/* =========================================================================
   GrowByte Control — panel design system (v17)

   Same visual language as the public site (Website/styles.css): same fonts,
   same tokens, same accent gradient. One cascade:

     1. fonts + tokens   (the only place a colour literal appears, apart from
                          brand colours that must not follow the theme)
     2. reset / base
     3. shell: sidebar, main, mobile bar
     4. primitives: page head, chips, cards, fields, buttons, tables
     5. page blocks
     6. sign-in screen
     7. responsive

   A later group may consume tokens and primitives but never re-declares an
   earlier selector; variants get a modifier class.
   ========================================================================= */

/* --- 1. Fonts and tokens -------------------------------------------------
   Self-hosted under /assets/fonts (public/fonts): no third-party request,
   works on an air-gapped deploy. latin + latin-ext per weight; the browser
   fetches latin-ext only when ş ğ İ appear (unicode-range). */
@font-face { font-family: "Unbounded"; src: url("/assets/fonts/unbounded-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; src: url("/assets/fonts/unbounded-latin-ext-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Unbounded"; src: url("/assets/fonts/unbounded-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; src: url("/assets/fonts/unbounded-latin-ext-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/assets/fonts/plus-jakarta-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/assets/fonts/plus-jakarta-sans-latin-ext-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/assets/fonts/plus-jakarta-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/assets/fonts/plus-jakarta-sans-latin-ext-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/assets/fonts/plus-jakarta-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("/assets/fonts/plus-jakarta-sans-latin-ext-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* Night (default). Values match the public site's :root. */
:root {
  color-scheme: dark;
  --bg: #07060c;
  --bg-soft: #0b0912;
  --rail: #0b0912;
  --surface: #110e1a;
  --surface-2: #17131f;
  --surface-3: #201a2c;
  --line: rgba(255, 255, 255, .075);
  --line-strong: rgba(255, 255, 255, .14);
  --highlight: rgba(255, 255, 255, .14);

  --text: #f4f1fa;
  --text-dim: #b8afc6;
  --muted: #8d849b;
  --faint: #655d74;

  --violet: #8b3bff;
  --magenta: #e13ce6;
  --accent-ink: #c49bff;
  --accent-soft: rgba(139, 59, 255, .14);
  --accent-line: rgba(174, 110, 255, .34);
  --grad: linear-gradient(118deg, #7c2bff, #d42ee0);

  --good: #37d99a;
  --good-soft: rgba(55, 217, 154, .12);
  --warn: #ffb545;
  --warn-soft: rgba(255, 181, 69, .12);
  --bad: #ff5470;
  --bad-soft: rgba(255, 84, 112, .12);

  --orb: rgba(124, 43, 255, .2);
  --grid-line: rgba(255, 255, 255, .028);
  --shadow: 0 18px 46px rgba(0, 0, 0, .45);
  --shadow-accent: 0 10px 30px rgba(139, 45, 230, .3);

  --radius: 16px;
  --radius-sm: 10px;
  --rail-w: 256px;
  --ease: cubic-bezier(.22, .68, 0, 1);

  --display: "Unbounded", "Segoe UI", system-ui, sans-serif;
  --body: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Code", Consolas, ui-monospace, monospace;

  /* v17: glass and glow tokens */
  --glass-bg: rgba(17, 14, 26, 0.72);
  --panel-glow: 0 0 0 1px rgba(174, 110, 255, .1), var(--shadow);
  --input-glow: 0 0 0 3px rgba(139, 59, 255, .22);
}

/* Day: token swap only. A rule below that hardcodes a colour will not follow
   the toggle -- that is the bug this structure exists to prevent. */
[data-theme=light] {
  color-scheme: light;
  --bg: #f6f4fb;
  --bg-soft: #f0edf7;
  --rail: #ffffff;
  --surface: #ffffff;
  --surface-2: #fbfaff;
  --surface-3: #f0ecf8;
  --line: rgba(30, 16, 50, .09);
  --line-strong: rgba(30, 16, 50, .16);
  --highlight: rgba(255, 255, 255, .9);

  --text: #170e24;
  --text-dim: #4a3f58;
  --muted: #706780;
  --faint: #978fa4;

  --accent-ink: #6a1fe0;
  --accent-soft: rgba(124, 43, 255, .09);
  --accent-line: rgba(124, 43, 255, .28);
  --good: #0f9d6a;
  --good-soft: rgba(15, 157, 106, .1);
  --warn: #b9701a;
  --warn-soft: rgba(185, 112, 26, .1);
  --bad: #d8294c;
  --bad-soft: rgba(216, 41, 76, .09);

  --orb: rgba(124, 43, 255, .09);
  --grid-line: rgba(30, 16, 50, .04);
  --shadow: 0 14px 34px rgba(60, 30, 100, .1);
  --shadow-accent: 0 10px 26px rgba(124, 43, 255, .24);
  --glass-bg: rgba(255, 255, 255, 0.72);
  --panel-glow: 0 0 0 1px rgba(124, 43, 255, .12), var(--shadow);
  --input-glow: 0 0 0 3px rgba(124, 43, 255, .15);
}

/* --- 2. Reset and base -------------------------------------------------- */
* { box-sizing: border-box; }
html { background: var(--bg); overflow-x: hidden; }
body {
  margin: 0; min-height: 100vh; overflow-x: hidden;
  background: var(--bg); color: var(--text);
  font: 400 14px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }
code { font-family: var(--mono); font-size: 12px; color: var(--accent-ink); }
.fa-solid, .fa-regular, .fa-brands { line-height: 1; }
::selection { background: rgba(139, 59, 255, .34); }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: 6px; box-shadow: 0 0 0 4px rgba(139, 59, 255, .18); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* --- 3. Shell ------------------------------------------------------------ */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--rail-w);
  display: flex; flex-direction: column; padding: 22px 14px 16px;
  background: var(--rail); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; }
.panel-logo { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.wordmark { display: block; font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.wordmark span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand small { display: block; margin-top: 2px; font-size: 10px; font-weight: 500; letter-spacing: .08em; color: var(--muted); }

.brand-glyph {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--grad); color: #fff; font-weight: 700;
}
.brand-glyph.large { width: 56px; height: 56px; border-radius: 16px; font-size: 22px; }

.sidebar nav { display: grid; gap: 2px; overflow-y: auto; }
.sidebar nav p {
  margin: 18px 10px 6px; font-family: var(--display); font-size: 9px; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--faint);
}
.sidebar nav a, .theme-button {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 13.5px; font-weight: 500;
  transition: background .16s, color .16s;
}
.sidebar nav a span, .theme-button span:first-child { width: 18px; text-align: center; }
.sidebar nav a span i, .theme-button span i { font-size: 13px; }
.sidebar nav a:hover, .theme-button:hover { color: var(--text); background: var(--accent-soft); }
/* Active row: tinted fill + gradient bar on the left, the same "you are here"
   language as the public site's nav underline. */
.sidebar nav a.active { color: var(--text); background: var(--accent-soft); }
.sidebar nav a.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 3px; background: var(--grad);
}
.sidebar nav a.active span i { color: var(--accent-ink); }

.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.theme-button { width: 100%; border: 0; background: none; cursor: pointer; }
.admin-card {
  display: flex; align-items: center; gap: 10px; margin: 10px 2px 8px; padding: 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.avatar {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px;
  border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink);
}
.avatar i { font-size: 13px; }
.admin-card strong, .admin-card small { display: block; }
.admin-card strong { font-size: 12.5px; }
.admin-card small { font-size: 11px; color: var(--muted); }
.signout {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: none; color: var(--muted); font-size: 12px; cursor: pointer;
  transition: color .16s, background .16s;
}
.signout:hover { color: var(--bad); background: var(--bad-soft); }

/* The content area carries the ambient glow and grid, anchored to it rather
   than the page so neither slides under the fixed rail. */
.main {
  position: relative; margin-left: var(--rail-w); min-height: 100vh;
  padding: 34px clamp(20px, 3.4vw, 52px) 64px;
  background:
    radial-gradient(ellipse 60% 38% at 85% -8%, var(--orb), transparent 70%),
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 56px 56px,
    var(--bg);
}
.mobilebar { display: none; }

/* --- 4. Primitives ------------------------------------------------------ */

/* Page header */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  margin-bottom: 26px;
}
.page-head h1 { margin: 8px 0 6px; font-size: clamp(22px, 2.6vw, 30px); }
.page-head h1 i { margin-right: 10px; color: var(--accent-ink); font-size: .8em; }
.page-head p { color: var(--muted); font-size: 13.5px; }
.eyebrow {
  font-family: var(--display); font-size: 10px !important; font-weight: 500;
  letter-spacing: .16em !important; text-transform: uppercase; color: var(--accent-ink) !important;
}
.back-link {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px;
  color: var(--muted); font-size: 13px; font-weight: 500; transition: color .16s;
}
.back-link:hover { color: var(--text); }

