@font-face { font-family: "Inter"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("/fonts/inter-tight.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
/* Layout: left rail nav + work area (desktop); top bar + bottom tabs (phone). Theme follows FlexPC apps. */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f8f8fa;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #9a9aa0;
  --line: rgba(0,0,0,.09);
  --line-strong: rgba(0,0,0,.18);
  --accent: #e11d2a;
  --accent-dark: #c01622;
  --accent-soft: #fdecee;
  --accent-ink: #ffffff;
  --ok: #0a7d4f;
  --ok-soft: #e4f5ee;
  --warn: #8a4b08;
  --warn-soft: #fdf3dc;
  --info: #1f5fbf;
  --info-soft: #e8f0fc;
  --shadow: 0 6px 20px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.18);
  --overlay: rgba(20,20,24,.42);
  --radius: 16px;
  --display: "Inter Tight", Inter, system-ui, sans-serif;
  --text: Inter, -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, monospace;
  --ease: cubic-bezier(.2,.75,.25,1);
  /* signatures and receipts stay on light paper in both themes so ink is readable */
  --paper: #ffffff;
  --paper-ink: #1d1d1f;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #101012; --surface: #1b1b1e; --surface-2: #232327; --ink: #f2f2f4; --ink-2: #a1a1a8; --ink-3: #74747b;
  --line: rgba(255,255,255,.09); --line-strong: rgba(255,255,255,.2);
  --accent: #ff4450; --accent-dark: #ff6b74; --accent-soft: #3a1518; --accent-ink: #ffffff;
  --ok: #3ccf8e; --ok-soft: #10301f; --warn: #f0b45a; --warn-soft: #36270d; --info: #7fb0ff; --info-soft: #14243d;
  --shadow: 0 6px 20px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.3); --shadow-lg: 0 24px 60px rgba(0,0,0,.55); --overlay: rgba(0,0,0,.6);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #101012; --surface: #1b1b1e; --surface-2: #232327; --ink: #f2f2f4; --ink-2: #a1a1a8; --ink-3: #74747b;
  --line: rgba(255,255,255,.09); --line-strong: rgba(255,255,255,.2);
  --accent: #ff4450; --accent-dark: #ff6b74; --accent-soft: #3a1518; --accent-ink: #ffffff;
  --ok: #3ccf8e; --ok-soft: #10301f; --warn: #f0b45a; --warn-soft: #36270d; --info: #7fb0ff; --info-soft: #14243d;
  --shadow: 0 6px 20px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.3); --shadow-lg: 0 24px 60px rgba(0,0,0,.55); --overlay: rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
html { color-scheme: light; }
body { margin: 0; }
html, body { height: 100%; }
html.smooth { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--text); letter-spacing: -.005em; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.015em; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------- motion (only when enabled in Settings) ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes popOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes flash { 0% { box-shadow: 0 0 0 0 var(--accent-soft); } 30% { box-shadow: 0 0 0 6px var(--accent-soft); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes spin { to { transform: rotate(360deg); } }
html.motion #view.enter > * { animation: rise .38s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
html.motion #view { transition: opacity .16s ease, transform .16s ease; }
html.motion #view.leaving { opacity: 0; transform: translateY(6px); }
html.motion .modal { animation: fadeIn .18s ease both; }
html.motion .modal .dialog { animation: popIn .26s var(--ease) both; }
html.motion .modal.out { animation: fadeOut .16s ease forwards; }
html.motion .modal.out .dialog { animation: popOut .16s ease forwards; }
html.motion .toast { animation: toastIn .26s var(--ease) both; }
html.motion .toast.out { animation: toastOut .2s ease forwards; }
html.motion .flash { animation: flash .9s ease; }
html.motion .new { animation: rise .35s var(--ease) both; }
html.motion .btn, html.motion .pipe, html.motion .nav a, html.motion .st .c, html.motion .ticks i, html.motion .seg button { transition: background-color .15s, color .15s, border-color .15s, box-shadow .2s, transform .15s; }
html.motion .btn:active { transform: scale(.97); }
html.motion .bar i { transition: width .5s var(--ease); }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 32px 28px; display: flex; flex-direction: column; gap: 18px; text-align: center; }
.login-card .wordmark { justify-content: center; font-size: 28px; padding: 0; }
.login-card h1 { font-size: 22px; }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 12px; padding: 11px 16px; font-weight: 600; width: 100%; }
.gbtn:hover { background: var(--surface-2); }
.gbtn .g { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--info); }
.accounts { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.acct { all: unset; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); }
.acct:hover, .acct:focus-visible { background: var(--surface-2); border-color: var(--line-strong); }
.acct b { display: block; font-size: 14px; }
.acct span { font-size: 12.5px; color: var(--ink-2); }

