  :root {
    --bg: #F4F2EF;
    --surface: #FFFFFF;
    --surface-2: #FAF8F4;
    --ink: #1C1E21;
    --ink-2: #585C64;
    --ink-3: #8B8F97;
    --line: #E3DED4;
    --line-strong: #CFC8BB;
    --accent: #DA5127;
    --accent-deep: #A93C1A;
    --accent-soft: #F7E7DF;
    --good: #2E7D4F;
    --good-soft: #E2EFE7;
    --warn: #B07611;
    --warn-soft: #F6EAD2;
    --crit: #BC3B2E;
    --crit-soft: #F6E0DD;
    --info: #33628F;
    --info-soft: #E1E9F2;
    --shadow: 0 1px 2px rgba(28,30,33,.04), 0 8px 24px -12px rgba(28,30,33,.14);
    --shadow-lg: 0 24px 60px -18px rgba(28,30,33,.4);
    --radius: 10px;
    --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
    --font-body: "Public Sans", "Helvetica Neue", Arial, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #15171A; --surface: #1E2126; --surface-2: #24272D;
      --ink: #E9E6E1; --ink-2: #A8ACB3; --ink-3: #777C84;
      --line: #31353B; --line-strong: #40454C;
      --accent: #F26A3E; --accent-deep: #F68A62; --accent-soft: #3A241C;
      --good: #61B886; --good-soft: #1E2E25;
      --warn: #D6A343; --warn-soft: #322817;
      --crit: #E2685B; --crit-soft: #331F1D;
      --info: #6F9FCB; --info-soft: #1C2732;
      --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px -14px rgba(0,0,0,.6);
      --shadow-lg: 0 24px 60px -18px rgba(0,0,0,.7);
    }
  }
  :root[data-theme="dark"] {
    --bg: #15171A; --surface: #1E2126; --surface-2: #24272D;
    --ink: #E9E6E1; --ink-2: #A8ACB3; --ink-3: #777C84;
    --line: #31353B; --line-strong: #40454C;
    --accent: #F26A3E; --accent-deep: #F68A62; --accent-soft: #3A241C;
    --good: #61B886; --good-soft: #1E2E25;
    --warn: #D6A343; --warn-soft: #322817;
    --crit: #E2685B; --crit-soft: #331F1D;
    --info: #6F9FCB; --info-soft: #1C2732;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px -14px rgba(0,0,0,.6);
    --shadow-lg: 0 24px 60px -18px rgba(0,0,0,.7);
  }

  * { box-sizing: border-box; }
  body {
    margin: 0; background: var(--bg); color: var(--ink);
    font-family: var(--font-body); font-size: 14px; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
  a { color: var(--accent-deep); }
  .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
  .eyebrow {
    font-family: var(--font-display); font-size: 10.5px; font-weight: 600;
    letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3);
  }

  /* ---------- App shell ---------- */
  .app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
  .sidebar {
    background: var(--surface); border-right: 1px solid var(--line);
    padding: 18px 16px 28px; display: flex; flex-direction: column; gap: 18px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
  }
  .brand { display: flex; align-items: center; gap: 10px; }
  .brand__mark {
    width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff;
    display: grid; place-items: center; font-family: var(--font-display); font-weight: 700;
    font-size: 15px; letter-spacing: -0.02em; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  }
  .brand__name { font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1.1; }
  .brand__sub { font-size: 11px; color: var(--ink-3); }

  .viewtoggle {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 4px;
  }
  .viewtoggle button {
    font-family: var(--font-display); font-weight: 600; font-size: 11px; letter-spacing: 0.02em;
    border: 0; border-radius: 6px; padding: 7px 4px; cursor: pointer; background: transparent; color: var(--ink-2);
  }
  .viewtoggle button[aria-pressed="true"] { background: var(--accent); color: #fff; }

  /* ---------- Field technician app ---------- */
  body[data-scope="field"] .sidebar > *:not(.brand):not(.viewtoggle):not(.sidebar__foot) { display: none; }
  .field-wrap { display: flex; justify-content: center; padding: 4px 0 20px; }
  .field-app {
    width: 100%; max-width: 468px; display: flex; flex-direction: column;
    min-height: calc(100vh - 150px); background: var(--surface);
    border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-lg);
  }
  .field-head {
    padding: 14px 16px; background: var(--ink); color: var(--bg);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
  }
  :root[data-theme="dark"] .field-head, :root:not([data-theme="light"]) .field-head { background: #0f1113; }
  .field-head b { font-family: var(--font-display); font-size: 13px; letter-spacing: 0.02em; }
  .field-head__job { font-size: 10.5px; opacity: .75; font-family: var(--font-mono); }
  .field-scroll { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
  .field-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line);
    background: var(--surface);
  }
  .field-nav button {
    border: 0; background: transparent; cursor: pointer; padding: 9px 2px 10px;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-family: var(--font-display); font-weight: 600; font-size: 9.5px; letter-spacing: 0.03em;
    color: var(--ink-3); text-transform: uppercase;
  }
  .field-nav button svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; }
  .field-nav button[aria-current="true"] { color: var(--accent-deep); }

  .f-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
  .f-card h4 { font-size: 13px; font-weight: 700; }
  .f-card__sub { font-size: 11.5px; color: var(--ink-3); }
  .f-eyebrow { font-family: var(--font-display); font-size: 9.5px; font-weight: 600; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-3); }

  .f-clock { border-color: var(--accent); background: var(--accent-soft); }
  .f-clock__time { font-family: var(--font-mono); font-size: 30px; font-weight: 500; letter-spacing: -0.02em; color: var(--accent-deep); }
  .f-clock__meta { font-size: 11.5px; color: var(--ink-2); }

  .f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .f-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
    min-height: 54px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface);
    color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 12.5px; cursor: pointer; padding: 8px 10px;
  }
  .f-btn:hover { background: var(--surface-2); }
  .f-btn--wide { width: 100%; }
  .f-btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
  .f-btn--primary:hover { background: var(--accent-deep); }
  .f-btn--danger { border-color: var(--crit); color: var(--crit); }
  .f-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9; flex: none; }

  .f-joblist { display: flex; flex-direction: column; gap: 8px; }
  .f-job {
    display: flex; flex-direction: column; gap: 3px; text-align: left; width: 100%;
    border: 1px solid var(--line); border-radius: 13px; padding: 11px 12px; background: var(--surface); cursor: pointer;
  }
  .f-job[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); }
  .f-job__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .f-job__id { font-family: var(--font-mono); font-size: 12px; color: var(--accent-deep); font-weight: 500; }
  .f-job__addr { font-size: 11.5px; color: var(--ink-2); }

  .f-task {
    display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start;
    border: 1px solid var(--line); border-radius: 13px; padding: 13px 12px; background: var(--surface);
    cursor: pointer; min-height: 52px;
  }
  .f-task__box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-strong); display: grid; place-items: center; margin-top: 1px; }
  .f-task__box svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3.5; fill: none; opacity: 0; }
  .f-task.done .f-task__box { background: var(--good); border-color: var(--good); }
  .f-task.done .f-task__box svg { opacity: 1; }
  .f-task__t { font-size: 13px; }
  .f-task.done .f-task__t { color: var(--ink-3); text-decoration: line-through; }
  .f-task__s { display: block; font-size: 11px; color: var(--ink-3); margin-top: 1px; }

  .f-field { display: flex; flex-direction: column; gap: 4px; }
  .f-field label { font-family: var(--font-display); font-size: 9.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
  .f-field input, .f-field select, .f-field textarea {
    font-family: var(--font-body); font-size: 15px; color: var(--ink); background: var(--surface);
    border: 1px solid var(--line-strong); border-radius: 10px; padding: 11px 12px; width: 100%;
  }
  .f-field input:focus, .f-field select:focus, .f-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
  .f-field textarea { min-height: 84px; resize: vertical; }
  .f-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

  .f-feed { display: flex; flex-direction: column; gap: 0; }
  .f-feed__row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 9px 2px; font-size: 12px; border-bottom: 1px solid var(--line); }
  .f-feed__row:last-child { border-bottom: 0; }
  .f-feed__row span:last-child { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
  .f-feed__tag { font-size: 10px; }

  .f-stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .f-stat { border: 1px solid var(--line); border-radius: 12px; padding: 9px 6px; text-align: center; }
  .f-stat b { display: block; font-family: var(--font-mono); font-size: 17px; }
  .f-stat span { font-size: 9px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }

  .f-pill { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-display); font-weight: 600; font-size: 9.5px; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; }
  .f-pill--warn { color: var(--warn); background: var(--warn-soft); }
  .f-pill--good { color: var(--good); background: var(--good-soft); }
  .f-pill--info { color: var(--info); background: var(--info-soft); }
  .f-pill--crit { color: var(--crit); background: var(--crit-soft); }
  .f-sheet { border: 1px solid var(--line-strong); border-radius: 16px; padding: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 12px; }
  .f-sheet h4 { font-size: 13px; font-weight: 700; }
  .f-hidden { display: none; }

  .jobcard {
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
    padding: 12px; display: flex; flex-direction: column; gap: 8px;
  }
  .jobcard__row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
  .jobcard__row span:first-child { color: var(--ink-3); }
  .jobcard__row span:last-child { text-align: right; font-weight: 500; }
  .jobcard__num { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--accent-deep); }

  .phasenav { display: flex; flex-direction: column; gap: 2px; }
  .phasenav__label { margin: 4px 0 6px; }
  .phasenav button {
    display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 9px;
    width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer;
    padding: 8px 8px; border-radius: 8px; color: var(--ink); font-size: 13px; font-family: var(--font-body);
  }
  .phasenav button:hover { background: var(--surface-2); }
  .phasenav button[aria-current="true"] { background: var(--accent-soft); color: var(--accent-deep); font-weight: 600; }
  .phasenav__idx {
    font-family: var(--font-mono); font-size: 11px; font-weight: 500;
    width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
    border: 1px solid var(--line-strong); color: var(--ink-2);
  }
  .phasenav button[aria-current="true"] .phasenav__idx { border-color: var(--accent); color: var(--accent-deep); }
  .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
  .dot--done { background: var(--good); }
  .dot--active { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
  .dot--pending { background: var(--line-strong); }

  .sidebar__foot { margin-top: auto; font-size: 11px; color: var(--ink-3); display: flex; flex-direction: column; gap: 8px; }
  .themebtn {
    border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
    border-radius: 7px; padding: 6px 9px; font-size: 11px; cursor: pointer; font-family: var(--font-body); align-self: flex-start;
  }
  .sync-badge {
    display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
    font-family: var(--font-display); font-weight: 600; font-size: 10px; letter-spacing: 0.03em;
    border-radius: 999px; padding: 3px 9px;
  }
  .sync-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
  .sync-badge--on { color: var(--good); background: var(--good-soft); }
  .sync-badge--off { color: var(--warn); background: var(--warn-soft); }
  .sync-badge--busy { color: var(--info); background: var(--info-soft); }
  #me-badge:empty { display: none; }

  /* ---------- Main ---------- */
  .main { display: flex; flex-direction: column; min-width: 0; }
  .topbar { border-bottom: 1px solid var(--line); background: var(--surface); padding: 16px 26px; display: flex; flex-direction: column; gap: 12px; }
  .topbar__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
  .topbar h1 { font-size: 19px; font-weight: 700; }
  .topbar__addr { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
  .topbar__meta { display: flex; gap: 20px; flex-wrap: wrap; }
  .metaitem { font-size: 12px; }
  .metaitem b { display: block; font-family: var(--font-display); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 2px; }
  .progresswrap { display: flex; align-items: center; gap: 12px; }
  .progressbar { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; min-width: 160px; }
  .progressbar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-deep)); border-radius: inherit; }
  .progresswrap .mono { font-size: 12px; color: var(--ink-2); }

  .content { padding: 24px 26px 72px; max-width: 1180px; }
  .module { display: flex; flex-direction: column; gap: 22px; }
  .module.hidden { display: none; }

  .modhead { display: flex; flex-direction: column; gap: 4px; }
  .modhead h2 { font-size: 17px; font-weight: 700; }
  .modhead p { color: var(--ink-2); font-size: 13px; margin: 0; max-width: 66ch; }

  /* ---------- Panels ---------- */
  .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
  .panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
  .panel__head h3 { font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }
  .panel__body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
  .grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; align-items: start; }
  .grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; align-items: start; }

  /* ---------- Forms ---------- */
  .form { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 16px; }
  .form--1 { grid-template-columns: 1fr; }
  .fg { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .fg--wide { grid-column: 1 / -1; }
  .fg label, .fg > .lab {
    font-family: var(--font-display); font-size: 9.5px; font-weight: 600; letter-spacing: 0.11em;
    text-transform: uppercase; color: var(--ink-3);
  }
  .fg input, .fg select, .fg textarea {
    font-family: var(--font-body); font-size: 13px; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px;
    padding: 8px 10px; width: 100%; transition: border-color .12s ease, box-shadow .12s ease;
  }
  .fg input:focus, .fg select:focus, .fg textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
  }
  .fg textarea { resize: vertical; min-height: 74px; line-height: 1.45; }
  .fg input[readonly], .fg textarea[readonly] { background: var(--surface-2); color: var(--ink-2); cursor: default; }
  .fg .hint { font-size: 11px; color: var(--ink-3); }
  .fg--money input { font-family: var(--font-mono); text-align: right; }
  .autofill {
    font-size: 10px; color: var(--info); background: var(--info-soft); border-radius: 4px; padding: 1px 6px;
    font-family: var(--font-display); font-weight: 600; letter-spacing: 0.04em; align-self: flex-start;
  }
  .saved-tag { font-size: 10.5px; color: var(--good); font-family: var(--font-display); font-weight: 600; letter-spacing: 0.04em; opacity: 0; transition: opacity .2s ease; }
  .saved-tag.show { opacity: 1; }

  /* ---------- Status pills ---------- */
  .pill { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 600; font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
  .pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .pill--good { color: var(--good); background: var(--good-soft); }
  .pill--warn { color: var(--warn); background: var(--warn-soft); }
  .pill--crit { color: var(--crit); background: var(--crit-soft); }
  .pill--info { color: var(--info); background: var(--info-soft); }
  .pill--muted { color: var(--ink-3); background: var(--surface-2); border-color: var(--line); }
  .pill--lg { font-size: 11.5px; padding: 4px 11px; }

  /* ---------- Checklist ---------- */
  .checklist { display: flex; flex-direction: column; gap: 2px; }
  .check { display: grid; grid-template-columns: 20px 1fr auto; gap: 11px; align-items: start; padding: 9px 6px; border-radius: 7px; cursor: pointer; }
  .check:hover { background: var(--surface-2); }
  .check + .check { border-top: 1px solid var(--line); border-radius: 0; }
  .check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
  .check__box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line-strong); margin-top: 1px; display: grid; place-items: center; transition: all .12s ease; }
  .check__box svg { width: 11px; height: 11px; stroke: #fff; stroke-width: 3.5; fill: none; opacity: 0; }
  .check input:checked + .check__box { background: var(--good); border-color: var(--good); }
  .check input:checked + .check__box svg { opacity: 1; }
  .check input:focus-visible + .check__box { outline: 2px solid var(--accent); outline-offset: 2px; }
  .check__text { font-size: 13px; }
  .check input:checked ~ .check__text { color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--line-strong); }
  .check__sub { display: block; font-size: 11.5px; color: var(--ink-3); text-decoration: none !important; margin-top: 1px; }
  .check__meta { font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); white-space: nowrap; }

  /* ---------- Tables ---------- */
  .tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
  .tablewrap--tall { max-height: 460px; overflow: auto; }
  .tablewrap--tall table.data thead th { position: sticky; top: 0; z-index: 2; }
  table.data tr.rowhide { display: none; }
  table.data td[data-cell="cost"] { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-2); }
  table.data td[data-cell="id"] input { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
  table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 420px; }
  table.data th { text-align: left; font-family: var(--font-display); font-size: 9.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
  table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  table.data tr:last-child td { border-bottom: 0; }
  table.data td.num, table.data th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
  table.data tfoot td, table.data tr.total td { font-weight: 600; background: var(--surface-2); }
  table.data input, table.data select {
    font-family: var(--font-body); font-size: 12.5px; color: var(--ink); background: var(--surface);
    border: 1px solid var(--line); border-radius: 5px; padding: 5px 7px; width: 100%;
  }
  table.data input.num { font-family: var(--font-mono); text-align: right; }
  table.data input:focus, table.data select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
  .row-del { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 6px; border-radius: 4px; }
  .row-del:hover { color: var(--crit); background: var(--crit-soft); }

  /* ---------- Stat tiles ---------- */
  .tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; }
  .tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 3px; }
  .tile__k { font-family: var(--font-display); font-size: 9.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
  .tile__v { font-family: var(--font-mono); font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
  .tile__note { font-size: 11px; color: var(--ink-3); }
  .tile--flag { border-left: 3px solid var(--crit); }
  .tile--ok { border-left: 3px solid var(--good); }
  .tile--watch { border-left: 3px solid var(--warn); }

  /* ---------- Timeline ---------- */
  .timeline { display: flex; flex-direction: column; gap: 0; }
  .tl { display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding-bottom: 16px; position: relative; }
  .tl:not(:last-child)::before { content: ""; position: absolute; left: 12px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
  .tl__node { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; z-index: 1; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }
  .tl--done .tl__node { border-color: var(--good); background: var(--good); color: #fff; }
  .tl--active .tl__node { border-color: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); color: var(--warn); }
  .tl__body h4 { font-size: 13px; font-weight: 600; }
  .tl__body p { margin: 2px 0 0; font-size: 12px; color: var(--ink-2); }
  .tl__date { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

  /* ---------- Misc ---------- */
  .note { font-size: 12px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--info); border-radius: 6px; padding: 10px 12px; }
  .note--warn { border-left-color: var(--warn); }
  .note--crit { border-left-color: var(--crit); }
  .note--good { border-left-color: var(--good); }
  .btn { font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: 0.02em; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 7px; padding: 7px 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
  .btn:hover { background: var(--surface-2); }
  .btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
  .btn--primary:hover { background: var(--accent-deep); }
  .btn--ghost { border-color: transparent; background: transparent; color: var(--accent-deep); }
  .btn--ghost:hover { background: var(--accent-soft); }
  .btn:disabled { opacity: .5; cursor: not-allowed; }
  .btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
  .miniprog { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-2); }
  .miniprog__bar { width: 70px; height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; }
  .miniprog__bar > i { display: block; height: 100%; background: var(--good); }

  .docrow { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 9px 4px; font-size: 12.5px; }
  .docrow + .docrow { border-top: 1px solid var(--line); }
  .docrow__meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
  .filetag { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; text-transform: uppercase; }

  .photgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .phot { aspect-ratio: 4/3; border-radius: 8px; border: 1px solid var(--line); background: linear-gradient(135deg, var(--surface-2), var(--accent-soft)); display: flex; flex-direction: column; justify-content: flex-end; padding: 8px; position: relative; overflow: hidden; }
  .phot span { font-size: 10.5px; font-weight: 600; font-family: var(--font-display); letter-spacing: 0.03em; color: var(--ink-2); }
  .phot::before { content: "▣"; position: absolute; top: 8px; left: 9px; font-size: 13px; color: var(--ink-3); opacity: .6; }
  .photgrid--field .phot { justify-content: flex-end; gap: 2px; }
  .phot span.phot__tag { position: absolute; top: 7px; right: 7px; font-family: var(--font-display); font-weight: 600; font-size: 8.5px; letter-spacing: 0.05em; text-transform: uppercase; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 7px; color: var(--ink-2); }
  .phot span.phot__meta { font-size: 9px; color: var(--ink-3); font-family: var(--font-mono); font-weight: 400; letter-spacing: 0; }
  .photo-day { font-family: var(--font-display); font-size: 9.5px; font-weight: 600; letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-3); margin: 12px 0 6px; }
  .photo-day:first-child { margin-top: 0; }
  .phototags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
  .phototags button { font-size: 11px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); border-radius: 999px; padding: 3px 9px; cursor: pointer; font-family: var(--font-body); }
  .phototags button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

  .readingbar { display: inline-flex; align-items: center; gap: 6px; }
  .readingbar i { width: 44px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; display: inline-block; }
  .readingbar i b { display: block; height: 100%; border-radius: inherit; }

  .portal-banner { background: var(--info-soft); border: 1px solid var(--info); color: var(--info); border-radius: var(--radius); padding: 12px 16px; font-size: 12.5px; display: flex; align-items: center; gap: 10px; }
  .portal-banner b { font-family: var(--font-display); }

  .kv-inline { display: flex; flex-wrap: wrap; gap: 6px 22px; }
  .kv-inline > div { font-size: 12.5px; }
  .kv-inline b { color: var(--ink-3); font-weight: 500; }

  .sow-line { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 8px 0; font-size: 12.5px; border-bottom: 1px solid var(--line); }
  .sow-line:last-child { border-bottom: 0; }
  .sow-line small { color: var(--ink-3); display: block; }

  /* ---------- Sub-tabs ---------- */
  .subtabs { display: flex; gap: 4px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 9px; padding: 4px; flex-wrap: wrap; }
  .subtabs button {
    font-family: var(--font-display); font-weight: 600; font-size: 12px; border: 0; border-radius: 6px;
    padding: 8px 14px; cursor: pointer; background: transparent; color: var(--ink-2);
  }
  .subtabs button[aria-selected="true"] { background: var(--surface); color: var(--accent-deep); box-shadow: var(--shadow); }
  .subpane { display: flex; flex-direction: column; gap: 20px; }
  .subpane.hidden { display: none; }

  /* ---------- Modal / email composer ---------- */
  .modal-scrim {
    position: fixed; inset: 0; background: rgba(20,22,25,.55); backdrop-filter: blur(3px);
    display: none; align-items: flex-start; justify-content: center; padding: 40px 20px; z-index: 60; overflow-y: auto;
  }
  .modal-scrim.open { display: flex; }
  .modal-scrim.wide .modal { max-width: 900px; }
  .po-section-label { font-family: var(--font-display); font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin: 4px 0 -2px; }
  .po-recap { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 12.5px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
  .po-recap b { font-family: var(--font-mono); }
  .po-add-receipt { display: grid; grid-template-columns: 1.1fr 1.3fr 0.9fr auto; gap: 8px; align-items: end; }
  @media (max-width: 640px) { .po-add-receipt { grid-template-columns: 1fr 1fr; } }
  .modal {
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
    width: 100%; max-width: 660px; overflow: hidden; display: flex; flex-direction: column;
  }
  .modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
  .modal__head h3 { font-size: 14px; font-weight: 700; }
  .modal__x { border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
  .modal__x:hover { color: var(--ink); background: var(--line); }
  .modal__body { padding: 18px; display: flex; flex-direction: column; gap: 13px; max-height: 62vh; overflow-y: auto; }
  .modal__foot { padding: 13px 18px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
  .email-meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 12.5px; }
  .email-meta b { color: var(--ink-3); font-weight: 500; font-family: var(--font-display); letter-spacing: 0.04em; text-transform: uppercase; font-size: 10px; align-self: center; }
  .email-meta input { font-family: var(--font-body); font-size: 12.5px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--surface); color: var(--ink); width: 100%; }
  .email-body {
    font-family: var(--font-body); font-size: 13px; line-height: 1.6; white-space: pre-wrap;
    border: 1px solid var(--line-strong); border-radius: 8px; padding: 14px; background: var(--surface-2);
    min-height: 240px; color: var(--ink); resize: vertical; width: 100%;
  }
  .email-body:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

  /* ---------- Toast ---------- */
  .toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
    background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 500;
    padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow-lg); opacity: 0;
    transition: opacity .2s ease, transform .2s ease; z-index: 80; pointer-events: none; max-width: 90vw;
  }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

  /* ---------- Invoice / print doc ---------- */
  .invoice-doc {
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 26px;
    font-size: 12.5px; color: var(--ink);
  }
  .invoice-doc__top { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
  .invoice-doc__brand { display: flex; align-items: center; gap: 10px; }
  .invoice-doc h2 { font-size: 22px; letter-spacing: 0.02em; }
  .invoice-doc__parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin: 22px 0; }
  .invoice-doc__parties h4 { font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
  .balancebox { display: flex; gap: 22px; flex-wrap: wrap; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
  .balancebox div { font-size: 11px; color: var(--ink-3); }
  .balancebox b { display: block; font-family: var(--font-mono); font-size: 17px; color: var(--ink); margin-top: 2px; }

  @media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .phasenav { display: grid; grid-template-columns: 1fr 1fr; }
    .sidebar__foot { flex-direction: row; align-items: center; flex-wrap: wrap; margin-top: 8px; }
    .sidebar__foot .themebtn { display: none; }
    .form { grid-template-columns: 1fr; }
    .content { padding: 20px 16px 56px; }
    .topbar { padding: 14px 16px; }
  }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  /* ---------- Portfolio ---------- */
  .pf-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .pf-filter {
    font-family: var(--font-body); font-size: 12px; color: var(--ink);
    border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 9px; background: var(--surface);
  }
  .pf-filter:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
  .pf-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: 14px; }
  .pf-card {
    text-align: left; font: inherit; color: inherit; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 15px 16px; display: flex; flex-direction: column; gap: 9px; cursor: pointer;
    transition: border-color .12s ease, transform .12s ease;
  }
  .pf-card:hover { border-color: var(--accent); transform: translateY(-2px); }
  .pf-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .pf-card__top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  .pf-card__id { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--accent-deep); }
  .pf-card__client { font-family: var(--font-display); font-weight: 600; font-size: 14px; }
  .pf-card__addr { font-size: 12px; color: var(--ink-2); }
  .pf-card__bar { height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 2px; }
  .pf-card__bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-deep)); }
  .pf-card__meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--ink-3); font-family: var(--font-mono); }
  .pf-card__foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
  .alertchip {
    font-family: var(--font-display); font-weight: 600; font-size: 10px; letter-spacing: 0.04em;
    text-transform: uppercase; color: var(--crit); background: var(--crit-soft); border-radius: 999px; padding: 2px 8px;
  }
  .alertchip--none { color: var(--good); background: var(--good-soft); }
  .pf-alerts-cell { color: var(--crit); font-size: 11px; }
  table.data tr[data-openproj] { cursor: pointer; }
  table.data tr[data-openproj]:hover td { background: var(--surface-2); }

  /* ---------- Sidebar project controls ---------- */
  .side-newbtn {
    font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: 0.02em;
    border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 8px;
    padding: 9px 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
  }
  .side-newbtn:hover { background: var(--accent-deep); }
  .side-projbtn {
    font-family: var(--font-body); font-size: 12px; color: var(--ink-2);
    border: 1px solid var(--line); background: var(--surface-2); border-radius: 7px;
    padding: 7px 10px; cursor: pointer; text-align: left; display: flex; align-items: center; gap: 7px;
  }
  .side-projbtn:hover { background: var(--line); }
  .side-projchip {
    border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 7px;
    padding: 8px 10px; background: var(--surface-2); font-size: 12px; color: var(--ink-2);
  }
  .side-projchip b { font-family: var(--font-mono); font-size: 12px; display: block; color: var(--accent-deep); margin-bottom: 1px; }
  body[data-scope="portfolio"] #jobcard,
  body[data-scope="portfolio"] #phasenav,
  body[data-scope="portfolio"] .viewtoggle,
  body[data-scope="portfolio"] #btn-allprojects,
  body[data-scope="portfolio"] #side-projchip { display: none; }
  body[data-scope="project"] #btn-newproject,
  body[data-scope="project"] .side-navbtn,
  body[data-scope="field"] .side-navbtn,
  body[data-scope="marketing"] #jobcard, body[data-scope="marketing"] #phasenav, body[data-scope="marketing"] .viewtoggle, body[data-scope="marketing"] #side-projchip,
  body[data-scope="admin"] #jobcard, body[data-scope="admin"] #phasenav, body[data-scope="admin"] .viewtoggle, body[data-scope="admin"] #side-projchip { display: none; }
  body[data-scope="marketing"] #btn-allprojects, body[data-scope="admin"] #btn-allprojects { display: block; }
  .side-navbtn { font-family: var(--font-body); font-size: 12px; color: var(--ink-2); border: 1px solid var(--line); background: var(--surface-2); border-radius: 7px; padding: 7px 10px; cursor: pointer; text-align: left; }
  .side-navbtn:hover { background: var(--line); }
  .side-navbtn[aria-current="true"] { border-color: var(--accent); color: var(--accent-deep); }

  /* pipeline / marketing */
  .pipe { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: start; }
  .pipe__col { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); padding: 8px; display: flex; flex-direction: column; gap: 7px; min-height: 60px; }
  .pipe__head { font-family: var(--font-display); font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); display: flex; justify-content: space-between; }
  .lead-card { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 9px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
  .lead-card:hover { border-color: var(--accent); }
  .lead-card b { font-size: 12.5px; }
  .lead-card__meta { font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); }
  .lead-card__due { font-size: 10.5px; }
  .lead-card__due.over { color: var(--crit); }
  .lead-move { display: flex; gap: 4px; }
  .lead-move button { flex: 1; font-size: 10px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 5px; padding: 3px; cursor: pointer; color: var(--ink-2); }
  .lead-move button:hover { background: var(--accent-soft); color: var(--accent-deep); }

  /* messaging */
  .msg-thread { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; padding: 4px; }
  .msg { max-width: 82%; font-size: 12.5px; line-height: 1.5; border-radius: 12px; padding: 8px 11px; }
  .msg--in { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); }
  .msg--out { align-self: flex-end; background: var(--accent); color: #fff; }
  .msg__meta { font-size: 9.5px; opacity: .7; font-family: var(--font-mono); margin-top: 3px; }
  .msg-input { display: flex; gap: 8px; margin-top: 10px; }
  .msg-input input { flex: 1; font-family: var(--font-body); font-size: 13px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 11px; background: var(--surface); color: var(--ink); }
  .msg-input input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

  /* audit / role */
  .rolebar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .rolebar select { font-family: var(--font-body); font-size: 12.5px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 9px; background: var(--surface); color: var(--ink); }
  .audit-row { display: grid; grid-template-columns: 128px 110px 1fr; gap: 10px; font-size: 11.5px; padding: 6px 2px; border-bottom: 1px solid var(--line); }
  .audit-row span:first-child, .audit-row span:nth-child(2) { font-family: var(--font-mono); color: var(--ink-3); font-size: 10.5px; }
  .code-out { font-family: var(--font-mono); font-size: 10.5px; white-space: pre; overflow: auto; max-height: 220px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--surface-2); color: var(--ink-2); }
  .rolegate-hide { display: none !important; }
  body[data-role="readonly"] .content section:not(#mod-admin) input,
  body[data-role="readonly"] .content section:not(#mod-admin) select,
  body[data-role="readonly"] .content section:not(#mod-admin) textarea,
  body[data-role="readonly"] .content section:not(#mod-admin) .btn,
  body[data-role="readonly"] .content section:not(#mod-admin) .check,
  body[data-role="readonly"] .assist-fab,
  body[data-role="readonly"] .topbar__head .btn { pointer-events: none; opacity: .55; }
  body[data-role="estimator"] #mod-billing input:not([data-taxfor]):not([data-emgpct]),
  body[data-role="estimator"] #mod-billing .row-del,
  body[data-role="estimator"] #mod-billing [data-rowadd] { pointer-events: none; opacity: .55; }

  .np-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
  .np-grid .fg--wide { grid-column: 1 / -1; }
  @media (max-width: 640px) { .np-grid { grid-template-columns: 1fr; } }

  /* ---------- AI Assistant ---------- */
  .assist-fab {
    position: fixed; right: 20px; bottom: 20px; width: 52px; height: 52px; border-radius: 50%;
    background: var(--accent); color: #fff; border: 0; cursor: pointer; box-shadow: var(--shadow-lg);
    display: grid; place-items: center; z-index: 45;
  }
  .assist-fab svg { width: 24px; height: 24px; stroke: none; fill: #fff; }
  .assist-fab:hover { background: var(--accent-deep); }
  body.assist-open .assist-fab { display: none; }

  .assistant {
    position: fixed; top: 0; right: 0; height: 100vh; width: min(444px, 100vw);
    background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
    z-index: 55; display: flex; flex-direction: column; transform: translateX(100%);
    transition: transform .22s ease;
  }
  body.assist-open .assistant { transform: translateX(0); }
  .assistant__head { padding: 13px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
  .assistant__head h3 { font-size: 14px; font-weight: 700; }
  .assistant__head p { margin: 2px 0 0; font-size: 10.5px; color: var(--ink-3); font-family: var(--font-mono); }
  .assistant__modes { display: flex; gap: 6px; padding: 10px 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
  .assistant__modes button {
    font-family: var(--font-display); font-weight: 600; font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase;
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 5px 10px; cursor: pointer;
  }
  .assistant__modes button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
  .assistant__log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 11px; background: var(--bg); }
  .a-msg { max-width: 90%; font-size: 12.5px; line-height: 1.55; border-radius: 14px; padding: 10px 13px; }
  .a-msg--u { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
  .a-msg--a { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
  .a-msg--a h4 { font-size: 12px; font-weight: 700; margin: 0 0 5px; }
  .a-msg--a ul { margin: 5px 0; padding-left: 17px; }
  .a-msg--a li { margin: 2px 0; }
  .a-msg--a b { font-weight: 700; }
  .a-msg--a table { width: 100%; border-collapse: collapse; font-size: 11px; margin: 6px 0; }
  .a-msg--a td { padding: 3px 4px; border-bottom: 1px solid var(--line); }
  .a-msg--a .num { text-align: right; font-family: var(--font-mono); }
  .a-act { margin-top: 9px; }
  .a-act button {
    font-family: var(--font-display); font-weight: 600; font-size: 11px; border: 1px solid var(--accent);
    background: var(--accent-soft); color: var(--accent-deep); border-radius: 8px; padding: 6px 11px; cursor: pointer;
  }
  .a-act button:hover { background: var(--accent); color: #fff; }
  .assistant__starters { display: flex; gap: 6px; flex-wrap: wrap; padding: 9px 12px 0; }
  .assistant__starters button { font-size: 11px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); border-radius: 999px; padding: 4px 9px; cursor: pointer; }
  .assistant__starters button:hover { border-color: var(--accent); color: var(--accent-deep); }
  .assistant__input { padding: 10px 12px 6px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-end; }
  .assistant__input textarea {
    flex: 1; font-family: var(--font-body); font-size: 13px; border: 1px solid var(--line-strong); border-radius: 10px;
    padding: 9px 11px; resize: none; min-height: 40px; max-height: 120px; background: var(--surface); color: var(--ink);
  }
  .assistant__input textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
  .assistant__send { width: 40px; height: 40px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }
  .assistant__send svg { width: 18px; height: 18px; fill: #fff; }
  .a-disc { font-size: 10px; color: var(--ink-3); padding: 4px 14px 10px; }
  @media (max-width: 520px) { .assistant { width: 100vw; } }
  @media print { .assist-fab, .assistant { display: none !important; } }

  @media print {
    .sidebar, .topbar, .modal__head, .modal__foot, .no-print { display: none !important; }
    .modal-scrim { position: static; background: none; padding: 0; display: block; }
    .modal { max-width: none; border: 0; box-shadow: none; }
    .modal__body { max-height: none; overflow: visible; }
    body { background: #fff; }
  }

  /* ---------- Production additions ---------- */
  .boot { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--ink-2); font-size: 14px; text-align: center; padding: 24px; }
  .boot .btn { margin-left: 8px; }
  .me-badge { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; cursor: pointer; color: var(--ink); font: inherit; font-family: var(--font-body); }
  .me-badge:hover { border-color: var(--line-strong); }
  .me-badge:empty { display: none; }
  .me-badge b { display: block; font-size: 12px; line-height: 1.2; }
  .me-badge small { display: block; font-size: 10.5px; color: var(--ink-3); }
  .me-badge__av { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-deep); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 11px; }
  @media (max-width: 900px) { .me-badge { width: auto; } }
  .visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  label.btn { cursor: pointer; }
  label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
  .muted-p { color: var(--ink-2); margin: 0 0 8px; }
  .linkbtn { background: none; border: 0; padding: 0; margin-left: 4px; font: inherit; font-size: 12px; font-weight: 600; color: var(--accent-deep); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
  .linkbtn:hover { color: var(--accent); }
  .phot--img { padding: 0; background: var(--surface-2); }
  .phot--img::before { content: none; }
  .phot__img { position: absolute; inset: 0; display: block; }
  .phot__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .phot--img > span:not(.phot__tag) { position: relative; z-index: 1; background: linear-gradient(transparent, rgba(0,0,0,.62)); color: #fff; padding: 14px 8px 6px; }
  .phot--img > span.phot__meta { padding-top: 0; color: rgba(255,255,255,.85); }
  .phot--img span.phot__tag { z-index: 2; }
  .phot__del { position: absolute; top: 6px; left: 6px; z-index: 3; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--crit); font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; opacity: .85; }
  .phot__del:hover { opacity: 1; }
  .row-muted td { color: var(--ink-3); }
  table.is-locked input, table.is-locked select, table.is-locked textarea { background: transparent; }
  .is-locked .row-del { display: none; }
  input:disabled, select:disabled, textarea:disabled { opacity: .75; cursor: not-allowed; }
  .kv-inline { display: grid; gap: 4px; font-size: 13px; }
  .kv-inline b { display: inline-block; min-width: 56px; color: var(--ink-3); font-weight: 600; }
  .temp-pw { font-family: var(--font-mono); font-size: 18px; letter-spacing: .06em; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 8px; padding: 10px 12px; user-select: all; }