/* Status chips. An empty <i> is the state dot; an <i class="fa-…"> is a
   glyph and must not be turned into a circle. */
.status, .pill { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; border-radius: 100px; }
.status { padding: 8px 14px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 12px; font-weight: 500; }
.pill { padding: 4px 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 11px; font-weight: 600; text-transform: capitalize; }
.status > i:empty, .pill > i:empty { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.pill i.fa-solid, .status i.fa-solid { font-size: 11px; }
.good { color: var(--good) !important; }
.bad { color: var(--bad) !important; }
.warn { color: var(--warn) !important; }
.neutral { color: var(--muted) !important; }
.status.good, .pill.good { border-color: var(--good-soft); background: var(--good-soft); }
.status.bad, .pill.bad { border-color: var(--bad-soft); background: var(--bad-soft); }
.status.warn, .pill.warn { border-color: var(--warn-soft); background: var(--warn-soft); }

/* Cards */
.panel, .metrics article {
  position: relative; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(170deg, var(--surface-2), var(--surface));
  box-shadow: var(--panel-glow);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
}
/* Hairline along the top edge, same as the site's cards. */
.panel::before, .metrics article::before {
  content: ""; position: absolute; inset: 0 18px auto; height: 1px;
  background: linear-gradient(90deg, transparent, var(--highlight), transparent);
}
.panel { padding: 22px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.panel h2, .panel-head h2 { margin: 6px 0 0; font-size: 15px; }
.panel h3 i { margin-right: 8px; color: var(--accent-ink); }
.count { padding: 5px 11px; border: 1px solid var(--line); border-radius: 100px; font-size: 11px; color: var(--muted); white-space: nowrap; }

/* Metrics */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.metrics article { padding: 20px; overflow: hidden; }
.metrics span, .metrics small { display: block; color: var(--muted); font-size: 12px; }
.metrics span i { margin-right: 7px; color: var(--accent-ink); }
.metrics strong { display: block; margin: 10px 0 3px; font-family: var(--display); font-size: 26px; font-weight: 600; }

/* Layout */
.content-grid { display: grid; grid-template-columns: minmax(280px, .74fr) minmax(0, 1.26fr); gap: 16px; align-items: start; }
.panel.span-2 { grid-column: auto; }
.wide-panel { margin-top: 16px; }

/* Fields */
.stack { display: grid; gap: 14px; }
.stack label { display: grid; gap: 6px; color: var(--text-dim); font-size: 12px; font-weight: 500; }
.stack input, .stack textarea, .stack select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--bg-soft); color: var(--text); outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.stack input:focus, .stack textarea:focus, .stack select:focus { border-color: var(--violet); box-shadow: var(--input-glow); }
.stack textarea { resize: vertical; }
.stack input[type=file] { padding: 10px; border-style: dashed; color: var(--muted); cursor: pointer; }
.check { display: flex !important; align-items: center; gap: 10px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.check input { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--violet); }
.hint, .muted { color: var(--muted); font-size: 12px; }
.hint i { margin-right: 6px; color: var(--accent-ink); }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; padding: 10px; text-align: center; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--bg-soft); font-size: 12.5px; color: var(--muted); transition: .16s;
}
.segmented input:checked + span { color: var(--text); border-color: var(--violet); background: var(--accent-soft); }
.segmented input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform .16s var(--ease), box-shadow .16s, background .16s, border-color .16s, color .16s;
}
.button:active { transform: translateY(1px); }
.button i { font-size: 12px; }
.button.primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-accent); }
.button.primary:hover { transform: translateY(-1px); }
.button.subtle { border-color: var(--line-strong); background: var(--surface-2); color: var(--text-dim); }
.button.subtle:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.button.danger { border-color: var(--bad-soft); background: var(--bad-soft); color: var(--bad); }
.button.danger:hover { background: rgba(255, 84, 112, .2); }
.button.subtle.danger { background: var(--surface-2); }
.button.subtle.danger:hover { background: var(--bad-soft); }
.button.compact { padding: 7px 11px; font-size: 11px; }
.button.block { width: 100%; }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.icon-button {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface-2); color: var(--muted); cursor: pointer; transition: .16s;
}
.icon-button:hover { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }
.icon-button.danger:hover { color: var(--bad); border-color: var(--bad-soft); background: var(--bad-soft); }
.icon-button i { font-size: 12px; }

