/* ===== Ironclad Auto Works — Shop Manager ===== */
:root {
  --accent: #e8590c;
  --bg: #f3f1ec;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --ink: #1d232b;
  --ink-2: #3a434e;
  --muted: #6b7280;
  --line: #e2dfd8;
  --side: #1d232b;
  --side-ink: #c9ced5;
  --side-hover: #2a323c;
  --shadow: 0 1px 2px rgba(29,35,43,.06), 0 4px 14px rgba(29,35,43,.05);
  --radius: 10px;
  --green: #15803d; --green-bg: #dcfce7;
  --blue: #1d4ed8;  --blue-bg: #dbeafe;
  --orange: #c2410c; --orange-bg: #ffedd5;
  --amber: #a16207; --amber-bg: #fef3c7;
  --red: #b91c1c;   --red-bg: #fee2e2;
  --violet: #6d28d9; --violet-bg: #ede9fe;
  --gray: #4b5563;  --gray-bg: #e5e7eb;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161b; --surface: #1a2027; --surface-2: #212830; --ink: #e6e8eb; --ink-2: #c3c8ce; --muted: #8f98a3;
    --line: #2c343d; --side: #0d1014; --side-hover: #1a2027; --shadow: 0 1px 2px rgba(0,0,0,.4);
    --green-bg: #12321f; --green: #4ade80; --blue-bg: #172a4d; --blue: #93b4ff; --orange-bg: #3d2312; --orange: #fdba74;
    --amber-bg: #392d0d; --amber: #fcd34d; --red-bg: #3f1717; --red: #fca5a5; --violet-bg: #2a1d4a; --violet: #c4b5fd;
    --gray-bg: #2c343d; --gray: #c3c8ce; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161b; --surface: #1a2027; --surface-2: #212830; --ink: #e6e8eb; --ink-2: #c3c8ce; --muted: #8f98a3;
  --line: #2c343d; --side: #0d1014; --side-hover: #1a2027; --shadow: 0 1px 2px rgba(0,0,0,.4);
  --green-bg: #12321f; --green: #4ade80; --blue-bg: #172a4d; --blue: #93b4ff; --orange-bg: #3d2312; --orange: #fdba74;
  --amber-bg: #392d0d; --amber: #fcd34d; --red-bg: #3f1717; --red: #fca5a5; --violet-bg: #2a1d4a; --violet: #c4b5fd;
  --gray-bg: #2c343d; --gray: #c3c8ce; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; letter-spacing: .01em; margin: 0 0 .5em; line-height: 1.15; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.15rem; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.ico { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.pos { color: var(--green); } .neg { color: var(--red); }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--surface); padding: 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

/* ----- Shell ----- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex: none; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 16px 12px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 100%; max-width: 200px; height: auto; filter: drop-shadow(0 0 1px rgba(255,255,255,.35)); }
.brand-sub { color: var(--side-ink); opacity: .7; font-size: .72rem; text-transform: uppercase; letter-spacing: .16em; }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav a, .nav-out { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: var(--side-ink); font-weight: 500; }
.nav a:hover, .nav-out:hover { background: var(--side-hover); color: #fff; text-decoration: none; }
.nav a.active { background: var(--side-hover); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav a.active .ico { color: var(--accent); }
.sidebar-foot { padding: 12px 8px 16px; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar-foot > span { display: block; padding: 0 12px 6px; color: var(--side-ink); }
.sidebar-scrim { display: none; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topsearch { flex: 1; max-width: 560px; position: relative; display: flex; align-items: center; }
.topsearch .ico { position: absolute; left: 12px; color: var(--muted); }
.topsearch input { width: 100%; padding: 9px 12px 9px 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.topbar .btn { margin-left: auto; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; flex: none; }
.icon-btn:hover { border-color: var(--accent); }
.menu-btn { display: none; }
.content { padding: 22px 24px 40px; width: 100%; max-width: 1400px; }
.foot { padding: 16px 24px 90px; }
.tabbar { display: none; }

/* ----- Page header ----- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ----- Cards ----- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -2px 0 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 16px 18px 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line); }
.stat.accent::before { background: var(--accent); } .stat.good::before { background: var(--green); } .stat.warn::before { background: #d97706; } .stat.bad::before { background: var(--red); } .stat.info::before { background: var(--blue); }
.stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.stat-value { font-family: var(--font-head); font-size: clamp(1.35rem, 0.9rem + 0.8vw, 1.8rem); white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-sub { font-size: .82rem; color: var(--muted); }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { border-color: var(--ink-2); text-decoration: none; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.07); border-color: var(--accent); }
.btn-dark { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn-sm { padding: 6px 11px; font-size: .86rem; }
.btn-xs { padding: 3px 8px; font-size: .78rem; border-radius: 6px; }
.btn-block { width: 100%; }
.btn .ico { width: 16px; height: 16px; }
.inline { display: inline; }

/* ----- Forms ----- */
.form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; padding: 0; }
input[type=color] { padding: 2px; height: 40px; width: 60px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
.hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--accent); font-weight: 600; cursor: pointer; padding: 6px; }
.pw-meter { display: block; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters label { flex: 1 1 150px; font-size: .8rem; }
.filters .btn { flex: none; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; font-family: var(--font-head); font-size: 1.05rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* ----- Pills / tabs ----- */
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: .88rem; }
.pill:hover { text-decoration: none; border-color: var(--ink-2); }
.pill.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.pill .count { opacity: .65; margin-left: 4px; font-weight: 500; }

/* ----- Badges & chips ----- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.badge-green { background: var(--green-bg); color: var(--green); } .badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-orange { background: var(--orange-bg); color: var(--orange); } .badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); } .badge-gray { background: var(--gray-bg); color: var(--gray); }
.badge-violet { background: var(--violet-bg); color: var(--violet); }
.tag { display: inline-block; padding: 2px 8px; margin: 2px 3px 2px 0; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.tag.accent { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); color: var(--ink); }
.emp-chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; flex: none; }
.job-id { font-family: var(--font-head); font-weight: 700; font-size: 1.02rem; letter-spacing: .02em; white-space: nowrap; }
.overdue { color: var(--red); font-weight: 700; }
.prio-high { color: var(--red); font-weight: 700; font-size: .75rem; text-transform: uppercase; }

/* ----- Tables ----- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
.t th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.t tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; }
.t .svc-list { margin: 0; padding: 0; list-style: none; }
.t.compact .svc-list li { white-space: normal; }
.t .svc-list li { display: flex; justify-content: space-between; gap: 12px; white-space: nowrap; }
.t .svc-list li span:last-child { font-variant-numeric: tabular-nums; color: var(--muted); }
.row-link { cursor: pointer; }
.qa { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.qa form, .qa .btn { width: 100%; }
.t .svc-list li span:first-child { white-space: normal; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

/* ----- Lists ----- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 11px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0; font-weight: 500; }
.totals { margin-left: auto; min-width: 260px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 1.1rem; }

/* ----- Alerts ----- */
.alert { position: relative; padding: 12px 40px 12px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; font-weight: 500; }
.alert ul { margin: 6px 0 0 18px; padding: 0; font-weight: 400; }
.alert-success { background: var(--green-bg); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.alert-error { background: var(--red-bg); color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.alert-warn { background: var(--amber-bg); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.alert-info { background: var(--blue-bg); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 30%, transparent); }
.alert-x { position: absolute; right: 8px; top: 8px; border: 0; background: none; font-size: 1.3rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }

/* ----- Bars / charts ----- */
.hbar { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr auto; gap: 10px; align-items: center; padding: 5px 0; font-size: .88rem; }
.hbar .track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; border: 1px solid var(--line); }
.hbar .fill { height: 100%; background: var(--accent); border-radius: 5px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--accent); }
.chart .bar:hover { filter: brightness(1.15); }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }

