/* 365-Chiptuningfiles – file service portal
   One stylesheet for the customer portal and the admin panel.
   1 tokens · 2 base · 3 shell · 4 components · 5 forms · 6 tables · 7 charts · 8 pages · 9 utilities */

/* ------------------------------------------------------------------ 1 tokens */
@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/inter-400.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/inter-500.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/inter-600.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/inter-700.woff") format("woff"); }

:root {
  color-scheme: light;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --page: #eceff1;
  --surface: #ffffff;
  --surface-2: #f5f7f8;      /* table heads, hover rows */
  --surface-3: #eceff1;      /* wells inside a card */
  --line: #dde4e7;           /* dividers */
  --line-strong: #7f929c;    /* input borders (3:1 on the surface) */
  --ink: #263238;
  --ink-2: #546e7a;
  --ink-3: #5f7480;

  --brand: #e5202b;          /* the red of the logo: marks, big numerals, focus */
  --brand-solid: #e5202b;    /* filled buttons / banner: white text is readable on it (4.6:1) */
  --brand-solid-hover: #c8151f;
  --brand-ink: #c8151f;      /* red text and links on light surfaces (5.9:1 on white) */
  --on-brand: #ffffff;

  --side: #333333;
  --side-ink: #ffffff;
  --side-ink-2: #c9c9c9;
  --side-hover: #454545;
  --side-active: #5c5c5c;

  --top: #ffffff;

  --info-bg: #c6e9f5;    --info-ink: #01579b;
  --success-bg: #c8e6c9; --success-ink: #1b5e20;
  --warning-bg: #fdecc0; --warning-ink: #6b4400;
  --danger-bg: #fbd5d5;  --danger-ink: #9b1c1c;
  --neutral-bg: #e3e8eb; --neutral-ink: #37474f;
  --danger-solid: #b3261e;

  --series-1: #e5202b;
  --series-2: #2a78d6;
  --series-3: #199e70;
  --grid: #e3e8eb;
  --axis: #b0bec5;

  --shadow: 0 1px 2px rgba(38, 50, 56, 0.14), 0 0 1px rgba(38, 50, 56, 0.10);
  --shadow-pop: 0 8px 24px rgba(38, 50, 56, 0.18), 0 0 1px rgba(38, 50, 56, 0.2);
  --radius: 3px;
  --side-width: 220px;
  --top-height: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #13161a; --surface: #1e2226; --surface-2: #252a2f; --surface-3: #171a1d;
    --line: #2f363c; --line-strong: #77848e;
    --ink: #e7ebee; --ink-2: #b0bcc4; --ink-3: #8e9ca6;
    --brand: #f0323c; --brand-solid: #e5202b; --brand-solid-hover: #f0323c; --brand-ink: #ff6b6b;
    --side: #181b1f; --side-ink: #e7ebee; --side-ink-2: #9aa7b0; --side-hover: #23282d; --side-active: #2e343a;
    --top: #1e2226;
    --info-bg: #0f3547;    --info-ink: #a9dcf5;
    --success-bg: #163f25; --success-ink: #9be3ae;
    --warning-bg: #4a3505; --warning-ink: #ffd480;
    --danger-bg: #4f1c1c;  --danger-ink: #ffb4b4;
    --neutral-bg: #2a3036; --neutral-ink: #c5ced4;
    --danger-solid: #c9372c;
    --series-1: #f0323c; --series-2: #3987e5; --series-3: #199e70;
    --grid: #2a3036; --axis: #48525a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03);
    --shadow-pop: 0 10px 28px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #13161a; --surface: #1e2226; --surface-2: #252a2f; --surface-3: #171a1d;
  --line: #2f363c; --line-strong: #77848e;
  --ink: #e7ebee; --ink-2: #b0bcc4; --ink-3: #8e9ca6;
  --brand: #f0323c; --brand-solid: #e5202b; --brand-solid-hover: #f0323c; --brand-ink: #ff6b6b;
  --side: #181b1f; --side-ink: #e7ebee; --side-ink-2: #9aa7b0; --side-hover: #23282d; --side-active: #2e343a;
  --top: #1e2226;
  --info-bg: #0f3547;    --info-ink: #a9dcf5;
  --success-bg: #163f25; --success-ink: #9be3ae;
  --warning-bg: #4a3505; --warning-ink: #ffd480;
  --danger-bg: #4f1c1c;  --danger-ink: #ffb4b4;
  --neutral-bg: #2a3036; --neutral-ink: #c5ced4;
  --danger-solid: #c9372c;
  --series-1: #f0323c; --series-2: #3987e5; --series-3: #199e70;
  --grid: #2a3036; --axis: #48525a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-pop: 0 10px 28px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* --------------------------------------------------------------------- 2 base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, figure, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1 { font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 15px; line-height: 1.35; font-weight: 600; }
h3 { font-size: 14px; line-height: 1.4; font-weight: 600; }
a { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
strong, b { font-weight: 600; }
small { font-size: 12.5px; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--brand); color: #fff; }

.icon {
  width: 18px; height: 18px; flex: none; vertical-align: -4px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 15px; height: 15px; vertical-align: -3px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 34px; height: 34px; stroke-width: 1.6; }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--surface); color: var(--ink);
  padding: 8px 12px; border-radius: var(--radius); box-shadow: var(--shadow-pop);
}
.skip-link:focus { top: 8px; }