.action-button {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer;
  transition: transform .16s, background .16s, color .16s, border-color .16s;
}
.action-button:hover { transform: translateY(-1px); color: var(--text); }
.action-button.freeze { color: var(--warn); border-color: var(--warn-soft); background: var(--warn-soft); }
.action-button.activate { color: var(--good); border-color: var(--good-soft); background: var(--good-soft); }
.action-button.reset:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.action-button.delete { color: var(--bad); border-color: var(--bad-soft); background: var(--bad-soft); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions form { margin: 0; }

.text-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 16px; color: var(--accent-ink); font-size: 12.5px; font-weight: 600; }
.text-link:hover { color: var(--magenta); }

/* Tables */
.table-wrap { max-width: 100%; margin: 0 -6px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; }
table { width: 100%; border-collapse: collapse; }
.license-table { min-width: 560px; }
th {
  padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left;
  font-family: var(--display); font-size: 9.5px; font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint);
}
td { padding: 13px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); vertical-align: middle; }
tbody tr { transition: background .14s; }
tbody tr:hover { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: 0; }
td strong, td small { display: block; }
td strong { color: var(--text); font-weight: 600; }
td small { margin-top: 3px; font-size: 11px; }
td code i { margin-right: 4px; color: var(--muted); font-size: 11px; }
.empty { padding: 36px; text-align: center; color: var(--muted); }
.version-row { cursor: pointer; }
/* Whole licence row is a link target (see app.js [data-href]); the pointer
   says so, and buttons inside the row keep their own behaviour. */
