/* TFU Hub v2 — foundation styles. Brand: Ecstasy #f86a14, White Linen #f9f2ec. */
:root {
  --accent: #f86a14;
  --accent-ink: #ffffff;
  --bg: #f9f2ec;        /* White Linen */
  --surface: #ffffff;
  --surface-2: #fbf6f0;
  --ink: #1d2330;
  --muted: #6b7280;
  --line: #ece3d8;
  --danger: #c0392b;
  --ok: #1e874b;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(25, 35, 55, .06);
  --sidebar-w: 264px;
}
[data-theme="dark"] {
  --accent: #f86a14;
  --accent-ink: #1a1206;
  --bg: #12151c;
  --surface: #1a1f29;
  --surface-2: #20262f;
  --ink: #e7ecf3;
  --muted: #9aa6b6;
  --line: #2a3140;
  --shadow: 0 2px 12px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--accent); }
button { font: inherit; cursor: pointer; }

/* Buttons & inputs */
.btn {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px;
  padding: 10px 16px; font-weight: 600;
}
.btn:hover { filter: brightness(.96); }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.frow { margin-bottom: 12px; }
.frow label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.error { color: var(--danger); font-size: 13.5px; min-height: 18px; margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Auth (login/setup) */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow); padding: 28px 26px;
}
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.auth-logo svg { width: 40px; height: 40px; }
.auth-logo h1 { font-size: 19px; margin: 0; }
.auth-sub { color: var(--accent); font-weight: 600; font-size: 13px; }
.auth-tools { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 12px; }

/* App shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line); padding: 14px 12px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.nav-scroll { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.brand svg { width: 30px; height: 30px; }
.brand b { font-size: 15px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 8px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--ink); padding: 9px 10px; border-radius: 9px; font-size: 14px;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-weight: 600; }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; opacity: .7; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.topbar .spacer { flex: 1; }
.iconbtn { background: transparent; border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; color: var(--ink); }
.iconbtn:hover { background: var(--surface-2); }
.menu-toggle { display: none; }
.topbar-logo { display: none; background: transparent; border: 0; padding: 0; }
.topbar-logo svg { width: 30px; height: 30px; display: block; }
.content { padding: 22px 20px; max-width: 1100px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 22px; }
/* Plain-language helper line under a section heading */
.sec-hint {
  display: flex; align-items: center; gap: 7px; margin: -6px 0 16px;
  color: var(--muted); font-size: 13.5px;
}
.sec-hint svg { flex: 0 0 auto; color: var(--accent); }
/* Friendly empty state inside a card */
.empty-state { text-align: center; padding: 26px 16px 20px; }
.empty-ico {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
}
.empty-title { font-weight: 600; font-size: 15.5px; margin-bottom: 4px; }
.empty-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; max-width: 360px; margin-left: auto; margin-right: auto; }
.empty-state .btn { display: inline-flex; align-items: center; gap: 6px; }
/* One-time welcome card on the Dashboard */
.welcome-card {
  position: relative; background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px;
}
.welcome-h { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.welcome-h svg { color: var(--accent); }
.welcome-sub { color: var(--muted); margin: 6px 0 8px; font-size: 14px; }
.welcome-tips { margin: 0; padding-left: 20px; color: var(--ink); font-size: 13.5px; }
.welcome-tips li { margin: 3px 0; }
.welcome-x {
  position: absolute; top: 10px; right: 10px; background: transparent; border: 0;
  color: var(--muted); padding: 4px; border-radius: 8px; line-height: 0;
}
.welcome-x:hover { background: var(--surface-2); color: var(--ink); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px;
}
.badge { display: inline-block; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--muted); }
.pill-accent { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); border: 0; }