/* ----- Tech board ----- */
.tech-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tech { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--surface-2); display: flex; gap: 10px; }
.tech .avatar { width: 38px; height: 38px; font-size: .95rem; }
.tech-status { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

/* ----- Calendar ----- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 180px; display: flex; flex-direction: column; }
.cal-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal-day.closed { background: var(--surface-2); }
.cal-day-head { padding: 8px 10px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.cal-day-head strong { font-family: var(--font-head); font-size: 1.05rem; }
.cal-day-body { padding: 6px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.cal-job { display: block; padding: 6px 8px; border-radius: 6px; background: var(--surface-2); border-left: 4px solid var(--muted); font-size: .8rem; color: var(--ink); line-height: 1.3; }
.cal-job:hover { text-decoration: none; filter: brightness(.97); }
.cal-job .t1 { font-weight: 700; }
.cal-job.st-completed { opacity: .65; }
.cal-job.st-cancelled, .cal-job.st-no_show { opacity: .45; text-decoration: line-through; }
.cal-add { margin-top: auto; text-align: center; font-size: .8rem; padding: 4px; color: var(--muted); }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.month-cell { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; min-height: 92px; padding: 6px; font-size: .78rem; color: var(--ink); display: block; }
.month-cell:hover { text-decoration: none; border-color: var(--accent); }
.month-cell.other { opacity: .45; }
.month-cell.today { border-color: var(--accent); }
.month-head { text-align: center; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 4px; }

/* ----- Auth ----- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%), var(--bg); }
.auth-wrap { width: 100%; max-width: 520px; }
.auth-brand { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; margin-bottom: 18px; }
.auth-logo { display: block; width: 300px; max-width: 80%; height: auto; }
.auth-brand p { margin: 0; color: var(--muted); }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 26px; box-shadow: var(--shadow); border-top: 4px solid var(--accent); }
.auth-title { font-size: 1.5rem; }
.auth-foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 14px; }

/* ----- Invoice / print ----- */
.invoice { max-width: 860px; margin: 0 auto; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 3px solid var(--ink); padding-bottom: 14px; margin-bottom: 16px; }
@media print {
  .sidebar, .topbar, .tabbar, .foot, .no-print, .alert { display: none !important; }
  body { background: #fff; color: #000; font-size: 12px; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  a { color: #000; }
}

/* ----- Responsive ----- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 35; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .content { padding: 16px 12px 30px; }
  .cal { grid-template-columns: 1fr; }
  .cal-day { min-height: 0; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px max(6px, env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: .7rem; font-weight: 600; padding: 4px 10px; }
  .tabbar a:hover { text-decoration: none; color: var(--ink); }
  .tabbar .tab-new { background: var(--accent); color: #fff; border-radius: 50%; width: 48px; height: 48px; justify-content: center; margin-top: -18px; box-shadow: 0 4px 12px rgba(0,0,0,.2); padding: 0; }
  .tabbar .tab-new .ico { width: 24px; height: 24px; }
}
@media (max-width: 700px) {
  h1 { font-size: 1.55rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-value { font-size: 1.45rem; }
  .hide-xs { display: none !important; }
  .card { padding: 14px; }
  /* Stacked table cards on phones */
  table.t.stack thead { display: none; }
  table.t.stack, .t.stack tbody, .t.stack tr, .t.stack td, .t.stack tfoot { display: block; width: 100%; }
  .t.stack tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .t.stack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .t.stack td::before { content: attr(data-label); color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; text-align: left; flex: none; padding-top: 2px; }
  .t.stack td[data-label=""]::before { content: none; }
  .t.stack td.num { justify-content: space-between; }
  .t.stack .svc-list li { justify-content: flex-end; }
  .t.stack .qa { flex-direction: row; justify-content: flex-end; width: 100%; }
  .t.stack .qa form, .t.stack .qa .btn { width: auto; }
  .t.stack tfoot tr { padding: 10px 14px; }
  .hbar { grid-template-columns: 1fr auto; }
  .hbar .track { grid-column: 1 / -1; grid-row: 2; }
  .totals { min-width: 0; width: 100%; }
  .month-cell { min-height: 60px; font-size: .68rem; padding: 4px; }
  .page-head { align-items: flex-start; }
}

/* ----- Live demo banner ----- */
.demo-banner { background: var(--amber-bg); color: var(--amber); border-bottom: 1px solid color-mix(in srgb, var(--amber) 25%, transparent); font-size: .88rem; }
.demo-banner-in { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 8px 24px; max-width: 1440px; margin: 0 auto; }
.demo-banner .btn { background: var(--surface); }
@media (max-width: 900px) { .demo-banner-in { padding: 8px 12px; } }
@media print { .demo-banner { display: none; } }

.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; }
.brand-logo, .auth-logo { color: transparent; }