tr[data-href] { cursor: pointer; }

/* --- 5. Page blocks ----------------------------------------------------- */

/* Dashboard timeline */
.timeline { display: grid; gap: 12px; }
.timeline > div { display: flex; align-items: flex-start; gap: 11px; }
.timeline-icon {
  display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px;
  border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink);
}
.timeline-icon i { font-size: 11px; }
.timeline p { margin: 0; font-size: 12px; color: var(--muted); }
.timeline p strong { display: inline; color: var(--text); }
.timeline small { display: block; margin-top: 2px; font-size: 10.5px; color: var(--faint); }

/* Banners */
.notice {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 14px 16px;
  border: 1px solid var(--accent-line); border-radius: 12px; background: var(--accent-soft);
}
.notice code { overflow-wrap: anywhere; }
.security-banner {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 15px 18px;
  border: 1px solid var(--bad-soft); border-radius: 12px; background: var(--bad-soft); color: var(--bad);
}
.security-banner span { flex: 1; }
.security-banner strong, .security-banner small { display: block; }
.security-banner small { margin-top: 3px; font-size: 11px; color: var(--muted); }

/* Quick links strip (dashboard) and info strip (other pages) */
.security-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.security-strip > div {
  display: flex; align-items: center; gap: 12px; padding: 15px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.security-strip > div > i { font-size: 17px; color: var(--accent-ink); }
.security-strip > div > span { flex: 1; min-width: 0; }
.security-strip b, .security-strip small { display: block; }
.security-strip b { font-size: 13px; }
.security-strip small { margin-top: 2px; font-size: 11px; color: var(--muted); }

/* Logs */
.log-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.actor { display: inline-flex; align-items: center; gap: 6px; }
.actor i { color: var(--accent-ink); }
.message { max-width: 440px; overflow-wrap: anywhere; }
/* Source switcher on the Logs page; keeps the licence filter in each link. */
.tabs {
  display: inline-flex; gap: 4px; margin-bottom: 16px; padding: 4px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.tabs a {
  padding: 8px 14px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--muted);
  transition: background .16s, color .16s;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: #fff; background: var(--grad); }
/* "Showing logs for licence X" bar with a one-click clear. */
.filter-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 16px;
  border: 1px solid var(--accent-line); border-radius: 12px; background: var(--accent-soft); font-size: 13px;
}
.filter-bar i { color: var(--accent-ink); }
.filter-bar strong { color: var(--text); }
.filter-bar a { margin-left: auto; color: var(--accent-ink); font-weight: 600; }

/* Created-key screen */
.reveal-card { max-width: 620px; margin: auto; padding: 42px; text-align: center; }
.success-mark {
  display: grid; place-items: center; margin: 0 auto 14px; width: 54px; height: 54px;
  border-radius: 50%; background: var(--good-soft); color: var(--good); font-size: 22px;
}
.secret {
  display: block; margin: 20px 0; padding: 16px; border: 1px dashed var(--accent-line); border-radius: 12px;
  background: var(--bg-soft); font-size: 16px; overflow-wrap: anywhere;
}
.actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

/* Licence summary page -------------------------------------------------- */
.license-hero {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; padding: 22px 24px;
}
.license-hero .avatar { width: 52px; height: 52px; border-radius: 14px; font-size: 20px; }
.license-hero .avatar i { font-size: 20px; }
.license-hero h1 { font-size: clamp(20px, 2.4vw, 26px); }
.license-hero .sub { margin-top: 6px; color: var(--muted); font-size: 13px; }
.license-hero .status { margin-left: auto; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.kpi span { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); }
.kpi span i { color: var(--accent-ink); font-size: 12px; }
.kpi b { display: block; margin-top: 8px; font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--text); }
.kpi small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* Vertical list of one-tap actions; each row is its own <form>. */
.action-list { display: grid; gap: 8px; }
.action-list form { margin: 0; }
.action-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
  color: var(--text); text-align: left; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: border-color .16s, background .16s, transform .16s;
}
.action-row:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.action-row .ar-icon {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent-ink);
}
.action-row small { display: block; margin-top: 1px; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.action-row > span:nth-child(2) { flex: 1; }
.action-row .chev { color: var(--faint); font-size: 11px; }
.action-row.danger .ar-icon { background: var(--bad-soft); color: var(--bad); }
.action-row.danger:hover { border-color: var(--bad-soft); background: var(--bad-soft); }
.action-row.good .ar-icon { background: var(--good-soft); color: var(--good); }
.action-row.warn .ar-icon { background: var(--warn-soft); color: var(--warn); }
.action-row.done .ar-icon { background: var(--good-soft); color: var(--good); }
/* Inline "add days" row: number field + button on one line. */
.inline-form { display: flex; gap: 8px; align-items: stretch; }
.inline-form input {
  width: 92px; flex: none; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-soft); color: var(--text); outline: none;
}
.inline-form input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px var(--accent-soft); }
.inline-form .button { flex: 1; }
.license-note { margin-top: 14px; }
.danger-zone { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-strong); }