/* -------------------------------------------------------------------- 3 shell */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--top-height); z-index: 30;
  display: flex; align-items: center; gap: 8px; padding: 0 20px 0 0;
  background: var(--top); border-bottom: 1px solid var(--line);
}
.topbar-brand {
  width: var(--side-width); flex: none; height: 100%; display: flex; align-items: center; padding: 0 12px 0 16px;
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 14px; letter-spacing: -0.015em;
}
.topbar-brand img { max-height: 36px; max-width: 170px; }
.topbar-brand img.logo-compact { max-width: 184px; width: auto; height: auto; }
.topbar-brand picture img, .auth-brand picture img { display: block; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--surface); flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; margin-right: 10px;
}
.brand-text { line-height: 1.15; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.brand-text span { display: block; font-size: 11px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.logo-light { display: block; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .logo-light { display: none; }
  :root:where(:not([data-theme="light"])) .logo-dark { display: block; }
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.topbar-right { margin-left: auto; }
.top-link {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px; border-radius: var(--radius);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13.5px; white-space: nowrap;
  background: none; border: 0; cursor: pointer;
}
.top-link:hover { background: var(--surface-2); }
.top-link .icon { color: var(--brand); }
.top-link.plain .icon { color: var(--ink-2); }
.top-credits { display: inline-flex; align-items: center; gap: 12px; }
.top-credits b { font-weight: 700; font-variant-numeric: tabular-nums; }
.top-credits span { color: var(--ink-2); font-weight: 500; }
.nav-toggle { display: none; margin-left: 8px; position: relative; }
.toggle-dot { position: absolute; top: 8px; right: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--brand-solid); box-shadow: 0 0 0 2px var(--top); }
.mobile-only { display: none !important; }

/* language: NL | EN */
.lang-switch { display: inline-flex; margin: 0 4px; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; background: var(--surface); }
.lang-switch button {
  border: 0; background: none; min-height: 26px; padding: 3px 10px; color: var(--ink-2); cursor: pointer;
  font-weight: 700; font-size: 12px; letter-spacing: 0.04em; line-height: 1.2;
}
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button:hover { background: var(--surface-2); color: var(--ink); }
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: var(--surface); cursor: default; }
.lang-switch button:focus-visible { outline-offset: -2px; }
.side-lang { display: none; }

/* theme: a switch with the sun or the moon on the knob */
.theme-switch { display: inline-flex; align-items: center; padding: 8px 6px; margin: 0 2px; border: 0; background: none; border-radius: 999px; cursor: pointer; }
.ts-track { position: relative; display: block; width: 44px; height: 24px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line-strong); transition: background 0.2s, border-color 0.2s; }
.theme-switch:hover .ts-track { border-color: var(--ink-2); }
.ts-knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.2s;
}
.ts-knob .icon { width: 12px; height: 12px; }
.ts-moon { display: none; }
:root[data-theme="dark"] .ts-track { background: var(--side-active); }
:root[data-theme="dark"] .ts-knob { transform: translateX(20px); background: var(--ink); color: var(--page); }
:root[data-theme="dark"] .ts-sun { display: none; }
:root[data-theme="dark"] .ts-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .ts-track { background: var(--side-active); }
  :root:where(:not([data-theme="light"])) .ts-knob { transform: translateX(20px); background: var(--ink); color: var(--page); }
  :root:where(:not([data-theme="light"])) .ts-sun { display: none; }
  :root:where(:not([data-theme="light"])) .ts-moon { display: block; }
}

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: #f9d2d4; color: #8a1c24; font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em;
}
:root[data-theme="dark"] .avatar { background: #4a2a2e; color: #ffc9cd; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .avatar { background: #4a2a2e; color: #ffc9cd; } }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }

/* dropdown menus are <details> elements: they work without JavaScript */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 40; padding: 6px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-pop);
}
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none;
  border-radius: var(--radius); color: var(--ink); text-decoration: none; text-align: left; cursor: pointer;
  font-weight: 500;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); }
.menu-panel .icon { color: var(--ink-2); }
.menu-panel hr { margin: 6px 0; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head b { display: block; }
.menu-head span { color: var(--ink-2); font-size: 12.5px; word-break: break-all; }
.menu-choice[aria-pressed="true"] { background: var(--surface-2); font-weight: 600; }
.menu-choice[aria-pressed="true"]::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }

