/* NWARCH CRM styles. Mobile first: the phone layout is the base, wider screens add to it. */
:root {
  color-scheme: light;
  --bg: #f6f6f3; --surface: #ffffff; --surface-2: #f2f2ee; --ink: #14161a; --ink-2: #52514e; --muted: #898781;
  --line: #e4e3dd; --line-2: #d2d1c9; --accent: #2a78d6; --accent-ink: #1c5cab; --accent-soft: #e8f1fd; --on-accent: #ffffff;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b; --critical-soft: #fdecec; --good-soft: #e9f7e9; --warn-soft: #fff6df;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --track: #e9eff8; --neg: #e34948; --total: #898781;
  --shadow: 0 1px 2px rgba(20, 22, 26, .06), 0 4px 16px rgba(20, 22, 26, .06);
  --radius: 12px; --nav-h: 60px; --top-h: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
    --line: #2c2c2a; --line-2: #383835; --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #14263d; --on-accent: #ffffff;
    --critical-soft: #3a1a1a; --good-soft: #12301a; --warn-soft: #3a2e10;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --track: #1d2a3b; --neg: #e66767; --total: #898781;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
[v-cloak] { display: none; }
.muted { color: var(--muted); } .ink2 { color: var(--ink-2); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .grow { flex: 1; min-width: 0; } .bold { font-weight: 650; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .row.top { align-items: flex-start; } .between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack > *, .detail-grid > *, .dash-grid > *, .dash-col > * { min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide-m { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell */
.app { min-height: 100%; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.side { display: none; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -.02em; font-size: 16px; color: var(--ink); }
.brand .logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: 14px; font-weight: 800; }
.brand .brand-img { height: 30px; width: auto; max-width: 150px; object-fit: contain; display: block; }
.searchbox { position: relative; flex: 1; max-width: 520px; }
.searchbox input { width: 100%; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 12px 0 36px; outline: none; }
.searchbox input:focus { border-color: var(--accent); background: var(--surface); }
.searchbox > .ic { position: absolute; left: 10px; top: 10px; color: var(--muted); }
.results { position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 70vh; overflow: auto; z-index: 30; }
.results a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; color: var(--ink); border-bottom: 1px solid var(--line); }
.results a:last-child { border-bottom: 0; } .results a:hover { background: var(--surface-2); text-decoration: none; }
.page { padding: 14px 12px 24px; max-width: 1440px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { flex: 1 1 auto; min-width: min-content; }
.page-head .btn.primary span { display: none; }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--muted); text-decoration: none; }
.bottomnav a.on { color: var(--accent-ink); font-weight: 650; }
.fab { position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 24; width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; }
.iconbtn { width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); position: relative; flex: none; }
.iconbtn:hover { background: var(--surface-2); }
.badge { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--critical); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }

/* ---------- basics */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 14px; }
.card > .card-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.card > .card-h h3 { flex: 1; }
.card > .card-b { padding: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap; color: var(--ink); text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--critical); border-color: var(--critical); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: default; }
.input, .select, textarea.input { width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); outline: none; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 84px; resize: vertical; }
.select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px; background-size: 5px 5px; background-repeat: no-repeat; }
.select.sm, .input.sm { min-height: 34px; padding: 4px 26px 4px 8px; font-size: 13px; border-radius: 8px; width: auto; }
.select.sm { background-position: calc(100% - 13px) 14px, calc(100% - 8px) 14px; }
label.f { display: block; }
label.f > span, .flabel { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; font-weight: 600; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.req { color: var(--critical); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; white-space: nowrap; color: var(--ink); font-weight: 550; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.good { background: var(--good); } .dot.warn { background: var(--warning); } .dot.serious { background: var(--serious); } .dot.bad { background: var(--critical); } .dot.info { background: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 8px; background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.toggle { cursor: pointer; border: 1px solid var(--line-2); background: var(--surface); padding: 6px 11px; border-radius: 999px; font-size: 13px; color: var(--ink); user-select: none; }
.chip.toggle.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .ic { opacity: .5; margin-bottom: 6px; }
.note { padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; }
.note.bad { background: var(--critical-soft); } .note.good { background: var(--good-soft); } .note.info { background: var(--accent-soft); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 40px; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 9px 12px; cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 0 12px; height: 36px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- lists */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar .input.q { max-width: 260px; min-height: 36px; padding: 4px 10px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; font-weight: 650; color: var(--ink-2); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; background: var(--surface); }
table.t th.nosort { cursor: default; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover { background: var(--surface-2); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cards { display: flex; flex-direction: column; }
.rcard { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--ink); cursor: pointer; }
.rcard:last-child { border-bottom: 0; }
.rcard:active { background: var(--surface-2); }
.rcard:hover { text-decoration: none; }
.rcard .t1 { font-weight: 650; } .rcard .t2 { font-size: 13px; color: var(--ink-2); margin-top: 1px; }
.rcard .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }

/* ---------- KPI tiles & charts */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; display: block; color: var(--ink); }
a.kpi:hover { text-decoration: none; border-color: var(--line-2); }
.kpi .l { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.kpi .v { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 1px; }
.hero .v { font-size: 34px; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(84px, 30%) 1fr; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .lab { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .trk { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-row .bar { height: 16px; min-width: 2px; background: var(--s1); border-radius: 0 4px 4px 0; transition: width .3s; flex: none; }
.bar-row:hover .bar, .bar-row:focus .bar { filter: brightness(1.12); }
.bar-row .val { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.bar-row .val small { font-weight: 400; color: var(--muted); }
.stackbar { display: flex; height: 16px; gap: 2px; min-width: 0; }
.stackbar i { display: block; height: 100%; min-width: 0; }
.stackbar i:last-child { border-radius: 0 4px 4px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.c1 { background: var(--s1); } .c2 { background: var(--s2); } .c3 { background: var(--s3); } .c4 { background: var(--s4); }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: var(--bg); padding: 6px 9px; border-radius: 8px; font-size: 12.5px; max-width: 260px; box-shadow: var(--shadow); }
.tip b { display: block; font-size: 13.5px; }
.funnel-step { display: grid; grid-template-columns: minmax(84px, 30%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.funnel-step .conv { font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 64px; text-align: right; }

/* bridge (waterfall): each bar starts where the previous one ended */
.bridge { display: flex; flex-direction: column; gap: 9px; }
.bridge-row { display: grid; grid-template-columns: minmax(96px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bridge-row .lab { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bridge-row.total .lab { color: var(--ink); font-weight: 650; }
.bridge-row .trk { position: relative; height: 16px; border-left: 1px solid var(--line-2); }
.bridge-row .trk i { position: absolute; top: 0; height: 16px; border-radius: 2px; min-width: 2px; }
.bridge-row .trk i.total { background: var(--total); border-radius: 0 4px 4px 0; }
.bridge-row .trk i.up { background: var(--s1); }
.bridge-row .trk i.down { background: var(--neg); }
.bridge-row:hover .trk i, .bridge-row:focus .trk i { filter: brightness(1.12); }
.bridge-row .val { font-weight: 600; white-space: nowrap; min-width: 96px; text-align: right; }
.bridge-row .val small { font-weight: 400; color: var(--muted); }
/* column chart (monthly trend) */
.cols { display: flex; align-items: flex-end; gap: 2px; height: 190px; border-bottom: 1px solid var(--line-2); padding-top: 18px; position: relative; margin-bottom: 22px; }
.colx { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; }
.colx .cbar { width: 100%; max-width: 24px; background: var(--s1); border-radius: 4px 4px 0 0; }
.colx:hover .cbar, .colx:focus .cbar { filter: brightness(1.12); }
.colx .cval { font-size: 11.5px; font-weight: 650; white-space: nowrap; margin-bottom: 3px; }
.colx .clab { position: absolute; bottom: -20px; font-size: 11px; color: var(--muted); white-space: nowrap; }
/* documents, photos, repeating rows */
.docrow { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.docrow:last-of-type { border-bottom: 0; }
.dropbox { display: flex; gap: 12px; align-items: center; padding: 16px; border: 2px dashed var(--line-2); border-radius: var(--radius); cursor: pointer; color: var(--ink-2); }
.dropbox:hover { border-color: var(--accent); background: var(--accent-soft); }
.modal.pdfv { max-width: 1100px; height: 94vh; max-height: 94vh; }
.modal.pdfv iframe { flex: 1; width: 100%; border: 0; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .iconbtn { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; background: rgba(0, 0, 0, .55); color: #fff; border-radius: 50%; }
.rowcard { display: flex; gap: 6px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--surface-2); }
.rowgrid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; min-width: 0; }
.rowgrid .f:first-child { grid-column: 1 / -1; }
table.t.mini { font-size: 13px; } table.t.mini th, table.t.mini td { padding: 5px 10px 5px 0; }

/* ---------- pipeline board */
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; align-items: flex-start; }
.col { flex: 0 0 84vw; max-width: 320px; scroll-snap-align: start; background: var(--surface-2); border-radius: var(--radius); border: 1px solid var(--line); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.col.over { outline: 2px solid var(--accent); outline-offset: -2px; }
.col-h { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.col-h .n { font-weight: 650; font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.col-h .v { font-size: 12.5px; color: var(--ink-2); }
.col-b { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; }
.deal { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; }
.deal[draggable=true] { cursor: grab; }
.deal.dragging { opacity: .4; }
.deal .co { font-size: 12.5px; color: var(--ink-2); }
.deal .nm { font-weight: 650; font-size: 14px; margin: 1px 0 6px; }
.deal .ft { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
/* Won / Lost drop targets float over the bottom of the screen while dragging, so the board does not jump */
.dropzones { display: none; gap: 10px; }
.dropzones.show { display: grid; grid-template-columns: 1fr 1fr; position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 40; width: min(640px, 90vw); }
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 18px 14px; text-align: center; font-weight: 650; color: var(--ink-2); background: var(--surface); box-shadow: var(--shadow); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- detail */
.detail-head { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px; }
.detail-head .ttl { flex: 1; min-width: 200px; }
.detail-head .ttl h1 { overflow-wrap: anywhere; }
.crumb { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; margin-bottom: 2px; }
.detail-grid { display: grid; gap: 12px; }
/* phone: one column, activity right after the summary. Desktop: two columns. */
.detail-grid.two { display: flex; flex-direction: column; }
.detail-grid.two > .stack { display: contents; }
.o1 { order: 1; } .o2 { order: 2; } .o3 { order: 3; } .o4 { order: 4; } .o5 { order: 5; } .o6 { order: 6; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.fields .fv { min-width: 0; } .fields .fv.wide { grid-column: 1 / -1; }
.fv .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.fv .v { overflow-wrap: anywhere; white-space: pre-wrap; }
.sec-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 16px 0 8px; }
.sec-title:first-child { margin-top: 0; }
.stepper { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.stepper::-webkit-scrollbar { display: none; }
.step { flex: 1 0 auto; min-width: 86px; text-align: center; padding: 8px 10px; font-size: 12.5px; font-weight: 650; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); cursor: pointer; border-radius: 8px; white-space: nowrap; }
.step.done { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.step.now { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.step.won.now { background: var(--good); border-color: var(--good); } .step.lost.now { background: var(--critical); border-color: var(--critical); }
.step[disabled] { cursor: default; }
.timeline { display: flex; flex-direction: column; }
.tl { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tl:last-child { border-bottom: 0; }
.tl .ico { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); flex: none; }
.tl.todo .ico { background: var(--warn-soft); }
.tl .sub { font-size: 12.5px; color: var(--muted); }
.tl .body { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); margin-top: 2px; }
.composer { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--surface-2); margin-bottom: 8px; }
.composer textarea { min-height: 58px; }
.fu { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.fu:last-child { border-bottom: 0; }
.chk { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid var(--line-2); background: none; cursor: pointer; flex: none; display: grid; place-items: center; color: transparent; }
.chk:hover { border-color: var(--good); color: var(--good); }
.fu a.main { color: var(--ink); flex: 1; min-width: 0; }
.fu a.main:hover { text-decoration: none; }
.when { font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.when.late { color: var(--critical); } .when.today { color: var(--accent-ink); }
.score { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; font-size: 15px; border: 3px solid var(--line-2); flex: none; }
.score.hi { border-color: var(--good); } .score.mid { border-color: var(--warning); } .score.lo { border-color: var(--line-2); }
.meter { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--s1); border-radius: 4px; }

/* ---------- modal / sheets / toasts */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 16, .5); display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); width: 100%; max-height: 94vh; border-radius: 16px 16px 0 0; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.modal-h h2 { flex: 1; }
.modal-b { padding: 14px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.modal-f .btn { flex: 1; }
.modal-f.wrapf { flex-wrap: wrap; align-items: center; }
.callnum { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.callnum a { flex: 1; min-width: 0; font-size: 22px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
details.sec { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 4px; }
details.sec > summary { cursor: pointer; padding: 10px 0; font-weight: 650; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 6px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::before { content: '+'; width: 18px; height: 18px; border-radius: 5px; background: var(--surface-2); display: inline-grid; place-items: center; font-size: 14px; color: var(--ink-2); }
details.sec[open] > summary::before { content: '\2212'; }
.picker { position: relative; }
.picker .opts { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); max-height: 240px; overflow: auto; }
.picker .opt { padding: 9px 11px; cursor: pointer; border-bottom: 1px solid var(--line); font-size: 14px; }
.picker .opt:last-child { border-bottom: 0; }
.picker .opt:hover { background: var(--surface-2); }
.picker .clear { position: absolute; right: 6px; top: 6px; }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); max-width: 520px; }
.toast.err { background: var(--critical); color: #fff; }
.menu { position: absolute; right: 0; top: 42px; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: 230px; padding: 6px; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; color: var(--ink); font-size: 14px; }
.menu button:hover, .menu a:hover { background: var(--surface-2); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.rel { position: relative; }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.more-grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 6px; text-align: center; font-size: 12.5px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-weight: 600; }
.more-grid a:hover { text-decoration: none; background: var(--surface-2); }
.more-grid .ic { color: var(--accent-ink); }

/* ---------- login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 400px; padding: 24px; }
.auth h1 { margin: 14px 0 4px; }

/* ---------- quote */
.items td { padding: 6px 6px; } .items .input { min-height: 36px; padding: 4px 8px; }
.totals { margin-left: auto; width: 100%; max-width: 340px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .grand { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 17px; }
.totals .amcsep { margin-top: 12px; padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: 8px; font-size: 14px; align-items: center; gap: 10px; }
.matrix select { min-width: 140px; }
.card > .card-h.wrap-h { flex-wrap: wrap; }
.qitems { min-width: 820px; } /* scrolls sideways on a phone instead of squeezing the inputs */
.qitems td { vertical-align: top; }
.qitems .qdesc { min-height: 52px; margin-top: 6px; font-size: 13px; }
.qitems tr.autorow td { background: var(--accent-soft); }
.qitems .num.right { padding-top: 8px; }
textarea.qtext { min-height: 260px; line-height: 1.5; }
.qb { background: var(--accent-soft); display: flex; flex-direction: column; gap: 8px; }
.qb-h { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin-top: 10px; }
.qb-grid { gap: 10px 14px; }
.qb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; padding: 8px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.qb-row > :first-child, .qb-row .qb-wide { grid-column: 1 / -1; }
.qb-svc { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.qb-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line-2); padding-top: 10px; margin-top: 6px; }
.logo-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-top: 12px; }
.logo-box { width: 200px; height: 90px; padding: 8px; border: 1px dashed var(--line-2); border-radius: 10px; background: #fff; display: grid; place-items: center; flex: none; }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }

/* ---------- wider screens */
@media (min-width: 720px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .rowgrid { grid-template-columns: 2fr 1fr 2fr; }
  .rowgrid .f:first-child { grid-column: auto; }
  .bridge-row { grid-template-columns: 200px 1fr auto; }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 12px 16px; }
  .form-grid .wide { grid-column: 1 / -1; }
  .overlay { align-items: center; padding: 20px; }
  .modal { max-width: 720px; border-radius: 16px; max-height: 90vh; }
  .modal.narrow { max-width: 480px; }
  .modal.wide { max-width: 980px; }
  .modal-f .btn { flex: none; min-width: 96px; }
  .fields { grid-template-columns: repeat(3, 1fr); }
  .qb-row { grid-template-columns: minmax(0, 1fr) 80px 120px auto 34px; }
  .qb-row > :first-child { grid-column: auto; }
  .more-grid { grid-template-columns: repeat(5, 1fr); }
  .col { flex: 0 0 272px; }
  .bar-row, .funnel-step { grid-template-columns: 150px 1fr; }
  .funnel-step { grid-template-columns: 150px 1fr auto; }
}
@media (min-width: 980px) {
  .hide-m { display: revert !important; }
  .hide-d { display: none !important; }
  .app { display: grid; grid-template-columns: 228px 1fr; padding-bottom: 0; }
  .side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); padding: 12px 10px; overflow-y: auto; }
  .side .brand { padding: 4px 8px 14px; }
  .side .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 14px 10px 4px; }
  .side a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--ink-2); font-weight: 550; font-size: 14px; text-decoration: none; }
  .side a:hover { background: var(--surface-2); }
  .side a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
  .side a .cnt { margin-left: auto; font-size: 11.5px; background: var(--critical); color: #fff; border-radius: 9px; padding: 0 6px; font-weight: 700; }
  .bottomnav, .fab { display: none; }
  .topbar { padding: 0 20px; }
  .topbar .brand { display: none; }
  .page { padding: 20px 24px 40px; }
  .detail-grid.two { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); align-items: start; }
  .detail-grid.two > .stack { display: flex; }
  .dash-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .page-head .btn.primary span { display: inline; }
  .col { flex: 0 0 248px; }
  table.t td:first-child { min-width: 150px; }
  .kpis.six { grid-template-columns: repeat(4, 1fr); }
  .kpis.five { grid-template-columns: repeat(5, 1fr); }
  .kpis.three { grid-template-columns: repeat(3, 1fr); }
  .kpis.five .kpi .v { font-size: 20px; }
  .toasts { bottom: 20px; }
  .col { max-height: calc(100vh - 200px); }
}
.dash-grid { display: grid; gap: 12px; }
.dash-col { display: flex; flex-direction: column; gap: 12px; }

/* ---------- print (quotes) */
.print-only { display: none; }
/* Settings > Fields & modules */
.fm { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.fm-pick { padding: 12px; }
.modlist { display: none; padding: 6px; max-height: calc(100vh - 230px); overflow-y: auto; }
.modlist button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border: 0; background: none; text-align: left; cursor: pointer; border-radius: 8px; color: var(--ink); font-size: 14px; }
.modlist button:hover { background: var(--surface-2); }
.modlist button.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.modlist .n { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.modlist .n .c { color: var(--accent-ink); }
.tag { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap; vertical-align: middle; }
.fm-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 12px 16px; }
.fm-tools .input.q { max-width: 280px; min-height: 36px; padding: 4px 10px; }
.fsec-h { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 16px; background: var(--surface-2); border-top: 1px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--ink-2); }
.fsec-h .n { color: var(--muted); font-weight: 500; letter-spacing: 0; }
.fsec-h .btn { text-transform: none; letter-spacing: 0; }
.frow { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n s" "t t" "v v"; gap: 2px 12px; padding: 10px 16px; border-top: 1px solid var(--line); align-items: start; }
.frow .fn { grid-area: n; min-width: 0; } .frow .ft { grid-area: t; } .frow .fvals { grid-area: v; min-width: 0; overflow-wrap: anywhere; } .frow .fs { grid-area: s; display: flex; align-items: center; gap: 2px; }
.frow .fs .iconbtn { width: 30px; height: 30px; }
.frow.head { display: none; }
.frow.hl { background: var(--warn-soft); } .frow.bad { background: var(--critical-soft); }
.src { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; margin-right: 4px; }
.src.custom { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); font-weight: 650; }
.src.auto { border-style: dashed; }
.fform { margin: 10px 0 12px; padding: 14px; border-color: var(--accent); background: var(--surface); box-shadow: var(--shadow); }
.fm-foot { padding: 12px 16px; border-top: 1px solid var(--line); }
@media (min-width: 980px) {
  .fm { grid-template-columns: 260px minmax(0, 1fr); align-items: start; }
  .fm-side { position: sticky; top: calc(var(--top-h) + 12px); }
  .fm-pick { display: none; } .modlist { display: block; }
  .frow { grid-template-columns: minmax(0, 1.5fr) minmax(0, .8fr) minmax(0, 1.9fr) 160px; grid-template-areas: "n t v s"; gap: 4px 16px; }
  .frow .fs { justify-content: flex-end; }
  .frow.head { display: grid; padding-top: 8px; padding-bottom: 8px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 650; color: var(--muted); }
}
@media print {
  body { background: #fff; color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 11pt; }
  .app > .side, .topbar, .bottomnav, .fab, .no-print, .toasts { display: none !important; }
  .app { display: block; padding: 0; }
  .page { padding: 0; max-width: none; }
  .card { border: 0; }
  .print-only { display: block; }
  /* the quotation: black and white, grey table header, zebra rows, A4 portrait */
  /* the quotation prints on its own page type with no page margin, so the browser has no room for its date, title and address
     header and footer; the margin is padding instead, repeated on every page */
  .qdoc { page: quotation; padding: 13mm 12mm; box-decoration-break: clone; -webkit-box-decoration-break: clone; font-size: 9.5pt; line-height: 1.35; color: #000; }
  .qdoc table { width: 100%; border-collapse: collapse; }
  .qdoc .r { text-align: right; white-space: nowrap; }
  .qd-head td { vertical-align: top; padding: 0 0 10px; }
  .qd-logo { max-height: 18mm; max-width: 62mm; display: block; margin-bottom: 4px; }
  .qd-name { font-size: 13pt; font-weight: bold; }
  .qd-small { font-size: 8.5pt; color: #333; }
  .qd-meta { width: 42%; text-align: right; }
  .qd-title { font-size: 18pt; font-weight: bold; letter-spacing: .06em; margin-bottom: 4px; }
  .qd-meta table { width: auto; margin-left: auto; }
  .qd-meta td { padding: 1px 0 1px 12px; text-align: right; }
  .qd-to { margin: 4px 0 12px; border-top: 1.5px solid #000; border-bottom: 1px solid #999; }
  .qd-to td { width: 33%; vertical-align: top; padding: 7px 10px 7px 0; }
  .qd-label { font-size: 7.5pt; text-transform: uppercase; letter-spacing: .08em; color: #555; font-weight: bold; }
  .qd-items th { background: #d9d9d9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; text-align: left; padding: 5px 6px; border: 1px solid #999; font-size: 8.5pt; }
  .qd-items td { padding: 5px 6px; border: 1px solid #bbb; vertical-align: top; }
  .qd-items tbody tr:nth-child(even) td { background: #f3f3f3 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .qd-items tr { page-break-inside: avoid; }
  .qd-desc { font-size: 8pt; color: #444; white-space: pre-line; }
  .qdoc .qd-tot { width: 55%; margin: 6px 0 0 auto; }
  .qd-tot td { padding: 3px 6px; border-bottom: 1px solid #ddd; }
  .qd-tot tr.b td { font-weight: bold; border-top: 1.5px solid #000; }
  .qd-amc { margin-top: 14px; page-break-inside: avoid; }
  .qd-amc-h { font-size: 10pt; font-weight: bold; margin-bottom: 4px; }
  .qd-amc .qd-items tbody tr:nth-child(even) td { background: none !important; }
  .qd-sec { margin-top: 14px; }
  .qdoc .qd-sec h2 { font-size: 11pt; font-weight: bold; border-bottom: 1px solid #000; padding-bottom: 2px; margin: 0 0 6px; page-break-after: avoid; }
  .qdoc .qd-sec h3 { font-size: 9.5pt; font-weight: bold; margin: 8px 0 3px; page-break-after: avoid; }
  .qd-sec p { margin: 0 0 4px; }
  .qd-li { position: relative; padding-left: 14px; margin: 0 0 2px; }
  .qd-li::before { content: '\2022'; position: absolute; left: 3px; }
  .qd-gap { height: 4px; }
  .qdoc .qd-sign { margin-top: 26px; page-break-inside: avoid; }
  .qd-sign td { width: 50%; vertical-align: top; padding-right: 30px; }
  .qd-line { border-bottom: 1px solid #000; height: 34px; margin: 6px 0 4px; }
  @page { size: A4 portrait; margin: 14mm 12mm; }
  @page quotation { size: A4 portrait; margin: 0; }
}

/* Google Calendar setup steps, inline code */
.steps { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 8px; line-height: 1.5; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
.bad-text { color: var(--critical); }

/* Help & FAQ */
.help { max-width: 860px; }
.help .help-search { max-width: none; margin-bottom: 12px; }
.help .help-search input { height: 44px; font-size: 15px; background: var(--surface); }
.help .help-search > .ic { top: 13px; }
.help-popular { margin-bottom: 14px; }
.help-popular .chip { text-decoration: none; }
.help-popular .chip:hover { border-color: var(--accent); text-decoration: none; }
.faq { border-top: 1px solid var(--line); scroll-margin-top: 76px; }
.faq-q { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px; border: 0; background: none; text-align: left; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.faq-q:hover { background: var(--surface-2); }
.faq-q .chip { font-weight: 500; font-size: 11.5px; padding: 1px 8px; }
.faq-arrow { flex: none; color: var(--muted); transition: transform .15s; }
.faq.on .faq-arrow { transform: rotate(180deg); }
.faq-a { padding: 0 16px 14px; color: var(--ink-2); line-height: 1.55; font-size: 14px; }
.faq-a p { margin: 0 0 8px; }
.faq-a ul, .faq-a ol { margin: 0 0 8px; padding-left: 20px; }
.faq-a li { margin-bottom: 3px; }
.faq-a b { color: var(--ink); }
.faq-share { margin-left: -10px; color: var(--muted); }

/* Settings > Import from Zoho */
.zi-owner { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(170px, 1fr); gap: 8px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.zi-owner:first-of-type { border-top: 0; }
.zi-map { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 6px 14px; align-items: center; margin: 10px 0 4px; max-width: 640px; }
.zi-issue { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 6px; }
.zi-issue:first-child { border-top: 0; padding-top: 0; }
.zi-list { margin: 0; padding-left: 18px; display: grid; gap: 2px; }
details > summary { cursor: pointer; padding: 4px 0; }
@media (min-width: 760px) { .zi-owner { grid-template-columns: 200px 220px minmax(120px, 1fr) minmax(160px, 1.2fr) 170px; } }