/* DLL deployment ---------------------------------------------------------- */
.deploy { max-width: 760px; }
.deploy-status { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 18px 20px; margin-bottom: 16px; }
.deploy-status .ar-icon {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 18px;
}
.deploy-status .meta { flex: 1; min-width: 200px; }
.deploy-status strong { display: block; font-size: 14px; }
.deploy-status small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

.drop-zone {
  display: grid !important; place-items: center; gap: 6px; padding: 34px 20px !important; text-align: center;
  border: 2px dashed var(--accent-line) !important; border-radius: 16px; background: var(--accent-soft);
  cursor: pointer; transition: background .16s, border-color .16s, transform .16s;
}
.drop-zone:hover, .drop-zone.dragging { background: rgba(139, 59, 255, .2); border-color: var(--violet) !important; }
.drop-zone.dragging { transform: scale(1.01); }
.drop-zone > i { font-size: 30px; color: var(--accent-ink); }
.drop-zone b { font-size: 15px; color: var(--text); }
.drop-zone small { color: var(--muted); font-size: 12px; }
.drop-zone .file-name {
  margin-top: 6px; padding: 5px 12px; border-radius: 100px; background: var(--surface);
  color: var(--text); font-size: 12px; font-weight: 600;
}
/* The input stays in the DOM for keyboard + screen-reader access and for
   dll-upload.js, which reads it; it is visually replaced by the zone. */
