/* =========================================================================
   FiveMScripts Control Panel - gleiches Design-System wie der Shop
   ========================================================================= */

:root {
  --bg: #030814;
  --surface: #0a1426;
  --surface-2: #0f1c33;
  --surface-3: #142441;
  --border: rgba(140, 180, 255, 0.11);
  --border-strong: rgba(0, 175, 255, 0.4);
  --text: #ffffff;
  --text-soft: #c9d4e3;
  --text-dim: #8d9cb4;
  --blue: #00afff;
  --blue-strong: #005bff;
  --blue-dim: rgba(0, 175, 255, 0.12);
  --green: #35d07f;
  --green-dim: rgba(53, 208, 127, 0.12);
  --gold: #f6b730;
  --gold-dim: rgba(246, 183, 48, 0.12);
  --danger: #ff5c6a;
  --danger-dim: rgba(255, 92, 106, 0.12);
  --radius: 6px;
  --radius-sm: 4px;
  --sidebar: 248px;
  --font-display: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  --font-body: "Barlow Semi Condensed", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-condensed-600-latin.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-condensed-700-latin.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url("../assets/fonts/barlow-condensed-800-latin.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 400; font-display: swap; src: url("../assets/fonts/barlow-semi-condensed-400-latin.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 500; font-display: swap; src: url("../assets/fonts/barlow-semi-condensed-500-latin.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-semi-condensed-600-latin.woff2") format("woff2"); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; line-height: 1.05; text-transform: uppercase; letter-spacing: 0.2px; margin: 0 0 0.4em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; color: var(--text-dim); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--font-mono); font-size: 0.88em; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
::selection { background: var(--blue); color: #021022; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: radial-gradient(ellipse at top, rgba(0, 91, 255, 0.18), transparent 60%), var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  text-align: center;
}
.login-card img { margin: 0 auto 18px; }
.login-card h1 { font-size: 1.9rem; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 8px; }
.login-card .small { font-size: 0.85rem; margin-top: 18px; margin-bottom: 0; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand span { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; text-transform: uppercase; line-height: 1; }
.brand small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 0.72rem; color: var(--blue); letter-spacing: 1.5px; margin-top: 3px; }
.nav-label { font-family: var(--font-display); font-weight: 700; font-size: 0.78rem; letter-spacing: 1.4px; text-transform: uppercase; color: var(--text-dim); padding: 16px 10px 6px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--blue-dim); color: var(--blue); }
.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.sidebar-foot .who small { color: var(--text-dim); font-size: 0.8rem; }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-3); flex: none; object-fit: cover; display: grid; place-items: center; font-weight: 700; color: var(--text-soft); }
.avatar.sm { width: 26px; height: 26px; font-size: 0.75rem; }

.topbar { display: none; }
.main { min-width: 0; padding: 32px clamp(16px, 3vw, 40px) 60px; max-width: 1280px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 24px; }
.page-head p { margin: 0; }

/* ---------- Bausteine ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { font-size: 0.82rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; font-family: var(--font-display); font-weight: 700; }
.stat .value { font-family: var(--font-display); font-weight: 800; font-size: 2rem; line-height: 1.1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .value.blue { color: var(--blue); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { text-decoration: none; border-color: var(--border-strong); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--blue-strong)); color: #fff; }
.btn-primary:hover { border-color: transparent; opacity: 0.92; }
.btn-discord { background: #5865f2; color: #fff; }
.btn-discord:hover { border-color: transparent; opacity: 0.92; }
.btn-danger { background: var(--danger-dim); color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 0.88rem; }
.btn-icon { min-height: 32px; width: 32px; padding: 0; justify-content: center; background: transparent; border-color: var(--border); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-soft); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--green-dim); color: var(--green); }
.badge.bad { background: var(--danger-dim); color: var(--danger); }
.badge.warn { background: var(--gold-dim); color: var(--gold); }
.badge.info { background: var(--blue-dim); color: var(--blue); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--text-soft); }
.field .hint { font-size: 0.8rem; color: var(--text-dim); }
.input, select.input, textarea.input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}
textarea.input { min-height: 120px; resize: vertical; font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--blue); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.toolbar .input { width: auto; flex: 1 1 200px; }
.toolbar select.input { flex: 0 1 180px; }

.notice { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft); font-size: 0.93rem; }
.notice.error { border-color: rgba(255, 92, 106, 0.35); background: var(--danger-dim); color: #ffc2c8; }
.notice.ok { border-color: rgba(53, 208, 127, 0.35); background: var(--green-dim); color: #b9f3d2; }
.notice.warn { border-color: rgba(246, 183, 48, 0.35); background: var(--gold-dim); color: #fbe2a8; }
.empty { text-align: center; padding: 48px 20px; color: var(--text-dim); }
.empty h2 { color: var(--text); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; font-size: 0.8rem; color: var(--text-dim); background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }
td .sub { display: block; font-size: 0.8rem; color: var(--text-dim); }
.user-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }

/* ---------- Lizenz-Karten (Kunde) ---------- */
.license { display: grid; grid-template-columns: 180px 1fr; gap: 22px; }
.license-media { border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); aspect-ratio: 16 / 10; }
.license-media img { width: 100%; height: 100%; object-fit: cover; }
.license-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.license-head h2 { margin: 0; }
.keybox { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 6px 6px 12px; margin-bottom: 16px; }
.keybox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 1px; font-size: 0.95rem; }
.section-label { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; font-size: 0.85rem; color: var(--text-dim); margin: 18px 0 8px; }
.ip-list { display: grid; gap: 6px; margin-bottom: 10px; }
.ip-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm); }
.ip-item code { font-size: 0.95rem; }
.ip-item .label { color: var(--text-dim); font-size: 0.88rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ip-form { display: flex; flex-wrap: wrap; gap: 8px; }
.ip-form .input { flex: 1 1 160px; width: auto; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.88rem; color: var(--text-dim); }
.meta strong { color: var(--text-soft); font-weight: 600; }
pre.snippet { margin: 0; padding: 12px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow-x: auto; font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-soft); }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(1, 4, 12, 0.72); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { margin: 0; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 0.92rem; margin-bottom: 8px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

.toast { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 11px 18px; border-radius: var(--radius-sm); background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); font-weight: 500; }
.toast.error { border-color: var(--danger); }

.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 40px; gap: 10px; align-items: center; font-size: 0.92rem; }
.bar-track { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--blue); border-radius: 4px; }
.bar-row span:last-child { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-soft); }

.product-thumb { width: 64px; height: 40px; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface-2); }
.build-output { max-height: 280px; white-space: pre-wrap; }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: min(280px, 85vw); transform: translateX(-100%); transition: transform 0.2s; }
  .shell.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, 0.6); }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
  .topbar span { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: 1.15rem; }
  .main { padding: 22px 16px 48px; }
  .license { grid-template-columns: 1fr; }
  .license-media { max-width: 320px; }
  h1 { font-size: 1.7rem; }
}
@media (max-width: 520px) {
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}
