:root {
  --bg: #f4f2ee; --surface: #ffffff; --sunk: #ebe8e2; --ink: #414143; --muted: #6b6a66; --line: #d9d6cf;
  --accent: #726c5c; --accent-ink: #ffffff; --accent-soft: #e9e6de;
  --warn: #a35617; --warn-soft: #f6e7d5; --info-soft: #e4e1da;
  --ok: #3f6b4e; --red: #b23b2e; --red-soft: #f7e0dc;
  --logo-filter: none;
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1b1c; --surface: #242426; --sunk: #1f1f21; --ink: #ecebe6; --muted: #a8a59d; --line: #38383b;
    --accent: #b5ad97; --accent-ink: #1b1b1c; --accent-soft: #312f2a;
    --warn: #e2a362; --warn-soft: #3a2918; --info-soft: #2c2b28;
    --ok: #8cc39d; --red: #e8806f; --red-soft: #3d221e;
    --logo-filter: brightness(0) invert(0.92);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.55; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; margin: 0; }
h2 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.muted { color: var(--muted); }
.stack { display: grid; gap: 6px; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; }
.brand img { height: 36px; width: auto; filter: var(--logo-filter); }
.login-card .brand img { height: 48px; }
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding-block: 14px; }
.who { display: flex; align-items: center; gap: 12px; font-size: 0.88rem; flex-wrap: wrap; }
.link-btn { background: none; border: none; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.staffbar { background: var(--info-soft); font-size: 0.85rem; }
.staffbar .wrap { padding-block: 8px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.jobhead { padding-block: 28px 20px; display: grid; gap: 6px; }
.jobhead h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 800; letter-spacing: -0.015em; }
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.stat .big { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; }
.stat .small { font-size: 0.84rem; color: var(--muted); }
.bar { height: 8px; border-radius: 999px; background: var(--sunk); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.stat.alert { border-color: var(--warn); background: var(--warn-soft); }
.stat.alert .big { color: var(--warn); }
.stat.clear .big { color: var(--accent); }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; padding-bottom: 48px; align-items: start; }
.side { display: grid; gap: 16px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-body { padding: 16px 18px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--warn); color: var(--surface); font-size: 0.72rem; line-height: 18px; text-align: center; }
.entry { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 16px; padding: 18px; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: none; }
.entry .date { font-size: 0.82rem; color: var(--muted); }
.entry .date b { display: block; font-family: var(--font-display); font-size: 1.05rem; color: var(--ink); }
.entry h3 { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.phase { padding: 6px 18px 14px; }
.phase + .phase { border-top: 1px solid var(--line); }
.phase h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 12px 0 6px; font-family: var(--font-body); font-weight: 600; }
.task { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 0; }
.task .when { font-size: 0.84rem; color: var(--muted); white-space: nowrap; text-align: right; }
.task .note { font-size: 0.84rem; color: var(--muted); }
.dot { width: 18px; height: 18px; border-radius: 50%; margin-top: 3px; display: grid; place-items: center; }
.dot.done { background: var(--accent); }
.dot.done svg { width: 11px; height: 11px; }
.dot.now { border: 2px solid var(--accent); background: conic-gradient(var(--accent) var(--p, 30%), transparent 0); }
.dot.next { border: 2px solid var(--line); }
.dot.wait { border: 2px dashed var(--warn); }
.shutdown { margin: 6px 0; padding: 8px 12px; border-radius: 6px; background: var(--sunk); font-size: 0.84rem; color: var(--muted); }
.var { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.var:last-child { border-bottom: none; }
.var .ref { font-family: var(--font-display); font-weight: 700; color: var(--muted); }
.var .price { font-family: var(--font-display); font-weight: 700; text-align: right; white-space: nowrap; }
.var .actions { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.todo { background: var(--warn-soft); color: var(--warn); }
.pill.pend { background: var(--sunk); color: var(--muted); }
.var-total { display: flex; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--sunk); border-top: 1px solid var(--line); font-size: 0.9rem; border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.btn { border: none; border-radius: 8px; padding: 10px 16px; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.doc { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.doc:last-child { border-bottom: none; }
.doc .icon { width: 36px; height: 44px; border-radius: 4px; background: var(--sunk); border: 1px solid var(--line); display: grid; place-items: end center; font-size: 0.6rem; font-weight: 700; color: var(--muted); padding-bottom: 4px; }
.action-card { border-color: var(--warn); }
.action-card .panel-body { display: grid; gap: 10px; }
.next-list { display: grid; gap: 12px; }
textarea { width: 100%; min-height: 80px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--bg); }
input[type="email"], input[type="text"], select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; background: var(--bg); }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10, 12, 12, 0.55); z-index: 30; display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sheet { background: var(--surface); border-radius: 14px; width: 100%; max-width: 620px; max-height: 100%; overflow-y: auto; border: 1px solid var(--line); }
.sheet header { padding: 20px 22px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 4px; }
.sheet .body { padding: 18px 22px; display: grid; gap: 16px; }
.sheet .scope { background: var(--sunk); border-radius: 8px; padding: 14px 16px; }
.sheet dl, .receipt dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 0.9rem; }
.sheet dt, .receipt dt { color: var(--muted); }
.sheet dd, .receipt dd { margin: 0; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-top: 1px solid var(--line); padding-top: 12px; flex-wrap: wrap; }
.total-line .big { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; }
.check { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 0.9rem; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.sheet footer { padding: 14px 22px 20px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; border-top: 1px solid var(--line); }
.receipt { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 14px 16px; display: grid; gap: 8px; }
.fp { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.8rem; word-break: break-all; }
.login { min-height: 70vh; display: grid; place-items: center; padding-block: 48px; }
.login-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 18px; }
.login-card h1 { font-size: 1.5rem; font-weight: 800; }
.field { display: grid; gap: 6px; }
.field label { font-size: 0.85rem; font-weight: 600; }
.code-input { letter-spacing: 0.5em; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.2rem; text-align: center; }
.demo { background: var(--info-soft); border-radius: 8px; padding: 10px 12px; font-size: 0.88rem; }
.demo .code-show { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: 0.2em; font-size: 1.05rem; }
.err { color: var(--warn); font-size: 0.85rem; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 0.88rem; z-index: 40; max-width: calc(100% - 32px); }
.foot { border-top: 1px solid var(--line); background: var(--surface); font-size: 0.8rem; color: var(--muted); }
.foot .wrap { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding-block: 20px 28px; }
.foot b { color: var(--ink); }
.foot .r { text-align: right; }
.loading { padding: 80px 16px; text-align: center; color: var(--muted); }
.stat.money .big { color: var(--ink); }
.under { color: var(--ok); } .over { color: var(--red); font-weight: 600; }
.bsum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.bsum > div { padding: 16px 18px; display: grid; gap: 4px; border-right: 1px solid var(--line); min-width: 0; }
.bsum > div:last-child { border-right: none; }
.bsum .big { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; }
.bscroll { overflow-x: auto; }
.btable { min-width: 600px; }
.brow { display: grid; grid-template-columns: minmax(170px, 1.7fr) repeat(4, minmax(78px, 1fr)) 24px; gap: 8px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line); text-align: right; }
.brow > :first-child { text-align: left; }
.bhead { font-size: 0.72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
button.brow { width: 100%; background: none; border: none; border-bottom: 1px solid var(--line); cursor: pointer; font: inherit; color: inherit; }
button.brow:hover { background: var(--sunk); }
.brow .cat { display: grid; gap: 5px; }
.brow .bar { height: 5px; }
.chev { color: var(--muted); transition: transform 0.15s; display: inline-block; }
button.brow[aria-expanded="true"] .chev { transform: rotate(90deg); }
.bdetail { background: var(--sunk); padding: 12px 18px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.items { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 4px 12px; font-size: 0.86rem; }
.items span:last-child { text-align: right; }
.bfoot { background: var(--sunk); }
.bfoot.total { font-weight: 700; border-radius: 0 0 var(--radius) var(--radius); border-bottom: none; }
.cu { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); align-items: start; }
.cu:last-child { border-bottom: none; }
.signs { display: grid; gap: 6px; margin-top: 10px; }
.signrow { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; font-size: 0.85rem; align-items: start; }
.signrow .dot { margin-top: 2px; width: 16px; height: 16px; }
.pill.red { background: var(--red-soft); color: var(--red); }
@media (max-width: 700px) { .bsum { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bsum > div:nth-child(2) { border-right: none; } .bsum > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
@media (max-width: 900px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; order: -1; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) { .foot .wrap { grid-template-columns: minmax(0, 1fr); } .foot .r { text-align: left; } }
@media (max-width: 520px) {
  .summary { grid-template-columns: minmax(0, 1fr); }
  .entry { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .entry .date b { display: inline; margin-right: 6px; }
  .task { grid-template-columns: 22px minmax(0, 1fr); }
  .task .when { grid-column: 2; text-align: left; }
  .var { grid-template-columns: 36px minmax(0, 1fr); }
  .var .price { grid-column: 2; text-align: left; }
}
.bsum.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.btable.client { min-width: 0; }
.btable.client .brow { grid-template-columns: minmax(130px, 2fr) repeat(3, minmax(78px, 1fr)) minmax(60px, 0.6fr) 24px; }
.barline { display: flex; align-items: center; gap: 8px; } .barline .bar { flex: 1; } .pctinline { display: none; font-size: 0.72rem; color: var(--muted); }
@media (max-width: 560px) { .btable.client .pctcol { display: none; } .btable.client .pctinline { display: inline; } .btable.client .brow { grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(58px, 1fr)) 12px; gap: 6px; padding: 10px 12px; font-size: 0.84rem; } .btable.client .bhead { font-size: 0.64rem; letter-spacing: 0.03em; } .btable.client .brow .pill { font-size: 0.66rem; padding: 1px 6px; } }
.cunote { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
@media (max-width: 700px) { .bsum.three { grid-template-columns: minmax(0, 1fr); } .bsum.three > div { border-right: none; border-bottom: 1px solid var(--line); } .bsum.three > div:last-child { border-bottom: none; } }
.fpc { display: block; font-size: 0.7rem; color: var(--muted); font-weight: 400; margin-top: 1px; }
@media (max-width: 560px) { .fpc { font-size: 0.66rem; } .fpcl { display: none; } }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 12px; }
.ph { padding: 0; border: none; background: var(--sunk); border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3; cursor: zoom-in; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox figure { margin: 0; max-width: 100%; max-height: 100%; display: grid; gap: 10px; justify-items: center; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 140px); border-radius: 8px; object-fit: contain; }
.lightbox figcaption { color: #fff; font-size: 0.9rem; text-align: center; }
.btn.small { padding: 6px 12px; font-size: 0.85rem; text-decoration: none; display: inline-block; }
.doclinks { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
a { color: var(--accent); }