.drop-zone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone { position: relative; }

.advanced { margin-top: 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.advanced summary { padding: 12px 14px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-dim); list-style: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary i { margin-right: 8px; color: var(--accent-ink); transition: transform .2s; }
.advanced[open] summary i { transform: rotate(90deg); }
.advanced > div { padding: 0 14px 14px; display: grid; gap: 12px; }

.upload-message {
  margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--accent-line); border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--text-dim); font-size: 12.5px; overflow-wrap: anywhere;
}
.upload-message.success { border-color: var(--good-soft); background: var(--good-soft); color: var(--good); }
.upload-message.failure { border-color: var(--bad-soft); background: var(--bad-soft); color: var(--bad); }

/* Legacy DLL/deployment blocks still used by other pages. */
.artifact-card { display: flex; align-items: center; gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); }
.artifact-card > div { flex: 1; min-width: 0; }
.artifact-card strong, .artifact-card small { display: block; }
.artifact-card small { margin-top: 4px; font-size: 11px; color: var(--muted); }
.artifact-icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-ink); font-size: 18px; }
.details { margin: 16px 0; }
.details div { display: flex; justify-content: space-between; gap: 14px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.details div:last-child { border-bottom: 0; }
.details dt { color: var(--muted); font-size: 12px; }
.details dd { margin: 0; font-size: 12px; }
.split-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }
.split-actions form, .split-actions button { width: 100%; }

/* Redirect page */
.info-stack { display: grid; gap: 14px; }
.info-stack > div { display: flex; gap: 12px; }
.info-stack b { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; }
.info-stack p { margin: 4px 0; color: var(--muted); font-size: 12.5px; }
.code-editor { font-family: var(--mono) !important; font-size: 12px !important; line-height: 1.6; }

/* Security page */
.trace-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: center; margin-bottom: 16px; }
.trace-panel h2 { margin: 6px 0 7px; }
.trace-form { display: grid; gap: 9px; }
.trace-form input[type=file] { padding: 11px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-soft); color: var(--muted); }
.trace-panel > #traceResult { grid-column: 1 / -1; margin: 0; }

/* --- 6. Sign-in screen --------------------------------------------------
   Single centred card on the site's backdrop (grid + orbs). */
.login-page {
  display: grid; place-items: center; min-height: 100vh; padding: 28px; overflow: auto;
  background: var(--bg);
}
.login-page::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 10%, transparent 75%);
}
.login-orb { position: fixed; border-radius: 50%; filter: blur(90px); pointer-events: none; }
.orb-one { width: 560px; height: 560px; left: -200px; top: -220px; background: radial-gradient(circle, rgba(124, 43, 255, .45), transparent 65%); }
.orb-two { width: 480px; height: 480px; right: -180px; bottom: -220px; background: radial-gradient(circle, rgba(212, 46, 224, .28), transparent 65%); }
[data-theme=light] .orb-one { opacity: .45; }
[data-theme=light] .orb-two { opacity: .45; }