/* ---------- app frame ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0,1fr); min-height: 100%; }
.rail { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: var(--surface); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; }
.wordmark { font-family: var(--display); font-weight: 800; font-size: 21px; letter-spacing: .01em; padding: 0 10px; display: flex; align-items: baseline; gap: 8px; }
.wordmark b { color: var(--accent); }
.wordmark span { font-family: var(--text); font-weight: 600; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border-radius: 99px; padding: 1px 8px; }
.nav a.on .count { background: var(--surface); color: var(--accent); }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.mockflag { font-size: 12px; color: var(--ink-3); padding: 0 10px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-right: 6px; vertical-align: 1px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); min-width: 0; }
.me .who { min-width: 0; flex: 1; }
.me .who b { display: block; font-size: 13.5px; }
.me .who span { display: block; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--accent-soft); color: var(--accent); flex: none; }
.av.sm { width: 26px; height: 26px; font-size: 10.5px; }
.iconbtn { border: 1px solid transparent; background: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); flex: none; }
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn svg { width: 18px; height: 18px; }

.main { min-width: 0; padding-block: 28px 60px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pagehead h1 { font-size: 28px; font-weight: 800; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.sample-tag { font-size: 12px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.mtop, .mtabs { display: none; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--surface); padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; border-radius: 99px; padding: 2px 9px; white-space: nowrap; }
.pill.cash { background: var(--info-soft); color: var(--info); }
.pill.instalment { background: var(--accent-soft); color: var(--accent); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.idle { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.by { font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 5px; }
.by b { color: var(--ink); font-weight: 600; }
.by .av { width: 18px; height: 18px; font-size: 8.5px; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-h h3 { font-size: 15px; font-weight: 700; }
.panel-b { padding: 16px 18px; }
.sub { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- pipeline ---------- */
.pipeline { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); overflow: hidden; }
.pipe { all: unset; cursor: pointer; padding: 14px 16px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pipe:last-child { border-right: 0; }
.pipe:hover { background: var(--surface-2); }
.pipe.on { background: var(--accent-soft); }
.pipe .n { font-family: var(--display); font-size: 26px; font-weight: 800; line-height: 1.1; }
.pipe .l { font-size: 12.5px; color: var(--ink-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe.on .l, .pipe.on .n { color: var(--accent); }
.pipe:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 7px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.seg button svg { width: 15px; height: 15px; }
.seg button.on { background: var(--ink); color: var(--surface); }
.seg button[disabled] { opacity: .5; cursor: not-allowed; }
.search { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.search input { border: 0; background: none; padding: 8px 0; width: 100%; outline: none; }
.search svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }

/* ---------- orders table ---------- */
.orders { overflow: hidden; }
.orow { display: grid; grid-template-columns: 120px minmax(0,1.4fr) 100px minmax(0,1.6fr) 110px 120px; gap: 16px; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.orow:last-child { border-bottom: 0; }
a.orow:hover { background: var(--surface-2); }
.orow.head { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; padding-block: 10px; background: var(--surface-2); }
.orow .qt { font-weight: 700; font-variant-numeric: tabular-nums; }
.orow .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orow .amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.orow .upd { text-align: right; font-size: 13px; color: var(--ink-2); }
.track { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ticks { display: flex; gap: 4px; }
.ticks i { flex: 1; height: 6px; border-radius: 3px; background: var(--line-strong); opacity: .5; }
.ticks i.d { background: var(--ok); opacity: 1; }
.ticks i.c { background: var(--accent); opacity: 1; }
.track .lbl { font-size: 13px; font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.track .lbl.done { color: var(--ok); }
.track .lbl .m { font-weight: 500; color: var(--ink-2); }
.empty { padding: 40px 18px; text-align: center; color: var(--ink-2); }

/* ---------- detail ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14px; align-self: flex-start; }
.back:hover { color: var(--ink); }
.dhead { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.dhead h1 { font-size: 30px; font-weight: 800; }
.dhead .meta { display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center; margin-top: 8px; color: var(--ink-2); font-size: 14px; }
.dhead .total { text-align: right; }
.dhead .total .v { font-family: var(--display); font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }

.stepper { display: flex; overflow-x: auto; padding: 4px 4px 2px; scrollbar-width: thin; }
.st { all: unset; cursor: pointer; flex: 1 0 116px; display: flex; flex-direction: column; gap: 8px; padding: 0 6px 10px; }
.st .b { display: flex; align-items: center; }
.st .c { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; border: 2px solid var(--line-strong); background: var(--surface); color: var(--ink-2); flex: none; }
.st .c svg { width: 14px; height: 14px; }
.st .ln { flex: 1; height: 2px; background: var(--line-strong); margin-left: 6px; }
.st:last-child .ln { visibility: hidden; }
.st.d .c { background: var(--ok); border-color: var(--ok); color: #fff; }
.st.d .ln { background: var(--ok); }
.st.cur .c { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.st .t { font-size: 13px; font-weight: 600; }
.st .s { font-size: 12px; color: var(--ink-2); margin-top: -6px; }
.st.cur .t { color: var(--accent); }
.st:focus-visible .c { outline: 2px solid var(--accent); outline-offset: 2px; }

.dgrid { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 20px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.step { scroll-margin-top: 20px; }
.step.cur { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.step .ttl { display: flex; align-items: center; gap: 10px; min-width: 0; }
.step .ttl .k { width: 24px; height: 24px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-2); flex: none; }
.step.done .ttl .k { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.step .ttl small { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 400; }
.step .stat { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.step .panel-b { display: flex; flex-direction: column; gap: 14px; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.note { font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; align-items: flex-start; }
.note svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.note.warn { color: var(--warn); }

.files { display: flex; flex-direction: column; gap: 6px; }
.file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); min-width: 0; }
.file.slot { border-style: dashed; background: none; }
.file .ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; font-size: 9.5px; font-weight: 800; letter-spacing: .02em; }
.ic.pdf { background: var(--accent-soft); color: var(--accent); }
.ic.img, .ic.doc { background: var(--info-soft); color: var(--info); }
.ic.cn, .ic.n8n { background: var(--warn-soft); color: var(--warn); }
.file .fx { min-width: 0; flex: 1; }
.file .fn { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .fl { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dest { font-size: 11px; font-weight: 600; color: var(--ink-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; white-space: nowrap; background: var(--surface); }

.kv { display: grid; grid-template-columns: 112px minmax(0,1fr); gap: 7px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.kv dd.miss { color: var(--warn); }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.ph { aspect-ratio: 1; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); position: relative; overflow: hidden; display: grid; place-items: center; color: var(--ink-3); }
.ph > svg { width: 38%; height: 38%; opacity: .7; }
.ph .cap { position: absolute; left: 5px; bottom: 5px; right: 5px; font-size: 10.5px; color: var(--ink-2); background: var(--surface); border-radius: 5px; padding: 2px 5px; line-height: 1.3; }
.ph .cap b { display: block; font-family: var(--mono); font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph.add { border-style: dashed; border-color: var(--line-strong); cursor: pointer; background: none; font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; }
.ph.add svg { width: 22px; height: 22px; }
.ph.add:hover { color: var(--accent); border-color: var(--accent); }

.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl td, .tbl th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.tbl td.r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }
.bar { height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); }

.plan { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.plan div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.plan b { display: block; font-family: var(--display); font-size: 18px; font-variant-numeric: tabular-nums; }
.plan span { font-size: 12px; color: var(--ink-2); }

.items { width: 100%; border-collapse: collapse; font-size: 13px; }
.items td { padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.items td.r { text-align: right; white-space: nowrap; padding-left: 10px; font-variant-numeric: tabular-nums; }
.items tbody tr:last-child td { border-bottom: 0; }
.items tfoot td { font-weight: 700; padding-top: 10px; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.cat { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; color: var(--ink-2); margin-right: 4px; }

.methods { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.mth { all: unset; cursor: pointer; border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mth b { font-size: 14px; display: flex; align-items: center; gap: 7px; }
.mth b svg { width: 17px; height: 17px; }
.mth span { font-size: 12px; color: var(--ink-2); }
.mth:hover { background: var(--surface-2); }
.mth.on { border-color: var(--accent); background: var(--accent-soft); }
.mth.on b { color: var(--accent); }
.mth[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.mth:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.history { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--ink-2); border-left: 2px solid var(--line-strong); padding-left: 10px; }
.history b { color: var(--ink); font-weight: 600; }

.feed { display: flex; flex-direction: column; max-height: 460px; overflow-y: auto; }
.ev { display: grid; grid-template-columns: 26px minmax(0,1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ev:last-child { border-bottom: 0; }
.ev .w { font-size: 13px; }
.ev .w b { font-weight: 600; }
.ev .tm { font-size: 11.5px; color: var(--ink-3); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.ev .tag { font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; color: var(--ink-2); }
.composer { display: flex; gap: 8px; margin-top: 10px; }
.composer input { flex: 1; min-width: 0; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 8px 12px; }

/* ---------- new QT ---------- */
.drop { border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); padding: 44px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .big { width: 56px; height: 56px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.drop .big svg { width: 28px; height: 28px; }
.drop h2 { font-size: 20px; font-weight: 700; }
.flow { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.flow div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--ink-2); }
.flow b { display: block; color: var(--ink); font-size: 13.5px; margin-bottom: 2px; }
.extract { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.xline { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-3); }
.xline.on { color: var(--ink); }
.xline.ok { color: var(--ok); }
.xline .mk { width: 16px; height: 16px; flex: none; display: grid; place-items: center; }
.xline .mk svg { width: 14px; height: 14px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }

.form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 14px; }
.form.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form .full { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > label, .fld > .lab { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.fld input, .fld select, .fld textarea { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 9px; padding: 8px 10px; width: 100%; min-width: 0; }
.fld input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.fld textarea { resize: vertical; min-height: 64px; }
.fld.miss input, .fld.miss textarea, .fld.miss select { border-color: var(--warn); background: var(--warn-soft); }
.fld .hint { font-size: 11.5px; color: var(--ink-2); }
.fld.miss .hint, .hint.warn { color: var(--warn); font-weight: 600; }
.hint.ok { color: var(--ok); font-weight: 600; }
.radio { display: flex; gap: 8px; flex-wrap: wrap; }
.radio label { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 12px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink); }
.radio label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.radio input { accent-color: var(--accent); margin: 0; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.picks label { cursor: pointer; }
.picks input { position: absolute; opacity: 0; }
.picks .ph { border-width: 2px; }
.picks input:checked + .ph { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.picks input:focus-visible + .ph { outline: 2px solid var(--accent); outline-offset: 2px; }
.formerr { font-size: 13px; color: var(--accent); font-weight: 600; }
.edit-items { overflow-x: auto; }
.edit-items table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.edit-items th { text-align: left; font-size: 12px; color: var(--ink-2); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); }
.edit-items td { padding: 5px 6px; border-bottom: 1px solid var(--line); }
.edit-items input { width: 100%; border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 4px 6px; }
.edit-items input:hover, .edit-items input:focus { border-color: var(--line-strong); background: var(--surface); }
.edit-items .r, .edit-items .r input { text-align: right; font-variant-numeric: tabular-nums; }
.checks { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.checks label { display: flex; gap: 9px; align-items: flex-start; }
.checks input { accent-color: var(--accent); margin-top: 3px; }
.checks small { display: block; color: var(--ink-2); font-size: 12.5px; }

/* ---------- images: photos, signature, proof, viewer, paste ---------- */
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
button.ph.img { padding: 0; cursor: zoom-in; background: var(--surface-2); }
button.ph.img:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ph.add small { font-size: 11px; font-weight: 500; color: var(--ink-3); }
.file.sig { align-items: center; }
.sig .pad { flex: none; width: 168px; max-width: 42%; aspect-ratio: 3 / 1; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; overflow: hidden; padding: 4px; cursor: zoom-in; }
.sig .pad:not([data-view]) { cursor: default; }
.sig .pad img, .sig .pad svg { width: 100%; height: 100%; object-fit: contain; display: block; }
[data-paste].slot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.thumbbtn { border: 0; background: none; padding: 0; cursor: zoom-in; border-radius: 6px; }
.thumb { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); display: block; }
.pasted { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--ink-2); min-width: 0; }
.pasted img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: none; background: var(--paper); }
.pasted span { overflow-wrap: anywhere; }
.lb .dialog { width: min(860px, 100%); margin: 0; }
.lb .panel-b { align-items: center; }
.lb img { display: block; max-width: 100%; max-height: calc(100vh - 160px); border-radius: 10px; background: var(--paper); }

/* ---------- AEON invoice preview (paper) ---------- */
.inv { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 18px 20px; font-size: 12.5px; line-height: 1.45; display: flex; flex-direction: column; gap: 12px; max-width: 560px; box-shadow: var(--shadow); }
.inv .top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.inv .ttl { text-align: right; margin-left: auto; }
.inv .ttl div:first-child { font-size: 20px; letter-spacing: .02em; }
.inv b.u { text-transform: uppercase; }
.inv .tw { overflow-x: auto; }
.inv table { width: 100%; border-collapse: collapse; border: 1px solid var(--ink); min-width: 360px; }
.inv th { background: var(--ink); color: var(--surface); text-align: left; padding: 6px 8px; font-weight: 600; }
.inv td { padding: 6px 8px; vertical-align: top; }
.inv td + td, .inv th + th { border-left: 1px solid var(--ink); }
.inv td.r, .inv th.r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv tfoot td { border-top: 1px solid var(--ink); }
.inv ol { margin: 0; padding-left: 18px; color: var(--ink-2); }

/* ---------- settings ---------- */
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.setrow:last-child { border-bottom: 0; padding-bottom: 0; }
.setrow:first-child { padding-top: 0; }
.setrow b { display: block; font-size: 14.5px; }
.setrow span { font-size: 13px; color: var(--ink-2); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background-color .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.integ { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.integ .panel-b { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.tree { font-family: var(--mono); font-size: 12.5px; line-height: 1.7; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; overflow-x: auto; white-space: pre; }
.schema { overflow-x: auto; }
.schema table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
.schema th, .schema td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.schema th { font-size: 12px; color: var(--ink-2); font-weight: 600; background: var(--surface-2); }
.schema td:first-child { font-weight: 700; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips code { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.chips code.hl { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- modal + toast ---------- */
.modal { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 50; padding: 16px; }
.dialog { background: var(--surface); border-radius: 18px; width: min(600px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.dialog .panel-h { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dialog .panel-h h3 { font-size: 17px; }
.dialog .panel-b { display: flex; flex-direction: column; gap: 14px; }
.dialog .panel-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface); }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; z-index: 60; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .dgrid { grid-template-columns: minmax(0,1fr); }
  .pipeline { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .pipe:nth-child(4) { border-right: 0; }
  .pipe:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .orow { grid-template-columns: 110px minmax(0,1fr) 90px minmax(0,1.3fr) 100px; }
  .orow .upd, .orow.head > :last-child { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0,1fr); }
  .rail { display: none; }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
  .mtop { display: flex; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9; background: var(--surface); border-bottom: 1px solid var(--line); padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); align-items: center; justify-content: space-between; gap: 8px; }
  .mtop .r { display: flex; align-items: center; gap: 4px; }
  .mtabs { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .mtabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; font-size: 11px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
  .mtabs a.on { color: var(--accent); }
  .mtabs svg { width: 22px; height: 22px; }
  .main { padding-block: 18px 96px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .pagehead h1, .dhead h1 { font-size: 24px; }
  .dhead .total { text-align: left; }
  .dhead .total .v { font-size: 24px; }
  .pipeline { grid-template-columns: repeat(7, 112px); overflow-x: auto; }
  .pipe { border-bottom: 0 !important; border-right: 1px solid var(--line) !important; }
  .orow.head { display: none; }
  .orow { grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "nm amt" "qt ty" "tr tr"; gap: 6px 12px; padding: 14px 16px; }
  .orow > :nth-child(1) { grid-area: qt; }
  .orow > :nth-child(2) { grid-area: nm; }
  .orow > :nth-child(3) { grid-area: ty; justify-self: end; }
  .orow > :nth-child(4) { grid-area: tr; margin-top: 4px; }
  .orow > :nth-child(5) { grid-area: amt; }
  .form, .form.three, .integ, .flow, .plan { grid-template-columns: minmax(0,1fr); }
  .methods { grid-template-columns: minmax(0,1fr); }
  .kv { grid-template-columns: 96px minmax(0,1fr); }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- live app additions ---------- */
.toast.err { background: var(--accent); color: var(--accent-ink); }
.btn .spin, .pill .spin { width: 14px; height: 14px; }
.empty .spin { display: inline-block; vertical-align: -3px; margin-right: 6px; }
a.btn.ghost.sm { text-decoration: none; }
