/* Samani Design office system.
   Layout: dark left rail with role-based navigation, light working area; collapses to a top bar on iPads/phones. */
:root {
  --bg: #eef0ec; --surface: #ffffff; --sunk: #f6f7f4; --line: #dadfd8; --line-2: #c9cfc6;
  --fg: #1c211f; --muted: #5f6863; --faint: #8b938e;
  --rail: #1f2a27; --rail-2: #2b3833; --rail-fg: #d6ddd9; --rail-muted: #93a19b;
  --accent: #9a6a22; --accent-2: #7d5418; --accent-soft: #f5ead8; --on-accent: #ffffff;
  --crit: #b3261e; --crit-soft: #fbe7e5; --warn: #9c5a00; --warn-soft: #fdf0dc;
  --ok: #2e7d4f; --ok-soft: #e3f2e8; --info: #2f5e8c; --info-soft: #e3ecf6; --mute-soft: #eceeeb;
  --t-design: #6b5ca5; --t-stage: #6b5ca5; --t-shop: #9a6a22; --t-steel: #4f6470; --t-pool: #227c8f; --t-tile: #2e7d4f; --t-ceil: #7a6a4f; --t-gen: #7a7f7c; --t-sign: #b3261e;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 16px rgba(20, 30, 25, .06);
  --radius: 8px;
  --f: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --f-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131715; --surface: #1b201e; --sunk: #171b19; --line: #2c3431; --line-2: #3a4440;
    --fg: #e6eae7; --muted: #a0a9a4; --faint: #77817c;
    --rail: #0f1312; --rail-2: #1c2421; --rail-fg: #d6ddd9; --rail-muted: #85928c;
    --accent: #d9a65a; --accent-2: #e8bb76; --accent-soft: #3a2f1e; --on-accent: #1a1408;
    --crit: #f08a82; --crit-soft: #3b1e1c; --warn: #f0b35a; --warn-soft: #3a2c17;
    --ok: #7cc79a; --ok-soft: #1c3326; --info: #8ab4e0; --info-soft: #1c2a3a; --mute-soft: #252b28;
    --t-design: #9c8fd6; --t-stage: #9c8fd6; --t-shop: #d9a65a; --t-steel: #8fa6b3; --t-pool: #5fb8ca; --t-tile: #6dbb8c; --t-ceil: #c2ad86; --t-gen: #8d9390; --t-sign: #f08a82;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131715; --surface: #1b201e; --sunk: #171b19; --line: #2c3431; --line-2: #3a4440;
  --fg: #e6eae7; --muted: #a0a9a4; --faint: #77817c;
  --rail: #0f1312; --rail-2: #1c2421; --rail-fg: #d6ddd9; --rail-muted: #85928c;
  --accent: #d9a65a; --accent-2: #e8bb76; --accent-soft: #3a2f1e; --on-accent: #1a1408;
  --crit: #f08a82; --crit-soft: #3b1e1c; --warn: #f0b35a; --warn-soft: #3a2c17;
  --ok: #7cc79a; --ok-soft: #1c3326; --info: #8ab4e0; --info-soft: #1c2a3a; --mute-soft: #252b28;
  --t-design: #9c8fd6; --t-stage: #9c8fd6; --t-shop: #d9a65a; --t-steel: #8fa6b3; --t-pool: #5fb8ca; --t-tile: #6dbb8c; --t-ceil: #c2ad86; --t-gen: #8d9390; --t-sign: #f08a82;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--f); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.mono { font-family: var(--f-mono); font-size: 12.5px; }
.code { font-family: var(--f-mono); font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
[hidden] { display: none !important; }

/* ---- Shell */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--rail); color: var(--rail-fg); display: flex; flex-direction: column; padding: 18px 12px; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; color: #fff; text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.brand b { font-family: var(--f-display); font-size: 15.5px; letter-spacing: .01em; display: block; line-height: 1.15; }
.brand small { color: var(--rail-muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav .grp { color: var(--rail-muted); font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; padding: 12px 10px 4px; }
.nav a { color: var(--rail-fg); text-decoration: none; padding: 7px 10px; border-radius: 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav a:hover { background: var(--rail-2); }
.nav a.on { background: var(--rail-2); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav .count { font-size: 11px; background: var(--accent); color: var(--on-accent); border-radius: 99px; padding: 0 7px; font-weight: 700; }
.nav .count.crit { background: var(--crit); color: #fff; }
.who { margin-top: auto; border-top: 1px solid var(--rail-2); padding: 12px 6px 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.who b { color: #fff; }
.who small { color: var(--rail-muted); }
.who .links { display: flex; gap: 12px; }
.who a, .who button { color: var(--rail-muted); background: none; border: 0; padding: 0; cursor: pointer; font-size: 12.5px; text-decoration: underline; }
.topbar { display: none; }
main { min-width: 0; padding: 22px clamp(16px, 2.6vw, 34px) 60px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
  .shell.nav-open .rail { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .topbar { display: flex; align-items: center; gap: 12px; background: var(--rail); color: #fff; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; position: sticky; top: 0; z-index: 30; }
  .topbar button { background: none; border: 0; color: #fff; font-size: 22px; line-height: 1; padding: 4px 6px; cursor: pointer; }
  .topbar b { font-family: var(--f-display); }
  main { padding: 16px 16px 60px; }
}

/* ---- Buttons and pills */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--fg); padding: 7px 13px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--crit); }
.btn.danger.solid { background: var(--crit); color: #fff; border-color: var(--crit); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.lg { padding: 12px 18px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.left { margin-right: auto; }
.icon-btn { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--mute-soft); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.info { background: var(--info-soft); color: var(--info); }
.pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.crit { background: var(--crit-soft); color: var(--crit); }
.pill.mute { background: var(--mute-soft); color: var(--faint); } .pill.accent { background: var(--accent-soft); color: var(--accent); }
.due { font-size: 12px; color: var(--muted); white-space: nowrap; }
.due.late { color: var(--crit); font-weight: 600; }
.track { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.track::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--tc, var(--t-gen)); }

/* ---- Panels */
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.grid.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid.two, .grid.halves, .grid.three { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel > header h2 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.panel > header .hint { font-size: 12px; color: var(--faint); }
.panel > .body { padding: 14px 16px; }
.panel.flag-crit { border-color: color-mix(in srgb, var(--crit) 45%, var(--line)); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spacer { flex: 1; }

.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-width: 120px; text-decoration: none; color: inherit; }
.stat b { display: block; font-size: 22px; font-family: var(--f-display); font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 12px; }
.stat.crit b { color: var(--crit); } .stat.warn b { color: var(--warn); } .stat.ok b { color: var(--ok); }

/* ---- Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list > li.nocheck { grid-template-columns: minmax(0, 1fr) auto; }
.list .t { font-weight: 600; }
.list .t a { color: inherit; text-decoration: none; }
.list .t a:hover { text-decoration: underline; }
.list .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.list .why { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.list .side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.done-box { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--ok); cursor: pointer; }
.list li.is-read .t { font-weight: 500; }
.list li.is-done .t { text-decoration: line-through; color: var(--muted); }
.grouphead { padding: 7px 16px; background: var(--sunk); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.empty { padding: 22px 16px; color: var(--muted); text-align: center; }
.empty p { margin: 0 0 10px; }
.alert-row { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.alert-row:last-child { border-bottom: 0; }
.alert-row .sev { align-self: stretch; border-radius: 2px; background: var(--warn); }
.alert-row .sev.crit { background: var(--crit); } .alert-row .sev.ok { background: var(--ok); } .alert-row .sev.info { background: var(--info); }
.alert-row .t { font-weight: 600; }
.alert-row .why { font-size: 12.5px; color: var(--muted); }

/* ---- Tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 8px 12px; background: var(--sunk); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--sunk); }
.tbl tfoot td { font-weight: 700; background: var(--sunk); border-top: 1px solid var(--line-2); }
.tbl .sub { font-size: 12px; color: var(--muted); }
.tbl input, .tbl select { width: 100%; padding: 5px 7px; border: 1px solid var(--line-2); border-radius: 5px; background: var(--surface); }
.tbl input.qty { width: 80px; }
.bar-meter { height: 6px; background: var(--mute-soft); border-radius: 3px; overflow: hidden; min-width: 80px; }
.bar-meter i { display: block; height: 100%; background: var(--ok); }
.bar-meter i.warn { background: var(--warn); } .bar-meter i.crit { background: var(--crit); }

/* ---- Filters / tabs */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); min-width: 0; }
.filters input[type=search] { width: 240px; max-width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg a, .seg button { padding: 6px 12px; font-size: 13px; text-decoration: none; color: var(--fg); border: 0; background: none; cursor: pointer; border-right: 1px solid var(--line-2); }
.seg a:last-child, .seg button:last-child { border-right: 0; }
.seg .on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--fg); border-bottom-color: var(--accent); }

/* ---- Stage stepper */
.stepper { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.stepper button { border: 1px solid var(--line); background: var(--sunk); border-radius: 6px; padding: 8px 6px; text-align: left; cursor: pointer; font-size: 12px; color: var(--muted); min-width: 0; }
.stepper button b { display: block; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.stepper button.past { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.stepper button.now { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
.stepper button:disabled { cursor: default; }
@media (max-width: 900px) { .stepper { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---- Forms */
.form { display: flex; flex-wrap: wrap; gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.field.half { width: calc(50% - 7px); } .field.third { width: calc(33.33% - 10px); }
@media (max-width: 600px) { .field.half, .field.third { width: 100%; } }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .req { color: var(--crit); }
.field input, .field select, .field textarea { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); width: 100%; }
.field textarea { resize: vertical; }
.field small { color: var(--faint); font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; width: 100%; }
.check.half { width: calc(50% - 7px); }
.multi { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; padding: 8px; border: 1px solid var(--line-2); border-radius: 6px; max-height: 200px; overflow-y: auto; }
.form-h { width: 100%; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 6px 0 -4px; padding-top: 8px; border-top: 1px solid var(--line); }
.form-error { width: 100%; margin: 0; color: var(--crit); background: var(--crit-soft); padding: 8px 10px; border-radius: 6px; font-size: 13px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; width: 100%; margin-top: 6px; flex-wrap: wrap; }

/* ---- Modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 20, 18, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 100; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 920px; }
.modal > header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal > header h2 { font-size: 17px; }
.modal-body { padding: 16px 18px 18px; }
.modal-body > p:first-child { margin-top: 0; }

/* ---- Toasts */
#toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--rail); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); border-left: 4px solid var(--ok); transition: opacity .4s, transform .4s; font-size: 13.5px; }
.toast.crit { border-left-color: var(--crit); } .toast.warn { border-left-color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---- Plan (4-week Gantt) */
.plan-wrap { overflow-x: auto; }
.plan { display: grid; min-width: 980px; font-size: 12px; position: relative; }
.plan .h-week { padding: 8px 6px; font-weight: 700; border-left: 1px solid var(--line-2); background: var(--sunk); }
.plan .h-day { text-align: center; padding: 3px 0 5px; color: var(--muted); border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); background: var(--sunk); font-variant-numeric: tabular-nums; }
.plan .h-day.today { color: var(--accent); font-weight: 800; }
.plan .lbl { padding: 8px 12px; border-bottom: 1px solid var(--line); min-width: 0; position: sticky; left: 0; background: var(--surface); z-index: 2; }
.plan .lbl b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan .lbl small { color: var(--muted); }
.plan .cell { border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.plan .cell.wk { border-left-color: var(--line-2); }
.plan .cell.today { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.plan .gbar { margin: 2px 2px; border-radius: 4px; color: #fff; font-size: 11px; font-weight: 600; padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--tc, var(--t-gen)); z-index: 1; text-decoration: none; align-self: center; line-height: 1.5; }
.plan .gbar.done { opacity: .45; text-decoration: line-through; }
.plan .gbar.late { box-shadow: inset 0 0 0 2px var(--crit); }
.load { font-size: 11px; font-variant-numeric: tabular-nums; }
.load.over { color: var(--crit); font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 10px 16px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* ---- Install packs */
.docs { display: flex; flex-wrap: wrap; gap: 4px; }
.doc { font-size: 11.5px; padding: 3px 8px; border-radius: 4px; white-space: nowrap; border: 0; cursor: pointer; font-weight: 600; }
.doc.have { background: var(--ok-soft); color: var(--ok); }
.doc.have::before { content: "✓ "; }
.doc.miss { background: var(--crit-soft); color: var(--crit); }
.doc.miss::before { content: "✕ "; }
.room-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px 0; }
.room-tabs button { border: 1px solid var(--line-2); background: var(--sunk); border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 13px; }
.room-tabs button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.room-tabs small { color: var(--muted); margin-left: 4px; font-weight: 500; }

/* ---- Big-touch screens (factory board, installers) */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.card h3 { font-size: 16px; }
.card .meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.card .btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.card.late { border-color: var(--crit); }
.big-list > li { padding: 14px 16px; }
.big-list .t { font-size: 15px; }

/* ---- Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--rail); }
.login .box { background: var(--surface); width: 100%; max-width: 400px; border-radius: 12px; padding: 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.login .box.wide { max-width: 560px; }
.login h1 { font-size: 22px; margin-bottom: 4px; }
.login .lead { color: var(--muted); margin: 0 0 18px; }
.login .brand-mark { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.login .brand-mark img { width: 36px; height: 36px; border-radius: 8px; }
.login .brand-mark b { font-family: var(--f-display); font-size: 17px; }
.login .btn.primary { width: 100%; justify-content: center; padding: 10px; font-size: 14.5px; }
.secret { font-family: var(--f-mono); font-size: 17px; letter-spacing: .08em; background: var(--sunk); border: 1px dashed var(--line-2); padding: 10px 12px; border-radius: 6px; word-break: break-all; text-align: center; user-select: all; }
.steps { padding-left: 20px; margin: 0 0 16px; color: var(--muted); }
.steps li { margin-bottom: 6px; }
.workers { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.workers button { padding: 22px 10px; font-size: 17px; font-weight: 700; border-radius: 10px; border: 1px solid var(--line-2); background: var(--sunk); cursor: pointer; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.pinpad button { padding: 18px 0; font-size: 22px; font-weight: 700; border-radius: 10px; border: 1px solid var(--line-2); background: var(--sunk); cursor: pointer; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 14px 0 4px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); }

.sigpad { border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #fff; }
.sigpad canvas { display: block; width: 100%; height: 160px; touch-action: none; cursor: crosshair; }
.sigpad-foot { display: flex; justify-content: space-between; padding: 6px 10px; background: var(--sunk); font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line-2); }
.basket-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.basket-row select, .basket-row input { padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); width: 100%; }
.files { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.note { background: var(--sunk); border: 1px dashed var(--line-2); border-radius: 8px; padding: 10px 14px; font-size: 13px; color: var(--muted); }
.banner { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); } .banner.crit { background: var(--crit-soft); color: var(--crit); } .banner.info { background: var(--info-soft); color: var(--info); }

/* ---- Printable purchase order */
.po-print { background: #fff; color: #111; padding: 32px; max-width: 820px; border: 1px solid var(--line); }
.po-print h1 { font-size: 26px; }
.po-print .tbl th { background: #f2f2f2; color: #333; }
.po-print .tbl td { border-color: #ddd; }
@media print {
  .rail, .topbar, .page-head .tools, .no-print, #toasts { display: none !important; }
  .shell { display: block; } main { padding: 0; } body { background: #fff; }
  .po-print { border: 0; padding: 0; max-width: none; }
  #po-print { display: block !important; }
  .crumbs, .page-head, .tabs, .stats, .banner { display: none !important; }
  .po-print .tbl { font-size: 11px; }
}
/* ---- iPad-style tiles, cards and bottom bar */
/* Text size (per device): everything in the working area and dialogs scales together. */
html[data-size="large"] { --z: 1.12; } html[data-size="xl"] { --z: 1.28; }
main, .modal, #toasts { zoom: var(--z, 1); }
html[data-size="large"] .nav a, html[data-size="xl"] .nav a { font-size: 15px; padding: 9px 10px; }
.nav-l { display: inline-flex; align-items: center; gap: 10px; }
.nav-l .ic { opacity: .75; flex: none; }
.nav a.on .ic { opacity: 1; color: var(--accent); }
.topbar .spacer { flex: 1; }
.topbar #textsize2 { font-size: 15px; font-weight: 700; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; padding: 5px 9px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tiles.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tiles-h { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 6px 0 10px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 16px; min-height: 128px; text-decoration: none; color: var(--fg); cursor: pointer; text-align: left; box-shadow: var(--shadow); transition: transform .08s, border-color .15s; font: inherit; }
.tile:hover { border-color: var(--accent); }
.tile:active { transform: scale(.97); }
.tile .ic { color: var(--accent); margin-bottom: 4px; }
.tile b { font-size: 16px; font-family: var(--f-display); }
.tile small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.tile.warn { border-color: var(--warn); background: var(--warn-soft); } .tile.warn .ic { color: var(--warn); }
.tile .count { position: absolute; top: 12px; right: 12px; font-style: normal; font-size: 13px; font-weight: 700; min-width: 26px; text-align: center; padding: 2px 8px; border-radius: 99px; background: var(--accent); color: var(--on-accent); }
.tile .count.crit { background: var(--crit); color: #fff; }
.tiles.compact .tile { min-height: 96px; padding: 14px; }
.tiles.compact .tile small { display: none; }
.stats a.stat { text-decoration: none; color: inherit; cursor: pointer; }
.pcards, .icards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.pcard, .icard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); text-align: left; color: var(--fg); font: inherit; }
.pcard { cursor: pointer; transition: transform .08s, border-color .15s; }
.pcard:hover { border-color: var(--accent); } .pcard:active { transform: scale(.98); }
.pcard-top, .icard-top, .pcard-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.pcard-foot { justify-content: flex-start; flex-wrap: wrap; margin-top: 4px; font-size: 13px; }
.pcard-foot > span:first-child { display: inline-flex; align-items: center; gap: 4px; }
.pcard-foot .spacer { flex: 1; }
.pcard-name { font-size: 18px; font-family: var(--f-display); }
.pcard .sub, .icard .sub { font-size: 13px; color: var(--muted); }
.stagebar { height: 8px; background: var(--mute-soft); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.stagebar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.icard-top b { font-size: 15.5px; }
.icard .qty { white-space: nowrap; color: var(--muted); } .icard .qty b { font-size: 22px; color: var(--fg); font-variant-numeric: tabular-nums; }
.icard.low { border-color: var(--crit); }
.icard .btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }
.icard .btns .btn { padding: 10px 14px; font-size: 14px; }
.bottombar { display: none; }
.tabs { scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; }

/* Touch screens: bigger targets everywhere. */
@media (pointer: coarse) {
  .btn { padding: 10px 15px; font-size: 14px; min-height: 44px; }
  .btn.sm { padding: 7px 11px; font-size: 13px; min-height: 36px; }
  .seg a, .seg button { padding: 10px 14px; }
  .tabs a { padding-top: 12px; padding-bottom: 12px; }
  input, select, textarea { min-height: 44px; }
  .list > li { padding-top: 12px; padding-bottom: 12px; }
}
@media (max-width: 900px) {
  .bottombar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -2px 12px rgba(0,0,0,.06); }
  .bottombar a { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; border-radius: 10px; }
  .bottombar a.on { color: var(--accent); background: var(--accent-soft); }
  .bottombar .count { position: absolute; top: 2px; left: calc(50% + 8px); font-style: normal; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 99px; background: var(--accent); color: var(--on-accent); }
  .bottombar .count.crit { background: var(--crit); color: #fff; }
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 600px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pcards, .icards { grid-template-columns: minmax(0, 1fr); }
}
@media print { .bottombar { display: none !important; } main { zoom: 1; } }
/* ---- Card layout (html[data-layout="cards"], the default): every list becomes tappable cards */
html[data-layout="cards"] main table.tbl:not(.keep) { display: block; }
html[data-layout="cards"] main table.tbl:not(.keep) thead { display: none; }
html[data-layout="cards"] main table.tbl:not(.keep) tbody, html[data-layout="cards"] main table.tbl:not(.keep) tfoot {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
html[data-layout="cards"] main table.tbl:not(.keep) tfoot { margin-top: 12px; }
html[data-layout="cards"] main table.tbl:not(.keep) tr { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
html[data-layout="cards"] main table.tbl:not(.keep) tr.click { cursor: pointer; transition: transform .08s, border-color .15s; }
html[data-layout="cards"] main table.tbl:not(.keep) tr.click:hover { border-color: var(--accent); background: var(--surface); }
html[data-layout="cards"] main table.tbl:not(.keep) tr.click:active { transform: scale(.98); }
html[data-layout="cards"] main table.tbl:not(.keep) tr.full { grid-column: 1 / -1; background: none; border: 0; box-shadow: none; padding: 4px 0; }
html[data-layout="cards"] main table.tbl:not(.keep) td { display: block; border: 0; padding: 0; text-align: left; white-space: normal; min-width: 0; width: auto !important; }
html[data-layout="cards"] main table.tbl:not(.keep) td:first-child { font-size: 16px; font-weight: 600; }
html[data-layout="cards"] main table.tbl:not(.keep) td:first-child.code { font-size: 14px; }
html[data-layout="cards"] main table.tbl:not(.keep) td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 1px; }
html[data-layout="cards"] main table.tbl:not(.keep) td:empty { display: none; }
html[data-layout="cards"] main table.tbl:not(.keep) td.right:not([data-label]), html[data-layout="cards"] main table.tbl:not(.keep) td:last-child:not([data-label]) { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; }
html[data-layout="cards"] main table.tbl:not(.keep) .btn.sm { padding: 9px 14px; font-size: 14px; }
html[data-layout="cards"] main .panel:has(> .table-wrap > table.tbl:not(.keep)), html[data-layout="cards"] main .panel:has(> .body > table.tbl:not(.keep)) { background: none; border: 0; box-shadow: none; }
html[data-layout="cards"] main .panel:has(> .table-wrap > table.tbl:not(.keep)) > header { padding-left: 0; padding-right: 0; border-bottom: 0; }
html[data-layout="cards"] main .table-wrap:has(> table.tbl:not(.keep)) { overflow: visible; }
/* Filters and page tabs as big chips */
html[data-layout="cards"] main .seg { border: 0; background: none; gap: 8px; flex-wrap: wrap; overflow: visible; }
html[data-layout="cards"] main .seg a, html[data-layout="cards"] main .seg button { border: 1px solid var(--line-2); border-radius: 99px; background: var(--surface); padding: 9px 16px; font-size: 14px; font-weight: 600; }
html[data-layout="cards"] main .seg .on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
html[data-layout="cards"] main .tabs { gap: 8px; border-bottom: 0; flex-wrap: wrap; overflow: visible; }
html[data-layout="cards"] main .tabs a { border: 1px solid var(--line-2); border-radius: 99px; background: var(--surface); padding: 9px 16px; margin: 0; color: var(--fg); font-size: 14px; }
html[data-layout="cards"] main .tabs a.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
html[data-layout="cards"] main .filters input, html[data-layout="cards"] main .filters select { padding: 10px 14px; border-radius: 10px; font-size: 14px; }
/* Lists (tasks, deliveries, alerts) get more room */
html[data-layout="cards"] main .panel { border-radius: 14px; }
html[data-layout="cards"] main .list > li { padding: 13px 18px; }
html[data-layout="cards"] main .list .t { font-size: 15px; }
html[data-layout="cards"] main .list .meta { font-size: 13px; }
html[data-layout="cards"] main .alert-row .t { font-size: 15px; }
html[data-layout="cards"] main .stat { border-radius: 14px; }
.who .links { flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.tiles.status-tiles { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tiles.status-tiles .tile { min-height: 0; padding: 14px; }
.tile.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

/* ---- Email */
.mcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.mcard { display: flex; flex-direction: column; gap: 5px; text-align: left; font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line);
  border-left: 5px solid var(--line-2); border-radius: 14px; padding: 14px 16px; cursor: pointer; box-shadow: var(--shadow); transition: transform .08s, border-color .15s; min-width: 0; }
.mcard:hover { border-color: var(--accent); } .mcard:active { transform: scale(.98); }
.mcard.ok { border-left-color: var(--info); } .mcard.soon { border-left-color: var(--warn); } .mcard.overdue { border-left-color: var(--crit); background: var(--crit-soft); }
.mcard-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mcard-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard-subj { font-size: 15px; } .mcard.unread .mcard-subj { font-weight: 700; }
.mcard-subj .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 1px; }
.mcard-snip { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mcard-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.actionbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.thread { display: flex; flex-direction: column; gap: 10px; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.msg.out { border-left: 4px solid var(--accent); }
.msg-head { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 10px; align-items: baseline; width: 100%; text-align: left; background: none; border: 0; padding: 14px 16px; cursor: pointer; font: inherit; color: inherit; }
.msg-snip { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.open .msg-snip { visibility: hidden; }
.msg-body { padding: 0 16px 16px; }
.msg-meta { font-size: 13px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 2px; word-break: break-word; }
.msg-frame { width: 100%; min-height: 120px; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: block; }
.atts { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.att { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunk); flex-wrap: wrap; }
.att span { flex: 1; min-width: 140px; display: flex; flex-direction: column; } .att small { color: var(--muted); }
.ackline { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); padding: 2px 6px; }
.trow { display: grid; grid-template-columns: 4px minmax(0, 1fr); gap: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.pcard.late { border-color: var(--crit); }
@media (max-width: 600px) { .mcards { grid-template-columns: minmax(0, 1fr); } .msg-head { grid-template-columns: minmax(0, 1fr) auto; } .msg-snip { display: none; } }
.trow .sev { border-radius: 2px; background: var(--warn); } .trow .sev.crit { background: var(--crit); }

/* ---- PC activity */
.strip { display: grid; grid-template-columns: repeat(52, 1fr); gap: 1px; height: 18px; margin-top: 6px; }
.strip i { background: var(--accent); border-radius: 2px; }
.strip-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--faint); padding: 0 1px; }
.appbars { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.appbars div { display: grid; grid-template-columns: 110px minmax(0, 1fr) 62px; gap: 8px; align-items: center; font-size: 13px; }
.appbars i { display: block; height: 8px; background: var(--info); border-radius: 99px; min-width: 3px; }
.appbars b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.weekrow { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-top: 6px; }
.weekrow span { display: flex; flex-direction: column; align-items: center; background: var(--sunk); border-radius: 8px; padding: 4px 0; }
.weekrow span.on { background: var(--accent-soft); color: var(--accent); }
.weekrow small { font-size: 11px; color: var(--muted); }
.mcards.selecting .mcard { position: relative; padding-left: 48px; }
.mcards.selecting .mcard::before { content: ""; position: absolute; left: 16px; top: 16px; width: 20px; height: 20px; border: 2px solid var(--line-2); border-radius: 6px; background: var(--surface); }
.mcards.selecting .mcard.picked { border-color: var(--accent); background: var(--accent-soft); }
.mcards.selecting .mcard.picked::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.selectbar { position: sticky; top: 8px; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; align-items: center; box-shadow: var(--shadow); }
.undobar { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 14px;
  background: var(--rail); color: #fff; padding: 10px 12px 10px 18px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.3); max-width: calc(100vw - 32px); }

/* ---- Schedule import board */
.modal.xwide { width: min(1400px, 96vw); max-width: none; }
.sb-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.sb-top select { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); }
.sboard { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 300px); gap: 12px; overflow-x: auto; padding-bottom: 8px; max-height: 65vh; }
.scol { background: var(--sunk); border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 200px; }
.scol.over { border-color: var(--accent); background: var(--accent-soft); }
.scol header { display: flex; flex-direction: column; padding: 2px 4px 6px; position: sticky; top: -10px; background: inherit; z-index: 1; }
.scol header small { color: var(--muted); }
.scard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; cursor: grab; box-shadow: var(--shadow); }
.scard.dragging { opacity: .4; } .scard.off { opacity: .5; } .scard.bad { border-color: var(--crit); }
.scard-top { display: flex; gap: 6px; align-items: flex-start; } .scard-top b { flex: 1; font-size: 14px; }
.scard-f { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.scard-f select, .scard-f input { width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); font-size: 12.5px; }
.sb-err { font-size: 12px; color: var(--crit); background: var(--crit-soft); border-radius: 6px; padding: 3px 8px; }

/* ---- Gmail-style inbox */
.gm { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; align-items: start; }
.gm-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 12px; }
.gm-compose { display: inline-flex; align-items: center; gap: 12px; align-self: flex-start; margin-bottom: 12px; padding: 16px 24px 16px 18px; border: 0; border-radius: 16px;
  background: var(--accent-soft); color: var(--fg); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; box-shadow: var(--shadow); }
.gm-compose:hover { box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.gm-box { display: flex; align-items: center; gap: 14px; padding: 9px 14px 9px 18px; border: 0; border-radius: 0 99px 99px 0; background: none; color: var(--fg); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.gm-box span { flex: 1; } .gm-box b { font-size: 13px; }
.gm-box:hover { background: var(--mute-soft); }
.gm-box.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.gm-box.crit b { color: var(--crit); }
.gm-nav-foot { margin-top: 18px; padding: 12px 18px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.gm-nav-foot small { color: var(--faint); font-size: 12px; margin-top: 6px; }
.gm-main { min-width: 0; background: var(--surface); border-radius: 16px; border: 1px solid var(--line); overflow: hidden; }
.gm-search { display: flex; align-items: center; gap: 10px; margin: 12px; padding: 4px 8px 4px 16px; background: var(--sunk); border-radius: 99px; border: 1px solid transparent; }
.gm-search:focus-within { background: var(--surface); border-color: var(--line-2); box-shadow: var(--shadow); }
.gm-search .ic { color: var(--muted); flex: none; }
.gm-search input { flex: 1; min-width: 0; border: 0; background: none; padding: 10px 0; font-size: 15px; outline: none; }
.gm-tools { display: flex; align-items: center; gap: 8px; padding: 4px 14px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.gm-title { font-weight: 700; margin-left: 6px; }
.gm-list { display: flex; flex-direction: column; }
.gm-row { display: grid; grid-template-columns: 0 minmax(120px, 210px) minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line);
  cursor: pointer; font-size: 14px; color: var(--muted); background: var(--sunk); }
.gm-row.unread { background: var(--surface); color: var(--fg); }
.gm-row.unread .gm-from, .gm-row.unread .gm-subj, .gm-row.unread .gm-date { font-weight: 700; color: var(--fg); }
.gm-row:hover { box-shadow: inset 0 -1px 0 var(--line-2), 0 1px 3px rgba(0,0,0,.12); position: relative; z-index: 1; }
.gm-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.gm-row.overdue { box-shadow: inset 4px 0 0 var(--crit); } .gm-row.soon { box-shadow: inset 4px 0 0 var(--warn); }
.gm-from { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
.gm-from small { color: var(--muted); font-weight: 400; margin-left: 2px; }
.gm-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.gm-subj { color: var(--fg); } .gm-snip { color: var(--muted); }
.gm-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.gm-date { font-size: 12.5px; white-space: nowrap; min-width: 46px; text-align: right; }
.chip { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 6px; margin-right: 6px; background: var(--mute-soft); color: var(--muted); vertical-align: 1px; text-decoration: none; white-space: nowrap; }
.chip.code { background: var(--accent-soft); color: var(--accent); }
.chip.crit { background: var(--crit-soft); color: var(--crit); } .chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--info-soft); color: var(--info); } .chip.ok { background: var(--ok-soft); color: var(--ok); }
.gm-empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.gm-more { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px; color: var(--muted); }
.gm-list.selecting .gm-row { grid-template-columns: 22px minmax(120px, 210px) minmax(0, 1fr) auto; }
.gm-list.selecting .gm-pick { width: 18px; height: 18px; border: 2px solid var(--line-2); border-radius: 4px; background: var(--surface); }
.gm-row.picked { background: var(--accent-soft); } .gm-row.picked .gm-pick { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
/* Reading */
.gm-read { max-width: 1000px; }
.gm-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; position: sticky; top: 0; z-index: 4; background: var(--bg); padding: 4px 0 10px; }
.gm-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 16px; }
.gm-head h1 { font-size: 22px; font-weight: 500; margin-right: 6px; }
.gm-av { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 700; font-size: 17px; color: #fff; background: hsl(var(--h) 45% 45%); }
.thread .msg { border-radius: 0; border-width: 0 0 1px; background: var(--surface); }
.thread .msg:first-child { border-radius: 14px 14px 0 0; border-top-width: 1px; } .thread .msg:last-child { border-radius: 0 0 14px 14px; }
.thread { gap: 0; border-radius: 14px; }
.thread .msg { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.thread .msg.out { border-left: 1px solid var(--line); }
.msg-head { grid-template-columns: auto minmax(0, 1fr) auto !important; align-items: center !important; gap: 12px !important; }
.msg-who { display: flex; flex-direction: column; min-width: 0; }
.msg-who .muted { font-size: 12.5px; font-weight: 400; }
.msg-who b { font-size: 14.5px; }
.msg.open .msg-snip { display: none; } .msg:not(.open) .msg-to { display: none; }
.msg-to { font-size: 12.5px; }
.msg-date { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.msg-body { padding: 0 16px 16px 68px; }
.gm-replies { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 30px; }
.gm-replies .btn { border-radius: 99px; padding-left: 20px; padding-right: 22px; }
@media (max-width: 900px) {
  .gm { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .gm-nav { position: static; flex-direction: row; overflow-x: auto; gap: 8px; scrollbar-width: none; padding-bottom: 2px; }
  .gm-compose { margin: 0; padding: 10px 16px; border-radius: 99px; flex: none; }
  .gm-box { border-radius: 99px; flex: none; border: 1px solid var(--line-2); background: var(--surface); padding: 8px 14px; gap: 8px; }
  .gm-nav-foot { display: none; }
  .gm-row { grid-template-columns: 0 minmax(0, 1fr) auto; grid-template-areas: "p from meta" "p text text"; gap: 2px 10px; }
  .gm-list.selecting .gm-row { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .gm-pick { grid-area: p; } .gm-from { grid-area: from; } .gm-meta { grid-area: meta; } .gm-text { grid-area: text; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .msg-body { padding-left: 16px; }
  .gm-bar .btn { padding: 8px 12px; }
}
/* Tick boxes on every email row (Gmail style) */
.gm-row, .gm-list.selecting .gm-row { grid-template-columns: 22px minmax(120px, 210px) minmax(0, 1fr) auto; }
.gm-pick { width: 18px; height: 18px; border: 2px solid var(--line-2); border-radius: 4px; background: var(--surface); cursor: pointer; position: relative; }
.gm-pick::after { content: ""; position: absolute; inset: -10px; } /* bigger tap area */
.gm-pick:hover { border-color: var(--muted); }
.gm-row.picked .gm-pick, .gm-pick.all.on { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }
.gm-pick.all.some:not(.on) { background: linear-gradient(var(--accent), var(--accent)) center / 10px 2px no-repeat var(--surface); border-color: var(--accent); }
.gm-tools .gm-pick.all { margin: 0 6px 0 2px; }
.gm-picked, .gm-idle { display: inline-flex; align-items: center; gap: 8px; }
.gm-picked[hidden], .gm-idle[hidden] { display: none !important; }
@media (max-width: 900px) {
  .gm-row, .gm-list.selecting .gm-row { grid-template-columns: 22px minmax(0, 1fr) auto; }
}
