:root {
  --red: #a11b1c; --red-dark: #7f1415; --red-tint: #fbeeee;
  --ink: #232324; --ink-2: #58595b; --ink-3: #6f7072;
  --line: #e4e1dc; --bg: #f7f5f2; --card: #fff; --side: #262627;
  --green: #1d6b45; --green-tint: #e7f3ec; --amber: #8a5a00; --amber-tint: #fdf3dc; --blue: #245a8c; --blue-tint: #e8f0f8;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h2.inline { display: inline; margin: 0; }
h2 small { font-weight: 400; color: var(--ink-3); font-size: .85rem; margin-left: .4rem; }
.sub-head { font-size: .9rem; margin: 1.2rem 0 .4rem; }
p { margin: .4rem 0 .8rem; }
.muted { color: var(--ink-3); }
.small, small { font-size: .82rem; }
.neg { color: var(--red); }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
code { font-family: Consolas, Menlo, monospace; font-size: .85em; }

/* Shell */
body:not(.public) { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.mobile-bar { display: none; }
.sidebar { background: var(--side); color: #d9d8d6; padding: 18px 12px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 2px 8px 6px; display: block; }
.brand img { width: 128px; display: block; }
.sidebar a { color: inherit; display: block; padding: 7px 10px; border-radius: 6px; }
.sidebar a:hover { background: #38383a; color: #fff; text-decoration: none; }
.sidebar nav a.on { background: var(--red); color: #fff; font-weight: 600; }
.quick h2 { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #a3a2a0; margin: 0 10px 4px; }
.quick a { padding: 4px 10px; font-size: .9rem; }
.quick .review { margin-top: 6px; }
.quick .review b { background: var(--red); color: #fff; border-radius: 10px; padding: 0 7px; font-size: .78rem; margin-left: 2px; }
.who { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid #3c3c3e; font-size: .85rem; }
.who strong { display: block; color: #fff; }
.who span { color: #a3a2a0; }
.who-actions { display: flex; gap: 12px; margin-top: 6px; align-items: center; }
.who-actions a { padding: 0; text-decoration: underline; }
.who-actions a:hover { background: none; }
.linklike { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.main { padding: 26px 30px 60px; min-width: 0; max-width: 1240px; width: 100%; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: .2rem 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: .85rem; }

/* Cards and figures */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-accent { border-top: 3px solid var(--red); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.stat span { display: block; color: var(--ink-2); font-size: .84rem; }
.stat strong { display: block; font-size: 1.3rem; font-variant-numeric: tabular-nums; line-height: 1.35; letter-spacing: -.01em; overflow-wrap: anywhere; }
.stat small { color: var(--ink-3); }
.amount { font-size: 1.8rem; font-weight: 600; margin: 0 0 .6rem; font-variant-numeric: tabular-nums; }
.callout { background: var(--blue-tint); color: #1b4468; border-radius: var(--radius); padding: 9px 14px; margin-bottom: 18px; }
.empty { color: var(--ink-3); padding: 10px 0; margin: 0; }
.card.flush .empty { padding: 16px 18px; }

.warnings { list-style: none; margin: 0 0 18px; padding: 10px 14px; background: var(--amber-tint); border-radius: var(--radius); }
.warnings a { color: var(--amber); font-weight: 500; }
.pipeline { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 12px; }
.pipeline a { display: block; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; color: var(--ink); font-size: .87rem; }
.pipeline b { color: var(--red); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: .8rem; white-space: nowrap; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 9px 10px; border-bottom: 1px solid #f0eeea; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { border-top: 1px solid var(--line); border-bottom: 0; color: var(--ink-2); padding-top: 5px; padding-bottom: 5px; }
.card.flush th:first-child, .card.flush td:first-child { padding-left: 18px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub { display: block; font-size: .8rem; color: var(--ink-3); }
.dim { opacity: .55; }
.strong td { font-weight: 600; background: var(--bg); }
.compare th small, .compare td small { display: block; font-weight: 400; color: var(--ink-3); }
td.json { font-family: Consolas, Menlo, monospace; font-size: .75rem; max-width: 280px; overflow-wrap: anywhere; color: var(--ink-2); }
.json { display: block; overflow-wrap: anywhere; color: var(--ink-2); margin-top: 4px; }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: #efedea; color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.badge-approved, .badge-acquired, .badge-sold-closed { background: var(--green-tint); color: var(--green); }
.badge-submitted, .badge-pending, .badge-advance-paid, .badge-negotiation, .badge-due-diligence { background: var(--amber-tint); color: var(--amber); }
.badge-rejected, .badge-reversed, .badge-cancelled { background: var(--red-tint); color: var(--red-dark); }
.badge-plots-units-available, .badge-partially-sold-allocated { background: var(--blue-tint); color: var(--blue); }
.tag { font-size: .72rem; font-weight: 600; background: #efedea; color: var(--ink-2); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.tag-personal { background: var(--amber-tint); color: var(--amber); }
.flag { font-size: .7rem; font-weight: 600; color: var(--amber); white-space: nowrap; }

.rows { list-style: none; margin: 0 0 .8rem; padding: 0; }
.rows li { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid #f0eeea; flex-wrap: wrap; }
.rows li:last-child { border-bottom: 0; }
.rows span { color: var(--ink-3); font-size: .85rem; flex: 1; min-width: 120px; }
.rows b { font-variant-numeric: tabular-nums; font-weight: 600; }
.facts { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 5px 12px; margin: 0; }
.facts dt { color: var(--ink-3); font-size: .87rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.files { list-style: none; padding: 0; margin: 0 0 10px; }
.files li { padding: 3px 0; overflow-wrap: anywhere; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0 6px 12px; border-left: 2px solid var(--line); }
.timeline b { text-transform: capitalize; font-weight: 600; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.report-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); }
.report-card:hover { border-color: var(--red); text-decoration: none; }
.report-card b { display: block; color: var(--red); }
.report-card span { font-size: .87rem; color: var(--ink-2); }
.link-box { display: block; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; overflow-wrap: anywhere; margin-bottom: 12px; font-size: .9rem; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; }

/* Forms */
.btn { display: inline-block; font: inherit; font-weight: 500; font-size: .9rem; padding: 8px 14px; min-height: 38px; border-radius: 6px; border: 1px solid #cfccc6; background: #fff; color: var(--ink); cursor: pointer; line-height: 1.35; white-space: nowrap; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-sm { padding: 3px 10px; min-height: 30px; font-size: .84rem; }
.btn-block { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.wide { grid-column: 1 / -1; }
.form-section { margin: 8px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.field label { display: block; font-weight: 500; font-size: .87rem; margin-bottom: 3px; }
.field small { display: block; color: var(--ink-3); margin-top: 3px; }
.req { font-weight: 700; color: var(--red); margin-left: 2px; text-decoration: none; cursor: help; }
input, select, textarea { font: inherit; color: inherit; width: 100%; padding: 7px 10px; min-height: 38px; border: 1px solid #cfccc6; border-radius: 6px; background: #fff; }
input[type=checkbox] { width: 17px; height: 17px; min-height: 0; padding: 0; accent-color: var(--red); }
input[type=file] { padding: 5px; }
.add-new { margin-top: 6px; }
.payer-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 28px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; }
.payer-head h1 a { color: var(--ink); }
.payer-head p { margin: 0; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.payer-figures { display: flex; gap: 24px; flex-wrap: wrap; margin: 0; }
.payer-figures dt { font-size: .8rem; color: var(--ink-3); }
.payer-figures dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.btn-link { border-color: transparent; background: none; color: var(--red); }
.badge-registered { background: var(--green-tint); color: var(--green); }
.badge-agreement, .badge-in-progress { background: var(--amber-tint); color: var(--amber); }
.badge-not-started { background: #efedea; color: var(--ink-2); }
.history .uncounted td { color: var(--ink-3); }
.history tr.alloc-row td { background: #faf8f5; }
.history .run { font-weight: 600; }
.totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; background: var(--bg); border-radius: 6px; padding: 12px 14px; }
.totals span { display: block; font-size: .8rem; color: var(--ink-3); }
.totals strong { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.totals strong.ok { color: var(--green); }
.totals small { display: block; color: var(--ink-3); }
.other-expenses { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
input[readonly] { background: var(--bg); color: var(--ink-2); }
@media (max-width: 900px) { .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); } .other-expenses { grid-template-columns: minmax(0, 1fr); } }
.badge-paid { background: var(--green-tint); color: var(--green); }
tr.row-bank td { background: #d6efdd; }
tr.row-cash td { background: #f9d9d9; }
tr.row-bank:hover td { background: #c7e8d0; }
tr.row-cash:hover td { background: #f5c9c9; }
th a.sort { color: inherit; text-decoration: none; }
th a.sort:hover { color: var(--red); }
th a.sort.on { color: var(--ink); }
.legend { font-size: .82rem; color: var(--ink-2); display: flex; align-items: center; gap: 6px; margin: 0; }
.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.page-head.compact { margin-bottom: 6px; }
.page-head.compact + .filter-box { margin-bottom: 8px; }
@media (max-width: 900px) { .head-right { align-items: flex-start; } }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line); margin-left: 8px; }
.swatch.row-bank { background: #d6efdd; }
.swatch.row-cash { background: #f9d9d9; }
.reg-form { display: grid; gap: 6px; margin-top: 6px; min-width: 210px; }
.prop-split { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px 4px; margin: 0; }
.prop-split legend { font-weight: 500; font-size: .87rem; padding: 0 4px; }
.prop-split legend small { display: block; font-weight: 400; color: var(--ink-3); }
.prop-row { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 10px; align-items: center; padding: 4px 0; border-bottom: 1px solid #f0eeea; }
.prop-row:last-child { border-bottom: 0; }
.split-total { margin: 6px 0 4px; font-size: .87rem; font-weight: 500; }
.split-total.ok { color: var(--green); }
.split-total.off { color: var(--red); }
.prop-row .check { white-space: normal; }
@media (max-width: 900px) { .prop-row { grid-template-columns: minmax(0, 1fr) 130px; } }
.money-input { position: relative; }
.money-input span { position: absolute; left: 10px; top: 8px; color: var(--ink-3); }
.money-input input { padding-left: 24px; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 7px; font-size: .9rem; white-space: nowrap; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { flex: 1 1 150px; max-width: 240px; }
.filter-box summary, details.add summary, details.mini summary, .card details > summary { cursor: pointer; color: var(--red); font-weight: 500; }
.filter-box { margin-bottom: 14px; }
.filter-box .filters { margin-top: 10px; }
details.add { margin-top: 12px; }
details.add form { margin-top: 12px; }
details.mini { display: inline-block; margin-left: 6px; font-size: .84rem; }
details.mini[open] form { margin-top: 8px; min-width: 200px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.inline-form input:not([type=checkbox]), .inline-form select { width: auto; flex: 1 1 130px; min-width: 0; }
.inline-form.compact { margin-top: 0; gap: 5px; }
.inline-form.compact input:not([type=checkbox]), .inline-form.compact select { min-height: 30px; padding: 3px 7px; font-size: .84rem; flex: 1 1 100px; }
.split-line { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 10px; align-items: end; padding: 10px; background: var(--bg); border-radius: 6px; margin-bottom: 8px; }
.split-line .remove-split { color: var(--red); padding-bottom: 8px; font-size: .85rem; }

.flash { padding: 9px 14px; border-radius: var(--radius); margin-bottom: 14px; }
.flash-ok { background: var(--green-tint); color: var(--green); }
.flash-error { background: var(--red-tint); color: var(--red-dark); }
.flash-warn { background: var(--amber-tint); color: var(--amber); }

/* Sign-in pages */
body.public { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; background: #fff; }
.public-brand { background: var(--red); color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px; text-align: center; }
.public-brand img { width: min(300px, 70%); }
.public-brand p { opacity: .9; max-width: 320px; margin-top: 20px; }
.public-panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.public-card { width: 100%; max-width: 360px; }
.public-card h1 { margin-bottom: 16px; }

@media (max-width: 900px) {
  body:not(.public) { display: block; }
  .mobile-bar { display: flex; justify-content: space-between; align-items: center; background: var(--side); padding: 10px 16px; position: sticky; top: 0; z-index: 20; }
  .mobile-logo { height: 38px; display: block; }
  .menu-btn { color: #fff; border: 1px solid #5a5a5c; border-radius: 6px; padding: 6px 14px; cursor: pointer; }
  .sidebar { display: none; position: static; height: auto; }
  .nav-toggle:checked ~ .sidebar { display: flex; }
  .brand { display: none; }
  .main { padding: 18px 16px 48px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .split-line { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat strong { font-size: 1.08rem; }
  .filters .field { max-width: none; flex-basis: 45%; }
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 42px; }
  .btn-sm { min-height: 34px; }
  body.public { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .public-brand { padding: 26px 16px; }
  .public-brand img { width: 170px; }
  .public-brand p { display: none; }
}
@media print {
  .sidebar, .mobile-bar, .actions, .filters, .btn { display: none !important; }
  body:not(.public) { display: block; }
  .card { border: 0; }
}

/* Compact spacing: less white space everywhere, so more data fits on screen. */
h1 { font-size: 1.45rem; }
h2 { margin: 0 0 .4rem; }
p { margin: .25rem 0 .5rem; }
.sub-head { margin: .8rem 0 .3rem; }
.page-head { gap: 10px; margin-bottom: 10px; }
.card { padding: 12px 14px; margin-bottom: 12px; }
.grid-2 { gap: 12px; }
.stats { gap: 8px; margin-bottom: 12px; }
.stat { padding: 8px 12px; }
.stat strong { font-size: 1.15rem; }
.callout { padding: 7px 12px; margin-bottom: 12px; }
.warnings { padding: 8px 12px; margin: 0 0 12px; }
.flash { padding: 7px 12px; margin-bottom: 10px; }
.empty { padding: 6px 0; }
th { padding: 6px 8px; }
td { padding: 6px 8px; }
.card.flush th:first-child, .card.flush td:first-child { padding-left: 14px; }
.rows li { padding: 4px 0; }
.facts { gap: 3px 10px; }
.timeline li { padding: 4px 0 4px 10px; }
.form-grid { gap: 10px 14px; }
.stack { gap: 8px; }
.filters { gap: 8px 10px; margin-bottom: 10px; }
.filter-box { margin-bottom: 10px; }
.totals { padding: 10px 12px; }
.sidebar { padding: 14px 10px; gap: 12px; }
@media (min-width: 901px) {
  .main { padding: 16px 22px 32px; max-width: 1400px; }
  .btn { padding: 6px 12px; min-height: 34px; }
  .btn-sm { min-height: 28px; }
  input, select, textarea { padding: 5px 9px; min-height: 34px; }
}
@media (max-width: 900px) {
  .main { padding: 12px 12px 32px; }
}

/* Click-to-sort table headers. */
.sort-btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; font: inherit; color: inherit; }
.sort-btn:hover { color: var(--red); }
.sort-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.sort-btn::after { content: '↕'; font-size: .75em; opacity: .35; }
th.sorted-asc .sort-btn::after { content: '▲'; opacity: 1; }
th.sorted-desc .sort-btn::after { content: '▼'; opacity: 1; }
th.sorted-asc, th.sorted-desc { color: var(--ink); }
th.num .sort-btn { justify-content: flex-end; }

/* Profile button on an investor's page: contact info and documents in a drop-down panel. */
.profile { position: relative; }
.profile > summary { list-style: none; }
.profile > summary::-webkit-details-marker { display: none; }
.profile > summary::after { content: ' ▾'; font-size: .8em; }
.profile[open] > summary { background: var(--bg); border-color: var(--ink-3); }
.profile-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(460px, 92vw); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); padding: 12px 14px; text-align: left; }
@media (max-width: 900px) { .profile-panel { left: 0; right: auto; } }
.profile-facts dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.fact-edit > summary { cursor: pointer; color: var(--red); font-size: .8rem; list-style: none; }
.fact-edit > summary::-webkit-details-marker { display: none; }
.fact-edit[open] { flex-basis: 100%; }
.fact-edit[open] > summary { display: none; }
.fact-form { display: flex; gap: 6px; align-items: flex-start; }
.fact-form input, .fact-form textarea { flex: 1; min-width: 0; }
.back-link { margin: 0 0 2px; }
.acct-line { display: flex; justify-content: flex-end; align-items: baseline; gap: 8px; white-space: nowrap; }
.acct-line + .acct-line { margin-top: 2px; }
.acct-bank { color: var(--ink-3); font-size: .8rem; }
.acct-total { border-top: 1px solid var(--line); padding-top: 2px; }
.head-tools { display: flex; align-items: center; gap: 12px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.panel-close { position: absolute; top: 6px; right: 8px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--ink-2); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.panel-close:hover { background: var(--bg); color: var(--red); }
.profile-panel h2 { padding-right: 34px; }

/* Investor page header: name and mobile on the left, buttons on the right, one line. */
.page-head.one-line { align-items: center; }
.page-head.one-line .actions { margin-left: auto; }
.name-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.name-phone { color: var(--ink-2); font-size: 1rem; font-variant-numeric: tabular-nums; }
.page-head.one-line .actions { gap: 6px; }
.page-head.one-line .actions .btn, .page-head.one-line .profile > summary { padding: 6px 10px; }
.page-head.one-line .name-line { min-width: 0; }
.page-head.one-line h1 { white-space: nowrap; }
@media (min-width: 1100px) {
  .page-head.one-line, .page-head.one-line .actions { flex-wrap: nowrap; }
}

/* Notification bell, top right of every page. */
.main { position: relative; }
.topbar { position: absolute; top: 10px; right: 22px; z-index: 40; }
.main > .flash:first-of-type, .main > .back-link:first-of-type { margin-right: 52px; }
.notif { position: relative; }
.bell { list-style: none; cursor: pointer; position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); }
.bell::-webkit-details-marker { display: none; }
.bell:hover, .notif[open] .bell { color: var(--red); border-color: var(--ink-3); }
.bell-count { position: absolute; top: -5px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(380px, 92vw); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .14); padding: 12px 14px; }
.notif-panel h2 { padding-right: 34px; }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li + li { border-top: 1px solid #f0eeea; }
.notif-list a { display: flex; gap: 10px; align-items: baseline; padding: 8px 2px; color: var(--ink); }
.notif-list a:hover { color: var(--red); text-decoration: none; background: var(--bg); }
.notif-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); transform: translateY(-1px); }
.notif-action .notif-dot { background: var(--blue); }
.notif-alert .notif-dot { background: var(--red); }
.notif-info .notif-dot { background: var(--ink-3); }
.page-head { padding-right: 52px; }
@media (max-width: 900px) { .topbar { top: 8px; right: 12px; } .page-head { padding-right: 46px; } }
/* Balances by person: amounts read as figures, not red links; names stay on one line. */
.by-person td:first-child { white-space: nowrap; }
.by-person .acct-line a, .by-person td.num > a { color: var(--ink); }
.by-person .acct-line a:hover, .by-person td.num > a:hover { color: var(--red); }
.by-person a.neg { color: var(--red); }
.by-person .acct-line { flex-direction: column; align-items: flex-end; gap: 0; }
.by-person .acct-bank { font-size: .72rem; line-height: 1.2; }
.by-person th, .by-person td { padding-left: 6px; padding-right: 6px; }

/* Dashboard charts. Colours validated on the white card (dataviz validator): ordinal blue ramp for
   received / registration stages, blue <-> red diverging pair for profit and loss. */
:root {
  --viz-blue-250: #86b6ef; --viz-blue-350: #5598e7; --viz-blue-450: #2a78d6; --viz-blue-600: #184f95;
  --viz-red: #e34948; --viz-axis: #c3c2b7; --viz-ink-muted: #898781;
}
.viz-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.viz-grid .card { margin-bottom: 0; }
.viz-card .card-head { align-items: baseline; }
.viz-headline { font-size: 1.25rem; font-weight: 600; color: var(--ink); }
.viz-sub { color: var(--ink-3); font-size: .8rem; margin: -4px 0 8px; }
.viz-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 8px; padding: 0; font-size: .78rem; color: var(--ink-2); }
.viz-legend li { display: flex; align-items: center; gap: 6px; }
.viz-legend-col { flex-direction: column; gap: 4px; margin-top: 10px; }
.viz-legend-col li b { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink); }
.viz-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.viz-rows { display: grid; gap: 6px; }
.viz-row { display: grid; grid-template-columns: minmax(70px, 34%) minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.viz-label { font-size: .82rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz-bar { width: 100%; display: block; overflow: visible; }
.viz-value { font-size: .8rem; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.viz-segbar { width: 100%; display: block; }
.viz-seg-text { fill: #fff; font-size: 13px; font-weight: 600; }
.viz-seg-text.on-light { fill: var(--ink); }
.viz-gap { stroke: var(--card); stroke-width: 2px; }
.viz-received { fill: var(--viz-blue-450); background: var(--viz-blue-450); }
.viz-to-receive { fill: var(--viz-blue-250); background: var(--viz-blue-250); }
.viz-profit { fill: var(--viz-blue-450); background: var(--viz-blue-450); }
.viz-loss { fill: var(--viz-red); background: var(--viz-red); }
.viz-reg-0 { fill: var(--viz-blue-250); background: var(--viz-blue-250); }
.viz-reg-1 { fill: var(--viz-blue-350); background: var(--viz-blue-350); }
.viz-reg-2 { fill: var(--viz-blue-450); background: var(--viz-blue-450); }
.viz-reg-3 { fill: var(--viz-blue-600); background: var(--viz-blue-600); }
.viz-axis { stroke: var(--viz-axis); stroke-width: 1; }
.viz-bar rect:hover, .viz-segbar rect:hover { opacity: .85; }
.viz-table { margin-top: 10px; font-size: .8rem; }
.viz-table summary { cursor: pointer; color: var(--red); }
.viz-table table { margin-top: 6px; }
@media (max-width: 1100px) { .viz-grid { grid-template-columns: minmax(0, 1fr); } }

/* Balances by person: one card per person. */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 8px; }
.person-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--card); }
.person-card.is-company { border-top: 3px solid var(--red); }
.pc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.pc-name { font-weight: 600; }
.pc-total { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.pc-lines { list-style: none; margin: 0; padding: 0; }
.pc-lines li + li { border-top: 1px dashed #ebe8e3; }
.pc-lines a { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; color: var(--ink); font-size: .85rem; font-variant-numeric: tabular-nums; }
.pc-lines a:hover { color: var(--red); text-decoration: none; }
.pc-kind { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-note { margin: 4px 0 0; font-size: .75rem; color: var(--amber); }

/* Balances by person: larger, easier to read. */
.people-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.person-card { padding: 12px 14px; }
.pc-name { font-size: 1.1rem; }
.pc-total { font-size: 1.35rem; }
.pc-lines a { font-size: 1rem; padding: 6px 0; }
.pc-note { font-size: .85rem; }

/* Pipeline counts beside the heading. */
.head-inline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.head-inline h2 { margin: 0; }
.head-inline .pipeline { margin: 0; }
.card-head:has(.head-inline) { align-items: center; margin-bottom: 8px; }

/* Voice to text: a microphone beside notes and remarks boxes. */
.dictate-wrap { position: relative; }
.dictate-wrap textarea { padding-right: 40px; }
.dictate { position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); cursor: pointer; display: grid; place-items: center; }
.dictate:hover { color: var(--red); border-color: var(--ink-3); }
.dictate.listening { background: var(--red); color: #fff; border-color: var(--red); animation: dictate-pulse 1.2s ease-in-out infinite; }
@keyframes dictate-pulse { 50% { box-shadow: 0 0 0 6px rgba(161, 27, 28, .18); } }
@media (prefers-reduced-motion: reduce) { .dictate.listening { animation: none; } }

/* Chart period switch and column charts. */
.period-switch { display: flex; align-items: center; gap: 4px; margin: 0 0 8px; flex-wrap: wrap; }
.period-switch span { margin-right: 6px; }
.period-switch a { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink-2); font-size: .85rem; }
.period-switch a:hover { text-decoration: none; border-color: var(--ink-3); color: var(--ink); }
.period-switch a.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.viz-cols { width: 100%; height: auto; display: block; overflow: visible; }
.viz-tick { fill: var(--viz-ink-muted); font-size: 10px; }
.viz-col-value { fill: var(--ink-2); font-size: 10px; font-weight: 600; }
.viz-hit { fill: transparent; }
.viz-cols g:hover .viz-hit { fill: rgba(0, 0, 0, .04); }