.sidebar {
  position: fixed; top: var(--top-height); bottom: 0; left: 0; width: var(--side-width); z-index: 20;
  background: var(--side); color: var(--side-ink); overflow-y: auto; padding: 16px 16px 24px;
}
.side-title { font-size: 12.5px; font-weight: 700; color: var(--side-ink); padding: 4px 0 12px; }
.side-nav a, .side-nav summary {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 7px 12px; margin-bottom: 2px;
  color: var(--side-ink); text-decoration: none; font-weight: 600; font-size: 13.5px; border-radius: 2px;
  cursor: pointer; list-style: none;
}
.side-nav summary::-webkit-details-marker { display: none; }
.side-nav a:hover, .side-nav summary:hover { background: var(--side-hover); }
.side-nav a[aria-current="page"] { background: var(--side-active); }
.side-nav .icon { color: var(--side-ink-2); }
.side-nav a[aria-current="page"] .icon { color: var(--side-ink); }
.side-nav .chev { margin-left: auto; transition: transform 0.15s ease; }
.side-nav details[open] > summary .chev { transform: rotate(180deg); }
.side-sub { padding: 2px 0 6px 28px; }
.side-sub a { font-weight: 500; font-size: 13px; min-height: 32px; padding: 5px 10px; color: var(--side-ink-2); }
.side-sub a:hover, .side-sub a[aria-current="page"] { color: var(--side-ink); }
.side-count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-solid); color: #fff; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.side-foot { margin-top: 20px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.12); font-size: 12px; color: var(--side-ink-2); }

