/* Safety Shield CRM — one stylesheet, no build step.
   Brand colours come from Admin → Branding and are injected as --brand / --accent. */

@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); }

:root {
  --brand: #1F4E79;
  --brand-ink: #ffffff;
  --accent: #F2A900;
  --ink: #0f1720;
  --ink-2: #3d4854;
  --ink-3: #66727f;
  --line: #d3d9e0;
  --line-2: #e6eaee;
  --page: #eef1f4;
  --head: #f6f8fa;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --card: #ffffff;
  --green: #1d7a46;  --green-bg: #e3f3e9;
  --amber: #8a5a00;  --amber-bg: #fdf0d2;
  --red: #b42318;    --red-bg: #fde7e5;
  --blue: #1f5fa8;   --blue-bg: #e4eefa;
  --grey: #55606c;   --grey-bg: #eceff2;
  --radius: 3px;
  --radius-lg: 4px;
  --sidebar: 236px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --focus: 0 0 0 3px rgba(242, 169, 0, .55);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; color: var(--ink); background: var(--page); }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 3px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.005em; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.015em; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.num, td.num, .money { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pre { white-space: pre-line; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(rgba(0,0,0,.28), rgba(0,0,0,.28)), var(--brand); color: var(--brand-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar::after { content: ""; display: block; height: 6px; flex: none; margin-top: auto;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 8px, #111 8px 16px); }
.brand { display: flex; align-items: center; gap: .6rem; padding: .95rem 1rem; color: inherit; text-decoration: none; font-weight: 700; font-size: .98rem; letter-spacing: -.01em; line-height: 1.2; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand img { max-height: 34px; max-width: 150px; background: #fff; border-radius: 4px; padding: 2px 4px; }
.brand-mark { width: 30px; height: 34px; flex: none; }
.nav { padding: .25rem .6rem 1.5rem; }
.nav-group { margin-top: .9rem; }
.nav-group > span { display: block; padding: 0 .6rem .3rem; font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .55; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .38rem .6rem; border-radius: 2px;
  color: inherit; text-decoration: none; opacity: .82; font-weight: 500; font-size: .92rem; }
.nav a:hover { background: rgba(255,255,255,.1); opacity: 1; }
.nav a.active { background: rgba(255,255,255,.12); opacity: 1; box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
.nav .soon { font-size: .72rem; opacity: .6; }
.nav .count { font: 600 .72rem/1.5 var(--mono); background: var(--accent); color: #111; border-radius: 2px; padding: 0 .4rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; height: 56px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar form.search { flex: 1; max-width: 560px; position: relative; }
.topbar input[type=search] { width: 100%; padding-left: 2.1rem; background: var(--page) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236f7b88' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") no-repeat .7rem center; }
.user-menu { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.avatar { width: 30px; height: 30px; border-radius: 2px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: .8rem; font-weight: 700; text-decoration: none; }


.content { padding: 1.25rem 1.5rem 3rem; max-width: 1400px; width: 100%; }
.crumbs { font-size: .85rem; color: var(--ink-3); margin-bottom: .35rem; }
.crumbs a { color: var(--ink-3); }
.crumbs span + span::before, .crumbs a + span::before, .crumbs a + a::before { content: "/"; margin: 0 .4rem; color: var(--line); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--ink-3); margin-top: .2rem; font-size: .9rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Reference tag — the record's identity, styled like an inspection tag */
.ref { display: inline-flex; align-items: stretch; font: 600 .86rem/1.6 var(--mono); letter-spacing: .01em; color: var(--ink);
  border: 1px solid var(--ink); border-radius: 2px; overflow: hidden; background: #fff; vertical-align: middle; text-decoration: none; }
.ref::before { content: ""; width: 9px; background: repeating-linear-gradient(-45deg, var(--accent) 0 4px, var(--ink) 4px 8px); }
.ref > span { padding: 0 .5rem; }
a.ref:hover { background: var(--ink); color: #fff; }
td .ref { font-size: .78rem; }
td .ref::before { width: 6px; }

/* ---------- Cards, panels ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel + .panel { margin-top: 1rem; }
.grid > .panel + .panel { margin-top: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .65rem 1rem; border-bottom: 1px solid var(--line); background: var(--head); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.panel-head h2 { margin: 0; font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.panel-head h2 .muted { letter-spacing: 0; }
.panel-body { padding: 1rem; }
.panel-body.flush { padding: 0; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; align-items: start; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; margin-bottom: 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.stat { padding: .85rem 1rem .8rem; text-decoration: none; color: inherit; display: block; border-right: 1px solid var(--line-2); position: relative; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--tone, var(--line)); }
.stat:last-child { border-right: 0; }
a.stat:hover { background: var(--head); }
.stat .label { color: var(--ink-3); font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.stat .value { font-size: 1.7rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.25; letter-spacing: -.02em; margin-top: .15rem; }
.stat .hint { font-size: .8rem; color: var(--ink-3); }
.tone-green { --tone: var(--green); } .tone-amber { --tone: var(--accent); } .tone-red { --tone: var(--red); }
.tone-blue { --tone: var(--blue); } .tone-grey { --tone: var(--grey); }
.section-title { font-size: .72rem; color: var(--ink-3); margin: 1.25rem 0 .5rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
dl.facts dt { color: var(--ink-3); }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .05rem .45rem; border-radius: 2px; font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; border: 1px solid; line-height: 1.55; }
.badge-green { color: var(--green); background: var(--green-bg); border-color: #b9dcc6; }
.badge-amber { color: var(--amber); background: var(--amber-bg); border-color: #f0d38e; }
.badge-red { color: var(--red); background: var(--red-bg); border-color: #f2bcb6; }
.badge-blue { color: var(--blue); background: var(--blue-bg); border-color: #bcd3ef; }
.badge-grey { color: var(--grey); background: var(--grey-bg); border-color: #d3d8dd; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; padding: .55rem .75rem; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--head); }
table.data td { padding: .55rem .75rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #f4f7fa; box-shadow: inset 2px 0 0 var(--brand); }
table.data a.sort { color: inherit; text-decoration: none; }
table.data a.sort:hover { color: var(--brand); text-decoration: underline; }
table.data td.num, table.data th.num { text-align: right; }
table.data .primary-link, .primary-link { font-weight: 600; color: var(--ink); text-decoration: none; }
.primary-link:hover { color: var(--brand); text-decoration: underline; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--ink-2); }
.empty p { margin-bottom: .75rem; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: #fff; }
.filters .field { margin: 0; }
.filters input[type=search] { min-width: 220px; }
.chips { display: flex; flex-wrap: wrap; gap: 0; padding: 0 1rem; border-bottom: 1px solid var(--line-2); }
.chip { display: inline-flex; gap: .4rem; align-items: center; padding: .6rem .75rem .55rem; border-bottom: 2px solid transparent; text-decoration: none; color: var(--ink-3); font-size: .85rem; font-weight: 500; }
.chip:hover { color: var(--ink); }
.chip.on { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
.chip b { font: 500 .72rem/1.5 var(--mono); background: var(--grey-bg); color: var(--ink-2); padding: 0 .35rem; border-radius: 2px; }

.pagination { display: flex; gap: .25rem; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-top: 1px solid var(--line-2); font-size: .88rem; color: var(--ink-3); flex-wrap: wrap; }
.pagination .pages { display: flex; gap: .25rem; }
.pagination a, .pagination span.cur { padding: .2rem .6rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.pagination span.cur { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .85rem 1rem; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: .8rem; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--ink-3); }
.req::after { content: " *"; color: var(--red); }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=password], input[type=search], input[type=url], input[type=color], select, textarea {
  font: inherit; color: inherit; width: 100%; padding: .4rem .6rem; border: 1px solid #bfc8d1; border-radius: var(--radius); background: #fff; min-height: 36px; }
input:hover, select:hover, textarea:hover { border-color: #8f9aa6; }
input[type=color] { padding: .15rem; width: 64px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); }
.is-invalid { border-color: var(--red) !important; }
.error { color: var(--red); font-size: .84rem; font-weight: 700; }
.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; }
.check input { width: 18px; height: 18px; margin-top: .15rem; accent-color: var(--brand); }
fieldset { border: 0; padding: 0; margin: 0; }
fieldset legend { font-weight: 600; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 0; margin-bottom: .75rem; }
.form-section + .form-section { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line-2); }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; padding: .75rem 1rem; border-top: 1px solid var(--line); background: var(--head); border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }

.postcode-row { display: flex; gap: .5rem; }
.postcode-row input { max-width: 160px; text-transform: uppercase; }
.pc-results { margin-top: .5rem; }
.pc-msg { font-size: .85rem; margin-top: .35rem; }

/* ---------- Buttons ---------- */
.btn { font: inherit; font-weight: 600; font-size: .88rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .4rem .85rem; border-radius: var(--radius);
  border: 1px solid #bfc8d1; background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; min-height: 36px; white-space: nowrap; box-shadow: 0 1px 0 rgba(16,24,32,.04); }
.btn:hover { border-color: var(--ink-2); background: var(--head); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.15); border-color: var(--brand); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #1c1c1c; }
.btn-danger { color: var(--red); border-color: #e7b4ae; }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-sm { padding: .2rem .55rem; min-height: 30px; font-size: .8rem; }
.btn-link { border: 0; background: none; color: var(--brand); padding: 0; min-height: 0; font-weight: 700; text-decoration: underline; cursor: pointer; font: inherit; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
form.inline { display: inline; }

/* ---------- Flash ---------- */
.flash { padding: .65rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; border-left-width: 4px; font-weight: 600; }
.flash-ok { background: var(--green-bg); color: var(--green); border-color: #b7dfc6; }
.flash-error { background: var(--red-bg); color: var(--red); border-color: #f2b8b2; }
.flash-info { background: var(--blue-bg); color: var(--blue); border-color: #bcd3ef; font-weight: 400; }
.flash ul { margin: .25rem 0 0 1.1rem; padding: 0; font-weight: 400; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--ink-3); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a .muted { font-weight: 400; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .65rem 1rem; border-bottom: 1px solid var(--line-2); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { font-size: .8rem; color: var(--ink-3); }
.timeline .t-status { border-left: 3px solid var(--blue); }
.timeline .t-question { border-left: 3px solid var(--accent); background: #fffaf0; }
.timeline .t-system { color: var(--ink-2); }

/* ---------- Documents ---------- */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.file { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; font-size: .82rem; display: flex; flex-direction: column; }
.file .thumb { height: 96px; background: var(--page) center/cover no-repeat; display: grid; place-items: center; color: var(--ink-3); font-weight: 700; text-decoration: none; }
.file .meta { padding: .4rem .5rem; display: flex; flex-direction: column; gap: .1rem; }
.file .meta a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Estimate lines editor ---------- */
.lines { width: 100%; border-collapse: collapse; }
.lines th { font-size: .8rem; text-align: left; color: var(--ink-2); padding: .4rem .35rem; border-bottom: 1px solid var(--line); }
.lines td { padding: .35rem; vertical-align: top; border-bottom: 1px solid var(--line-2); }
.lines textarea { min-height: 40px; height: 40px; }
.lines input { min-width: 0; }
.lines .w-qty { width: 78px; } .lines .w-unit { width: 86px; } .lines .w-price { width: 108px; }
.lines .w-disc { width: 70px; } .lines .w-vat { width: 78px; } .lines .w-total { width: 110px; text-align: right; padding-top: .8rem; }
.lines .w-x { width: 40px; }
.totals { margin-left: auto; width: min(360px, 100%); border-collapse: collapse; }
.totals td { padding: .3rem .5rem; }
.totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totals tr.grand td { font-weight: 700; font-size: 1.1rem; border-top: 2px solid var(--ink); letter-spacing: -.01em; }

/* ---------- Dialog ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 0; width: min(560px, 94vw); box-shadow: 0 20px 50px rgba(16, 24, 32, .3); }
dialog::backdrop { background: rgba(16, 24, 32, .45); }
dialog .panel-head { border-bottom: 1px solid var(--line-2); }
dialog .panel-body { max-height: 70vh; overflow-y: auto; }

/* ---------- Bars (dashboard chart) ---------- */
.bars { display: flex; align-items: flex-end; gap: .5rem; height: 120px; padding-top: .5rem; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .25rem; height: 100%; justify-content: flex-end; font-size: .78rem; color: var(--ink-3); }
.bars .bar i { display: block; width: 100%; background: var(--brand); border-radius: 1px; min-height: 2px; }
.bars .bar b { color: var(--ink); font-variant-numeric: tabular-nums; }
.pipeline { display: flex; flex-direction: column; gap: .4rem; }
.pipeline a { display: grid; grid-template-columns: 150px 1fr 40px; gap: .5rem; align-items: center; text-decoration: none; color: inherit; font-size: .88rem; }
.pipeline .track { background: var(--line-2); height: 8px; border-radius: 1px; overflow: hidden; }
.pipeline .track i { display: block; height: 100%; background: var(--brand); }

/* ---------- Signature ---------- */
.sig-wrap { border: 1.5px dashed #9aa5b1; border-radius: var(--radius); background: #fff; position: relative; touch-action: none; }
.sig-wrap canvas { display: block; width: 100%; height: 170px; cursor: crosshair; }
.sig-wrap .sig-hint { position: absolute; left: 1rem; bottom: .6rem; color: var(--ink-3); font-size: .85rem; pointer-events: none; }

/* ---------- Auth / public ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--page); }
.auth-card { width: min(420px, 100%); }
.auth-card .panel-body { padding: 1.5rem; }
.public-top { background: var(--brand); color: var(--brand-ink); }
.public-top .inner { max-width: 980px; margin: 0 auto; padding: .9rem 1.25rem; display: flex; align-items: center; gap: .75rem; font-weight: 700; }
.public-top img { max-height: 38px; background: #fff; border-radius: 4px; padding: 2px 4px; }
.public-top { background: linear-gradient(rgba(0,0,0,.28), rgba(0,0,0,.28)), var(--brand); }
.public-top::after { content: ""; display: block; height: 4px; background: repeating-linear-gradient(-45deg, var(--accent) 0 8px, #111 8px 16px); }
.public-main { max-width: 980px; margin: 0 auto; padding: 1.25rem; }
body.embed { background: transparent; }
body.embed .public-main { padding: 0; max-width: none; }

/* ---------- Responsive ---------- */
.topbar .menu-btn { display: none; }
@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(16,24,32,.45); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: .5rem .75rem; }
  .content { padding: 1rem .75rem 3rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .col-8, .col-6, .col-4, .col-3, .col-2 { grid-column: span 12; }
  .col-3.half, .col-2.half, .col-4.half { grid-column: span 6; }
  .hide-sm { display: none; }
  .user-menu .name { display: none; }
  /* Tables become cards */
  table.data.stack thead { display: none; }
  table.data.stack, table.data.stack tbody, table.data.stack tr, table.data.stack td { display: block; width: 100%; }
  table.data.stack tr { padding: .6rem .9rem; border-bottom: 1px solid var(--line); }
  table.data.stack td { border: 0; padding: .12rem 0; }
  table.data.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-3); font-size: .82rem; }
  table.data.stack td.num { text-align: left; }
  .lines thead { display: none; }
  .lines, .lines tbody, .lines tr, .lines td { display: block; width: 100% !important; }
  .lines tr { display: grid; grid-template-columns: repeat(6, 1fr); gap: .4rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .lines td { border: 0; padding: 0; }
  .lines td.c-desc { grid-column: span 6; }
  .lines td.c-qty, .lines td.c-unit, .lines td.c-price { grid-column: span 2; }
  .lines td.c-disc, .lines td.c-vat { grid-column: span 2; }
  .lines td.w-total { grid-column: span 1; padding-top: .55rem; }
  .lines td.w-x { grid-column: span 1; }
  .lines td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--ink-3); }
  .pipeline a { grid-template-columns: 120px 1fr 32px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .sidebar, .topbar, .actions, .form-actions, .filters { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .panel { border: 0; }
}

/* v002 refinements */
.user-menu .name { text-decoration: none; color: var(--ink-2); font-weight: 500; }
.user-menu .name:hover { color: var(--ink); }
.panel-head a.small { font-size: .78rem; font-weight: 500; text-decoration: none; color: var(--brand); }
.panel-head a.small:hover { text-decoration: underline; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* =====================================================================
   v003 — modern SaaS theme: light sidebar, rounded soft cards, charts.
   Overrides earlier rules; brand colours still come from Branding.
   ===================================================================== */
:root {
  --page: #f3f5fa;
  --card: #ffffff;
  --ink: #111827; --ink-2: #4b5563; --ink-3: #8a94a6;
  --line: #e5e8ef; --line-2: #eff1f6; --head: #f8f9fc;
  --radius: 10px; --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(17,24,39,.04), 0 6px 24px rgba(17,24,39,.05);
  --shadow-hover: 0 2px 4px rgba(17,24,39,.05), 0 12px 32px rgba(17,24,39,.09);
  --brand-soft: color-mix(in srgb, var(--brand) 10%, #fff);
  --c1: #3b82f6; --c2: #f59e0b; --c3: #8b5cf6; --c4: #10b981; --c5: #ef4444;
  --c6: #06b6d4; --c7: #ec4899; --c8: #64748b; --c9: #84cc16;
  --green: #059669; --green-bg: #e7f8f0; --amber: #b45309; --amber-bg: #fef4e2;
  --red: #dc2626; --red-bg: #fdecec; --blue: #2563eb; --blue-bg: #eaf1fe; --grey: #5b6474; --grey-bg: #f0f2f6;
  --sidebar: 252px;
}
body { font-size: 14px; background: var(--page); }
h1 { font-size: 1.6rem; letter-spacing: -.02em; }

/* Icons */
.ic { width: 19px; height: 19px; flex: none; }
.ic-sm { width: 16px; height: 16px; flex: none; }
.ic-xs { width: 12px; height: 12px; flex: none; }

/* Sidebar — light */
.sidebar { background: var(--card); color: var(--ink-2); border-right: 1px solid var(--line); }
.sidebar::after { height: 4px; }
.brand { color: var(--ink); border-bottom: 0; padding: 1.15rem 1.2rem 1rem; font-size: 1rem; }
.brand img { background: none; padding: 0; max-height: 36px; }
.brand .brand-mark { background: var(--brand); border-radius: 9px; padding: 5px; width: 34px; height: 34px; }
.nav { padding: .25rem .75rem 1.5rem; }
.nav-group { margin-top: 1.1rem; }
.nav-group > span { color: var(--ink-3); opacity: 1; font-size: .68rem; padding: 0 .75rem .4rem; }
.nav a { justify-content: flex-start; gap: .7rem; padding: .55rem .75rem; border-radius: 10px; opacity: 1; color: var(--ink-2); font-size: .9rem; font-weight: 500; }
.nav a .lbl { flex: 1; }
.nav a .ic { color: var(--ink-3); }
.nav a:hover { background: var(--head); color: var(--ink); }
.nav a:hover .ic { color: var(--ink-2); }
.nav a.active { background: var(--brand-soft); color: var(--brand); box-shadow: none; font-weight: 600; }
.nav a.active .ic { color: var(--brand); }
.nav .count { font: 600 .7rem/1.6 var(--font); background: var(--brand); color: #fff; border-radius: 99px; padding: 0 .45rem; min-width: 1.4rem; text-align: center; }

/* Top bar */
.topbar { background: color-mix(in srgb, var(--page) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 0; height: 64px; padding: 0 1.75rem; }
.topbar input[type=search] { border-radius: 99px; background-color: var(--card); border-color: var(--line); height: 40px; box-shadow: 0 1px 2px rgba(17,24,39,.03); }
.who { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; padding: .25rem .6rem .25rem .25rem; border-radius: 99px; }
.who:hover { background: var(--card); }
.who .name { display: flex; flex-direction: column; line-height: 1.2; }
.who .name b { font-weight: 600; font-size: .86rem; color: var(--ink); }
.who .name small { font-size: .74rem; color: var(--ink-3); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--c3)); color: #fff; font-size: .78rem; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { color: var(--red); border-color: #f3c4c4; }
.menu-btn .ic { width: 18px; height: 18px; }
.content { padding: 1.25rem 1.75rem 3rem; max-width: 1480px; }

/* Page heads */
.page-head { border-bottom: 0; padding-bottom: 0; margin-bottom: 1.25rem; align-items: flex-end; }
.crumbs { margin-bottom: .2rem; }

/* Cards / panels */
.panel, .card { background: var(--card); border: 1px solid rgba(17,24,39,.04); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.panel-head { background: none; border-bottom: 1px solid var(--line-2); padding: 1rem 1.25rem; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.panel-head h2 { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; text-transform: none; color: var(--ink); }
.panel-body { padding: 1.25rem; }
.form-actions { background: none; border-top: 1px solid var(--line-2); padding: 1rem 1.25rem; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
fieldset legend { color: var(--brand); }

/* Buttons & inputs */
.btn { border-radius: 10px; min-height: 40px; padding: .45rem 1rem; border-color: var(--line); box-shadow: 0 1px 2px rgba(17,24,39,.04); }
.btn:hover { background: var(--head); border-color: #cfd5df; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.1); }
.btn-sm { border-radius: 8px; min-height: 32px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=password], input[type=search], input[type=url], select, textarea { border-radius: 10px; border-color: var(--line); min-height: 40px; }
input:hover, select:hover, textarea:hover { border-color: #c7cdd8; }

/* Badges — soft pills */
.badge { border-radius: 99px; text-transform: none; letter-spacing: 0; font-size: .76rem; font-weight: 600; padding: .12rem .6rem; border: 0; }
.badge::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: .38rem; vertical-align: .08rem; }

/* Reference tag — softer */
.ref { border-radius: 7px; border-color: #d6dbe4; font-size: .82rem; }
td .ref { font-size: .76rem; }
a.ref:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Tables */
table.data th { background: var(--head); color: var(--ink-3); font-size: .7rem; border-bottom: 1px solid var(--line-2); padding: .7rem 1rem; }
table.data td { padding: .75rem 1rem; }
table.data tbody tr:hover { background: #fafbfe; box-shadow: none; }
.panel > .table-wrap:last-child table.data tr:last-child td, .card > .table-wrap:last-child table.data tr:last-child td { border-bottom: 0; }
.filters { background: none; border-bottom: 1px solid var(--line-2); padding: .9rem 1.25rem; }
.chips { padding: 0 1.25rem; }
.chip.on { border-bottom-color: var(--brand); color: var(--brand); }
.chip b { border-radius: 99px; background: var(--head); }
.chip.on b { background: var(--brand-soft); color: var(--brand); }
.pagination { padding: .9rem 1.25rem; }
.pagination a, .pagination span.cur { border-radius: 8px; }
.pagination span.cur { background: var(--brand); border-color: var(--brand); }
.tabs a.on { border-bottom-color: var(--brand); color: var(--brand); }
.flash { border-radius: 12px; }
dialog { border-radius: var(--radius-lg); border: 0; }

/* ---------- Dashboard ---------- */
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: .25rem 0 1.4rem; }
.dash-head h1 { margin: 0 0 .25rem; font-size: 1.75rem; }
.dash-head p { margin: 0; }
.eyebrow { font-size: .78rem; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: .08em; margin-bottom: .3rem !important; }
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.25rem; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: 1 / -1; }
a.card { display: block; color: inherit; text-decoration: none; transition: box-shadow .15s, transform .15s; }
a.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.15rem 1.25rem .4rem; }
.card-head h2 { font-size: 1.02rem; font-weight: 600; margin: 0 0 .1rem; letter-spacing: -.01em; }
.card-head p { margin: 0; }
.card-body { padding: .75rem 1.25rem 1.25rem; }
.link { font-size: .8rem; font-weight: 600; color: var(--brand); text-decoration: none; white-space: nowrap; padding: .3rem .65rem; border-radius: 8px; background: var(--brand-soft); }
.link:hover { filter: brightness(.96); }

/* Hero */
.hero { position: relative; overflow: hidden; color: #fff; padding: 1.4rem 1.5rem 1.2rem; border: 0;
  background: radial-gradient(circle at 100% 0, rgba(255,255,255,.18) 0 22%, transparent 23%),
              radial-gradient(circle at 85% 120%, rgba(255,255,255,.12) 0 28%, transparent 29%),
              linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #7c3aed));
  box-shadow: 0 12px 32px color-mix(in srgb, var(--brand) 32%, transparent); display: flex; flex-direction: column; }
.hero-top { display: flex; align-items: center; gap: .65rem; }
.hero-ic { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.18); display: grid; place-items: center; }
.hero-label { font-weight: 600; opacity: .92; flex: 1; }
.hero .trend { background: rgba(255,255,255,.2); color: #fff; }
.hero-value { font-size: 2.4rem; font-weight: 700; letter-spacing: -.03em; margin-top: .9rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-sub { opacity: .8; font-size: .84rem; margin-top: .3rem; }
.hero-bars { display: flex; gap: .55rem; align-items: flex-end; height: 92px; margin-top: auto; padding-top: 1.1rem; }
.hb { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .35rem; font-size: .7rem; opacity: .85; }
.hb i { width: 100%; max-width: 34px; border-radius: 6px; background: rgba(255,255,255,.28); }
.hb.now i { background: #fff; }
.hb.now { opacity: 1; font-weight: 600; }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.kpi { padding: 1.1rem 1.2rem 1rem; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; }
.kpi-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.t-blue { background: #eaf1fe; color: var(--c1); } .t-amber { background: #fef4e2; color: #d97706; }
.t-violet { background: #f1ecfe; color: var(--c3); } .t-green { background: #e7f8f0; color: var(--c4); }
.kpi-label { color: var(--ink-3); font-size: .84rem; font-weight: 500; margin-top: .85rem; }
.kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: .5rem; min-height: 40px; }
.kpi-value { font-size: 1.65rem; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-hint { font-size: .78rem; color: var(--ink-3); margin-top: .35rem; }
.spark { width: 110px; height: 34px; flex: none; }
.trend { display: inline-flex; align-items: center; gap: .15rem; font-size: .74rem; font-weight: 600; padding: .15rem .5rem; border-radius: 99px; }
.trend.up { background: var(--green-bg); color: var(--green); }
.trend.down { background: var(--red-bg); color: var(--red); }
.ring { --p: 50; width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: radial-gradient(closest-side, var(--card) 70%, transparent 71%), conic-gradient(var(--c4) calc(var(--p) * 1%), var(--line-2) 0); }

/* Charts */
.legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -.05rem; }
.totals-row { display: flex; gap: 2.2rem; margin-bottom: .5rem; flex-wrap: wrap; }
.totals-row div { display: flex; flex-direction: column; }
.totals-row b { font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.chart-wrap { height: 260px; }
.chart { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid { stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .ax { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart circle { cursor: default; }
.donut-body { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.donut .d-big { font-size: 30px; font-weight: 700; fill: var(--ink); font-family: var(--font); }
.donut .d-sub { font-size: 12px; fill: var(--ink-3); font-family: var(--font); }
.key { list-style: none; padding: 0; margin: 0; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: .25rem .75rem; }
.key a { display: flex; align-items: center; gap: .45rem; text-decoration: none; color: var(--ink-2); font-size: .82rem; padding: .25rem .35rem; border-radius: 6px; }
.key a:hover { background: var(--head); }
.key i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.key b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Row lists */
.rows { list-style: none; margin: 0; padding: .25rem .6rem .75rem; }
.rows a { display: flex; align-items: center; gap: .8rem; padding: .6rem .65rem; border-radius: 12px; text-decoration: none; color: inherit; }
.rows a:hover { background: var(--head); }
.av { width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center; font-size: .74rem; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.av.t0 { background: #eaf1fe; color: var(--c1); } .av.t1 { background: #f1ecfe; color: var(--c3); } .av.t2 { background: #e7f8f0; color: var(--c4); }
.av.t3 { background: #fef4e2; color: #d97706; } .av.t4 { background: #fdeef6; color: var(--c7); }
.ic-av { background: var(--head); color: var(--ink-3); }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.grow b, .end b { font-weight: 600; font-size: .88rem; }
.grow b, .grow small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows small { color: var(--ink-3); font-size: .76rem; }
.end { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; text-align: right; }
small.warn { color: var(--red) !important; font-weight: 600; }

/* Lead sources */
.src { display: block; text-decoration: none; color: inherit; padding: .45rem 0; }
.src-top { display: flex; justify-content: space-between; font-size: .84rem; margin-bottom: .35rem; color: var(--ink-2); }
.src-top b { color: var(--ink); }
.bar { display: block; height: 7px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; }

@media (max-width: 1280px) {
  .span-5, .span-7 { grid-column: span 12; }
  .span-3 { grid-column: span 6; } .span-4 { grid-column: span 6; }
  .span-8 { grid-column: span 12; }
}
@media (max-width: 900px) {
  .sidebar { background: var(--card); }
  .topbar { padding: 0 .75rem; height: 58px; background: var(--card); }
  .content { padding: 1rem .75rem 3rem; }
  .dash-grid { gap: .9rem; }
  .span-3, .span-4, .span-5, .span-7, .span-8 { grid-column: span 12; }
  .kpis { gap: .9rem; }
  .who .name { display: none; }
  .who { padding: 0; }
  .hero-value { font-size: 2rem; }
  .chart-wrap { height: 210px; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: .9rem; }
  .kpi-value { font-size: 1.3rem; }
  .spark, .ring { display: none; }
  .kpi-ic { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) { a.card:hover { transform: none; } }
.card.hero, a.card.hero { color: #fff; }
.ref { white-space: nowrap; }
@media (min-width: 901px) { .shell { background: linear-gradient(to right, var(--card) var(--sidebar), var(--page) var(--sidebar)); } .sidebar { border-right: 1px solid var(--line); } }
.hero-bars { flex: 1; height: auto; min-height: 110px; }
.hb i { max-width: 40px; }
table.data { font-size: .86rem; }
table.data td { padding: .7rem .75rem; }
table.data th { padding: .65rem .75rem; }
table.data td:first-child, table.data th:first-child { padding-left: 1.25rem; }
table.data td:last-child, table.data th:last-child { padding-right: 1.25rem; }
@media (max-width: 1500px) { .hide-sm { display: none; } }
.split > div { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.split > div > .panel { margin: 0; }
.split { gap: 1.25rem; }

/* Foldable sidebar groups */
.nav-group.fold > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; border-radius: 8px; padding: .3rem .75rem .3rem 0; user-select: none; }
.nav-group.fold > summary::-webkit-details-marker { display: none; }
.nav-group.fold > summary > span { display: block; padding: 0 .75rem; font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.nav-group.fold > summary:hover > span, .nav-group.fold > summary:hover .chev { color: var(--ink); }
.nav-group.fold > summary:focus-visible { box-shadow: var(--focus); }
.nav-group.fold .chev { color: var(--ink-3); transition: transform .15s; }
.nav-group.fold:not([open]) .chev { transform: rotate(-90deg); }
.nav-group.fold .fold-body { padding-top: .25rem; }
@media (prefers-reduced-motion: reduce) { .nav-group.fold .chev { transition: none; } }

/* =====================================================================
   v005 — jobs board & maps, reminders, mailbox, certificates
   ===================================================================== */
:root { --st-not: #475569; --st-prog: #2563eb; --st-hold: #f97316; --st-cancel: #94a3b8; --st-done: #16a34a; }

/* Segmented switch (List / Job board / Job map) */
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg a { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .7rem; border-radius: 7px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .84rem; }
.seg a:hover { background: var(--head); color: var(--ink); }
.seg a.on { background: var(--brand); color: #fff; }

/* Status dot */
.sdot { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .84rem; white-space: nowrap; }
.sdot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--sd); }

/* Legend toggles above maps */
.legend-bar { display: flex; flex-wrap: wrap; gap: .4rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--line-2); }
.legend-btn { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 99px; background: var(--card); font: inherit; font-size: .84rem; color: var(--ink-2); cursor: pointer; }
.legend-btn i { width: 10px; height: 10px; border-radius: 50%; }
.legend-btn b { font-variant-numeric: tabular-nums; color: var(--ink); }
.legend-btn[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }

/* Maps */
.map { height: 360px; background: #aad3df; z-index: 0; }
.map-lg { height: calc(100vh - 330px); min-height: 460px; }
.map-sm { height: 220px; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.panel > .map:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.map-note { padding: .75rem 1.25rem; display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 0; }
.leaflet-container { font: inherit; }
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--shadow-hover); }
.pop { display: flex; flex-direction: column; gap: .15rem; font-size: .84rem; min-width: 200px; }
.pop-title { font-weight: 700; color: var(--ink) !important; text-decoration: none; font-size: .9rem; }
.pop-muted { color: var(--ink-3); }
.pop-tag { align-self: flex-start; color: #fff; font-size: .7rem; font-weight: 700; padding: .05rem .5rem; border-radius: 99px; margin-bottom: .2rem; }
.pop-link { margin-top: .35rem; font-weight: 600; }

/* Job board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(205px, 1fr); gap: .8rem; padding: 1.25rem; overflow-x: auto; align-items: start; }
.col { background: var(--head); border-radius: 12px; border-top: 4px solid var(--col); display: flex; flex-direction: column; min-height: 220px; transition: background .12s; }
.col.drop { background: color-mix(in srgb, var(--col) 9%, var(--head)); outline: 2px dashed color-mix(in srgb, var(--col) 50%, transparent); outline-offset: -2px; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: .7rem .85rem; font-weight: 700; background: var(--card); border-radius: 0 0 8px 8px; margin: 0 0 .5rem; box-shadow: 0 1px 0 var(--line-2); }
.col-head b { font: 600 .74rem/1.6 var(--font); background: var(--head); border-radius: 99px; padding: 0 .5rem; color: var(--ink-2); }
.col-list { display: flex; flex-direction: column; gap: .55rem; padding: 0 .6rem .7rem; min-height: 60px; flex: 1; }
.col-empty { display: none; text-align: center; color: var(--ink-3); font-size: .82rem; padding: 0 0 1rem; }
.col.is-empty .col-empty { display: block; margin-top: -2.5rem; pointer-events: none; }
.jcard { background: var(--card); border-radius: 10px; padding: .7rem .8rem; box-shadow: 0 1px 2px rgba(17,24,39,.06), 0 0 0 1px rgba(17,24,39,.04); border-left: 3px solid var(--col); position: relative; }
.jcard[draggable="true"] { cursor: grab; }
.jcard.dragging { opacity: .45; transform: rotate(1.5deg); }
.jcard-top { display: flex; justify-content: space-between; align-items: center; gap: .4rem; }
.jnum { font: 600 .74rem/1.4 var(--mono); color: var(--ink-3); text-decoration: none; }
.jtitle { display: block; font-weight: 600; color: var(--ink); text-decoration: none; margin: .2rem 0 .15rem; line-height: 1.3; }
.jtitle:hover { color: var(--brand); }
.jmeta { font-size: .8rem; display: flex; align-items: center; gap: .25rem; }
.jfoot { display: flex; justify-content: space-between; align-items: center; margin-top: .45rem; }
.jfoot .small { display: inline-flex; align-items: center; gap: .25rem; }
.mini-av { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: .64rem; font-weight: 700; display: grid; place-items: center; }
.jmove { display: none; margin-top: .5rem; }
.jmove select { min-height: 30px; padding: .15rem .4rem; font-size: .8rem; }
.jcard:focus-within .jmove { display: block; }
@media (pointer: coarse), (max-width: 900px) { .jmove { display: block; } .jcard[draggable="true"] { cursor: default; } }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 10px; font-size: .86rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; box-shadow: var(--shadow-hover); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Top bar icons with counts */
.icon-btn { position: relative; text-decoration: none; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn .dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 99px; background: var(--red); color: #fff; font: 700 .64rem/18px var(--font); text-align: center; padding: 0 4px; font-style: normal; border: 2px solid var(--page); }
.icon-btn .dot.blue { background: var(--brand); }
.nav .count.warn { background: var(--red); }
.nav .count.soft { background: var(--line-2); color: var(--ink-2); }

/* Reminders */
.rlist { list-style: none; margin: 0; padding: .35rem .6rem .75rem; }
.rlist li { display: flex; align-items: center; gap: .7rem; padding: .55rem .6rem; border-radius: 10px; }
.rlist li + li { border-top: 1px solid var(--line-2); border-radius: 0; }
.rlist li.due b { color: var(--red); }
.rlist li.is-done b { text-decoration: line-through; color: var(--ink-3); }
.rlist li.is-cur { background: var(--brand-soft); border-radius: 10px; }
.rlist .grow small { color: var(--ink-3); font-size: .76rem; }
.rlist.big li { padding: .85rem .75rem; align-items: flex-start; }
.r-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--head); color: var(--ink-3); flex: none; }
.rlist li.due .r-ic { background: var(--red-bg); color: var(--red); }
.rlist li.is-done .r-ic { background: var(--green-bg); color: var(--green); }
.r-actions { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.r-actions .snooze select { min-height: 32px; padding: .15rem .45rem; font-size: .8rem; width: auto; }

/* Mailbox */
.mb { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.mb-side { position: sticky; top: 80px; display: flex; flex-direction: column; gap: .75rem; }
.mb-compose { width: 100%; justify-content: center; }
.mb-folders { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: .35rem; display: flex; flex-direction: column; }
.mb-folders a { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.mb-folders a span { flex: 1; }
.mb-folders a:hover { background: var(--head); color: var(--ink); }
.mb-folders a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.mb-folders b { font: 700 .7rem/1.6 var(--font); background: var(--brand); color: #fff; padding: 0 .45rem; border-radius: 99px; }
.mb-folders b.soft { background: var(--line-2); color: var(--ink-2); }
.mb-sync { display: flex; flex-direction: column; gap: .4rem; padding: 0 .3rem; }
.mb-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.mb-head h1 { margin: 0; }
.mb-search { display: flex; gap: .4rem; }
.mb-search input { min-width: 260px; }
.mb-search select { width: auto; }
.mb-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 1.25rem; align-items: start; }
.mb-body.no-preview { grid-template-columns: 1fr; }
.mb-body.no-preview .mb-preview { display: none; }
.mb-tools { display: flex; align-items: center; gap: .15rem; padding: .55rem .75rem; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.mb-all { margin-right: .4rem; }
.tb { width: 36px; height: 34px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; color: var(--ink-3); cursor: pointer; }
.tb:hover { background: var(--head); color: var(--ink); }
.tb.t-amber:hover { color: #d97706; } .tb.t-violet:hover { color: var(--c3); } .tb.t-green:hover { color: var(--green); } .tb.t-red:hover { color: var(--red); }
.mb-count { margin-left: auto; }
.mb-rows { list-style: none; margin: 0; padding: 0; }
.mb-rows li { display: flex; align-items: flex-start; gap: .35rem; padding: .25rem .5rem .25rem .75rem; border-bottom: 1px solid var(--line-2); position: relative; }
.mb-rows li .check { padding-top: .85rem; }
.mb-rows li.unread::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.mb-rows li.unread .who, .mb-rows li.unread .mb-subj { font-weight: 700; color: var(--ink); }
.mb-rows li.sel { background: var(--brand-soft); }
.mb-rows li:hover:not(.sel) { background: #fafbfe; }
.mb-rows.plain li { padding: 0 .5rem; }
.star { border: 0; background: none; padding: .8rem .2rem 0; color: #cbd2dc; cursor: pointer; }
.star.on { color: #f59e0b; }
.star.on svg { fill: currentColor; }
.mb-row { display: flex; gap: .7rem; padding: .6rem .3rem; text-decoration: none; color: inherit; flex: 1; min-width: 0; }
.av.sm { width: 34px; height: 34px; border-radius: 50%; font-size: .68rem; }
.av.sm.out { background: var(--head); color: var(--ink-3); }
.mb-top { display: flex; justify-content: space-between; gap: .5rem; }
.mb-top .who { font-weight: 500; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-top time { color: var(--ink-3); font-size: .76rem; white-space: nowrap; }
.mb-subj, .mb-snip { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mb-subj { color: var(--ink-2); font-size: .88rem; }
.mb-subj .flag { color: var(--c3); vertical-align: -.1rem; }
.mb-snip { color: var(--ink-3); font-size: .8rem; }
.tagc { display: inline-block; margin-top: .2rem; font-size: .7rem; font-weight: 600; color: var(--brand); background: var(--brand-soft); border-radius: 6px; padding: .02rem .4rem; }
.mb-preview { position: sticky; top: 80px; min-height: 360px; max-height: calc(100vh - 100px); overflow-y: auto; }
.mb-preview.full { position: static; max-height: none; max-width: 980px; }
.mb-empty-preview { display: grid; place-items: center; text-align: center; color: var(--ink-3); padding: 5rem 1rem; }
.mb-empty-preview .ic { width: 40px; height: 40px; margin: 0 auto .5rem; opacity: .5; }
.mb-msg-head { padding: 1.1rem 1.25rem .8rem; border-bottom: 1px solid var(--line-2); }
.mb-msg-head h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.mb-msg-meta { display: flex; gap: .7rem; align-items: flex-start; }
.mb-msg-actions { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .8rem; }
.mb-link { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; padding: .55rem 1.25rem; border-bottom: 1px solid var(--line-2); font-size: .84rem; background: var(--head); }
.mb-link span { display: inline-flex; gap: .3rem; align-items: center; }
.mb-linkform { margin-left: auto; }
.mb-linkform select { min-height: 32px; padding: .15rem .45rem; font-size: .8rem; width: auto; max-width: 240px; }
.mb-frame { width: 100%; min-height: 260px; border: 0; display: block; padding: .5rem .75rem; background: #fff; }
.mb-att { display: flex; flex-wrap: wrap; gap: .45rem; padding: .8rem 1.25rem 1.1rem; border-top: 1px solid var(--line-2); }
.att { display: inline-flex; gap: .35rem; align-items: center; padding: .35rem .65rem; border: 1px solid var(--line); border-radius: 8px; font-size: .82rem; text-decoration: none; color: var(--ink); }
.att:hover { border-color: var(--brand); color: var(--brand); }
details.quoted { border: 1px solid var(--line); border-radius: 10px; padding: .5rem .75rem; }
@media (max-width: 1280px) { .mb-body { grid-template-columns: 1fr; } .mb-body .mb-preview { display: none; } }
@media (max-width: 900px) {
  .mb { grid-template-columns: 1fr; }
  .mb-side { position: static; }
  .mb-folders { flex-direction: row; overflow-x: auto; }
  .mb-folders a { white-space: nowrap; }
  .mb-sync { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .mb-search input { min-width: 0; }
}

/* Certificates */
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; padding: 0; margin: 0 0 1.25rem; }
.steps li { display: flex; align-items: center; gap: .55rem; background: var(--card); border-radius: 12px; padding: .65rem .85rem; font-weight: 600; color: var(--ink-3); box-shadow: var(--shadow); font-size: .88rem; }
.steps li span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--head); font-size: .78rem; flex: none; }
.steps li.done { color: var(--green); }
.steps li.done span { background: var(--green); color: #fff; }
.steps li.now { color: var(--brand); box-shadow: 0 0 0 2px var(--brand), var(--shadow); }
.steps li.now span { background: var(--brand); color: #fff; }
.qr-box { text-align: center; }
.qr svg { width: 150px; height: 150px; }
.lines.cl .w-res { width: 150px; }
.verify { max-width: 560px; margin: 1.5rem auto; }
.verify-top { display: flex; gap: .9rem; align-items: center; padding: 1.2rem 1.25rem; border-radius: var(--radius-lg) var(--radius-lg) 0 0; color: #fff; }
.verify-top.v-green { background: var(--green); } .verify-top.v-red { background: var(--red); } .verify-top.v-amber { background: #d97706; } .verify-top.v-grey { background: var(--grey); }
.verify-ic { width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; flex: none; }
.verify-ic .ic { width: 26px; height: 26px; }
.verify-state { font-weight: 700; font-size: 1.1rem; }
@media (max-width: 700px) { .steps { grid-template-columns: 1fr 1fr; } }
.tagc { align-self: flex-start; }
@media (max-width: 1280px) { .mb-toggle { display: none; } }

/* ---------- v006: form builder, public forms, invoices ---------- */
.fb-list { display: flex; flex-direction: column; gap: .6rem; }
.fb-row { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: .7rem .75rem; position: relative; }
.fb-row:hover { border-color: #c9d0db; }
.fb-row[data-type="heading"], .fb-row[data-type="paragraph"] { background: var(--head); }
.fb-main { display: grid; grid-template-columns: 26px 170px minmax(0, 1fr) 110px auto 34px; grid-template-areas: "move type label label label del" "move width maps maps req ."; gap: .55rem .6rem; align-items: end; }
.fb-move { grid-area: move; align-self: start; padding-top: 1.35rem; } .fb-type { grid-area: type; } .fb-label { grid-area: label; } .fb-width { grid-area: width; }
.fb-maps { grid-area: maps; } .fb-req { grid-area: req; } .fb-del { grid-area: del; }
.fb-row[data-type="heading"] .fb-main, .fb-row[data-type="paragraph"] .fb-main { grid-template-areas: "move type label label label del" "move width . . . ."; }
[hidden] { display: none !important; }
.fb-main .field { margin: 0; }
.fb-main label.small, .fb-more label.small { font-size: .72rem; color: var(--ink-3, #8a94a6); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; margin-bottom: .2rem; }
.fb-move { display: flex; flex-direction: column; gap: 2px; padding-bottom: 2px; }
.fb-move .icon-btn { width: 24px; height: 18px; }
.fb-req { white-space: nowrap; padding-bottom: .55rem; margin: 0; }
.fb-del { margin-bottom: 4px; color: var(--red); }
.fb-more { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .6rem; padding-left: 34px; }
.fb-more .field { margin: 0; }
.fb-options { grid-column: 1 / -1; }
.fb-key { grid-column: 1 / -1; font-family: var(--mono); font-size: .72rem; }
.fb-add { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--line); }
.fb-bar { position: sticky; bottom: 0; z-index: 5; margin-top: 1rem; }
.fb-bar .panel-body { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .7rem 1rem; }
.slug-row { display: flex; align-items: center; gap: .35rem; }
.slug-row input { flex: 1; min-width: 0; }
.pf-heading { font-size: 1.05rem; margin: .75rem 0 0; padding-bottom: .35rem; border-bottom: 1px solid var(--line); }
.choice { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; padding: .3rem 0; }
.choice .check { margin: 0; }
tr.unread-row td { font-weight: 600; }
tr.unread-row td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 640px) {
  .fb-main { grid-template-columns: 1fr 1fr 34px; grid-template-areas: "move move del" "type width width" "label label label" "maps maps maps" "req req req"; }
  .fb-row[data-type="heading"] .fb-main, .fb-row[data-type="paragraph"] .fb-main { grid-template-areas: "move move del" "type width width" "label label label"; }
  .fb-move { flex-direction: row; padding-top: 0; }
  .fb-more { grid-template-columns: 1fr; padding-left: 0; }
}
.fin-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; }
.fin-strip > a { display: flex; gap: .85rem; align-items: center; padding: 1.1rem 1.25rem; color: inherit; text-decoration: none; border-left: 1px solid var(--line-2, #eff1f6); }
.fin-strip > a:first-child { border-left: 0; }
.fin-strip > a:hover { background: var(--head); }
.fin-strip > a > span:last-child { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.fin-strip b { font-size: 1.25rem; font-variant-numeric: tabular-nums; margin: .1rem 0; }
.fin-strip b.neg { color: var(--red); }
@media (max-width: 900px) { .fin-strip { grid-template-columns: 1fr 1fr; } .fin-strip > a:nth-child(3) { border-left: 0; } .fin-strip > a:nth-child(n+3) { border-top: 1px solid var(--line-2, #eff1f6); } }
@media (max-width: 480px) { .fin-strip { grid-template-columns: 1fr; } .fin-strip > a { border-left: 0; border-top: 1px solid var(--line-2, #eff1f6); } .fin-strip > a:first-child { border-top: 0; } }

/* ---------- v007: placeholders + email signatures ---------- */
.label-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .3rem; }
.label-row label { margin: 0; }
.ph-picker { display: flex; flex-direction: column; gap: .5rem; }
.ph-search { width: 100%; }
.ph-scroll { display: flex; flex-direction: column; gap: .7rem; }
.ph-title { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3, #8a94a6); margin: 0 0 .25rem; }
.ph-item { display: flex; width: 100%; align-items: baseline; gap: .5rem; text-align: left; background: none; border: 0; border-radius: 6px; padding: .3rem .45rem; cursor: pointer; color: var(--ink); font: inherit; }
.ph-item:hover, .ph-item:focus-visible { background: var(--head); }
.ph-item code { font-family: var(--mono); font-size: .76rem; color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); padding: .05rem .35rem; border-radius: 4px; white-space: nowrap; }
.ph-item span { font-size: .8rem; color: var(--ink-2, #4b5563); min-width: 0; }
.ph-panel .ph-scroll { max-height: 62vh; overflow: auto; padding-right: .25rem; }
.ph-pop { position: relative; }
.ph-pop > summary { list-style: none; cursor: pointer; }
.ph-pop > summary::-webkit-details-marker { display: none; }
.ph-pop-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: min(360px, 86vw); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(17,24,39,.14); padding: .7rem; }
.ph-pop-body .ph-scroll { max-height: 300px; overflow: auto; }
.ph-note { margin: .4rem 0 0; }
.sig-option { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; }
.sig-option .check { margin: 0; }
.sig-peek { flex-basis: 100%; }
.sig-peek > summary { cursor: pointer; color: var(--ink-2, #4b5563); }
.sig-peek .sig-frame { margin: .5rem 0 .25rem; border: 1px dashed var(--line); border-radius: var(--radius); }
.sig-frame { display: block; width: 100%; height: 120px; border: 0; background: #fff; }
.sig-designs { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .9rem; }
.sig-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.sig-tabs { display: inline-flex; gap: 2px; background: var(--head); border: 1px solid var(--line); border-radius: 8px; padding: 2px; margin-bottom: .6rem; }
.sig-tabs button { border: 0; background: none; font: inherit; font-size: .82rem; font-weight: 600; padding: .3rem .8rem; border-radius: 6px; color: var(--ink-2, #4b5563); cursor: pointer; }
.sig-tabs button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(17,24,39,.08); }
textarea.code { font-family: var(--mono); font-size: .78rem; line-height: 1.5; white-space: pre; tab-size: 2; min-height: 360px; }
.sig-mail { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.sig-mail-head { display: flex; gap: 5px; padding: .5rem .7rem; background: var(--head); border-bottom: 1px solid var(--line); }
.sig-mail-head span { width: 9px; height: 9px; border-radius: 50%; background: #d6dbe3; }
.sig-mail-body { padding: .9rem 1rem 1rem; }
.sig-dummy { font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 1.55; color: #18212b; margin: 0 0 .25rem; }
.sig-ph { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; background: var(--card); }
.sig-ph .ph-head { display: flex; flex-direction: column; margin-bottom: .5rem; }
.sig-ph .ph-scroll { max-height: 470px; overflow: auto; }
.sig-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-bottom: 1.1rem; }
.sig-mode { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .85rem; cursor: pointer; }
.sig-mode:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; background: color-mix(in srgb, var(--brand) 4%, var(--card)); }
.sig-mode span { display: flex; flex-direction: column; gap: .15rem; }
.sig-mode input { margin-top: .2rem; }
@media (max-width: 900px) { .sig-grid { grid-template-columns: 1fr; } .sig-modes { grid-template-columns: 1fr; } }
.sig-link { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
