:root {
  --red: #E84158; --red-hover: #d6364c; --dark: #3B3C43; --gray: #9D9D9C; --light: #DADADA; --tint: #F1F1F1;
  --ink: #26272b; --muted: #6b6b70; --ok: #1e7e34; --bg: #f7f7f6; --card: #ffffff;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); }
.top { display: flex; align-items: center; gap: 16px; background: var(--dark); color: #fff; padding: 10px 20px; flex-wrap: wrap; }
.logo { height: 22px; }
.product { font-weight: 600; letter-spacing: .5px; color: var(--light); }
nav { display: flex; gap: 4px; margin-left: 12px; }
.tab { background: transparent; color: var(--light); border: 0; padding: 8px 12px; border-radius: 6px; cursor: pointer; font: inherit; }
.tab.active, .tab:hover { background: rgba(255,255,255,.12); color: #fff; }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--red); color: #fff; vertical-align: middle; }
.link { background: none; border: 0; color: var(--light); text-decoration: underline; cursor: pointer; font: inherit; }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 8px; }
.muted { color: var(--muted); margin: 4px 0 12px; }
.card { background: var(--card); border: 1px solid var(--light); border-radius: 8px; padding: 14px 16px; margin-bottom: 14px; }
.narrow { max-width: 380px; margin: 60px auto; }
form label, .filters label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
form label { margin-bottom: 12px; }
input, select { font: inherit; padding: 7px 9px; border: 1px solid var(--light); border-radius: 6px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.filters label { min-width: 180px; flex: 1 1 180px; }
button.primary, button.secondary, button.small { font: inherit; border-radius: 6px; padding: 8px 14px; cursor: pointer; border: 1px solid transparent; }
button.primary { background: var(--red); color: #fff; }
button.primary:hover { background: var(--red-hover); }
button.secondary { background: #fff; border-color: var(--light); color: var(--ink); }
button.secondary:hover { background: var(--tint); }
button.small { padding: 4px 10px; font-size: 13px; background: #fff; border-color: var(--light); }
button.small.on { background: var(--red); border-color: var(--red); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }
.table-wrap { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--tint); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: var(--tint); position: sticky; top: 0; }
tr.filed td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
tr.retired { color: var(--gray); }
.status-filed { color: var(--ok); font-weight: 600; }
.status-retired { color: var(--gray); }
.code { font-weight: 600; white-space: nowrap; }
.error { color: var(--red); min-height: 1.2em; margin: 0 0 8px; }
dialog { border: 1px solid var(--light); border-radius: 10px; padding: 18px 20px; max-width: 420px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0,0,0,.35); }
#freq-options label { display: flex; flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; margin: 6px 0; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 9px 16px; border-radius: 6px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }
@media (max-width: 640px) {
  .top { padding: 10px 16px; }
  .who { margin-left: 0; width: 100%; }
  th:nth-child(3), td:nth-child(3), th:nth-child(4), td:nth-child(4) { display: none; }
}
.tenant { display: flex; align-items: center; gap: 6px; color: var(--light); font-size: 13px; }
.tenant select { padding: 4px 6px; }
.tenant-name { color: var(--light); font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 14px; }
.entity { text-align: left; font: inherit; color: inherit; cursor: pointer; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.entity:hover { border-color: var(--red); }
.entity-head { display: flex; justify-content: space-between; }
.entity-name { font-weight: 600; }
.small { font-size: 12.5px; }
.warn { color: #b25e09; }
.bar { height: 6px; background: var(--tint); border-radius: 3px; overflow: hidden; }
.bar .fill { display: block; height: 100%; width: 0; background: var(--ok); }
.kpis { display: flex; gap: 8px; }
.kpi { font-size: 12.5px; padding: 2px 8px; border-radius: 10px; background: var(--tint); }
.kpi.bad, td.bad { color: #fff; background: var(--red); }
td.bad { color: var(--red); background: none; font-weight: 600; }
.steps { list-style: none; padding: 0; margin: 0; }
.step { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--tint); }
.step .icon { flex: 0 0 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; background: var(--tint); color: var(--muted); }
.step.done .icon { background: #e2f4e6; color: var(--ok); }
.step.warn .icon { background: #d9822b; color: #fff; }
tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
#user-form label, #client-form label { min-width: 150px; }
[hidden] { display: none !important; }
td.nowrap, button.small { white-space: nowrap; }
.banner { background: #fdecef; border: 1px solid var(--red); color: var(--ink); border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; }
.steptabs { display: flex; gap: 6px; margin: 0 0 12px; flex-wrap: wrap; }
.steptab { font: inherit; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--light); background: #fff; cursor: pointer; }
.steptab.active { background: var(--dark); border-color: var(--dark); color: #fff; }
.cards.two { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.upload h2 { margin-bottom: 2px; }
.filebtn { display: inline-flex !important; flex-direction: row !important; align-items: center; background: var(--red); color: #fff !important; border-radius: 6px; padding: 8px 14px; cursor: pointer; font-size: 14px !important; margin-top: 4px; }
.filebtn:hover { background: var(--red-hover); }
.filebtn input { display: none; }
.rv-head { font-weight: 600; margin: 8px 0; }
.rv-head.ok { color: var(--ok); } .rv-head.bad { color: #b02a37; } .rv-head.warn { color: #9a6700; }
.notes { margin: 4px 0 10px; padding-left: 18px; color: var(--muted); }
details { margin: 8px 0; } summary { cursor: pointer; color: var(--ink); }
.scroll { max-height: 320px; overflow: auto; }
.scroll-x { overflow-x: auto; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.lvl-Error td:first-child { color: #b02a37; font-weight: 600; } tr.lvl-Check td:first-child { color: #9a6700; font-weight: 600; }
tr.issue td:nth-child(8) { color: #b02a37; font-weight: 600; }
tr.documented td:nth-child(8) { color: var(--muted); }
tr.sel { background: #fdecef; }
.grow { flex: 2 1 260px !important; }
#out-table th { white-space: nowrap; }
#out-table tr.totals td { font-weight: 700; border-top: 2px solid var(--dark); }
#out-table th.sec-NET, #out-table td.total { background: var(--tint); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--tint); }
.pill.closed { background: var(--dark); color: #fff; } .pill.open { background: #e2f4e6; color: var(--ok); }
[data-noedit] { display: none !important; }
.full { flex: 1 1 100% !important; }
#inc-form { align-items: flex-end; }
@media (max-width: 640px) {
  nav { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; }
}

.cfg-main { min-width: 0; }
.cfg-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.cfg-list { max-height: none; overflow: auto; }
.cfg-list tr.click { cursor: pointer; }
.cfg-list tr.click:hover { background: var(--tint); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin: 0; }
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid label.check { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; color: var(--ink); grid-column: 1 / -1; }
.form-grid textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--light); border-radius: 6px; resize: vertical; }
.form-grid input:disabled, .form-grid select:disabled, .form-grid textarea:disabled { background: var(--tint); color: var(--ink); }
.mono { font-family: Consolas, "Cascadia Mono", Menlo, monospace !important; font-size: 13px !important; }
.scope { display: flex; gap: 6px; } .scope select { flex: 1; min-width: 0; }
.cfg-test { border-top: 1px solid var(--light); margin-top: 14px; padding-top: 10px; }
.cfg-test pre { background: var(--tint); padding: 10px; border-radius: 6px; white-space: pre-wrap; max-height: 260px; overflow: auto; margin: 8px 0 0; }
.ok-note { color: var(--ok); font-weight: 600; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-width: 0; }
.form-grid label.check input { width: auto; }
body.wide main { max-width: 1500px; }
.emp-split { grid-template-columns: minmax(0, .8fr) minmax(0, 1.6fr); }
.emp-card { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.check-inline { flex-direction: row !important; align-items: center; gap: 8px; color: var(--ink) !important; }
tr.overdue-row td:nth-child(7) { color: #b02a37; font-weight: 600; }
tr.done td:first-child { color: var(--muted); text-decoration: line-through; }
#b-table td, #b-table th { white-space: nowrap; }
@media (max-width: 1000px) { .emp-split { grid-template-columns: 1fr; } .form-grid.three { grid-template-columns: 1fr 1fr; } }
/* -- dashboard: payroll quality ------------------------------------------------------------------------------- */
.viz-root {
  --surface-1: #ffffff; --text-primary: #26272b; --text-secondary: #6b6b70;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --deemph: #c9c8c2; --deemph-ink: #8f8e88;
  --grid: #ececea; --grid-strong: #b9b8b2;
  --good: #0ca30c; --warning: #fab219; --critical: #d03b3b;
}
.viz-root.loading { opacity: .55; transition: opacity .15s; }
.dash-tabs { margin: 0; align-self: flex-end; }
.attention { display: block; background: #fff7e6; border: 1px solid #f0c36d; color: var(--ink); border-radius: 8px; padding: 9px 14px; margin-bottom: 14px; text-decoration: none; font-weight: 600; }
.attention:hover { background: #ffefcc; }
.kpis-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi-tile { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 13px; color: var(--text-secondary); }
.kpi-value { font-size: 32px; font-weight: 600; line-height: 1.1; color: var(--text-primary); }
.kpi-sub { font-size: 12.5px; color: var(--text-secondary); min-height: 2.6em; }
.spark { width: 100%; height: 28px; margin-top: auto; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-primary); align-self: flex-start; }
.chip-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 700; color: #fff; }
.chip.good .chip-icon { background: var(--good); }
.chip.warning .chip-icon { background: var(--warning); color: #3b2a00; }
.chip.critical .chip-icon { background: var(--critical); }
.chip.none { color: var(--text-secondary); }
.viz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; }
.viz-card { margin-bottom: 14px; min-width: 0; }
.viz-card h2 { margin-bottom: 2px; }
.chart { width: 100%; min-height: 240px; }
.chart svg { display: block; overflow: visible; }
.chart text.axis { font-size: 11.5px; fill: var(--text-secondary); font-variant-numeric: tabular-nums; }
.chart text.end-label { font-size: 12px; fill: var(--text-primary); }
.chart text.bar-total { font-size: 11.5px; fill: var(--text-secondary); }
.chart .bar-seg { stroke: none; }
.chart rect[tabindex]:focus { outline: none; }
.chart rect[tabindex]:focus-visible { stroke: var(--grid-strong); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 4px; font-size: 12.5px; color: var(--text-primary); }
.lg-item { display: inline-flex; align-items: center; gap: 6px; }
.lg-box { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.lg-line { width: 16px; height: 2px; border-radius: 1px; display: inline-block; }
.viz-tip { position: fixed; z-index: 50; background: #fff; border: 1px solid var(--light); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.12); padding: 8px 10px; font-size: 12.5px; pointer-events: none; min-width: 150px; }
.tip-title { color: #6b6b70; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.tip-row strong { font-variant-numeric: tabular-nums; min-width: 44px; }
.tip-key { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
@media (max-width: 640px) { .viz-grid { grid-template-columns: 1fr; } .kpi-value { font-size: 28px; } }
#q-rows .chip { white-space: nowrap; }
#q-rows td:first-child { min-width: 160px; }
/* -- one entity filter for every page (top bar) ------------------------------------------------------------- */
.page-entity { display: none !important; }
#g-entity { max-width: 260px; }
.entity-pick { max-width: 720px; }
.pick-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pick-list button { font: inherit; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--light); background: #fff; cursor: pointer; text-align: left; }
.pick-list button:hover { border-color: var(--red); }
.pick-list .code { display: block; }
.needs-entity > .cfg-toolbar, .needs-entity > .cfg-list, .needs-entity > #cfg-inline, .needs-entity > #cfg-note { display: none !important; }
/* -- tax return check ------------------------------------------------------------------------------------- */
.tax-split { grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); }
.warn-list li { color: #8a5a00; }
.decl { border-top: 1px solid var(--tint); padding-top: 10px; margin-top: 10px; }
.decl:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.decl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.box-table input { width: 120px; text-align: right; }
tr.box-diff td { background: #fdecef; }
.decl-form { margin-top: 10px; align-items: flex-end; }
.chip.pending .chip-icon { background: #6b6b70; }
.chip .chip-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 700; color: #fff; }
.chip.good .chip-icon { background: #0ca30c; } .chip.critical .chip-icon { background: #d03b3b; }
.chip.warning .chip-icon { background: #fab219; color: #3b2a00; } .chip.none .chip-icon { background: #c9c8c2; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
@media (max-width: 1000px) { .tax-split { grid-template-columns: 1fr; } }
.tax-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
#x-rows .muted.small { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#x-rows .chip { white-space: nowrap; }
.box-table input { width: 104px; }
.box-table td:first-child { min-width: 180px; }
#x-rows td.bad, #x-rows div.bad { color: #b02a37; font-weight: 600; }
.multi { border: 1px solid var(--light); border-radius: 6px; padding: 8px; background: #fff; }
.multi-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.multi-bar input { flex: 1; }
.multi-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.form-grid .multi-row { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--ink) !important; padding: 3px 4px; border-radius: 4px; font-size: 13.5px !important; }
.multi-row:hover { background: var(--tint); }
.multi-row span { flex: 1; }
.multi-row input[type=checkbox] { width: auto !important; }
.multi-row .sign { width: 28px; height: 24px; border: 1px solid var(--light); background: #fff; border-radius: 4px; cursor: pointer; font-weight: 700; }
.multi-row .sign:disabled { opacity: .35; cursor: default; }
.form-grid > div.fieldbox { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); grid-column: 1 / -1; }
.warn-note { background: #fff7e6; border: 1px solid #f0c36d; border-radius: 8px; padding: 9px 14px; color: var(--ink); }
.multi-row.pending span { color: #8a5a00; font-weight: 600; }

/* -- Configuration: overview cards, topic tabs, full-width list and an editor that slides in -------------------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cfg-home-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.cfg-home-head .muted { margin-bottom: 0; }
.cfg-find input { width: min(420px, 90vw); padding: 9px 12px; }
.cfg-find-results { display: flex; flex-direction: column; gap: 2px; padding: 6px; }
.find-hit { display: grid; grid-template-columns: 220px 220px 1fr; gap: 12px; align-items: baseline; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: inherit; cursor: pointer; color: var(--ink); }
.find-hit:hover, .find-hit:focus-visible { background: var(--tint); }
@media (max-width: 760px) { .find-hit { grid-template-columns: 1fr; gap: 2px; } }
.cfg-sec { margin: 18px 0 8px; }
.cfg-sec-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.cfg-sec-head h2 { margin: 0; }
.cfg-sec-head .muted { margin: 0; }
.tag-dark { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; background: var(--dark); color: #fff; border-radius: 8px; padding: 2px 8px; }
.cfg-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.cfg-card { background: var(--card); border: 1px solid var(--light); border-top: 4px solid var(--light); border-radius: 8px; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.cfg-card.state-done { border-top-color: var(--ok); }
.cfg-card.state-warn { border-top-color: #e0a100; }
.cfg-card.state-todo { border-top-color: var(--red); }
.cfg-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cfg-card-head h3 { margin: 0; font-size: 16px; }
.cfg-card-desc { margin: 0; }
.cfg-lines { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.cfg-lines li { display: grid; grid-template-columns: 16px 1fr auto; gap: 6px; align-items: start; }
.cfg-lines .dot { text-align: center; font-weight: 700; color: var(--muted); }
.cfg-lines .st-done .dot { color: var(--ok); }
.cfg-lines .st-warn .dot { color: #b07d00; }
.cfg-lines .st-todo .dot { color: var(--red); }
.fix-link { background: none; border: 0; color: var(--red); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0 2px; text-decoration: underline; }
.cfg-card-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.chip-link { font: inherit; font-size: 12.5px; background: var(--tint); border: 1px solid transparent; border-radius: 12px; padding: 2px 10px; cursor: pointer; color: var(--ink); }
.chip-link:hover { border-color: var(--gray); }
.cfg-card-foot { display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--tint); padding-top: 10px; }
.cfg-crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.crumb-link { background: none; border: 0; padding: 0; font: inherit; color: var(--red); cursor: pointer; text-decoration: underline; }
.cfg-tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--light); margin: 6px 0 14px; overflow-x: auto; }
.cfg-tab { background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; padding: 9px 14px; font: inherit; cursor: pointer; color: var(--muted); white-space: nowrap; }
.cfg-tab:hover { color: var(--ink); }
.cfg-tab.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--red); }
.cfg-tab .ro-tag { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.cfg-page-head h2 { margin: 0 0 2px; font-size: 17px; }
.cfg-page-head .muted { margin-top: 0; }
.cfg-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 4px 0 10px; }
.cfg-toolbar label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.cfg-toolbar #cfg-new { margin-left: auto; }
.cfg-list-search input { width: 240px; }
.cfg-list tr.flash td { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: #e6f4ea; } to { background: transparent; } }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(620px, 100vw); max-width: 100vw; border: 0; border-left: 1px solid var(--light); border-radius: 0; padding: 0; box-shadow: -8px 0 24px rgba(0,0,0,.12); }
dialog.drawer[open] { animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer .cfg-form { display: flex; flex-direction: column; height: 100%; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 16px 20px 10px; border-bottom: 1px solid var(--tint); }
.drawer-head h2 { margin: 0; }
.drawer-head .muted { margin: 0 0 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 20px; }
.drawer-foot { display: flex; gap: 8px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--light); background: var(--card); }
.drawer-foot .spacer { flex: 1; }
.icon-btn { background: none; border: 0; font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--tint); color: var(--ink); }
.danger-link { background: none; border: 0; color: #b42318; font: inherit; cursor: pointer; text-decoration: underline; padding: 6px 2px; }
.err-note { background: #fdecec; border: 1px solid #f3b3b3; color: #8a1c1c; border-radius: 8px; padding: 9px 12px; margin: 0 0 12px; }
.cfg-form.inline { padding: 0; }
.cfg-form.inline .drawer-head { border-bottom: 0; padding-bottom: 0; }
.cfg-form.inline .drawer-foot { border-radius: 0 0 8px 8px; }
.cfg-form.inline .drawer-body { overflow: visible; }
@media (max-width: 760px) { .cfg-toolbar #cfg-new { margin-left: 0; } .cfg-list-search input { width: 100%; } }

/* -- assistant, advanced tabs, lines inside a record --------------------------------------------------------------- */
.wiz-start { margin-left: auto; }
.wiz-hint { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: #fff7e6; border: 1px solid #f0c36d; border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
.wiz-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.wiz-top h1 { margin: 0; }
.wiz-top .muted { margin: 0 0 2px; }
.wiz-steps { list-style: none; display: flex; gap: 4px; padding: 0; margin: 14px 0 12px; overflow-x: auto; counter-reset: none; }
.wiz-step { flex: 1 1 0; min-width: 92px; }
.wiz-step button { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; border-top: 4px solid var(--light); padding: 8px 4px 4px; cursor: pointer; font: inherit; color: var(--muted); }
.wiz-step button:hover { color: var(--ink); }
.wiz-num { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--tint); color: var(--muted); }
.wiz-label { font-size: 12px; text-align: center; line-height: 1.25; }
.wiz-step.st-done button { border-top-color: var(--ok); }
.wiz-step.st-done .wiz-num { background: #e6f4ea; color: var(--ok); }
.wiz-step.st-warn button { border-top-color: #e0a100; }
.wiz-step.st-warn .wiz-num { background: #fff4e5; color: #8a4b00; }
.wiz-step.st-todo button { border-top-color: var(--red); }
.wiz-step.current button { color: var(--ink); font-weight: 600; }
.wiz-step.current .wiz-num { background: var(--dark); color: #fff; }
.wiz-intro { background: var(--card); border: 1px solid var(--light); border-left: 4px solid var(--red); border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; }
.wiz-intro p { margin: 0 0 6px; font-size: 15px; }
.wiz-nav { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--light); border-radius: 8px; padding: 10px 14px; margin-top: 16px; box-shadow: 0 -4px 12px rgba(0,0,0,.05); z-index: 2; }
.wiz-returns td { vertical-align: top; }
.wiz-parts { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 12px; }
.wiz-src { display: flex; flex-direction: column; gap: 4px; max-width: 420px; font-size: 13px; color: var(--muted); }
.check-inline { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.adv-toggle { background: none; border: 0; margin-left: auto; padding: 9px 10px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; text-decoration: underline; white-space: nowrap; }
.cfg-tab.adv { font-style: italic; }
.cfg-sub { margin-top: 18px; border-top: 1px solid var(--light); padding-top: 12px; }
.cfg-sub h3 { margin: 0 0 4px; font-size: 15px; }
.sub-table input, .sub-table select { width: 100%; min-width: 70px; padding: 5px 7px; }
.sub-table td { padding: 4px 6px; }
.small-btn { padding: 4px 10px; font-size: 13px; }
.chip-link.go { background: #fff; border-color: var(--light); }

/* -- monthly report verification ----------------------------------------------------------------------------- */
.filters .spacer { flex: 1; }
dialog.wide-dlg { max-width: 560px; }
.verify-out { border-radius: 8px; padding: 10px 14px; margin: 12px 0 4px; border: 1px solid var(--light); }
.verify-out.good { background: #e6f4ea; border-color: #9fd3ad; }
.verify-out.warn { background: #fff7e6; border-color: #f0c36d; }
.verify-out.bad { background: #fdecec; border-color: #f3b3b3; }
.verify-out p { margin: 4px 0 8px; }
.verify-out dl { display: grid; grid-template-columns: 120px 1fr; gap: 3px 10px; margin: 0; font-size: 13px; }
.verify-out dt { color: var(--muted); }
.verify-out dd { margin: 0; }
.upload-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.noin-ok { color: var(--ok); font-weight: 600; }
.link-btn { background: none; border: 0; padding: 0; color: var(--red); text-decoration: underline; cursor: pointer; font: inherit; font-weight: 400; }
.x-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.x-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.contents { display: contents; }

/* AI assistant (vendor) */
.ai-open { font: inherit; font-size: 13px; background: var(--red); color: #fff; border: 0; border-radius: 14px; padding: 4px 12px; cursor: pointer; }
.ai-open:hover { background: var(--red-hover); }
.ai-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--card); border-left: 1px solid var(--light); box-shadow: -8px 0 24px rgba(0,0,0,.12); display: flex; flex-direction: column; z-index: 50; }
.ai-panel[hidden] { display: none; }
@media (min-width: 1300px) { body.ai-on { padding-right: 520px; } }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--light); }
.ai-head select { flex: 1; min-width: 0; font: inherit; font-size: 13px; padding: 3px 4px; }
.ai-link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: 13px; }
.ai-settings { padding: 10px 14px; border-bottom: 1px solid var(--light); background: var(--tint); display: flex; flex-direction: column; gap: 8px; }
.ai-settings label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.ai-settings label.check-inline { flex-direction: row; align-items: center; }
.ai-settings .muted { margin: 0; }
.ai-log { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ai-empty p { margin: 0 0 8px; }
.ai-msg { border-radius: 10px; padding: 8px 12px; max-width: 94%; overflow-wrap: anywhere; }
.ai-msg.user { align-self: flex-end; background: var(--dark); color: #fff; white-space: pre-wrap; }
.ai-msg.bot { align-self: flex-start; background: var(--tint); }
.ai-msg.warn { background: #fdecee; color: #8a1c2b; }
.ai-md p, .ai-md ul, .ai-md ol { margin: 0 0 6px; }
.ai-md ul, .ai-md ol { padding-left: 18px; }
.ai-md h4 { margin: 8px 0 4px; }
.ai-md code { background: rgba(0,0,0,.06); padding: 0 3px; border-radius: 3px; font-size: 12.5px; }
.ai-pre, .ai-diff { background: #1f2024; color: #e8e8e8; border-radius: 6px; padding: 8px 10px; font: 12px/1.45 Consolas, "Courier New", monospace; overflow-x: auto; white-space: pre; margin: 4px 0; max-height: 360px; overflow-y: auto; }
.ai-diff .add { color: #8fe39b; } .ai-diff .del { color: #ff9aa8; } .ai-diff .hunk { color: #9cc7ff; } .ai-diff .meta { color: #b5b5b5; }
.ai-tool { color: var(--muted); font-size: 12px; }
.ai-thinking { font-style: italic; }
.ai-change { border: 1px solid var(--light); border-left: 4px solid var(--gray); border-radius: 8px; padding: 8px 10px; background: #fff; }
.ai-change.st-pending { border-left-color: var(--red); }
.ai-change.st-applied { border-left-color: var(--ok); }
.ai-change.st-failed { border-left-color: #b26a00; }
.ai-change-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ai-badge { font-size: 12px; color: var(--muted); }
.ai-change .actions { margin-top: 6px; display: flex; gap: 8px; }
.ai-change summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.ai-compose { border-top: 1px solid var(--light); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.ai-compose textarea { font: inherit; resize: vertical; min-height: 60px; padding: 6px 8px; border: 1px solid var(--light); border-radius: 6px; }
.ai-compose-foot { display: flex; justify-content: space-between; align-items: center; }

/* Employees: directory + profile (ERP) */
.dir-filters { align-items: flex-end; }
.dir-wrap { max-height: calc(100vh - 330px); }
.dir-table td { vertical-align: middle; }
.who-cell { display: flex; align-items: center; gap: 10px; }
.who-name { font-weight: 600; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; background: var(--dark); color: #fff; font-weight: 700; font-size: 20px; flex: 0 0 auto; letter-spacing: .5px; }
.avatar.sm { width: 32px; height: 32px; font-size: 12.5px; }
.st-badge { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 10px; white-space: nowrap; }
.st-active { background: #e3f3e7; color: var(--ok); }
.st-term { background: var(--tint); color: var(--muted); }
.st-none { background: #fff4e0; color: #8a5a00; }
.prof-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.prof-nav .grow { flex: 1; }
.prof-head { padding: 16px 18px; }
.prof-id { display: flex; gap: 16px; align-items: center; }
.prof-id h1 { margin: 0; font-size: 22px; }
.prof-id p.muted { margin: 2px 0 8px; }
.pchips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pchip { font-size: 12.5px; background: var(--tint); border-radius: 10px; padding: 2px 9px; color: var(--ink); }
.pchip .link-btn { font-size: 12.5px; }
.ptabs { display: flex; gap: 2px; border-bottom: 2px solid var(--light); margin: 4px 0 14px; overflow-x: auto; }
.ptab { font: inherit; background: none; border: 0; padding: 9px 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.ptab.active { color: var(--ink); border-bottom-color: var(--red); font-weight: 600; }
.ptab:disabled { opacity: .4; cursor: default; }
.ptab[hidden] { display: none; }
.prof-alerts { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.prof-alerts:empty { display: none; }
.prof-alerts li { border-radius: 6px; padding: 7px 12px; font-size: 13.5px; }
.prof-alerts .alert-warn { background: #fdecee; color: #8a1c2b; }
.prof-alerts .alert-info { background: #eef4fb; color: #22476e; }
.prof-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
@media (max-width: 1000px) { .prof-grid { grid-template-columns: 1fr; } }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; margin: 0; }
dl.facts dt { color: var(--muted); font-size: 13px; }
dl.facts dd { margin: 0; }
.tiles { display: flex; flex-wrap: wrap; gap: 10px; }
.tile { background: var(--tint); border-radius: 8px; padding: 8px 12px; min-width: 92px; }
.tile-v { font-size: 20px; font-weight: 600; }
.tile-l { font-size: 12px; color: var(--muted); }
.tile.strong .tile-v { color: var(--ok); }
.tile.bad .tile-v { color: var(--red); }
ul.team { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.grid-break { grid-column: 1 / -1; height: 0; }
tr.slip-lines > td { background: var(--tint); padding: 6px 12px 10px; }
table.slip { width: 100%; }
table.slip td { padding: 3px 8px; border: 0; font-size: 13px; }
table.slip tr.cat-total td { font-weight: 600; border-top: 1px solid var(--light); }
td.strong { font-weight: 600; }
span.bad { color: var(--red); font-weight: 600; }
span.warn { color: #8a5a00; }
#w-form h2 + p.muted.small { margin-top: -4px; }
#w-form .form-grid + h2 { margin-top: 18px; }
.dir-table td { padding-top: 6px; padding-bottom: 6px; }
.area-tag { font-size: 12px; background: var(--tint); border-radius: 8px; padding: 1px 7px; white-space: nowrap; }
tr.chg-del td { color: var(--muted); text-decoration: line-through; }
tr.chg-del td:first-child, tr.chg-del td:nth-child(2), tr.chg-del td:nth-child(3), tr.chg-del td:nth-child(4) { text-decoration: none; }
tr.chg-fix .area-tag { background: #fff4e0; }

/* read-only until Edit */
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-head h2 { margin-bottom: 8px; }
form.locked input:disabled, form.locked select:disabled, form.locked textarea:disabled { background: #fafafa; border-color: var(--tint); color: var(--ink); opacity: 1; cursor: default; -webkit-text-fill-color: var(--ink); }
form.locked select:disabled { appearance: none; }
.actions .grow { flex: 1; }
button.danger-btn { color: var(--red); border-color: var(--red); }
form.add-form { border-left: 4px solid var(--red); }

/* configuration workbook */
.wb-card { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 12px; }
.wb-card h3 { margin: 0 0 4px; }
.wb-card .wb-text { flex: 1 1 380px; }
.wb-card .wb-text p { margin: 0; }
.wb-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
dialog.wb-dlg { width: min(980px, 96vw); max-width: 96vw; }
.wb-items td:last-child { min-width: 260px; }
.wb-sum { margin-bottom: 10px; }
.wb-items td { vertical-align: top; }
span.op { font-size: 12px; padding: 1px 8px; border-radius: 9px; white-space: nowrap; }
.op-add { background: #e3f3e7; color: var(--ok); } .op-upd { background: #eef4fb; color: #22476e; }
.op-del { background: #fdecee; color: #8a1c2b; } .op-err { background: var(--red); color: #fff; } .op-warn { background: #fff4e0; color: #8a5a00; }
/* sign-in: two-step, recovery codes, my account */
#login.narrow { max-width: 440px; }
#login h1 { margin-top: 0; }
.setup-steps { padding-left: 20px; margin: 8px 0 4px; }
.setup-steps li { margin-bottom: 12px; }
.setup-steps input { display: block; margin-top: 6px; width: 140px; font-size: 18px; letter-spacing: 3px; }
#mfa-code { font-size: 18px; letter-spacing: 3px; }
.qr { width: 184px; height: 184px; margin: 8px 0 6px; background: #fff; border: 1px solid var(--light); border-radius: 6px; padding: 8px; }
.qr svg { display: block; width: 100%; height: 100%; }
.codes { list-style: none; padding: 0; margin: 10px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px;
         font: 600 15px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.codes li { background: var(--tint); border-radius: 6px; padding: 6px 10px; text-align: center; }
.codes li.used { color: var(--gray); text-decoration: line-through; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.actions.left { justify-content: flex-start; margin-top: 4px; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin-bottom: 0; }
#acct-dlg h3 { font-size: 14px; margin: 18px 0 4px; }
#acct-dlg .table-wrap { max-height: 220px; overflow: auto; }
h2.sub { font-size: 16px; margin: 18px 0 8px; }
.form-note { flex-basis: 100%; margin: 0; }
.mfa-on { color: var(--ok); font-weight: 600; }
.mfa-off { color: var(--red); font-weight: 600; }
.locked { color: var(--red); font-weight: 600; }
tr.warn-row td { background: #fff5f6; }
.bk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.bk-state { margin: 0; font-weight: 600; }
.bk-state.good { color: var(--ok); } .bk-state.bad { color: var(--red); }
.rv { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--tint); color: var(--muted); }
.rv-ok { background: #e3f3e7; color: var(--ok); } .rv-bad { background: #fdecee; color: #8a1c2b; }
.rv-warn { background: #fff4e0; color: #8a5a00; } .rv-none { background: var(--tint); color: var(--muted); }
.wb-hist { flex-basis: 100%; border-top: 1px solid var(--tint); padding-top: 8px; }
.wb-hist:empty { display: none; }
.wb-hist-title { margin: 0 0 4px; }
.wb-hist-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.wb-hist-row.undone > span:first-child { color: var(--gray); text-decoration: line-through; }
.owner-in { width: 160px; font-size: 13px; padding: 4px 8px; }
.forgot { margin: 10px 0 0; font-size: 13px; }
.gdpr-acts { display: flex; gap: 8px; margin-left: auto; align-self: flex-start; }
.ret-preview { background: var(--tint); border-radius: 6px; padding: 8px 12px; margin-top: 10px; }
.ret-preview p { margin: 4px 0; }
/* compare versions, ranking bar, definitions, formula builder */
.cmp-wrap { max-height: 52vh; overflow: auto; }
tr.cmp-changed td:last-child { color: #7a5200; font-weight: 600; }
tr.cmp-new td:last-child { color: #0a6e0a; font-weight: 600; }
tr.cmp-removed td:last-child { color: var(--critical); font-weight: 600; }
.table-bar { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.table-bar .grow, .actions .grow { flex: 1; }
table.mini { width: auto; margin: 6px 0; font-size: 13px; }
table.mini td, table.mini th { padding: 3px 10px; }
.fb-part { border: 1px solid var(--tint); border-radius: 6px; margin: 8px 0; padding: 6px 10px 8px; }
.fb-part legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.fb-part legend label { display: inline-flex; gap: 6px; align-items: center; }
.fb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; }
.fb-src { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.fb-src select, .fb-row > select { width: auto; }
.fb-val { width: 170px; } .fb-arg { width: 120px; } .fb-fac { width: 70px; }
.fb-open { display: inline-block; margin-top: 4px; font-size: 13px; }
#fb-text { width: 100%; }
@media (max-width: 600px) { .fb-val { width: 120px; } }
dialog#cmp-dlg { width: min(1040px, 96vw); max-width: 96vw; }
dialog#fb-dlg { width: min(820px, 96vw); max-width: 96vw; }
dialog#defs-dlg { width: min(760px, 96vw); max-width: 96vw; }
#cmp-rows td:nth-child(2) { min-width: 150px; }
.fb-part legend label.check { display: inline-flex; flex-direction: row; font-size: 13px; font-weight: 600; }
.fb-part legend label.check input { width: auto; margin: 0; }
.fb-part.off > :not(legend) { display: none; }
.fb-part.off { padding-bottom: 0; }
.fb-part.off { border-color: transparent; padding: 0 10px; margin: 2px 0; }
.lang-login { margin-top: 14px; font-size: 13px; }
.lang-login select { width: auto; }
.lang-box select { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 6px; padding: 3px 6px; font-size: 13px; width: auto; }
.lang-box select option { color: #000; }
.who { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
.who > button, .who > span, .who > .badge { white-space: nowrap; }
#login-form .lang-login select { width: auto; align-self: flex-start; }
.acc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; margin: 10px 0;
  max-height: 50vh; overflow: auto; }
.acc-list label.check { font-size: 14px; }