.main { margin-left: var(--side-width); padding: calc(var(--top-height) + 20px) 24px 40px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { color: var(--ink-2); margin-top: 4px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.backlink { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; font-weight: 600; text-decoration: none; color: var(--ink-2); }
.backlink:hover { color: var(--ink); }
.scrim { display: none; }

@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .topbar { padding-right: 10px; }
  .topbar-brand { width: auto; padding: 0 8px 0 12px; }
  .brand-text span { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: none; }
  .nav-open .sidebar { transform: none; box-shadow: var(--shadow-pop); }
  .nav-open .scrim { display: block; position: fixed; inset: var(--top-height) 0 0 0; z-index: 15; background: rgba(0, 0, 0, 0.45); }
  .main { margin-left: 0; padding-left: 14px; padding-right: 14px; }
  .hide-mobile { display: none !important; }
  .side-nav a.mobile-only { display: flex !important; }
  /* the bar must fit on a 320 px phone: the name shrinks, menus stay on the screen */
  .topbar { gap: 2px; }
  .topbar-brand { flex: 0 1 auto; min-width: 0; }
  .brand-text { min-width: 0; }
  .topbar-right { flex: none; }
  .menu-panel { position: fixed; top: calc(var(--top-height) + 4px); right: 8px; max-width: calc(100vw - 16px); }
}
@media (max-width: 600px) {
  .topbar .top-lang { display: none; }
  .side-lang { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
  .side-lang > span { display: inline-flex; align-items: center; gap: 8px; color: var(--side-ink-2); font-size: 12.5px; font-weight: 600; }
  .side-lang .lang-switch { margin: 0; border-color: rgba(255, 255, 255, 0.35); background: transparent; }
  .side-lang .lang-switch button { color: var(--side-ink-2); }
  .side-lang .lang-switch button + button { border-left-color: rgba(255, 255, 255, 0.2); }
  .side-lang .lang-switch button:hover { background: var(--side-hover); color: var(--side-ink); }
  .side-lang .lang-switch button[aria-pressed="true"] { background: var(--side-ink); color: var(--side); }
}
@media (max-width: 480px) {
  .top-credits { display: none; }
  .brand-text { font-size: 13px; }
  .topbar-brand img.logo-compact { max-width: 150px; }
  .auth-top { flex-wrap: wrap; }
  .auth-brand { flex-basis: 100%; }
  .auth-tools { margin-left: auto; }
  .topbar .top-link { padding: 0 8px; }
}
@media (max-width: 360px) {
  .brand-text { display: none; }
  .topbar-brand img.logo-compact { max-width: 130px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* --------------------------------------------------------------- 4 components */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--line); min-height: 50px;
}
.card-head a { font-weight: 600; }
.card-body { padding: 16px; }
.card-body + .card-body { border-top: 1px solid var(--line); }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card-flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.main > :is(.grid, .card, .notice, .credit-banner) + :is(.grid, .card, .notice, .credit-banner) { margin-top: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.cols-half { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.grid.stretch { align-items: stretch; }
.grid.stretch > .grid { align-items: stretch; }
.span-2 { grid-column: span 2; }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 800px) { .cols-2, .cols-3, .cols-half { grid-template-columns: minmax(0, 1fr); } .span-2 { grid-column: auto; } }
@media (max-width: 520px) { .cols-4 { grid-template-columns: minmax(0, 1fr); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 7px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 13.5px; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand-solid); border-color: var(--brand-solid); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-solid-hover); border-color: var(--brand-solid-hover); }
/* Red is the brand colour, so a destructive action is outlined rather than filled: it reads as a warning,
   not as the primary button. */
.btn-danger { background: var(--surface); border-color: var(--danger-solid); color: var(--danger-ink); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { border-color: transparent; background: none; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-inverse { background: #fff; border-color: #fff; color: #b5121c; }
.btn-inverse:hover { background: #fff1f1; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.link-button { background: none; border: 0; padding: 0; color: var(--brand-ink); text-decoration: underline; cursor: pointer; font-weight: 600; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 11px; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; line-height: 1.5; background: var(--neutral-bg); color: var(--neutral-ink);
}
.badge-info { background: var(--info-bg); color: var(--info-ink); }
.badge-success { background: var(--success-bg); color: var(--success-ink); }
.badge-warning { background: var(--warning-bg); color: var(--warning-ink); }
.badge-danger { background: var(--danger-bg); color: var(--danger-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; display: inline-block; }

.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius);
  background: var(--info-bg); color: var(--info-ink);
}
.notice .icon { margin-top: 1px; }
.notice a { color: inherit; font-weight: 600; }
.notice-body { min-width: 0; flex: 1; }
.notice-success { background: var(--success-bg); color: var(--success-ink); }
.notice-warning { background: var(--warning-bg); color: var(--warning-ink); }
.notice-danger, .notice-error { background: var(--danger-bg); color: var(--danger-ink); }
.notice + .notice { margin-top: 8px; }
.error-links { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 2px; }
.error-links:has(li:only-child) { padding-left: 0; list-style: none; }
.flashes { margin-bottom: 16px; }
.notice-close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; padding: 2px; border-radius: 2px; }

.stat-value { font-size: 28px; line-height: 1.1; font-weight: 700; color: var(--brand); letter-spacing: -0.01em; }
:root[data-theme="dark"] .stat-value { color: #ff6b6b; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .stat-value { color: #ff6b6b; } }
.stat-label { color: var(--ink); margin-top: 4px; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stat-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; text-decoration: none; color: inherit; }
.stat-link .stat-value, .stat-link .stat-label { display: block; }
.stat-link .icon { color: var(--brand); }
.stat-link:hover .stat-label { text-decoration: underline; }
@media (max-width: 520px) { .stat-row { gap: 10px; } .stat-value { font-size: 24px; } .stat-label { font-size: 13px; } }

.credit-banner {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 18px 20px; border-radius: var(--radius);
  background: var(--brand-solid); color: var(--on-brand); box-shadow: var(--shadow);
}
.credit-banner h2 { width: 100%; font-size: 13.5px; font-weight: 600; margin-bottom: -8px; }
.credit-wallets { display: flex; gap: 32px; flex-wrap: wrap; flex: 1; }
.credit-wallet b { display: block; font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -0.01em; }
.credit-wallet span { font-size: 14px; font-weight: 600; }
@media (max-width: 640px) {
  .credit-banner { gap: 16px; }
  .credit-wallets { flex: 1 0 100%; gap: 12px 24px; }
  .credit-wallet b { font-size: 26px; }
  .top-credits { display: none; }
}

.empty { text-align: center; padding: 36px 16px; color: var(--ink-2); }
.empty .icon { color: var(--ink-3); margin-bottom: 8px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; font-size: 15px; }
.empty .btn { margin-top: 14px; }

.dl { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 8px 16px; }
.dl dt { color: var(--ink-2); }
.dl dd { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } .dl dd { margin-bottom: 8px; } }

.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a, .tabs button {
  padding: 10px 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; cursor: pointer;
  color: var(--ink); font-weight: 600; text-decoration: none; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center;
}
.tabs a[aria-current="page"], .tabs button[aria-selected="true"] { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tab-count { background: var(--neutral-bg); color: var(--neutral-ink); border-radius: 9px; padding: 0 6px; font-size: 12px; }

.thread { display: grid; gap: 12px; }
.msg { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border-left: 3px solid var(--line-strong); }
.msg-staff { border-left-color: var(--brand); }
.msg-internal { background: var(--warning-bg); color: var(--warning-ink); border-left-color: var(--warning-ink); }
.msg-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; font-size: 13px; }
.msg-head b { font-weight: 600; }
.msg-head time { color: var(--ink-2); }
.msg-internal .msg-head time { color: inherit; }
.msg-body { overflow-wrap: anywhere; }
.msg-files { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }

.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-row > .icon { color: var(--ink-2); }
.file-meta { min-width: 0; flex: 1; }
.file-meta b { display: block; overflow-wrap: anywhere; font-weight: 600; }
.file-meta span { display: block; color: var(--ink-2); font-size: 12.5px; }
/* on a phone the buttons go under the file name instead of squeezing it */
@media (max-width: 640px) {
  .file-row { flex-wrap: wrap; row-gap: 8px; }
  .file-row > .file-meta { flex: 1 1 calc(100% - 48px); }
  .file-row > .file-meta + * { margin-left: 36px; }
}

.steps { display: flex; gap: 0; counter-reset: step; }
.step { flex: 1; position: relative; padding-top: 22px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.step::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 3px; background: var(--line); }
.step::after { content: ""; position: absolute; top: 1px; left: calc(50% - 7px); width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line); }
.step-done { color: var(--ink); }
.step-done::before { background: var(--brand); }
.step-done::after { border-color: var(--brand); background: var(--brand); }
.step-now { color: var(--ink); }
.step-now::after { border-color: var(--brand); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }
.pager-links { display: flex; gap: 4px; align-items: center; }
.pager-links a, .pager-links span { min-width: 30px; height: 30px; padding: 0 8px; display: grid; place-items: center; border-radius: var(--radius); text-decoration: none; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.pager-links a:hover { background: var(--surface-2); }
.pager-links [aria-current="page"] { background: var(--brand-solid); color: #fff; }

.order-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 16px; overflow-x: auto; padding: 16px; scroll-snap-type: x proximity; scroll-padding: 0 16px; }
.order-strip > div { scroll-snap-align: start; }
.order-strip a { font-weight: 600; }

.clock { display: flex; gap: 4px; justify-content: center; align-items: center; font-variant-numeric: tabular-nums; }
.clock span { width: 32px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; font-weight: 500; background: var(--surface); }
.clock i { font-style: normal; font-weight: 700; color: var(--ink-2); }
.hours { width: 100%; border-collapse: collapse; }
.hours td { padding: 3px 0; }
.hours td:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
.hours tr.today td { color: var(--brand-ink); }

.greeting { display: flex; align-items: center; gap: 16px; }
.greeting h1 { font-size: 20px; }
.greeting p { color: var(--ink-2); margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ok { color: var(--success-ink); font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }

.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .icon { margin-top: 2px; }
.check-done .icon { color: var(--success-ink); }
.check-todo .icon { color: var(--warning-ink); }

/* -------------------------------------------------------------------- 5 forms */
.form { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form-grid .wide, .form-grid-3 .wide { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 5px; align-content: start; min-width: 0; }
.field > label, .field > .label { font-weight: 600; font-size: 13.5px; }
.field .hint { color: var(--ink-2); font-size: 12.5px; }
.field .error { color: var(--danger-ink); font-size: 13px; font-weight: 500; display: flex; gap: 6px; }
.optional { color: var(--ink-2); font-weight: 400; }
.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
:root[data-theme="dark"] .input, :root[data-theme="dark"] .select, :root[data-theme="dark"] .textarea { background: var(--surface-3); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) :is(.input, .select, .textarea) { background: var(--surface-3); } }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
/* iPhones zoom into a field whose text is smaller than 16 px */
@media (max-width: 640px) { .input, .select, .textarea { font-size: 16px; } }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger-solid); border-width: 2px; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input-sm { min-height: 32px; padding: 4px 8px; width: auto; }
.input-num { text-align: right; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 10px; align-items: flex-start; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--brand-solid); flex: none; }
.check input { margin: 2px 0 0; }
input[type="file"] { max-width: 100%; font-size: 13.5px; color: var(--ink-2); }
input[type="file"]::file-selector-button {
  margin-right: 12px; min-height: 32px; padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--surface-2); }
.check label { font-weight: 500; }
.check .hint { display: block; color: var(--ink-2); font-size: 12.5px; font-weight: 400; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.fieldset > legend { font-weight: 600; font-size: 15px; padding: 0; margin-bottom: 12px; }
.inline-form { display: inline; }
/* list pages: the up/down arrows and the delete button sit on one line */
.table .actions form { display: inline-block; vertical-align: middle; }
.order-buttons { display: inline-flex; margin-right: 6px; }
.actions-stack { display: inline-grid; gap: 4px; }
.ini-preview { margin: 8px 0 0; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius); font-size: 12.5px; line-height: 1.5; overflow-x: auto; white-space: pre; }
.actions-stack .btn { width: 100%; justify-content: flex-start; }
.order-buttons .btn[disabled] { opacity: .3; }
/* a grid of checkboxes (options with a tuning type, tuning types with an option) */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 20px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .input, .filters .select { width: auto; min-width: 150px; }
.filters .grow { flex: 1; min-width: 180px; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 42px; }
.password-toggle { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 38px; border: 0; background: none; cursor: pointer; color: var(--ink-2); border-radius: var(--radius); }

.option-list { display: grid; gap: 8px; }
.option {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; background: var(--surface);
}
.option:hover { border-color: var(--line-strong); }
.option input { margin: 2px 0 0; }
.option:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.option:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }
.option-text { flex: 1; min-width: 0; }
.option-text b { display: block; font-weight: 600; }
.option-text span { color: var(--ink-2); font-size: 12.5px; }
.option-price { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.type-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.type-picker .option { flex-direction: column; gap: 4px; }
.type-picker .option-head { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.type-picker .balance { font-size: 20px; font-weight: 700; color: var(--brand-ink); padding-left: 28px; line-height: 1.2; }
.type-picker .balance small { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
/* the upload form: tuning types and options as cards with a credits badge, like a price list */
.type-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.type-card {
  position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px 12px 12px; border: 1px solid var(--line);
  border-radius: var(--radius); cursor: pointer; background: var(--surface); min-height: 64px;
}
.type-card:hover { border-color: var(--line-strong); }
.type-card:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--surface-2); }
.type-card:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.type-card:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.type-card input { margin: 3px 0 0; flex: none; }
.type-card-body { flex: 1; min-width: 0; display: grid; gap: 2px; padding-right: 72px; }
.type-card-name { display: flex; gap: 6px; align-items: flex-start; font-weight: 600; }
.type-card-name .icon { color: var(--brand); flex: none; margin-top: 3px; }
.type-card-text { color: var(--ink-2); font-size: 12.5px; }
.credit-badge {
  position: absolute; top: -1px; right: 10px; padding: 2px 8px; border: 1px solid var(--brand); border-top: 0; border-radius: 0 0 8px 8px;
  background: var(--surface); color: var(--brand-ink); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.type-card[hidden] { display: none; }
.delivery-note { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--radius); background: var(--surface-2); color: var(--ink-2); font-size: 13.5px; }
.delivery-note .icon { color: var(--brand); flex: none; }
.brand-ink { color: var(--brand-ink); }
.fs-section .card-head h2 { font-size: 16px; }
.fs-section .card-head { border-top: 3px solid var(--brand); border-radius: var(--radius) var(--radius) 0 0; }

.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 16px 18px; background: var(--surface-2); display: grid; gap: 10px; }
.dropzone.is-over { border-color: var(--brand); background: var(--surface); }
.dropzone-prompt { display: flex; gap: 8px; align-items: center; color: var(--ink-2); font-size: 13px; }
.dropzone-prompt b { font-weight: 600; color: var(--ink); }
.dropzone-words { display: grid; gap: 2px; min-width: 0; }
.dropzone-sub { color: var(--ink-2); font-size: 12.5px; }
.dropzone-big { border-color: var(--brand); border-width: 1.5px; padding: 18px 20px; }
.dropzone-big .dropzone-prompt { gap: 14px; }
.dropzone-big .dropzone-prompt > .icon { width: 26px; height: 26px; color: var(--brand); flex: none; }
.dropzone input[type="file"] { width: 100%; }
.file-list { font-size: 13px; color: var(--ink); display: grid; gap: 4px; }
.file-list > div { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; min-width: 0; }
.file-list > div > span { min-width: 0; overflow-wrap: anywhere; }
[aria-busy="true"] { opacity: .55; transition: opacity .15s; }
.file-list:empty { display: none; }
.summary-box { background: var(--surface-2); border-radius: var(--radius); padding: 14px 16px; }
.summary-line { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; }
.summary-line.total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; font-weight: 700; font-size: 16px; }
.summary-line span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ------------------------------------------------------------------- 6 tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); padding: 9px 16px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table a.row-link { font-weight: 600; }
.table .sub { display: block; color: var(--ink-2); font-size: 12.5px; }
.table .unread td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.table .unread .row-link { font-weight: 700; }
.table-plain th { background: none; }
/* wide lists scroll sideways on a phone instead of squeezing every column */
@media (max-width: 800px) {
  .table-wrap > .table:has(th:nth-child(5)) { min-width: 820px; }
  .table-wrap > .table:has(th:nth-child(7)) { min-width: 1040px; }
}
.amount-pos { color: var(--success-ink); font-weight: 600; }
.amount-neg { color: var(--danger-ink); font-weight: 600; }

