/* ===== Amp-Hour ===== */
:root {
  --bg: #f4f4f1; --surface: #ffffff; --surface-2: #f7f7f4; --surface-3: #ecece8;
  --border: #dddcd6; --border-strong: #b8b7af;
  --text: #1b1b19; --text-2: #585853; --text-3: #767670;
  --primary: #1f5f8b; --primary-hover: #184d72;
  --primary-soft-light: #e6eef4; --primary-soft-dark: #1c3346; --primary-light: #799fb9;
  --primary-soft: var(--primary-soft-light); --link: var(--primary);
  --ok: #1d7a4b; --ok-soft: #e6f3ec; --warn: #9a5b00; --warn-soft: #fbf0da; --bad: #b42318; --bad-soft: #fbe9e6;
  --info: #3b5bb8; --info-soft: #e9edf8; --muted-soft: #ecece8;
  --shadow-lg: 0 8px 24px rgba(0,0,0,.18);
  --radius: 4px; --radius-sm: 3px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, "DejaVu Sans Mono", "Liberation Mono", monospace;
  --doc-font: Arial, Helvetica, "Liberation Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #141619; --surface: #1c1f23; --surface-2: #22262b; --surface-3: #2a2f35;
  --border: #30353c; --border-strong: #474e57;
  --text: #e6e6e2; --text-2: #a9aba6; --text-3: #80827d;
  --primary-soft: var(--primary-soft-dark); --link: var(--primary-light);
  --ok: #5fbf86; --ok-soft: #1b2f24; --warn: #e0a042; --warn-soft: #352a14; --bad: #ef7b6f; --bad-soft: #3a1f1c;
  --info: #8fa4ea; --info-soft: #202845; --muted-soft: #2a2f35;
  --shadow-lg: 0 8px 24px rgba(0,0,0,.5);
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #141619; --surface: #1c1f23; --surface-2: #22262b; --surface-3: #2a2f35;
  --border: #30353c; --border-strong: #474e57;
  --text: #e6e6e2; --text-2: #a9aba6; --text-3: #80827d;
  --primary-soft: var(--primary-soft-dark); --link: var(--primary-light);
  --ok: #5fbf86; --ok-soft: #1b2f24; --warn: #e0a042; --warn-soft: #352a14; --bad: #ef7b6f; --bad-soft: #3a1f1c;
  --info: #8fa4ea; --info-soft: #202845; --muted-soft: #2a2f35;
  --shadow-lg: 0 8px 24px rgba(0,0,0,.5);
  color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); font-variant-numeric: tabular-nums; }
