:root {
  --bg: #f5f7fa; --panel: #ffffff; --text: #1d2733; --muted: #66727f; --line: #dfe4ea;
  --brand: #1f5f8b; --brand-ink: #ffffff; --ok: #1e7b4a; --warn: #a86100; --bad: #b3261e; --chip: #eef2f6;
  --radius: 10px;
  font-family: Inter, "Noto Sans Sinhala", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #12161b; --panel: #1b2128; --text: #e6ebf0; --muted: #9aa6b2; --line: #2c343d;
          --brand: #5aa6d6; --brand-ink: #0d1a24; --ok: #5cc48c; --warn: #e0a24a; --bad: #ef7b72; --chip: #232b34; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--brand); }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 10px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.right { text-align: right; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }

/* layout: dark sidebar + white top bar */
:root { --side-bg: #1f2430; --side-ink: #c4cad6; --side-dim: #8a93a5; --side-hover: rgba(255,255,255,.06); --side-active: rgba(255,255,255,.11);
        --side-accent: #4ea3e0; --page: #f1f3f6; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06); }
@media (prefers-color-scheme: dark) { :root { --side-bg: #11151c; --page: #0f1318; --shadow: none; } }
body { background: var(--page); }
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .2s; }
.side { background: var(--side-bg); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
        display: flex; flex-direction: column; padding: 0 12px 14px; scrollbar-width: thin; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 6px 18px; text-align: center; }
.brand .logo { width: 92px; height: 92px; border-radius: 50%; background: #fff; display: grid; place-items: center; overflow: hidden;
               box-shadow: 0 0 0 4px rgba(255,255,255,.08); flex: none; }
.brand .logo img { width: 78%; height: 78%; object-fit: contain; }
.brand .logo.txt { background: var(--side-accent); color: #fff; font-size: 30px; font-weight: 700; }
.brand .bname { color: #fff; font-weight: 600; font-size: 15px; line-height: 1.3; }
.side nav { flex: 1; }
.side .nav { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin: 1px 0; border-radius: 8px;
             color: var(--side-ink); text-decoration: none; background: none; font: inherit; font-size: 14.5px; text-align: left; cursor: pointer; white-space: nowrap; }
.side .nav:hover { background: var(--side-hover); color: #fff; }
.side .nav.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--side-accent); }
.side .nav span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.ic { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side .nav .ic { color: var(--side-dim); } .side .nav:hover .ic, .side .nav.active .ic { color: #fff; }
.grp .chev { width: 15px; height: 15px; transition: transform .15s; }
.grp.open .chev { transform: rotate(90deg); }
.grp.has-active > .grp-h { color: #fff; }
.grp-b { display: none; padding-left: 12px; margin-left: 21px; border-left: 1px solid rgba(255,255,255,.08); }
.grp.open .grp-b { display: block; }
.grp-b .nav { padding: 8px 10px; font-size: 14px; }
.side .logout { margin-top: 10px; border-top: 1px solid rgba(255,255,255,.08); border-radius: 0; padding-top: 14px; }

/* collapsed rail (desktop) */
.shell.min { grid-template-columns: 72px minmax(0, 1fr); }
.shell.min .side { padding: 0 10px 14px; }
.shell.min .brand { padding: 16px 0 12px; }
.shell.min .brand .logo { width: 44px; height: 44px; } .shell.min .brand .logo.txt { font-size: 16px; }
.shell.min .bname, .shell.min .side .nav span, .shell.min .grp-h { display: none; }
.shell.min .grp-b { display: block; padding: 0; margin: 0; border: 0; }
.shell.min .side .nav { justify-content: center; padding: 11px 0; }
.scrim { display: none; }

.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 12px; padding: 10px 24px;
          background: var(--panel); border-bottom: 1px solid var(--line); }
.icon-btn { background: none; color: var(--text); padding: 7px; border-radius: 8px; line-height: 0; }
.icon-btn:hover { background: var(--chip); }
.icon-btn .ic { width: 22px; height: 22px; }
.gsearch { display: flex; align-items: center; gap: 8px; max-width: 380px; background: var(--chip); border-radius: 8px; padding: 0 12px; color: var(--muted); }
.gsearch input { border: 0; background: none; padding: 9px 0; min-width: 0; }
.gsearch input:focus { outline: none; }
.gsearch:focus-within { box-shadow: 0 0 0 2px var(--brand); }
.topbar .lang { width: auto; padding: 6px 8px; font-size: 13px; }
.user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.who { display: flex; flex-direction: column; line-height: 1.2; font-size: 14px; }
.who small { color: var(--muted); font-size: 12px; }
.main { padding: 20px 24px 60px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 19px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.crumb { color: var(--muted); font-size: 13px; } .crumb span { margin: 0 4px; }

@media (max-width: 900px) {
  .shell, .shell.min { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.min .side { padding: 0 12px 14px; }
  .shell.min .bname, .shell.min .side .nav span { display: block; } .shell.min .grp-h { display: flex; }
  .shell.min .side .nav { justify-content: flex-start; padding: 10px 12px; }
  .shell.min .grp-b { display: none; padding-left: 12px; margin-left: 21px; border-left: 1px solid rgba(255,255,255,.08); }
  .shell.min .grp.open .grp-b { display: block; }
  .shell.min .brand .logo { width: 92px; height: 92px; }
  .shell.open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .shell.open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .who { display: none; }
  .main { padding: 14px 14px 60px; }
}
@media (max-width: 520px) { .topbar .lang { max-width: 84px; } }

/* dashboard count cards (coloured icon squares) */
/* 1px gaps over a line-coloured background draw the dividers, however the cards wrap */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1px; margin-bottom: 16px; overflow: hidden;
              background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; background: var(--panel); }
.stat-card .l { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.stat-card .v { font-size: 26px; font-weight: 700; margin: 2px 0 2px; }
.stat-card a { font-size: 13px; text-decoration: none; font-weight: 500; }
.stat-card .sq { width: 48px; height: 48px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.stat-card .sq .ic { width: 24px; height: 24px; }
.sq.yellow { background: #f2b01e; } .sq.orange { background: #ee6a3c; } .sq.blue { background: #2f9bd6; } .sq.green { background: #2fb889; }

/* components */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card > h2:first-child { font-size: 16px; margin-bottom: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 480px) { .kpi .v { font-size: 18px; } .kpis { gap: 8px; } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi .v { font-size: 22px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
.tbl-wrap { border: 1px solid var(--line); border-radius: 8px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 13px; color: var(--text); font-weight: 600; background: var(--chip); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--chip) 55%, transparent); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }

button, .btn { background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 8px; padding: 9px 14px;
               font: inherit; cursor: pointer; text-decoration: none; display: inline-block; }
button.ghost { background: var(--chip); color: var(--text); }
a.btn.sm { padding: 5px 9px; font-size: 13px; }
button.act { width: 30px; height: 30px; padding: 0; display: inline-grid; place-items: center; border-radius: 6px; color: #fff; }
button.act .ic { width: 16px; height: 16px; stroke-width: 2.2; }
button.act.blue { background: #2f9bd6; } button.act.orange { background: #ee6a3c; }
button.act:hover { filter: brightness(.92); }
button.sm { padding: 5px 9px; font-size: 13px; }
button.danger { background: var(--bad); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
                          border-radius: 8px; padding: 9px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label > input, label > select, label > textarea { margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 12px; }
td input { padding: 6px; min-width: 70px; }
.disc { display: flex; gap: 4px; min-width: 150px; }
.disc input { flex: 1; } .disc select { width: auto; padding: 6px 4px; }

.chip { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--chip); font-size: 12px; }
.chip.ok { color: var(--ok); } .chip.warn { color: var(--warn); } .chip.bad { color: var(--bad); }
/* status pills (Paid, Unpaid…): solid like the reference design */
.chip.st { font-weight: 600; padding: 3px 10px; border-radius: 6px; }
.chip.st.ok { background: #1f9d55; color: #fff; } .chip.st.warn { background: #f2b01e; color: #3b2a00; } .chip.st.bad { background: #d64545; color: #fff; }
.chip.st:not(.ok):not(.warn):not(.bad) { background: var(--chip); color: var(--text); }
.banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; background: var(--chip); }
.banner.bad { color: var(--bad); } .banner.warn { color: var(--warn); }

.search-results { border: 1px solid var(--line); border-radius: 8px; margin-top: 4px; max-height: 260px; overflow: auto; background: var(--panel); }
.search-results div { padding: 8px 10px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.search-results div:hover, .search-results div.sel { background: var(--chip); }
.totals { margin-left: auto; max-width: 320px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; font-variant-numeric: tabular-nums; }
.totals .gt { font-weight: 600; font-size: 18px; border-top: 1px solid var(--line); padding-top: 8px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow: auto; }
.modal-box { background: var(--panel); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 640px; }
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 60; max-width: 90vw; }

.auth { max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.otp-in { font-size: 28px; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; padding: 12px; }

/* calendar: colour = appointment type, badges = priority / warranty, dashed = waiting for confirmation */
:root { --ty-sales_visit: #3b6fd8; --ty-site_inspection: #8a55d0; --ty-repair: #d9731f; --ty-maintenance: #16917f; --ty-consultation: #4f8f32; }
@media (prefers-color-scheme: dark) {
  :root { --ty-sales_visit: #7aa2f0; --ty-site_inspection: #b48ef0; --ty-repair: #f0a060; --ty-maintenance: #4cc7b4; --ty-consultation: #8cc46a; }
}
.ty-sales_visit { --c: var(--ty-sales_visit); } .ty-site_inspection { --c: var(--ty-site_inspection); } .ty-repair { --c: var(--ty-repair); }
.ty-maintenance { --c: var(--ty-maintenance); } .ty-consultation { --c: var(--ty-consultation); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); vertical-align: middle; }
.chip.pr-urgent { background: var(--bad); color: #fff; } .chip.pr-high { background: var(--warn); color: #fff; } .chip.pr-low { color: var(--muted); }
.chip.wr-ok { background: color-mix(in srgb, var(--ok) 18%, var(--panel)); color: var(--ok); }
.chip.wr-bad { background: color-mix(in srgb, var(--bad) 15%, var(--panel)); color: var(--bad); }

.cal-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.cal-bar h2 { margin: 0 8px; min-width: 150px; text-align: center; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .wd { font-size: 12px; color: var(--muted); padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.cal .cell { min-height: 108px; padding: 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0; background: var(--panel); }
.cal .cell:hover { background: var(--chip); }
.cal .cell.out { opacity: .45; }
.cal .cell.today .num { background: var(--brand); color: var(--brand-ink); border-radius: 99px; padding: 0 7px; }
.cal .cell.blocked { background: repeating-linear-gradient(135deg, var(--panel), var(--panel) 6px, var(--chip) 6px, var(--chip) 12px); }
.cal .num { font-size: 12px; font-weight: 600; display: inline-block; margin-bottom: 3px; }
.ev { display: flex; gap: 4px; align-items: center; font-size: 12px; line-height: 1.25; padding: 2px 4px; margin-bottom: 2px; border-radius: 4px;
      border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 16%, var(--panel)); overflow: hidden; white-space: nowrap; }
.ev .tx { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.ev.requested { border: 1px dashed var(--c); border-left-width: 4px; background: var(--panel); }
.ev.done { opacity: .55; text-decoration: line-through; }
.ev .b { font-size: 10px; font-weight: 700; border-radius: 3px; padding: 0 3px; flex: none; }
.ev .b.pu { background: var(--bad); color: #fff; } .ev .b.ph { background: var(--warn); color: #fff; }
.ev .b.wv { background: var(--ok); color: #fff; } .ev .b.wx { background: var(--chip); color: var(--bad); }
.ev.blk { --c: var(--muted); background: var(--chip); color: var(--muted); }
.more { font-size: 11px; color: var(--muted); }
@media (max-width: 700px) {
  .cal .cell { min-height: 58px; padding: 3px; }
  .cal .cell .ev { display: inline-block; width: 9px; height: 9px; padding: 0; margin: 1px; border: 0; border-radius: 50%; background: var(--c); }
  .cal .cell .ev > * { display: none; }
  .cal .cell .ev.requested { background: transparent; border: 2px solid var(--c); }
  .cal .cell .more { display: none; }
}
.agenda .item { display: flex; gap: 10px; padding: 10px; border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.agenda .item.requested { border-style: dashed; border-left-style: solid; }
.agenda .item .when { font-weight: 600; min-width: 52px; }
.agenda .item .body { flex: 1; min-width: 200px; }
.agenda .item .acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* charts: blue = selected year, orange = previous year (validated colour-blind safe pair, light + dark);
   invoice status uses the fixed status palette, always with an icon + label */
:root { --viz-cur: #2a78d6; --viz-prev: #eb6834; --st-good: #0ca30c; --st-warn: #fab219; --st-crit: #d03b3b;
        --viz-grid: #e1e0d9; --viz-axis: #c3c2b7; --viz-muted: #898781; }
@media (prefers-color-scheme: dark) {
  :root { --viz-cur: #3987e5; --viz-prev: #d95926; --viz-grid: #2c2c2a; --viz-axis: #383835; }
}
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { margin: 0; min-width: 130px; flex: 0 1 180px; }
.viz { position: relative; }
.viz svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz text { fill: var(--viz-muted); font-size: 11px; font-family: inherit; }
.viz .gl { stroke: var(--viz-grid); stroke-width: 1; }
.viz .base { stroke: var(--viz-axis); stroke-width: 1; }
.viz .hit { fill: transparent; cursor: default; }
.viz .hit:hover { fill: var(--chip); opacity: .6; }
.viz .seg { stroke: var(--panel); stroke-width: 2; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.viz-tip { position: absolute; pointer-events: none; background: var(--panel); color: var(--text); border: 1px solid var(--line);
           border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.12); white-space: nowrap; z-index: 5; }
.viz-tip b { font-variant-numeric: tabular-nums; }
.dash-charts { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 24px; }
@media (max-width: 1250px) { .dash-charts { grid-template-columns: 1fr; } }
.donut-wrap { display: grid; grid-template-columns: minmax(140px, 190px) minmax(240px, 1fr); gap: 20px; align-items: center; max-width: 620px; }
@media (max-width: 520px) { .donut-wrap { grid-template-columns: 1fr; } .donut-wrap .viz { max-width: 220px; margin: 0 auto; } }
.stat-list { display: grid; gap: 8px; }
.stat-list .r { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 14px; }
.stat-list .r .v { font-variant-numeric: tabular-nums; text-align: right; }
.stat-list .r .ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; }
.pct-bar { display: inline-block; height: 6px; border-radius: 3px; background: var(--viz-cur); vertical-align: middle; margin-right: 6px; }
.chip.sp-fast { background: color-mix(in srgb, var(--ok) 18%, var(--panel)); color: var(--ok); }
.chip.sp-medium { color: var(--text); } .chip.sp-slow { color: var(--warn); } .chip.sp-none { color: var(--muted); }
td.neg { color: var(--bad); }

.list-bar { margin-bottom: 12px; align-items: flex-end; }
.year-pick { margin: 0; display: flex; align-items: center; gap: 8px; }
.year-pick select { width: auto; margin: 0; }
/* feature switches */
.feat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.feat { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin: 0; color: var(--text); cursor: pointer; }
.feat small { display: block; color: var(--muted); font-size: 12px; }
.feat.na { opacity: .6; cursor: default; }
.otp-box { margin: 6px 0 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 8px; }

/* SMS templates */
.tpl-list .tpl { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; padding: 8px 12px; background: var(--panel); }
.tpl-list .tpl summary { cursor: pointer; display: flex; align-items: center; gap: 10px; list-style: none; }
.tpl-list .tpl summary::-webkit-details-marker { display: none; }
.tpl-list .tpl[open] summary { margin-bottom: 4px; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; margin: 0; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .15s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset { background: var(--panel); color: var(--text); border: 1px solid var(--line); padding: 6px; display: grid; grid-template-columns: repeat(3, 18px); gap: 3px;
          align-items: center; border-radius: 8px; }
.preset span { width: 18px; height: 18px; border-radius: 4px; display: block; }
.preset small { grid-column: 1 / -1; font-size: 11px; color: var(--muted); }
.preset:hover { border-color: var(--brand); }
.colour-in { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.colour-in input[type=color] { width: 54px; height: 38px; padding: 2px; cursor: pointer; }
.colour-in code { font-size: 13px; color: var(--text); }
.theme-doc { overflow-x: auto; background: #e9edf2; padding: 12px; border-radius: 8px; }
.theme-doc .doc { max-width: 760px; margin: 0 auto; }
.co-in { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.co-in input[type=text], .co-in input[type=tel], .co-in input[type=email] { flex: 1; margin: 0; }
.show-tog { display: inline-flex; align-items: center; gap: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
            color: var(--text); font-size: 13px; white-space: nowrap; margin: 0; }
.show-tog input { width: auto; margin: 0; }
.show-tog:has(input:not(:checked)) { opacity: .5; text-decoration: line-through; }
.pw-confirm { margin-top: 6px; padding: 10px; border-radius: 8px; background: var(--chip); color: var(--text); }

/* quick estimate customer picker */
.cust-pick { position: relative; }
.cust-res { position: absolute; left: 0; right: 0; top: 100%; z-index: 10; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.cust-res .add { color: var(--brand); font-weight: 600; justify-content: flex-start; border-top: 1px solid var(--line); }
.cust-sel { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--chip); }

/* settings section picker, logo, photos */
.sec-pick { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.sec-pick select { max-width: 340px; }
.logo-prev { max-height: 80px; max-width: 220px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.brand img { max-height: 40px; max-width: 160px; display: block; margin-bottom: 6px; }
.doc .logo { max-height: 72px; max-width: 200px; display: block; margin-bottom: 8px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 8px; }
.photos a { display: block; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--chip); }
.photos img { width: 100%; height: 100px; object-fit: cover; display: block; }
.photos small { display: block; padding: 4px 6px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.req-row label { margin: 0; display: inline-flex; gap: 6px; align-items: center; color: var(--text); }
.req-row input[type=checkbox] { width: auto; }

/* packages */
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.plan { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--panel); }
.plan.cur { border: 2px solid var(--brand); }
.plan .price { font-size: 22px; font-weight: 600; }
.plan ul { margin: 0; padding-left: 18px; font-size: 13px; }
.plan ul li.no { color: var(--muted); text-decoration: line-through; }
.bar { height: 8px; background: var(--chip); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--ok); }
.bar i.warn { background: var(--warn); } .bar i.bad { background: var(--bad); }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: var(--chip); color: var(--text); } .tabs button.on { background: var(--brand); color: var(--brand-ink); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 12px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--text); font-size: 14px; }
.checks input { width: auto; margin: 0; }

/* printable documents */
.doc { background: #fff; color: #111; padding: 28px; max-width: 800px; margin: 0 auto; font-size: 13px; }
.doc h1 { font-size: 20px; letter-spacing: .05em; }
.doc table th { color: #444; }
.doc .head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #111; padding-bottom: 12px; margin-bottom: 14px; }
.doc .warranty { margin-top: 18px; padding: 10px; border: 1px solid #999; white-space: pre-wrap; }
.doc .sign { margin-top: 50px; display: flex; justify-content: space-between; }
.doc .sign div { border-top: 1px solid #111; padding-top: 4px; width: 200px; text-align: center; }
/* document layout (estimate / invoice / tax invoice / delivery note); --da = business document colour, --db = light band */
.doc.doc2 { font-size: 12px; color: #2b2f36; line-height: 1.45; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc2 .d2-top { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.doc2 .d2-logo .logo { max-height: 150px; max-width: 260px; margin: 18px 0 0; }
.doc2 .d2-name-big { font-size: 24px; font-weight: 700; color: var(--da); margin-top: 24px; }
.doc2 .d2-co { text-align: right; color: #555; font-size: 11px; line-height: 1.55; }
.doc2 .d2-co b { color: #2b2f36; }
.doc2 .d2-title { font-size: 30px; letter-spacing: .14em; font-weight: 300; color: #2b2f36; text-transform: uppercase; margin-bottom: 12px; line-height: 1.1; }
.doc2 .d2-gap { height: 10px; }
.doc2 .d2-mid { display: flex; justify-content: space-between; gap: 24px; margin: 26px 0 18px; }
.doc2 .d2-lbl { font-weight: 700; text-transform: uppercase; font-size: 11px; color: #2b2f36; margin-bottom: 2px; }
.doc2 .d2-bill { font-size: 11px; color: #444; }
.doc2 table.d2-meta { width: auto; border-collapse: collapse; font-size: 11px; }
.doc2 table.d2-meta td { border: 0; padding: 2px 0 2px 34px; background: none; color: #555; }
.doc2 table.d2-meta td:last-child { text-align: right; color: #2b2f36; }
.doc2 table.d2-meta tr.d2-pm td { padding-top: 12px; }
.doc2 table.d2-items { width: 100%; border-collapse: collapse; }
.doc2 table.d2-items th { background: var(--db); color: var(--dbi); text-transform: uppercase; font-size: 10.5px; letter-spacing: .03em;
                          font-weight: 700; padding: 9px 10px; border: 0; }
.doc2 table.d2-items td { padding: 9px 10px; border-bottom: 1px solid #e3e6ea; font-size: 11px; background: none; }
.doc2 .d2-sn { font-size: 10px; color: #666; }
.doc2 .d2-totals { margin: 10px 0 0 auto; width: 46%; min-width: 250px; font-size: 11px; }
.doc2 .d2-totals > div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #e3e6ea; font-variant-numeric: tabular-nums; }
.doc2 .d2-totals .d2-tot { font-weight: 700; }
.doc2 .d2-totals .d2-due { border-top: 2px solid var(--da); border-bottom: 0; margin-top: 2px; padding-top: 10px; font-size: 15px; font-weight: 700; }
.doc2 .d2-totals .d2-due span:last-child { font-weight: 400; font-size: 17px; }
.doc2 .d2-sign { display: flex; justify-content: flex-end; gap: 40px; margin-top: 20px; }
.doc2 .d2-sig { text-align: right; min-width: 200px; }
.doc2 .d2-lbl2 { font-weight: 700; font-size: 11px; }
.doc2 .esign2 { display: block; max-height: 70px; max-width: 230px; margin: 10px 0 0 auto; }
.doc2 .d2-line { border-bottom: 1px solid #444; height: 50px; }
.doc2 .d2-small { font-size: 11px; }
.doc.doc2 .special-note { border-left-color: var(--da); }
.doc2 .d2-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-top: 28px; font-size: 11px; }
.doc2 .d2-pay { flex: 1; } .doc2 .d2-pay > div { margin-top: 3px; }
.doc2 .d2-pt { color: var(--da); font-weight: 700; text-transform: uppercase; font-size: 11px; border-bottom: 1px solid #c9ced6; padding-bottom: 5px; margin-bottom: 6px; }
.doc2 .d2-foot .qr { text-align: center; flex: none; }
.doc2 .d2-foot .qr img, .doc2 .d2-foot .qr svg { width: 92px; height: 92px; display: block; }
.doc2 .d2-foot .qr small { display: block; font-size: 9px; color: #666; margin-top: 2px; }
@media (max-width: 600px) {
  .doc2 .d2-top, .doc2 .d2-mid { flex-direction: column; }
  .doc2 .d2-co { text-align: left; } .doc2 .d2-title { font-size: 24px; }
  .doc2 table.d2-meta td { padding-left: 0; padding-right: 16px; } .doc2 .d2-totals { width: 100%; }
}
.doc .co { font-size: 12px; line-height: 1.5; color: #333; }
.doc .special-note { margin-top: 14px; padding: 10px 12px; border: 1px solid #c9ced6; border-left: 4px solid #1f5f8b; border-radius: 4px;
                     font-size: 12px; line-height: 1.5; background: #fafbfc; }
.doc .special-note .sn-text, .doc .special-note .sn-w > div { white-space: pre-wrap; }
.doc .special-note .sn-text { margin-top: 4px; }
.doc .special-note .sn-w { margin-top: 6px; }
.doc .sign.one { justify-content: flex-end; }
.doc .esign { position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%); max-height: 56px; max-width: 180px; }
.doc .sign div { position: relative; }
.doc table.meta { width: auto; margin-left: auto; margin-top: 6px; }
.doc table.meta td { border: 0; padding: 1px 0 1px 12px; text-align: right; background: none; }
.doc table.meta td:first-child { color: #555; }
.doc th { background: #f1f3f6; color: #222; }
.doc tbody tr:hover td { background: none; }
.doc-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-top: 18px; padding-top: 12px; border-top: 1px solid #ccc; }
.doc-foot .pay { font-size: 12px; line-height: 1.5; } .doc-foot .pay > div { margin-top: 4px; }
.doc-foot .qr { text-align: center; flex: none; }
.doc-foot .qr img, .doc-foot .qr svg { width: 104px; height: 104px; display: block; }
.doc-foot .qr small { display: block; font-size: 10px; color: #555; margin-top: 2px; }
.doc-actions { margin-top: 20px; justify-content: flex-end; flex-wrap: wrap; }
button.act.green { background: #25a244; } button.act.gray { background: #6b7685; }
button.wa { background: #25a244; color: #fff; display: inline-flex; align-items: center; gap: 6px; }
button.thanks { background: #fde7ef; color: #b0245a; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
button.thanks .ic { width: 15px; height: 15px; }
@media (prefers-color-scheme: dark) { button.thanks { background: #4a1f30; color: #ffb3cd; } }
.modal-box.wide { max-width: 880px; padding: 12px; }
.modal-box.wide .doc { padding: 22px; }
@media print {
  body * { visibility: hidden; }
  .doc, .doc * { visibility: visible; }
  .doc { position: absolute; left: 0; top: 0; width: 100%; }
  .no-print { display: none !important; }
}
