/* PPW prototype — tokens. Light is the default; dark is chosen or follows the device. */
:root {
  --paper: #F4F6F3; --surface: #FFFFFF; --surface-2: #F7FAF8;
  --ink: #1F2D27; --ink-2: #56655E; --ink-3: #8C9891;
  --line: #D9E0DB; --line-2: #ECF0ED;
  --rail: #1F2D27; --rail-ink: #C9D6CF; --rail-dim: #6F8078;
  --accent: #0B6E4F; --accent-ink: #FFFFFF; --accent-soft: #E1F0E9; --accent-hover: #095B41;
  --danger: #B42318; --danger-soft: #FBE9E7; --warn: #B7791F; --warn-soft: #FBF1DC; --rush: #D92D20;
  --st-unassigned: #B7791F; --st-assigned: #3B5BDB; --st-in_field: #0C8599; --st-ready: #6F42C1; --st-follow_up: #C2410C;
  --st-submitted: #2F9E44; --st-invoiced: #1B7F3A; --st-closed: #6B7280; --st-cancelled: #B42318; --st-unable: #9F1239;
  --shadow: 0 20px 50px rgba(0,0,0,.25);
  --radius: 4px; --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  --paper: #131816; --surface: #1B2220; --surface-2: #202927;
  --ink: #E4EBE7; --ink-2: #A7B4AD; --ink-3: #798680;
  --line: #2E3936; --line-2: #263030;
  --rail: #0E1311; --rail-ink: #B5C2BB; --rail-dim: #5E6B66;
  --accent: #3FB48C; --accent-ink: #0B1B15; --accent-soft: #1B3A2F; --accent-hover: #55C69E;
  --danger: #F08A80; --danger-soft: #3A1F1C; --warn: #E2B04A; --warn-soft: #3A2E14; --rush: #FF6B5E;
  --shadow: 0 20px 50px rgba(0,0,0,.6);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --paper: #131816; --surface: #1B2220; --surface-2: #202927;
    --ink: #E4EBE7; --ink-2: #A7B4AD; --ink-3: #798680;
    --line: #2E3936; --line-2: #263030;
    --rail: #0E1311; --rail-ink: #B5C2BB; --rail-dim: #5E6B66;
    --accent: #3FB48C; --accent-ink: #0B1B15; --accent-soft: #1B3A2F; --accent-hover: #55C69E;
    --danger: #F08A80; --danger-soft: #3A1F1C; --warn: #E2B04A; --warn-soft: #3A2E14; --rush: #FF6B5E;
    --shadow: 0 20px 50px rgba(0,0,0,.6);
  }
}
:root[data-size="compact"] { font-size: 13px; }
:root[data-size="comfortable"] { font-size: 14px; }
:root[data-size="large"] { font-size: 16px; }
* { box-sizing: border-box; }
html { font-size: 14px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 1rem; line-height: 1.45; color-scheme: light; }
:root[data-theme="dark"] body { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] body { color-scheme: dark; } }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.57em; }
h2 { font-size: 1.21em; }
h3 { font-size: 1em; }
p { margin: 0 0 8px; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.muted { color: var(--ink-3); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Office shell */
.shell { display: grid; grid-template-columns: 212px 1fr; min-height: 100vh; }
.rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; padding: 18px 0; position: sticky; top: 0; height: 100vh; overflow: auto; }
.rail .brand { padding: 0 20px 14px; }
.rail .brand .mark { font-size: 1.43em; font-weight: 600; color: #fff; letter-spacing: .5px; }
.rail .brand .tenant { font-size: .86em; color: var(--rail-dim); margin-top: 2px; }
.rail nav .navgroup { border-top: 1px solid rgba(255,255,255,.07); padding: 6px 0; }
.rail nav .navgroup:first-child { border-top: 0; }
.rail nav a { display: flex; align-items: center; justify-content: space-between; padding: 7px 20px; color: var(--rail-ink); font-size: .96em; }
.rail nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.rail nav a.active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.rail nav .count { background: rgba(255,255,255,.14); border-radius: 999px; font-size: .79em; padding: 1px 7px; }
.rail .foot { margin-top: auto; padding: 12px 20px 0; display: grid; gap: 6px; font-size: .93em; }
.rail .foot a { color: var(--rail-dim); }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: .93em; color: var(--ink-2); }
.topbar .who b { color: var(--ink); font-weight: 500; }
.theme-pick { font-size: .9em; }
.banner-support { background: var(--warn-soft); color: var(--ink); border-bottom: 1px solid var(--warn); padding: 8px 24px; font-size: .93em; display: flex; align-items: center; gap: 12px; }
/* A read-only tenant: the banner stays on every page and nothing in the content that changes data is shown.
   Buttons marked btn-view only open something to look at and stay. */
.banner-readonly { background: var(--danger-soft); color: var(--ink); border-bottom: 1px solid var(--danger); padding: 8px 24px; font-size: .93em; }
.shell.readonly .content .btn:not(.btn-view), .shell.readonly .content .bulkbar, .shell.readonly .content .tickall, .shell.readonly .content input[data-change="tick"] { display: none; }
.signin-notice { margin-bottom: 14px; font-size: 1em; }
.content { padding: 20px 24px 60px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.page-head .grow { flex: 1; }
.page-head .sub { color: var(--ink-2); font-size: .93em; margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Controls */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: .93em; font-weight: 500; line-height: 1.2; text-decoration: none; }
.btn:hover { background: var(--line-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--accent); }
.btn-quiet:hover { background: var(--accent-soft); }
.btn-sm { padding: 4px 9px; font-size: .86em; }
.btn-lg { padding: 12px 16px; font-size: 1.07em; }
.btn-block { width: 100%; justify-content: center; }
select, input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], input[type=tel], input[type=file], textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); width: 100%; }
select.inline, input.inline { width: auto; }
select[multiple] { padding: 4px; }
textarea { min-height: 72px; resize: vertical; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > label { font-size: .86em; color: var(--ink-2); }
.field .hint { font-size: .86em; color: var(--ink-3); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: .93em; padding: 4px 0; }
.check input { margin-top: 3px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 12px; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 5px 0; border-bottom: 1px solid var(--line-2); }
ul.plain li a { margin-left: 6px; color: var(--ink-3); }

/* Filters */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 14px 0 10px; font-size: .93em; }
.filters .grow { flex: 1; min-width: 180px; }
.filters label.toggle { display: inline-flex; gap: 6px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

/* Pipeline strip */
.pipeline { display: flex; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.pipe { flex: 1; padding: 10px 12px 8px; border-right: 1px solid var(--line-2); border-top: 3px solid var(--pipe, var(--line)); cursor: pointer; min-width: 0; }
.pipe:last-child { border-right: 0; }
.pipe:hover { background: var(--line-2); }
.pipe.active { background: var(--accent-soft); }
.pipe.all { --pipe: var(--ink); flex: 0 0 90px; }
.pipe .n { font-size: 1.57em; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pipe .l { font-size: .86em; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe.dim .n { color: var(--ink-3); }
.pipeline .sep { width: 10px; background: var(--paper); }

/* Tables */
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93em; }
.table th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: .92em; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; white-space: nowrap; }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: var(--surface-2); }
.table .group td { background: var(--line-2); font-weight: 600; color: var(--ink-2); }
.table td.actions { white-space: nowrap; }
.table.matrix td.c { text-align: center; }
.table.matrix th { text-align: center; }
.table.matrix th:first-child, .table.matrix td:first-child { text-align: left; }
.due-over { color: var(--danger); font-weight: 500; }
.due-today { color: var(--warn); font-weight: 500; }
.empty { padding: 28px; text-align: center; color: var(--ink-2); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }
td.empty { padding: 20px; }

/* Chips and marks */
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .86em; font-weight: 500; color: #fff; white-space: nowrap; line-height: 1.5; }
.chip.st-unassigned { background: var(--st-unassigned); } .chip.st-assigned { background: var(--st-assigned); } .chip.st-in_field { background: var(--st-in_field); }
.chip.st-ready { background: var(--st-ready); } .chip.st-follow_up { background: var(--st-follow_up); } .chip.st-submitted { background: var(--st-submitted); }
.chip.st-invoiced { background: var(--st-invoiced); } .chip.st-closed { background: var(--st-closed); } .chip.st-cancelled { background: var(--st-cancelled); } .chip.st-unable { background: var(--st-unable); }
.chip.soft { background: var(--line-2); color: var(--ink-2); }
.chip.ok { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.rush { color: var(--rush); font-weight: 600; font-size: .86em; }
.masked { color: var(--ink-3); font-style: italic; font-size: .86em; }
.tag { display: inline-block; font-size: .79em; padding: 1px 6px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink-2); margin: 2px 4px 2px 0; }
.tag a { color: var(--ink-3); }
.tag.rep { color: var(--st-in_field); border-color: var(--st-in_field); }
.tag.flag { color: var(--warn); border-color: var(--warn); }
.tag.wait { color: var(--st-follow_up); border-color: var(--st-follow_up); }
.tag.tpl { color: var(--st-assigned); border-color: var(--st-assigned); }
/* the client's own fields: the panel on the order page, the definition table, the draft's inputs */
.card.own .own-grid { grid-template-columns: 170px 1fr 170px 1fr; }
@media (max-width: 1100px) { .card.own .own-grid { grid-template-columns: 170px 1fr; } }
.table.fields td.c { text-align: center; }
.table tr.dim td { color: var(--ink-3); }
.own-draft .row > .field { min-width: 180px; }
.filters.xf select.inline { max-width: 260px; }
td.flags { max-width: 230px; }
td.rules, th.rules { min-width: 300px; }
.tickall { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; font-weight: 500; cursor: pointer; }
.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: 8px 12px; margin: 0 0 10px; font-size: .93em; }
.bulkbar b { margin-right: 6px; }
.filters .lbl { color: var(--ink-3); font-size: .92em; }
.mailbox { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mailbox code { font: inherit; background: var(--line-2); padding: 2px 8px; border-radius: 3px; }

/* Order detail */
.band { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; margin-bottom: 14px; }
.band .k { font-size: .86em; color: var(--ink-2); }
.band .v { font-size: 1em; font-weight: 500; margin-top: 1px; }
.detail { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .detail { grid-template-columns: 1fr; } }
.stepper { list-style: none; margin: 0; padding: 0; }
.stepper li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 0 0 14px; position: relative; font-size: .93em; }
.stepper li::before { content: ""; position: absolute; left: 7px; top: 16px; bottom: -2px; width: 2px; background: var(--line); }
.stepper li:last-child::before { display: none; }
.stepper .dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); margin-top: 2px; }
.stepper li.done .dot { background: var(--accent); border-color: var(--accent); }
.stepper li.done::before { background: var(--accent); }
.stepper li.current .dot { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stepper li.current b { color: var(--accent); }
.stepper li.todo { color: var(--ink-3); }
.stepper li.todo b { font-weight: 500; }
.stepper li.bad .dot { background: var(--danger); border-color: var(--danger); }
.stepper li.bad b { color: var(--danger); }
.stepper .t { font-size: .92em; color: var(--ink-2); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: .93em; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { color: var(--ink); border-color: var(--accent); font-weight: 500; }
.tabs .count { color: var(--ink-3); margin-left: 4px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.card h3 { margin-bottom: 8px; }
.card .head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.card .head .grow { flex: 1; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 1100px) { .two { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 4px 12px; font-size: .93em; }
.kv .k { color: var(--ink-2); }
.notice { padding: 10px 12px; border-radius: var(--radius); font-size: .93em; margin-bottom: 12px; border: 1px solid; }
.notice.info { background: var(--accent-soft); border-color: var(--accent); }
.notice.warn { background: var(--warn-soft); border-color: var(--warn); }
.notice.bad { background: var(--danger-soft); border-color: var(--danger); }
.notice.clientno .actions { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: 6px; vertical-align: middle; }
.modal .choices { margin: 6px 0 10px 18px; padding: 0; }
.modal .choices li { margin: 6px 0; }
.field.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: .93em; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.timeline li:last-child { border-bottom: 0; }
.timeline .t { color: var(--ink-2); white-space: nowrap; }
.timeline.small li { padding: 3px 0; grid-template-columns: 130px 1fr; }
.bill { border-top: 1px solid var(--line-2); padding-top: 10px; margin-top: 10px; }
.bill:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.raw { white-space: pre-wrap; font: inherit; font-size: .9em; color: var(--ink-2); margin: 0; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); font-size: .86em; }
.photo img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.photo .meta { padding: 6px 8px; color: var(--ink-2); }
.photo .meta b { color: var(--ink); font-weight: 500; display: block; }
.note { border-bottom: 1px solid var(--line-2); padding: 8px 0; font-size: .93em; }
.note:last-child { border-bottom: 0; }
.note .by { color: var(--ink-2); font-size: .92em; margin-bottom: 2px; }

/* Settings */
.settings { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .settings { grid-template-columns: 1fr; } }
.subnav { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 0; position: sticky; top: 64px; }
.subnav a { display: block; padding: 8px 14px; color: var(--ink-2); font-size: .93em; }
.subnav a:hover { text-decoration: none; color: var(--ink); background: var(--line-2); }
.subnav a.active { color: var(--ink); font-weight: 500; box-shadow: inset 3px 0 0 var(--accent); }
.platform .topbar { gap: 10px; }
.platform .content { max-width: 1200px; }
.ptabs { display: flex; gap: 2px; margin-left: 18px; }
.ptabs a { padding: 6px 10px; color: var(--ink-2); border-radius: var(--radius); font-size: .93em; }
.ptabs a:hover { text-decoration: none; background: var(--line-2); color: var(--ink); }
.ptabs a.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.crumbs { font-size: .93em; color: var(--ink-2); margin-bottom: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.stat { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px 12px; }
.stat .n { font-size: 1.57em; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: .86em; color: var(--ink-2); margin-top: 2px; }
.table tfoot td { border-top: 1px solid var(--line); background: var(--surface-2); }

/* Sign-in */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 24px; }
.signin .box { width: min(960px, 100%); display: grid; grid-template-columns: 1.1fr .9fr; gap: 20px; }
@media (max-width: 860px) { .signin .box { grid-template-columns: 1fr; } }
.signin .card { padding: 26px 28px; margin: 0; }
.signin .brand { font-size: 1.86em; font-weight: 600; margin-bottom: 2px; }
.signin .lede { color: var(--ink-2); margin-bottom: 18px; }
.signin ul { padding-left: 18px; margin: 0 0 12px; font-size: .93em; color: var(--ink-2); }
.signin li { margin: 3px 0; }
.demo-users { display: grid; gap: 6px; margin-top: 10px; }
.demo-users a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); font-size: .93em; }
.demo-users a:hover { background: var(--accent-soft); text-decoration: none; }
.demo-users .r { color: var(--ink-2); text-align: right; }

/* Modal, toast */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 16, 13, .55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: var(--surface); width: 620px; max-width: 100%; max-height: 92vh; overflow: auto; border-radius: 6px; padding: 20px 22px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.modal h2 { margin-bottom: 12px; }
.modal .card { padding: 10px 12px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 6px; font-size: .93em; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; }

/* Personal notifications and report charts */
.notice-wrap { position: relative; }
.notice-bell { gap: 4px; white-space: nowrap; }
.bell-symbol { font-size: 1.1em; }
.notice-list { position: absolute; right: 0; top: calc(100% + 6px); width: min(340px, 90vw); max-height: 400px; overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); z-index: 10; }
.notice-list .head { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.notice-list .head b { flex: 1; }
.notice-item { display: block; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink); padding: 9px 4px; cursor: pointer; }
.notice-item.unread { background: var(--accent-soft); font-weight: 600; }
.notice-item:hover { color: var(--accent); }
.notice-item small { display: block; color: var(--ink-2); font-weight: 400; margin-top: 3px; }
.phone .app-head .notice-wrap { margin-left: auto; }
.phone .notice-bell { background: transparent; color: #fff; border-color: #ffffff80; }
.phone .notice-list { right: -12px; width: 315px; }
.dash-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.dash-total { display: flex; flex-direction: column; text-align: left; gap: 6px; color: var(--ink); cursor: pointer; }
.dash-total b { font-size: 1.45em; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dash-panel { min-width: 0; }
.dash-bars { display: grid; gap: 8px; margin-top: 12px; }
.dash-row { display: block; width: 100%; padding: 6px; text-align: left; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--ink); cursor: pointer; }
.dash-row:hover, .dash-total:hover { border-color: var(--accent); }
.dash-row-head { display: flex; justify-content: space-between; gap: 10px; font: inherit; }
.dash-track { display: block; height: 12px; margin-top: 5px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.dash-fill { display: block; height: 100%; border-radius: 8px; background: var(--accent); }
.dash-fill.crew { background: var(--warn); }
.dash-fill.orders { background: var(--ink-2); }
.dash-fill.margin { background: var(--accent); }
@media (max-width: 700px) { .dash-totals, .dash-grid { grid-template-columns: 1fr; } .notice-list { right: -60px; } }

/* Field app */
.field-stage { min-height: 100vh; display: grid; grid-template-columns: 1fr 420px 1fr; align-items: start; }
.field-stage .side { padding: 40px 28px; color: var(--ink-2); font-size: .93em; max-width: 360px; }
.field-stage .side h2 { color: var(--ink); margin-bottom: 8px; }
.field-stage .side ul { padding-left: 18px; }
.field-stage .side.right { justify-self: end; }
@media (max-width: 1000px) { .field-stage { grid-template-columns: 1fr; } .field-stage .side { display: none; } }
.phone { width: 400px; height: 820px; margin: 28px auto; border: 12px solid #1B1F1D; border-radius: 42px; background: var(--surface); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.phone .status-bar { height: 28px; background: var(--surface); display: flex; justify-content: space-between; align-items: center; padding: 0 22px; font-size: .86em; color: var(--ink-2); }
.phone .app { flex: 1; overflow: auto; display: flex; flex-direction: column; background: var(--paper); }
.phone .app-head { background: var(--rail); color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 2; }
.phone .app-head h2 { color: #fff; font-size: 1.21em; }
.phone .app-head a { color: var(--rail-ink); font-size: 1.43em; line-height: 1; }
.phone .app-body { padding: 14px 16px 24px; flex: 1; }
.phone .app-nav { display: flex; border-top: 1px solid var(--line); background: var(--surface); }
.phone .app-nav a { flex: 1; text-align: center; padding: 10px 0 12px; font-size: .86em; color: var(--ink-2); }
.phone .app-nav a.active { color: var(--accent); font-weight: 600; }
.phone .app-nav a:hover { text-decoration: none; }
.f-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.f-card h3 { margin-bottom: 6px; font-size: 1.07em; }
.f-card.tap { cursor: pointer; }
.f-card.tap:hover { border-color: var(--accent); }
.f-card .sub { color: var(--ink-2); font-size: .93em; }
.f-card .badge { float: right; background: var(--accent); color: var(--accent-ink); font-size: .79em; padding: 2px 7px; border-radius: 999px; font-weight: 600; }
.f-section { font-size: .86em; color: var(--ink-2); margin: 14px 0 6px; font-weight: 500; }
.f-line { border-top: 1px solid var(--line-2); padding: 10px 0; }
.f-line:first-of-type { border-top: 0; }
.f-line .d { font-size: 1em; }
.f-line .q { color: var(--ink-2); font-size: .86em; }
.seg { display: flex; gap: 6px; margin-top: 8px; }
.seg .btn { flex: 1; justify-content: center; }
.seg .btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seg .btn.on.bad { background: var(--danger); border-color: var(--danger); color: #fff; }
.seg .btn.on.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 72px; height: 54px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.big-code { font-size: 2em; letter-spacing: 6px; font-weight: 600; text-align: center; padding: 8px; }
.f-locked { background: var(--warn-soft); border: 1px solid var(--warn); padding: 10px 12px; border-radius: 8px; font-size: .93em; }
.f-followup { background: var(--danger-soft); border: 1px solid var(--danger); padding: 10px 12px; border-radius: 8px; font-size: .93em; }
.f-pay { font-size: 1.43em; font-weight: 600; }
.f-code { font-size: 1.43em; font-weight: 600; letter-spacing: 2px; }

/* photos: click to see large (2026-10-06) */
.photo-link { display: block; cursor: zoom-in; }
.photo-large { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--radius); background: var(--surface-2, #eee); }
.thumbs .photo-link img, .thumbs img { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; }

/* ---- Phones (owner, 2026-10-07): the office, the console, the sign-in pages and the crew app on a phone, upright or on
   its side. Below 760px wide, or a touch screen less than 500px tall (a phone held sideways): the left rail becomes a bar
   across the top with its links in one row that scrolls sideways; the top bar wraps; the status strip and wide tables
   scroll inside their own frames, never the page; each table row shows as a card; filters take whole rows and the less-used ones fold behind "More
   filters"; side-by-side panels stack; dialogs use the whole width; the crew app fills the screen instead of a drawn
   phone. The real app (ppw-app) gets these rules from this file through tools/sync-demo.sh. ---- */
.phone-only { display: none; }
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; overflow: visible; padding: 10px 0 0; }
  .rail .brand { padding: 0 16px 8px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .rail .brand .mark { font-size: 1.15em; }
  .rail nav { display: flex; overflow-x: auto; white-space: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .rail nav::-webkit-scrollbar { display: none; }
  .rail nav .navgroup { display: flex; border-top: 0; padding: 0; }
  .rail nav a { padding: 10px 14px; gap: 6px; }
  .rail nav a.active { box-shadow: inset 0 -3px 0 var(--accent); }
  .rail .foot { margin: 0; padding: 4px 16px 8px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .86em; }

  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 16px; position: static; }
  .topbar .spacer { display: none; }
  .topbar #company-scope { flex: 1 1 100%; }
  .topbar #company-scope select, .topbar > select:first-child { width: 100%; }
  .banner-support, .banner-readonly { padding: 8px 16px; flex-wrap: wrap; }

  .content { padding: 14px 16px 48px; }
  .page-head { flex-wrap: wrap; gap: 10px; }
  .page-head .actions { width: 100%; }

  .pipeline { overflow-x: auto; }
  .pipe { flex: 0 0 auto; min-width: 92px; }
  .pipe.all { flex: 0 0 72px; }
  .pipeline .sep { flex: 0 0 8px; }

  .filters { gap: 6px; }
  .filters > input, .filters > select { flex: 1 1 100%; min-width: 0; }
  .filters .grow { min-width: 0; }
  .filters .toggle { flex: 1 1 auto; }
  .notice .actions { width: 100%; margin-top: 6px; }
  .phone-only { display: inline-flex; margin: 0 0 8px; }
  .more-filters:not(.open) { display: none; }

  /* tables: each row a card, each value on its own line named by its column (labels from ui.js labelTables) */
  .tablewrap { max-width: 100%; overflow: visible; background: transparent; border: 0; }
  .table, .table tbody, .table tfoot { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin: 0 0 10px; }
  /* the column's name sits on the left; the cell's own content flows on the right, chips and buttons at their own size */
  .table td, .table tfoot td { display: block; position: relative; padding: 4px 0 4px 38%; min-height: 1.7em; border: 0; text-align: left; white-space: normal; background: transparent; overflow-wrap: anywhere; }
  .table td::before { content: attr(data-label); position: absolute; left: 0; top: 5px; width: 35%; color: var(--ink-2); font-size: .86em; line-height: 1.3; }
  .table td[data-long] { min-height: 3.1em; }
  .table td:not([data-label]), .table td[data-label=""] { padding-left: 0; }
  .table td:not([data-label])::before, .table td[data-label=""]::before { content: none; }
  .table td[data-empty] { display: none; }
  .table td.num, .table td.actions { text-align: left; white-space: normal; }
  .table td .btn, .table td select, .table td input[type=text], .table td .inline { max-width: 100%; }
  .table td .btn { margin: 2px 6px 2px 0; }
  .table tr.link:hover td { background: transparent; }
  .table tr.group { background: transparent; border: 0; padding: 6px 2px 0; margin: 4px 0 6px; }
  .table tr.group td { font-weight: 600; color: var(--ink-2); }
  .table tr:has(> td.empty:only-child) { text-align: center; }
  .band { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 14px; gap: 10px 14px; }
  .two, .detail, .settings { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: 112px minmax(0, 1fr); }
  .card .head { flex-wrap: wrap; gap: 8px; }
  .bulkbar { gap: 6px; }

  .modal-backdrop { padding: 8px; align-items: flex-end; }
  .modal { padding: 16px; max-height: 94vh; }
  .modal .foot { flex-wrap: wrap; }

  .signin { padding: 12px; }
  .signin .box { grid-template-columns: minmax(0, 1fr); }
  .signin .card { padding: 18px 16px; }

  .field-stage { grid-template-columns: minmax(0, 1fr); }
  .field-stage .side { display: none; }
  .phone { width: 100%; height: auto; min-height: 100vh; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
}
