/* CAR WAY dashboard. Same language as the app: white, grey and near-black, with one gold accent.
   Flat surfaces with hairlines; the only loud element is the instrument cluster on the overview. */
:root {
  --night: #111214;
  --ink: #111214;
  --on-ink: #FFFFFF;
  --gold: #C9A26C;
  --gold-deep: #A87A45;
  --gold-text: #8A6236;
  --gold-soft: #FBF3E6;
  --champagne: #F2E6D2;
  --cream: #F4F4F2;
  --card: #FFFFFF;
  --sunken: #F4F4F2;
  --hover: #F7F7F5;
  --line: #E6E6E2;
  --line-strong: #D5D5D0;
  --muted: #85858A;
  --text-2: #66666B;
  --success: #1F7A53;
  --success-soft: #E5F3EC;
  --warning-text: #87580F;
  --warn-soft: #FBF1DF;
  --info-text: #2F5496;
  --info-soft: #E9EFFA;
  --danger: #B3261E;
  --danger-soft: #FCEEED;
  --chart: #B07D3A;
  --chart-wash: rgba(176, 125, 58, .1);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: none;
  --side: 256px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --ink: #F2F2F0;
  --on-ink: #111214;
  --gold-text: #DDB984;
  --gold-soft: #33291A;
  --champagne: #2B2620;
  --cream: #0E0E10;
  --card: #18181B;
  --sunken: #111113;
  --hover: #1F1F23;
  --line: #2A2A2E;
  --line-strong: #3A3A3F;
  --muted: #8E8E94;
  --text-2: #A6A6AC;
  --success: #4CB98A;
  --success-soft: #16291F;
  --warning-text: #E4B872;
  --warn-soft: #30261A;
  --info-text: #A9C1EC;
  --info-soft: #1B2436;
  --danger: #F08A82;
  --danger-soft: #331B19;
  --chart: #D9A85C;
  --chart-wash: rgba(217, 168, 92, .12);
}

body { background: var(--cream); color: var(--ink); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; box-shadow: none; }
.sidebar :focus-visible, .cluster :focus-visible, .auth :focus-visible { outline-color: var(--gold); }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.gap-top { margin-top: 14px; }
.ltr-start { direction: ltr; text-align: end; unicode-bidi: isolate; }

/* ── Sign-in and loading ── */
.auth { background: var(--night); }
.auth-card { background: transparent; border: 0; box-shadow: none; overflow: visible; }
.auth-head { background: transparent; padding: 0 0 22px; }
.auth-logo { display: block; height: 96px; width: auto; margin: 0 auto; }
.auth-head p { color: #A6A6AC; margin-top: 10px; }
.auth-body { background: var(--card); color: var(--ink); border-radius: 18px; padding: 26px; }
#screen-loading .state-box { color: #A6A6AC; }
#screen-loading .wordmark { color: var(--gold) !important; }
.form-note { background: var(--gold-soft); border-color: transparent; color: var(--gold-text); }
.form-error { background: var(--danger-soft); border-color: transparent; }
.pass-toggle:hover { background: var(--sunken); }

/* ── Shell ── */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100dvh; }
.shell[hidden] { display: none !important; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column;
  background: var(--night); color: #B9B9BE;
  padding: calc(16px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom));
  scrollbar-width: thin; scrollbar-color: #2C2C30 transparent;
  border-inline-end: 1px solid #1E1E22;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 16px; text-decoration: none; }
