/* MAT (Maintenance Assist Technology) – staff portals (shared styles)
   Tokens mirror the public guide page so the portals feel like the same product. */

:root {
  --bg: #F4F6FA; --surface: #FFFFFF; --surface-2: #E9EDF4; --ink: #1F2430; --muted: #5F6778; --line: #D8DEE8;
  --brand: #1F6FEB; --brand-ink: #1558C4; --accent: #2B3240; --accent-soft: #E3EDFF; --good: #1E8E5A;
  --warn: #E0A800; --warn-soft: #FFF4D6; --bad: #D64545; --bad-ink: #B33A3A;
  --blue: #1F6FEB; --blue-ink: #1558C4; --orange: #C9611C; --violet: #5B4BD6; --amber-ink: #8A5A00;
  --shadow: 0 1px 2px rgba(31,36,48,.06), 0 14px 36px -20px rgba(31,36,48,.3);
  /* chart series: brand blue first, then dark gray, teal, amber, violet, rose (validated on #FFFFFF) */
  --series-1: #1F6FEB; --series-2: #2B3240; --series-3: #0F9D9D; --series-4: #D99700; --series-5: #7C5CE6; --series-6: #D9607F;
  /* chart status colors (state, not identity): good / warning / bad / neutral */
  --viz-good: #1E8E5A; --viz-warn: #E0A800; --viz-bad: #D64545; --viz-neutral: #9AA3B2;
  --grid: #E6EAF1; --axis: #C9D0DC;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151B; --surface: #1B1F27; --surface-2: #262B35; --ink: #EEF1F6; --muted: #9AA3B2; --line: #333945;
    --brand: #4D8DF5; --brand-ink: #8FB6FF; --accent: #3A4150; --accent-soft: #1E2A44; --good: #5CC48F;
    --warn: #E6B44C; --warn-soft: #3A3018; --bad: #F06A6A; --bad-ink: #FF8E8E;
    --blue: #4D8DF5; --blue-ink: #8FB6FF; --orange: #E88A4A; --violet: #9D8BF0; --amber-ink: #E6B44C;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 14px 36px -20px rgba(0,0,0,.8);
    --series-1: #4D8DF5; --series-2: #AEB7C6; --series-3: #2BC4C4; --series-4: #E6B44C; --series-5: #9D8BF0; --series-6: #E88AA4;
    --grid: #262B35; --axis: #3E4554; --viz-good: #5CC48F; --viz-warn: #E6B44C; --viz-bad: #F06A6A; --viz-neutral: #6F7786;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151B; --surface: #1B1F27; --surface-2: #262B35; --ink: #EEF1F6; --muted: #9AA3B2; --line: #333945;
  --brand: #4D8DF5; --brand-ink: #8FB6FF; --accent: #3A4150; --accent-soft: #1E2A44; --good: #5CC48F;
  --warn: #E6B44C; --warn-soft: #3A3018; --bad: #F06A6A; --bad-ink: #FF8E8E;
  --blue: #4D8DF5; --blue-ink: #8FB6FF; --orange: #E88A4A; --violet: #9D8BF0; --amber-ink: #E6B44C;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 14px 36px -20px rgba(0,0,0,.8);
  --series-1: #4D8DF5; --series-2: #AEB7C6; --series-3: #2BC4C4; --series-4: #E6B44C; --series-5: #9D8BF0; --series-6: #E88AA4;
  --grid: #262B35; --axis: #3E4554; --viz-good: #5CC48F; --viz-warn: #E6B44C; --viz-bad: #F06A6A; --viz-neutral: #6F7786;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif; font-size: 15px; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand-ink); }
h1, h2 { font-family: "Bricolage Grotesque", "Segoe UI", sans-serif; margin: 0; line-height: 1.1; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif; font-size: 12px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; font-size: .95em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1 1 180px; min-width: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------------------------------------------------------------- top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .bar { display: flex; align-items: center; gap: 12px; padding: 8px clamp(12px, 3vw, 28px); max-width: 1360px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-family: "Bricolage Grotesque", sans-serif; font-weight: 800; font-size: 17px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand svg { width: 32px; height: 32px; flex: none; }
.brand .name { white-space: nowrap; }
.brand .portal { font-family: "IBM Plex Sans", sans-serif; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-ink); background: var(--accent-soft); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.topbar .store { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.topbar .store select { max-width: 220px; }
.topbar .who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; min-width: 0; }
.topbar .who .n { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.topbar .who .r { font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (max-width: 720px) {
  .brand .name { display: none; }
  .topbar .who .n { max-width: 120px; }
  .topbar .store .lbl { display: none; }
}
@media (max-width: 480px) {
  .topbar .who .r { display: none; }
  .topbar .store { display: none; }
  .topbar .store.always { display: flex; }
}

/* ---------------------------------------------------------------- tabs */
.tabs { border-bottom: 1px solid var(--line); background: var(--bg); }
.tabs .in { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 0 clamp(12px, 3vw, 28px); max-width: 1360px; margin: 0 auto; }
.tabs .in::-webkit-scrollbar { display: none; }
.tab { appearance: none; background: none; border: 0; border-bottom: 3px solid transparent; padding: 11px 12px 9px; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
.tab .cnt { display: inline-block; margin-left: 6px; font-size: 11px; background: var(--surface-2); color: var(--muted); padding: 1px 6px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.panel[hidden] { display: none; }

main { flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: 16px clamp(12px, 3vw, 28px) 40px; display: grid; gap: 16px; align-content: start; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }

/* ---------------------------------------------------------------- tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 2px; align-content: start; min-width: 0; }
.tile .label { font-size: 12.5px; color: var(--muted); }
.tile .value { font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -.01em; }
.tile .sub { font-size: 12px; color: var(--muted); }
.tile.accent .value { color: var(--bad-ink); }
.tile .value .unit { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.tile.clickable { cursor: pointer; }
.tile.clickable:hover { border-color: var(--muted); }

/* ---------------------------------------------------------------- controls */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .sep { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { appearance: none; font: inherit; font-size: 13px; font-weight: 500; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.input, select, textarea, input[type="text"], input[type="search"], input[type="password"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], input[type="datetime-local"] {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 38px; max-width: 100%;
}
select { padding-right: 28px; }
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }

.btn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 11px; font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer; line-height: 1.2; white-space: nowrap; color: var(--ink); background: var(--surface-2); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.secondary { background: var(--surface); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--muted); }
.btn.ghost { background: transparent; color: var(--brand-ink); padding-inline: 8px; }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad-ink); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.btn.good { background: var(--good); color: #fff; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .55; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .01em; padding: 2px 9px 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink); white-space: nowrap; line-height: 1.5; vertical-align: middle; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.badge.b-red { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad-ink); }
.badge.b-red::before { background: var(--bad); }
.badge.b-yellow { background: var(--warn-soft); color: var(--amber-ink); }
.badge.b-yellow::before { background: #E0A800; }
.badge.b-blue { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue-ink); }
.badge.b-blue::before { background: var(--blue); }
.badge.b-green { background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); }
.badge.b-green::before { background: var(--good); }
.badge.b-orange { background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); }
.badge.b-orange::before { background: var(--orange); }
.badge.b-violet { background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet); }
.badge.b-violet::before { background: var(--violet); }
.badge.b-gray { color: var(--muted); }
.badge.b-plain::before { display: none; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.pill.inhouse { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue-ink); }
.pill.vendor { background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); background: var(--surface); }
table.grid td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
table.grid tr:first-child td { border-top: 0; }
table.grid tr.row { cursor: pointer; }
table.grid tr.row:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid .sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
table.grid .clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.grid tr.inactive td { opacity: .6; }
table.grid td .btn { vertical-align: middle; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pager .btns { display: flex; gap: 6px; }

.state { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 14.5px; background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; }
.state.err { color: var(--bad-ink); border-color: var(--bad); border-style: solid; }
.state.inline { padding: 16px; border: 0; background: transparent; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.is-loading { opacity: .55; pointer-events: none; transition: opacity .15s; }

/* ---------------------------------------------------------------- cards (technician jobs, list cards) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--muted); }
.card .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card .title { font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; font-size: 18px; line-height: 1.15; }
.card .line { font-size: 13.5px; color: var(--muted); }
.card .line b { color: var(--ink); font-weight: 600; }
.card .excerpt { font-size: 13.5px; border-left: 3px solid var(--line); padding-left: 10px; color: var(--ink); }
.card.urgent { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }

/* ---------------------------------------------------------------- drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; opacity: 0; transition: opacity .18s; }
.drawer-backdrop.open { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--bg); z-index: 41; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s ease; box-shadow: -10px 0 40px -20px rgba(0,0,0,.5); }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.drawer-head h2 { flex: 1; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 16px 48px; -webkit-overflow-scrolling: touch; }
.iconbtn { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 34px; height: 34px; border-radius: 10px; font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; flex: none; }
.iconbtn:hover { border-color: var(--muted); }

.detail-head { display: grid; gap: 6px; margin-bottom: 4px; }
.detail-head .badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.detail-head .name { font-family: "Bricolage Grotesque", sans-serif; font-size: 22px; font-weight: 800; line-height: 1.1; }
.sec { margin-top: 20px; }
.sec + .sec { padding-top: 16px; border-top: 1px solid var(--line); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; }
.fact .k { font-size: 12px; color: var(--muted); }
.fact .v { font-size: 14.5px; overflow-wrap: anywhere; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.box.warn { background: var(--warn-soft); border-color: var(--warn); }
.quote { border-left: 3px solid var(--brand); padding: 6px 12px; background: var(--surface); border-radius: 0 10px 10px 0; white-space: pre-wrap; overflow-wrap: anywhere; }

ul.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
ul.steps li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; font-size: 14px; }
ul.steps .ck { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; }
ul.steps li.done .ck { background: var(--good); border-color: var(--good); }
ul.steps li:not(.done) { color: var(--muted); }
ul.steps .n { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 4px; }

ul.timeline { list-style: none; margin: 4px 0 0 6px; padding: 0 0 0 16px; border-left: 2px solid var(--line); display: grid; gap: 12px; }
ul.timeline li { position: relative; font-size: 14px; }
ul.timeline li::before { content: ""; position: absolute; left: -23px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); border: 2px solid var(--bg); }
ul.timeline li.hi::before { background: var(--brand); }
ul.timeline .when { font-size: 12px; color: var(--muted); }
ul.timeline .who { font-weight: 600; }
ul.timeline .note { white-space: pre-wrap; overflow-wrap: anywhere; }

.mini-list { display: grid; gap: 6px; }
.mini-list .item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: 13.5px; }
.mini-list .item.clickable { cursor: pointer; }
.mini-list .item.clickable:hover { border-color: var(--muted); }
.mini-list .item .grow { flex: 1 1 120px; }

.guide details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-top: 8px; }
.guide summary { cursor: pointer; padding: 10px 14px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.guide summary::after { content: "+"; color: var(--brand); font-weight: 700; }
.guide details[open] summary::after { content: "–"; }
.guide details > :not(summary) { padding: 0 14px 12px; }
.guide ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; font-size: 14px; }
.guide ol li::marker { color: var(--brand); font-weight: 600; }
.guide table.grid { font-size: 13.5px; }
.eq-photo { display: block; width: 100%; max-width: 280px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 560px) { .split { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 14px; }
.kv .k { color: var(--muted); }

/* ---------------------------------------------------------------- modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { width: min(580px, 100%); max-height: 92vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.modal .mhead { display: flex; align-items: center; gap: 10px; padding: 14px 18px 0; }
.modal .mhead h2 { flex: 1; font-size: 19px; }
.modal form, .modal .mbody { display: grid; gap: 12px; padding: 16px 18px 18px; }
.modal .mfoot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; }
.field label .opt { color: var(--muted); font-weight: 400; }
.field .hint { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .field.full { grid-column: 1 / -1; }
@media (max-width: 480px) { .form-grid { grid-template-columns: 1fr; } }
.form-error { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad-ink); border-radius: 10px; padding: 8px 12px; font-size: 13.5px; white-space: pre-wrap; }
.form-note { font-size: 13.5px; color: var(--muted); }
@media (max-width: 520px) {
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 94vh; width: 100%; }
}
.rows-editor { display: grid; gap: 6px; }
.rows-editor .row3 { display: grid; grid-template-columns: 110px 1fr 1fr 34px; gap: 6px; align-items: center; }
@media (max-width: 560px) { .rows-editor .row3 { grid-template-columns: 1fr 1fr; } .rows-editor .row3 .iconbtn { grid-column: 2; justify-self: end; } }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 70; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--accent); color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); pointer-events: auto; animation: rise .18s ease-out; overflow-wrap: anywhere; }
.toast.ok { background: var(--good); color: #fff; }
.toast.err { background: var(--bad); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- charts */
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; transition: opacity .15s; }
.charts.loading { opacity: .5; pointer-events: none; }
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px 12px; display: grid; gap: 8px; align-content: start; min-width: 0; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card .chead { display: flex; align-items: baseline; gap: 8px; }
.chart-card .chead h3 { flex: 1; margin: 0; text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--ink); }
.chart-card .chead .sub { font-size: 12.5px; color: var(--muted); }
.chart-card .canvas-wrap { position: relative; height: 240px; }
.chart-card.tall .canvas-wrap { height: 300px; }
.chart-card .tview { display: none; }
.chart-card[data-view="table"] .canvas-wrap { display: none; }
.chart-card[data-view="table"] .tview { display: block; }
.chart-card .tview .table-wrap { border-radius: 10px; }
.chart-card .tview table.grid { font-size: 13px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.multiples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.multiples .m { display: grid; gap: 4px; }
.multiples .m .t { font-size: 12.5px; color: var(--muted); text-align: center; }
.multiples .m .canvas-wrap { height: 150px; }
@media (max-width: 560px) { .multiples { grid-template-columns: 1fr; } .multiples .m .canvas-wrap { height: 120px; } }
.linkbtn { appearance: none; background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; color: var(--brand-ink); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ---------------------------------------------------------------- login */
.login-wrap { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.login-card .brand { font-size: 19px; }
.login-card .brand svg { width: 40px; height: 40px; }
.login-card h1 { font-size: 24px; }
.login-card form { display: grid; gap: 12px; }
.login-card .btn { width: 100%; padding-block: 12px; }
.login-card .foot { font-size: 13.5px; }

/* ---------------------------------------------------------------- footer */
footer.foot { border-top: 1px solid var(--line); padding: 18px clamp(12px, 3vw, 28px); font-size: 13px; color: var(--muted); text-align: center; }
footer.foot a { color: inherit; }

/* ---------------------------------------------------------------- guides editor + misc */
.editor { display: grid; gap: 14px; max-width: 900px; }
.editor .field textarea { min-height: 120px; font-family: inherit; }
.sticky-actions { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); padding: 10px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.notice { background: var(--warn-soft); border: 1px solid var(--warn); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.sum-line { font-size: 14px; color: var(--muted); }
.sum-line b { color: var(--ink); font-variant-numeric: tabular-nums; }
.search-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- people: sign-in details, stores checklist, inline role */
.creds { display: grid; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.creds .row { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: center; }
.creds .k { font-size: 12px; color: var(--muted); }
.creds .v { font-size: 17px; font-weight: 600; letter-spacing: .02em; overflow-wrap: anywhere; user-select: all; }
.checks { display: grid; gap: 4px; max-height: 240px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.check-item { display: flex; align-items: flex-start; gap: 10px; padding: 6px 8px; border-radius: 8px; font-size: 14px; cursor: pointer; user-select: none; }
.check-item:hover { background: var(--surface-2); }
.check-item input { width: 18px; height: 18px; accent-color: var(--brand); margin: 2px 0 0; flex: none; }
.check-item .sub { display: block; font-size: 12px; color: var(--muted); }
.input.sm, select.sm { min-height: 32px; padding: 4px 8px; font-size: 13px; border-radius: 8px; }
.role-select { max-width: 160px; }
.store-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink); white-space: nowrap; }

/* ---------------------------------------------------------------- technician: store step + job cards */
.store-step { display: flex; flex-wrap: wrap; gap: 8px; }
.store-chip { appearance: none; font: inherit; text-align: left; display: grid; gap: 1px; padding: 8px 14px; min-width: 150px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.store-chip:hover { border-color: var(--muted); }
.store-chip[aria-pressed="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.store-chip .t { font-weight: 600; font-size: 14px; }
.store-chip .s { font-size: 12px; color: var(--muted); }
.store-chip .n { font-size: 12px; color: var(--brand-ink); font-weight: 600; }
.card.job .job-head { display: flex; gap: 12px; align-items: flex-start; }
.card.job .thumb { width: 72px; height: 54px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); flex: none; }
.card.late { border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }
.store-did { display: grid; gap: 6px; }
.store-did .excerpt { font-size: 13.5px; border-left: 3px solid var(--line); padding-left: 10px; color: var(--ink); white-space: pre-wrap; }
.actions .btn + .btn { margin-left: 0; }

/* ---------------------------------------------------------------- alerts toggle (administrator) */
#alerts[aria-pressed="true"] { border-color: var(--brand); color: var(--brand-ink); }