a { color: var(--link); text-decoration: none; } a:hover { text-decoration: underline; }
abbr[title] { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; font-weight: 600; } h2 { font-size: 14px; font-weight: 600; } h3 { font-size: 13px; font-weight: 600; } h4 { font-size: 13px; font-weight: 600; }
p { margin: 0 0 8px; } p:last-child { margin-bottom: 0; }
code, .mono, .id { font-family: var(--mono); font-size: .92em; }
.boot { padding: 40px; color: var(--text-2); }
.muted { color: var(--text-2); } .faint { color: var(--text-3); } .small { font-size: 12px; line-height: 1.35; } .right { text-align: right; } .nowrap { white-space: nowrap; } .hidden { display: none !important; }
.bad { color: var(--bad); } .warn { color: var(--warn); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .stack { display: flex; flex-direction: column; gap: 16px; } .spacer { flex: 1; } .grow { flex: 1; }
svg { flex: none; vertical-align: -3px; }
.mark { vertical-align: middle; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); color: var(--text); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; }
.brand { display: flex; align-items: center; gap: 8px; padding: 0 16px; min-height: 44px; color: var(--text); border-bottom: 1px solid var(--border); }
.brand:hover { text-decoration: none; } .brand .mark { color: var(--primary); }
.brand-logo { max-height: 28px; max-width: 170px; object-fit: contain; display: block; }
.brand-name { font-weight: 600; font-size: 14px; line-height: 1.3; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand small, .brand-sub { display: block; font-weight: 400; font-size: 12px; line-height: 1.35; color: var(--text-2); }
.brand-sub { padding: 6px 16px 0; } .brand-sub a { color: var(--text-2); }
.nav { padding: 6px 8px 16px; flex: 1; }
.nav-group { margin-top: 10px; } .nav-group:first-child { margin-top: 0; }
.nav-head { font-size: 11px; line-height: 1.3; font-weight: 600; color: var(--text-3); padding: 4px 10px; cursor: pointer; display: flex; align-items: center; user-select: none; }
.nav-head svg { margin-left: auto; width: 12px; height: 12px; transform: rotate(90deg); }
.nav-group.collapsed .nav-head svg { transform: none; } .nav-group.collapsed .nav-items { display: none; }
.nav a { display: flex; align-items: center; gap: 8px; color: var(--text-2); padding: 5px 10px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.4; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--link); font-weight: 600; box-shadow: inset 2px 0 0 var(--primary); }
.nav a svg { width: 15px; height: 15px; color: var(--text-3); } .nav a.active svg { color: var(--link); }
.sidebar-foot { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; line-height: 1.35; color: var(--text-2); }
.sidebar-foot a { color: var(--text-2); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.search { position: relative; }
.topbar-search { width: 320px; max-width: 40vw; height: 32px; }
.search-dd { position: absolute; left: 0; top: 36px; width: min(560px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 30; max-height: 60vh; overflow-y: auto; padding: 4px; }
.search-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); color: var(--text); font-size: 13px; }
.search-item span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .search-item .group { font-size: 12px; color: var(--text-3); }
.search-item svg { width: 14px; height: 14px; color: var(--text-3); }
.search-item.sel, .search-item:hover { background: var(--surface-2); text-decoration: none; }
.btn.icon { width: 32px; height: 32px; padding: 0; justify-content: center; }
.menu-btn { display: none; }
.bell { position: relative; } .bell .dot { position: absolute; top: 2px; right: 2px; background: var(--bad); color: #fff; font: 600 10px/14px var(--font); border-radius: 9px; padding: 0 4px; min-width: 14px; text-align: center; font-style: normal; }
.user-menu { position: relative; } .user-menu > .btn svg { width: 12px; height: 12px; transform: rotate(90deg); color: var(--text-3); }
.menu { position: absolute; right: 0; top: 38px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 220px; z-index: 30; padding: 4px; }
.menu-head { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; font-size: 13px; }
.menu a { display: block; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: 13px; } .menu a:hover { background: var(--surface-2); text-decoration: none; }
.banner { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 24px; font-size: 13px; line-height: 1.4; background: var(--surface-2); color: var(--text-2); border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; }
.banner span { overflow: hidden; text-overflow: ellipsis; }
.banner.bad, .banner.warn { background: var(--bad-soft); color: var(--bad); } .banner.bad a, .banner.warn a { color: inherit; text-decoration: underline; }
.content { padding: 20px 24px 48px; max-width: 1560px; width: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 200px; } .page-head .sub { color: var(--text-2); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.page-head .row { gap: 8px; }
.crumbs { font-size: 12px; line-height: 1.35; color: var(--text-3); margin-bottom: 2px; } .crumbs a { color: var(--text-3); }

/* ---------- Cards, grids, strip ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card > .card-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; } .card > .card-head h2, .card > .card-head h3 { flex: 1; font-size: 14px; font-weight: 600; min-width: 0; }
.card > .card-body { padding: 16px; } .card > .card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; } .grid > *, .stack > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.g-side > .stack:last-child { gap: 12px; }
.strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); margin-bottom: 16px; }
.strip.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } .strip.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .strip.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .strip.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.strip > * { display: block; padding: 10px 14px; color: inherit; min-width: 0; border-left: 1px solid var(--border); }
.strip > *:first-child { border-left: 0; }
.strip > a:hover { text-decoration: none; background: var(--surface-2); }
.strip-label, .strip .label { font-size: 12px; line-height: 1.35; color: var(--text-2); }
.strip .value { font-size: 20px; line-height: 1.25; font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip .note { font-size: 12px; line-height: 1.35; color: var(--text-3); margin-top: 2px; }
.strip > .bad .value { color: var(--bad); } .strip > .warn .value { color: var(--warn); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; display: block; color: inherit; min-width: 0; }
a.kpi:hover { text-decoration: none; background: var(--surface-2); }
.kpi .label { font-size: 12px; line-height: 1.35; color: var(--text-2); } .kpi .value { font-size: 20px; line-height: 1.25; font-weight: 600; margin-top: 2px; } .kpi .note { font-size: 12px; line-height: 1.35; color: var(--text-3); margin-top: 2px; }
.kpi.bad .value { color: var(--bad); } .kpi.warn .value { color: var(--warn); }
dl.props { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; } dl.props dt { color: var(--text-2); font-size: 13px; line-height: 1.5; } dl.props dd { margin: 0; min-width: 0; overflow-wrap: anywhere; } dl.props dd.num { text-align: right; }
dl.props.facts { gap: 0; align-items: stretch; } dl.props.facts dt, dl.props.facts dd { padding: 6px 0; border-bottom: 1px solid var(--border); align-self: stretch; } dl.props.facts dt { padding-right: 16px; } dl.props.facts dt:last-of-type, dl.props.facts dd:last-of-type { border-bottom: 0; }
.hold-notice { border: 2px solid var(--bad); background: var(--bad); color: #fff; font: 700 20px/1.25 var(--font); padding: 8px 12px; text-align: center; }
.worklist .due-inline { display: none; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.4; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data th { font-size: 12px; line-height: 1.35; font-weight: 600; color: var(--text-2); border-bottom-color: var(--border-strong); white-space: nowrap; cursor: default; user-select: none; }
table.data th.sortable { cursor: pointer; } table.data th.sortable:hover { color: var(--text); }
table.data td.num, table.data th.num { text-align: right; }
table.data td .mono, table.data td .id, table.data td.date { white-space: nowrap; }
table.data tbody tr.clickable { cursor: pointer; } table.data tbody tr.clickable:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
table.data tr.sub td { background: var(--surface-2); font-size: 12px; line-height: 1.35; font-weight: 600; color: var(--text-2); padding-top: 4px; padding-bottom: 4px; }
table.data.compact th, table.data.compact td { padding: 5px 8px; }
table.data td .small, table.data td .sub { color: var(--text-2); }
.empty { padding: 16px; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); } .toolbar input[type=search] { width: 260px; max-width: 100%; }

/* ---------- Badges, priority ---------- */
.badge { display: inline-block; font: 600 11px/16px var(--font); padding: 1px 5px; border-radius: var(--radius-sm); border: 1px solid currentColor; background: transparent; color: var(--text-2); white-space: nowrap; text-transform: none; }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.bad { color: var(--bad); } .badge.info { color: var(--info); } .badge.primary { color: var(--link); }
.pri { font: 600 12px/1.35 var(--mono); color: var(--text-3); white-space: nowrap; } .pri.p1 { color: var(--bad); } .pri.p2 { color: var(--warn); }

/* ---------- Forms ---------- */
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 1.35; color: var(--text-2); font-weight: 600; min-width: 0; }
label.field.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; font-weight: 400; }
.field .help { font-size: 12px; color: var(--text-3); font-weight: 400; } .field.req > span::after { content: " *"; color: var(--bad); }
input, select, textarea { font: inherit; font-size: 14px; font-weight: 400; line-height: 1.45; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 6px 8px; min-width: 0; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color]), select { height: var(--input-h, 32px); padding-top: 0; padding-bottom: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; } input[type=file] { border: 0; background: none; padding: 0; }
textarea { min-height: 70px; resize: vertical; } input[readonly] { background: var(--surface-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; } .form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.lines-table input, .lines-table select { width: 100%; --input-h: 28px; padding-left: 6px; padding-right: 6px; } .lines-table td { padding: 4px 6px; }
.err { color: var(--bad); font-size: 13px; }
.ob-steps { display: flex; flex-direction: column; gap: 8px; }
.ob-step { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; align-items: start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); }
.ob-step.done { opacity: .75; } .ob-step.done .ob-title b { text-decoration: line-through; text-decoration-color: var(--text-3); }
.ob-num { width: 26px; height: 26px; border: 1px solid var(--border-strong); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ob-num.done { background: var(--ok); border-color: var(--ok); color: #fff; } .ob-num.done svg { width: 14px; height: 14px; }
.ob-inline { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); } .ob-inline .form-grid { margin-bottom: 8px; }
.ob-kit { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 18px; } .ob-tour ol { margin: 6px 0 0; padding-left: 20px; } .ob-tour li { margin: 3px 0; }
@media (max-width: 700px) { .ob-step { grid-template-columns: 28px 1fr; } .ob-act { grid-column: 2; } }
.pw-meter { margin-top: 6px; } .pw-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; } .pw-bars i { display: block; height: 4px; background: var(--border); border-radius: 1px; }
.pw-bars[data-score="1"] i:nth-child(-n+1), .pw-bars[data-score="0"] i:nth-child(-n+1) { background: var(--bad); } .pw-bars[data-score="2"] i:nth-child(-n+2) { background: var(--warn); }
.pw-bars[data-score="3"] i:nth-child(-n+3) { background: var(--ok); } .pw-bars[data-score="4"] i { background: var(--ok); }
.pw-text { font-size: 12px; color: var(--text-3); margin-top: 4px; font-weight: 400; } .pw-text.bad { color: var(--bad); } .pw-text.warn { color: var(--warn); } .pw-text.ok { color: var(--ok); }
.swatch { width: 22px; height: 22px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); cursor: pointer; padding: 0; } .swatch.sel, .swatch[aria-pressed=true] { outline: 2px solid var(--text); outline-offset: 1px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 13px/1 var(--font); cursor: pointer; white-space: nowrap; transition: background .1s, border-color .1s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; } .btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--bad); border-color: var(--bad); } .btn.danger:hover { background: var(--bad-soft); }
.btn.ok { background: var(--primary); border-color: var(--primary); color: #fff; } .btn.ok:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); } .btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; } .btn.lg { height: 36px; padding: 0 18px; font-size: 14px; } .btn:disabled { opacity: .5; cursor: not-allowed; } .btn svg { width: 14px; height: 14px; stroke-width: 1.75; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 13px; font-weight: 600; white-space: nowrap; } .tabs a:hover { color: var(--text); text-decoration: none; } .tabs a.active { color: var(--link); border-bottom-color: var(--link); }

/* ---------- Modal, drawer, toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 22, 25, .5); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: min(640px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; margin: 0; }
.modal.wide { width: min(980px, 100%); }
.modal-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; } .modal-head h2 { flex: 1; font-size: 16px; line-height: 1.3; font-weight: 600; } .modal-body { padding: 16px; overflow-y: auto; } .modal-foot { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.drawer { position: fixed; inset: 0; background: rgba(20, 22, 25, .5); z-index: 90; } .drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(420px, 100%); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 0 16px; min-height: 44px; border-bottom: 1px solid var(--border); } .drawer-head h2 { font-size: 14px; } .drawer-body { overflow-y: auto; padding: 4px 8px; }
.notif { display: flex; gap: 4px; align-items: flex-start; border-bottom: 1px solid var(--border); color: var(--text); font-size: 13px; line-height: 1.4; } .notif:last-child { border-bottom: 0; } .notif:hover { background: var(--surface-2); }
.notif-main { flex: 1; min-width: 0; display: block; padding: 8px; color: inherit; } .notif-main:hover { text-decoration: none; } .notif-main b { font-weight: 400; display: block; } .notif.unread .notif-main b { font-weight: 600; }
.notif.unread { box-shadow: inset 3px 0 0 var(--link); } .notif-del { margin: 6px 6px 0 0; opacity: .55; } .notif:hover .notif-del, .notif-del:focus { opacity: 1; }
.drawer-foot { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 13px; margin-top: auto; }
.nav-count { margin-left: auto; background: var(--link); color: #fff; font: 600 10px/16px var(--font); font-style: normal; border-radius: 8px; padding: 0 5px; min-width: 16px; text-align: center; }
/* Notifications page */
.notif-page .notif { font-size: 14px; } .notif-page .notif-main { padding: 10px 12px; } .notif-page .notif-del { margin: 8px 8px 0 0; }
.notif-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; } .notif-filters select, .notif-filters input { height: 30px; }
/* Messages: list on the left, thread on the right; one pane at a time on a phone */
.msgs { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; height: calc(100vh - 44px - 40px - 72px); min-height: 420px; }
.msgs > .pane { min-width: 0; } .msgs .pane { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; }
.msgs .pane-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); min-height: 44px; } .msgs .pane-head h2 { font-size: 14px; font-weight: 600; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-list { overflow-y: auto; flex: 1; } .conv { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text); align-items: flex-start; } .conv:hover { background: var(--surface-2); text-decoration: none; } .conv.active { background: var(--primary-soft); }
.conv .who { font-weight: 600; display: flex; gap: 8px; align-items: baseline; } .conv .who span { font-weight: 400; color: var(--text-3); font-size: 12px; margin-left: auto; white-space: nowrap; } .conv .last { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv > div { flex: 1; min-width: 0; } .conv .count { background: var(--link); color: #fff; font: 600 11px/18px var(--font); border-radius: 9px; padding: 0 6px; margin-top: 2px; } .conv.unread .last { color: var(--text); font-weight: 500; }
.thread { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.msg { max-width: min(78%, 640px); padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; position: relative; } .msg .body { white-space: pre-wrap; }
.msg.mine { align-self: flex-end; background: var(--primary-soft); } .msg .meta { font-size: 11px; color: var(--text-3); margin-top: 2px; white-space: normal; } .msg.mine .meta { text-align: right; }
.msg .link { display: inline-block; margin-top: 4px; font-size: 13px; padding: 2px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); } .msg .link:hover { text-decoration: none; border-color: var(--link); }
.msg.deleted { color: var(--text-3); font-style: italic; } .msg .tools { position: absolute; top: -10px; right: 6px; display: none; gap: 2px; } .msg:hover .tools { display: flex; } .msg .tools .btn { padding: 0 4px; height: 20px; background: var(--surface); border: 1px solid var(--border); }
.day-sep { align-self: center; font-size: 11px; color: var(--text-3); margin: 10px 0 4px; }
.sender { font-size: 12px; color: var(--text-2); margin: 8px 0 1px; font-weight: 600; } .msg.mine + .sender, .sender.mine { display: none; }
.composer { border-top: 1px solid var(--border); padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.composer textarea { width: 100%; min-width: 0; resize: none; min-height: 38px; max-height: 160px; font: inherit; } .composer .attach { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); flex-wrap: wrap; } .composer .attach select { height: 28px; max-width: 160px; }
.people { display: grid; gap: 4px; max-height: 320px; overflow-y: auto; } .people label { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 400; color: var(--text); } .people label:hover { background: var(--surface-2); } .people .role { margin-left: auto; color: var(--text-3); font-size: 12px; }
.members { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) { .msgs .pane-head { flex-wrap: wrap; } .msgs .pane-head > div { flex: 1 1 160px; } .msgs { grid-template-columns: 1fr; height: calc(100vh - 56px - 24px - 48px); } .msgs.has-thread .pane.list { display: none; } .msgs:not(.has-thread) .pane.thread-pane { display: none; } .msg { max-width: 92%; } }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--text); color: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-width: 380px; font-size: 13px; line-height: 1.4; cursor: pointer; } .toast.bad { background: var(--bad); color: #fff; } .toast.ok { background: var(--ok); color: #fff; }

/* ---------- Auth screens ---------- */
.auth { min-height: 100vh; display: grid; place-items: start center; padding: 64px 16px 24px; background: var(--bg); }
.auth-box { width: min(380px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; line-height: 1.3; color: var(--text); margin-bottom: 16px; } .auth-brand:hover { text-decoration: none; } .auth-brand .mark { color: var(--primary); }
.auth-card { background: var(--surface); border: 1px solid var(--border-strong); border-top: 3px solid var(--primary); border-radius: var(--radius); padding: 24px 28px; }
.auth-card h1 { font-size: 16px; line-height: 1.3; font-weight: 600; } .auth-card .sub { font-size: 13px; line-height: 1.4; color: var(--text-2); margin-top: 4px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; } .auth-form input { --input-h: 36px; } .auth-form .btn.lg { width: 100%; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.auth-foot { color: var(--text-3); font-size: 12px; line-height: 1.35; margin-top: 16px; }
.org-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font: inherit; color: var(--text); cursor: pointer; } .org-row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.org-row b { font-size: 14px; font-weight: 600; } .org-row svg { color: var(--text-3); }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; } .plan.current { border-color: var(--text); }
.plan .price { font-size: 24px; font-weight: 600; } .plan .price span { font-size: 13px; color: var(--text-2); font-weight: 400; } .plan ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; flex: 1; }