.side-brand img { height: 30px; width: auto; display: block; }
.side-brand .wordmark { font-size: 14px; letter-spacing: .26em; margin-inline-end: -.26em; color: #fff; }
.side-nav { flex: 1 1 auto; display: flex; flex-direction: column; gap: 1px; }
.side-group { color: #6F6F75; font-size: 12px; font-weight: 500; padding: 16px 10px 6px; }
.side-group:first-child { padding-top: 2px; }
.side-link {
  display: flex; align-items: center; gap: 11px;
  min-height: 42px; padding: 0 10px; border-radius: 10px;
  color: #C4C4C9; text-decoration: none; font-weight: 500; font-size: 14.5px;
  transition: background-color .12s, color .12s;
}
.side-link svg { flex: 0 0 auto; color: #85858B; transition: color .12s; }
.side-link span:first-of-type { flex: 1 1 auto; min-width: 0; }
.side-link:hover { background: #1B1B1F; color: #fff; }
.side-link[aria-current="page"] { background: #1F1C17; color: var(--gold); font-weight: 600; }
.side-link[aria-current="page"] svg { color: var(--gold); }
.nav-badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--gold); color: #111214; font-size: 12px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.side-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid #222226; display: grid; gap: 10px; }
.side-who { display: flex; align-items: center; gap: 10px; padding: 0 6px; min-width: 0; }
.side-avatar {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: #26231C; color: var(--gold); font-weight: 700; font-size: 14px;
}
.side-who-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.who-name { color: #F0F0F2; font-size: 13.5px; font-weight: 600; max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-role { color: #85858B; font-size: 12px; }
.btn-dark { background: transparent; border: 1px solid #2C2C30; color: #C4C4C9; border-radius: 10px; font-weight: 500; }
.btn-dark:hover { background: #1B1B1F; border-color: #3A3A3F; color: #fff; }
.btn-block-dark { width: 100%; }

.shell-main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  height: calc(60px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 24px 0;
  background: var(--cream); color: var(--ink);
  border-bottom: 1px solid var(--line); box-shadow: none;
}
.top-search { position: relative; flex: 1 1 auto; max-width: 440px; min-width: 0; }
.top-search .input { min-height: 40px; font-size: 14px; background-color: var(--card); padding-inline-start: 38px; border-color: var(--line); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2385858A' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E"); }
.top-results {
  position: absolute; z-index: 35; top: calc(100% + 6px); inset-inline: 0; max-height: 70vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 12px; padding: 6px;
  box-shadow: 0 16px 40px rgba(17, 18, 20, .16);
}
.result-group { color: var(--muted); font-size: 12px; padding: 8px 8px 4px; }
.result { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px; border-radius: 8px; text-decoration: none; color: inherit; }
.result:hover, .result:focus-visible { background: var(--hover); }
.result-text { display: flex; flex-direction: column; min-width: 0; }
.result-text strong { font-weight: 600; font-size: 14px; }
.result-text small { color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-add { flex: 0 0 auto; margin-inline-end: 4px; }
@media (max-width: 700px) { .top-add, #sound-btn, .live-pill { display: none !important; } }
.top-spacer { flex: 1 1 auto; }
.top-icon {
  position: relative; display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent;
  color: var(--text-2); cursor: pointer; text-decoration: none;
}
.top-icon:hover { background: var(--line); color: var(--ink); }
#top-new[data-count]:not([data-count=""])::after {
  content: attr(data-count); position: absolute; top: 3px; inset-inline-end: 1px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--gold); color: #111214; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
}
.menu-btn { display: none; }
.live-pill {
  display: inline-flex; align-items: center; gap: 6px; margin-inline-start: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--success);
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.side-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, .55); }

@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 40; inset-block: 0; inset-inline-start: 0; width: min(290px, 84vw); height: 100dvh;
    transform: translateX(100%); transition: transform .2s ease-out; visibility: hidden;
  }
  .sidebar.open { transform: none; visibility: visible; }
  .menu-btn { display: inline-grid; margin-inline-start: -8px; }
  .topbar { padding-inline: 16px; }
}

/* ── Page frame ── */
#main { flex: 1 1 auto; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 24px 120px; }
.wrap.narrow { max-width: 920px; }
.wrap.wide { max-width: none; }
@media (max-width: 600px) { .wrap { padding: 18px 14px 110px; } }
.page-head { align-items: flex-end; margin-bottom: 18px; }
.page-title { font-size: 25px; font-weight: 700; line-height: 1.3; }
.page-sub { font-size: 14px; }
.page-actions, .head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card { padding: 20px; border-radius: var(--radius); }
.card + .card { margin-top: 12px; }
.stack > .card + .card { margin-top: 0; }
.card-title { font-size: 15.5px; font-weight: 700; }
.card-sub { margin-bottom: 14px; }
.card-sub.tight { margin-bottom: 0; }
.empty-line { padding: 14px 0; color: var(--text-2); font-size: 14px; }
.state-box strong { color: var(--ink); }
.spinner { border-color: var(--line); border-top-color: var(--gold-deep); }
.back-link:hover { color: var(--ink); }

/* ── Controls ── */
.btn { background: var(--card); color: var(--ink); border-color: var(--line-strong); border-radius: var(--radius-sm); font-size: 14.5px; min-height: 42px; }
.btn:hover { background: var(--hover); border-color: var(--line-strong); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); opacity: .86; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #111214; }
.btn-gold:hover { background: #BE9660; border-color: #BE9660; }
.btn-danger { color: var(--danger); border-color: var(--line-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger-solid { background: #B3261E; border-color: #B3261E; color: #fff; }
.btn-danger-solid:hover { background: #9C1F18; border-color: #9C1F18; }
.btn-success { background: #1F7A53; border-color: #1F7A53; color: #fff; }
.btn-success:hover { background: #196645; border-color: #196645; }
.btn-sm { min-height: 36px; font-size: 13.5px; padding: 0 12px; border-radius: 9px; }
.icon-btn { background: var(--card); color: var(--ink); border-color: var(--line-strong); width: 36px; height: 36px; border-radius: 9px; }
.icon-btn:hover { background: var(--hover); }
.link-btn { color: var(--ink); text-decoration-color: var(--gold); font-size: 13.5px; white-space: nowrap; }
.link-btn.small { font-size: 12.5px; }

.input, select.input, textarea.input {
  background-color: var(--card); color: var(--ink); border-color: var(--line-strong);
  border-radius: var(--radius-sm); font-size: 15px; min-height: 44px;
}
.input:hover { border-color: var(--muted); }
.input::placeholder { color: var(--muted); }
.input[aria-invalid="true"] { background: var(--danger-soft); }
.input.is-changed { border-color: var(--gold-deep); background-color: var(--gold-soft); }
.input-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.input-row .input { flex: 1 1 auto; min-width: 0; }
.check { background: var(--card); border-color: var(--line-strong); border-radius: var(--radius-sm); }
.check input { accent-color: var(--gold-deep); }
.check-sm { min-height: 44px; font-weight: 500; font-size: 14px; white-space: nowrap; }
.toolbar { margin-bottom: 18px; }
.toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar-row .grow { flex-basis: 220px; }
.chip { background: var(--card); border-color: var(--line-strong); font-size: 13.5px; min-height: 36px; text-decoration: none; }
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.filter-label { color: var(--text-2); font-weight: 500; }
.view-switch { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--line); }
.view-switch a, .view-switch button {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); font-weight: 500; font-size: 13.5px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.view-switch a:hover, .view-switch button:hover { color: var(--ink); }
.view-switch [aria-current="page"], .view-switch [aria-pressed="true"] { background: var(--card); color: var(--ink); font-weight: 600; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--sunken); border-radius: 12px; }
.seg button { flex: 1 1 28%; color: var(--ink); font-size: 13px; min-height: 38px; font-weight: 500; white-space: nowrap; }
.seg button:hover { background: var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); font-weight: 600; }

/* ── Status colours ── */
.badge { font-size: 12px; font-weight: 500; padding: 2px 9px; }
.b-draft, .b-closed, .b-lost { background: var(--sunken); color: var(--text-2); }
.b-draft::before, .b-lost::before { background: var(--muted); }
.b-available, .b-won { background: var(--success-soft); color: var(--success); }
.b-available::before, .b-won::before { background: var(--success); }
.b-reserved, .b-contacted { background: var(--warn-soft); color: var(--warning-text); }
.b-reserved::before, .b-contacted::before { background: currentColor; }
.b-negotiating { background: var(--info-soft); color: var(--info-text); }
.b-negotiating::before { background: currentColor; }
.b-sold { background: var(--ink); color: var(--on-ink); }
.b-sold::before { background: var(--gold); }
.b-new { background: var(--gold); color: #111214; }
.b-new::before { background: #111214; }
.b-type { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.b-type.t-buy::before { background: var(--success); }
.b-type.t-test_drive::before { background: var(--gold-deep); }
.b-type.t-sell::before { background: var(--warning-text); }
.b-type.t-finance::before { background: var(--info-text); }
.b-type.t-contact::before { background: var(--muted); }
.status-select.b-sold { color: var(--on-ink); }
.status-select option { background: var(--card); color: var(--ink); }
.is-late { color: var(--danger); }

/* ── Notices ── */
.alerts { display: grid; gap: 8px; margin-bottom: 14px; }
.alert {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm); text-decoration: none; font-size: 14px;
}
.alert svg { flex: 0 0 auto; }
.alert strong { font-weight: 600; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-warn { background: var(--warn-soft); color: var(--warning-text); }
.alert-info { background: var(--sunken); color: var(--text-2); border: 1px solid var(--line); }
.wrap > div > .alert { margin-bottom: 14px; }

/* ── Instrument cluster: the overview's one loud element ── */
.cluster {
  background: var(--night); color: #fff; border-radius: 20px; margin-bottom: 14px;
  padding: 26px 28px 0; overflow: hidden;
}
[data-theme="dark"] .cluster { background: #17171A; border: 1px solid var(--line); }
.cluster-main {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center; gap: 12px;
}
.gauge { display: grid; justify-items: center; min-width: 0; }
.gauge svg { display: block; width: 100%; max-width: 190px; height: auto; overflow: visible; }
.gauge-track { fill: none; stroke: rgba(255, 255, 255, .12); stroke-width: 7; stroke-linecap: round; }
.gauge-value { fill: none; stroke: var(--gold); stroke-width: 7; stroke-linecap: round; }
.gauge-tick { stroke: rgba(255, 255, 255, .28); stroke-width: 1.5; stroke-linecap: round; }
.gauge-num { fill: #fff; font-size: 30px; font-weight: 700; text-anchor: middle; font-family: inherit; }
.gauge-unit { fill: #A6A6AC; font-size: 12.5px; text-anchor: middle; font-family: inherit; }
.gauge-label { color: #C4C4C9; font-size: 13.5px; margin-top: -12px; text-align: center; }
.gauge-hint { color: #85858B; font-size: 12px; text-align: center; }
.cluster-center { text-align: center; text-decoration: none; color: inherit; display: block; border-radius: 16px; padding: 4px; }
.cluster-label { display: block; color: #C4C4C9; font-size: 15px; }
.cluster-num { display: block; font-size: clamp(72px, 9vw, 112px); line-height: 1.05; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.cluster-center.has-new .cluster-num { color: var(--gold); }
.cluster-sub { display: block; color: #85858B; font-size: 13.5px; }
.readouts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 22px -28px 0; border-top: 1px solid rgba(255, 255, 255, .1);
}
.readout {
  display: block; padding: 14px 20px 16px; text-decoration: none; color: inherit;
  border-inline-start: 1px solid rgba(255, 255, 255, .1); margin-inline-start: -1px; min-width: 0;
}
a.readout:hover { background: rgba(255, 255, 255, .04); }
.readout-label { display: block; color: #A6A6AC; font-size: 12.5px; }
.readout-value { display: block; font-size: 21px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.readout-sub { display: block; color: #85858B; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .cluster { padding: 22px 16px 0; }
  .cluster-main { grid-template-columns: 1fr 1fr; }
  .cluster-center { grid-column: 1 / -1; grid-row: 1; }
  .readouts { margin-inline: -16px; grid-template-columns: 1fr 1fr; }
  .readout { padding: 12px 16px; }
}

/* ── Quiet figures ── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile {
  display: grid; gap: 2px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: inherit; min-width: 0;
}
a.tile:hover { border-color: var(--line-strong); }
.tile-label { color: var(--text-2); font-size: 13px; }
.tile-value { font-size: 23px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.tile-sub { color: var(--muted); font-size: 12.5px; }
.tile-dark { background: var(--night); border-color: var(--night); color: #fff; }
.tile-dark .tile-label { color: #A6A6AC; }
[data-theme="dark"] .tile-dark { background: #1F1C17; border-color: #2F2A20; }

/* ── Panels ── */
.panels { display: grid; gap: 12px; margin-bottom: 12px; }
.panels .card + .card { margin-top: 0; }
.panels.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.panels.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.panel { min-width: 0; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list > li + li { border-top: 1px solid var(--line); }
.mini-list a, .mini-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; text-decoration: none; color: inherit;
}
.mini-list a:hover .mini-main strong, .mini-list a:hover .mini-main > span { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.mini-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; font-size: 14px; }
.mini-main strong { font-weight: 600; }
.mini-main small { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.mini-side { display: flex; flex-direction: column; align-items: flex-end; flex: 0 0 auto; font-size: 13px; color: var(--text-2); text-align: end; }
.mini-side small { color: var(--muted); font-size: 12px; }
.mini-side.is-late, .mini-side.is-late small { color: var(--danger); }

/* ── Charts ── */
.chart-fig { margin: 0; }
.chart { position: relative; outline-offset: 4px; border-radius: 6px; touch-action: pan-y; }
.chart-plot { width: 100%; height: 220px; }
.chart-plot svg { display: block; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11.5px; font-family: inherit; }
.chart-bar { fill: var(--chart); }
.chart-line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--chart-wash); }
.chart-dot { fill: var(--chart); stroke: var(--card); stroke-width: 2; }
.chart-cross { stroke: var(--muted); stroke-width: 1; }
.chart-tip {
  position: absolute; z-index: 2; pointer-events: none; white-space: nowrap;
  padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--on-ink); font-size: 12.5px;
}
.chart-tip strong { font-size: 14px; }
.chart-tip small { display: block; opacity: .75; font-size: 11.5px; }
.chart-table { margin-top: 6px; }
.chart-table summary { cursor: pointer; color: var(--text-2); font-size: 12.5px; min-height: 28px; display: inline-flex; align-items: center; }
.chart-table[open] .table-scroll { max-height: 220px; overflow-y: auto; margin-top: 6px; }

.bar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.bar-row {
  display: grid; grid-template-columns: minmax(84px, 38%) minmax(30px, 1fr) minmax(36px, auto);
  align-items: center; gap: 10px; min-height: 36px; text-decoration: none; color: inherit; border-radius: 6px;
}
a.bar-row:hover .bar-label { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.bar-label { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { display: block; height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--chart); border-start-end-radius: 4px; border-end-end-radius: 4px; }
.bar-value { font-size: 13.5px; font-weight: 600; text-align: end; }
.bar-value small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }

/* ── Tables ── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-card { padding: 0; overflow: hidden; }
.table-card .data-table th:first-child, .table-card .data-table td:first-child { padding-inline-start: 18px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: start; font-weight: 500; color: var(--text-2); font-size: 12.5px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--hover); }
.data-table.compact td, .data-table.compact th { padding: 7px 10px; font-size: 13px; }
.data-table td.center, .role-table th:not(:first-child) { text-align: center; }
.data-table small { font-size: 12.5px; }
.th-btn { border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.th-btn:hover { color: var(--ink); }
.table-link { font-weight: 600; text-decoration: none; }
.table-link:hover { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.role-table svg { color: var(--success); vertical-align: middle; }

@media (max-width: 700px) {
  .table-card thead { display: none; }
  .table-card table, .table-card tbody, .table-card tr, .table-card td { display: block; width: 100%; }
  .table-card tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table-card tbody tr:last-child { border-bottom: 0; }
  .table-card .data-table td, .table-card .data-table td:first-child { padding: 3px 0; border: 0; }
  .table-card td[data-label] { display: flex; justify-content: space-between; gap: 12px; }
  .table-card td[data-label]::before { content: attr(data-label); color: var(--text-2); font-size: 13px; }
  .row-actions { flex-wrap: wrap; margin-top: 8px; }
}

/* ── Requests ── */
.req-card { border-radius: var(--radius); }
.req-card:hover { border-color: var(--line-strong); }
.req-card.is-new { border-inline-start: 3px solid var(--gold); }
.req-name { font-size: 15.5px; font-weight: 600; }
.req-notes { color: var(--ink); }
.req-when { color: var(--gold-text); }
.req-when.is-late { color: var(--danger); }
.wa-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.wa-row .filter-label { margin: 0; margin-inline-end: 4px; }
.detail-side { top: 76px; }
.kv dt { color: var(--text-2); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.tl-item { position: relative; padding-block: 0 14px; padding-inline-start: 18px; }
.tl-item::before {
  content: ""; position: absolute; top: 7px; inset-inline-start: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong);
}
.tl-item::after { content: ""; position: absolute; top: 18px; bottom: -4px; inset-inline-start: 3.5px; width: 1px; background: var(--line); }
.tl-item:last-child::after { display: none; }
.tl-item.is-note::before { background: var(--gold); }
.tl-text { font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.tl-item.is-note .tl-text { font-weight: 500; }
.tl-meta { color: var(--muted); font-size: 12px; }

/* ── Stage board ── */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(216px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.board-col { background: #ECECE9; border: 1px solid transparent; border-radius: var(--radius); padding: 10px; min-height: 240px; transition: border-color .12s; }
[data-theme="dark"] .board-col { background: var(--sunken); border-color: var(--line); }
.board-col.drop { border-color: var(--gold); }
.board-title { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; padding: 2px 4px 10px; }
.board-count { color: var(--text-2); font-size: 13px; font-weight: 500; }
.board-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.board-card { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; cursor: grab; display: grid; gap: 3px; }
.board-card:hover { border-color: var(--line-strong); }
.board-card.is-late { border-inline-start: 3px solid var(--danger); color: inherit; }
.board-card.dragging { opacity: .45; }
.board-name { font-weight: 600; font-size: 14.5px; text-decoration: none; margin-top: 5px; overflow-wrap: anywhere; }
.board-name:hover { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.board-card .req-line { font-size: 13px; }
.board-card .req-date { font-size: 12px; }
.board-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; }
.board-select {
  min-height: 30px; max-width: 150px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--card); color: var(--text-2); font-size: 12.5px; cursor: pointer;
}
.board-who { width: 24px; height: 24px; border-radius: 50%; background: #26231C; color: var(--gold); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; flex: 0 0 auto; }
.board-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; }

/* ── Agenda ── */
.card-late { border-color: var(--danger); }
.agenda-list { list-style: none; margin: 8px 0 0; padding: 0; }
.agenda-item { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); }
.agenda-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 11px 0; text-decoration: none; }
.agenda-time { flex: 0 0 76px; font-weight: 600; font-size: 14px; }
.agenda-text { display: flex; flex-direction: column; min-width: 0; }
.agenda-text strong { font-weight: 600; font-size: 14.5px; }
.agenda-text small { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.agenda-main:hover strong { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }

/* ── Switches ── */
.switch-list { display: grid; }
.switch-row {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding: 8px 0; cursor: pointer;
}
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-text { display: flex; flex-direction: column; min-width: 0; }
.switch-text strong { font-weight: 600; font-size: 14.5px; }
.switch-text small { color: var(--text-2); font-size: 12.5px; }
.switch-row input, .mini-switch input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; inset-inline-end: 0; }
.switch-ui {
  position: relative; flex: 0 0 auto; width: 44px; height: 26px; border-radius: 13px;
  background: var(--line-strong); transition: background-color .15s;
}
.switch-ui::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
input:checked + .switch-ui { background: #1F7A53; }
input:checked + .switch-ui::after { transform: translateX(-18px); }
input:focus-visible + .switch-ui { outline: 2px solid var(--gold-deep); outline-offset: 2px; }
input:disabled + .switch-ui { opacity: .6; }
[data-danger] input:checked + .switch-ui { background: #B3261E; }
.mini-switch { position: relative; display: inline-flex; flex: 0 0 auto; }
.mini-switch input { top: 0; }

/* ── Operating page ── */
.control-grid { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 20px; align-items: start; }
.control-side { position: sticky; top: 76px; }
@media (max-width: 1180px) {
  .control-grid { grid-template-columns: minmax(0, 1fr); }
  .control-side { display: none; }
}
.phone-wrap { display: grid; gap: 10px; justify-items: center; }
.phone {
  position: relative; width: 250px; height: 500px; padding: 12px 0 0; overflow: hidden;
  background: #fff; color: #111214; border: 8px solid #111214; border-radius: 34px;
  display: flex; flex-direction: column;
}
[data-theme="dark"] .phone { border-color: #2A2A2E; }
.ph-head { display: flex; align-items: center; gap: 7px; padding: 4px 12px 8px; }
.ph-logo { width: 22px; height: 22px; border-radius: 7px; background: #111214 url("assets/logo-symbol.png") center / 16px no-repeat; }
.ph-word { font-size: 10px; font-weight: 700; letter-spacing: .2em; direction: ltr; }
.ph-tabs { display: flex; padding: 0 6px 6px; border-bottom: 1px solid #E6E6E2; }
.ph-tab { flex: 1; display: grid; justify-items: center; gap: 1px; color: #85858A; min-width: 0; }
.ph-tab small { font-size: 9px; white-space: nowrap; }
.ph-pill { width: 32px; height: 20px; border-radius: 10px; display: grid; place-items: center; }
.ph-tab.on { color: #111214; }
.ph-tab.on .ph-pill { background: #111214; color: #fff; }
.ph-ann { background: #C9A26C; color: #111214; font-size: 10.5px; font-weight: 600; padding: 5px 10px; text-align: center; }
.ph-body { flex: 1; padding: 10px; display: grid; gap: 8px; align-content: start; }
.ph-offer { display: block; height: 84px; border-radius: 12px; background: #111214; }
.ph-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ph-card { display: block; height: 92px; border-radius: 10px; background: #F3F3F2; }
.ph-maint {
  position: absolute; inset: 0; z-index: 2; background: #111214; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 18px; text-align: center;
}
.ph-maint[hidden] { display: none; }
.ph-maint strong { font-size: 16px; color: #C9A26C; }
.ph-maint small { font-size: 11.5px; color: #C4C4C9; }

/* ── Texts ── */
.text-row { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.text-row .input { min-height: 40px; font-size: 14px; }
.text-row textarea.input { min-height: 64px; }
.text-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.text-foot:has(> span:empty):has(> button[hidden]) { display: none; }

/* ── Notifications ── */
.push-preview {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px;
  background: var(--sunken); max-width: 420px;
}
.push-icon { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; background: #111214 url("assets/logo-symbol.png") center / 26px no-repeat; }
.push-text { display: flex; flex-direction: column; min-width: 0; font-size: 13.5px; }
.push-text strong { font-weight: 600; overflow-wrap: anywhere; }
.push-text span { color: var(--text-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Content ── */
.tab-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tab-head .card-sub { flex: 1 1 260px; }
.content-list { list-style: none; margin: 0; padding: 0; }
.content-item { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.content-thumb {
  flex: 0 0 auto; width: 84px; height: 56px; border-radius: 9px; overflow: hidden; background: var(--sunken);
  display: grid; place-items: center;
}
.content-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.content-thumb.tone-dark { background: #111214; }
.content-thumb.tone-gold { background: var(--gold); }
.content-thumb.is-logo { width: 56px; background: var(--sunken); }
.content-thumb.is-logo img { object-fit: contain; padding: 8px; }
.content-thumb b { color: var(--text-2); font-size: 20px; }
.content-text { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.content-text strong { font-weight: 600; font-size: 14.5px; }
.content-text small { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.content-text .ltr-start { text-align: start; direction: ltr; }
.content-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.move-btns { display: flex; gap: 4px; }
.img-field { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.img-thumb {
  width: 132px; height: 80px; border-radius: 10px; overflow: hidden; background: var(--sunken);
  display: grid; place-items: center; color: var(--muted); font-size: 12px; border: 1px solid var(--line);
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb.is-logo img { object-fit: contain; padding: 8px; }
.img-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
dialog.dlg-wide { max-width: 680px; max-height: calc(100dvh - 32px); overflow-y: auto; }

/* ── Cars ── */
.tools-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.car-thumb { background: var(--sunken); }
.thumb-empty { color: var(--text-2); }
.car-card { border-radius: var(--radius); }
.car-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.car-old { color: var(--muted); font-weight: 400; font-size: 13px; }
.sample-tag { font-size: 11.5px; font-weight: 500; color: var(--warning-text); background: var(--warn-soft); padding: 1px 8px; border-radius: 999px; }
.star-btn { color: var(--line-strong); }
.star-btn[aria-pressed="true"] { color: var(--gold-deep); }
.star-btn:hover { background: var(--hover); }
.sub-item { background: var(--sunken); border-color: var(--line); }
.photo { background: var(--card); border-color: var(--line); }
.photo-view { background: var(--sunken); }
.dropzone { background: var(--sunken); border-color: var(--line-strong); }
.dropzone.drag { background: var(--gold-soft); border-color: var(--gold-deep); }
.cover-tag { background: #111214; color: var(--gold); }
.section-error { background: var(--danger-soft); }
.thumb { background: var(--sunken); border-color: var(--line); }
.card-private { border-color: var(--line-strong); background: var(--sunken); }
.card-private .input { background-color: var(--card); }
.profit-line { font-weight: 700; font-size: 16px; color: var(--success); margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.profit-line.is-loss { color: var(--danger); }

/* ── Save bar, dialogs, toasts ── */
.savebar { background: var(--card); border-top: 1px solid var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (min-width: 981px) { .savebar { inset-inline-start: var(--side); } }
.toast { background: #111214; color: #fff; border-radius: 12px; }
[data-theme="dark"] .toast { background: #26262A; }
.toast-error, [data-theme="dark"] .toast-error { background: #B3261E; }
dialog { background: var(--card); color: var(--ink); border-radius: 16px; }
.dlg-body p { color: var(--text-2); }

/* ── Showroom sticker ── */
#print-area { display: none; }
@media print {
  @page { size: A4 portrait; margin: 14mm; }
  body.printing { background: #fff; color: #111214; }
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block !important; }
  .sticker { display: grid; gap: 20px; font-size: 16px; }
  .sticker-head .wordmark { color: #111214; font-size: 26px; }
  .sticker-head { border-bottom: 3px solid #C9A26C; padding-bottom: 14px; }
  .sticker h1 { font-size: 40px; line-height: 1.2; }
  .sticker-en { font-size: 18px; color: #66666B; margin-top: -14px; text-align: end; }
  .sticker-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 14px; }
  .sticker-price strong { font-size: 52px; line-height: 1; }
  .sticker-price s { color: #85858A; font-size: 22px; }
  .sticker-price span { flex-basis: 100%; font-size: 20px; color: #8A6236; font-weight: 600; }
  .sticker-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 30px; margin: 0; }
  .sticker-specs div { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid #D5D5D0; }
  .sticker-specs dt { color: #66666B; }
  .sticker-specs dd { margin: 0; font-weight: 600; }
  .sticker-qr { display: flex; align-items: center; gap: 22px; border: 2px solid #111214; border-radius: 16px; padding: 18px; margin-top: 8px; }
  .sticker-qr svg { flex: 0 0 auto; }
  .sticker-qr strong { font-size: 24px; }
  .sticker-qr p { font-size: 16px; color: #66666B; margin-top: 4px; }
}