/* ---- Demo login buttons ---- */
.demo-logins { display: grid; gap: 8px; }
.demo-login { width: 100%; text-align: left; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface, #fff); color: inherit; font: inherit; cursor: pointer; }
.demo-login:hover { border-color: var(--accent); }
.demo-login > .small:last-child { flex-basis: 100%; color: var(--muted, #6b7280); }

/* ---- Users ---- */
.role-key { display: grid; gap: 6px; margin: 10px 0 14px; }
.user-row { border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; }
.user-row.off { opacity: .7; }
.user-row > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
.user-row > summary::-webkit-details-marker { display: none; }
.user-row[open] > summary { border-bottom: 1px solid var(--line); }
.user-row > form, .user-tools { padding: 10px 12px; }
.user-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; justify-content: space-between; border-top: 1px dashed var(--line); }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin: 0; }
.avatar.sm { width: 32px; height: 32px; font-size: .8rem; flex: none; }
.nav-count { margin-left: auto; background: var(--red, #dc2626); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; padding: 1px 7px; line-height: 1.5; }

/* ---- Invoices ---- */
.nav-count { background: #dc2626 !important; }
.aging-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.aging-cell { display: flex; flex-direction: column; gap: 4px; }
.aging-cell strong { font-variant-numeric: tabular-nums; }
.aging-cell.late strong { color: var(--red); }
.aging-bar { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.aging-bar span { display: block; height: 100%; background: var(--accent); }
.aging-cell.late .aging-bar span { background: var(--red); }
.batch-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); }
.batch-bar label { margin: 0; font-size: .85rem; }
.batch-bar > .small { margin-right: auto; align-self: center; }
.group-row td { background: var(--surface-2); }
.inv-paper { background: #fff; color: #1d232b; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px; }
.inv-band { background: var(--band, #1d232b); border-bottom: 4px solid var(--accent); color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 24px; flex-wrap: wrap; }
.inv-band img { height: 64px; width: auto; display: block; }
.inv-band .biz { text-align: right; font-size: .82rem; color: #d1d5db; line-height: 1.5; }
.inv-band .biz strong { color: #fff; font-size: .95rem; }
.inv-body { padding: 22px 24px; }
.inv-top { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.inv-title { font-family: var(--font-head); font-size: 2rem; font-weight: 700; letter-spacing: .02em; margin: 0 0 10px; display: flex; align-items: center; gap: 12px; }
.inv-stamp { font-size: .8rem; letter-spacing: .08em; border: 2px solid currentColor; border-radius: 4px; padding: 2px 8px; }
.inv-stamp.paid { color: #15803d; } .inv-stamp.overdue { color: #b91c1c; } .inv-stamp.void, .inv-stamp.draft { color: #6b7280; } .inv-stamp.partial { color: #b45309; }
.inv-meta { display: grid; grid-template-columns: auto auto; gap: 3px 14px; font-size: .9rem; align-content: start; }
.inv-meta dt { color: #6b7280; text-align: right; } .inv-meta dd { margin: 0; font-weight: 600; text-align: right; }
.inv-label { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: #6b7280; font-weight: 700; margin-bottom: 4px; }
.inv-due { background: #f6f4ef; border-left: 4px solid var(--accent); padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.inv-due strong { font-size: 1.35rem; }
.inv-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.inv-table th { background: var(--band, #1d232b); color: #fff; text-align: left; font-size: .72rem; letter-spacing: .06em; padding: 7px 8px; }
.inv-table td { padding: 7px 8px; border-bottom: 1px solid #e7e4dd; vertical-align: top; }
.inv-table .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv-table tr.jobhead td { background: #f1efe9; font-weight: 700; }
.inv-table tr.disc td { color: #15803d; }
.inv-table .type { display: block; font-size: .7rem; color: #6b7280; letter-spacing: .05em; text-transform: uppercase; }
.inv-totals { margin: 12px 0 0 auto; max-width: 340px; font-size: .92rem; }
.inv-totals div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; color: #4b5563; }
.inv-totals div span:last-child { font-variant-numeric: tabular-nums; color: #1d232b; }
.inv-totals .big { border-top: 1.5px solid #1d232b; margin-top: 4px; padding-top: 6px; font-weight: 700; color: #1d232b; font-size: 1.02rem; }
.inv-notes { margin-top: 18px; font-size: .82rem; color: #374151; white-space: pre-line; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); white-space: nowrap; min-width: 92px; font-size: .8rem; }
.email-preview { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.email-preview .hdr { background: var(--surface-2); padding: 10px 14px; font-size: .85rem; display: grid; gap: 2px; }
.email-preview iframe { width: 100%; height: 520px; border: 0; background: #f3f1ec; display: block; }
.attach-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .8rem; background: var(--surface); }
.line-editor input { min-width: 0; }
.line-editor td { vertical-align: middle; }
.line-editor .amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .aging-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } .inv-body { padding: 16px; } .inv-band { padding: 12px 16px; } .inv-band .biz { text-align: left; } }
.line-editor select { min-width: 112px; } .line-editor input[name="desc[]"] { min-width: 200px; }

/* ---- Demo sign-in picker ---- */
.demo-pick { margin: 0 0 6px; }
.demo-pick h3 { margin: 0 0 4px; font-size: 1.15rem; }
.demo-pick > p { margin: 0 0 14px; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.demo-pick form { margin: 0 0 10px; }
.demo-go { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border: 2px solid var(--accent); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface)); color: inherit; font: inherit; cursor: pointer; transition: transform .08s, box-shadow .15s, background .15s; }
.demo-go:hover, .demo-go:focus-visible { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 28%, transparent); transform: translateY(-1px); outline: none; }
.demo-go .av { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; flex: none; }
.demo-go .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.demo-go .txt strong { font-size: 1rem; }
.demo-go .txt span { font-size: .82rem; color: var(--muted); line-height: 1.35; }
.demo-go .go { flex: none; font-weight: 700; font-size: .9rem; color: var(--accent); white-space: nowrap; }
.demo-manual { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.demo-manual > summary { cursor: pointer; color: var(--muted); font-size: .85rem; text-align: center; list-style: none; padding: 4px; }
.demo-manual > summary::-webkit-details-marker { display: none; }
.demo-manual[open] > summary { margin-bottom: 12px; }
@media (max-width: 420px) { .demo-go .go { display: none; } }

.qb-steps { padding-left: 20px; margin: 0; display: grid; gap: 14px; }
.qb-steps li > div { margin-top: 6px; }