/* ---------- Board / planning ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.lane { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); min-height: 120px; } .lane-head { padding: 8px 12px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); font-size: 13px; } .lane-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.ticket { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12px; line-height: 1.35; cursor: pointer; display: block; color: inherit; } .ticket:hover { border-color: var(--border-strong); text-decoration: none; }
.ticket.late { border-left: 3px solid var(--bad); } .ticket.soon { border-left: 3px solid var(--warn); } .ticket.hold { border-left: 3px solid var(--text-3); } .ticket b { font: 600 13px/1.35 var(--mono); }
.progress { height: 3px; background: var(--muted-soft); overflow: hidden; margin-top: 6px; } .progress > i { display: block; height: 100%; background: var(--link); }
.load { display: grid; grid-template-columns: 180px 1fr 70px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; } .load .track { height: 12px; background: var(--muted-soft); overflow: hidden; position: relative; } .load .track i { display: block; height: 100%; background: var(--link); } .load .track i.over { background: var(--bad); }

/* ---------- Routing / ops ---------- */
.ops { display: flex; flex-direction: column; } .op { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); align-items: start; } .op:last-child { border-bottom: 0; }
.op .dot { width: 22px; height: 22px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); display: grid; place-items: center; font: 600 11px/1 var(--mono); background: var(--surface); color: var(--text-2); }
.op.running .dot { border-color: var(--link); color: var(--link); } .op.done .dot { background: var(--surface-3); color: var(--text-2); } .op .instr { white-space: pre-wrap; font-size: 12px; line-height: 1.35; color: var(--text-2); margin-top: 3px; }
.floor-scan { font-size: 22px; --input-h: 48px; padding-left: 12px; padding-right: 12px; width: 100%; font-family: var(--mono); } .floor-actions { display: flex; gap: 12px; flex-wrap: wrap; } .floor-actions .btn { height: 44px; font-size: 15px; padding: 0 18px; }