/* ------------------------------------------------------------------- 7 charts */
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-head p { color: var(--ink-2); }
.chart { position: relative; height: 260px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart text { font: 500 11.5px var(--font); fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-area { stroke: none; opacity: 0.1; }
.chart .series-bar { stroke: none; }
.chart .s1 { stroke: var(--series-1); } .chart .s1.series-area, .chart .s1.series-bar, .chart .s1.marker { fill: var(--series-1); }
.chart .s2 { stroke: var(--series-2); } .chart .s2.series-area, .chart .s2.series-bar, .chart .s2.marker { fill: var(--series-2); }
.chart .s3 { stroke: var(--series-3); } .chart .s3.series-area, .chart .s3.series-bar, .chart .s3.marker { fill: var(--series-3); }
.chart .marker { stroke: var(--surface); stroke-width: 2; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 120px; padding: 8px 10px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-pop); font-size: 12.5px; white-space: nowrap;
}
.chart-tip[hidden] { display: none; }
.chart-tip .tip-label { color: var(--ink-2); margin-bottom: 2px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; }
.chart-tip .tip-row b { font-weight: 700; font-size: 14px; color: var(--ink); }
.chart-tip .tip-row span { color: var(--ink-2); }
.tip-key { width: 12px; height: 0; border-top: 2px solid var(--series-1); flex: none; }
.tip-key.k2 { border-top-color: var(--series-2); } .tip-key.k3 { border-top-color: var(--series-3); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 0; border-top: 2px solid var(--series-1); }
.legend .k2 { border-top-color: var(--series-2); } .legend .k3 { border-top-color: var(--series-3); }
.chart-table[hidden] { display: none; }
.chart-table { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.segmented a { padding: 6px 12px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 13px; border-right: 1px solid var(--line); white-space: nowrap; }
.segmented a:last-child { border-right: 0; }
.segmented a:hover { background: var(--surface-2); }
.segmented a[aria-current="true"] { background: var(--ink); color: var(--surface); }
.period-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.period-row > span { font-weight: 600; }

/* -------------------------------------------------------------------- 8 pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: start center; align-content: start; padding: 28px 16px 48px; }
.auth-top { width: 100%; max-width: 980px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.auth-brand { display: flex; align-items: center; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 16px; }
.auth-brand img { max-height: 44px; max-width: 220px; }
.auth-brand picture img { max-height: 40px; max-width: min(360px, 60vw); width: auto; height: auto; }
.auth-tools { display: flex; gap: 4px; align-items: center; }
.auth-grid { width: 100%; max-width: 980px; display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 24px; align-items: start; }
.auth-single { width: 100%; max-width: 460px; }
.auth-wide { width: 100%; max-width: 760px; }
.auth-card { padding: 28px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card > p { color: var(--ink-2); margin-bottom: 20px; }
.auth-aside { padding: 28px; }
.auth-aside h2 { font-size: 18px; margin-bottom: 12px; }
.auth-aside li { display: flex; gap: 10px; padding: 6px 0; }
.auth-aside li .icon { color: var(--brand); margin-top: 2px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
@media (max-width: 800px) { .auth-grid { grid-template-columns: minmax(0, 1fr); } }

.frame { width: 100%; height: calc(100vh - var(--top-height) - 150px); min-height: 480px; border: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.qr { background: #fff; padding: 8px; border-radius: var(--radius); width: 196px; height: 196px; display: block; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 24px; font-size: 15px; max-width: 320px; }
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.error-page .card { padding: 36px 32px; max-width: 480px; }
.error-code { font-size: 54px; font-weight: 700; color: var(--brand); line-height: 1; margin-bottom: 8px; }
.package-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.package { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.package h3 { font-size: 14px; font-weight: 600; }
.package .price { font-size: 24px; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.package .price small { font-size: 12.5px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.package .per { color: var(--ink-2); font-size: 12.5px; }
.package .btn { margin-top: auto; }
.package .per { margin-bottom: 8px; }
.matrix th, .matrix td { padding: 8px 10px; }
.logo-preview { max-height: 60px; max-width: 100%; display: block; }
.logo-box-light { background: #ffffff; }
.logo-box-dark { background: #15171b; }
.matrix .input { min-width: 84px; }
.pay-state { text-align: center; padding: 12px 0; }
.pay-state .icon { color: var(--brand); }
.pay-state.ok-state .icon { color: var(--success-ink); }
.spinner { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- 9 utilities */
.muted { color: var(--ink-2); }
.strong { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.wrap-anywhere { overflow-wrap: anywhere; }
.tnum { font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 12px; align-content: start; }
.stack-lg { display: grid; gap: 20px; align-content: start; }
.cluster { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.between { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; }
.measure { max-width: 72ch; }
.sticky { position: sticky; top: calc(var(--top-height) + 16px); }
@media (max-width: 1100px) { .sticky { position: static; } }
.narrow { max-width: 720px; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.w-auto { width: auto; }
.test-ribbon { background: var(--warning-bg); color: var(--warning-ink); font-weight: 600; text-align: center; padding: 6px 12px; font-size: 13px; border-radius: var(--radius); margin-bottom: 16px; }

@media print {
  .topbar, .sidebar, .page-actions, .flashes, .no-print { display: none !important; }
  .main { margin: 0; padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

/* Lists in the customer portal become one block per row on a phone: everything visible
   without swiping sideways. Each cell carries its column name in data-label. */
@media (max-width: 640px) {
  .table-wrap > .table.table-stack { min-width: 0 !important; }
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-stack, .table-stack tbody { display: block; }
  .table-stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table-stack td { display: block; border: 0; padding: 0; text-align: left; min-width: 0; overflow-wrap: anywhere; }
  .table-stack td.num { text-align: left; }
  .table-stack td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .table-stack td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-2); }
  .table-stack td.actions { grid-column: 1 / -1; }
  .table-stack .unread td:first-child { box-shadow: none; }
  .table-stack tr.unread { box-shadow: inset 3px 0 0 var(--brand); }
}
.page-head h1, .page-head p { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
/* free text typed by customers (a model name of 80 characters without spaces) must not widen a list */
.cell-text { max-width: 32ch; overflow-wrap: anywhere; }

/* ------------------------------------------------------ upload form helpers */
.recent-vehicles { display: grid; gap: 8px; }
.recent-label { font-weight: 600; font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 12px; border-radius: 16px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); text-decoration: none;
  font-size: 13.5px; font-weight: 500; line-height: 1.3;
}
.chip:hover { border-color: var(--brand); background: var(--surface-2); }
.chip .icon { color: var(--brand); flex: none; }
.chip .muted { font-weight: 400; }
.more-fields > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13.5px;
  color: var(--ink-2); padding: 4px 0;
}
.more-fields > summary::-webkit-details-marker { display: none; }
.more-fields > summary .icon { transition: transform .15s; }
.more-fields[open] > summary .icon { transform: rotate(90deg); }
.more-fields > summary:hover { color: var(--ink); }

/* The bar with the price and the Send button that stays in view on a phone (the summary card
   is far below the fields there). */
.fs-bar { display: none; }
@media (max-width: 1100px) {
  .fs-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 10px 16px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  }
  .fs-bar-text { min-width: 0; font-size: 13.5px; line-height: 1.35; }
  .fs-bar-text b { font-size: 15px; font-variant-numeric: tabular-nums; }
  .fs-bar-line { display: block; white-space: nowrap; }
  .fs-bar-after { font-size: 12.5px; }
  .fs-bar-after b { font-size: 12.5px; font-weight: 600; }
  .fs-bar .btn { flex: none; }
  body.has-fs-bar .main { padding-bottom: 96px; }
  body.has-fs-bar .bottom-nav { display: none; }
}

/* staff looking at the portal as a customer */
.impersonation-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--ink); color: var(--surface); font-size: 13.5px; font-weight: 500;
}
.impersonation-bar .icon { color: var(--brand); flex: none; }
.impersonation-bar span { flex: 1 1 320px; }
.impersonation-bar form { margin-left: auto; }

/* own prices of a customer group */
.price-matrix .price-col { width: 190px; }
.price-matrix input.input-num { width: 150px; margin-left: auto; text-align: right; }
.price-matrix .error { display: block; }
.price-matrix .per-credit { display: block; font-size: 12px; margin-top: 3px; min-height: 15px; }

/* ------------------------------------------------------- phone navigation */
.bottom-nav { display: none; }
@media (max-width: 960px) {
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px 7px; text-decoration: none;
    color: var(--ink-2); font-size: 11.5px; font-weight: 600; position: relative; min-width: 0;
  }
  .bottom-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottom-nav a .icon { width: 22px; height: 22px; }
  .bottom-nav a[aria-current="page"] { color: var(--brand-ink); }
  .bottom-nav .side-count { position: absolute; top: 4px; left: calc(50% + 6px); }
  body.has-bottom-nav .main { padding-bottom: 84px; }
}

