/* Bhexa Quotations — navy sidebar app shell, light work surface, paper-white quotation sheet. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(/vendor/plex/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(/vendor/plex/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(/vendor/plex/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-display: swap; src: url(/vendor/plex/ibm-plex-sans-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans Condensed"; font-weight: 600; font-display: swap; src: url(/vendor/plex-condensed/ibm-plex-sans-condensed-latin-600-normal.woff2) format("woff2"); }

:root {
  /* Light theme (default). --brand is the document's print colour and stays the same in both themes. */
  --bg: #f1f3f8; --panel: #ffffff; --fg: #1a1f33; --muted: #5f667c; --line: #dde1ea; --field: #f8f9fc; --hover: #f3f5fa;
  --brand: #1e2a5a; --brand-soft: #e6eaf6; --accent: #2563eb;
  --side: #1e2a5a; --side-fg: #dfe4f5; --side-muted: #aab4d8; --on-side: #ffffff;
  --brand-ink: #1e2a5a; --on-brand: #ffffff;
  --primary: #1e2a5a; --primary-hover: #2b3a78; --primary-fg: #ffffff;
  --ok: #16a34a; --bad: #dc2626; --warn: #ea580c; --warn-bg: #fff4e5; --warn-fg: #9a4a00;
  --bad-soft: #fff6f6; --danger-line: #f1b4b4;
  --shadow: rgba(20, 24, 40, .14); --backdrop: rgba(15, 20, 40, .45);
  --toast-bg: #1a1f33; --toast-fg: #ffffff; --grid: #eef0f5;
  --ph: #fff0c2; --ph-line: #d9a21b;
  --radius: 8px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-label: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1320; --panel: #171c2b; --fg: #e6e9f2; --muted: #9aa2b8; --line: #2a3145; --field: #1d2334; --hover: #222a3d;
    --brand-soft: #232b48; --accent: #7fa6ff;
    --side: #121833; --side-fg: #d3d9ee; --side-muted: #8f9bc4;
    --primary: #5b77e0; --primary-hover: #6d87ea; --primary-fg: #ffffff;
    --ok: #34c46a; --bad: #f26b6b; --warn: #f59044; --warn-bg: #3a2a12; --warn-fg: #f5b169;
    --bad-soft: #3a1a1d; --danger-line: #6b2a2a;
    --shadow: rgba(0, 0, 0, .45); --backdrop: rgba(0, 0, 0, .6);
    --toast-bg: #e6e9f2; --toast-fg: #0f1320; --grid: #262d40;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1320; --panel: #171c2b; --fg: #e6e9f2; --muted: #9aa2b8; --line: #2a3145; --field: #1d2334; --hover: #222a3d;
  --brand-soft: #232b48; --accent: #7fa6ff;
  --side: #121833; --side-fg: #d3d9ee; --side-muted: #8f9bc4;
  --primary: #5b77e0; --primary-hover: #6d87ea; --primary-fg: #ffffff;
  --ok: #34c46a; --bad: #f26b6b; --warn: #f59044; --warn-bg: #3a2a12; --warn-fg: #f5b169;
  --bad-soft: #3a1a1d; --danger-line: #6b2a2a;
  --shadow: rgba(0, 0, 0, .45); --backdrop: rgba(0, 0, 0, .6);
  --toast-bg: #e6e9f2; --toast-fg: #0f1320; --grid: #262d40;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- shell ---------- */
/* Sidebar, Gmail style: a rail of areas in the brand colour (Sales, Chat, Issues, Calendar), and beside it a light
   menu for the area, with its main action at the top, rounded highlights and counts on the right. */
:root { --chrome: #f6f8fc; --pill: color-mix(in srgb, var(--primary) 15%, #ffffff); --compose: color-mix(in srgb, var(--primary) 12%, #ffffff);
  --cal-event: #2a78d6; --cal-followup: #eb6834; --cal-lead: #1baf7a; --cal-expiry: #eda100; --cal-invoice: #e87ba4; --unread: #c5221f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chrome: #131826; --pill: color-mix(in srgb, var(--primary) 30%, #131826);
  --compose: color-mix(in srgb, var(--primary) 24%, #171c2b);
  --cal-event: #3987e5; --cal-followup: #d95926; --cal-lead: #199e70; --cal-expiry: #c98500; --cal-invoice: #d55181; --unread: #e5534b; } }
:root[data-theme="dark"] { --chrome: #131826; --pill: color-mix(in srgb, var(--primary) 30%, #131826); --compose: color-mix(in srgb, var(--primary) 24%, #171c2b);
  --cal-event: #3987e5; --cal-followup: #d95926; --cal-lead: #199e70; --cal-expiry: #c98500; --cal-invoice: #d55181; --unread: #e5534b; }

.shell { display: grid; grid-template-columns: auto minmax(0, 1fr); min-height: 100vh; }
.side { display: flex; position: sticky; top: 0; height: 100vh; z-index: 20; }
.rail { width: 76px; flex: none; background: var(--side); color: var(--side-fg); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0; }
.rail a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--side-fg); font-size: 11.5px; font-weight: 500; width: 100%; padding: 4px 0; }
.rail a:hover { text-decoration: none; color: var(--on-side); }
.rail .rp { position: relative; width: 52px; height: 32px; border-radius: 16px; display: grid; place-items: center; transition: background .15s; }
.rail a:hover .rp { background: color-mix(in srgb, var(--on-side) 10%, transparent); }
.rail a.on { color: var(--on-side); font-weight: 700; }
.rail a.on .rp { background: color-mix(in srgb, var(--on-side) 20%, transparent); }
.rail a:focus-visible { outline: none; } .rail a:focus-visible .rp { outline: 2px solid var(--on-side); outline-offset: 1px; }
.rail .dot { position: absolute; top: -5px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--unread); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid var(--side); box-sizing: content-box; }
.menu-panel { width: 248px; flex: none; background: var(--chrome); color: var(--fg); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  padding: 16px 12px 14px 0; overflow-y: auto; }
.shell:not(.has-rail) .menu-panel { background: var(--side); color: var(--side-fg); border-right: 0; }
.menu-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.side .logo { color: var(--fg); font-weight: 700; font-size: 16px; padding: 2px 20px 12px; letter-spacing: .01em; }
.side .logo small { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); letter-spacing: 0; }
.side nav { display: flex; flex-direction: column; gap: 1px; }
.side nav a { color: var(--fg); min-height: 34px; padding: 6px 14px 6px 20px; border-radius: 0 999px 999px 0; display: flex; gap: 14px; align-items: center; }
.side nav a .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side nav a .ico { flex: none; color: var(--muted); }
.side nav a:hover { background: var(--hover); text-decoration: none; }
.side nav a.active { background: var(--pill); font-weight: 700; }
.side nav a.active .ico { color: var(--fg); }
.side nav .badge { background: none; color: inherit; font-size: 12px; font-weight: 700; padding: 0; }
.side nav a.compose { min-height: 52px; width: max-content; margin: 0 0 14px 12px; padding: 0 22px 0 16px; border-radius: 16px; background: var(--compose); font-weight: 600;
  box-shadow: 0 1px 2px var(--shadow), 0 1px 3px 1px color-mix(in srgb, var(--shadow) 50%, transparent); transition: box-shadow .15s; }