.auth-shell {
  position: relative; z-index: 2; width: min(420px, 100%);
  border: 1px solid var(--line-strong); border-radius: 22px;
  background: linear-gradient(170deg, var(--surface-2), var(--surface)); box-shadow: 0 34px 90px rgba(0, 0, 0, .45);
}
.auth-card { padding: 38px 36px 30px; }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; text-align: center; }
.auth-logo img { width: 60px; height: 60px; border-radius: 16px; object-fit: cover; box-shadow: var(--shadow-accent); }
.auth-logo .wordmark { font-size: 22px; }
.auth-logo small { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.auth-heading { text-align: center; }
.auth-heading h1 { margin: 0 0 6px; font-size: 20px; }
.auth-heading p { color: var(--muted); font-size: 13px; }
.auth-form { margin-top: 24px; gap: 14px; }
.input-wrap {
  display: flex; align-items: center; height: 48px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--bg-soft); transition: .18s;
}
.input-wrap:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-wrap > span { width: 44px; text-align: center; color: var(--muted); }
.input-wrap > span i { font-size: 13px; }
/* The wrapper owns border + focus ring; the inner input drops its own. */
.stack .input-wrap input { height: 100%; padding: 0 12px 0 0; border: 0 !important; background: transparent !important; box-shadow: none !important; }
.auth-submit { width: 100%; height: 48px; margin-top: 4px; font-size: 14px; border-radius: 12px; }
.auth-security { margin-top: 20px; text-align: center; color: var(--faint); font-size: 11.5px; }
.auth-security i { margin-right: 6px; color: var(--accent-ink); }
.error {
  display: flex; align-items: center; gap: 9px; margin: 18px 0 0; padding: 11px 13px;
  border: 1px solid var(--bad-soft); border-radius: var(--radius-sm); background: var(--bad-soft); color: var(--bad); font-size: 12.5px;
}
.floating-theme {
  position: fixed; right: 20px; top: 20px; z-index: 5; display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text-dim); cursor: pointer;
}
.floating-theme:hover { color: var(--text); border-color: var(--accent-line); }

/* --- 7. v17 Enhancements ------------------------------------------------
   Animations and improvements added in v17. All use var() tokens and
   respect prefers-reduced-motion at the bottom of this file. */

/* Custom scrollbar — thin accent bar, invisible track */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }

/* Status dot pulse — the glow contracts and expands on a cycle to suggest
   liveness without distracting from the number next to it. */
@keyframes gb-pulse {
  0%, 100% { box-shadow: 0 0 6px 0 currentColor; }
  50% { box-shadow: 0 0 10px 3px currentColor; }
}
.status > i:empty, .pill > i:empty { animation: gb-pulse 2.4s ease-in-out infinite; }

/* Sidebar active-row accent bar: slides in from the top to announce the
   route change rather than simply appearing. */
@keyframes gb-bar-in {
  from { transform: scaleY(0); opacity: 0; }
  to   { transform: scaleY(1); opacity: 1; }
}
.sidebar nav a.active::before { transform-origin: top; animation: gb-bar-in .2s var(--ease) both; }

/* Metric number ambient glow — just enough violet to link it to the brand. */
.metrics strong { text-shadow: 0 0 32px rgba(139, 59, 255, .28); }

/* Primary button: animated gradient shift so the purple-to-magenta sweep is
   always in motion — signals interactability without layout movement. */
