/* ===========================================================
   surgebright Tools – gemeinsame Gestaltung (v4 – mit Dunkelmodus)
   -----------------------------------------------------------
   Wird von allen Werkzeugen unter tools.surgebright.com als
   erstes Stylesheet eingebunden (<link href="/assets/ui.css?v=4">)
   und liefert die verbindlichen Farben, Schriften und Maße.

   Aufbau:
   1) Tokens (alle alten Namen bleiben als Synonyme gültig)
   2) Grundlagen (Schrift, Fokus, Scrollbalken)
   3) Shell-Angleich: Seitenleiste, Navigation, Karten, Tabellen,
      Tags/Pills, Eingaben – überschreibt die lokalen Stile der
      Werkzeuge über höhere Spezifität ("body …", ".layout …").
      Beide Namensschemata werden abgedeckt:
        YT Suite:            aside            + .nav-item
        SEO Suite / WET LAB: .sidebar         + .nav button
   4) Werkzeug-Umschalter (wird von /assets/shell.js eingebaut)
   5) Dunkelmodus: :root[data-theme="dark"] setzt die Tokens um
      (Werte wie im Sales Dashboard) + zentrale Nachbesserungen.
      Umschalten/Speichern: /assets/theme.js (localStorage sb_theme).

   Neue Farben immer NUR hier ändern.
   =========================================================== */