.account { position: relative; }
.account-menu {
  position: absolute; right: 0; top: 44px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); min-width: 220px; padding: 8px; display: none; z-index: 20;
}
.account-menu.open { display: block; }
.account-menu .who { padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.account-menu button { width: 100%; text-align: left; background: transparent; border: 0; color: var(--ink); padding: 9px 10px; border-radius: 8px; }
.account-menu button:hover { background: var(--surface-2); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 50; box-shadow: var(--shadow); }

/* Icons, tables, import */
.nav-ico { display: inline-flex; align-items: center; opacity: .8; }
.nav-item.active .nav-ico { opacity: 1; }
.nav-bottom { flex: 0 0 auto; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.refresh-top { padding: 8px 10px; display: inline-flex; align-items: center; }
.refresh-top svg { display: block; }
.refresh-top.spin svg { animation: spin .5s linear; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.iconbtn svg, .btn svg { display: inline-block; vertical-align: -3px; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 160px; padding: 6px; display: none; z-index: 40; }
.dropdown-menu.open { display: block; }
.dropdown-menu button { display: block; width: 100%; text-align: left; background: transparent; border: 0; color: var(--ink); padding: 8px 10px; border-radius: 7px; font-size: 13.5px; }
.dropdown-menu button:hover { background: var(--surface-2); }
.card-head .spacer { flex: 1; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num, .bud-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.bud-total td { border-top: 2px solid var(--line); background: var(--surface-2); }
.bud-total:hover { background: var(--surface-2); }
.tbl td.neg { color: var(--danger); }
.ive-table td:nth-child(n+2), .ive-table th:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.fin-narrow { max-width: 560px; }
.tx-link { cursor: pointer; }
.tx-link:hover { background: var(--surface-2); }
.pnl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 700px) { .pnl-grid { grid-template-columns: 1fr; } }
.kpi-val.neg { color: var(--danger); }
.kpi-val.pos { color: #1e874b; }
/* Income vs Expenses: full-width interactive chart stacked above the table */
.ive-wrap { display: flex; flex-direction: column; gap: 16px; }
/* QBO Transactions filter bar */
.tx-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.tx-filters .tx-f-search { flex: 1; min-width: 180px; width: auto; }
.tx-filters select { width: auto; }
.tx-filters .tx-f { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.tx-filters .tx-f input { width: auto; }
/* Signed amounts: outflow red, inflow green */
.tbl td.pos, b.pos { color: #1e874b; }
b.neg, .bar-val.neg { color: var(--danger); }
/* Budget: interactive vertical bar chart */
.vbar-box { position: relative; }
.vbar-wrap { overflow-x: auto; }
.vbar-wrap g.vcol:hover .vfill { filter: brightness(1.18); }
.vtip { position: absolute; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 12px; font-size: 12.5px; pointer-events: none; min-width: 190px; max-width: 300px; }
.vtip b, .gtip b { display: block; margin-bottom: 5px; font-size: 13px; }
.vtip .vt-row, .gtip .vt-row { display: flex; justify-content: space-between; gap: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; }
/* Global cursor-following tooltip for dashboard stats ([data-tip]) */
.gtip { position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 12px; font-size: 12.5px; pointer-events: none; min-width: 180px; max-width: 300px; }
.bar-fill.over { background: var(--danger); }
/* Training & Support: month calendar */
.tcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.tcal-dow { text-align: center; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 2px 0; }
.tcal-day { min-height: 68px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 5px; background: var(--surface); overflow: hidden; }
.tcal-day.empty { border: 0; background: transparent; }
.tcal-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tcal-n { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.tcal-ev { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 6px; font-size: 10.5px; line-height: 1.25; padding: 2px 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) { .tcal-day { min-height: 44px; } .tcal-ev { display: none; } .tcal-day:has(.tcal-ev) { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); } }
/* Budget: move line up/down */
.bud-move { display: inline-flex; gap: 2px; }
.bud-move .mv { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 6px; width: 22px; height: 20px; line-height: 1; font-size: 9px; cursor: pointer; padding: 0; }
.bud-move .mv:hover { color: var(--ink); border-color: var(--accent); }
textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace; resize: vertical; margin-bottom: 8px; }

/* Modal + add/edit forms */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.modal-head b { font-size: 16px; }
.modal-body { padding: 18px 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .frow { margin-bottom: 0; }
.form-grid .frow.full { grid-column: 1 / -1; }
.form-grid textarea { font-family: inherit; font-size: 14px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal-foot .spacer { flex: 1; }
.modal .error { padding: 0 20px; }
tr.clickable { cursor: pointer; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }

/* Dashboards (Phase 4) */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.kpi[data-nav] { cursor: pointer; transition: border-color .15s; }
.kpi[data-nav]:hover { border-color: var(--accent); }
.kpi-val { font-size: 26px; font-weight: 700; line-height: 1.1; }
.kpi-lbl { color: var(--muted); font-size: 13px; margin-top: 3px; }
.kpi-sub { color: var(--accent); font-size: 12px; margin-top: 4px; }
.dash-title { font-weight: 700; font-size: 15px; margin-bottom: 12px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.bar-lbl { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--surface-2); border-radius: 6px; height: 10px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.bar-val { font-variant-numeric: tabular-nums; white-space: nowrap; }
.me-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.me-row:last-child { border-bottom: 0; }
.me-name { flex: 1; min-width: 200px; }
.me-tgt { color: var(--muted); }
.chip { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.chip.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.chip.risk { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.na-grp { margin-bottom: 10px; }
.na-h { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.na-h.na-over { color: var(--danger); } .na-h.na-week { color: var(--accent); } .na-h.na-up { color: var(--muted); }
.na-item { font-size: 13px; padding: 3px 0; }
.na-date { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 6px; }

/* Integrations */
.intg { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-top: 12px; }
.intg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

/* Finance section */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 7px 12px; color: var(--ink); font-size: 13px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg.seg-sm button { padding: 5px 9px; font-size: 12px; }
.cohort-tabs { margin: 0 0 12px; flex-wrap: wrap; }
.tv-switch { margin-bottom: 12px; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart-legend .dot, .lg .dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.donut-box { position: relative; }
.donut-wrap { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.donut-legend { flex: 1; min-width: 220px; }
.donut-legend.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 2px 20px; align-content: start; }
.lg { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 6px; border-radius: 7px; }
.lg.hl { background: var(--surface-2); }
.lg.lg-total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 7px; }
.lg-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dseg { transition: stroke-width .12s; }
.dseg.hl { stroke-width: 30; filter: brightness(1.1); }
.ai-out { margin-top: 10px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.5; }
.ai-controls { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.ai-controls label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ai-controls select { width: auto; }
.sso-div { text-align: center; color: var(--muted); font-size: 12px; margin: 14px 0 10px; }
.sso-btn { width: 100%; display: block; text-align: center; text-decoration: none; }

/* Global search */
.search-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 70; display: flex; justify-content: center; padding: 70px 16px 16px; }
.search-box { width: 100%; max-width: 620px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; height: fit-content; max-height: 74vh; display: flex; flex-direction: column; }
.search-box > input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 16px; font-size: 16px; }
.search-box > input:focus { outline: none; }
.search-results { overflow-y: auto; }
.sr-group { padding: 6px 0; border-top: 1px solid var(--line); }
.sr-group:first-child { border-top: 0; }
.sr-h { font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 6px 16px; letter-spacing: .05em; }
.sr-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: transparent; border: 0; padding: 9px 16px; color: var(--ink); font-size: 14px; }
.sr-item:hover { background: var(--surface-2); }
.sr-lbl { flex: 1; }
.sr-sub { color: var(--muted); font-size: 12px; }

/* Activity log filters */
.audit-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.audit-filters input { width: auto; }
#a-backups a { margin: 0 2px; }

/* ---- Increment 6b: brand, avatars, settings, announcements, polish ---- */
/* Clickable two-line brand */
.brand {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: transparent; border: 0; padding: 8px 8px 16px; color: var(--ink); border-bottom: 1px solid var(--line); margin-bottom: 6px;
}
.brand:hover { opacity: .85; }
.brand svg { width: 32px; height: 32px; flex: 0 0 auto; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt b { font-size: 14.5px; }
.brand-txt span { font-size: 12px; color: var(--accent); font-weight: 600; }

/* Avatars & account button */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: 50%; font-size: 13px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #f59a3c); color: #fff; letter-spacing: .02em;
}
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.acct-btn { display: inline-flex; align-items: center; gap: 7px; }
.acct-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu .who { display: flex; align-items: center; gap: 10px; }
.account-menu button { display: flex; align-items: center; gap: 8px; }
@media (max-width: 560px) { .acct-name { display: none; } }

/* Role chips */
.role-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); }
.role-chip.role-admin { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); border-color: transparent; }
.role-chip.role-director, .role-chip.role-vice { background: color-mix(in srgb, #4f9cf9 18%, transparent); color: #2f7fe0; border-color: transparent; }
.role-chip.role-head { background: color-mix(in srgb, #8e44ad 16%, transparent); color: #8e44ad; border-color: transparent; }
.role-chip.role-accountant { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); border-color: transparent; }

/* Announcements box (distinguished, top of dashboard) */
.ann-box { border-left: 4px solid var(--accent); }
.ann-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 15px; }
.ann-head .spacer { flex: 1; }
.ann-item { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin-bottom: 8px; border: 1px solid var(--line); }
.ann-item:last-child { margin-bottom: 0; }
.ann-item.ann-high { border-left: 3px solid var(--danger); }
.ann-row { display: flex; align-items: center; gap: 8px; }
.ann-row .spacer { flex: 1; }
.ann-title { font-weight: 600; }
.ann-when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.ann-body { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Settings grid */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.settings-actions { position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.settings-actions .spacer { flex: 1; }
.chk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.chk input { width: auto; }
.reorder-row { display: flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 4px; font-size: 13px; }
.reorder-row .ro-lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reorder-row .iconbtn.sm { padding: 2px 8px; }

/* Section sub-nav tabs (Finance / Org Info / AI Reports) */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px; color: var(--muted); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }

/* Dossier cards (Org Info) */
.dossier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.dossier { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.dossier .d-main { min-width: 0; }
.dossier .d-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dossier .d-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-profile dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; margin-top: 12px; }
.org-profile dd { margin: 3px 0 0; }
/* Visual org chart: top-down boxed tree with connector lines */
.orgchart { overflow-x: auto; padding: 8px 4px 16px; }
.orgchart ul { display: flex; justify-content: center; list-style: none; margin: 0; padding: 18px 0 0; position: relative; }
.orgchart > ul { padding-top: 0; }
.orgchart ul ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 18px; border-left: 2px solid var(--line); }
.orgchart li { position: relative; display: flex; flex-direction: column; align-items: center; padding: 18px 8px 0; }
.orgchart > ul > li { padding-top: 0; }
.orgchart li::before, .orgchart li::after { content: ""; position: absolute; top: 0; right: 50%; width: 50%; height: 18px; border-top: 2px solid var(--line); }
.orgchart li::after { right: auto; left: 50%; border-left: 2px solid var(--line); }
.orgchart li:only-child::before, .orgchart li:only-child::after { border-top: 0; }
.orgchart li:only-child::after { height: 18px; border-left: 2px solid var(--line); left: 50%; }
.orgchart li:first-child::before, .orgchart li:last-child::after { border-top: 0; }
.orgchart li:last-child::before { border-right: 2px solid var(--line); border-radius: 0 8px 0 0; }
.orgchart li:first-child::after { border-radius: 8px 0 0 0; }
.orgchart > ul > li::before, .orgchart > ul > li::after { display: none; }
.oc-box { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--surface); min-width: 132px; max-width: 200px; box-shadow: var(--shadow); text-align: center; }
.oc-box .avatar.sm { margin: 0 auto 6px; }
.oc-box .oc-name { font-weight: 700; font-size: 13px; line-height: 1.25; }
.oc-box .oc-role { color: var(--muted); font-size: 11.5px; margin-top: 3px; line-height: 1.3; }
.oc-box.tier-founder { border-color: #f86a14; border-width: 2px; background: color-mix(in srgb, #f86a14 6%, var(--surface)); }
.oc-box.tier-director { border-color: #f86a14; }
.oc-box.tier-deputy { border-color: #4f9cf9; }
.oc-box.tier-head { border-color: #1e874b; }
.oc-dept { display: inline-block; margin-top: 5px; font-size: 10.5px; padding: 1px 8px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
/* About TFU structured sections */
.org-sec { margin-bottom: 14px; }
.org-sec:last-child { margin-bottom: 0; }
.org-sec h4 { margin: 0 0 6px; font-size: 14px; }
.org-sec p { margin: 0 0 8px; line-height: 1.55; font-size: 13.5px; }
.org-list { margin: 0 0 8px; padding-left: 20px; }
.org-list li { margin-bottom: 5px; line-height: 1.5; font-size: 13.5px; }
.org-impact td:last-child { text-align: right; }
/* Ask AI conversation */
.ai-thread { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; max-height: 46vh; overflow-y: auto; }
.chat-msg { padding: 9px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; max-width: 85%; }
.cm-user { align-self: flex-end; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.cm-ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); }

/* Report viewer (AI Reports) */
.report-body { white-space: pre-wrap; font-size: 14px; line-height: 1.6; margin-top: 10px; }
.report-list-item { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; background: var(--surface); }
.report-list-item:hover { border-color: var(--accent); }
.report-list-item .r-title { font-weight: 600; flex: 1; min-width: 0; }
.report-meta { color: var(--muted); font-size: 12.5px; }

/* Users table (Admin) */
.usr-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.access-grid { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; margin-top: 8px; }
.access-grid label { font-size: 13px; color: var(--ink); }
.access-grid select { width: auto; min-width: 130px; }
.u-cell { display: inline-flex; align-items: center; gap: 8px; }
.acc-details { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.acc-details summary { cursor: pointer; font-weight: 600; font-size: 14px; }

/* Polish: page head accent, card hover, active nav bar */
.page-head { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.page-head h2 { position: relative; }
.card { transition: box-shadow .15s, border-color .15s; }
.nav-item.active { position: relative; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.kpi { transition: transform .12s, border-color .12s, box-shadow .12s; }
.kpi:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(25,35,55,.09); }
.card-nav { cursor: pointer; }
.card-nav:hover { border-color: var(--accent); }
.card-go { opacity: 0; transition: opacity .12s; font-weight: 600; }
.card-nav:hover .card-go { opacity: 1; }
.bar-row { cursor: default; }
.bar-fill { transition: filter .12s; }
.bar-row:hover .bar-fill { filter: brightness(1.08); }

/* Links as buttons */
.link-grp { margin-bottom: 16px; }
.link-grp-h { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 8px; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.link-btn { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .12s, transform .12s, box-shadow .12s; }
.link-btn:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(25,35,55,.08); }
.link-ico { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-size: 16px; flex: 0 0 auto; }
.link-lbl { flex: 1; font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-go, .link-edit { color: var(--muted); display: inline-flex; }
.link-edit:hover { color: var(--accent); }

.sec-actions { display: flex; align-items: center; margin-bottom: 12px; }
.sec-actions .spacer { flex: 1; }

/* Communications — social channels + feeds */
.social-row { display: flex; flex-wrap: wrap; gap: 10px; }
.social-btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14px; color: #fff; background: var(--sc, var(--accent)); border: 0; }
.social-btn:hover { filter: brightness(.94); }
.feed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.feed-card { margin-bottom: 0; }
#tg-posts { max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.tg-post { display: block; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.tg-post:hover { border-color: var(--accent); }
.tg-text { font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; }
.tg-date { margin-top: 6px; }
.feed-scroll { max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.ig-img { width: 100%; height: auto; max-height: 220px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; display: block; }

/* Calendar (agenda) */
.cal-day { padding: 8px 0; border-top: 1px solid var(--line); }
.cal-day:first-child { border-top: 0; }
.cal-date { font-weight: 700; font-size: 13px; color: var(--accent); margin-bottom: 6px; }
.cal-ev { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; }
.cal-ev:hover { background: var(--surface-2); }
.cal-ev.clickable { cursor: pointer; }
.cal-when { font-weight: 600; font-size: 12.5px; color: var(--accent); min-width: 52px; }
.cal-time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 46px; font-size: 13px; }
.cal-title { font-weight: 600; }
.cal-ev .spacer { flex: 1; }
/* Notifications section panel headings */
.nt-h { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 20px 0 10px; }
.nt-h:first-child { margin-top: 4px; }
.nt-h svg { color: var(--accent); }
/* Communications — media plan month/quarter chips + essentials list */
.mp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.mp-chip { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.mp-chip:hover { border-color: var(--accent); }
.mp-chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tips-list { margin: 8px 0 0; padding-left: 20px; color: var(--ink); font-size: 13.5px; }
.tips-list li { margin: 5px 0; }

/* ---- Tasks & Projects ---- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.proj-card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--pc, var(--accent)); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; cursor: pointer; display: block; }
.proj-card:hover { border-color: var(--accent); }
.proj-top { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.proj-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pc, var(--accent)); flex: 0 0 auto; }
.proj-desc { margin: 6px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.proj-bar { height: 7px; background: var(--surface-2); border-radius: 6px; overflow: hidden; margin: 10px 0 6px; }
.proj-bar span { display: block; height: 100%; background: var(--pc, var(--accent)); border-radius: 6px; }
.board-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.board-name { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; }
.board-bar { max-width: 100%; margin-bottom: 14px; }
.kb-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; -webkit-overflow-scrolling: touch; align-items: flex-start; }
.kb-col { flex: 0 0 270px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.kb-col.kb-addcol { background: transparent; border-style: dashed; }
.kb-col-h { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; padding: 0 2px; }
.kb-cards { display: flex; flex-direction: column; gap: 8px; min-height: 12px; border-radius: 8px; }
.kb-cards.drop-hover { outline: 2px dashed var(--accent); outline-offset: 2px; }
.kb-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; cursor: pointer; }
.kb-card:hover { border-color: var(--accent); }
.kb-card.dragging { opacity: .5; }
.kb-card-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.kb-card-title.done { text-decoration: line-through; color: var(--muted); }
.kb-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kb-add { width: 100%; margin-top: 8px; background: transparent; border: 1px dashed var(--line); color: var(--muted); border-radius: 8px; padding: 8px; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.kb-add:hover { border-color: var(--accent); color: var(--accent); }
.prio { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.prio.p-low { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }
.prio.p-med { background: color-mix(in srgb, #2d7dd2 20%, transparent); color: #2d7dd2; }
.prio.p-high { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.prio.p-urg { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--danger); }
.due-badge { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.due-badge.over { color: var(--danger); font-weight: 600; }
.mini { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.mini.assignee { background: var(--accent); color: var(--accent-ink); width: 20px; height: 20px; border-radius: 50%; justify-content: center; font-weight: 700; font-size: 10px; }
.iconbtn.xs { padding: 2px 5px; font-size: 13px; line-height: 1; }
/* task list */
.tl-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tl-filters select { width: auto; }
.chip-btn { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 600; color: var(--ink); }
.chip-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tl-row { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tl-title { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 620px) {
  /* Phones: let a task row wrap — title first, chips and meta flow below. */
  .tl-row { flex-wrap: wrap; row-gap: 4px; }
  .tl-title { flex: 1 1 calc(100% - 40px); }
}
.tl-row:last-child { border-bottom: 0; }
.tl-row:hover { background: var(--surface-2); }
.tl-check { width: auto; flex: 0 0 auto; }
.tl-title { font-weight: 600; }
.tl-title.done { text-decoration: line-through; color: var(--muted); }
/* card detail */
.modal.modal-lg { max-width: 720px; }
.color-row { display: flex; gap: 8px; }
.color-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; }
.color-dot.on { border-color: var(--ink); }
.cl-add { display: flex; gap: 8px; margin-top: 8px; }
.cl-add input { flex: 1; }
.cl-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }
.cl-item label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cl-item input { width: auto; }
.cl-done { text-decoration: line-through; color: var(--muted); }
.cmt { border-top: 1px solid var(--line); padding: 8px 0; }
.cmt:first-child { border-top: 0; }
.cmt-h { display: flex; align-items: center; gap: 8px; }
.cmt-b { font-size: 13.5px; margin-top: 2px; white-space: pre-wrap; }
@media (max-width: 820px) { .kb-col { flex-basis: 82vw; } }
/* labels, chips, attachments, deps */
.lbl-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.lbl { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: color-mix(in srgb, var(--lc) 18%, transparent); color: var(--lc); display: inline-flex; align-items: center; gap: 5px; }
.lbl button, .chip-tag button { background: transparent; border: 0; color: inherit; cursor: pointer; padding: 0; font-size: 11px; line-height: 1; opacity: .7; }
.chip-field { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; min-height: 22px; align-items: center; }
.chip-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; }
.dep-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dep-dot.ok { background: var(--ok); } .dep-dot.risk { background: var(--danger); }
.att-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 13.5px; }
.att-item a { display: inline-flex; align-items: center; gap: 5px; }
.proj-restore { margin-top: 8px; }
/* notification centre */
.notif-wrap { position: relative; }
.notif-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.notif-menu { width: 320px; max-width: 88vw; max-height: 70vh; overflow-y: auto; padding: 0; }
.notif-head { display: flex; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.notif-list { display: flex; flex-direction: column; }
.notif-item { text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; cursor: pointer; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.notif-text { font-size: 13.5px; }
/* Gantt / timeline */
.gantt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gantt { position: relative; font-size: 12.5px; }
.g-grid { position: absolute; top: 0; width: 1px; background: var(--line); }
.g-tick { position: absolute; top: 4px; font-size: 10.5px; color: var(--muted); }
.g-proj { position: absolute; left: 0; height: 34px; display: flex; align-items: center; font-weight: 700; font-size: 12px; color: var(--accent); }
.g-lbl { position: absolute; left: 0; width: 182px; height: 34px; display: flex; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.g-bar { position: absolute; height: 22px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 11px; line-height: 22px; padding: 0 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; box-shadow: var(--shadow); }
.g-bar.prio-urgent { background: var(--danger); } .g-bar.prio-high { background: var(--accent); }
.g-bar.prio-medium { background: #2d7dd2; } .g-bar.prio-low { background: var(--muted); }
.g-bar.done { opacity: .55; text-decoration: line-through; }
.gantt-svg { position: absolute; top: 0; left: 0; pointer-events: none; }
.src-badge { font-size: 11px; padding: 2px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.src-internal { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.src-outlook { background: color-mix(in srgb, #0f6cbd 18%, transparent); color: #0f6cbd; }
.src-google { background: color-mix(in srgb, #1e874b 16%, transparent); color: #1e874b; }
.src-manual { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.cal-grid-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 10px 0 6px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-grid-head div { text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell { min-height: 92px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; background: var(--surface); cursor: pointer; overflow: hidden; }
.cal-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell:not(.empty):hover { border-color: var(--accent); }
.cal-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-dnum { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
.cal-cell.today .cal-dnum { color: var(--accent); }
.cal-chip { font-size: 11px; padding: 1px 5px; border-radius: 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: 10.5px; color: var(--muted); }
@media (max-width: 620px) { .cal-cell { min-height: 64px; } .cal-chip { display: none; } }

/* Mobile: bottom bar + account-menu extras (hidden on desktop) */
.mobile-only { display: none; }
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--surface); border-top: 1px solid var(--line);
  justify-content: space-around; align-items: stretch; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(25,35,55,.06);
}
.bb-item { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: transparent; border: 0; color: var(--muted); font-size: 10.5px; padding: 7px 2px; border-radius: 10px; }
.bb-item.on { color: var(--accent); }
.bb-item.on svg { opacity: 1; }
.bb-item svg { display: block; opacity: .85; }
.bb-item span { line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.acct-mobile { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 6px; }
.acct-mobile > button { width: 100%; text-align: left; background: transparent; border: 0; color: var(--ink); padding: 9px 10px; border-radius: 8px; display: flex; align-items: center; gap: 8px; }
.acct-mobile > button:hover { background: var(--surface-2); }
.acct-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; font-size: 14px; gap: 10px; }
.acct-row select { width: auto; }

/* Responsive */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 84%; max-width: 320px; z-index: 30; height: 100%;
    transform: translateX(-100%); transition: transform .2s ease;
    overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 32px;
  }
  .sidebar.open { transform: translateX(0); }
  /* The whole drawer scrolls, so Admin/Settings at the bottom are reachable. */
  .nav-scroll { overflow: visible; flex: 0 0 auto; min-height: 0; }
  .nav-bottom { margin-top: 16px; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; display: none; }
  .scrim.open { display: block; }
  .desktop-only { display: none !important; }
  .menu-toggle { display: inline-flex; }
  /* Logo sits just to the right of the menu button (not centred). */
  .topbar-logo { display: block; margin-left: 2px; }
  .bottombar { display: flex; }
  .acct-mobile { display: block; }
  /* Everything fits + bigger touch targets */
  .content { padding: 16px 14px calc(74px + env(safe-area-inset-bottom)); max-width: 100%; }
  .topbar { padding: 9px 12px; gap: 8px; }
  .btn { padding: 12px 18px; font-size: 15px; border-radius: 12px; }
  .btn.sm { padding: 9px 13px; font-size: 14px; }
  .iconbtn { padding: 10px 11px; }
  .acct-btn { padding: 8px 9px; }
  .refresh-top { padding: 10px 12px; }
  .page-head h2 { font-size: 19px; }
  .kpi-row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .kpi-val { font-size: 22px; }
  /* Bar charts: value can be a long money string, so stack it — label + value
     on top, full-width track below — instead of one row that overflows. */
  .bar-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "lbl val" "track track"; gap: 4px 10px; margin-bottom: 12px;
  }
  .bar-lbl { grid-area: lbl; }
  .bar-val { grid-area: val; text-align: right; }
  .bar-track { grid-area: track; }
  .settings-grid, .dossier-grid, .feed-grid, .chk-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-overlay { padding: 10px; }
  .modal { max-width: 100%; }
  .account-menu { min-width: 250px; right: -4px; }
  .card { padding: 15px 15px; }
  .settings-actions { bottom: calc(74px + env(safe-area-inset-bottom)); }
  .search-overlay { padding: 12px; }
  .tab { padding: 9px 11px; font-size: 13.5px; }
}

/* ---- Official org chart (fixed structure, Phase 19) ---- */
.ocx-scroll { overflow-x: auto; padding: 6px 2px 10px; }
.ocx { min-width: 880px; }
.ocx-spine { display: flex; flex-direction: column; align-items: center; }
.ocx-box {
  border: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 600;
  text-align: center; max-width: 250px; min-width: 150px; cursor: default;
  position: relative; transition: box-shadow .12s, transform .12s;
}
.ocx-box:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, .16); transform: translateY(-1px); }
.ocx-org { background: var(--accent); color: #fff; border-color: var(--accent); min-width: 250px; }
.ocx-spine .ocx-box:not(.ocx-org) { background: color-mix(in srgb, var(--accent) 10%, transparent); min-width: 250px; }
.ocx-blue { border-color: #0a66c2; background: color-mix(in srgb, #0a66c2 14%, transparent); cursor: pointer; }
.ocx-line, .ocx-riser { width: 2px; height: 16px; background: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.ocx-riser { margin: 0 auto; }
.ocx-row { display: flex; justify-content: center; align-items: flex-start; gap: 26px; position: relative; }
.ocx-row::before { content: ""; position: absolute; top: 0; left: 10%; right: 10%; border-top: 2px solid color-mix(in srgb, var(--accent) 45%, var(--line)); }
.ocx-col { display: flex; flex-direction: column; align-items: center; position: relative; padding-top: 16px; flex: 1; max-width: 260px; }
.ocx-col::before { content: ""; position: absolute; top: 0; left: 50%; height: 16px; border-left: 2px solid color-mix(in srgb, var(--accent) 45%, var(--line)); }
.ocx-n {
  position: absolute; top: -8px; right: -8px; background: var(--accent); color: #fff;
  border-radius: 50%; min-width: 18px; height: 18px; font-size: 11px; line-height: 18px; font-weight: 700;
}

/* ---- Recruitment: multi-year funnel + regional targets ---- */
.rcf-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 2px 0 12px; }
.rcf { display: flex; flex-direction: column; gap: 12px; }
.rcf-row { display: grid; grid-template-columns: 230px 1fr; gap: 12px; align-items: center; }
.rcf-stage { font-size: 13px; font-weight: 600; }
.rcf-bars { display: flex; flex-direction: column; gap: 3px; }
.rcf-bar { position: relative; height: 17px; background: color-mix(in srgb, var(--line) 45%, transparent); border-radius: 5px; overflow: hidden; cursor: default; }
.rcf-fill { position: absolute; top: 0; left: 0; bottom: 0; border-radius: 5px; transition: filter .12s; }
.rcf-bar:hover .rcf-fill { filter: brightness(1.1); }
.rcf-num { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: 11.5px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); z-index: 1; }
.rcf-bar.empty .rcf-num { color: var(--muted); text-shadow: none; font-weight: 600; }
.rcr-item { margin-bottom: 14px; cursor: default; }
.rcr-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.rcr-track { display: block; height: 10px; background: color-mix(in srgb, var(--line) 45%, transparent); border-radius: 6px; overflow: hidden; margin: 6px 0 4px; }
.rcr-prog { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.rcr-prog.over { background: #1e874b; }
@media (max-width: 720px) {
  .rcf-row { grid-template-columns: 1fr; gap: 4px; }
  .ocx-row { gap: 14px; }
}

/* ---- Communications: campaign plan (Summer Institute media plan) ---- */
.cmp-pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.cmp-pillar { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.cmp-pillar b { color: var(--accent); display: block; margin-bottom: 4px; }
.cmp-pillar p { margin: 0; font-size: 13.5px; }
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-bottom: 12px; }
.cmp-ch { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; min-width: 0; }
.cmp-grid .cmp-ch { margin-bottom: 0; }
.cmp-ch-h { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; margin-bottom: 6px; color: var(--accent); }
.cmp-ch-h svg { flex: 0 0 auto; }
.cmp-ch-b { font-size: 13.5px; line-height: 1.55; }

/* ---- Polish: tooltips, settings grid ---- */
.gtip { max-width: 340px; }
.gtip .vt-row span:last-child { text-align: right; word-break: break-word; }
.settings-grid .card { margin-bottom: 0; }
.settings-grid .dash-title { display: flex; align-items: center; gap: 7px; }
.kpi-val { overflow-wrap: anywhere; }

/* ---- Fellow profile ---- */
.fp-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.fp-ava {
  width: 52px; height: 52px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
}
.fp-name { font-size: 18px; font-weight: 700; }
.fp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; align-items: center; }
.fp-status { border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; }
.fp-status.st-placed, .fp-status.st-in_training, .fp-status.st-accepted { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.fp-status.st-alumni { background: color-mix(in srgb, #0a66c2 16%, transparent); color: #0a66c2; }
.fp-status.st-withdrawn { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.fp-status.st-applicant { background: var(--surface-2); color: var(--muted); }
.fp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; margin-bottom: 12px; }
.fp-fact span { display: block; }
.fp-fact b { font-size: 13.5px; overflow-wrap: anywhere; }
.fp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.fp-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 12px; min-width: 0; }
.fp-cols .fp-box { margin-top: 0; }
.fp-box-h { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13.5px; margin-bottom: 8px; color: var(--accent); }
.fp-tl { border-left: 2px solid color-mix(in srgb, var(--accent) 40%, var(--line)); padding-left: 14px; display: flex; flex-direction: column; gap: 10px; }
.fp-tl-item { position: relative; font-size: 13.5px; }
.fp-tl-dot { position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.fp-att { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.fp-att:last-child { border-bottom: 0; }
.fp-att.miss { color: var(--muted); }
@media (max-width: 640px) { .fp-cols { grid-template-columns: 1fr; } }

/* ---- Data export center ---- */
.exp-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 4px 22px; }
.exp-grp { min-width: 0; }
.exp-grp-h { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 12px 0 4px; }
.exp-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.exp-row:last-child { border-bottom: 0; }
.exp-name { font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-row .btn.sm { padding: 4px 9px; font-size: 12.5px; }

/* ---- School & Alumni profiles ---- */
.fp-status.st-engaged, .fp-status.st-mou-signed { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.fp-status.st-occasional, .fp-status.st-mou-draft { background: color-mix(in srgb, #e67e22 16%, transparent); color: #b35c0e; }
.fp-status.st-inactive, .fp-status.st-mou-none { background: var(--surface-2); color: var(--muted); }
.fp-status.st-mou-expired { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.sp-fellow { cursor: pointer; }
.sp-fellow:hover { background: var(--surface-2); }
.fp-link { color: var(--accent); font-weight: 600; }

/* ---- M&E indicator trends ---- */
.met { display: flex; flex-direction: column; gap: 20px; }
.met-row { display: grid; grid-template-columns: 220px 1fr; gap: 14px; align-items: end; }
.met-name { font-size: 13px; font-weight: 600; }
.met-bars { position: relative; display: flex; align-items: flex-end; gap: 6px; height: 72px; margin-bottom: 16px; }
.met-cell { flex: 1; max-width: 46px; position: relative; height: 100%; display: flex; align-items: flex-end; }
.met-col { width: 100%; border-radius: 4px 4px 0 0; background: var(--accent); min-height: 5px; cursor: default; transition: filter .12s; }
.met-col:hover { filter: brightness(1.12); }
.met-col.ok { background: var(--ok); }
.met-col.bad { background: var(--danger); }
.met-x { position: absolute; top: 100%; left: -3px; right: -3px; font-size: 10px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.met-target { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--muted); z-index: 1; pointer-events: none; }
@media (max-width: 720px) { .met-row { grid-template-columns: 1fr; gap: 6px; } }

/* ---- Relationship chips (donor / partner profiles) ---- */
.fp-status.st-rel-active { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.fp-status.st-rel-prospect { background: color-mix(in srgb, #e67e22 16%, transparent); color: #b35c0e; }
.fp-status.st-rel-dormant { background: var(--surface-2); color: var(--muted); }

/* ---- Data quality (Admin Panel) ---- */
.dq-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 4px 22px; }
.dq-grp-h { font-size: 13px; font-weight: 700; margin: 12px 0 4px; display: flex; align-items: center; gap: 8px; }
.dq-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px; font-size: 13.5px; }
.dq-row:hover { background: var(--surface-2); }
.dq-row:last-child { border-bottom: 0; }

/* ---- Cohort retention ---- */
.cr { display: flex; flex-direction: column; gap: 16px; }
.cr-row { display: grid; grid-template-columns: 230px 1fr auto; gap: 12px; align-items: center; }
.cr-name { font-size: 13.5px; font-weight: 600; }
.cr-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: color-mix(in srgb, var(--line) 45%, transparent); }
.cr-seg { display: grid; place-items: center; color: #fff; font-size: 11.5px; font-weight: 700; min-width: 18px; cursor: default; transition: filter .12s; }
.cr-seg:hover { filter: brightness(1.1); }
.cr-chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 820px) { .cr-row { grid-template-columns: 1fr; gap: 6px; } }

/* ---- Print (Year in review, profiles) ---- */
@media print {
  .sidebar, .topbar, .bottombar, .sec-hint, .tabs, .sec-actions, .settings-actions, #yr-back, #yr-print { display: none !important; }
  .shell { display: block; }
  .content { max-width: 100%; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---- Table filter/sort controls ---- */
.tbl-controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; align-items: center; }
.tbl-controls .tf-q { flex: 1 1 180px; min-width: 150px; width: auto; padding: 8px 11px; }
.tbl-controls select { width: auto; max-width: 230px; padding: 8px 10px; font-size: 13.5px; }
th.tsort { cursor: pointer; user-select: none; white-space: nowrap; }
th.tsort:hover { color: var(--accent); }

/* ---- Grant status chips ---- */
.fp-status.st-g-active, .fp-status.st-g-awarded { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.fp-status.st-g-reporting { background: color-mix(in srgb, #e67e22 16%, transparent); color: #b35c0e; }
.fp-status.st-g-pipeline, .fp-status.st-g-closed { background: var(--surface-2); color: var(--muted); }

/* ---- Recycle bin (Admin Panel) ---- */
.trash-row { display: flex; align-items: center; gap: 8px; padding: 9px 2px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.trash-row:first-child { border-top: 0; }
.trash-info { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trash-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Custom fields designer (Admin Panel) ---- */
.cfd-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.cfd-top select { width: auto; min-width: 160px; }
.cfd-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.cfd-row input[data-cfl] { flex: 1 1 160px; min-width: 130px; width: auto; }
.cfd-row select { width: auto; }
.cfd-row input[data-cfo] { flex: 1 1 170px; min-width: 140px; width: auto; }

/* ---- Record change history ---- */
.rh-item { border-top: 1px solid var(--line); padding: 9px 2px; }
.rh-item:first-child { border-top: 0; }
.rh-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rh-diff { display: flex; gap: 7px; align-items: baseline; font-size: 13px; margin-top: 4px; flex-wrap: wrap; }
.rh-field { font-weight: 600; min-width: 90px; }
.rh-from { color: var(--muted); text-decoration: line-through; overflow-wrap: anywhere; }
.rh-arrow { color: var(--muted); }
.rh-to { overflow-wrap: anywhere; }

/* ---- Uzbekistan map (About TFU) ---- */
.uzg { overflow-x: auto; }
.uzg svg { width: 100%; min-width: 660px; height: auto; display: block; }
.uzg path { stroke: var(--line); stroke-width: 1.1; vector-effect: non-scaling-stroke; transition: filter .12s ease; cursor: default; }
.uzg path:hover { stroke: var(--accent); stroke-width: 2; filter: brightness(.95); }
.uzg text { fill: var(--ink); pointer-events: none; }
.uzg .uzg-name { opacity: .82; }
.uzg .uzg-count { font-weight: 700; }
.uzg-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.uzg-key { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.uzg-key i { width: 13px; height: 13px; border-radius: 4px; border: 1px solid var(--line); display: inline-block; flex: 0 0 auto; }

/* ---- Board of Trustees read-only mode ---- */
.board-banner { display: flex; align-items: center; gap: 7px; padding: 8px 16px; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--ink); border-bottom: 1px solid var(--line); }
.bl-url { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.bl-url input { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }

/* ---- Multi-select filters + bulk toolbar (shared table engine) ---- */
.flt-dd { position: relative; }
.flt-menu { min-width: 180px; max-height: 260px; overflow-y: auto; padding: 6px; }
.flt-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.flt-opt:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.flt-opt input { width: auto; }
.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface)); font-size: 13.5px; }
th.tsel, td.tsel { width: 34px; text-align: center; }
.tsel input { width: auto; cursor: pointer; }

/* ---- Letters registry ---- */
.st-l-draft, .st-l-filed, .st-l-none { background: var(--surface-2); color: var(--muted); }
.st-l-pending, .st-l-in_review { background: color-mix(in srgb, #e67e22 16%, transparent); color: #b35c0e; }
.st-l-approved, .st-l-answered { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.st-l-sent, .st-l-received { background: color-mix(in srgb, #2e86c1 16%, transparent); color: #2e86c1; }
.st-l-rejected { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* ---- Applicant dossier profile ---- */
.apr-list { display: flex; gap: 8px; flex-wrap: wrap; }
.apr-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; background: var(--surface); }
.apr-chip b { color: var(--accent); }
.apr-score { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