/* ------------------------------------------------------ customer dashboard */
.active-files { list-style: none; margin: 0; padding: 0; }
.active-files li {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 6px 14px; align-items: center;
  padding: 10px 20px; border-bottom: 1px solid var(--line);
}
.active-files li:last-child { border-bottom: 0; }
.active-files .row-link { font-weight: 700; text-decoration: none; }
.active-files .active-vehicle { min-width: 0; overflow-wrap: anywhere; }
.active-files .active-state { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.active-files .sub { display: block; color: var(--ink-2); font-size: 12.5px; }
@media (max-width: 640px) {
  .active-files li { grid-template-columns: auto minmax(0, 1fr); padding: 10px 14px; }
  .active-files .active-state { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 10px; }
  .active-files .btn { grid-column: 1 / -1; justify-self: start; }
}
.expectation { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); font-size: 13.5px; border-top: 1px solid var(--line); }
.expectation .icon { color: var(--brand); flex: none; margin-top: 1px; }
.onboarding { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.onboarding li a { font-weight: 600; }
.card .period-row { margin: 0 0 12px; }
.step time { display: block; font-weight: 500; font-size: 11.5px; color: var(--ink-2); margin-top: 2px; }
.revision-box > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--brand-ink); }
.revision-box > summary::-webkit-details-marker { display: none; }
.revision-box > summary:hover { text-decoration: underline; }
.package-marked { border-color: var(--brand); position: relative; }
.package-label { display: inline-block; align-self: flex-start; background: var(--brand-solid); color: #fff; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 10px; margin-bottom: 2px; }