.side nav a.compose:hover { background: var(--compose); box-shadow: 0 1px 3px var(--shadow), 0 4px 8px 3px color-mix(in srgb, var(--shadow) 60%, transparent); }
.side nav a.compose .ico { color: var(--fg); }
.menu-h { margin: 14px 0 4px; padding: 0 20px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.menu-empty { padding: 4px 20px; color: var(--muted); font-size: 12.5px; }
.menu-note { margin: 18px 0 0 20px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 12.5px; display: grid; gap: 6px; color: var(--muted); }
.menu-note b { color: var(--fg); }
.menu-note .btn { justify-self: start; }
.menu-sec { padding: 0 0 0 20px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--panel); margin-bottom: 4px; }
.seg button { background: none; border: 0; padding: 5px 16px; cursor: pointer; color: var(--muted); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--pill); color: var(--fg); font-weight: 700; }
.layer { display: flex; align-items: center; gap: 10px; padding: 5px 0; cursor: pointer; }
.layer input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.layer .sw { width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--sw); background: var(--sw); flex: none; position: relative; }
.layer input:not(:checked) + .sw { background: transparent; }
.layer input:checked + .sw::after { content: ""; position: absolute; left: 4px; top: 0; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.layer input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-event { --sw: var(--cal-event); } .cal-followup { --sw: var(--cal-followup); } .cal-lead { --sw: var(--cal-lead); }
.cal-expiry { --sw: var(--cal-expiry); } .cal-invoice { --sw: var(--cal-invoice); }
.side .me { margin-top: auto; border-top: 1px solid var(--line); margin-left: 20px; padding: 12px 0 0; font-size: 12.5px; color: var(--muted); }
.side .me b { color: var(--fg); display: block; }
.side .me button { background: none; border: 0; color: var(--muted); padding: 0; cursor: pointer; margin-top: 6px; margin-right: 12px; }
.side .me button:hover { color: var(--fg); }
.menu-btn { display: none; }
.theme-switch { display: flex; gap: 4px; margin-top: 12px; background: var(--hover); border-radius: 8px; padding: 3px; width: max-content; }
.theme-switch button { background: none; border: 0; color: var(--muted); width: 32px; height: 28px; padding: 0; border-radius: 6px; cursor: pointer; margin: 0 !important; display: inline-flex; align-items: center; justify-content: center; }
.theme-switch button:hover { color: var(--fg); }
.theme-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.theme-switch button.on { background: var(--panel); color: var(--fg); box-shadow: 0 1px 2px var(--shadow); }
/* The Super Admin console keeps the single brand-coloured sidebar. */
.shell:not(.has-rail) .side .logo, .shell:not(.has-rail) .side .me b, .shell:not(.has-rail) .side nav a, .shell:not(.has-rail) .side nav a .ico { color: var(--on-side); }
.shell:not(.has-rail) .side .logo small, .shell:not(.has-rail) .side .me, .shell:not(.has-rail) .side .me button { color: var(--side-muted); }
.shell:not(.has-rail) .side nav a:hover { background: color-mix(in srgb, var(--on-side) 9%, transparent); }
.shell:not(.has-rail) .side nav a.active { background: color-mix(in srgb, var(--on-side) 16%, transparent); }
.shell:not(.has-rail) .side .me { border-color: color-mix(in srgb, var(--on-side) 18%, transparent); }
.shell:not(.has-rail) .theme-switch { background: color-mix(in srgb, var(--on-side) 9%, transparent); }
.shell:not(.has-rail) .theme-switch button { color: var(--side-muted); }
.shell:not(.has-rail) .theme-switch button.on { background: color-mix(in srgb, var(--on-side) 18%, transparent); color: var(--on-side); box-shadow: none; }
.main { min-width: 0; padding: 22px 24px 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 21px; margin-right: auto; }
.page-head .sub { width: 100%; margin: -8px 0 0; color: var(--muted); }

@media (max-width: 900px) {
  /* Phones and small tablets: a top bar with the menu behind "Menu", and the areas as tabs along the bottom. */
  .shell { display: block; }
  .side { position: sticky; top: 0; height: auto; display: block; }
  .menu-panel { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .side .logo { padding: 0; }
  .menu-body { display: none; width: 100%; max-height: calc(100vh - 140px); overflow-y: auto; margin: 10px -16px 0 -16px; padding: 4px 12px 12px 0; width: calc(100% + 32px); }
  .side.open .menu-body { display: flex; }
  .menu-btn { display: block; margin-left: auto; background: var(--panel); border: 1px solid var(--line); color: var(--fg); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
  .shell:not(.has-rail) .menu-btn { background: none; border-color: color-mix(in srgb, var(--on-side) 35%, transparent); color: var(--on-side); }
  .rail { position: fixed; left: 0; right: 0; bottom: 0; width: auto; flex-direction: row; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 30; gap: 0; }
  .rail a { padding: 0; }
  .has-rail .main { padding-bottom: 96px; }
  .main { padding: 16px 16px 40px; }
}

/* ---------- controls ---------- */
.btn { border: 1px solid var(--line); background: var(--panel); padding: 8px 13px; border-radius: 6px; cursor: pointer; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--primary-hover); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--bad); border-color: var(--danger-line); }
.btn.small { padding: 5px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 16px; color: var(--muted); padding: 4px 6px; border-radius: 4px; }
.icon-btn:hover { background: var(--hover); }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--bad); }
label.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
label.f > span { font-size: 12px; color: var(--muted); }
label.f > span i { font-style: normal; opacity: .8; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; background: var(--field); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; min-width: 0; }
textarea { resize: vertical; min-height: 60px; }
.invalid { border-color: var(--bad) !important; background: var(--bad-soft) !important; }
.field-error { color: var(--bad); font-size: 12px; }
.form-error { color: var(--bad); margin: 0 18px 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.full { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- cards & tables ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; flex-wrap: wrap; }
.card > header h2 { margin: 0; font-size: 14.5px; }
.card > header .muted { font-size: 12px; }
.card .body { padding: 0 16px 16px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tbody tr:hover td { background: var(--hover); }
table.t tr.click { cursor: pointer; }
table.t .num { text-align: right; }
table.t td.actions { white-space: nowrap; text-align: right; }
table.t td.nw, table.t td.nw b { white-space: nowrap; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.pill { --c: #6b7280; background: color-mix(in srgb, var(--c) 14%, var(--panel)); color: color-mix(in srgb, var(--c) 78%, var(--fg)); border-color: color-mix(in srgb, var(--c) 24%, transparent); }
.pill[data-status="Draft"] { --c: #6b7280; }
.pill[data-status="Sent"] { --c: #2563eb; }
.pill[data-status="Viewed"] { --c: #0891b2; }
.pill[data-status="Under Discussion"] { --c: #ea580c; }
.pill[data-status="Accepted"] { --c: #16a34a; }
.pill[data-status="Rejected"] { --c: #dc2626; }
.pill[data-status="Expired"] { --c: #9ca3af; }
.pill[data-status="Cancelled"] { --c: #64748b; }
.pill[data-status="Issued"] { --c: #2563eb; }
.pill[data-status="Converted"] { --c: #0891b2; }
.pill[data-status="Paid"] { --c: #16a34a; }
.pill[data-status="Partly paid"] { --c: #ea580c; }
.pill[data-status="Unpaid"] { --c: #6366f1; }
.pill[data-status="Overdue"] { --c: #dc2626; }
.pill[data-status="Refund due"] { --c: #9333ea; }
.pill[data-type] { --c: #475569; background: transparent; }
.pill.archived { --c: #94a3b8; background: transparent; }
.pill.overdue { --c: #dc2626; }
.pill.today { --c: #ea580c; }
.pill.soon { --c: #2563eb; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty h3 { color: var(--fg); margin: 0 0 4px; font-size: 15px; }
.empty p { margin: 0 0 12px; }

/* action menu */
.menu { position: relative; display: inline-block; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px var(--shadow); padding: 4px; z-index: 30; min-width: 170px; display: flex; flex-direction: column; text-align: left; }
.menu-list button, .menu-list a { background: none; border: 0; text-align: left; padding: 7px 10px; border-radius: 5px; cursor: pointer; color: var(--fg); font-size: 13px; }
.menu-list button:hover, .menu-list a:hover { background: var(--hover); text-decoration: none; }
.menu-list .danger { color: var(--bad); }

/* ---------- dashboard ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 2px; }
.seg button { border: 0; background: none; padding: 6px 11px; border-radius: 5px; cursor: pointer; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--primary); color: var(--primary-fg); }
.range { display: flex; gap: 6px; align-items: center; }
.range input { width: 150px; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpis.secondary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 1500px) { .kpis.secondary { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; min-width: 0; border-top: 3px solid var(--k, var(--primary)); }
.kpi .label { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.kpi .value { font-size: 23px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .hint { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.kpis.secondary .kpi { border-top-width: 1px; padding: 10px 13px; }
.kpis.secondary .value { font-size: 18px; }
.dash-row { display: grid; gap: 12px; margin-bottom: 12px; }
.dash-row.r2 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.dash-row.r3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1250px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .dash-row.r2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1599px) { .dash-row.r3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) { .kpis.secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi .value { font-size: 19px; } }
.donut-wrap { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr); gap: 16px; align-items: center; }
@media (max-width: 460px) { .donut-wrap { grid-template-columns: minmax(0, 1fr); } }
.donut-box { position: relative; aspect-ratio: 1; max-width: 190px; width: 100%; margin: 0 auto; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center b { font-size: 24px; }
.donut-center span { font-size: 11.5px; color: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 52px; gap: 8px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend .pc { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.chart-box { position: relative; height: 260px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; padding-bottom: 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--panel); border: 3px solid var(--c, var(--primary)); margin-top: 3px; }
.timeline .what { font-weight: 600; }
.timeline .meta { font-size: 12px; color: var(--muted); }
.timeline .rem { font-size: 12.5px; background: var(--field); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; margin-top: 4px; }

/* ---------- list filters ---------- */
.toolbar { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: end; }
.toolbar label.f > span { font-size: 11.5px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }

/* ---------- editor ---------- */
.editor-layout { display: grid; grid-template-columns: minmax(0, 470px) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1150px) { .editor-layout { grid-template-columns: minmax(0, 1fr); } }
.editor-form { display: flex; flex-direction: column; gap: 12px; }
details.sec { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
details.sec > summary { cursor: pointer; padding: 12px 14px; font-family: var(--font-label); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 12.5px; display: flex; justify-content: space-between; list-style: none; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: "+"; color: var(--muted); }
details.sec[open] > summary::after { content: "–"; }
details.sec .sec-body { padding: 2px 14px 14px; }
.item-card { border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: var(--field); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.item-card input, .item-card textarea { background: var(--panel); }
.item-card .ih { grid-column: 1 / -1; display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--muted); }
.item-card .wide { grid-column: 1 / -1; }
.item-card .span3 { grid-column: span 3; }
.item-card .span2 { grid-column: span 2; }
/* Quotation template: business type and PDF design pickers. */
.biz-grid, .design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.design-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); margin-top: 12px; }
.biz-card, .design-card { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px 10px 10px 32px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--field); cursor: pointer; font-size: 13px; }
.design-card { padding: 8px; }
.biz-card > span, .design-card > span:last-child { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.biz-card input { position: absolute; left: 10px; top: 12px; margin: 0; }
.design-card input { position: absolute; opacity: 0; pointer-events: none; }
.biz-card:has(input:checked), .design-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--brand-soft, var(--field)); }
.design-card:has(input:focus-visible), .biz-card:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.biz-card:has(input:disabled), .design-card:has(input:disabled) { cursor: not-allowed; opacity: .7; }
.dthumb { --a: #f5b800; display: flex; flex-direction: column; gap: 4px; height: 76px; padding: 7px; margin-bottom: 6px; background: #fff; border: 1px solid #dfe3e8;
  border-radius: 4px; overflow: hidden; }
.dthumb i { display: block; flex: none; }
.dthumb .t { height: 14px; border-bottom: 2px solid var(--a); margin-bottom: 2px; background: linear-gradient(#1f2a37 0 0) 0 2px / 40% 4px no-repeat; }
.dthumb .l { height: 3px; width: 80%; background: #d5dae0; border-radius: 2px; }
.dthumb .l.s { width: 55%; }
.dthumb .b { height: 6px; background: #1f2a37; margin-top: 2px; }
.dthumb[data-design="modern"] { border-top: 5px solid var(--a); }
.dthumb[data-design="modern"] .t { border-bottom: 1px solid #dfe3e8; background: linear-gradient(var(--a) 0 0) 100% 2px / 30% 5px no-repeat, linear-gradient(#1f2a37 0 0) 0 2px / 40% 4px no-repeat; }
.dthumb[data-design="modern"] .b { background: color-mix(in srgb, var(--a) 14%, #fff); border-bottom: 1.5px solid var(--a); }
.dthumb[data-design="bold"] .t { height: 22px; margin: -7px -7px 2px; border: 0; background: linear-gradient(rgba(255, 255, 255, .9) 0 0) 7px 8px / 38% 4px no-repeat, var(--a); }
.dthumb[data-design="bold"] .b { background: var(--a); }
.dthumb[data-design="elegant"] .t { border-bottom: 3px double var(--a); background: linear-gradient(#1f2a37 0 0) 50% 3px / 46% 2px no-repeat; }
.dthumb[data-design="elegant"] .b { height: 4px; background: none; border-top: 1px solid #1f2a37; border-bottom: 1px solid #1f2a37; }
.accent-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: end; margin-top: 12px; }
.accent-row input[type=color] { width: 64px; height: 34px; padding: 2px; }
.accent-row .muted { padding-bottom: 9px; }
.accent-row .link-btn { padding-bottom: 9px; }
@media (max-width: 460px) { .item-card { grid-template-columns: repeat(2, minmax(0, 1fr)); } .item-card .span3, .item-card .span2 { grid-column: 1 / -1; } }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; display: flex; gap: 8px; flex-wrap: wrap; z-index: 5; }
.preview-col { position: sticky; top: 16px; min-width: 0; }
@media (max-width: 1150px) { .preview-col { position: static; } }
.preview-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; gap: 8px; flex-wrap: wrap; }
.warn-chip { background: var(--warn-bg); color: var(--warn-fg); border-radius: 999px; padding: 2px 9px; font-weight: 600; }
.scaler-wrap { overflow: hidden; }
.scaler { transform-origin: top left; width: 794px; }
.suggest { position: relative; }
.suggest-list { position: absolute; left: 0; right: 0; top: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px var(--shadow); z-index: 10; max-height: 240px; overflow: auto; }
.suggest-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; cursor: pointer; }
.suggest-list button:hover, .suggest-list button.on { background: var(--hover); }
.suggest-list small { color: var(--muted); display: block; }

/* ---------- quotation page ---------- */
.q-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
@media (max-width: 1200px) { .q-layout { grid-template-columns: minmax(0, 1fr); } }
.q-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.decision { border-radius: 6px; padding: 10px 12px; font-size: 13px; }
.decision.Accepted { background: color-mix(in srgb, var(--ok) 16%, var(--panel)); }
.decision.Rejected { background: color-mix(in srgb, var(--bad) 16%, var(--panel)); }
.share { display: flex; gap: 6px; }
.share input { font-size: 12px; }
.fu { border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; margin-bottom: 8px; font-size: 13px; }
.fu .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, var(--side) 0 38%, var(--bg) 38%); }
.auth .card { width: min(400px, 100%); padding: 26px 24px; }
.auth h1 { margin: 0 0 4px; font-size: 20px; }
.auth p { margin: 0 0 18px; color: var(--muted); }
.auth form { display: flex; flex-direction: column; gap: 12px; }

/* Sign-in page: a dark brand panel on the left (the same in both themes), the form on the right. */
.login { position: relative; min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); }
.login-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  padding: 36px; color: #e8ecf8;
  background: radial-gradient(ellipse 60% 45% at 62% 18%, rgba(46, 84, 170, .45), transparent 70%),
    radial-gradient(ellipse 45% 40% at 75% 62%, rgba(20, 110, 100, .18), transparent 70%),
    radial-gradient(ellipse 55% 40% at 0% 100%, rgba(150, 40, 70, .35), transparent 70%),
    linear-gradient(160deg, #0f1a3d, #101634 55%, #12123a); }
.login-brand { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.login-brand svg { width: 46px; height: 34px; }
.login-brand b { font-weight: 700; letter-spacing: .02em; }
.login-brand span { font-weight: 400; }
.login-mark svg { width: 136px; height: 99px; display: block; margin-bottom: 28px; }
.login-pitch h2 { margin: 0 0 16px; font-size: 34px; line-height: 1.25; font-weight: 700; color: #fff; }
.login-pitch p { margin: 0 0 30px; max-width: 440px; font-size: 16px; color: #b9c1da; }
.login-pitch ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.login-pitch li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; }
.login-pitch li svg { flex: none; color: #34c46a; }
.login-hero small { font-size: 11.5px; color: #8a93b2; }
.login-main { display: grid; place-items: center; padding: 72px 16px 32px; }
.login-theme { position: absolute; top: 14px; right: 16px; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  cursor: pointer; color: var(--fg); background: var(--panel); border: 1px solid var(--line); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 60%, transparent); }
.login-theme:hover { background: var(--hover); }
.login-form { width: min(420px, 100%); }
.login-form h1 { margin: 0 0 6px; font-size: 26px; }
.login-form > p { margin: 0 0 30px; color: var(--muted); }
.login-form form { display: flex; flex-direction: column; gap: 18px; }
.login-form label.f > span { font-size: 13px; font-weight: 600; color: var(--fg); }
.login-form input { height: 42px; padding-inline: 10px; }
.login-form .btn.primary { justify-content: center; height: 44px; margin-top: 2px; font-weight: 600; }
.login-form .field-error { margin: 0; color: var(--bad); }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-hero { padding: 16px; }
  .login-pitch, .login-hero small { display: none; }
  .login-theme { top: 11px; }
  .login-main { padding-top: 40px; align-items: start; }
}

/* ---------- modal & toast ---------- */
dialog.modal { border: 0; border-radius: 10px; padding: 0; width: min(520px, calc(100% - 32px)); box-shadow: 0 20px 60px var(--shadow); background: var(--panel); color: var(--fg); }
dialog.modal.wide { width: min(760px, calc(100% - 32px)); }
dialog.modal::backdrop { background: var(--backdrop); }
dialog.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 6px; }
dialog.modal h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 8px 18px 14px; display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow: auto; }
dialog.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-fg); padding: 10px 16px; border-radius: 6px; z-index: 100; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.toast.error { background: #9f1c1c; color: #fff; }
.toast.ok { background: #14532d; color: #fff; }

/* ---------- quotation sheet (A4 at 96dpi) ----------
   Colour grade of the quotation sheet: charcoal ink, yellow accent, light grey panels.
   Fixed paper colours, the same in light and dark theme. The accent can follow the brand colour (Settings). */
.sheet { --d-ink: #1f2a37; --d-accent: var(--doc-accent, #f5b800); --d-accent-on-ink: var(--doc-accent-on-ink, #f5b800);
  --d-panel: #f1f4f5; --d-muted: #5f6b7a; --d-rule: #e3e6ea;
  width: 794px; min-height: 1123px; background: #fff; color: var(--d-ink); padding: 40px 46px 34px; box-shadow: 0 2px 14px rgba(20, 24, 40, .16);
  font: 11.5px/1.45 var(--font); font-variant-numeric: tabular-nums; }
.sheet .ph { background: var(--ph); border: 1px dashed var(--ph-line); border-radius: 3px; padding: 0 4px; color: #6b4a00; white-space: nowrap; }
.sh-banner { background: #b91c1c; color: #fff; text-align: center; font-weight: 600; letter-spacing: .12em; font-size: 10px; padding: 4px; margin: -18px 0 16px; border-radius: 3px; text-transform: uppercase; }
.sh-top { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 16px; border-bottom: 3px solid var(--d-accent); }
.sh-co { min-width: 0; }
.sh-co img { max-height: 52px; max-width: 200px; margin-bottom: 6px; display: block; }
.sh-co h1 { margin: 0; font-size: 19px; color: var(--d-ink); font-weight: 700; }
.sh-tag { font-family: var(--font-label); text-transform: uppercase; letter-spacing: .12em; font-size: 9.5px; color: var(--d-muted); margin: 2px 0 6px; }
.sh-co p { margin: 0; color: var(--d-muted); font-size: 10.5px; }
.sh-meta { text-align: right; flex: none; }
.sh-title { font-size: 24px; font-weight: 700; letter-spacing: .16em; color: var(--d-ink); margin: 0 0 8px; }
.sh-meta table { border-collapse: collapse; margin-left: auto; font-size: 10.5px; }
.sh-meta td { padding: 1px 0 1px 12px; }
.sh-meta td:first-child { color: var(--d-muted); }
.sh-meta td:last-child { font-weight: 600; }
.sheet h2 { font-family: var(--font-label); text-transform: uppercase; letter-spacing: .12em; font-size: 10.5px; color: var(--d-ink); margin: 20px 0 8px;
  padding: 1px 0 1px 8px; border-left: 3px solid var(--d-accent); }
.sh-client { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; background: var(--d-panel); padding: 10px 14px; border-radius: 4px; }
.sh-client div { display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
.sh-client div span:first-child { color: var(--d-muted); }
.sh-subj { margin: 10px 0 0; font-size: 11px; }
.sh-subj b { color: var(--d-ink); }
table.sh-items { width: 100%; border-collapse: collapse; font-size: 10.5px; }
table.sh-items thead { display: table-header-group; }
table.sh-items th { background: var(--d-ink); color: #fff; font-weight: 600; text-align: left; padding: 8px 6px; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
table.sh-items td { padding: 8px 6px; border-bottom: 1px solid var(--d-rule); vertical-align: top; }
table.sh-items tr { break-inside: avoid; page-break-inside: avoid; }
table.sh-items .n { text-align: right; white-space: nowrap; }
table.sh-items .c { text-align: center; }
table.sh-items .desc { font-weight: 600; }
table.sh-items .spec { color: var(--d-muted); }
.sheet .sub { font-size: 9px; color: var(--d-muted); }
.sh-note { font-size: 9.5px; color: var(--d-muted); margin: 6px 0 0; }
.sh-sum { display: flex; justify-content: flex-end; margin-top: 12px; }
.sh-sum table { border-collapse: collapse; min-width: 330px; font-size: 11px; }
.sh-sum td { padding: 5px 10px; border-bottom: 1px solid var(--d-rule); }
.sh-sum td:first-child { color: var(--d-muted); }
.sh-sum td:last-child { text-align: right; white-space: nowrap; font-weight: 600; }
.sh-sum tr.gt td { background: var(--d-ink); font-weight: 700; font-size: 14px; padding: 10px; border: 0; }
.sh-sum tr.gt td:first-child { color: #fff; text-transform: uppercase; letter-spacing: .04em; font-size: 12px; }
.sh-sum tr.gt td:last-child { color: var(--d-accent-on-ink); }
.sh-words { margin-top: 10px; background: var(--d-panel); border-left: 3px solid var(--d-accent); padding: 8px 12px; font-size: 11px; }
.sheet ul, .sheet ol { margin: 0; padding-left: 18px; }
.sheet li { margin: 2px 0; }
.sh-paysub { margin: -2px 0 10px; color: var(--d-muted); font-size: 10.5px; }
.sh-paysub b { color: var(--d-ink); }
.sh-pay { display: grid; grid-template-columns: 240px 1fr; gap: 28px; align-items: start; }
.sh-pay.noqr { grid-template-columns: 1fr; }
.sh-qr { background: var(--d-panel); border-radius: 4px; padding: 14px 16px 16px; text-align: center; }
.sh-qr h3, .sh-bank h3 { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--d-ink); }
.sh-qr p { margin: 2px 0 10px; font-size: 9px; color: var(--d-muted); }
.sh-qr img { display: block; width: 168px; height: 168px; margin: 0 auto 10px; background: #fff; padding: 8px; image-rendering: pixelated; }
.sh-qr b { display: block; font-size: 10px; text-transform: uppercase; color: var(--d-ink); }
.sh-qr small { display: block; font-size: 9px; color: var(--d-muted); margin-top: 2px; }
.sh-bank { max-width: 300px; }
.sh-bank h3 { margin-bottom: 8px; }
.sh-bank div { padding: 6px 0 5px; border-bottom: 1px solid var(--d-rule); }
.sh-bank div span { display: block; font-size: 8.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--d-muted); }
.sh-bank div b { display: block; font-size: 11.5px; color: var(--d-ink); margin-top: 1px; }
.sh-paynote { margin-top: 14px; background: var(--d-panel); border-left: 3px solid var(--d-accent); padding: 8px 12px; font-size: 10.5px; color: var(--d-ink); }
.sh-sign { display: flex; justify-content: flex-end; margin-top: 24px; }
.sh-sign > div { min-width: 260px; text-align: center; }
.sh-sign h3 { margin: 0; font-size: 11px; color: var(--d-ink); }
.sh-sign .stamp { height: 64px; display: flex; align-items: flex-end; justify-content: center; }
.sh-sign .stamp img { max-height: 60px; max-width: 220px; object-fit: contain; }
.sh-sign .ln { border-top: 1px solid #9aa0b0; padding-top: 4px; color: var(--d-muted); }
.sh-sign .ln > * { display: block; }
.sh-sign .ln b { color: var(--d-ink); font-size: 12px; }
.sh-sign .ln i { font-style: normal; }
.sh-foot { margin-top: 22px; padding-top: 8px; border-top: 1px solid var(--d-rule); text-align: center; font-size: 9.5px; color: var(--d-muted); }
.avoid { break-inside: avoid; page-break-inside: avoid; }

/* Document designs (Quotation template -> Business type & design). The wrapper carries the document colour and its
   shades (sheet.js wrapDoc): --d-accent, --d-on-accent (text on it), --d-accent-soft (pale tint), --d-accent-line,
   --d-accent-text (readable on white), --d-accent-on-ink (on the charcoal total bar). Classic is the base style above. */
.sh-doc { --d-accent: var(--doc-accent, #f5b800); }
table.sh-items .unit { color: var(--d-muted); font-size: 9.5px; }
table.sh-items .spec { font-size: 9.5px; margin-top: 2px; white-space: normal; }

/* Modern: a coloured strip along the top, coloured title, tinted panels and table header. */
.sh-doc[data-design="modern"] { margin: -40px -46px 0; padding: 32px 46px 0; border-top: 8px solid var(--d-accent); }
.sh-doc[data-design="modern"] .sh-banner { margin-top: 0; }
.sh-doc[data-design="modern"] .sh-top { border-bottom: 1px solid var(--d-rule); }
.sh-doc[data-design="modern"] .sh-title { color: var(--d-accent-text); font-weight: 800; letter-spacing: .08em; font-size: 26px; }
.sh-doc[data-design="modern"] h2 { border-left: 0; padding: 0 0 4px; color: var(--d-accent-text); border-bottom: 1px solid var(--d-accent-line); }
.sh-doc[data-design="modern"] .sh-client { background: var(--d-accent-soft); border-radius: 8px; }
.sh-doc[data-design="modern"] table.sh-items th { background: var(--d-accent-soft); color: var(--d-ink); border-bottom: 2px solid var(--d-accent); }
.sh-doc[data-design="modern"] .sh-sum tr.gt td { background: var(--d-accent); }
.sh-doc[data-design="modern"] .sh-sum tr.gt td:first-child, .sh-doc[data-design="modern"] .sh-sum tr.gt td:last-child { color: var(--d-on-accent); }
.sh-doc[data-design="modern"] .sh-words, .sh-doc[data-design="modern"] .sh-paynote { border-left: 0; background: var(--d-accent-soft); border-radius: 6px; }
.sh-doc[data-design="modern"] .sh-qr { background: var(--d-accent-soft); border-radius: 8px; }

/* Bold: the letterhead sits on a full-width band of the colour; the table header and total use it too. */
.sh-doc[data-design="bold"] .sh-top { margin: 0 -46px; padding: 26px 46px 22px; background: var(--d-accent); color: var(--d-on-accent); border-bottom: 0; }
.sh-doc[data-design="bold"] > .sh-top:first-child { margin-top: -40px; }
.sh-doc[data-design="bold"] .sh-banner { margin: -18px 0 0; border-radius: 3px 3px 0 0; }
.sh-doc[data-design="bold"] .sh-top h1, .sh-doc[data-design="bold"] .sh-title, .sh-doc[data-design="bold"] .sh-co p,
.sh-doc[data-design="bold"] .sh-tag, .sh-doc[data-design="bold"] .sh-meta td, .sh-doc[data-design="bold"] .sh-meta td:first-child { color: inherit; }
.sh-doc[data-design="bold"] .sh-co p, .sh-doc[data-design="bold"] .sh-tag, .sh-doc[data-design="bold"] .sh-meta td:first-child { opacity: .82; }
.sh-doc[data-design="bold"] .sh-co img { background: #fff; padding: 4px 6px; border-radius: 4px; }
.sh-doc[data-design="bold"] .sh-top .ph { color: #6b4a00; opacity: 1; }
.sh-doc[data-design="bold"] h2 { border-left-color: var(--d-accent); }
.sh-doc[data-design="bold"] table.sh-items th { background: var(--d-accent); color: var(--d-on-accent); }
.sh-doc[data-design="bold"] table.sh-items tbody tr:nth-child(even) td { background: #f7f8f9; }
.sh-doc[data-design="bold"] .sh-sum tr.gt td { background: var(--d-accent); }
.sh-doc[data-design="bold"] .sh-sum tr.gt td:first-child, .sh-doc[data-design="bold"] .sh-sum tr.gt td:last-child { color: var(--d-on-accent); }

/* Elegant: serif headings, double rule under the letterhead, open table, colour only on small touches. */
.sh-doc[data-design="elegant"] { --d-serif: Georgia, 'Times New Roman', serif; }
.sh-doc[data-design="elegant"] .sh-top { border-bottom: 3px double var(--d-accent-text); }
.sh-doc[data-design="elegant"] .sh-co h1 { font-family: var(--d-serif); font-weight: 400; font-size: 23px; letter-spacing: .01em; }
.sh-doc[data-design="elegant"] .sh-title { font-family: var(--d-serif); font-weight: 400; letter-spacing: .28em; font-size: 22px; color: var(--d-accent-text); }
.sh-doc[data-design="elegant"] .sh-tag { font-family: var(--d-serif); text-transform: none; letter-spacing: .02em; font-style: italic; font-size: 11px; }
.sh-doc[data-design="elegant"] h2 { font-family: var(--d-serif); text-transform: none; letter-spacing: .02em; font-size: 14px; font-weight: 400;
  color: var(--d-accent-text); border-left: 0; padding: 0 0 4px; border-bottom: 1px solid var(--d-rule); }
.sh-doc[data-design="elegant"] .sh-client { background: none; padding: 4px 0; border-radius: 0; }
.sh-doc[data-design="elegant"] table.sh-items th { background: none; color: var(--d-ink); border-top: 1.5px solid var(--d-ink); border-bottom: 1px solid var(--d-ink); }
.sh-doc[data-design="elegant"] .sh-sum tr.gt td { background: none; border-top: 3px double var(--d-ink); border-bottom: 1px solid var(--d-ink); font-family: var(--d-serif); }
.sh-doc[data-design="elegant"] .sh-sum tr.gt td:first-child { color: var(--d-ink); }
.sh-doc[data-design="elegant"] .sh-sum tr.gt td:last-child { color: var(--d-accent-text); }
.sh-doc[data-design="elegant"] .sh-words, .sh-doc[data-design="elegant"] .sh-paynote { background: none; border-left: 1px solid var(--d-accent); font-style: italic; }
.sh-doc[data-design="elegant"] .sh-qr { background: none; border: 1px solid var(--d-rule); }

/* ---------- public client page ---------- */
.public-bar { background: var(--side); color: var(--on-side); padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.public-bar b { font-size: 15px; }
.public-bar .btn { color: var(--fg); }
.public-main { padding: 20px 16px 40px; display: flex; justify-content: center; }
.respond { margin-bottom: 16px; }
.respond h3 { font-size: 15px; }
.respond-btns { display: flex; flex-wrap: wrap; gap: 8px; }

@media print {
  @page { size: A4; margin: 10mm 0; }
  body { background: #fff; }
  .side, .page-head, .q-side, .public-bar, .respond, .crumbs, .no-print, .toast { display: none !important; }
  .shell { display: block; }
  .main, .public-main { padding: 0; }
  .q-layout { display: block; }
  .scaler-wrap { height: auto !important; overflow: visible; }
  .scaler { transform: none !important; }
  .sheet { box-shadow: none; min-height: 0; margin: 0 auto; padding-top: 18px; }
  .sh-doc[data-design="modern"], .sh-doc[data-design="bold"] > .sh-top:first-child { margin-top: -18px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Phones: the quotation history table becomes one card per quotation, so amount, status and actions stay visible. */
@media (max-width: 700px) {
  table.t.cards thead { display: none; }
  table.t.cards, table.t.cards tbody, table.t.cards tr, table.t.cards td { display: block; width: 100%; }
  table.t.cards tr { position: relative; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.t.cards td { border: 0; padding: 2px 0; text-align: left; display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; }
  table.t.cards td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  table.t.cards td.c-title { display: block; padding-right: 96px; margin-bottom: 4px; }
  table.t.cards td.num { font-weight: 600; }
  table.t.cards td.actions { position: absolute; top: 10px; right: 12px; width: auto; display: block; padding: 0; }
  table.t.cards tbody tr:hover td { background: transparent; }
  table.t.cards td > .pill { justify-self: start; }
}
.auth .field-error { color: var(--bad); }
@media (max-width: 560px) { .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); } .toolbar label.f:first-child { grid-column: 1 / -1; } }
.side .me-link { color: inherit; } .side .me-link:hover { text-decoration: underline; }

.print-only { display: none; }
table.t tfoot td { border-top: 2px solid var(--line); border-bottom: 0; background: var(--field); }
@media print {
  .print-only { display: block; }
  .report-head h1 { margin: 0 0 4px; font-size: 18px; }
  .report-head p { margin: 0 0 12px; color: #555; font-size: 12px; }
  .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
  .card, .kpi { border-color: #ccc; }
  html, body, .card, .kpi, table.t th, table.t tfoot td { background: #fff !important; color: #111 !important; }
  table.t { font-size: 11px; }
}
/* Printing always uses the light palette, whatever theme is on screen. */
@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --bg: #fff !important; --panel: #fff !important; --fg: #111 !important; --muted: #555 !important; --line: #ccc !important;
    --field: #fff !important; --hover: #fff !important; --grid: #e5e5e5 !important; color-scheme: light !important;
  }
  html { background: #fff !important; }
  .main:has(#report) { padding: 0 10mm !important; }
}

/* Settings: brand colour picker */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.swatch[aria-pressed="true"] { border-color: var(--fg); box-shadow: 0 0 0 2px var(--panel) inset; }
.brand-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.brand-row input[type=color] { width: 46px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--field); cursor: pointer; }
.brand-row input[type=text] { width: 110px; font-family: ui-monospace, monospace; }
.brand-preview { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.brand-preview .side-chip { background: var(--side); color: #fff; padding: 6px 12px; border-radius: 6px; font-size: 12px; }
.kpis.secondary.inv4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 700px) { .kpis.secondary.inv4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpis.secondary.inv3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .kpis.secondary.inv3 { grid-template-columns: minmax(0, 1fr); } }
.tpl-toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
.tpl-toggles label { display: flex; gap: 8px; align-items: center; }
@media (max-width: 560px) { .tpl-toggles { grid-template-columns: minmax(0, 1fr); } }
.pw-box { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pw-box legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 4px; }

/* Super Admin working inside a customer company */
.acting-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: -6px 0 18px;
  padding: 10px 14px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn-fg); border: 1px solid currentColor; font-size: 13.5px; }

/* Fields the company's plan doesn't let it change (and other disabled controls) */
.f input:disabled, .f textarea:disabled, .f select:disabled { opacity: .55; cursor: not-allowed; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Leads */
.lead-form-card { width: 100%; max-width: 480px; }
.lead-form-card form { display: flex; flex-direction: column; gap: 12px; }
.lead-form-card h1 { font-size: 22px; margin: 0 0 4px; }
.lead-form-logo { max-height: 56px; max-width: 200px; margin-bottom: 12px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.pill[data-lead="New"] { --c: #2563eb; }
.pill[data-lead="Contacted"] { --c: #0891b2; }
.pill[data-lead="Qualified"] { --c: #ea580c; }
.pill[data-lead="Quoted"] { --c: #7c3aed; }
.pill[data-lead="Won"] { --c: #16a34a; }
.pill[data-lead="Lost"] { --c: #64748b; }
.pill[data-band="Hot"] { --c: #dc2626; }
.pill[data-band="Warm"] { --c: #ea580c; }
.pill[data-band="Cold"] { --c: #64748b; }
.lead-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px 0; }
.lead-tabs button { border: 1px solid var(--line); background: var(--panel); color: inherit; border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.lead-tabs button.on { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.lead-tabs b { font-weight: 600; margin-left: 4px; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 16px; border-top: 1px solid var(--line); }
.score-parts { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; }
.score-parts li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.code-box { width: 100%; font-family: ui-monospace, monospace; font-size: 12px; }
.import-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }

/* Back link and breadcrumb above inner pages (app.js drawCrumbs). */
.crumbs { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; margin: -4px 0 14px; font-size: 13px; }
.crumbs .back { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 8px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--fg); font-weight: 600; text-decoration: none; }
.crumbs .back:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.crumbs .back:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; list-style: none; margin: 0; padding: 0; min-width: 0; color: var(--muted); }
.crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.crumbs li + li::before { content: '\203A'; margin: 0 7px; color: var(--muted); }
.crumbs li a { color: var(--muted); max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs li a:hover { color: var(--primary); }
.crumbs li[aria-current] { color: var(--fg); font-weight: 600; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* Welcome tour (tour.js): dimmed page, a highlight around the item being explained, and the step card. */
.tour-dim { position: fixed; inset: 0; z-index: 900; }
.tour-dim.solid { background: rgb(10 14 28 / 55%); }
.tour-spot { position: fixed; z-index: 901; border-radius: 8px; box-shadow: 0 0 0 9999px rgb(10 14 28 / 55%), 0 0 0 2px var(--primary-fg, #fff);
  pointer-events: none; transition: left .2s, top .2s, width .2s, height .2s; }
.tour-pop { position: fixed; z-index: 902; width: min(360px, calc(100vw - 32px)); background: var(--panel); color: var(--fg);
  border: 1px solid var(--line); border-radius: 10px; padding: 18px 18px 14px; box-shadow: 0 18px 50px rgb(0 0 0 / 30%); }
.tour-pop.centered { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); }
.tour-pop h2 { margin: 2px 0 8px; font-size: 17px; }
.tour-pop p { margin: 0; line-height: 1.55; color: var(--fg); }
.tour-count { font-size: 12px; color: var(--muted); }
.tour-dots { display: flex; gap: 5px; margin: 14px 0 12px; }
.tour-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.tour-dots span.on { background: var(--primary); width: 16px; border-radius: 3px; }
.tour-pop footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour-nav { display: flex; gap: 8px; margin-left: auto; }
@media (prefers-reduced-motion: reduce) { .tour-spot { transition: none; } }
@media print { .tour-dim, .tour-spot, .tour-pop { display: none !important; } }

/* Super Admin console (views/platform.js): system health cards and the company row's "to check" list. */
.sec-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 15px; margin: 4px 0 10px; }
.sec-title .btn { margin-left: auto; }
.health { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 22px; }
.hcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.hcard .htop { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.hcard .hline { font-size: 12.5px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.hcard .hline b { color: var(--fg); }
.hcard .bad, .bad { color: var(--bad) !important; }
.warn-list { margin: 6px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--warn-fg); }
.warn-list li { position: relative; padding-left: 14px; margin-top: 2px; }
.warn-list li::before { content: '!'; position: absolute; left: 0; top: 0; font-weight: 700; }

/* Super Admin -> Email: the provider's how-to and the test result. */
.mail-help { background: var(--field); border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; line-height: 1.5; }
.mail-help:empty { display: none; }
.ok-text { color: var(--ok, #15803d); }

/* Super Admin dashboard (views/sa-dashboard.js). */
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.sa-kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: 14px; }
.sa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.sa-h3 { font-size: 13px; margin: 0 0 8px; }
.meter { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--primary) 12%, var(--line)); overflow: hidden; margin-top: 4px; }
.meter .fill { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.meter .fill.warn { background: var(--warn); } .meter .fill.bad { background: var(--bad); }
.meter-text { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12.5px; margin-top: 6px; color: var(--muted); }
.meter-text b { color: var(--fg); }
.meter-state { font-weight: 600; color: var(--fg); }
.meter-state::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--ok); }
.meter-state.warn::before { background: var(--warn); } .meter-state.bad::before { background: var(--bad); }
.tbl-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.tbl-bars li { display: grid; grid-template-columns: minmax(0, 11rem) minmax(40px, 1fr) 5.2rem 6.5rem; align-items: center; gap: 10px; font-size: 12.5px; }
.tbl-bars .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-bars .bar { height: 8px; }
.tbl-bars .bar span { display: block; height: 100%; background: var(--primary); border-radius: 0 4px 4px 0; }
.tbl-bars .v { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-bars .r { text-align: right; font-size: 11.5px; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .tbl-bars li { grid-template-columns: minmax(0, 1fr) 4.6rem; } .tbl-bars .bar, .tbl-bars .r { display: none; } }
.sa-kv { grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); }
a.btn:not(.primary) { color: var(--fg); }
.chart-wrap { position: relative; }
.col-chart { display: block; overflow: visible; max-width: 100%; }
.col-chart .grid { stroke: var(--line); stroke-width: 1; }
.col-chart text { fill: var(--muted); font-size: 11px; }
.col-chart .col path { fill: var(--primary); }
.col-chart .col { cursor: default; outline: none; }
.col-chart .col.on path, .col-chart .col:focus-visible path { fill: var(--primary-hover); }
.col-chart .col:focus-visible rect { stroke: var(--primary); stroke-width: 1.5; }
.chart-tip { position: absolute; pointer-events: none; background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 9px; font-size: 12px; white-space: nowrap; box-shadow: 0 6px 18px rgb(0 0 0 / 15%); transform: translateY(-100%); }

/* ---------- shared bits for chat, issues, calendar and the client portal ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--primary); }
fieldset.checks { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 10px; margin: 0; display: grid; gap: 6px; max-height: 220px; overflow: auto; }
fieldset.checks.cols { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
fieldset.checks legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
fieldset.checks legend i { font-style: normal; opacity: .8; }
fieldset.checks label, label.check { display: flex; gap: 8px; align-items: center; }
ul.plain { margin: 0; padding-left: 18px; }
dl.facts { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 6px 10px; margin: 12px 0; font-size: 13px; }
dl.facts dt { color: var(--muted); } dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.sys-msg { text-align: center; color: var(--muted); font-size: 12px; margin: 10px auto; max-width: 90%; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--unread); margin-right: 6px; vertical-align: 1px; }
.pill[data-issue="Open"] { --c: #2563eb; }
.pill[data-issue="In progress"] { --c: #7c3aed; }
.pill[data-issue="Waiting on client"] { --c: #ea580c; }
.pill[data-issue="Resolved"] { --c: #16a34a; }
.pill[data-issue="Closed"] { --c: #64748b; }
.pill[data-prio="Low"] { --c: #64748b; }
.pill[data-prio="High"] { --c: #ea580c; }
.pill[data-prio="Urgent"] { --c: #dc2626; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 70px); min-height: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ch-title { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
.ch-title .ico { color: var(--muted); flex: none; }
.ch-title h1 { margin: 0; font-size: 17px; }
.ch-title p { margin: 0; max-width: 60ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-actions { display: flex; gap: 8px; }
.chat-log { flex: 1; overflow-y: auto; padding: 8px 16px 12px; }
.chat-log:focus-visible { outline-offset: -2px; }
.chat-empty { text-align: center; color: var(--muted); padding: 60px 16px; }
.chat-empty .ico { color: var(--muted); } .chat-empty h3 { color: var(--fg); margin: 8px 0 4px; }
.more-wrap { text-align: center; padding: 8px 0; }
.day-sep, .new-sep { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.day-sep::before, .day-sep::after, .new-sep::before, .new-sep::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.new-sep { color: var(--unread); } .new-sep::before, .new-sep::after { border-color: color-mix(in srgb, var(--unread) 50%, transparent); }
.msg { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; position: relative; }
.msg.grouped { padding-top: 1px; padding-bottom: 1px; }
.msg:hover { background: var(--hover); }
.msg-time-side { font-size: 10.5px; color: var(--muted); text-align: right; padding-top: 3px; visibility: hidden; white-space: nowrap; }
.msg:hover .msg-time-side { visibility: visible; }
.av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--fg);
  background: color-mix(in srgb, var(--avc) 26%, var(--panel)); border: 2px solid var(--avc); flex: none; }
.msg-head { display: flex; gap: 8px; align-items: baseline; }
.msg-text { overflow-wrap: anywhere; line-height: 1.5; }
.msg .deleted { font-style: italic; font-size: 13px; }
.msg-del { visibility: hidden; align-self: start; }
.msg:hover .msg-del, .msg-del:focus-visible { visibility: visible; }
.ref-card { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); max-width: 460px; color: var(--fg); }
.ref-card:hover { text-decoration: none; border-color: var(--primary); }
.ref-card .ico { color: var(--muted); flex: none; }
.ref-card .rc-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ref-card .rc-main .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-card .rc-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 12.5px; }
.ref-card.hidden { color: var(--muted); font-size: 13px; }
.composer { border-top: 1px solid var(--line); padding: 10px 12px 6px; }
.comp-row { display: flex; align-items: flex-end; gap: 6px; background: var(--field); border: 1px solid var(--line); border-radius: 22px; padding: 4px 6px 4px 6px; }
.comp-row:focus-within { border-color: var(--primary); }
.comp-row textarea { flex: 1; border: 0; background: none; resize: none; padding: 8px 4px; min-height: 22px; max-height: 180px; outline: none; line-height: 1.4; }
.comp-row .send { border-radius: 50%; width: 38px; height: 38px; padding: 0; justify-content: center; }
.comp-row .icon-btn { height: 38px; display: inline-flex; align-items: center; }
.comp-hint { margin: 4px 12px 0; }
.attached { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; padding: 6px 10px; border: 1px dashed var(--line); border-radius: 8px; font-size: 13px; }
.attached .ico { color: var(--muted); } .attached .icon-btn { margin-left: auto; }
.ref-results, .people, .day-list { display: flex; flex-direction: column; gap: 4px; }
.ref-pick, .person, .arow { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--fg); }
.ref-pick:hover, .person:hover, .arow:hover { background: var(--hover); border-color: var(--line); }
.ref-pick > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ref-pick .ico { color: var(--muted); flex: none; }
.people { max-height: 320px; overflow: auto; }
@media (max-width: 900px) { .chat { height: calc(100vh - 170px); border-radius: 10px; } }

/* ---------- issues ---------- */
.issue-list { list-style: none; margin: 0; padding: 0; }
.issue-list li { border-bottom: 1px solid var(--line); }
.issue-list li:last-child { border-bottom: 0; }
.issue-list a { display: grid; grid-template-columns: minmax(140px, 200px) minmax(0, 1fr) auto 70px; gap: 6px 16px; align-items: center; padding: 11px 16px; color: var(--fg); }
.issue-list a:hover { background: var(--hover); text-decoration: none; box-shadow: inset 2px 0 0 var(--primary); }
.issue-list li.unread a { background: color-mix(in srgb, var(--primary) 5%, var(--panel)); }
.issue-list li.unread .il-subj, .issue-list li.unread .il-who b { font-weight: 700; }
.il-who, .il-main { display: flex; flex-direction: column; min-width: 0; }
.il-who > *, .il-subj, .il-snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.il-tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.il-time { text-align: right; white-space: nowrap; }
@media (max-width: 760px) {
  .issue-list a { grid-template-columns: minmax(0, 1fr) auto; }
  .issue-list .il-main { grid-column: 1 / -1; grid-row: 2; }
  .issue-list .il-tags { grid-column: 1 / -1; justify-content: flex-start; }
}
.head-pills { display: inline-flex; gap: 6px; }
.issue-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1050px) { .issue-layout { grid-template-columns: minmax(0, 1fr); } }
.side-info h2 { font-size: 14.5px; margin: 14px 0 10px; }
.side-info .body { display: flex; flex-direction: column; gap: 10px; }
.thread .tlist { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; max-height: 62vh; overflow-y: auto; }
.tmsg { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--panel); max-width: 92%; }
.tmsg header { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.tmsg .tag { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }
.tmsg .tbody { overflow-wrap: anywhere; line-height: 1.55; }
.tmsg.client { background: var(--field); }
.tmsg.staff { align-self: flex-end; background: color-mix(in srgb, var(--primary) 7%, var(--panel)); border-color: color-mix(in srgb, var(--primary) 25%, var(--line)); }
.tmsg.note { align-self: flex-end; background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.tmsg .tag.note { color: var(--warn-fg); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.reply { border-top: 1px solid var(--line); padding: 10px 16px 14px; display: flex; flex-direction: column; gap: 8px; }
.reply textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--field); padding: 10px 12px; resize: vertical; }
.reply.note textarea { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.reply-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.reply-actions .muted { margin-right: auto; }
.pad { padding: 14px 16px; margin: 0; }

/* ---------- calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-head h1 { margin: 0 auto 0 4px; font-size: 21px; font-weight: 500; }
.cal-nav { display: inline-flex; }
.cal-nav .icon-btn { display: inline-flex; padding: 6px; border-radius: 50%; }
.cal-head .seg { margin: 0; }
.mgrid { display: flex; flex-direction: column; }
.mgrid .dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.mgrid .dow span { text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 8px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.mgrid .cells { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(116px, 1fr); }
.cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 4px 6px; display: flex; flex-direction: column; gap: 2px; min-width: 0; cursor: pointer; }
.cell:nth-child(7n) { border-right: 0; }
.cell:nth-last-child(-n+7) { border-bottom: 0; }
.cell:hover { background: color-mix(in srgb, var(--hover) 60%, transparent); }
.cell.out { background: color-mix(in srgb, var(--bg) 55%, var(--panel)); }
.cell.out .dn { color: var(--muted); }
.cell .dn { align-self: center; font-size: 12px; font-weight: 600; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 2px; }
.cell.today .dn { background: var(--primary); color: var(--primary-fg); }
.cell.focus { box-shadow: inset 0 0 0 2px var(--primary); }
.chip { display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; text-align: left; border: 0; border-left: 3px solid var(--sw); background: color-mix(in srgb, var(--sw) 13%, var(--panel));
  color: var(--fg); border-radius: 4px; padding: 2px 6px; font-size: 12px; cursor: pointer; line-height: 1.35; }
.chip.ev { background: color-mix(in srgb, var(--sw) 24%, var(--panel)); }
.chip:hover { background: color-mix(in srgb, var(--sw) 30%, var(--panel)); }
.chip .cl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chip .ct { font-weight: 600; flex: none; }
.chip .late { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.cell .more { background: none; border: 0; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 1px 6px; cursor: pointer; border-radius: 4px; }
.cell .more:hover { background: var(--hover); color: var(--fg); }
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda > li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.agenda > li:last-child { border-bottom: 0; }
.agenda .ad { display: flex; flex-direction: column; align-items: center; }
.agenda .ad b { font-size: 20px; font-weight: 500; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.agenda .ad span { font-size: 11.5px; color: var(--muted); text-transform: uppercase; }
.agenda li.today .ad b { background: var(--primary); color: var(--primary-fg); }
.agenda .ai { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.arow .sw { width: 10px; height: 10px; border-radius: 50%; background: var(--sw); flex: none; }
.arow .at { width: 110px; flex: none; color: var(--muted); font-size: 12.5px; }
.arow .atl { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.arow .atl b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.cal-legend { margin: 8px 2px 0; }
@media (max-width: 700px) {
  .mgrid .cells { grid-auto-rows: minmax(84px, 1fr); }
  .chip .ct { display: none; }
  .agenda > li { grid-template-columns: 48px minmax(0, 1fr); padding: 10px; }
  .arow { flex-wrap: wrap; row-gap: 2px; padding: 8px 6px; }
  .arow .atl { flex: 1 1 calc(100% - 24px); order: 1; }
  .arow .sw { order: 0; }
  .arow .at { width: auto; order: 2; margin-left: 20px; }
  .arow .num, .arow .pill { order: 3; }
}

/* ---------- client portal ---------- */
.portal-page { min-height: 100vh; display: flex; flex-direction: column; }
#portal { display: flex; flex-direction: column; min-height: 100vh; }
.portal-auth .card { width: min(420px, 100%); }
.pa-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--primary); margin-bottom: 12px; }
.btn.wide { width: 100%; justify-content: center; padding: 10px; }
.ok-note { background: color-mix(in srgb, var(--ok) 10%, var(--panel)); border: 1px solid color-mix(in srgb, var(--ok) 30%, var(--line)); border-radius: 8px; padding: 10px 12px; color: var(--fg) !important; font-size: 13px; }
.code-input { font-size: 24px; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; }
.acct-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.acct { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; text-align: left; gap: 0 10px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel); cursor: pointer; color: var(--fg); }
.acct:hover { border-color: var(--primary); }
.acct .ico { grid-row: 1 / 3; grid-column: 2; color: var(--muted); }
.portal-bar { background: var(--side); color: var(--on-side); padding: 12px 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pb-co { display: flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; }
.pb-co img { height: 36px; max-width: 120px; object-fit: contain; background: #fff; border-radius: 6px; padding: 3px; }
.pb-co div { display: flex; flex-direction: column; } .pb-co b { font-size: 16px; } .pb-co span { font-size: 12px; opacity: .8; }
.pb-me { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pb-who { display: flex; flex-direction: column; text-align: right; margin-right: 6px; font-size: 13px; }
.pb-who span { font-size: 11.5px; opacity: .8; }
.pb-me .btn { color: var(--fg); }
.portal-tabs { display: flex; gap: 4px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.portal-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.portal-tabs a:hover { color: var(--fg); text-decoration: none; }
.portal-tabs a.on { color: var(--fg); border-bottom-color: var(--primary); }
.portal-tabs .badge { background: var(--unread); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.portal-main { width: 100%; max-width: 1080px; margin: 0 auto; padding: 22px 16px 40px; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.portal-main > p { margin: -8px 0 0; }
.portal-h1 { font-size: 22px; margin: 0; }
.ptiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ptile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--fg); }
.ptile:hover { text-decoration: none; border-color: var(--primary); }
.ptile b { font-size: 24px; font-variant-numeric: tabular-nums; }
.help-card h2 { margin: 14px 0 4px; font-size: 16px; }
.portal-doc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.portal-doc-head .grow { flex: 1; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.body-pad { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.portal-foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 16px; border-top: 1px solid var(--line); }
@media (max-width: 640px) { .ptiles { grid-template-columns: minmax(0, 1fr); } .pb-who { text-align: left; }
  .portal-tabs { padding: 0 4px; } .portal-tabs a { padding: 12px 9px; gap: 5px; } .portal-tabs a .ico { display: none; } }
@media print { .portal-bar, .portal-tabs, .portal-foot, .portal-doc-head .btn, .back-link { display: none !important; } }
