
:root {
  --brand: #2440f0; --brand-hi: #1b33d6; --brand-soft: #eef1ff; --brand-ink: #1a2fc4;
  --ink: #0c1024; --muted: #4a5170; --faint: #6b7192; --line: #d5daf2; --line-soft: #e5e8f6;
  --bg: #f5f6fc; --surface: #ffffff; --surface-2: #fafbff; --sunk: #eef1ff; --hover: #f1f3fd;
  --cta: #ffc93c; --cta-hi: #ffd666; --cta-fg: #0c1024;
  --err: #a2412f; --err-soft: #fbece8; --ok: #12704a; --ok-soft: #e5f5ec; --warn: #8a5a00; --warn-soft: #fff4d6; --info-soft: #eef1ff;
  --radius: 12px; --radius-lg: 14px; --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(12, 16, 36, .06);
  --shadow: 0 1px 2px rgba(12, 16, 36, .05), 0 6px 18px rgba(12, 16, 36, .06);
  --shadow-lg: 0 18px 50px rgba(12, 16, 36, .22);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --side-w: 252px; --top-h: 62px;
  /* chart series (validated categorical order; slot 1 = brand-adjacent blue) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948; --s-other: #9aa0b8;
  --rev: #2440f0; --exp: #eb6834;
  }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 15px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; line-height: 1.2; }
p { margin: 0 0 .6em; }
button { font: inherit; color: inherit; }
kbd { font: 600 11px/1 var(--mono); padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); box-shadow: 0 1px 0 var(--line); }
:focus-visible { outline: 3px solid var(--cta); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 999; background: var(--cta); color: var(--cta-fg); padding: 10px 14px; border-radius: 8px; font-weight: 700; }
.skip-link:focus { left: 8px; top: 8px; }
.grow { flex: 1 1 auto; }
.muted { color: var(--muted); }
.muted-p { color: var(--muted); margin: 0; }
.pad { padding: 4px 18px 18px; }
.bad { color: var(--err); }
.good { color: var(--ok); }
.ic { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: middle; }
.ic-sm { width: 14px; height: 14px; }
[hidden] { display: none !important; }

/* ---------- Boot ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 14px; color: var(--muted); }
.boot-mark img { border-radius: 18px; margin: 0 auto; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.94); opacity: .8; } }
.boot-err { max-width: 520px; padding: 24px; text-align: left; color: var(--ink); }
.boot-err h1 { margin-bottom: 10px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); z-index: 40; }
.side-brand { padding: 16px 14px 10px; border-bottom: 1px solid var(--line-soft); }
.biz { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; font-size: 16px; line-height: 1.15; padding: 6px; border-radius: 10px; min-width: 0; }
.biz:hover { text-decoration: none; background: var(--hover); }
.biz-logo { width: auto; max-width: 92px; min-width: 40px; height: 40px; padding: 3px; object-fit: contain; border-radius: 9px; background: #fff; border: 1px solid var(--line-soft); flex: 0 0 auto; }
.biz-mono { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--c); font-weight: 800; font-size: 19px; flex: 0 0 auto; }
.biz-name { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.side-nav { flex: 1; overflow-y: auto; padding: 8px 10px 16px; }
.nav-group { margin-top: 10px; }
.nav-label { display: block; font: 600 11px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 8px 10px 6px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--muted); font-weight: 550; font-size: 14.5px; }
.side-nav a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.side-nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
.side-nav a.active .ic { color: var(--brand); }
.nav-count { margin-left: auto; font-size: 11.5px; font-weight: 700; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 99px; background: var(--sunk); color: var(--muted); }
.nav-count:empty { display: none; }
.nav-count.bad { background: var(--err-soft); color: var(--err); }
.side-foot { padding: 12px 18px 16px; border-top: 1px solid var(--line-soft); display: grid; gap: 2px; }
.pithe-link { font-weight: 700; font-size: 12.5px; color: var(--brand); letter-spacing: .01em; }
.side-foot-small { font-size: 11.5px; color: var(--faint); }
.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; height: var(--top-h); padding: 0 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line-soft); }
.page-title { font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-trigger { display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px 0 12px; min-width: 260px; border: 1px solid var(--line); background: var(--surface); color: var(--faint); border-radius: 10px; cursor: pointer; font-size: 14px; }
.search-trigger kbd { margin-left: auto; }
.search-trigger:hover { border-color: var(--brand); color: var(--muted); }
.view { flex: 1; padding: 24px; max-width: 1400px; width: 100%; margin: 0 auto; outline: none; }
.view.view-wide { max-width: none; }
.app-foot { display: flex; flex-wrap: wrap; gap: 6px 8px; justify-content: center; padding: 18px 24px 26px; font-size: 12.5px; color: var(--faint); }
.app-foot a { color: var(--muted); }
.only-mobile { display: none !important; }
@media (min-width: 900px) { .app { background: linear-gradient(to right, var(--surface) calc(var(--side-w) - 1px), var(--line) calc(var(--side-w) - 1px), var(--line) var(--side-w), transparent var(--side-w)); } }
.drawer-backdrop { position: fixed; inset: 0; background: rgba(8, 10, 25, .45); z-index: 39; }
.bottom-nav, .fab { display: none; }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s, transform .12s, box-shadow .12s; }
.btn:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn-primary { background: #2440f0; border-color: #2440f0; color: #fff; }
.btn-primary:hover { background: #1b33d6; border-color: #1b33d6; color: #fff; }
.btn-cta { background: var(--cta); border-color: var(--cta); color: var(--cta-fg); box-shadow: 0 1px 0 rgba(12, 16, 36, .25); }
.btn-cta:hover { background: var(--cta-hi); border-color: var(--cta-hi); color: var(--cta-fg); }
.btn-danger { background: #a2412f; border-color: #a2412f; color: #fff; }
.btn-danger:hover { background: #8c3727; border-color: #8c3727; }
.btn-danger-soft { color: var(--err); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost.danger { color: var(--err); }
.btn-install { border-color: var(--brand); color: var(--brand); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; flex: 0 0 auto; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font-weight: 600; text-align: left; }
.linkish:hover { text-decoration: underline; }
.input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; transition: border-color .12s, box-shadow .12s; }
.input:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.input::placeholder { color: var(--faint); opacity: .85; }
textarea.input { resize: vertical; min-height: 70px; line-height: 1.45; }
select.input { padding-right: 32px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a809c' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.input-sm { min-height: 34px; padding: 5px 10px; font-size: 13.5px; border-radius: 9px; }
select.input-sm { padding-right: 30px; }
.input-color { padding: 4px; width: 64px; height: 40px; }
.input-affix { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.input-affix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.input-affix .input { border: 0; box-shadow: none !important; border-radius: 0; }
.affix { display: grid; place-items: center; padding: 0 10px; color: var(--faint); background: var(--surface-2); font-weight: 600; font-size: 14px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: #2440f0; cursor: pointer; }
input[type=date].input, input[type=time].input, input[type=datetime-local].input { min-width: 0; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span2, .span2 { grid-column: 1 / -1; }
.lbl { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.lbl b { color: var(--err); }
.help { font-size: 12.5px; color: var(--faint); display: block; }
.err { font-size: 12.5px; color: var(--err); font-weight: 600; }
.err:empty { display: none; }
.field.invalid .input, .field.invalid .input-affix { border-color: var(--err); }
.field-check { flex-direction: row; align-items: center; gap: 10px; padding-top: 22px; font-weight: 600; font-size: 14px; cursor: pointer; }
.field-check .help { flex-basis: 100%; }
.form-section { padding-top: 6px; border-top: 1px solid var(--line-soft); margin-top: 4px; }
.form-section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); padding-top: 10px; }
fieldset.addr { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
fieldset.addr legend { padding: 0; margin-bottom: 6px; }
.addr-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
.note-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 14px; border-radius: 10px; background: var(--info-soft); color: var(--ink); font-size: 14px; }
.check-sm { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.receipt-drop { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; border: 1.5px dashed var(--line); border-radius: 10px; background: var(--surface-2); margin-top: 6px; }

/* combobox + tag picker */
.combo { position: relative; }
.combo-box { position: relative; }
.combo-clear { position: absolute; right: 5px; top: 5px; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; list-style: none; margin: 0; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 260px; overflow: auto; }
.combo-list li { padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.combo-list li.active, .combo-list li:hover { background: var(--brand-soft); }
.combo-list li.none { color: var(--faint); cursor: default; }
.combo-list li.create { color: var(--brand); font-weight: 600; }
.combo-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.combo-chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 99px; background: var(--sunk); font-size: 13px; font-weight: 600; }
.chip button { border: 0; background: none; cursor: pointer; display: grid; place-items: center; padding: 2px; border-radius: 99px; color: var(--muted); }
.chip button .ic { width: 14px; height: 14px; }
.tagpick { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { --c: #2440f0; display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; color: color-mix(in srgb, var(--c) 78%, var(--ink)); background: color-mix(in srgb, var(--c) 13%, transparent); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent); white-space: nowrap; line-height: 1.5; }
.tag.more { --c: #6b7192; }
.tag-toggle { cursor: pointer; opacity: .62; font-size: 13px; padding: 4px 11px; }
.tag-toggle.on { opacity: 1; box-shadow: inset 0 0 0 1.5px var(--c); }
.tag-toggle.on::before { content: "✓"; font-size: 11px; }
.tag-new { --c: #6b7192; cursor: pointer; border-style: dashed; font-size: 13px; padding: 4px 11px; }
.tag-new .ic { width: 13px; height: 13px; }

/* segmented */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--sunk); border: 1px solid var(--line-soft); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg-sm button { padding: 5px 9px; font-size: 13px; }
.seg-sm .ic { width: 15px; height: 15px; }

/* ---------- Cards & page structure ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; }
.card-head h2 { font-size: 16px; font-weight: 750; }
.card-head .grow + * { margin-left: auto; }
.card-head > :last-child:not(h2) { margin-left: auto; }
.card-body { padding: 0 18px 18px; }
.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.page-head h2 { font-size: 24px; font-weight: 800; }
.page-head .sub { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.detail-grid > div { display: grid; gap: 18px; min-width: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; color: var(--muted); font-weight: 650; font-size: 14.5px; border-bottom: 2.5px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs .on { color: var(--ink); border-bottom-color: var(--brand); }

/* ---------- Badges, avatars ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--sunk); color: var(--muted); white-space: nowrap; line-height: 1.55; }
.badge .ic { width: 12px; height: 12px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--err-soft); color: var(--err); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--brand); }
.badge.mute { background: transparent; border: 1px solid var(--line); color: var(--faint); }
.badge.cta { background: var(--cta); color: var(--cta-fg); }
.avatar { --c: #2440f0; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: color-mix(in srgb, var(--c) 82%, var(--ink)); font-weight: 750; font-size: 13.5px; flex: 0 0 auto; letter-spacing: .02em; }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; border-radius: 16px; }
.owner-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.chip-link { font-size: 12.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--sunk); color: var(--muted); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); color: var(--ink); display: block; min-width: 0; }
a.kpi:hover { text-decoration: none; border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); box-shadow: var(--shadow); }
.kpi-k { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; color: var(--muted); }
.kpi-k .ic { width: 16px; height: 16px; color: var(--brand); }
.kpi-v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.kpi-s { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.kpi.hero { background: linear-gradient(135deg, #2440f0, #1a2fc4); border-color: transparent; color: #fff; }
.kpi.hero .kpi-k, .kpi.hero .kpi-s, .kpi.hero .kpi-k .ic { color: rgba(255, 255, 255, .85); }
.kpi.alert .kpi-v { color: var(--err); }

/* ---------- Dashboard ---------- */
.greet { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.greet h2 { font-size: 26px; font-weight: 800; }
.greet p { color: var(--muted); margin: 4px 0 0; }
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; align-items: start; }
.col-8 { grid-column: span 8; } .col-4 { grid-column: span 4; } .col-6 { grid-column: span 6; } .col-12 { grid-column: span 12; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.agenda { list-style: none; margin: 0; padding: 0 8px 10px; }
.agenda li { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 10px; }
.agenda li:hover { background: var(--hover); }
.agenda .when { font-size: 12.5px; font-weight: 700; color: var(--muted); min-width: 64px; }
.agenda .what { flex: 1; min-width: 0; }
.agenda .what a { color: var(--ink); font-weight: 600; }
.agenda .what small { display: block; color: var(--faint); }
.feed { list-style: none; margin: 0; padding: 0 18px 14px; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 14px; align-items: flex-start; }
.feed li:first-child { border-top: 0; }
.feed .ic { color: var(--brand); margin-top: 2px; }
.feed time { margin-left: auto; color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.dash-foot { margin-top: 26px; text-align: center; font-size: 13px; color: var(--faint); }
.dash-foot a { font-weight: 700; }

/* ---------- Charts ---------- */
.chart { padding: 0 14px 12px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .baseline { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 11px; font-family: var(--font); }
.chart .hit { fill: transparent; }
.bar-group:hover .hit, .bar-group:focus .hit { fill: var(--hover); }
.bar-group:focus { outline: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; list-style: none; margin: 0 0 8px; padding: 0 4px; font-size: 13px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.legend-col { flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.legend-col li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-col li b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 650; }
.donut-wrap { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: center; padding: 0 18px 18px; }
.donut-wrap .legend-col { min-width: 210px; }
.donut { width: 160px; height: 160px; flex: 0 0 auto; }
.donut path, .donut circle { stroke: var(--surface); stroke-width: 0; cursor: default; }
.donut path:hover, .donut path:focus { opacity: .85; outline: none; }
.donut-k { fill: var(--faint); font-size: 11px; font-weight: 600; }
.donut-v { fill: var(--ink); font-size: 18px; font-weight: 800; }
.hbars { display: grid; gap: 12px; padding: 2px 18px 18px; }
.hbar:focus { outline: none; }
.hbar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; margin-bottom: 5px; }
.hbar-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-val { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.hbar-val small { color: var(--faint); font-weight: 500; }
.hbar-track { height: 10px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 99px; }
.hbar:hover .hbar-fill, .hbar:focus .hbar-fill { filter: brightness(1.08); }
.chart-empty { padding: 26px 18px; color: var(--faint); text-align: center; margin: 0; }
.chart-tip { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; background: #0c1024; color: #fff; font-size: 12.5px; line-height: 1.5; padding: 8px 11px; border-radius: 9px; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .1s; max-width: 260px; }
.chart-tip.show { opacity: 1; }
.chart-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ---------- Lists / tables ---------- */
.list-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line-soft); }
.search-box { position: relative; flex: 1 1 240px; max-width: 360px; }
.search-box .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; pointer-events: none; }
.search-box .input { padding-left: 34px; min-height: 36px; }
.filter-sel { flex: 0 1 auto; }
.filter-sel .input { width: auto; max-width: 200px; }
.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; background: var(--brand-soft); border-bottom: 1px solid var(--line); font-size: 14px; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); background: var(--surface-2); white-space: nowrap; user-select: none; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--ink); }
.sort-ind { margin-left: 4px; font-size: 9px; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; transition: background .08s; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl tbody tr:focus { outline: none; background: var(--hover); box-shadow: inset 3px 0 0 var(--brand); }
.tbl tbody tr.selected { background: var(--brand-soft); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .ck { width: 40px; padding-right: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .nowrap { white-space: nowrap; }
.tbl .tags-cell { display: flex; gap: 4px; flex-wrap: wrap; }
.tbl tr.norows { cursor: default; }
.tbl tr.norows:hover { background: none; }
.cell-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-main strong { font-weight: 650; color: var(--ink); }
.cell-main small { display: block; color: var(--faint); font-size: 12.5px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 12px; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.sort-sel { display: none; }
.filter-toggle { display: none !important; }
.sort-dir { display: none; }
.row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--err); }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 48px 20px; max-width: 520px; margin: 0 auto; }
.empty.sm { padding: 24px 12px; }
.empty-ic { width: 60px; height: 60px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto 14px; }
.empty-ic .ic { width: 28px; height: 28px; }
.empty h3 { font-size: 19px; margin-bottom: 6px; }
.empty p { color: var(--muted); }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

/* ---------- Banner ---------- */
#banners:empty { display: none; }
.banner { display: flex; align-items: center; gap: 12px; margin: 14px 24px 0; padding: 12px 14px; border-radius: 12px; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--cta) 60%, transparent); font-size: 14px; }
.banner > .ic { color: var(--warn); }
.banner > span { flex: 1; }
.banner .short { display: none; }

/* ---------- Kanban ---------- */
.board-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.board-stats { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.board-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(268px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; scroll-snap-type: x proximity; }
.col { background: var(--sunk); border: 1px solid var(--line-soft); border-radius: 14px; display: flex; flex-direction: column; max-height: calc(100vh - 210px); min-height: 160px; scroll-snap-align: start; transition: background .12s, box-shadow .12s; }
.col.drop { background: color-mix(in srgb, var(--brand) 12%, var(--sunk)); box-shadow: inset 0 0 0 2px var(--brand); }
.col-head { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.col-title { display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 14px; }
.col-title .cnt { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface); border-radius: 99px; padding: 0 8px; }
.col-sum { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-bar { height: 3px; border-radius: 3px; background: var(--brand); opacity: .75; margin-top: 6px; }
.col.won .col-bar { background: var(--ok); } .col.lost .col-bar { background: var(--err); }
.col-body { padding: 4px 8px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; flex: 1; }
.col-add { margin: 0 8px 10px; justify-content: flex-start; color: var(--muted); background: transparent; border-style: dashed; }
.dcard { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; box-shadow: var(--shadow-sm); cursor: grab; user-select: none; -webkit-user-select: none; touch-action: manipulation; transition: box-shadow .12s, transform .12s; }
.dcard:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.dcard:focus-visible { outline: 3px solid var(--cta); }
.dcard.dragging { opacity: .35; }
.dcard-title { font-weight: 650; font-size: 14px; line-height: 1.3; color: var(--ink); padding-right: 8px; }
.dcard-co { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcard-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12.5px; color: var(--muted); }
.dcard-val { font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; font-size: 13.5px; }
.dcard-due.bad { color: var(--err); font-weight: 650; }
.dcard .tags-cell { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 7px; }
.drag-ghost { position: fixed; z-index: 1000; pointer-events: none; transform: rotate(2.5deg); box-shadow: var(--shadow-lg); opacity: .96; cursor: grabbing; }
.hold-hint { position: fixed; inset: auto 0 90px; text-align: center; pointer-events: none; }

/* ---------- Detail header ---------- */
.rec-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.rec-head .avatar.lg { border-radius: 16px; }
.rec-title { flex: 1; min-width: 220px; }
.rec-title h2 .badge { font-size: 12px; letter-spacing: 0; line-height: 1.5; font-weight: 700; }
.rec-title h2 { font-size: 24px; font-weight: 800; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rec-title .sub { color: var(--muted); margin-top: 4px; display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center; font-size: 14px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 13.5px; margin-bottom: 10px; }
.contact-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.contact-actions .btn .ic { color: var(--brand); }
.info { margin: 0; padding: 0 18px 16px; display: grid; gap: 0; }
.info > div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.info > div:first-child { border-top: 0; }
.info dt { color: var(--faint); font-weight: 600; font-size: 13px; }
.info dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mini-list { list-style: none; margin: 0; padding: 0 10px 12px; }
.mini-list li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; font-size: 14px; }
.mini-list li:hover { background: var(--hover); }
.mini-list a { color: var(--ink); font-weight: 600; }
.mini-list .r { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-list small { display: block; color: var(--faint); font-size: 12.5px; font-weight: 500; }
.stage-track { display: flex; gap: 4px; margin: 4px 0 18px; overflow-x: auto; }
.stage-track button { flex: 1; min-width: 92px; padding: 9px 8px; border: 0; border-radius: 8px; background: var(--sunk); color: var(--muted); font-weight: 650; font-size: 12.5px; cursor: pointer; white-space: nowrap; position: relative; }
.stage-track button.past { background: color-mix(in srgb, var(--brand) 22%, var(--sunk)); color: var(--ink); }
.stage-track button.cur { background: #2440f0; color: #fff; }
.stage-track button:hover:not(.cur) { background: color-mix(in srgb, var(--brand) 30%, var(--sunk)); color: var(--ink); }

/* ---------- Timeline & tasks ---------- */
.composer { margin: 0 18px 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); display: grid; gap: 10px; }
.composer textarea { background: var(--surface); }
.composer-foot { display: flex; align-items: center; gap: 10px; }
.timeline { list-style: none; margin: 0; padding: 0 18px 12px; }
.tl-item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.tl-item.pinned { background: color-mix(in srgb, var(--cta) 10%, transparent); margin: 0 -18px; padding: 12px 18px; }
.tl-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: 0 0 auto; }
.tl-ic .ic { width: 16px; height: 16px; }
.tl-call { background: var(--ok-soft); color: var(--ok); }
.tl-meeting, .tl-visit { background: var(--warn-soft); color: var(--warn); }
.tl-body { flex: 1; min-width: 0; }
.tl-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.md { font-size: 14.5px; margin-top: 4px; overflow-wrap: anywhere; }
.md p { margin: 0 0 4px; }
.md ul, .md ol { margin: 4px 0; padding-left: 20px; }
.md code { font-family: var(--mono); font-size: 13px; background: var(--sunk); padding: 1px 5px; border-radius: 5px; }
.tasks { list-style: none; margin: 0; padding: 0 10px 10px; }
.task { display: flex; gap: 10px; padding: 9px 8px; border-radius: 10px; align-items: flex-start; }
.task:hover { background: var(--hover); }
.task-check { position: relative; display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 auto; margin-top: 1px; cursor: pointer; }
.task-check input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.task-check .box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; background: var(--surface); transition: all .12s; }
.task-check .box .ic { width: 14px; height: 14px; stroke-width: 3; }
.task-check input:checked + .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.task-check input:focus-visible + .box { outline: 3px solid var(--cta); outline-offset: 2px; }
.task.pri-high .task-check .box { border-color: var(--err); }
.task-main { flex: 1; min-width: 0; cursor: pointer; }
.task-main:focus-visible { outline: 3px solid var(--cta); }
.task-title { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.task.done .task-title { text-decoration: line-through; color: var(--faint); }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); margin-top: 2px; align-items: center; }
.task-meta .ic-sm { margin-top: -2px; }
.task.overdue .task-meta .bad { font-weight: 700; }
.pri-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--err); display: inline-block; flex: 0 0 auto; }
.checklist { list-style: none; padding: 4px 0 0; margin: 0; font-size: 13.5px; color: var(--muted); }
.checklist label { display: flex; gap: 8px; align-items: center; padding: 2px 0; cursor: pointer; }
.checklist input { width: 15px; height: 15px; }
.done-list { padding: 0 18px 14px; }
.done-list summary { cursor: pointer; color: var(--muted); font-size: 13.5px; font-weight: 600; padding: 4px 0; }
.files { list-style: none; margin: 0; padding: 0 18px 14px; }
.files li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.files li:first-child { border-top: 0; }
.files .linkish { flex: 1; display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-head h2 { font-size: 20px; min-width: 170px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--line-soft); gap: 1px; }
.cal-dow { background: var(--surface-2); padding: 8px; font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; }
.cal-day { background: var(--surface); min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.other { background: var(--surface-2); }
.cal-day.other .cal-n { color: var(--faint); opacity: .6; }
.cal-n { font-size: 12.5px; font-weight: 700; color: var(--muted); align-self: flex-start; padding: 2px 6px; border-radius: 99px; }
.cal-day.today .cal-n { background: #2440f0; color: #fff; }
.cal-ev { display: block; font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); background: var(--sunk); border-left: 3px solid var(--c, var(--brand)); cursor: pointer; text-align: left; border-top: 0; border-right: 0; border-bottom: 0; width: 100%; }
.cal-ev:hover { text-decoration: none; filter: brightness(.97); }
.cal-ev.done { text-decoration: line-through; opacity: .6; }
.cal-more { font-size: 11.5px; color: var(--muted); padding-left: 6px; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--muted); }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* ---------- Invoices ---------- */
.inv-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.paper { background: #fff; color: #0c1024; border-radius: 6px; box-shadow: 0 2px 6px rgba(12, 16, 36, .08), 0 18px 40px rgba(12, 16, 36, .12); padding: 44px 48px 30px; max-width: 860px; margin: 0 auto; position: relative; overflow: hidden; font-size: 13.5px; }
.paper::before { content: ""; position: absolute; inset: 0 0 auto; height: 7px; background: var(--acc, #2440f0); }
.paper .p-top { display: flex; justify-content: space-between; gap: 20px; }
.paper .p-logo { max-width: 150px; max-height: 64px; object-fit: contain; display: block; margin-bottom: 10px; }
.paper .p-biz { font-weight: 800; font-size: 16px; }
.paper .p-muted { color: #5a6180; font-size: 12.5px; line-height: 1.55; }
.paper .p-title { font-size: 30px; font-weight: 800; letter-spacing: .02em; color: var(--acc, #2440f0); text-align: right; }
.paper .p-meta { margin-top: 8px; display: grid; grid-template-columns: auto auto; gap: 3px 16px; justify-content: end; font-size: 12.5px; }
.paper .p-meta dt { color: #5a6180; text-align: right; }
.paper .p-meta dd { margin: 0; font-weight: 700; text-align: right; }
.paper hr { border: 0; border-top: 1px solid #e2e6f6; margin: 22px 0; }
.paper .p-mid { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.paper .p-k { font-size: 10.5px; font-weight: 800; color: #5a6180; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 5px; }
.paper .p-due { background: #eef1ff; border-radius: 10px; padding: 12px 16px; min-width: 190px; }
.paper .p-due b { font-size: 22px; display: block; }
.paper table { width: 100%; border-collapse: collapse; margin-top: 22px; }
.paper th { background: var(--acc, #2440f0); color: #fff; text-align: left; padding: 8px 10px; font-size: 11.5px; letter-spacing: .03em; }
.paper th:not(:first-child), .paper td:not(:first-child) { text-align: right; white-space: nowrap; }
.paper td { padding: 9px 10px; border-bottom: 1px solid #e2e6f6; vertical-align: top; }
.paper td small { display: block; color: #5a6180; }
.paper .p-totals { margin-left: auto; width: 270px; margin-top: 14px; }
.paper .p-totals div { display: flex; justify-content: space-between; padding: 5px 8px; color: #5a6180; }
.paper .p-totals div b { color: #0c1024; font-variant-numeric: tabular-nums; }
.paper .p-totals .strong { background: #eef1ff; color: #0c1024; font-weight: 800; font-size: 14.5px; border-radius: 6px; }
.paper .p-notes { margin-top: 22px; display: grid; gap: 14px; }
.paper .p-notes p { white-space: pre-wrap; margin: 0; }
.paper .p-foot { text-align: center; color: #8c92aa; font-size: 10.5px; margin-top: 34px; }
.paper .p-stamp { position: absolute; right: 54px; top: 170px; transform: rotate(12deg); color: #1b8c5a; border: 3px solid #1b8c5a; font-weight: 900; font-size: 30px; padding: 2px 14px; border-radius: 8px; opacity: .8; letter-spacing: .08em; }
.side-stack { display: grid; gap: 14px; position: sticky; top: calc(var(--top-h) + 16px); }
.sum-rows { padding: 0 18px 16px; display: grid; gap: 6px; font-size: 14px; }
.sum-rows div { display: flex; justify-content: space-between; gap: 10px; }
.sum-rows b { font-variant-numeric: tabular-nums; }
.sum-rows .big { font-size: 20px; font-weight: 800; padding-top: 6px; border-top: 1px solid var(--line-soft); }
.pay-list { list-style: none; margin: 0; padding: 0 18px 14px; font-size: 14px; }
.pay-list li { display: flex; gap: 8px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line-soft); }
.pay-list li:first-child { border-top: 0; }
.pay-list b { margin-left: auto; font-variant-numeric: tabular-nums; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.items-tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.items-tbl th { text-align: left; font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; padding: 8px 6px; font-weight: 700; }
.items-tbl td { padding: 5px 4px; vertical-align: top; }
.items-tbl .input { min-height: 38px; padding: 7px 9px; font-size: 14px; }
.items-tbl textarea.input { min-height: 38px; height: 38px; margin-top: 4px; font-size: 13px; }
.items-tbl .c-qty { width: 84px; } .items-tbl .c-rate { width: 120px; } .items-tbl .c-amt { width: 110px; text-align: right; font-weight: 700; padding-top: 14px; font-variant-numeric: tabular-nums; } .items-tbl .c-tax { width: 50px; text-align: center; padding-top: 14px; } .items-tbl .c-x { width: 40px; }
.items-tbl tr.drag-over td { box-shadow: inset 0 2px 0 var(--brand); }
.item-pick { position: relative; }
.inv-totals { display: grid; gap: 8px; padding: 0 18px 18px; font-size: 14px; }
.inv-totals > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.inv-totals .input-affix { width: 150px; }
.inv-totals .grand { font-size: 20px; font-weight: 800; border-top: 1px solid var(--line); padding-top: 10px; }
.disc-row { display: flex; gap: 6px; align-items: center; }
.disc-row select { width: 64px; }
.disc-row .input-affix { width: 110px; }
.status-pill { font-size: 13px; padding: 4px 12px; }
.aging { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.aging div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.aging small { color: var(--faint); font-weight: 650; font-size: 12px; display: block; }
.aging b { font-size: 17px; font-variant-numeric: tabular-nums; }
.aging .hot b { color: var(--err); }

/* ---------- Expenses ---------- */
.exp-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.thumb { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); display: block; background: var(--sunk); }
.thumb-btn { padding: 0; border: 0; background: none; cursor: zoom-in; position: relative; }
.thumb-ph { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--sunk); color: var(--faint); }
.viewer .modal { width: min(1100px, 96vw); }
.viewer-stage { display: grid; place-items: center; min-height: 60vh; background: var(--sunk); border-radius: 10px; overflow: auto; }
.viewer-stage img { max-height: 75vh; object-fit: contain; }
.viewer-stage object { width: 100%; height: 75vh; }

/* ---------- Reports ---------- */
.report-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.report-card { display: flex; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--ink); box-shadow: var(--shadow-sm); }
.report-card:hover { text-decoration: none; border-color: var(--brand); box-shadow: var(--shadow); }
.report-card .ic-wrap { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: 0 0 auto; }
.report-card h3 { font-size: 15.5px; margin-bottom: 3px; }
.report-card p { color: var(--muted); font-size: 13.5px; margin: 0; }
.range-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.range-bar .input { width: auto; }
.rpt-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.rpt-tbl th, .rpt-tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.rpt-tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); background: var(--surface-2); white-space: nowrap; }
.rpt-tbl td:first-child { min-width: 190px; }
.rpt-tbl td.num, .rpt-tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rpt-tbl tr.sec td { font-weight: 800; background: var(--surface-2); text-transform: uppercase; font-size: 12px; letter-spacing: .06em; color: var(--muted); }
.rpt-tbl tr.tot td { font-weight: 800; border-top: 2px solid var(--line); }
.rpt-tbl tr.grand td { font-weight: 800; font-size: 16px; background: var(--brand-soft); }
.rpt-tbl td.neg { color: var(--err); }
.rpt-note { font-size: 13px; color: var(--faint); padding: 12px 18px 16px; margin: 0; }

/* ---------- Settings / data pages ---------- */
.set-grid { display: grid; gap: 18px; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.set-row:first-of-type { border-top: 0; }
.set-row .txt { flex: 1; min-width: 220px; }
.set-row .txt strong { display: block; }
.set-row .txt span { font-size: 13.5px; color: var(--muted); }
.edit-list { list-style: none; margin: 0; padding: 0 18px 12px; display: grid; gap: 8px; }
.edit-list li { display: flex; gap: 8px; align-items: center; }
.edit-list .handle { color: var(--faint); cursor: grab; }
.edit-list .input { min-height: 36px; }
.logo-box { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-prev { width: 96px; height: 96px; border-radius: 16px; border: 1px dashed var(--line); display: grid; place-items: center; background: #fff; overflow: hidden; color: #6b7192; font-size: 12px; text-align: center; }
.logo-prev img { max-width: 88px; max-height: 88px; object-fit: contain; }
.steps { padding-left: 20px; margin: 0 0 12px; display: grid; gap: 8px; }
.qb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 0 18px 18px; }
.qb-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.qb-item h3 { font-size: 15px; }
.qb-item p { font-size: 13.5px; color: var(--muted); margin: 0; flex: 1; }
.map-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.map-tbl td, .map-tbl th { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.map-tbl .sample { color: var(--faint); font-size: 12.5px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-tbl { font-size: 12.5px; }
.dropzone { border: 2px dashed var(--line); border-radius: 14px; padding: 30px 20px; text-align: center; background: var(--surface-2); transition: all .12s; }
.dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; padding: 0 18px 14px; }
.stat-row .badge { font-size: 13px; padding: 4px 12px; }
.help-list { display: grid; gap: 12px; }
.help-list details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 18px; }
.help-list summary { cursor: pointer; padding: 14px 0; font-weight: 700; font-size: 15.5px; list-style: none; display: flex; align-items: center; gap: 10px; }
.help-list summary::-webkit-details-marker { display: none; }
.help-list summary .ic { color: var(--brand); }
.help-list details[open] summary { border-bottom: 1px solid var(--line-soft); }
.help-list .help-body { padding: 12px 0 16px; color: var(--ink); font-size: 14.5px; }
.help-list .help-body ol, .help-list .help-body ul { padding-left: 20px; display: grid; gap: 6px; }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 25, .5); opacity: 0; transition: opacity .18s; }
.modal { position: relative; width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.985); opacity: 0; transition: transform .18s, opacity .18s; border: 1px solid var(--line); }
.modal-sm { width: min(440px, 100%); } .modal-lg { width: min(760px, 100%); } .modal-xl { width: min(1040px, 100%); }
.modal-wrap.show .modal { transform: none; opacity: 1; }
.modal-wrap.show .modal-backdrop { opacity: 1; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { font-size: 18px; font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 18px 22px; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 22px 16px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.modal-foot .grow { flex: 1; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); cursor: pointer; font-weight: 650; font-size: 13.5px; }
.quick-btn .ic { width: 24px; height: 24px; color: var(--brand); }
.quick-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.shortcuts h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 0 0 8px; }
.shortcuts dl { margin: 0 0 16px; display: grid; gap: 6px; }
.shortcuts dl div { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.shortcuts dt { min-width: 84px; display: flex; gap: 3px; }
.shortcuts dd { margin: 0; color: var(--muted); }

/* ---------- Popover menu ---------- */
.popmenu { position: fixed; z-index: 400; min-width: 200px; max-width: 320px; max-height: 70vh; overflow-y: auto; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); }
.popmenu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-size: 14px; font-weight: 550; }
.popmenu button:hover, .popmenu button:focus { background: var(--hover); outline: none; }
.popmenu button .ic { color: var(--muted); width: 16px; height: 16px; }
.popmenu button.danger { color: var(--err); }
.popmenu button.danger .ic { color: var(--err); }
.popmenu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 0; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 600; display: grid; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 11px 10px 11px 16px; border-radius: 12px; background: #0c1024; color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; transform: translateY(12px); opacity: 0; transition: all .2s; }
.toast.show { transform: none; opacity: 1; }
.toast-msg { flex: 1; }
.toast-btn { border: 0; background: rgba(255, 255, 255, .14); color: var(--cta); font-weight: 750; padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.toast-btn:hover { background: rgba(255, 255, 255, .22); }
.toast-x { border: 0; background: none; color: rgba(255, 255, 255, .7); cursor: pointer; display: grid; place-items: center; padding: 4px; border-radius: 6px; }
.toast-x .ic { width: 16px; height: 16px; }
.toast-error { background: #a2412f; }


/* ---------- Command palette ---------- */
.palette .modal { width: min(640px, 100%); align-self: start; margin-top: 10vh; }
.palette .modal-head { display: none; }
.palette .modal-body { padding: 0; }
.pal-input { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.pal-input .ic { color: var(--faint); }
.pal-input input { flex: 1; border: 0; background: none; font: inherit; font-size: 17px; color: var(--ink); outline: none; min-width: 0; }
.pal-list { list-style: none; margin: 0; padding: 6px; max-height: 60vh; overflow-y: auto; }
.pal-sec { font-size: 11.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px 4px; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.pal-item .ic { color: var(--muted); }
.pal-item.active { background: var(--brand-soft); }
.pal-item.active .ic { color: var(--brand); }
.pal-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item small { color: var(--faint); white-space: nowrap; }
.pal-foot { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--faint); }

/* ---------- Welcome & wizard ---------- */
.welcome { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); background: var(--bg); }
.welcome-art { background: linear-gradient(160deg, #2440f0 0%, #1a2fc4 60%, #0c1024 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.welcome-art::after { content: ""; position: absolute; width: 440px; height: 440px; border-radius: 50%; border: 56px solid rgba(255, 201, 60, .16); right: -150px; bottom: -150px; pointer-events: none; }
.welcome-art h1 { font-size: clamp(30px, 4vw, 46px); font-weight: 850; line-height: 1.05; margin: 22px 0 14px; max-width: 520px; }
.welcome-art h1 em { font-style: normal; background: linear-gradient(transparent 62%, #ffc93c 62%, #ffc93c 92%, transparent 92%); color: #fff; }
.welcome-art p { color: rgba(255, 255, 255, .85); max-width: 480px; font-size: 16.5px; }
.welcome-art ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; max-width: 480px; }
.welcome-art li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.welcome-art li .ic { color: #ffc93c; margin-top: 2px; }
.welcome-mark { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; font-size: 18px; }
.welcome-mark img { width: 40px; height: 40px; border-radius: 11px; }
.welcome-mark small { font: 600 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
.welcome-main { padding: 48px clamp(20px, 5vw, 64px); display: flex; flex-direction: column; justify-content: center; max-width: 720px; width: 100%; }
.welcome-main h2 { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.welcome-main .lead { color: var(--muted); font-size: 16px; margin-bottom: 22px; }
.agree { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; margin: 18px 0; font-size: 15px; }
.agree input { margin-top: 2px; width: 20px; height: 20px; }
.agree:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.wiz-steps { display: flex; gap: 6px; margin-bottom: 22px; }
.wiz-steps span { flex: 1; height: 5px; border-radius: 9px; background: var(--line); }
.wiz-steps span.on { background: #2440f0; }
.wiz-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow-sm); }
.wiz-foot { display: flex; gap: 10px; margin-top: 18px; align-items: center; }
.ind-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; padding: 4px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
.ind-list button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 550; }
.ind-list button:hover { background: var(--hover); }
.ind-list button.on { background: #2440f0; color: #fff; }
.ind-list .custom { grid-column: 1 / -1; color: var(--brand); font-weight: 700; }
.legal-small { font-size: 12.5px; color: var(--faint); margin-top: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col-8, .col-4, .col-6 { grid-column: span 12; }
  .detail-grid, .inv-layout, .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .side-stack { position: static; }
  .exp-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-trigger { min-width: 0; }
}
@media (max-width: 899px) {
  :root { --top-h: 56px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); padding-bottom: env(safe-area-inset-bottom); }
  .sidebar.open { transform: none; }
  .only-mobile { display: inline-flex !important; }
  .hide-mobile { display: none !important; }
  .topbar { padding: 0 8px 0 4px; gap: 4px; padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top)); }
  .page-title { display: none; }
  .top-brand { flex: 1; min-width: 0; }
  .top-brand .biz { font-size: 15px; padding: 4px; }
  .top-brand .biz-logo, .top-brand .biz-mono { width: 34px; height: 34px; font-size: 16px; }
  .top-brand .biz-name { -webkit-line-clamp: 2; font-size: 14px; line-height: 1.15; }
  .top-brand .biz.has-logo .biz-name { display: none; }
  .top-brand .biz.has-logo .biz-logo { max-width: 180px; height: 44px; padding: 2px 4px; }
  .greet .quick-actions { display: none; }
  .banner .long { display: none; }
  .banner .short { display: inline !important; }
  .themebtn-m { display: none; }
  .search-trigger { min-width: 0; width: 40px; height: 40px; padding: 0; justify-content: center; border-color: transparent; background: transparent; color: var(--muted); }
  .view { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .app-foot { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .banner { margin: 10px 16px 0; flex-wrap: wrap; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 8px; font-size: 11px; font-weight: 650; color: var(--faint); border: 0; background: none; cursor: pointer; }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav .ic { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--brand); }
  .fab { display: grid; place-items: center; position: fixed; z-index: 36; right: 16px; bottom: calc(78px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 18px; border: 0; background: #ffc93c; color: #0c1024; box-shadow: 0 6px 18px rgba(12, 16, 36, .28); cursor: pointer; }
  .fab .ic { width: 28px; height: 28px; stroke-width: 2.6; }
  .toasts { bottom: calc(92px + env(safe-area-inset-bottom)); }
  .greet h2 { font-size: 22px; }
  .kpi { padding: 13px 14px; }
  .kpi-v { font-size: 21px; }
  .kpis { gap: 10px; }
  .dash-grid, .grid { gap: 14px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .field-check { padding-top: 0; }
  .modal-wrap { padding: 0; place-items: end stretch; }
  .modal, .modal-sm, .modal-lg, .modal-xl { width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; transform: translateY(40px); padding-bottom: env(safe-area-inset-bottom); }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px 16px; }
  .modal-foot .btn { flex: 1; }
  .modal-foot .grow { display: none; }
  .modal-foot .btn-ghost.danger { flex: 0 0 auto; }
  .palette .modal { margin-top: 0; align-self: end; }
  .viewer .modal { width: 100%; }
  /* lists become cards */
  .toolbar { padding: 10px; }
  .search-box { max-width: none; flex-basis: 100%; }
  .filter-sel .input { max-width: 46vw; }
  .sort-sel, .sort-dir { display: inline-flex; }
  .filter-toggle { display: inline-flex !important; }
  .toolbar .filter-sel:not(.sort-sel) { display: none; }
  .toolbar.show-filters .filter-sel { display: inline-flex; }
  .hide-sm { display: none; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody { display: block; }
  .tbl tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px 12px; border-bottom: 1px solid var(--line-soft); align-items: center; }
  .tbl tbody tr:last-child { border-bottom: 0; }
  .tbl td { padding: 0; border: 0; font-size: 13.5px; color: var(--muted); grid-column: 2; }
  .tbl td.ck { grid-column: 1; grid-row: 1 / span 3; width: auto; align-self: start; padding-top: 2px; }
  .tbl td.m-title { grid-column: 2; color: var(--ink); font-size: 15px; }
  .tbl td.m-right { grid-column: 3; grid-row: 1; text-align: right; color: var(--ink); font-weight: 700; }
  .tbl td.m-right2 { grid-column: 3; grid-row: 2; text-align: right; }
  .tbl td.m-hide { display: none; }
  .tbl td:empty { display: none; }
  .tbl tr.norows { display: block; }
  .tbl tr.norows td { display: block; }
  .board { grid-auto-columns: 84vw; margin: 0 -16px; padding: 0 16px 12px; scroll-padding: 16px; }
  .col { max-height: calc(100vh - 250px); }
  .aging { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exp-summary { gap: 10px; }
  .cal-day { min-height: 74px; padding: 3px; }
  .cal-ev { font-size: 10.5px; padding: 1px 4px; }
  .cal-dow { padding: 6px 3px; font-size: 10.5px; text-align: center; }
  .paper { padding: 26px 18px 20px; font-size: 12.5px; border-radius: 4px; }
  .paper .p-top, .paper .p-mid { flex-direction: column; }
  .paper .p-title { text-align: left; font-size: 24px; }
  .paper .p-meta { justify-content: start; }
  .paper .p-meta dt, .paper .p-meta dd { text-align: left; }
  .paper .p-totals { width: 100%; }
  .paper .p-stamp { top: 24px; right: 18px; font-size: 20px; }
  .items-tbl thead { display: none; }
  .items-tbl tr { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
  .items-tbl td { padding: 0; }
  .items-tbl td.c-item { grid-column: 1 / -1; }
  .items-tbl .c-qty, .items-tbl .c-rate, .items-tbl .c-amt { width: auto; }
  .items-tbl .c-amt { padding-top: 10px; }
  .items-tbl .c-tax { width: auto; padding-top: 10px; }
  .items-tbl .c-x { grid-column: 4; grid-row: 1; }
  .items-tbl td.c-item { grid-column: 1 / 4; }
  .shortcuts { grid-template-columns: 1fr; }
  .welcome { grid-template-columns: minmax(0, 1fr); }
  .welcome-art { padding: 28px 20px; }
  .welcome-art ul { display: none; }
  .welcome-main { padding: 24px 16px 40px; }
  .ind-list { grid-template-columns: minmax(0, 1fr); }
  .rec-title h2 { font-size: 21px; }
  .info > div { grid-template-columns: 110px 1fr; }
  .page-head h2 { font-size: 21px; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut { margin: 0 auto; }
  .addr-row { grid-template-columns: 1fr 1fr; }
  .addr-row input:first-child { grid-column: 1 / -1; }
}
@media (max-width: 420px) { .kpi-v { font-size: 19px; } .quick-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; } }


/* ================= Phase 2 components ================= */
.timer-slot { display: inline-flex; }
.timer-chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--err) 40%, var(--line)); background: var(--err-soft); color: var(--err); font-weight: 750; font-variant-numeric: tabular-nums; cursor: pointer; }
.timer-chip .ic { animation: pulse 1.6s ease-in-out infinite; }
.timer-chip small { color: var(--muted); font-weight: 600; }
.dcard.stale { border-left: 4px solid var(--warn); }
.dcard.uncontacted { border-left: 4px solid var(--err); }
.jbar { height: 4px; border-radius: 4px; background: var(--sunk); margin-top: 9px; overflow: hidden; }
.jbar i { display: block; height: 100%; border-radius: 4px; }
.cost-bars { display: grid; gap: 12px; }
.cost-row .hbar-fill { background: var(--s3); }
.cost-row .hbar-fill.over { background: var(--err); }
.cost-row .hbar-fill.budget { background: repeating-linear-gradient(45deg, var(--s1), var(--s1) 6px, color-mix(in srgb, var(--s1) 60%, transparent) 6px, color-mix(in srgb, var(--s1) 60%, transparent) 12px); }
.inline-add { display: flex; gap: 8px; padding: 0 18px 16px; align-items: center; flex-wrap: wrap; }
.inline-add .input { flex: 1 1 140px; min-height: 36px; }
.mat-add .input { flex: 1 1 70px; }
.mat-add .input:first-child { flex: 3 1 180px; }
.job-check { list-style: none; padding: 0 18px 8px; margin: 0; }
.job-check li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: 14.5px; color: var(--ink); }
.job-check li:first-child { border-top: 0; }
.job-check label { flex: 1; }
.job-check input { width: 18px; height: 18px; }
.photo-grid { display: grid; gap: 14px; padding: 0 18px 18px; }
.photo-grid h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin-bottom: 8px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photo { padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--sunk); cursor: zoom-in; display: grid; place-items: center; }
.photo-img { width: 100%; height: 100%; object-fit: cover; }
.sched-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.sched { border-collapse: collapse; width: 100%; min-width: 900px; table-layout: fixed; }
.sched.day { min-width: 1100px; }
.sched th, .sched td { border: 1px solid var(--line-soft); vertical-align: top; }
.sched thead th { background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; padding: 8px; text-align: left; }
.sched thead th span { color: var(--ink); font-size: 15px; margin-left: 2px; }
.sched thead th.today { color: var(--brand); }
.sched th.who { width: 150px; background: var(--surface-2); font-size: 13.5px; font-weight: 700; padding: 10px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.sched th.who small { display: block; color: var(--faint); font-weight: 600; font-size: 11.5px; margin-top: 2px; }
.sched td { padding: 5px; height: 84px; transition: background .1s; }
.sched td.today { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.sched td.drop, .tray-body.drop { background: color-mix(in srgb, var(--brand) 14%, transparent); box-shadow: inset 0 0 0 2px var(--brand); }
.sched-chip { display: block; width: 100%; text-align: left; font-size: 12px; line-height: 1.3; padding: 5px 7px; margin-bottom: 4px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--c) 35%, var(--line)); border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 9%, var(--surface)); color: var(--ink); cursor: grab; user-select: none; -webkit-user-select: none; font-weight: 600; }
.sched-chip small { display: block; color: var(--muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-chip b { color: var(--muted); font-weight: 700; }
.sched-chip.task { --c: var(--s7); cursor: pointer; font-family: inherit; }
.sched-chip.dragging { opacity: .35; }
.tray { margin-bottom: 14px; }
.tray-body { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 14px 14px; min-height: 50px; border-radius: 10px; }
.tray-body .sched-chip { width: auto; max-width: 260px; }
.sig-wrap { position: relative; margin-top: 12px; }
.sig-pad { width: 100%; height: 180px; border: 1.5px dashed var(--line); border-radius: 12px; background: #fff; display: block; cursor: crosshair; }
.sig-clear { position: absolute; top: 8px; right: 8px; }
.sig-line { position: absolute; left: 16px; right: 16px; bottom: 34px; border-top: 1px solid #c9cde0; font-size: 11px; color: #8c92aa; padding-top: 4px; pointer-events: none; }
.paper .p-sig img { max-height: 70px; max-width: 260px; display: block; border-bottom: 1px solid #c9cde0; }
.paper .p-sig p { font-size: 12px; color: #5a6180; }
.switch { position: relative; display: inline-flex; width: 38px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + span { background: #2440f0; }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 3px solid var(--cta); outline-offset: 2px; }
.goal { display: grid; gap: 10px; }
.goal-top { display: flex; align-items: baseline; gap: 8px; }
.goal-top b { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.goal-track { position: relative; height: 14px; border-radius: 99px; background: var(--sunk); overflow: visible; }
.goal-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #2440f0, #4f6bff); }
.goal-pace { position: absolute; top: -4px; bottom: -4px; width: 3px; border-radius: 3px; background: var(--cta); box-shadow: 0 0 0 2px var(--surface); }
.rank { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--sunk); color: var(--muted); flex: 0 0 auto; }
.mini-list li:first-child .rank { background: var(--cta); color: var(--cta-fg); }
.att-ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--sunk); color: var(--faint); flex: 0 0 auto; }
.att-ic .ic { width: 15px; height: 15px; }
.att-ic.on { background: var(--err-soft); color: var(--err); }
.ic.rot90 { transform: rotate(90deg); }
.task-go { flex: 0 0 auto; margin-top: -2px; }
details.history > summary { list-style: none; cursor: pointer; }
details.history > summary::-webkit-details-marker { display: none; }
.banner.hipaa { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.banner.hipaa > .ic { color: var(--err); }
.edit-list li { flex-wrap: wrap; }
.edit-list li > .input:not([type=color]) { flex: 1 1 140px; width: auto; }
.cal-ev { --c: var(--brand); }
@media (max-width: 899px) {
  .sched th.who { width: 104px; font-size: 12.5px; }
  .timer-chip { height: 34px; padding: 0 10px; font-size: 13px; }
  .mat-add .input { flex: 1 1 28%; }
}

/* ---------- Print ---------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .sidebar, .topbar, .bottom-nav, .fab, #banners, .toolbar, .bulkbar, .no-print, .toasts, .side-stack .actions, .actions, .range-bar, .tabs, .pager, .app-foot, .composer, .icon-btn, .btn { display: none !important; }
  .app { display: block; }
  .view { padding: 0; max-width: none; }
  .card, .list-wrap, .kpi { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .paper { box-shadow: none; padding: 0; max-width: none; }
  .inv-layout, .detail-grid { display: block; }
  .side-stack { display: none; }
  .print-only { display: block !important; }
  a { color: #000; }
  .tbl tbody tr { cursor: default; }
}
.print-only { display: none; }