:root {
  /* Flächen */
  --bg: #f2f5f8;
  --card: #ffffff;
  --surface: #ffffff;
  --surface2: #f5f7fa;
  --slate: #0c1723;          /* Seitenleiste (Basiston) */
  --slate2: #12212f;
  --sidebar: #0c1723;
  --sidebar-grad: linear-gradient(180deg, #0e1b29 0%, #0a1420 100%);
  --sidebar-edge: rgba(151, 189, 214, .12);

  /* Linien */
  --line: #e2e8ee;
  --border: #e2e8ee;
  --line-strong: #cbd6de;
  --border2: #cbd6de;

  /* Schriftfarben */
  --ink: #0e1620;
  --text: #0e1620;
  --ink2: #3d4b58;
  --text2: #5d6d7b;
  --muted: #5d6d7b;

  /* Seitenleisten-Schriftfarben */
  --side-text: #a9bac6;
  --side-text-dim: #5f7484;
  --side-active: #eaf6fd;

  /* Akzent (surgebright-Blau) */
  --accent: #2babe3;
  --accent-dark: #1585ba;
  --accent-bright: #6ecdf6;  /* auf dunklem Grund */
  --accent-soft: #e9f6fd;
  --accent-line: #c9e8f8;

  /* Status */
  --ok: #148a58;
  --green: #148a58;
  --warn: #c98a0b;
  --amber: #96700a;
  --bad: #d3453f;
  --red: #d3453f;

  /* Status-Flächen (getönt) */
  --ok-soft: #e3f4eb;
  --warn-soft: #faf1dc;
  --bad-soft: #fbe9e8;

  /* Form */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(13, 25, 38, .05), 0 1px 1px rgba(13, 25, 38, .03);
  --shadow-md: 0 10px 28px -6px rgba(13, 25, 38, .14), 0 2px 6px rgba(13, 25, 38, .05);
  --shadow-pop: 0 18px 50px -12px rgba(13, 25, 38, .25), 0 4px 12px rgba(13, 25, 38, .08);

  /* Schriften */
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
}

/* ── 2) Grundlagen ── */
body { font-family: var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.mono, code, kbd { font-family: var(--font-mono); }
button, input, select, textarea { font-family: inherit; }

::selection { background: rgba(43, 171, 227, .22); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Dezente Scrollbalken (WebKit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3ced8; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #a9b7c3; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Wortmarke + Werkzeug-Chip (Bestandsklassen) ── */
.sb-wordmark { font-weight: 700; font-size: 18px; color: #fff; letter-spacing: -.01em; line-height: 1; }
.sb-wordmark span { color: var(--accent); }
.sb-chip {
  display: inline-block; margin-top: 6px;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase;
  background: rgba(43, 171, 227, .15); color: var(--accent-bright);
  padding: 3px 8px; border-radius: 5px;
}
.sb-chip-light {
  background: var(--accent-soft); color: var(--accent-dark);
  border: 1px solid var(--accent-line);
}

/* ═══════════════════════════════════════════════════════════
   3) SHELL-ANGLEICH  (überschreibt lokale Werkzeug-Stile)
   ═══════════════════════════════════════════════════════════ */

/* ── Seitenleiste ── */
body .layout aside, body .layout .sidebar {
  background: var(--sidebar-grad);
  border-right: 1px solid var(--sidebar-edge);
  color: var(--side-text);
}

/* Markenblock */
body .layout aside .side-brand, body .layout .sidebar .brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(151, 189, 214, .1);
}
body .layout aside .side-brand .t, body .layout .sidebar .brand .wordmark {
  font-size: 17px; font-weight: 700; color: #fff; letter-spacing: -.015em;
}
body .layout aside .side-brand .s, body .layout .sidebar .brand .chip {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase;
  background: rgba(43, 171, 227, .15); color: var(--accent-bright);
  padding: 3px 8px; border-radius: 5px; margin-top: 7px;
}

/* Abschnitts-Beschriftungen */
body .layout aside .side-sec, body .layout .sidebar .siteswitch .lbl {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase; color: var(--side-text-dim);
}

/* Navigationseinträge – beide Schemata */
body .layout aside .nav-item,
body .layout .sidebar .nav button {
  position: relative;
  color: var(--side-text); font-size: 13.5px; font-weight: 500;
  border-radius: 8px; transition: background .12s, color .12s;
}
body .layout aside .nav-item svg,
body .layout .sidebar .nav button svg { stroke: currentColor; opacity: .85; }
body .layout aside .nav-item:hover,
body .layout .sidebar .nav button:hover {
  background: rgba(255, 255, 255, .05); color: #fff;
}
body .layout aside .nav-item.active,
body .layout .sidebar .nav button.active {
  background: rgba(43, 171, 227, .13);
  color: var(--side-active); font-weight: 600;
}
body .layout aside .nav-item.active svg,
body .layout .sidebar .nav button.active svg { stroke: var(--accent-bright); opacity: 1; }
body .layout aside .nav-item.active::before,
body .layout .sidebar .nav button.active::before {
  content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px;
  border-radius: 3px; background: var(--accent);
}
/* Einheitlicher Portal-Button (Markup kommt aus /assets/shell.js) */
.sb-portal-btn {
  display: flex; align-items: center; gap: 9px; margin-top: 10px;
  padding: 9px 11px; border: 1px solid rgba(151, 189, 214, .16); border-radius: 8px;
  background: rgba(255, 255, 255, .04); color: var(--side-text);
  font-size: 13px; font-weight: 500; text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}
.sb-portal-btn:hover { background: rgba(255, 255, 255, .09); color: #fff; text-decoration: none; border-color: rgba(151, 189, 214, .28); }
.sb-portal-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* Auswahl-/Umschaltflächen in der Seitenleiste (Kanal, Website) */
body .layout aside .chan-box select,
body .layout .sidebar .siteswitch .cur {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(151, 189, 214, .16);
  border-radius: 8px; color: #e8f0f6;
}
body .layout .sidebar .siteswitch .cur:hover,
body .layout aside .chan-box select:hover { background: rgba(255, 255, 255, .1); }

/* Fußzeilen */
body .layout aside .side-foot, body .layout .sidebar .sidefoot {
  border-top: 1px solid rgba(151, 189, 214, .1); color: var(--side-text-dim);
}
body .layout .sidebar .sidefoot b { color: var(--side-text); }
body .layout .sidebar .sidefoot .portal-link { color: var(--side-text-dim); }
body .layout .sidebar .sidefoot .portal-link:hover { color: #fff; }

/* ── Karten: ruhige Fläche statt Akzentstreifen ── */
body .card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
body .card::before { display: none; }

/* ── Schaltflächen ── */
body .btn { border-radius: var(--radius-sm); letter-spacing: .01em; }
body .btn:not(.sec):not(.danger):not(:disabled) { box-shadow: 0 1px 2px rgba(21, 133, 186, .3); }
body .btn:not(.sec):not(.danger):hover { background: var(--accent-dark); }

/* ── Tags / Pills: ein System für beide Namensschemata ── */
body .tag, body .pill { font-weight: 500; }
body .tag-ok,   body .pill.ok    { background: var(--ok-soft);   color: var(--ok); }
body .tag-warn, body .pill.warn  { background: var(--warn-soft); color: var(--amber); }
body .tag-err,  body .pill.bad   { background: var(--bad-soft);  color: #b2372f; }
body .tag-info, body .pill.info  { background: var(--accent-soft); color: var(--accent-dark); }
body .tag-none, body .pill.gray  { background: #edf1f5; color: var(--muted); }

/* ── Tabellen ── */
body th {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line);
}
body td { border-bottom: 1px solid #eef2f6; }
body tr:hover td { background: #f7fafc; }

/* ── Eingabefelder: einheitlicher Fokusring ── */
body .field input:focus, body .field select:focus, body .field textarea:focus,
body input[type=text]:focus, body input[type=password]:focus, body input[type=number]:focus,
body input[type=date]:focus, body input[type=time]:focus, body input[type=search]:focus,
body select:focus, body textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43, 171, 227, .16);
}

/* ═══════════════════════════════════════════════════════════
   4) WERKZEUG-UMSCHALTER  (Markup kommt aus /assets/shell.js)
   ═══════════════════════════════════════════════════════════ */
.sb-switch-row { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.sb-switch-row > * { margin-top: 0 !important; }
.sb-switch-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border: 0; border-radius: 5px; cursor: pointer;
  background: rgba(255, 255, 255, .07); color: var(--side-text);
  transition: background .12s, color .12s; padding: 0;
}
.sb-switch-btn:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.sb-switch-btn svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.sb-pop {
  position: absolute; left: 12px; top: 100%; margin-top: -6px; z-index: 80;
  min-width: 216px; padding: 6px;
  background: #101f2d; border: 1px solid rgba(151, 189, 214, .16);
  border-radius: 12px; box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-4px) scale(.98); pointer-events: none;
  transition: opacity .13s ease, transform .13s ease;
}
.sb-pop.open { opacity: 1; transform: none; pointer-events: auto; }
.sb-pop-label {
  font-family: var(--font-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase; color: var(--side-text-dim);
  padding: 7px 10px 5px;
}
.sb-pop a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; text-decoration: none;
  color: var(--side-text); font-size: 13.5px; font-weight: 500;
}
.sb-pop a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.sb-pop a.current { color: var(--side-active); font-weight: 600; }
.sb-pop a.current .sb-pop-dot { opacity: 1; }
.sb-pop-mono {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  background: rgba(43, 171, 227, .13); color: var(--accent-bright);
}
.sb-pop-mono.home { background: rgba(255, 255, 255, .08); color: var(--side-text); }
.sb-pop-mono.home svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sb-pop-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: auto; opacity: 0; flex-shrink: 0; }
.sb-pop-sep { border: 0; border-top: 1px solid rgba(151, 189, 214, .12); margin: 5px 4px; }


/* ═══════════════════════════════════════════════════════════
   5) DUNKELMODUS  (Umschalter: /assets/theme.js + shell.js)
   Token-Werte identisch zum Sales Dashboard.
   ═══════════════════════════════════════════════════════════ */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b141d;
  --card: #12212f;
  --surface: #12212f;
  --surface2: #172a3a;
  --line: #22384a;
  --border: #22384a;
  --line-strong: #2e4a60;
  --border2: #2e4a60;
  --ink: #eef3f7;
  --text: #eef3f7;
  --ink2: #c2cfd9;
  --text2: #9fb2c1;
  --muted: #8fa3b3;
  --accent-soft: #12324a;
  --accent-line: #1f4a66;
  --ok-soft: #123527;
  --warn-soft: #3a2d0c;
  --bad-soft: #3d1a18;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 10px 28px -6px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-pop: 0 18px 50px -12px rgba(0, 0, 0, .7), 0 4px 12px rgba(0, 0, 0, .4);
}
:root[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2e4a60; border: 2px solid transparent; background-clip: content-box; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #3d5c75; border: 2px solid transparent; background-clip: content-box; }
:root[data-theme="dark"] .sb-chip-light { background: var(--accent-soft); color: var(--accent-bright); border-color: var(--accent-line); }

/* Zentrale Nachbesserungen der Shell-Regeln aus Abschnitt 3 */
:root[data-theme="dark"] body td { border-bottom-color: #1c2f3f; }
:root[data-theme="dark"] body tr:hover td { background: #172a3a; }
:root[data-theme="dark"] body .tag-none, :root[data-theme="dark"] body .pill.gray { background: #22384a; color: var(--muted); }
:root[data-theme="dark"] body .tag-ok,   :root[data-theme="dark"] body .pill.ok   { color: #3fc48f; }
:root[data-theme="dark"] body .tag-warn, :root[data-theme="dark"] body .pill.warn { color: #e6b54a; }
:root[data-theme="dark"] body .tag-err,  :root[data-theme="dark"] body .pill.bad  { color: #f07d76; }
:root[data-theme="dark"] body .tag-info, :root[data-theme="dark"] body .pill.info { color: var(--accent-bright); }
:root[data-theme="dark"] body .card { background: var(--card); border-color: var(--line); }
:root[data-theme="dark"] body th { color: var(--muted); border-bottom-color: var(--line); }
:root[data-theme="dark"] body .btn.sec, :root[data-theme="dark"] body .btn.secondary, :root[data-theme="dark"] body .btn.ghost {
  background: var(--surface2); color: var(--ink); border-color: var(--line-strong);
}
:root[data-theme="dark"] body .btn.sec:hover, :root[data-theme="dark"] body .btn.secondary:hover, :root[data-theme="dark"] body .btn.ghost:hover { background: #1c3446; }
:root[data-theme="dark"] body input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]),
:root[data-theme="dark"] body select, :root[data-theme="dark"] body textarea {
  background: var(--surface2); color: var(--ink); border-color: var(--line-strong);
}
:root[data-theme="dark"] body input::placeholder, :root[data-theme="dark"] body textarea::placeholder { color: var(--side-text-dim); }
:root[data-theme="dark"] body select option { background: var(--surface2); color: var(--ink); }
:root[data-theme="dark"] body code, :root[data-theme="dark"] body kbd, :root[data-theme="dark"] body pre { background: var(--surface2); color: var(--ink2); }
:root[data-theme="dark"] body hr { border-color: var(--line); }
:root[data-theme="dark"] body ::selection { background: rgba(43, 171, 227, .35); }

/* Umschalter Hell/Dunkel (Markup kommt aus /assets/shell.js) */
.sb-foot-row { display: flex; align-items: stretch; gap: 6px; margin-top: 10px; }
.sb-foot-row .sb-portal-btn { flex: 1; margin-top: 0; min-width: 0; }
.sb-theme-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 36px; min-height: 36px; border: 1px solid rgba(151, 189, 214, .16); border-radius: 8px;
  background: rgba(255, 255, 255, .04); color: var(--side-text); cursor: pointer; padding: 0;
  transition: background .12s, color .12s, border-color .12s;
}
.sb-theme-btn:hover { background: rgba(255, 255, 255, .09); color: #fff; border-color: rgba(151, 189, 214, .28); }
.sb-theme-btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sb-theme-btn .sb-ic-sun { display: none; }
:root[data-theme="dark"] .sb-theme-btn .sb-ic-sun { display: block; }
:root[data-theme="dark"] .sb-theme-btn .sb-ic-moon { display: none; }