@keyframes gb-shimmer {
  from { background-position: 0% 50%; }
  to   { background-position: 100% 50%; }
}
.button.primary {
  background: linear-gradient(118deg, #6a1be0, #7c2bff, #d42ee0, #9533ff, #6a1be0);
  background-size: 300% 100%;
  animation: gb-shimmer 5s linear infinite;
}

/* Card fade-up on first paint — staggered per column so the grid builds left
   to right. Delay is intentionally short to stay snappy. */
@keyframes gb-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.metrics article { animation: gb-fade-up .35s var(--ease) both; }
.metrics article:nth-child(2) { animation-delay: .05s; }
.metrics article:nth-child(3) { animation-delay: .10s; }
.metrics article:nth-child(4) { animation-delay: .15s; }

/* Table row hover: left accent bar telegraphs the row that is about to be
   clicked without the full blue tint shifting the layout. */
tbody tr:hover td:first-child { box-shadow: inset 3px 0 var(--violet); }

/* Auth shell: glassmorphism card over the ambient orbs. backdrop-filter runs
   before the shadow so the card looks like it's floating in the glow rather
   than pasted on top of it. */
.auth-shell {
  background: linear-gradient(170deg, rgba(23, 19, 31, 0.88), rgba(17, 14, 26, 0.80));
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
}
[data-theme=light] .auth-shell {
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.86), rgba(246, 244, 251, 0.80));
}

/* Login orbs: give them a slow float so they aren't completely static behind
   the glass card. The Y offset is small to avoid motion-sensitive discomfort. */
@keyframes gb-orb-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-18px); }
}
.orb-one { animation: gb-orb-float 12s ease-in-out infinite; }
.orb-two { animation: gb-orb-float 15s ease-in-out infinite reverse; }

/* Sidebar: subtle glow behind the fixed rail so it separates from the main
   area on screens where the orb gradient bleeds through. */
.sidebar { box-shadow: 2px 0 24px rgba(0, 0, 0, .18); }

/* KPI cards on the licence detail page match the metric-card treatment. */
.kpi { transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-accent); }

/* --- 8. Responsive ----------------------------------------------------- */
@media (max-width: 1100px) {
  .metrics, .kpis { grid-template-columns: 1fr 1fr; }
  .content-grid, .split { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  /* Rail slides over the content; .menu-open on <body> (app.js). */
  .sidebar { max-width: 86vw; transform: translateX(-100%); transition: transform .22s ease; }
  .menu-open .sidebar { transform: none; }
  .menu-open::after { content: ""; position: fixed; z-index: 19; inset: 0; background: rgba(0, 0, 0, .55); }
  .main { margin-left: 0; padding: 72px 15px 40px; }
  .mobilebar {
    position: fixed; z-index: 15; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
    height: 58px; padding: 0 14px; background: var(--rail); border-bottom: 1px solid var(--line);
  }
  .mobilebar button { border: 0; background: none; color: var(--text); font-size: 17px; cursor: pointer; }
  .page-head { display: block; }
  .page-head > .status, .page-head > .count { display: inline-flex; margin-top: 12px; }
  .panel { padding: 16px; }
  .security-strip, .split-actions, .trace-panel, .segmented { grid-template-columns: 1fr; }
  .license-hero .status { margin-left: 0; }
  .tabs { display: flex; overflow-x: auto; }

  /* Tables become stacked cards; each <td> carries data-label. */
  .license-table { min-width: 0; }
  .license-table thead { display: none; }
  .license-table tbody, .license-table tr, .license-table td { display: block; width: 100%; }
  .license-table tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .license-table tr:last-child { border-bottom: 0; }
  .license-table td { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 6px 8px; border: 0; text-align: right; }
  .license-table td::before {
    content: attr(data-label); flex: 0 0 auto; font-size: 10px; letter-spacing: .1em;
    text-transform: uppercase; color: var(--faint);
  }
  .license-table .row-actions { justify-content: flex-end; }
  .license-table .empty { display: block; text-align: center; }
  .license-table .empty::before { display: none; }
}

@media (max-width: 460px) {
  .metrics, .kpis { grid-template-columns: 1fr; }
  .login-page { padding: 14px; }
  .auth-card { padding: 30px 22px 24px; }
  .floating-theme { right: 12px; top: 12px; }
  .reveal-card { padding: 26px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .button.primary { background: var(--grad); background-size: 100% 100%; }
}