/* ---------- Charts ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; } .bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; min-width: 0; } .bars .bar i { display: block; width: 100%; max-width: 38px; background: var(--link); min-height: 2px; } .bars .bar span { font-size: 11px; line-height: 1.3; color: var(--text-3); white-space: nowrap; }
.hbar { display: grid; grid-template-columns: 150px 1fr 60px; gap: 8px; align-items: center; font-size: 13px; margin: 5px 0; } .hbar .track { background: var(--muted-soft); height: 12px; overflow: hidden; } .hbar .track i { display: block; height: 100%; background: var(--link); }
.spark { width: 100%; height: 40px; }
.spc { position: relative; height: 170px; } .spc svg { width: 100%; height: 100%; }

/* ---------- Documents (print) ---------- */
@page { size: letter; margin: .45in; }
.doc { background: #fff; color: #000; max-width: 8.5in; margin: 0 auto; padding: .5in; border: 1px solid var(--border-strong); border-radius: 0; font: 11px/1.3 var(--doc-font); }
.doc h1 { font: 700 20px/1.2 var(--doc-font); text-transform: uppercase; } .doc h2, .doc h3 { font-family: var(--doc-font); color: #000; }
.doc table { width: 100%; border-collapse: collapse; margin-top: 8px; } .doc th, .doc td { border: 1px solid #000; padding: 3px 5px; text-align: left; vertical-align: top; } .doc th { background: #fff; font-weight: 700; font-size: 10px; text-transform: none; }
.doc thead { display: table-header-group; }
.doc .mono, .doc .id { font-family: var(--mono); font-size: 11px; } .doc .small { font-size: 10px; } .doc b { font-weight: 700; }
.doc .label { font: 700 9px/1.2 var(--doc-font); text-transform: uppercase; color: #333; display: block; margin-bottom: 1px; }
.doc .fill { min-height: 28px; } .doc table.sig td { height: .45in; vertical-align: bottom; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 8px; } .doc .doc-logo { height: 44px; max-width: 200px; object-fit: contain; margin-bottom: 6px; display: block; }
.doc .addr { white-space: pre-line; } .doc .box { border: 1px solid #000; padding: 6px; } .doc div.sig { margin-top: 32px; display: flex; gap: 40px; } .doc div.sig div { flex: 1; border-top: 1px solid #000; padding-top: 4px; font-size: 10px; } .doc .num { text-align: right; }
.doc .pass { font-weight: 700; } .doc .fail, .doc .bad, .doc .warn { color: #000; font-weight: 700; } .doc .doc-foot { margin-top: 12px; font-size: 9px; color: #000; border-top: 1px solid #000; padding-top: 4px; }
.doc .hold-notice { background: #fff; color: #000; border: 2px solid #000; font-family: var(--doc-font); }
.doc .badge { border-color: #000; color: #000; } .doc a { color: inherit; }
.doc-actions { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; } .barcode svg { height: 44px; } .traveler-op { page-break-inside: avoid; }
.barcode-text { font-family: var(--mono); font-size: 11px; text-align: center; margin-top: 1px; } .barcode-big { font: 700 24px/1.1 var(--mono); text-align: center; margin-top: 2px; }
.doc table.actuals { margin-top: 6px; width: 100%; } .doc table.actuals td { border: 1px solid #000; padding: 2px 5px; font-size: 10px; height: 28px; } .doc table.actuals tr:first-child td { background: #fff; color: #000; height: auto; font-weight: 700; }
.doc.traveler + .doc.traveler, .page-break + .doc.traveler { margin-top: 16px; }
.barcode-pair { display: flex; align-items: center; gap: 8px; } .barcode-pair .qr svg { display: block; }
.label-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.3in, 1fr)); gap: 8px; } .label-sheet .label { display: flex; gap: 10px; align-items: center; border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 8px; background: #fff; color: #000; break-inside: avoid; }
.label-sheet .label-title { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .label-sheet .label .barcode svg { height: 30px; max-width: 100%; }

/* ---------- Camera scanner ---------- */
.scanner { position: fixed; inset: 0; z-index: 300; background: #000; color: #fff; display: flex; flex-direction: column; }
.scanner-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); background: rgba(0,0,0,.6); } .scanner-top .btn { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); }
.scanner-view { position: relative; flex: 1; overflow: hidden; display: grid; place-items: center; } .scanner-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: relative; width: min(82vw, 520px); aspect-ratio: 2 / 1; border: 2px solid rgba(255,255,255,.9); border-radius: var(--radius); box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.scanner-frame i { position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #ff4d4d; animation: scanline 1.6s ease-in-out infinite alternate; } @keyframes scanline { from { transform: translateY(-36px); } to { transform: translateY(36px); } }
.scanner-msg { padding: 12px 16px; text-align: center; font-size: 15px; background: rgba(0,0,0,.6); } .scanner-msg a { color: #8cc8ff; word-break: break-all; }
.scanner-manual { display: flex; gap: 8px; padding: 10px 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); background: rgba(0,0,0,.6); } .scanner-manual input { flex: 1; font-size: 17px; text-transform: uppercase; }

/* ---------- Security tab (Settings) ---------- */
.sec-line { gap: 8px; } .sec-line .badge { flex: none; }
.sec-notice { padding: 10px 14px; margin-bottom: 16px; border: 1px solid var(--warn); background: var(--warn-soft); color: var(--text); font-size: 13px; line-height: 1.45; }
.sec-steps { margin: 12px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 14px; font-size: 13px; line-height: 1.45; }
.sec-steps li::marker { color: var(--text-2); font-weight: 600; }
.sec-qr { display: block; width: max-content; margin: 10px 0 8px; padding: 8px; background: #fff; border: 1px solid var(--border); line-height: 0; }
.sec-qr svg { display: block; }
.sec-secret { display: inline-block; margin: 6px 0 4px; padding: 4px 8px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; letter-spacing: .06em; user-select: all; cursor: text; }
.sec-codes { border-color: var(--warn); margin-bottom: 16px; }
.sec-codes-meta { margin-top: 4px; }
.sec-code-list { margin: 12px 0 0; padding: 12px 16px; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 16px; border: 1px solid var(--border); font-size: 15px; line-height: 1.6; letter-spacing: .06em; }
.sec-codes-actions { margin-top: 12px; }
.sec-pending b { color: var(--bad); }
.sec-table-note { padding: 10px 16px; margin: 0; border-bottom: 1px solid var(--border); }
#sessions td:last-child { text-align: right; white-space: nowrap; }
@media print {
  body.print-codes .page-head, body.print-codes #pg > :not(.sec-codes), body.print-codes .sec-codes-actions, body.print-codes .sec-codes .badge { display: none !important; }
  body.print-codes .sec-codes { border: 0; } body.print-codes .sec-codes > .card-head { border: 0; padding-left: 0; } body.print-codes .sec-codes > .card-body { padding-left: 0; }
  body.print-codes .sec-code-list { grid-template-columns: repeat(2, 1fr); color: #000; border-color: #000; }
}

@media print {
  body { background: #fff; } .sidebar, .topbar, .banner, .doc-actions, .no-print, #toasts, .tabs, .page-head .row, .search-dd { display: none !important; } .layout { display: block; } .content { padding: 0; max-width: none; }
  .doc { border: 0; padding: 0; max-width: none; } .page-break { page-break-after: always; } .doc.traveler { page-break-after: always; } .doc.traveler:last-child { page-break-after: auto; }
  .label-sheet { grid-template-columns: repeat(2, 1fr); } .content:has(#labels) .page-head { display: none; } .card:has(#labels) { border: 0; } .card:has(#labels) > .card-head { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-side { grid-template-columns: 1fr; }
  .strip, .strip.c4, .strip.c5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .strip > *:nth-child(3n+1) { border-left: 0; } .strip > *:nth-child(n+4) { border-top: 1px solid var(--border); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .1s; } .layout.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .layout.nav-open::before { content: ""; position: fixed; inset: 0; background: rgba(20, 22, 25, .5); z-index: 45; }
  .menu-btn { display: inline-flex; } .topbar { padding: 0 12px; gap: 4px; } .topbar > * { flex-shrink: 0; } .search { flex: 1 1 0; min-width: 0; } .topbar-search { width: 100%; max-width: none; } .topbar .spacer { display: none; } .content { padding: 16px 16px 40px; }
  .banner { padding: 0 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; } .toolbar input[type=search] { width: 100%; } .hbar { grid-template-columns: 100px 1fr 50px; } .load { grid-template-columns: 110px 1fr 60px; } .doc { padding: 16px; overflow-x: auto; } .cam-label { display: none; } .auth-card { padding: 20px; }
  .modal-foot { flex-wrap: wrap; } .modal-foot .btn { flex: 1 1 auto; }
  .table-wrap table.data th:first-child, .table-wrap table.data td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
  .table-wrap table.data tr.sub td:first-child, .table-wrap table.data tfoot td:first-child { background: var(--surface-2); }
}
@media (max-width: 600px) {
  .strip, .strip.c3, .strip.c4, .strip.c5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .worklist .due-col { display: none; } .worklist .due-inline { display: block; }
  .dash > .stack { display: contents; } .dash .pf-1 { order: -2; } .dash .pf-2 { order: -1; }
  .strip > *:nth-child(n) { border-left: 1px solid var(--border); border-top: 0; } .strip > *:nth-child(2n+1) { border-left: 0; } .strip > *:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 480px) {
  #theme-btn { display: none; } .user-menu > .btn svg { display: none; }
  input, select, textarea { font-size: 16px; } .strip .value { font-size: 18px; }
}

/* Guided tour: a spotlight cut out of a dimmed page and one card beside it */
.tour { position: fixed; inset: 0; z-index: 150; pointer-events: none; }
.tour-spot { position: fixed; border-radius: 6px; box-shadow: 0 0 0 9999px rgba(20, 22, 25, .55), 0 0 0 2px var(--link); transition: left .15s, top .15s, width .15s, height .15s; }
.tour[data-target="0"]::before { content: ""; position: fixed; inset: 0; background: rgba(20, 22, 25, .55); }
.tour-card { position: fixed; pointer-events: auto; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 12px 14px; font-size: 13px; line-height: 1.45; }
.tour-card .tour-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; } .tour-card .tour-head b { font-size: 14px; }
.tour-card p { margin: 0 0 10px; } .tour-card .tour-foot { display: flex; gap: 6px; align-items: center; }
