:root {
  /* Modern type system. Inter is the workhorse for UI, articles, and
   * numbers (rendered with tabular/lining figures so columns align without a
   * monospace). --mono is a clean system stack reserved for codes/IDs. */
  --sans:         'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono:         ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --num-feat:     "tnum" 1, "lnum" 1, "cv01" 1;
  /* Modern white surface system — cool, clean neutrals so white cards read
   * crisply and the imperial gold/green brand stays the only warm accent. */
  --bg:           #f4f5f7; /* page backdrop */
  --surface:      #ffffff;
  --surface-2:    #f7f8fa;
  --ink:          #14171a;
  --ink-2:        #2b2f33;
  --muted:        #5b636c;
  --gold:         #c4981f;
  --gold-bright:  #d4ac2a;
  --gold-deep:    #9a780f;
  --gold-pale:    #fbf6e6;
  --gold-tint:    #f3e7b4;
  --gold-border:  #e0cd84;
  --line:         #e3e6ea;
  --line-2:       #eef0f3;
  /* Imperial brick red — muted to sit beside the gold/green instead of the
   * old fire-engine red that clashed with the palette. */
  --danger-bright:#c0392b;
  --danger:       #a32a20;
  --danger-pale:  #f8ece9;
  --danger-border:#e6c4bd;
  --success-text: #15803d; /* Stronger green for success */
  --shadow-xs:    0 1px 3px rgba(0,0,0,.06);
  --shadow-sm:    0 2px 6px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 12px rgba(0,0,0,.12), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.14), 0 3px 10px rgba(0,0,0,.07);
  --r:            6px;
  --masthead-h:   56px;
}
* { box-sizing: border-box; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); }
body { margin: 0; font-family: var(--sans); background: var(--bg); color: var(--ink); line-height: 1.55; font-size: 13px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* ── Masthead ───────────────────────────────── */
.masthead {
  position: sticky; top: 0; z-index: 200;
  height: var(--masthead-h);
  background: var(--ink);
  border-bottom: 3px solid var(--gold);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
}
.masthead-brand { display: flex; align-items: center; gap: 13px; flex: 1; }
.masthead-crest { font-size: 22px; line-height: 1; color: var(--gold); flex-shrink: 0; }
.masthead-wordmark { display: flex; flex-direction: column; gap: 1px; }
.masthead-title { font-size: 15px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #fff; line-height: 1; }
.masthead-user { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.masthead-profile { position: relative; }
.masthead-profile-btn { display: flex; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: rgba(255,255,255,.82); border-radius: 8px; padding: 5px 8px 5px 5px; box-shadow: none; text-decoration: none; cursor: pointer; font-family: inherit; }
.masthead-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--gold-tint); color: var(--gold-deep); display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.masthead-caret { color: var(--gold-border); font-size: 10px; }
.masthead-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 180px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-lg); padding: 6px; z-index: 500; }
.masthead-menu button,
.masthead-menu a { display: block; width: 100%; border: 0; background: transparent; color: var(--ink); box-shadow: none; text-align: left; padding: 9px 10px; border-radius: 4px; font-size: 12px; text-decoration: none; cursor: pointer; font-family: inherit; }
.masthead-menu button:hover,
.masthead-menu a:hover { background: var(--gold-pale); color: var(--gold-deep); }

/* ── Layout shell ───────────────────────────── */
.shell { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100vh - var(--masthead-h)); }
.global-nav { padding: 10px 8px; border-bottom: 1px solid var(--line-2); }
.runtime-line { display: flex; align-items: center; gap: 6px; font-weight: 800; text-transform: uppercase; }
.runtime-dot { width: 8px; height: 8px; border-radius: 50%; background: #999; flex-shrink: 0; }
.runtime-dot.online { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.runtime-dot.offline { background: var(--danger-bright); box-shadow: 0 0 8px var(--danger-bright); }
.runtime-meta { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0; }
.content { padding: 24px 28px; overflow-y: auto; height: calc(100vh - var(--masthead-h)); background: var(--bg); }

/* ── Guild cards ────────────────────────────── */
.guild { border: 1px solid var(--line-2); border-radius: var(--r); padding: 9px 11px; margin-bottom: 4px; cursor: pointer; display: grid; grid-template-columns: 34px 1fr; gap: 9px; align-items: center; background: transparent; transition: background .15s ease, border-color .15s ease, transform .15s ease; width: 100%; text-align: left; font-family: inherit; box-shadow: none; } /* No change, looks good */
.guild:hover { background: var(--gold-pale); border-color: var(--gold-border); transform: translateX(2px); }
.guild.active { border-color: var(--gold); border-left: 3px solid var(--gold); background: var(--gold-pale); padding-left: 9px; }
.guild:focus { outline: 2px solid rgba(196,152,31,.45); outline-offset: 1px; }
.guild img, .guild .fallback { width: 34px; height: 34px; border-radius: 4px; object-fit: cover; }
.guild .fallback { display: grid; place-items: center; background: var(--gold-tint); font-weight: 800; color: var(--gold-deep); font-size: 13px; border: 1px solid var(--gold-border); }
.guild .name { font-weight: 700; font-size: 12px; color: var(--ink); }
.guild .meta { color: var(--muted); font-size: 10px; margin-top: 1px; font-family: ui-monospace, monospace; }

/* ── Section blocks ─────────────────────────── */
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 16px; padding: 22px 24px; box-shadow: var(--shadow-sm); }
.block h3 { margin: 0 0 16px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding-bottom: 11px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 8px; }
.block h3::before { content: ''; display: inline-block; width: 3px; height: 12px; background: var(--gold); border-radius: 2px; flex-shrink: 0; }

/* ── Page banner (slim guild header) ───────── */
.page-banner { display: flex; align-items: center; gap: 14px; padding: 0 0 20px; flex-wrap: wrap; border-bottom: 1px solid var(--line-2); margin-bottom: 20px; }
.page-banner-icon { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); flex-shrink: 0; }
.page-banner-icon-fallback { width: 42px; height: 42px; border-radius: 8px; display: grid; place-items: center; background: var(--gold-tint); color: var(--gold-deep); font-weight: 800; font-size: 16px; border: 1px solid var(--gold-border); flex-shrink: 0; }
.page-banner-name { font-size: 19px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); line-height: 1.1; }
.page-banner-id { font-size: 10px; color: var(--muted); margin-top: 2px; font-family: ui-monospace, monospace; }
.page-banner-spacer { flex: 1; min-width: 12px; }
.page-banner-pills { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-banner-pill { font-size: 10px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 20px; padding: 3px 10px; white-space: nowrap; }
/* ── Stat cards ─────────────────────────────── */
.stat-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; position: relative; overflow: hidden; }
.stat-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--gold) 0%, var(--gold-bright) 100%); }
.stat-card h4 { margin: 0; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 800; }
.stat-card .value { margin-top: 8px; font-size: 26px; font-weight: 800; color: var(--ink); line-height: 1; letter-spacing: -.02em; }
.stat-card .meta { color: var(--muted); font-size: 11px; margin-top: 5px; }

/* ── Info grid ──────────────────────────────── */
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); font-size: 12px; color: var(--ink-2); }
.grid strong { color: var(--ink); }
.schedule-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }

/* ── Tabs ───────────────────────────────────── */
.tabbar { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 4px; box-shadow: var(--shadow-xs); }
.tab { background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 4px; font-size: 12px; font-weight: 600; padding: 7px 20px; cursor: pointer; transition: background .1s, color .1s, border-color .1s; letter-spacing: .02em; font-family: inherit; }
.tab:hover:not(.active) { background: var(--surface-2); color: var(--ink); border-color: var(--line-2); }
.tab.active { background: var(--gold); color: #1a1000; border-color: var(--gold-deep); font-weight: 800; box-shadow: 0 1px 4px rgba(196,152,31,.3); }
.tab:focus { outline: none; box-shadow: 0 0 0 3px rgba(196,152,31,.35); }

/* ── Tables ─────────────────────────────────── */
.table-shell { border: 1px solid var(--line); border-radius: var(--r); overflow: auto; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 10px 13px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--gold-pale); }
th { background: var(--surface-2); position: sticky; top: 0; z-index: 1; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }

/* ── User directory ─────────────────────────── */
.directory-table th:nth-child(2), .directory-table td:nth-child(2) { min-width: 260px; }
.directory-row { cursor: pointer; }
.directory-row td { transition: background .1s; }
.rank-badge { display: inline-grid; place-items: center; min-width: 30px; height: 26px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-weight: 800; font-size: 11px; }
/* Wealth-ranking podium: tint the top three ranks (gold / silver / bronze)
 * so the leaderboard reads at a glance without changing the table layout. */
.rank-badge.rank-tier-1 { background: #fbf2cf; border-color: #e3c45a; color: #6e4b00; }
.rank-badge.rank-tier-2 { background: #eef1f4; border-color: #c2cad3; color: #4a5560; }
.rank-badge.rank-tier-3 { background: #f6e9dd; border-color: #d8b48c; color: #7a4f25; }
.user-open-btn { display: block; width: 100%; padding: 0; border: 0; background: transparent; box-shadow: none; color: inherit; text-align: left; white-space: normal; }
.user-open-btn:hover { background: transparent; box-shadow: none; }
.user-open-btn:focus { outline: 2px solid rgba(196,152,31,.45); outline-offset: 3px; border-radius: 4px; }
.user-identity { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 10px; min-width: 0; }
.user-identity.compact { grid-template-columns: 30px minmax(0, 1fr); gap: 8px; }
.user-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-xs); background: var(--line-2); }
.user-avatar.small { width: 30px; height: 30px; }
.user-avatar-fallback { display: grid; place-items: center; background: var(--gold-tint); color: var(--gold-deep); font-size: 14px; font-weight: 800; }
.user-copy { min-width: 0; display: grid; gap: 1px; }
.user-copy strong { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.user-copy span { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.bot-pill { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 1px 6px; background: var(--surface-2); color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; line-height: 1.4; }
.slim-btn { padding: 6px 10px; font-size: 11px; }

/* ── Form controls ──────────────────────────── */
select { padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-family: inherit; font-size: 12px; color: var(--ink); cursor: pointer; }
input[type="text"], input[type="password"], textarea { padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-family: inherit; font-size: 12px; color: var(--ink); }
textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
input[type="text"]:focus, input[type="password"]:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(196,152,31,.18); }

/* ── Buttons ────────────────────────────────── */
button { border: 1px solid var(--gold-deep); border-radius: var(--r); padding: 9px 18px; cursor: pointer; background: var(--gold); color: #1a1000; font-weight: 700; font-size: 12px; letter-spacing: .02em; transition: all .15s cubic-bezier(0.4, 0, 0.2, 1); font-family: inherit; white-space: nowrap; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
button:hover { background: var(--gold-bright); box-shadow: 0 5px 15px rgba(196,152,31,0.3); transform: translateY(-2px); }
button:active { transform: translateY(0); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
button:focus { outline: none; box-shadow: 0 0 0 3px rgba(196,152,31,.35); }
button.secondary { background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; }
button.secondary:hover { background: var(--surface-2); border-color: var(--gold-border); box-shadow: 0 4px 8px rgba(0,0,0,0.05); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── Utility ────────────────────────────────── */
.status { font-size: 11px; color: var(--muted); line-height: 1.55; margin-top: 2px; }
.meta { color: var(--muted); font-size: 11px; }
pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 11px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; background: var(--line-2); padding: 1px 5px; border-radius: 3px; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); flex-shrink: 0; }

/* ── Amount input wrapper ───────────────────── */
.amount-input-wrap { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 0 11px; min-width: 180px; transition: border-color .1s; }
.amount-input-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(196,152,31,.18); }
.amount-input-wrap span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; flex-shrink: 0; }
.amount-input-wrap input { border: 0; outline: none; background: transparent; width: 100%; padding: 8px 0; font-size: 12px; color: var(--ink); }

/* ── Schedule planner ───────────────────────── */
.planner-block { overflow: visible; }
.planner-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.planner-layout { display: grid; gap: 12px; grid-template-columns: minmax(210px, 1fr) minmax(280px, 1.4fr); align-items: stretch; margin-bottom: 12px; }
.planner-summary { border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; background: var(--surface); box-shadow: var(--shadow-xs); }
.planner-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 10px; }
.planner-label { font-size: 9px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 800; }
.planner-date { margin-top: 6px; font-size: 17px; font-weight: 800; line-height: 1.2; color: var(--ink); }
.planner-summary-value { margin-top: 5px; font-size: 14px; font-weight: 800; color: var(--ink); }
.planner-help { margin-top: 4px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.planner-calendar-shell { border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; background: var(--surface); box-shadow: var(--shadow-xs); }
.planner-selected-line { margin-bottom: 12px; color: var(--ink-2); font-size: 12px; }
.planner-button-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

/* ── Calendar ───────────────────────────────── */
.calendar-pop { position: relative; background: transparent; border: 0; padding: 0; width: 100%; }
.cal-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.cal-nav { padding: 6px 12px; font-size: 11px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-label { font-size: 9px; color: var(--muted); text-align: center; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; padding-bottom: 6px; }
.cal-day { border: 1px solid var(--line-2); background: var(--surface); border-radius: 4px; padding: 7px 0; font-size: 12px; font-weight: 600; text-align: center; cursor: pointer; min-height: 36px; color: var(--ink); transition: background .08s, border-color .08s; font-family: inherit; }
.cal-day:hover { border-color: var(--gold-border); background: var(--gold-pale); }
.cal-day.selected { background: var(--gold); border-color: var(--gold-deep); color: #1a1000; font-weight: 800; box-shadow: 0 1px 4px rgba(196,152,31,.4); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--gold-border); font-weight: 800; }
.cal-day.outside { opacity: .35; } /* Slightly less faded */

/* ── Channel picker ─────────────────────────── */
.channel-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.channel-picker { border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: var(--surface); box-shadow: var(--shadow-xs); }
.channel-selection { min-height: 28px; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.channel-search { width: 100%; margin-bottom: 8px; }
.channel-list { display: grid; gap: 5px; max-height: 280px; overflow: auto; padding-right: 2px; }
.channel-option { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink); padding: 9px 11px; box-shadow: none; border-radius: 4px; font-weight: 400; font-family: inherit; cursor: pointer; transition: background .09s, border-color .09s; }
.channel-option:hover { background: var(--gold-pale); border-color: var(--gold-border); }
.channel-option.selected { border-color: var(--gold); background: var(--gold-pale); }
.channel-option-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 2px; }
.channel-head-actions { display: inline-flex; align-items: center; gap: 6px; }
.channel-kind { font-size: 9px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 800; }
.channel-revoke-badge { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 999px; border: 1px solid var(--danger); background: var(--danger-pale); color: var(--danger); font-size: 11px; font-weight: 900; line-height: 1; }
.channel-permission { margin-top: 4px; font-size: 11px; font-weight: 700; }
.channel-permission.ok { color: var(--success-text); }
.channel-permission.blocked { color: var(--danger); }
.channel-empty { border: 1px dashed var(--line); border-radius: 4px; padding: 14px; color: var(--muted); font-size: 11px; text-align: center; background: var(--surface-2); }

/* ── Salary management ──────────────────────── */
.salary-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.role-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.role-search-wrap { width: min(360px, 100%); }
.role-sort-wrap { display: inline-flex; align-items: center; gap: 8px; }
.role-search-meta { color: var(--muted); font-size: 11px; margin: -4px 0 10px; }
.salary-table th, .salary-table td { padding-top: 10px; padding-bottom: 10px; }
.salary-role-cell { min-width: 230px; }
.salary-role-line { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.salary-current-cell strong { font-size: 13px; color: var(--ink); font-weight: 700; }
.salary-input-cell { min-width: 210px; }
.salary-actions-cell { min-width: 130px; }
.salary-state { display: inline-flex; align-items: center; border-radius: 20px; padding: 2px 9px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.salary-state.configured { background: var(--gold-tint); color: var(--gold-deep); border: 1px solid var(--gold-border); }
.salary-state.unconfigured { background: var(--line-2); color: var(--muted); border: 1px solid var(--line); }
.salary-meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.salary-input-wrap { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 0 11px; width: min(100%, 270px); transition: border-color .1s; }
.salary-input-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(196,152,31,.18); }
.salary-input-wrap span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; flex-shrink: 0; }
.salary-input-wrap input { border: 0; outline: none; background: transparent; width: 100%; padding: 8px 0; font-size: 13px; color: var(--ink); } /* Increased font size slightly */
.salary-actions { display: flex; gap: 5px; align-items: center; }
.salary-actions button { padding: 7px 12px; }

/* ── Pills ──────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--gold-border); border-radius: 20px; padding: 3px 9px; background: var(--gold-tint); font-size: 11px; font-weight: 600; color: var(--gold-deep); }
.pill.neutral { border-color: var(--line); background: var(--surface-2); color: var(--ink-2); }

/* ── Bot settings ───────────────────────────── */
.settings-layout { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(320px, 1.2fr); gap: 14px; align-items: start; }
.settings-panel { border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; background: var(--surface); box-shadow: var(--shadow-xs); } /* Increased padding */
.panel-title { margin: 0 0 12px; font-size: 14px; font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.settings-form { display: grid; gap: 12px; }
.settings-field { display: grid; gap: 7px; } /* Increased gap */
.settings-field span, .settings-label { font-size: 9px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.settings-field input, .settings-field textarea { width: 100%; }
.finance-action-grid { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.government-account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.government-account { border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-xs); padding: 15px 16px; min-width: 0; }
.government-account.printing { border-left-color: var(--danger); }
.government-account.treasury { border-left-color: var(--gold-bright); } /* Brighter gold for treasury */
.government-account.ministry { border-left-color: #345f8a; }
.government-account.department { border-left-color: #478057; }
.government-account-top { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.government-account h4 { margin: 4px 0 0; font-size: 14px; line-height: 1.3; color: var(--ink); }
.account-role { font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.government-account-balance { margin-top: 14px; font-size: 24px; font-weight: 800; color: var(--ink); line-height: 1; }
.government-account-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: 11px; }
.account-url, .table-link { color: var(--gold); overflow-wrap: anywhere; text-decoration: none; } /* Lighter gold for links */
.account-url { display: block; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.account-url.compact { margin-top: 5px; padding-top: 0; border-top: 0; font-size: 10px; }
.account-url:hover, .table-link:hover { color: var(--ink); text-decoration: underline; }
.nested-fund-heading { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.nested-fund-list { display: grid; gap: 8px; margin-top: 8px; }
.nested-fund-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface-2); padding: 10px 11px; }
.nested-fund-main { min-width: 0; display: grid; gap: 2px; }
.nested-fund-main strong { font-size: 12px; color: var(--ink); line-height: 1.25; }
.nested-fund-side { display: grid; justify-items: end; gap: 4px; font-size: 11px; color: var(--muted); }
.nested-fund-side span { color: var(--ink); font-weight: 800; }
.nested-fund-row .planner-button-row { grid-column: 1 / -1; margin: 0; }
.fund-empty { margin-top: 8px; border: 1px dashed var(--line); border-radius: var(--r); padding: 10px 11px; color: var(--muted); font-size: 11px; background: var(--surface-2); }
.orphan-fund-panel { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: var(--surface-2); }
.orphan-fund-panel h4 { margin: 0 0 8px; font-size: 13px; }
.funding-meter { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: var(--surface-2); }
.funding-meter-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.funding-track { margin-top: 10px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line); }
.funding-fill { height: 100%; border-radius: inherit; background: var(--success-text); transition: width .2s ease; }
.funding-fill.warning { background: var(--danger); }

/* Funding block is no longer a card — it lives inline inside the parent
   official-section so the page reads as one continuous document. The only
   visual signal is the bar fill color, which follows traditional fiscal
   signaling: green (healthy/surplus) → gold (warning) → orange (low) →
   red (critical). No off-palette blues. */
.payroll-funding-block {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
}
.payroll-funding-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}
.payroll-funding-head-text { min-width: 0; flex: 1 1 auto; }
.payroll-funding-head h3 {
  margin: 2px 0 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.payroll-funding-subtitle {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .02em;
}
/* Percentage now lives in the heading row as a large tabular number, not
   floating inside the bar. Color matches the tier so the eye links the
   number to the bar without needing a coloured chip. */
.payroll-funding-pct {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  align-self: flex-start;
}
.payroll-funding-pct-sign {
  font-size: 14px;
  font-weight: 700;
  margin-left: 2px;
  opacity: .85;
}
.payroll-funding-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line-2, #e6e9ee);
  margin: 8px 0 12px 0;
}
.payroll-funding-fill {
  position: relative;
  height: 100%;
  border-radius: inherit;
  transition: width .25s ease, background-color .25s ease;
  background: var(--success-text, #2f7a40);
}
.tier-funded   .payroll-funding-fill { background: var(--success-text, #2f7a40); }
.tier-warning  .payroll-funding-fill { background: #c98e10; }
.tier-low      .payroll-funding-fill { background: #d97412; }
.tier-critical .payroll-funding-fill { background: var(--danger, #b9352d); }
/* Two-segment fill: when the fund covers next cycle with surplus left over,
   the right-hand portion of the fill is overlaid in a paler green so the
   bar visually splits into "committed for next release" + "excess reserves".
   The 1px white seam between the segments keeps the boundary readable on
   small displays without needing a separate divider element. */
.payroll-funding-fill-excess {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  background: #b9d8a4;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, .55);
  transition: width .25s ease;
}
/* Legend swatches reuse the bar colors so meta-row labels carry the same
   color identity as the segment they describe. Inline-block dot, rendered
   before the label text. */
.payroll-funding-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: 1px;
}
.swatch-committed { background: var(--success-text, #2f7a40); }
.swatch-excess    { background: #b9d8a4; }
.payroll-funding-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.payroll-funding-meta > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.payroll-funding-meta strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.payroll-funding-note { margin-top: 8px; font-size: 11px; }

/* Hairline divider between the inline blocks (funding → schedule → roles).
   Replaces the old nested-card borders with a single horizontal rule that
   keeps the sections distinct without boxing them in. */
.payroll-section-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 14px 0;
  height: 0;
}

@media (max-width: 720px) {
  .payroll-funding-meta { grid-template-columns: 1fr; gap: 6px; }
  .payroll-funding-head h3 { font-size: 14px; }
  .payroll-funding-pct { font-size: 20px; }
  .payroll-section-divider { margin: 10px 0; }
}

.auth-method-picker {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-method-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.auth-method-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: var(--surface);
  width: fit-content;
  gap: 2px;
}
.auth-method-pill {
  border: none;
  background: transparent;
  color: var(--ink-2);
  padding: 7px 18px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.auth-method-pill:hover { background: var(--gold-pale); color: var(--gold-deep); }
.auth-method-pill.active {
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow-xs);
}
.auth-method-pill.active:hover { background: var(--ink-2); color: var(--surface); }

.account-history-card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  background: var(--surface);
}

.treasury-review-card {
  max-width: 580px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.treasury-review-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
}
.tr-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
  font-size: 13px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 6px;
}
.tr-row:last-child { border-bottom: none; padding-bottom: 0; }
.tr-key {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}
.tr-val {
  color: var(--ink);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.tr-val.amount { font-size: 16px; color: var(--gold-deep); }
.tr-val.missing { color: var(--danger); font-style: italic; font-weight: 500; }

.treasury-review-auth {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.treasury-review-credline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--gold-pale);
  color: var(--ink);
  border: 1px solid var(--gold-border);
  border-radius: var(--r);
  font-family: var(--mono);
  font-size: 12px;
}
.cred-tag {
  font-weight: 700;
  letter-spacing: 0.06em;
  background: var(--gold);
  color: var(--ink);
  padding: 3px 8px;
  border-radius: 4px;
}
.cred-preview { letter-spacing: 0.04em; color: var(--ink-2); }
.cred-preview.missing { color: var(--danger); }

.alert-ribbon.danger {
  background: var(--danger-pale);
  border-color: var(--danger-border);
  color: var(--danger);
}
.alert-ribbon.danger ul { margin: 6px 0 0 18px; padding: 0; }
.alert-ribbon.danger li { font-size: 12px; }

.armed-btn {
  position: relative;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}
.armed-btn .armed-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(255, 255, 255, 0.18);
  transition: width .08s linear;
  pointer-events: none;
}
.armed-btn .armed-label {
  position: relative;
  z-index: 1;
}
.armed-btn.ready {
  background: var(--success-text);
  color: var(--surface);
  border-color: var(--success-text);
}

.account-combobox {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.combobox-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.combobox-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.combobox-input {
  flex: 1;
  width: 100%;
  padding: 9px 32px 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.combobox-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-pale);
}
.combobox-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 999px;
}
.combobox-clear:hover { background: var(--line); color: var(--ink); }
.combobox-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.combobox-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease;
  font-size: 12px;
}
.combobox-option:hover {
  background: var(--gold-pale);
  border-color: var(--gold-border);
}
.combobox-option-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.combobox-option-main strong {
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combobox-empty {
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.combobox-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--gold-border);
  background: linear-gradient(180deg, var(--gold-pale), var(--surface));
  border-radius: var(--r);
}
.combobox-selected-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.combobox-selected-info strong {
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.my-banking-transfer-panel {
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid var(--gold-border);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--gold-pale) 0%, var(--surface) 100%);
  position: relative;
  z-index: 1;
}
.my-banking-transfer-panel .inline-transfer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.passkey-status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
}
.passkey-status-line .cred-tag {
  background: var(--gold);
  color: #1a1000;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}
@media (max-width: 720px) {
  .tx-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ── Medals ─────────────────────────────────────
 * Compact, scannable registry. The old design stacked one huge bordered
 * row per medal (82px+ artwork, oversized rank panel) which made the page
 * very tall and hard to scan. This is a responsive card grid: small
 * emblem, name, precedence chip, short description, and issuance counts —
 * every card links to that medal's recipients page. */
.medal-search-field { display: flex; align-items: center; }
.medal-search-field input {
  min-width: 220px;
  padding: 8px 12px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
.medal-search-field input:focus {
  outline: 2px solid var(--gold-pale);
  border-color: var(--gold-border);
}

.medal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.medal-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.medal-card:hover {
  border-color: var(--gold-border);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.medal-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.medal-card-emblem {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
}
.medal-card-emblem img { width: 44px; height: 44px; object-fit: contain; }
.medal-card-emblem span { font-size: 26px; color: var(--gold); line-height: 1; }
.medal-card-body { min-width: 0; }
.medal-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.medal-card-head h3 { margin: 0; font-size: 14px; font-weight: 800; line-height: 1.25; color: var(--ink); }
.medal-rank-chip {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}
.medal-card-desc {
  margin: 6px 0 10px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.medal-card-stats { display: flex; gap: 14px; font-size: 11px; color: var(--muted); }
.medal-card-stats strong { color: var(--ink); font-weight: 800; }

/* Detail page hero emblem (reuses the .official-seal frame). */
.medal-detail-seal { background: #ffffff; }
.medal-detail-seal img { width: 60px; height: 60px; object-fit: contain; }
.medal-detail-seal .medal-detail-fallback { font-size: 34px; color: var(--gold); }

.emoji-icon { width: 18px; height: 18px; vertical-align: middle; object-fit: contain; margin-right: 3px; }
.table-medal-icon { width: 18px; height: 18px; vertical-align: text-bottom; object-fit: contain; margin-right: 4px; }

/* ── Toasts ─────────────────────────────────── */
.toast-stack { position: fixed; right: 16px; top: calc(var(--masthead-h) + 12px); z-index: 100000; width: min(340px, calc(100vw - 32px)); display: grid; gap: 8px; pointer-events: none; }
.toast { background: var(--surface); color: var(--ink); border: 1px solid var(--gold-border); border-left: 4px solid var(--gold); border-radius: var(--r); padding: 12px 38px 14px 14px; box-shadow: var(--shadow-md); position: relative; overflow: hidden; animation: toast-in .18s ease-out; pointer-events: auto; }
.toast strong { display: block; font-size: 13px; margin-bottom: 3px; font-weight: 900; color: var(--gold-deep); }
.toast > div:not(.life) { font-size: 12px; color: var(--ink-2); line-height: 1.4; }
.toast button { position: absolute; right: 8px; top: 8px; background: var(--gold-pale); border: 1px solid var(--gold-border); border-radius: 4px; padding: 2px 7px; box-shadow: none; font-size: 13px; color: var(--ink-2); font-weight: 700; }
.toast button:hover { background: var(--gold-tint); color: var(--ink); }
.toast .life { position: absolute; bottom: 0; left: 0; height: 2px; background: var(--gold); width: 100%; transform-origin: left center; animation: toast-life linear forwards; }

.danger-btn { background: var(--danger); color: #fff; border: 1px solid #8b1a1a; }
.danger-btn:hover { background: #c93030; box-shadow: 0 3px 10px rgba(180,36,36,.25); }

/* ── Modal ──────────────────────────────────── */
.modal-root { position: fixed; inset: 0; display: grid; place-items: center; z-index: 420; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10,8,5,.68); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: min(480px, calc(100vw - 32px)); border-radius: 8px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-lg); padding: 26px 28px; } /* No change, looks good */
.modal-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--muted); box-shadow: none; font-size: 18px; line-height: 1; border-radius: 50%; } /* Larger, rounder close button */
.modal-close:hover { background: var(--surface-2); box-shadow: var(--shadow-xs); color: var(--ink); }
.modal-kicker { font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--danger); margin-bottom: 4px; }
.modal-card h3 { margin: 3px 0 12px; font-size: 20px; font-weight: 800; color: var(--ink); }
.modal-card p { margin: 0 0 8px; color: var(--muted); font-size: 12px; line-height: 1.6; }
/* Base ribbon is POSITIVE (success/confirmation, e.g. a completed donation) —
 * green, not red. The .danger modifier below restores red for errors. */
.alert-ribbon { margin: 12px 0; border: 1px solid #cce0c8; background: #e8f1ea; color: #1f5b3b; border-radius: var(--r); padding: 10px 14px; font-weight: 700; font-size: 12px; }
.modal-field { display: grid; gap: 6px; margin-top: 12px; }
.modal-field span { font-size: 9px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.auth-code-box { border-radius: 4px; border: 1px dashed var(--gold-border); background: var(--gold-pale); color: var(--gold-deep); padding: 12px 18px; font-size: 16px; font-weight: 800; letter-spacing: .15em; text-align: center; font-family: ui-monospace, monospace; } /* Larger code box */
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.armed-btn { position: relative; overflow: hidden; min-width: 210px; }
.armed-btn:disabled { cursor: not-allowed; opacity: 1; }
.armed-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255,255,255,.15); }
.armed-label { position: relative; z-index: 1; }
.armed-btn.ready .armed-fill { background: rgba(255,255,255,.10); }

/* ── Profile modal ──────────────────────────── */
.profile-modal { width: min(760px, calc(100vw - 32px)); padding: 24px; max-height: calc(100vh - 40px); overflow: auto; }
.profile-modal .modal-kicker { color: var(--gold); } /* Lighter gold for profile kicker */
.profile-head { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 18px; align-items: center; padding-right: 34px; }
.profile-avatar { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm); background: var(--line-2); }
.profile-title { min-width: 0; }
.profile-title h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; line-height: 1.18; overflow-wrap: anywhere; }
.profile-systemid { color: var(--gold-deep); margin-bottom: 2px; }
.profile-subtitle { color: var(--muted); font-family: var(--sans); font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }
.profile-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.profile-metric { border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; background: var(--surface); min-width: 0; }
.profile-metric span, .profile-details span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.profile-metric strong { display: block; margin-top: 5px; font-size: 19px; color: var(--ink); font-weight: 800; line-height: 1.15; letter-spacing: -.01em; font-variant-numeric: tabular-nums lining-nums; overflow-wrap: anywhere; }
.profile-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.profile-details > div { border: 1px solid var(--line-2); border-radius: 5px; padding: 10px 12px; min-width: 0; }
.profile-details strong, .profile-details code { display: inline-block; margin-top: 4px; max-width: 100%; overflow-wrap: anywhere; }
.profile-section { margin-top: 16px; }
.profile-section h4 { margin: 0 0 8px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.profile-chip-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.profile-medal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.profile-medal { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; align-items: center; border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 6px; padding: 11px 12px; background: #fff; min-height: 74px; }
.profile-medal-emblem { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid var(--gold-border); border-radius: 6px; background: var(--gold-pale); }
.profile-medal-icon { width: 42px; height: 42px; object-fit: contain; display: block; }
.profile-medal-body { min-width: 0; }
.profile-medal strong { display: block; font-size: 13px; line-height: 1.25; color: var(--ink); overflow-wrap: anywhere; }
.profile-medal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; margin-top: 7px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.profile-medal-meta span, .profile-medal-meta code { display: inline-flex; align-items: center; min-height: 18px; max-width: 100%; overflow-wrap: anywhere; }
.profile-medal-meta code { border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; background: var(--surface-2); color: var(--ink-2); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-transform: none; }
.profile-medal-count { border: 1px solid var(--gold-border); border-radius: 4px; padding: 1px 6px; background: var(--gold-tint); color: var(--gold-deep); }
.profile-page-head { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 18px; align-items: center; }
.profile-page-head h2 { margin: 4px 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.profile-page-head p { color: var(--ink-2); line-height: 1.55; max-width: 760px; }
.profile-display-heading { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-display-edit-btn { display: inline-grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; padding: 0; border: 2px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); cursor: pointer; transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, transform 120ms ease; }
.profile-display-edit-btn:hover { background: var(--totemia-green, var(--ink)); color: #fff8e6; border-color: var(--totemia-green, var(--ink)); }
.profile-display-edit-btn:active { transform: scale(0.96); }
@media (prefers-reduced-motion: reduce) {
  .profile-display-edit-btn { transition: none; }
  .profile-display-edit-btn:active { transform: none; }
}
.profile-display-edit-icon {
  display: block;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask-image: url(/assets/icons/edit-pen.svg);
  mask-image: url(/assets/icons/edit-pen.svg);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.profile-display-edit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0; }
.profile-display-edit input { width: min(320px, 100%); height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; font: inherit; font-weight: 800; color: var(--ink); }
.profile-page-avatar { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm); }
.profile-avatar-fallback { background: var(--gold-tint); color: var(--gold-deep); display: grid; place-items: center; font-weight: 800; }
.profile-page-avatar.profile-avatar-fallback { font-size: 46px; letter-spacing: -.02em; }
/* Bold brand bar above the profile head, colored by the member's party/religion. */
.profile-brand-bar { height: 6px; border-radius: 999px; margin: 0 0 16px; }
/* Flat status treatment for the bank-status metric — color on the value, no pill. */
.profile-status.ok { color: #155642; }
.profile-status.bad { color: #9a241d; }
.profile-status.muted { color: var(--muted); }
/* Role-play affiliation chips: emblem + accent-colored name + left accent bar. */
.profile-rp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.profile-rp-card { display: flex; align-items: center; gap: 12px; min-width: 0; border: 1px solid var(--line-2); border-left: 4px solid var(--rp-accent, var(--line)); border-radius: 6px; padding: 12px 14px; background: var(--surface); }
.profile-rp-emblem { width: 42px; height: 42px; flex-shrink: 0; border-radius: 9px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.profile-rp-emblem-fallback { display: grid; place-items: center; font-size: 18px; font-weight: 900; text-transform: uppercase; color: var(--rp-accent, var(--muted)); background: color-mix(in srgb, var(--rp-accent, var(--muted)) 14%, #fff); }
.profile-rp-text { display: grid; min-width: 0; }
.profile-rp-label { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.profile-rp-value { margin-top: 4px; font-size: 15px; font-weight: 800; color: var(--ink); line-height: 1.2; overflow-wrap: anywhere; }
.profile-rp-brand.has-accent .profile-rp-value { color: var(--rp-accent); }
@media (max-width: 720px) { .profile-rp-grid { grid-template-columns: 1fr; } }
.empty-panel { border: 1px dashed var(--line); border-radius: 5px; padding: 14px; color: var(--muted); background: var(--surface-2); font-size: 12px; }

.password-meter {
  margin: 10px 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
  background: var(--surface-2);
}

.password-meter-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}

.password-meter-track {
  height: 6px;
  background: var(--line-2);
  border-radius: 999px;
  overflow: hidden;
}

.password-meter-fill {
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width .2s ease;
}

.password-meter-list {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.password-meter-list .ok {
  color: var(--ink);
  font-weight: 700;
}

.password-meter.good { border-color: rgba(22,163,74,.35); background: rgba(22,163,74,.08); }
.password-meter.good .password-meter-fill { background: #16a34a; }
.password-meter.warn { border-color: rgba(202,138,4,.35); background: rgba(202,138,4,.08); }
.password-meter.warn .password-meter-fill { background: #ca8a04; }
.password-meter.bad { border-color: var(--danger-border); background: var(--danger-pale); }
.password-meter.bad .password-meter-fill { background: #dc2626; }

/* ── No-sidebar (sign-in / standalone pages) ── */
body.no-sidebar .shell { grid-template-columns: 1fr; }
body.no-sidebar .sidebar { display: none; }
body.no-sidebar .content { height: auto; min-height: calc(100vh - var(--masthead-h)); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; background: var(--bg); }

/* ── Standalone sign-in card ─────────────────── */
.signin-wrap { width: 100%; max-width: 420px; }
.signin-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 40px 40px 36px; }
.signin-crest { font-size: 30px; color: var(--gold); margin-bottom: 12px; text-align: center; }
.signin-title { font-size: 22px; font-weight: 800; letter-spacing: .02em; color: var(--ink); text-align: center; margin: 0 0 6px; line-height: 1.2; }
.signin-sub { font-size: 12px; color: var(--muted); text-align: center; margin: 0 0 28px; line-height: 1.5; }
.signin-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.signin-field label { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-deep); }
.signin-field input { border: 1px solid var(--line); border-radius: var(--r); padding: 11px 14px; font-size: 14px; font-family: inherit; background: var(--surface-2); color: var(--ink); transition: border-color .15s; width: 100%; }
.signin-field input:focus { outline: none; border-color: var(--gold); background: #fff; }
.signin-btn { width: 100%; padding: 12px; background: var(--gold); border: none; border-radius: var(--r); font-size: 14px; font-weight: 800; letter-spacing: .04em; color: #fff; cursor: pointer; margin-top: 8px; transition: background .15s, transform .1s; }
.signin-btn:hover { background: var(--gold-bright); }
.signin-btn:active { transform: scale(.98); }
.signin-btn:disabled { opacity: .6; cursor: not-allowed; }

.acct-tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; padding: 10px 18px; font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; letter-spacing: .04em; text-transform: uppercase; transition: color .15s, border-color .15s; }
.acct-tab:hover { color: var(--ink); }
.acct-tab.active { color: var(--gold-deep); border-bottom-color: var(--gold); }
.acct-page-header { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.acct-avatar { width: 60px; height: 60px; border-radius: 50%; background: var(--gold-tint); border: 2px solid var(--gold-border); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; color: var(--gold-deep); flex-shrink: 0; object-fit: cover; }
.acct-identity { flex: 1; min-width: 0; }
.acct-name { font-size: 18px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.acct-meta { font-size: 11px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acct-role-badge { font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: 3px 8px; border-radius: 3px; background: var(--gold-tint); color: var(--gold-deep); border: 1px solid var(--gold-border); }
.acct-role-badge.dev { background: #f0fdf4; color: #15803d; border-color: #86efac; }
.acct-role-badge.admin { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.acct-role-badge.mof { background: #fdf4ff; color: #a21caf; border-color: #f0abfc; }

/* ── Profile save button ────────────────────── */
.profile-save-btn { background: var(--gold); color: #1a1000; border: 1px solid var(--gold-deep); border-radius: var(--r); padding: 10px 22px; font-size: 13px; font-weight: 800; letter-spacing: .03em; cursor: pointer; transition: all .15s; width: 100%; }
.profile-save-btn:hover { background: var(--gold-bright); }
.profile-save-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Profile picture upload area ────────────── */
.profile-upload-area { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border: 1.5px dashed var(--line); border-radius: var(--r); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.profile-upload-area:hover { border-color: var(--gold); background: var(--gold-pale); }
.profile-upload-preview { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--gold-tint); border: 2px solid var(--gold-border); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; color: var(--gold-deep); }
.profile-upload-label { display: flex; flex-direction: column; gap: 3px; }
.profile-upload-label span:first-child { font-size: 13px; font-weight: 700; color: var(--ink); }
.profile-upload-hint { font-size: 11px; color: var(--muted); }

/* ── Passkey cards ──────────────────────────── */
.passkey-actions { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.passkey-list { display: grid; gap: 8px; margin-top: 4px; }
.passkey-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); transition: border-color .15s; }
.passkey-card.revoked { opacity: .55; }
.passkey-card-body { flex: 1; min-width: 0; display: grid; gap: 5px; }
.passkey-card-id { font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); overflow-wrap: anywhere; }
.passkey-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.passkey-delete-btn { background: none; border: 1px solid var(--danger-border); border-radius: var(--r); color: var(--danger); padding: 6px 10px; font-size: 14px; cursor: pointer; flex-shrink: 0; transition: background .15s, color .15s; line-height: 1; }
.passkey-delete-btn:hover { background: var(--danger-pale); }
.passkey-delete-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Discord profile card ───────────────────── */
.discord-profile-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); margin-bottom: 4px; }
.discord-profile-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid var(--line); }
.discord-avatar-fallback { background: #5865f2; color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 800; }
.discord-profile-info { min-width: 0; }
.discord-profile-name { font-size: 15px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.discord-profile-username { font-size: 12px; color: var(--muted); margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.discord-profile-id { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

#chart-banking-history { min-height: 320px; }
.tx-row { display: grid; grid-template-columns: 1fr 100px 120px 90px; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); align-items: center; font-size: 12px; transition: background .1s; }
.tx-row:last-child { border-bottom: none; }
.tx-row:hover { background: var(--surface-2); }
.tx-type { display: inline-block; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; padding: 3px 7px; border-radius: 3px; background: var(--line-2); color: var(--muted); }
.tx-type.in { background: #f0fdf4; color: #15803d; }
.tx-type.out { background: var(--danger-pale); color: var(--danger); }
.tx-amount { font-weight: 700; font-family: var(--sans); font-variant-numeric: tabular-nums lining-nums; font-feature-settings: var(--num-feat); font-size: 12px; letter-spacing: -0.01em; }
.tx-amount.in { color: #15803d; }
.tx-amount.out { color: var(--danger); }

/* ── Section count badge ─────────────────────── */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-count { font-size: 10px; font-weight: 700; color: var(--muted); background: var(--line-2); border-radius: 20px; padding: 3px 10px; }

/* ── Animations ─────────────────────────────── */
@keyframes toast-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateX(14px); } }
@keyframes toast-life { from { transform: scaleX(1); } to { transform: scaleX(0); } } /* Life bar animation */

/* ── Responsive ─────────────────────────────── */
@media (max-width: 1100px) { .planner-layout, .planner-summary-grid, .channel-settings-grid, .settings-layout, .finance-action-grid { grid-template-columns: 1fr; } }
@media (max-width: 980px) { .shell { grid-template-columns: 1fr; } .content { height: auto; max-height: none; } .table-shell { max-width: 100%; } .modal-actions { flex-direction: column-reverse; } .cal-day { min-height: 32px; padding: 6px 0; } .profile-metrics, .profile-details, .profile-medal-grid { grid-template-columns: 1fr; } .profile-head { grid-template-columns: 64px minmax(0, 1fr); } .profile-avatar { width: 64px; height: 64px; } }

/* ── Chart containers ───────────────────────── */
.chart-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); margin-bottom: 14px; }
.chart-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; box-shadow: var(--shadow-sm); }
.chart-block h3 { margin: 0 0 16px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); padding-bottom: 11px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 8px; } /* Slightly larger font */
.chart-block h3::before { content: ''; display: inline-block; width: 3px; height: 13px; background: var(--gold); border-radius: 2px; flex-shrink: 0; }
.chart-area { min-height: 240px; }
.chart-area-tall { min-height: 320px; }
.chart-placeholder { min-height: 240px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; border: 1px dashed var(--line); border-radius: 4px; background: var(--surface-2); }

/* ── MonoFont overrides ─────────────────────── */
code, .mono { font-family: var(--mono); font-size: 0.9em; }

/* ── Breadcrumb nav bar ─────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.breadcrumb-sep { color: var(--muted); } /* More subtle separator */
.breadcrumb strong { color: var(--ink); font-weight: 700; }

/* ── KPI strip ──────────────────────────────── */
.kpi-strip { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 14px; }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow-xs); display: flex; flex-direction: column; gap: 4px; }
.kpi-card .kpi-label { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.kpi-card .kpi-value { font-size: 22px; font-weight: 800; color: var(--ink); line-height: 1.1; letter-spacing: -.01em; }
.kpi-card .kpi-trend { font-size: 10px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.kpi-card .kpi-trend.up { color: #22c55e; }
.kpi-card .kpi-trend.down { color: var(--danger); }

/* ── 2026 Workflow Console Overhaul ───────── */
:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --line: #d3dbe3;
  --line-2: #e3e9ef;
  --ink: #0f1720;
  --ink-2: #1f2a37;
  --muted: #5a6a7b;
  --gold: #be8a12;
  --gold-deep: #8c6106;
  --gold-bright: #d7a438;
  --gold-border: #d6be7a;
  --gold-tint: #fff4d8;
}
.masthead {
  background: linear-gradient(90deg, #121820 0%, #182131 55%, #1a2432 100%);
  border-bottom: 1px solid #304357;
}
.masthead-title { letter-spacing: .03em; }
.shell { display: block; min-height: calc(100vh - 82px); }
.sidebar { display: none; }
.global-nav {
  background: #ffffff;
  border-bottom: 1px solid #d8e0ea;
  box-shadow: 0 8px 22px rgba(20, 31, 48, 0.05);
  padding: 0 22px;
}
.portal-nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}
.portal-nav-link {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #465a70;
  font-weight: 800;
  font-size: 12px;
  padding: 14px 11px 12px;
  white-space: nowrap;
}
.portal-nav-link:hover {
  color: #0e2d2a;
  background: #f4f7f9;
}
.portal-nav-link.active {
  color: #0c3d34;
  border-bottom-color: #c99513;
}
.portal-nav-link.personal {
  color: #1a6558;
}
.guild {
  background: #162438;
  border-color: #2b3f57;
  color: #e2ecf7;
}
.guild .name { color: #edf4ff; }
.guild .meta { color: #9eb0c6; }
.guild.active {
  border-left: 3px solid #35b29b;
  border-color: #35b29b;
  background: #113034;
}
.guild:hover { background: #1d2e47; border-color: #3a5f8c; transform: none; }
.runtime-meta { color: #bed0e4; }
.content {
  padding: 16px 20px 28px;
  background: radial-gradient(circle at 50% -10%, rgba(250, 214, 117, .14), transparent 360px), var(--bg);
  max-width: 1180px;
  margin: 0 auto;
  height: auto;
  overflow: visible;
}
@media (max-width: 720px) {
  .content { padding: 12px 12px 20px; }
}
.page-banner {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.block {
  border-radius: 8px;
  border-color: #d5dde6;
  box-shadow: none;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.block h3 { font-size: 11px; color: #40566f; }
.portal-hero {
  background: #ffffff;
  border: 1px solid #d9e1ec;
  border-radius: 12px;
  padding: 22px 26px;
  margin-bottom: 14px;
  /* Removed 60px-blur drop shadow — the page now reads as a printed document
     rather than a stack of floating cards. */
}
.portal-hero.compact { padding: 16px 20px; }
@media (max-width: 720px) {
  .portal-hero { padding: 16px 16px; border-radius: 10px; }
  .portal-hero.compact { padding: 12px 14px; }
}
.portal-kicker {
  color: #64768c;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.portal-hero h1 {
  margin: 10px 0 10px;
  font-size: 38px;
  line-height: 1.08;
  color: #07111f;
}
.portal-hero p {
  max-width: 680px;
  margin: 0;
  color: #66778b;
  font-size: 16px;
  line-height: 1.55;
}
.portal-search-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.portal-section {
  background: #ffffff;
  border: 1px solid #d9e1ec;
  border-radius: 18px;
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: 0 14px 42px rgba(25, 35, 48, .06);
}
.portal-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.portal-section-head h2 {
  margin: 6px 0 0;
  font-size: 24px;
}
.portal-section-head span { color: #6c7f94; font-weight: 800; }
.portal-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.portal-card {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 14px;
  border: 1px solid #dfe6ef;
  border-radius: 14px;
  padding: 16px;
  background: #fff;
}
.portal-card.single { grid-template-columns: 72px 1fr; }
.portal-card-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #f3f7fb;
  border: 1px solid #dbe4ee;
  color: #1c4d46;
  font-weight: 900;
}
.portal-card h3 { margin: 0 0 5px; font-size: 18px; }
.portal-card p { margin: 0 0 10px; color: #66778b; line-height: 1.4; }
.text-link {
  border: 0;
  background: transparent;
  color: #166252;
  font-weight: 900;
  padding: 0;
  text-decoration: none;
}
.portal-anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-decoration: none;
  color: var(--ink-2);
}
.code-value { font-size: 20px !important; }
.table-shell { border-radius: 8px; }
.table-shell thead th { background: #f2f6fa; }
@media (max-width: 1100px) {
  .shell { display: block; }
  .content { height: auto; max-height: none; padding: 18px; }
  .portal-hero { padding: 28px 22px; }
  .portal-hero h1 { font-size: 30px; }
}


/* ── Password visibility toggle ───────────────── */
.password-visibility-wrap {
  position: relative;
  display: block;
  width: 100%;
}

.password-visibility-wrap > input {
  display: block;
  width: 100%;
  padding-right: 42px !important;
}

.password-visibility-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  min-width: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.password-visibility-toggle:hover,
.password-visibility-toggle:focus {
  background: var(--gold-pale);
  color: var(--ink);
  box-shadow: none;
  transform: translateY(-50%);
}

.password-visibility-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}


/* ── Totemia account activity status ─────────── */
.activity-status-card {
  min-height: 66px;
}

.activity-card-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.activity-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink);
}

.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(255,255,255,.85);
}

.activity-online .activity-dot {
  background: #16a34a;
  box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 0 9px rgba(22,163,74,.65);
}

.activity-idle .activity-dot {
  background: #ca8a04;
  box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 0 9px rgba(202,138,4,.55);
}

.activity-offline .activity-dot {
  background: #dc2626;
}

.activity-last-seen {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

/* ──────────────────────────────────────────────────────────────────────────
 * Narrow-screen layout (≤480px). Layout-only — every brand color stays.
 * The portal already collapses sidebar + multi-column grids at 980px;
 * these rules tighten the remaining mobile surfaces:
 *   • Tables: scroll horizontally inside .table-shell so legal ledger rows
 *     stay readable instead of compressing past legibility.
 *   • Finance / transfer / tax-fund forms: single column, full-width inputs.
 *   • Modal actions: column layout with primary action at bottom.
 *   • Profile head: tighter avatar + identity stack.
 *   • Calendar grid: smaller day cells.
 *   • Masthead: hide the username text, keep avatar + caret.
 * ────────────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .table-shell {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .table-shell table {
    min-width: 560px;
  }

  .finance-action-grid,
  .planner-layout,
  .planner-summary-grid,
  .channel-settings-grid,
  .settings-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-actions > button,
  .modal-actions > .btn {
    width: 100%;
  }

  .modal,
  .modal-card {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    padding: 16px;
  }

  .profile-head {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
  }
  .profile-avatar {
    width: 56px;
    height: 56px;
  }

  .cal-day {
    min-height: 28px;
    padding: 4px 0;
    font-size: 12px;
  }

  .masthead {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Form field stacks for transfer / tax-fund / mint / burn.
   * font-size: 16px is a deliberate iOS workaround — Mobile Safari zooms the
   * page when the focused input has a font-size below 16px, and that zoom
   * traps the user mid-form because the back-zoom gesture isn't obvious.
   * The slightly larger field is also easier to tap. */
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  select,
  textarea {
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
  }

  /* Apple HIG and Android Material both target a 44–48px tap region. The
   * desktop button sizing (font 12px + 9px padding ≈ 30px) is too small for
   * thumbs; bump it on phone widths only so we don't bloat the desk UI. */
  button,
  .btn {
    min-height: 44px;
  }
  .cal-day {
    min-height: 38px;
  }

  /* Reason / fund-purpose pickers stack vertically on phone widths */
  .tax-fund-reason-grid,
  .reason-picker-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Toast stack pinned to the bottom on mobile so it doesn't cover the
   * masthead account button. The safe-area inset accounts for the iOS home
   * indicator so toasts don't sit underneath it. */
  .toast-stack {
    bottom: max(8px, env(safe-area-inset-bottom, 8px));
    left: max(8px, env(safe-area-inset-left, 8px));
    right: max(8px, env(safe-area-inset-right, 8px));
    top: auto;
  }
  .toast {
    max-width: 100%;
  }
}

/* iOS double-tap-to-zoom delay and the default grey tap flash both feel
 * broken on a touch-first portal — kill the flash and let the browser keep
 * the focus ring for keyboard users. Applied globally because the portal is
 * never displayed in a mobile-emulator-on-desktop scenario where preserving
 * the tap flash would matter. */
button,
a,
.btn,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

/* Honor the iPhone notch / dynamic-island safe areas on the masthead so the
 * crest and account button never collide with system UI when the page is
 * pinned to the home screen as a PWA. */
.masthead {
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: max(16px, env(safe-area-inset-right, 16px));
}

/* Medal management modal — visually identical to the website-role
 * selector: vertical list, group headings, status badge on the right.
 * The only domain-specific bits are the medal thumbnail (replacing the
 * role color dot) and a +/− counter (replacing the role checkbox). */
.medal-manage-modal { max-width: 640px; width: min(640px, 96vw); max-height: 92vh; overflow: hidden; display: flex; flex-direction: column; }
.medal-manage-selector { max-height: 62vh; overflow-y: auto; margin-top: 12px; }
.medal-candidate-row { gap: 12px !important; }
.medal-candidate-row.changed { box-shadow: inset 3px 0 0 var(--gold, #c4981f); }
.medal-candidate-row .salary-candidate-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.medal-candidate-row .salary-candidate-name small { font-weight: 500; color: var(--ink-2, #525763); font-size: 11px; }
.medal-candidate-thumb { width: 32px; height: 32px; display: grid; place-items: center; flex-shrink: 0; }
.medal-candidate-thumb img { width: 100%; height: 100%; object-fit: contain; }
.medal-candidate-thumb-fallback { width: 100%; height: 100%; border-radius: 50%; background: var(--gold-tint, #f9efcf); color: var(--gold-deep, #8a6700); display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.medal-candidate-counter { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; margin-left: 8px; }
.medal-candidate-counter input { width: 40px; height: 28px; border: 1px solid var(--line, #e0d8c2); border-radius: 4px; text-align: center; font: inherit; font-weight: 700; background: #fff; }
.medal-candidate-counter input::-webkit-outer-spin-button,
.medal-candidate-counter input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.medal-candidate-counter input[type="number"] { -moz-appearance: textfield; }
.counter-btn { width: 28px; height: 28px; padding: 0; border: 1px solid var(--line, #e0d8c2); border-radius: 4px; background: var(--surface, #ffffff); cursor: pointer; font-weight: 800; line-height: 1; color: var(--ink, #1f2229); }
.counter-btn:hover:not(:disabled) { background: var(--gold-tint, #f9efcf); border-color: var(--gold, #c4981f); }
.counter-btn:disabled { opacity: .45; cursor: not-allowed; }
.modal-actions.sticky { position: sticky; bottom: 0; background: var(--surface, #ffffff); padding-top: 12px; margin-top: 6px; border-top: 1px solid var(--line, #e0d8c2); }
@media (max-width: 600px) {
  .medal-candidate-row { flex-wrap: wrap; }
  .medal-candidate-counter { margin-left: auto; }
}

/* Public /about pages — reuse portal.css so signed-out visitors see the
 * exact same visual language as the signed-in portal. These selectors are
 * the small additions on top of the universal classes. */
/* The masthead menu (under profile button) gets My Banking + Settings now
 * that they were promoted out of the top nav on desktop. A subtle <hr>
 * separates the sign-out button from the navigation items. */
.masthead-menu hr { border: 0; border-top: 1px solid var(--line, #e0d8c2); margin: 6px 0; }

/* Slim list-page hero + compact-card refinements live in
 * styles/portal/10-public-list-cards.css — split out because portalShell.css
 * is already over AGENTS.md's 1,200-line hard limit. */

/* Public member rows — avatar + name pair shown in /about table cells.
   The link wraps the whole pair so the entire row click-target is the
   user's profile page. min-width: 0 + overflow: hidden on the name lets
   long display names ellipsize instead of forcing the table cell wider
   than the table itself. */
.public-member-identity { display: inline-grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 10px; text-decoration: none; color: inherit; max-width: 100%; min-width: 0; }
.public-member-identity:hover .public-member-name strong { color: var(--gold-deep); }
.public-member-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--totemia-green); border: 1px solid var(--totemia-line); flex-shrink: 0; }
.public-member-avatar.medium { width: 40px; height: 40px; font-size: 14px; }
.public-member-avatar.large { width: 64px; height: 64px; font-size: 22px; border-width: 2px; }
.public-member-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.public-member-name strong { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.public-member-name small { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; color: var(--muted); }

/* Member-row table cell — keeps avatar + name on one line and the role
   badges tucked next to the name without pushing the System ID / Joined
   columns wider. A member can hold several roles, so the badges sit in a
   wrapping group that flows onto extra lines instead of overflowing. */
.public-member-cell { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; min-width: 0; max-width: 100%; }
.public-member-cell .public-member-identity { flex: 0 1 auto; min-width: 0; max-width: 100%; }
.public-member-roles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.public-member-badge { flex-shrink: 0; }

/* Public political-party / religion cards.
 *
 * Visual rules:
 *   - Thin gold stripe at the top of every card (matches the Interior
 *     "registration" editor's yellow accent — registry-record-card uses
 *     border-top: 4px solid). Same stripe on every card so the page
 *     reads as a cohesive set; image + name remain the primary
 *     differentiators.
 *   - Cover uses an <img> tag (not background-image) with
 *     smartPublicCoverFit() picking contain vs cover based on the
 *     image's natural aspect ratio. Odd-shaped logos (very tall, very
 *     wide) get contain so they aren't cropped to a center-square slice.
 *   - Soft shadow only — the page previously stacked multiple deep
 *     shadows from .official-section + .institution-card which made
 *     each card look like a floating box.
 */
/* Compact vertical card: keeps the original cover-on-top stack (so the
 * accent stripe and the existing ::before painters keep working) but the
 * cover is a short fixed-height banner instead of a 16:9 box that grew
 * with card width. Net effect: ~40 % shorter cards, same number of cards
 * per row at 1440p / 4K, no horizontal-layout regressions. */
.public-party-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }

.public-party-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--totemia-line, var(--line));
  border-top: 4px solid var(--totemia-gold, var(--gold));
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(42, 35, 23, .06);
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.public-party-card:hover { box-shadow: 0 6px 18px rgba(42, 35, 23, .09); transform: translateY(-1px); }

.public-party-card .public-party-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.public-party-card .public-party-title { margin: 1px 0 2px; font-size: 15px; line-height: 1.2; color: var(--totemia-ink, var(--ink)); word-break: break-word; }
/* Legacy single-line meta — kept around because religion cards still
 * use it. The party cards now use .public-party-card-info instead so
 * the leader and member count are guaranteed to stack consistently
 * (the previous single-line wrap was inconsistent across widths). */
.public-party-card .public-party-meta { font-size: 11px; color: var(--totemia-muted, var(--ink-2, #525763)); margin: 0; display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.public-party-card .public-party-meta strong { color: var(--totemia-ink, var(--ink)); font-weight: 800; }
.public-party-card .public-party-meta-sep { color: var(--totemia-line, var(--line)); }
.public-party-card .official-link-button { margin-top: auto; }

/* New stacked metadata block for party cards: Party Leader heading
 * with the leader name underneath, then the member count on its own
 * line. Always vertical, never wraps inline. Fixes the inconsistent
 * "sometimes-side-by-side, sometimes-stacked" boxing the user
 * reported across different card widths. */
.public-party-card-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.public-party-card-leader { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.public-party-card-leader .registry-label.small { font-size: 9px; }
.public-party-card-leader strong { color: var(--totemia-ink, var(--ink)); font-size: 12px; line-height: 1.25; font-weight: 800; overflow-wrap: anywhere; }
.public-party-card-members { font-size: 11px; color: var(--totemia-muted, var(--ink-2, #525763)); font-weight: 700; }

/* Cover frame — base sizing lives here; the fixed-height override + the
 * always-contain fit are layered on by styles/portal/10-public-list.css
 * so we don't have to keep growing this file (already over the 1,200-
 * line hard limit in AGENTS.md). */
.public-party-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #ffffff;
  overflow: hidden;
}
.public-party-cover-img { width: 100%; height: 100%; display: block; object-position: center; }
.public-party-cover-img.fit-cover { object-fit: cover; }
/* Emblem-style party/religion logos (rose, cross, sigil) are square art on
 * transparent/solid backgrounds — contain them on clean white so every org
 * renders identically regardless of source aspect ratio. */
.public-party-cover-img.fit-contain { object-fit: contain; padding: 10px; box-sizing: border-box; background: #ffffff; }
.public-party-cover-img.fit-wide,
.public-party-cover-img.fit-tall { object-fit: contain; padding: 10px; box-sizing: border-box; background: #ffffff; }

.public-party-cover-empty {
  display: grid;
  place-items: center;
  color: var(--gold-deep, #8a6700);
  font-weight: 900;
  letter-spacing: .1em;
  font-size: 20px;
  background: var(--surface-2, #f7f8fa);
}

/* Detail-page hero emblem — a clean, consistent square frame so the party
 * rose, religion cross, and independent sigil all sit identically. */
.public-party-cover-detail {
  flex: 0 0 168px;
  width: 168px;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid var(--totemia-line, var(--line));
  background: #ffffff;
}
.public-party-cover-detail.public-party-cover-empty { font-size: 36px; background: var(--surface-2, #f7f8fa); }

.party-head-row { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.party-head-body { flex: 1 1 320px; min-width: 0; }
.party-head-body h1 { word-break: break-word; }
.party-head-body p { margin: 8px 0 0; }
/* Detail page stat row — replaces .official-stat-grid for /about pages. */
.public-party-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.public-stat-card {
  border: 1px solid var(--totemia-line, var(--line));
  border-top: 3px solid var(--totemia-gold, var(--gold));
  border-radius: 12px;
  background: #ffffff;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.public-stat-card strong { font-size: 26px; line-height: 1.1; color: var(--totemia-ink, var(--ink)); word-break: break-word; }
.public-stat-card small { color: var(--totemia-muted, var(--ink-2, #525763)); font-size: 12px; }

/* The /about hero box uses the standard .official-hero shell, but
 * pulls back its heavy drop shadow because the cards below are now
 * also shadowed — the combination read as "everything is floating". */
.official-hero.public-party-hero { box-shadow: 0 4px 14px rgba(42, 35, 23, .05); }

/* ── Continuous party-document layout (About / party detail) ──────
 * One bordered container holds the whole party page. Inside, sections
 * are separated by 1px hairlines — no nested cards, no per-section
 * boxes, no extra borders. Replaces the previous fragmented design
 * the user explicitly called out ("you also failed to make a
 * continuous look and instead decided to continue making everything
 * separated into boxes"). */
.party-doc {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--totemia-line, var(--line));
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(42, 35, 23, .05);
  margin-bottom: 18px;
}
.party-doc.party-accent::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: var(--party-accent, var(--totemia-gold, var(--gold, #d5b637)));
  pointer-events: none;
}

/* HERO row — cover on the left, titles in the middle, leader-only
 * "Customize colors" pill on the right. Compact cover (160px wide)
 * leaves room for a strong title without crowding. Wraps cleanly
 * on phones. */
.party-doc-hero {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 30px 28px 24px;
}
.party-doc-hero-cover {
  width: 160px;
  flex: 0 0 160px;
}
.party-doc-hero-cover .public-party-cover-detail {
  flex: none;
  width: 160px;
  aspect-ratio: 4 / 3;
}
.party-doc-hero-titles { min-width: 0; }
.party-doc-hero-titles h1 {
  margin: 4px 0 8px;
  font-size: 28px;
  line-height: 1.15;
  word-break: break-word;
  color: var(--totemia-ink, var(--ink));
}
.party-doc-ideology {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(213, 182, 55, .12);
  border: 1px solid rgba(213, 182, 55, .35);
  font-size: 13px;
  color: var(--totemia-ink, var(--ink));
}
.party-doc-ideology .registry-label.small {
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--totemia-muted, var(--ink-2, #525763));
}
.party-doc-color-cta {
  align-self: start;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--totemia-line, var(--line));
  background: #ffffff;
  color: var(--totemia-ink, var(--ink));
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.party-doc-color-cta:hover {
  border-color: var(--party-accent, var(--totemia-gold, var(--gold, #d5b637)));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--party-accent, #d5b637) 22%, transparent);
}
@media (max-width: 720px) {
  .party-doc-hero { grid-template-columns: 1fr; text-align: left; padding: 24px 20px 18px; }
  .party-doc-hero-cover, .party-doc-hero-cover .public-party-cover-detail { width: 100%; }
  .party-doc-color-cta { justify-self: start; }
}

/* Generic section + hairline divider between blocks. No section gets
 * its own border or shadow — the whole document is one continuous
 * surface, just visually divided. */
.party-doc-section {
  padding: 22px 28px;
  border-top: 1px solid color-mix(in srgb, var(--totemia-line, var(--line, #e3d8b6)) 70%, transparent);
}
@media (max-width: 720px) {
  .party-doc-section { padding: 18px 20px; }
}

/* About block: full-width description, preserves the leader's own
 * line breaks / blank lines / spacing via `white-space: pre-wrap`.
 * The previous render collapsed everything into one wall — this is
 * the "displaying like how it was originally edited" the user asked
 * for. */
.party-doc-about .registry-label { margin-bottom: 8px; }
.public-party-description {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.65;
  color: var(--totemia-ink, var(--ink));
}

/* Stats strip — inline row of small unboxed items separated by thin
 * vertical hairlines. Wraps to multiple lines on narrow screens
 * (each item keeps a min width so labels never crash into values). */
.party-doc-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}
.party-doc-stat {
  flex: 1 1 180px;
  min-width: 180px;
  padding: 4px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 1px solid color-mix(in srgb, var(--totemia-line, var(--line, #e3d8b6)) 60%, transparent);
}
.party-doc-stat:first-child { padding-left: 0; border-left: 0; }
.party-doc-stat .registry-label { font-size: 9px; }
.party-doc-stat strong {
  font-size: 22px;
  font-weight: 800;
  color: var(--totemia-ink, var(--ink));
  line-height: 1.1;
}
.party-doc-stat small { color: var(--totemia-muted, var(--ink-2, #525763)); font-size: 12px; }
@media (max-width: 720px) {
  .party-doc-stat { flex-basis: 100%; padding: 8px 0; border-left: 0; border-top: 1px solid color-mix(in srgb, var(--totemia-line, var(--line, #e3d8b6)) 50%, transparent); }
  .party-doc-stat:first-child { border-top: 0; padding-top: 0; }
}
/* The leader/head card stands out from the other stats with a left accent in
 * the org's OWN color (party / religion), falling back to imperial gold only
 * outside a branded scope. Flat white surface — no tinted box. */
.party-doc-stat-leader { gap: 8px; border-left: 3px solid var(--party-accent-color, var(--totemia-gold)); padding-left: 13px; background: transparent; }
.party-doc-stat-leader .registry-label { color: var(--party-accent-color, var(--gold-deep)); }
.party-doc-leader-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.party-doc-leader-identity:hover .party-doc-leader-name strong { color: var(--gold-deep, #8a6700); text-decoration: underline; }
.party-doc-leader-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.party-doc-leader-name strong {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--totemia-ink, var(--ink));
  overflow: hidden;
  text-overflow: ellipsis;
}
.party-doc-leader-name small { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: var(--totemia-muted, var(--ink-2, #525763)); }
.party-doc-leader-vacant {
  font-size: 18px;
  font-weight: 800;
  color: var(--totemia-muted, var(--ink-2, #525763));
}

/* Members section — same continuous container, no extra borders. */
.party-doc-members .registry-label { margin-bottom: 4px; }
.party-doc-members h2 { margin: 0 0 12px; font-size: 18px; color: var(--totemia-ink, var(--ink)); }
.party-doc-members .public-ledger-table { border: 0; background: transparent; }

/* Page-level scope — sets --party-accent once and lets every accent-
 * aware child inherit it (the hero stripe, the description block in
 * legacy renders, the Interior brief, etc.). */
.party-detail-scope { display: block; }

/* Per-party accent. The `--party-accent` custom property is set inline
 * from the leader's saved colors (1 hex = flat band, 2-6 hex = linear
 * gradient). Defaults to the standard gold strip when nothing is set,
 * so unconfigured parties look identical to before. Used on both the
 * card list (top border) and the detail hero (top stripe). */
.public-party-card.party-accent { border-top: 0; }
.public-party-card.party-accent::before {
  content: "";
  display: block;
  height: 4px;
  background: var(--party-accent, var(--totemia-gold, var(--gold, #d5b637)));
}
/* Hero: the standard .official-hero ships a 4px gold border-top that
 * would otherwise sit ABOVE our accent strip and read as a double
 * stripe (the user's "double yellow" report). Drop the border on
 * the accented hero and paint a single 6px strip flush against the
 * top edge using ::before. overflow: hidden + the hero's own
 * border-radius round the strip's top corners naturally. */
.official-hero.public-party-hero.party-accent {
  position: relative;
  overflow: hidden;
  border-top-width: 0;
}
.official-hero.public-party-hero.party-accent::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--party-accent, var(--totemia-gold, var(--gold, #d5b637)));
  pointer-events: none;
}

/* Page-level scope set on the party-detail wrapper. Every accent-aware
 * descendant (hero, leader band, stat cards, leader card) inherits
 * --party-accent from here so we only compute the gradient once per
 * render and never have to thread the inline style through. */
.party-detail-scope { display: block; }

/* Stat / leader cards on the party detail page were also painting a
 * 3px gold border-top that ignored the party's colors. Same treatment
 * as the hero — drop the border, paint a single strip from the
 * scope-inherited --party-accent. */
.public-stat-card.party-accent {
  position: relative;
  overflow: hidden;
  border-top-width: 0;
}
.public-stat-card.party-accent::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--party-accent, var(--totemia-gold, var(--gold, #d5b637)));
  pointer-events: none;
}

/* Interior registration party-detail card — same accent strip on top
 * AND recolored left edge so the gold stripe doesn't stay leaking
 * through when the leader picks new colors. */
.interior-party-brief.party-accent { position: relative; overflow: hidden; padding-top: 14px; border-left-color: transparent; }
.interior-party-brief.party-accent::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--party-accent, var(--totemia-gold, var(--gold, #d5b637)));
}
.interior-party-brief.party-accent::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--party-accent, var(--totemia-gold, var(--gold, #d5b637)));
}

/* Same treatment on the Interior Political Parties registry grid
 * cards. Without these, every card stays gold even after the leader
 * has set custom colors — exactly the bug the user reported. */
.interior-registry-card.party-accent {
  position: relative;
  overflow: hidden;
  border-top-color: transparent;
  border-left: 0;
}
.interior-registry-card.party-accent::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--party-accent, var(--totemia-gold, var(--gold, #d5b637)));
}
.interior-registry-card.party-accent::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--party-accent, var(--totemia-gold, var(--gold, #d5b637)));
}

@media (max-width: 640px) {
  .public-party-cover-detail { width: 100%; flex-basis: auto; aspect-ratio: 16 / 9; }
  .public-member-avatar.large { width: 52px; height: 52px; font-size: 18px; }
}

/* Searchable account picker — replaces the bare <select> for staff and
 * party-leader appointments. Filtered by name + system ID, keyboard
 * accessible, scopes click-away handler by [data-namespace]. */
.account-picker { position: relative; display: block; }
.account-picker-input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; font: inherit; background: var(--surface); color: var(--ink); }
.account-picker-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-tint); }
.account-picker-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.08)); display: none; z-index: 30; }
.account-picker.open .account-picker-menu { display: block; }
.account-picker-menu[data-visible="0"]::after { content: attr(data-empty-message); display: block; padding: 12px 14px; color: var(--ink-2); font-size: 13px; }
.account-picker-option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 8px 14px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.account-picker-option:hover, .account-picker-option:focus-visible { background: var(--gold-tint); }
.account-picker-option strong { font-size: 13px; color: var(--ink); }
.account-picker-option span { font-size: 11px; color: var(--ink-2); }

  :root {
    /* Modern white surface — cool neutral whites/greys. Imperial gold and the
     * government green remain the only brand accents (masthead stays black). */
    --totemia-ivory: #f4f5f7;
    --totemia-paper: #ffffff;
    --totemia-gold: #c4981f;
    --totemia-gold-soft: #dcc48a;
    --totemia-green: #123c32;
    --totemia-green-2: #1d5a4a;
    --totemia-ink: #14171a;
    --totemia-muted: #5b636c;
    --totemia-line: #e3e6ea;
    --totemia-red: #a32a20;
  }

  body {
    background: var(--totemia-ivory);
    color: var(--totemia-ink);
  }

  .masthead {
    background: #111611 !important;
    border-bottom: 3px solid var(--totemia-gold) !important;
  }

  .masthead-crest {
    width: 36px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 36px;
  }

  .masthead-crest img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

  .masthead-sub { color: var(--totemia-gold-soft) !important; }

  .global-nav {
    background: var(--totemia-paper) !important;
    border-bottom: 1px solid var(--totemia-line) !important;    box-shadow: none !important;
  }

  .official-nav-inner {
    /* Match the widened .content shell below. */
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 54px;
  }

  .official-nav-primary,
  .official-nav-account {
    display: flex;
    align-items: center;
    gap: 6px;
    /* overflow: visible so the absolutely-positioned About dropdown menu
     * can render past the row. The previous overflow-x: auto clipped the
     * menu to the row bounds and showed a horizontal scrollbar in its
     * place. Narrow-viewport horizontal scrolling is restored at the
     * narrow breakpoint below, where the dropdown menu is also already
     * inlined as static so it does not need to escape the overflow box. */
    overflow: visible;
  }
  @media (max-width: 540px) {
    .official-nav-primary,
    .official-nav-account {
      overflow-x: auto;
    }
  }

  .official-nav-link {
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #283027;
    font-size: 13px;
    font-weight: 800;
    padding: 17px 12px 14px;
    white-space: nowrap;
    /* When the public-about pages render <a> elements with this class
     * (server-rendered, no JS) the anchor's default underline would
     * otherwise leak through and visually diverge from the SPA's
     * <button>-based nav. Reset it explicitly so both forms look
     * identical. */
    text-decoration: none;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
  }

  .official-nav-link:hover {
    background: rgba(213, 182, 55, .09);
    color: var(--totemia-green);
  }

  /* Active page is shown by the underline only — the text keeps its normal
     ink color rather than recoloring, which reads cleaner across the nav. */
  .official-nav-link.active {
    color: #283027;
    border-bottom-color: var(--totemia-gold);
  }

  /* About hover-dropdown — same visual rhythm as the rest of the
   * official-nav-primary buttons. The trigger picks up the standard hover
   * background; the menu opens on hover (desktop) or focus-within (touch).
   * An invisible bridge below the trigger keeps the menu open while the
   * cursor crosses from button to panel. */
  .official-nav-dropdown {
    position: relative;
    display: inline-flex;
  }
  .official-nav-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
  }
  .official-nav-caret {
    font-size: 11px;
    line-height: 1;
    transition: transform .18s ease;
  }
  /* Desktop dropdowns are CLICK-controlled: the trigger toggles `.open`
   * (driven by GlobalNavClient state), and an outside-click / Escape closes
   * it. Hover only tints the trigger — it never opens the panel — which is
   * what fixes the previous hover/focus-within flicker. */
  .official-nav-dropdown.open > .official-nav-trigger,
  .official-nav-trigger:hover {
    background: rgba(213, 182, 55, .14);
    color: var(--totemia-green);
  }
  .official-nav-dropdown.open .official-nav-caret {
    transform: rotate(180deg);
  }
  .official-nav-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 280px;
    background: var(--totemia-paper);
    border: 1px solid var(--totemia-line);
    border-top: 4px solid var(--totemia-gold);
    border-radius: 14px;
    box-shadow: 0 24px 52px rgba(20, 23, 26, .18);
    padding: 14px;
    opacity: 0;
    transform: translateY(-8px) scale(.985);
    transform-origin: top left;
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease;
    z-index: 90;
  }
  .official-nav-dropdown.open > .official-nav-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }
  .official-nav-menu a {
    display: block;
    padding: 11px 14px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--totemia-ink);
    text-decoration: none;
    border-radius: 9px;
  }
  .official-nav-menu a:hover {
    background: rgba(213, 182, 55, .12);
    color: var(--totemia-green);
  }

  @media (max-width: 720px) {
    .official-nav-dropdown {
      flex: 1 1 100%;
      flex-direction: column;
      align-items: stretch;
    }
    .official-nav-trigger {
      justify-content: space-between;
    }
    .official-nav-menu {
      position: static;
      opacity: 1;
      transform: none;
      pointer-events: auto;
      border: 0;
      border-top: 1px solid rgba(213, 182, 55, .25);
      border-radius: 0;
      box-shadow: none;
      background: rgba(213, 182, 55, .05);
      padding: 0;
    }
    .official-nav-menu a {
      padding-left: 28px;
    }
    .official-nav-menu a + a {
      border-top-color: rgba(0, 0, 0, .06);
    }
    .official-nav-dropdown::after {
      display: none;
    }
  }

  /* Phone-only nav layout (≤600px). Tablets (iPad mini 768px+) keep the
   * desktop single-row look. Below 600px the horizontal-scroll fallback
   * from the ≤540px rule above is replaced with a wrapping layout: the
   * primary group pairs items two-per-row, About spans full width (its
   * inline dropdown menu needs the room), and Banking sits below the
   * primary group on its own full-width row. No new components, no
   * icons — same buttons, just allowed to wrap. */
  @media (max-width: 600px) {
    .official-nav-inner {
      flex-direction: column;
      align-items: stretch;
      gap: 0;
      min-height: 0;
    }
    .official-nav-primary {
      overflow: visible;
      flex-wrap: wrap;
      gap: 0;
      width: 100%;
    }
    .official-nav-primary > .official-nav-link {
      flex: 1 1 50%;
      min-width: 0;
      justify-content: center;
      text-align: center;
    }
    .official-nav-account {
      overflow: visible;
      width: 100%;
      border-top: 1px solid var(--totemia-line);
    }
    .official-nav-account > .official-nav-link {
      flex: 1 1 100%;
      justify-content: center;
    }
  }

  .content {
    /* Wider shell on desktops — 1240px left ledger tables and workspaces
     * feeling cramped on ordinary PC monitors. Grids below auto-fit, so
     * narrow screens are unaffected. */
    max-width: 1400px !important;
    background: transparent !important;
  }

  .page-banner,
  .module-head {
    border-color: var(--totemia-line) !important;
    background: var(--totemia-paper) !important;
  }

  .official-hero,
  .official-record-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    background: #ffffff;
    /* Flat, uniform frame — the repetitive gold top stripe was dropped so the
       brand gold reads as an accent (links, focus, active tabs), not a rule
       stamped on every hero. Semantic heroes (record, ministry) re-apply a
       coloured top rule below. */
    border: 1px solid var(--totemia-line);
    border-radius: 10px;
    padding: 18px 22px;
    margin-bottom: 14px;
    /* Drop shadow removed — heavy 50px-blur shadow added vertical weight on
       a page that already shows 6+ stacked cards. */
  }

  .official-hero.compact,
  .official-record-hero {
    padding: 16px 20px;
  }

  .official-record-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    border-top: 3px solid var(--totemia-green);
  }

  .official-record-hero.fund {
    border-top-color: var(--totemia-gold);
  }

  .official-hero h1,
  .official-record-hero h1 {
    margin: 4px 0 4px;
    color: var(--totemia-green);
    font-size: 24px;
    line-height: 1.15;
  }

  .official-hero p,
  .official-record-hero p {
    max-width: 720px;
    margin: 0;
    color: var(--totemia-muted);
    font-size: 13px;
    line-height: 1.5;
  }

  .official-seal {
    width: 82px;
    height: 82px;
    display: grid;
    place-items: center;
    border: 1px solid var(--totemia-line);
    border-radius: 4px;
    background: #ffffff;
    /* Flat white frame — the gold-tinted box (#fff8e3 + gold border) read
     * as a yellow halo around every seal/photo and clashed with the
     * flattened portal. A neutral hairline carries the frame. */
  }

  .official-seal-img {
    width: 62px;
    height: 62px;
    border-radius: 3px;
    object-fit: cover;
  }

  .official-seal-img.fallback {
    display: grid;
    place-items: center;
    color: var(--totemia-gold);
    font-size: 32px;
  }

  .registry-label {
    color: var(--totemia-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
  }

  .official-section,
  .official-filter-panel {
    background: var(--totemia-paper);
    border: 1px solid var(--totemia-line);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 14px;
    /* Drop shadow removed — stacking 4-5 sections with 34px blur shadows
       on the salary management page was a major source of "weak/floaty"
       complaints. The hairline border carries the section boundary. */
  }

  .official-section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 12px;
    margin-bottom: 12px;
  }

  .official-section-head h2 {
    margin: 3px 0 0;
    color: var(--totemia-ink);
    font-size: 18px;
  }

  @media (max-width: 720px) {
    .official-hero,
    .official-record-hero {
      grid-template-columns: minmax(0, 1fr);
      padding: 14px 16px;
      gap: 10px;
    }
    .official-hero h1,
    .official-record-hero h1 { font-size: 20px; }
    .official-section,
    .official-filter-panel { padding: 12px 14px; margin-bottom: 10px; }
    .official-section-head h2 { font-size: 16px; }
  }

  .official-action-row,
  .record-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
    align-items: center;
  }

  .record-actions.compact {
    margin-top: 14px;
  }

  button,
  .official-link-button {
    background: var(--totemia-green);
    border-color: #0f3028;
    color: #fff8e6;
    /* Squared corners, no lift/glow — the portal look is flat and bold.
     * The legacy shell's rounded gold buttons with hover translate +
     * 15px glow shadow are neutralized here for every portal surface. */
    border-radius: 2px;
    box-shadow: none;
  }

  button:hover,
  .official-link-button:hover {
    background: var(--totemia-green-2);
    box-shadow: none;
    transform: none;
  }

  .official-secondary,
  .official-link-button.quiet {
    background: #ffffff !important;
    border: 1px solid var(--totemia-line) !important;
    color: var(--totemia-green) !important;
    box-shadow: none !important;
  }

  .official-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 8px 13px;
    border-radius: 2px;
    text-decoration: none;
    font-weight: 800;
    font-size: 12px;
  }

  .official-link-button.quiet {
    min-height: 30px;
  }

  .official-link-button:hover,
  .text-link:hover {
    text-decoration: underline;
  }

  .combobox-selected {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
  }

  .combobox-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
  }

  .combobox-account-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--totemia-line);
    background: #f7f8fa;
    color: var(--totemia-green);
    font-size: 13px;
    font-weight: 900;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
  }

  .official-back-button {
    margin: 0 0 10px;
    background: #ffffff !important;
    border: 1px solid var(--totemia-line) !important;
    color: var(--totemia-green) !important;
    box-shadow: none !important;
  }

  .treasury-overview-strip {
    border-top: 4px solid var(--totemia-gold);
  }

  .treasury-fund-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }

  .operation-tabs {
    margin: 22px 0 0;
  }

  .operation-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
  }

  .operation-form-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .operation-fieldset,
  .operation-warning {
    background: #ffffff;
    border: 1px solid var(--totemia-line);
    border-top: 3px solid var(--totemia-gold);
    border-radius: 14px;
    padding: 18px;
  }

  .operation-fieldset h3 {
    margin: 0 0 14px;
    color: var(--totemia-green);
    font-size: 16px;
  }

  .operation-warning {
    grid-column: 1 / -1;
    display: grid;
    gap: 5px;
    border-top-color: var(--totemia-green);
    color: var(--totemia-green);
  }

  .operation-warning.red {
    border-top-color: var(--totemia-red);
    color: #5d211b;
  }

  .operation-warning span {
    color: var(--totemia-muted);
  }

  .operation-submit-row {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
  }

  .inline-transfer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
  }

  .transfer-from-display {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 11px 14px;
    background: #f7f8fa;
    border: 1px solid var(--totemia-line);
    border-radius: 10px;
  }

  .transfer-from-label {
    color: var(--totemia-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .transfer-from-value {
    color: var(--totemia-ink);
    font-size: 14px;
    font-weight: 700;
    font-family: monospace;
  }

  .ops-tab-bar {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    margin-bottom: 6px;
  }

  .ops-tab-bar .acct-tab {
    background: #ffffff;
    color: var(--totemia-green);
    border: 1px solid var(--totemia-line);
    box-shadow: none;
    padding: 7px 16px;
    font-size: 13px;
    border-radius: 8px;
  }

  .ops-tab-bar .acct-tab.active {
    background: var(--totemia-green);
    color: #fff8e6;
    border-color: var(--totemia-green);
  }

  /* ── Fund detail tab bar ─────────────────────────────────────────────── */

  .fund-tab-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    border-bottom: 2px solid var(--totemia-line);
    padding-bottom: 0;
  }

  .fund-tab {
    background: none !important;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: var(--totemia-muted) !important;
    font-size: 13px;
    font-weight: 800;
    padding: 10px 14px 13px !important;
    margin-bottom: -2px;
    white-space: nowrap;
  }

  .fund-tab.active {
    color: var(--totemia-green) !important;
    border-bottom-color: var(--totemia-gold) !important;
  }


  .fund-tab:hover {
    background: rgba(213, 182, 55, .07) !important;
    color: var(--totemia-green) !important;
  }

  /* ── Compact schedule planner ─────────────────────────────────────────── */

  /* Schedule planner is inlined into the parent section (no card chrome)
     so the salary management page reads as one continuous document instead
     of stacked boxes. The accent border + background are removed; only the
     section title differentiates this block from the funding block above. */
  .compact-schedule-planner {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
  }

  .compact-schedule-meta {
    display: grid;
    gap: 4px;
  }

  .compact-schedule-next {
    font-size: 14px;
    color: var(--totemia-muted);
  }

  .compact-schedule-controls {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
  }

  .compact-date-field {
    min-width: 200px;
  }

  .compact-date-field span {
    color: var(--totemia-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .09em;
    text-transform: uppercase;
  }

  .compact-date-field input[type="date"] {
    padding: 8px 10px;
    font-size: 14px;
  }

  /* ── Salary / org role cards ──────────────────────────────────────────── */

  .salary-role-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(264px, 1fr));
    gap: 12px;
    margin-top: 6px;
  }

  .salary-role-card {
    --role-color: var(--totemia-gold);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #ffffff;
    border: 1px solid var(--totemia-line);
    border-left: 3px solid var(--role-color);
    border-radius: 12px;
    padding: 14px 16px;
    transition: border-color .12s ease, box-shadow .12s ease;
  }

  .salary-role-card:hover {
    border-color: color-mix(in srgb, var(--role-color) 36%, var(--totemia-line));
    box-shadow: 0 6px 18px rgba(20, 23, 26, .06);
  }

  /* Top of the hierarchy (Party Leader / head of organization) reads at a
     glance with a soft gold frame — a flat tint, never a decorative gradient. */
  .salary-role-card.is-leader {
    border-color: var(--totemia-gold-soft);
    background: #fffdf6;
    box-shadow: inset 0 0 0 1px rgba(196, 152, 31, .14);
  }

  .salary-role-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .salary-role-card-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    min-width: 0;
  }

  .salary-role-card-name strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .role-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--role-color) 16%, #ffffff);
  }

  .salary-role-card-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .salary-role-amount {
    color: var(--totemia-green);
    font-size: 20px;
    font-weight: 900;
  }

  .salary-role-card-actions {
    display: flex;
    gap: 6px;
  }

  .salary-role-card-edit {
    margin-top: auto;
  }

  /* Holder roster inside a role card */
  .salary-role-holders {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
  }

  .salary-role-holder {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid var(--totemia-line);
    border-radius: 9px;
    background: var(--totemia-ivory);
  }

  .salary-role-holder .user-identity-line {
    min-width: 0;
  }

  .role-vacant {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--totemia-ivory);
    border: 1px dashed var(--totemia-line);
    color: var(--totemia-muted);
    font-size: 12px;
    font-weight: 700;
  }

  @media (prefers-reduced-motion: reduce) {
    .salary-role-card {
      transition: none;
    }
  }

  /* ── Salary creator steps ─────────────────────────────────────────────── */

  .salary-step-header {
    margin-bottom: 18px;
    display: grid;
    gap: 6px;
  }

  /* Flat left-bar status flag (modern bold) — not a rounded pill. */
  .salary-step-badge {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    padding: 0 0 0 10px;
    border: 0;
    border-left: 3px solid currentColor;
    background: transparent;
    color: #6e4b00;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .11em;
    text-transform: uppercase;
    width: fit-content;
  }

  .salary-step-badge.arming {
    color: var(--totemia-green);
  }

  /* ── Role selector (step 1) ───────────────────────────────────────────── */

  .salary-role-selector {
    display: grid;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--totemia-line);
    border-radius: 10px;
    padding: 8px;
    background: #ffffff;
  }

  .salary-candidate-role {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    transition: background .1s;
  }

  .salary-candidate-role:hover {
    background: rgba(213, 182, 55, .07);
  }

  .salary-candidate-role.selected {
    background: #e8f2ec;
    border-color: rgba(29, 90, 74, .2);
  }

  .salary-candidate-role.existing {
    opacity: .7;
  }

  .salary-candidate-role input[type="checkbox"],
  .salary-candidate-role input[type="radio"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--totemia-green);
  }

  .salary-candidate-name {
    flex: 1;
    font-weight: 700;
  }

  .website-role-selector {
    max-height: 520px;
  }

  .website-role-selector-heading {
    padding: 10px 10px 4px;
    color: var(--totemia-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .16em;
    text-transform: uppercase;
  }

  .website-role-candidate {
    --role-color: var(--totemia-green);
  }

  .website-role-candidate.current {
    border-color: color-mix(in srgb, var(--role-color) 32%, var(--totemia-line));
  }

  .website-role-candidate .role-dot {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--role-color) 14%, white);
  }

  .website-role-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    padding: 4px 9px;
    border: 1px solid color-mix(in srgb, var(--role-color, var(--totemia-green)) 65%, white);
    border-radius: 999px;
    background: color-mix(in srgb, var(--role-color, var(--totemia-green)) 10%, white);
    color: var(--role-color, var(--totemia-green));
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
  }

  .website-role-management {
    display: grid;
    gap: 14px;
  }

  .website-role-management-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .website-role-management-head h4 {
    margin-bottom: 6px;
  }

  .website-role-section-list {
    display: grid;
    gap: 14px;
  }

  .website-role-section {
    display: grid;
    gap: 8px;
  }

  .website-role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 8px;
  }

  .website-role-option {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 58px;
    padding: 10px 12px;
    border: 1px solid color-mix(in srgb, var(--role-color, var(--totemia-green)) 18%, var(--totemia-line));
    border-radius: 8px;
    background: #ffffff;
    color: var(--totemia-ink);
    text-align: left;
    box-shadow: none;
  }

  .website-role-option:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--role-color, var(--totemia-green)) 55%, var(--totemia-line));
    background: color-mix(in srgb, var(--role-color, var(--totemia-green)) 7%, #ffffff);
  }

  .website-role-option.selected {
    background: color-mix(in srgb, var(--role-color, var(--totemia-green)) 11%, #ffffff);
    border-color: color-mix(in srgb, var(--role-color, var(--totemia-green)) 70%, var(--totemia-line));
  }

  .website-role-option:disabled {
    cursor: not-allowed;
    opacity: .68;
  }

  .website-role-swatch {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: var(--role-color, var(--totemia-green));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--role-color, var(--totemia-green)) 16%, white);
  }

  .website-role-option-main {
    display: grid;
    gap: 3px;
    min-width: 0;
    font-weight: 900;
  }

  .website-role-option-main small {
    color: var(--totemia-muted);
    font-size: 11px;
    font-weight: 800;
    overflow-wrap: anywhere;
  }

  .website-role-check {
    color: var(--role-color, var(--totemia-green));
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
    text-transform: uppercase;
  }

  /* ── Amount setter (step 2) ───────────────────────────────────────────── */

  .salary-amount-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
  }

  .salary-amount-card {
    background: #ffffff;
    border: 1px solid var(--totemia-line);
    border-radius: 10px;
    padding: 14px 16px;
    display: grid;
    gap: 10px;
  }

  .salary-amount-card-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
  }

  /* ── Arming progress (step 3) ─────────────────────────────────────────── */

  .salary-arm-bar-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
  }

  .salary-arm-bar {
    flex: 1;
    height: 8px;
    background: var(--totemia-line);
    border-radius: 99px;
    overflow: hidden;
  }

  .salary-arm-progress {
    height: 100%;
    width: 0;
    background: var(--totemia-green);
    border-radius: 99px;
    transition-property: width;
    transition-timing-function: linear;
    will-change: width;
  }

  @media (prefers-reduced-motion: reduce) {
    .salary-arm-progress { transition-duration: 0ms !important; }
  }

  .salary-arm-label {
    color: var(--totemia-muted);
    font-size: 13px;
    font-weight: 700;
    min-width: 30px;
    text-align: right;
  }

  .salary-arming-summary {
    display: grid;
    gap: 6px;
  }

  .salary-arming-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid var(--totemia-line);
    border-radius: 8px;
    font-size: 14px;
  }

  .salary-arming-row strong {
    margin-left: auto;
    color: var(--totemia-green);
    font-size: 15px;
  }

  .salary-batch-history {
    margin-top: 8px;
  }

  /* ── Account breadcrumb ─────────────────────────────────────────────── */

  .account-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: var(--totemia-muted);
    font-size: 13px;
    font-weight: 700;
  }

  .account-breadcrumb .breadcrumb-sep {
    color: var(--totemia-gold);
    font-size: 16px;
  }

  .inline-actions {
    margin-top: 0;
    justify-content: flex-end;
  }

  .treasury-ledger table th,
  .treasury-ledger table td {
    vertical-align: top;
  }

  .internal-details.compact {
    margin-top: 4px;
    color: var(--totemia-muted);
    font-size: 11px;
  }

  .internal-details.compact.inline {
    display: inline-block;
    margin-top: 0;
  }

  .internal-details.compact summary {
    cursor: pointer;
    font-weight: 800;
  }

  .module-meta {
    align-items: center;
  }

  .official-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--totemia-gold-soft);
    background: #fff4ce;
    color: #6e4b00;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
  }

  .official-badge.green {
    border-color: rgba(29, 90, 74, .24);
    background: #e8f2ec;
    color: var(--totemia-green);
  }

  .official-badge.gold {
    border-color: var(--totemia-gold-soft);
    background: #fff4ce;
    color: #6e4b00;
  }

  .official-badge.salary {
    border-color: rgba(59, 130, 246, .24);
    background: #eff6ff;
    color: #1d4ed8;
  }

  .official-badge.stimulus {
    border-color: rgba(139, 92, 246, .24);
    background: #f5f3ff;
    color: #6d28d9;
  }

  .official-badge.fine {
    border-color: rgba(220, 38, 38, .24);
    background: #fef2f2;
    color: #b91c1c;
  }

  .official-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin: 12px 0 18px;
  }

  .official-stat {
    border: 1px solid var(--totemia-line);
    border-top: 3px solid var(--totemia-gold);
    border-radius: 12px;
    background: #ffffff;
    padding: 18px;
  }

  .official-stat.major {
    border-top-color: var(--totemia-green);
  }

  .official-stat > span,
  .official-stat > small {
    display: block;
    color: var(--totemia-muted);
    font-weight: 800;
    font-size: 12px;
  }

  .official-stat strong {
    display: block;
    margin: 7px 0 5px;
    color: var(--totemia-ink);
    font-size: 26px;
    line-height: 1.1;
  }


  .official-stat strong.economic-money {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    margin: 9px 0 7px;
    color: var(--totemia-ink);
    line-height: 1;
  }

  .official-stat strong.economic-money .economic-money-amount,
  .official-stat strong.economic-money .economic-money-currency {
    display: inline;
    color: var(--totemia-ink);
    font-size: clamp(18px, 1.5vw, 24px);
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }

  .economic-count {
    font-size: clamp(20px, 1.6vw, 26px);
    font-weight: 800;
  }

  @media (max-width: 720px) {
    .economic-stat-grid {
      grid-template-columns: 1fr;
    }

    .official-stat strong.economic-money .economic-money-amount,
    .official-stat strong.economic-money .economic-money-currency {
      font-size: clamp(17px, 5vw, 22px);
    }
  }


  .institution-grid,
  .ministry-tool-grid,
  .registry-record-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 14px;
    align-items: start;
  }

  .institution-grid.two {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  }

  .institution-record,
  .registry-record-card {
    border: 1px solid var(--totemia-line);
    border-top: 4px solid var(--totemia-gold);
    border-radius: 14px;
    background: #ffffff;
    padding: 18px;
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 15px;
  }

  .institution-record.single {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .registry-record-card {
    display: block;
    border-top-color: var(--ministry-accent, var(--totemia-green));
  }

  .registry-record-card.treasury {
    border-top-color: var(--ministry-accent, var(--totemia-green));
  }



  /* Currency issuance fund: subtle distinction only */
  .registry-record-card.treasury.currency-issuance {
    position: relative;
    border-top-width: 5px;
    background: #ffffff;
  }

  .registry-record-card.treasury.currency-issuance::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: var(--totemia-gold);
  }

  .registry-record-card.treasury.currency-issuance .registry-label {
    color: #6e4b00;
  }

  .registry-record-card.treasury.currency-issuance .issuance-primary-action {
    border-color: var(--totemia-gold) !important;
    font-weight: 900;
  }

  .institution-mark {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #f8ecd0;
    border: 1px solid var(--totemia-gold-soft);
    color: var(--totemia-green);
    font-weight: 900;
    overflow: hidden;
  }

  .institution-mark.has-seal {
    background: transparent;
    border-color: transparent;
  }

  .institution-seal-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    display: block;
  }

  .institution-mark-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    font-weight: 900;
    color: var(--totemia-green);
  }

  .institution-body h3,
  .registry-record-card h3 {
    margin: 6px 0 6px;
    color: var(--totemia-ink);
    font-size: 19px;
  }

  .institution-body p,
  .registry-record-card p {
    color: var(--totemia-muted);
    line-height: 1.45;
    margin: 0 0 12px;
  }

  .record-card-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: start;
  }

  .record-balance {
    color: var(--ministry-accent, var(--totemia-green));
    font-size: 31px;
    font-weight: 900;
    margin: 16px 0 8px;
  }

  .record-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--totemia-muted);
    font-size: 12px;
    font-weight: 800;
  }

  .related-heading,
  .nested-fund-heading {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--totemia-line);
    color: var(--totemia-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
  }

  .related-fund-stack {
    display: grid;
    gap: 9px;
    margin-top: 10px;
  }

  .related-fund-record {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    padding: 12px 12px 12px 20px;
    border: 1px solid #e3e6ea;
    border-radius: 10px;
    background: #ffffff;
  }

  .related-fund-record .fund-line {
    position: absolute;
    left: 8px;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 99px;
    background: var(--totemia-gold);
  }

  .related-fund-record h5 {
    margin: 3px 0;
    font-size: 14px;
    color: var(--totemia-ink);
  }

  .muted-detail {
    color: var(--totemia-muted);
    font-size: 12px;
  }

  .fund-empty {
    border: 1px dashed var(--totemia-line);
    border-radius: 10px;
    background: #ffffff;
    color: var(--totemia-muted);
    padding: 13px;
  }

  .official-filter-panel {
    display: grid;
    grid-template-columns: minmax(280px, 1.8fr) repeat(3, minmax(160px, .7fr));
    gap: 12px;
    align-items: end;
  }

  .official-filter-panel label {
    display: grid;
    gap: 6px;
  }

  .official-filter-panel span {
    color: var(--totemia-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .09em;
    text-transform: uppercase;
  }

  input,
  select,
  textarea {
    border-color: var(--totemia-line) !important;
    background: #ffffff !important;
  }

  input:focus,
  select:focus,
  textarea:focus {
    outline: 2px solid rgba(213, 182, 55, .28) !important;
    border-color: var(--totemia-gold) !important;
  }

  .public-ledger-table {
    overflow-x: auto;
    border: 1px solid var(--totemia-line);
    border-radius: 12px;
    background: #ffffff;
  }

  .public-ledger-table table {
    width: 100%;
    border-collapse: collapse;
  }

  .public-ledger-table th {
    background: var(--surface-2);
    color: var(--totemia-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--totemia-line);
  }

  .public-ledger-table td {
    border-top: 1px solid var(--totemia-line);
    padding: 13px 14px;
    vertical-align: middle;
  }

  .internal-details {
    flex-basis: 100%;
    border: 1px solid var(--totemia-line);
    border-radius: 10px;
    padding: 10px 12px;
    background: #ffffff;
    color: var(--totemia-muted);
  }

  .internal-details summary {
    cursor: pointer;
    font-weight: 900;
    color: var(--totemia-green);
  }

  .internal-details div {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 10px;
    margin-top: 9px;
    font-size: 12px;
  }

  .quiet-copy {
    margin-top: 10px;
    background: #ffffff !important;
    color: var(--totemia-green) !important;
    border: 1px solid var(--totemia-line) !important;
  }

  .salary-state,
  .page-banner-pill {
    border-color: var(--totemia-gold-soft) !important;
    background: #fff4ce !important;
    color: #6e4b00 !important;
  }

  .auth-switch-btn.active {
    border-color: var(--totemia-green) !important;
    background: #e8f2ec !important;
    color: var(--totemia-green) !important;
  }

  .table-shell thead th {
    background: #f7f8fa !important;
    color: var(--totemia-muted) !important;
  }

  .table-shell {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chart-row,
  .chart-block,
  .chart-area,
  .chart-area-tall {
    min-width: 0;
    max-width: 100%;
  }

  @media (max-width: 900px) {
    .official-nav-inner,
    .official-nav-primary,
    .official-nav-account {
      align-items: stretch;
    }

    .official-nav-inner {
      display: block;
      padding: 6px 0;
    }

    .official-hero,
    .official-record-hero {
      grid-template-columns: 1fr;
      padding: 24px;
    }

    .official-filter-panel {
      grid-template-columns: 1fr;
    }

    .related-fund-record {
      grid-template-columns: 1fr;
    }

    .operation-form-grid,
    .operation-form-grid.compact,
    .inline-transfer-grid {
      grid-template-columns: 1fr;
    }

    .transfer-from-display {
      flex-direction: column;
      align-items: flex-start;
      gap: 4px;
    }

    .ops-tab-bar {
      flex-wrap: wrap;
    }

    .official-stat-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .registry-record-grid {
      grid-template-columns: 1fr;
    }

    .related-fund-record {
      grid-template-columns: 1fr auto;
    }

    .record-actions,
    .record-actions.compact {
      flex-direction: column;
      align-items: stretch;
    }

    .record-actions button,
    .record-actions a {
      text-align: center;
      justify-content: center;
    }

    .official-section-head {
      flex-direction: column;
      align-items: flex-start;
    }

    .inline-actions {
      justify-content: flex-start;
    }

    .public-ledger-table {
      font-size: 12px;
    }

    .official-stat strong {
      font-size: 20px;
    }

    .fund-tab-bar {
      overflow-x: auto;
      flex-wrap: nowrap;
      padding-bottom: 2px;
    }

    .compact-schedule-controls {
      flex-direction: column;
      align-items: stretch;
    }

    .compact-date-field {
      min-width: 0;
    }

    .salary-role-cards,
    .salary-amount-grid {
      grid-template-columns: 1fr;
    }

    .salary-role-card-body {
      flex-direction: column;
      align-items: flex-start;
    }
  }

  @media (max-width: 480px) {
    .official-stat-grid {
      grid-template-columns: 1fr;
    }

    .official-hero h1,
    .official-record-hero h1 {
      font-size: 26px;
    }

    .record-balance {
      font-size: 24px;
    }

  }

    .personal-role-pref-head,
    .personal-role-pref-footer {
      display: grid;
      justify-content: stretch;
    }
  }


  .personal-settings-hidden {
    display: none !important;
  }

  .personal-role-preferences-panel {
    border: 1px solid var(--totemia-line);
    border-top: 3px solid var(--totemia-gold);
    border-radius: 12px;
    background: #ffffff;
    padding: 18px;
    margin-top: 18px;
  }

  .personal-role-pref-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
  }

  .personal-role-pref-head h3 {
    margin: 4px 0 4px;
    color: var(--totemia-ink);
    font-size: 17px;
  }

  .personal-role-pref-head p {
    margin: 0;
    max-width: 620px;
    color: var(--totemia-muted);
    font-size: 12px;
    line-height: 1.45;
  }

  .role-pref-cooldown {
    border: 1px solid var(--totemia-gold-soft);
    background: #fff4ce;
    color: #6e4b00;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
  }

  .personal-role-pref-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .role-pref-field select {
    min-height: 38px;
    width: 100%;
  }

  .role-pref-field-locked select {
    opacity: .72;
    cursor: not-allowed;
  }

  .role-pref-lock-note {
    display: block;
    margin-top: 5px;
    color: var(--totemia-muted);
    font-size: 11px;
    font-weight: 800;
  }

  .personal-role-pref-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--totemia-line);
  }

  .personal-role-pref-footer span {
    color: var(--totemia-muted);
    font-size: 12px;
    font-weight: 700;
  }

  .personal-role-pref-footer button:disabled {
    opacity: .55;
    cursor: not-allowed;
  }

  #personal-settings-toast-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: grid;
    gap: 10px;
    z-index: 9999;
    max-width: 360px;
  }

  .personal-settings-toast {
    transform: translateX(24px);
    opacity: 0;
    transition: opacity .18s ease, transform .18s ease;
    border: 1px solid rgba(29, 90, 74, .22);
    border-left: 4px solid var(--totemia-green);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 16px 36px rgba(42, 35, 23, .16);
    padding: 13px 15px;
  }

  .personal-settings-toast.show {
    transform: translateX(0);
    opacity: 1;
  }

  .personal-settings-toast.error {
    border-left-color: var(--totemia-red);
  }

  .personal-settings-toast strong {
    display: block;
    color: var(--totemia-ink);
    font-size: 13px;
    margin-bottom: 3px;
  }

  .personal-settings-toast span {
    display: block;
    color: var(--totemia-muted);
    font-size: 12px;
    line-height: 1.35;
  }

  .onboarding-modal-card {
    width: min(620px, calc(100vw - 24px));
    max-width: 640px;
    max-height: calc(100dvh - 32px);
    overflow: auto;
  }

  .onboarding-progress-meter {
    margin: 14px 0 16px;
  }

  .onboarding-stage-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
  }

  .onboarding-stage-pill {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  .onboarding-stage-pill strong {
    display: block;
    color: var(--muted);
    font-size: 11px;
  }

  .onboarding-stage-pill.active {
    border-color: var(--gold-border);
  }

  .onboarding-stage-pill.active strong {
    color: var(--ink);
  }

  .onboarding-stage-pill.done {
    border-color: var(--success-border);
  }

  .onboarding-stage-pill.done strong {
    color: var(--success-text);
  }

  .onboarding-roleplay-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 14px;
  }

  .onboarding-select-field select {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--totemia-gold-soft);
    border-radius: 8px;
    background: #ffffff;
    color: var(--totemia-ink);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    padding: 0 12px;
    cursor: pointer;
    box-shadow: none;
  }

  .onboarding-select-field select.is-empty {
    color: var(--totemia-muted);
  }

  .onboarding-select-field select:focus {
    outline: 3px solid rgba(191, 142, 0, .18);
    border-color: var(--totemia-gold);
    background: #fff;
  }

  .onboarding-select-field select:disabled {
    opacity: .65;
    cursor: not-allowed;
  }

  .onboarding-discord-card {
    margin: 10px 0 0;
  }

  .onboarding-status {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
  }

  .onboarding-status.danger {
    border-color: var(--danger-border);
    background: var(--danger-pale);
    color: var(--danger);
  }

  .onboarding-status.success {
    border-color: var(--success-border);
    background: rgba(21, 128, 61, .08);
    color: var(--success-text);
  }

  @media (max-width: 900px) {
    .personal-role-pref-grid {
      grid-template-columns: 1fr;
    }

    .personal-role-pref-head,
    .personal-role-pref-footer {
      display: grid;
      justify-content: stretch;
    }
  }


  /* Account preferences tab cleanup */
  .personal-settings-tabbar {
    display: flex !important;
    align-items: flex-end !important;
    gap: 0 !important;
  }

  .personal-settings-tabbar button {
    background: transparent !important;
    border: 0 !important;
    border-bottom: 3px solid transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #526176 !important;
    font-size: 12px !important;
    font-weight: 900 !important;
    letter-spacing: .02em !important;
    text-transform: uppercase !important;
    min-height: 42px !important;
    min-width: 102px !important;
    padding: 12px 18px 13px !important;
    margin: 0 0 -1px 0 !important;
  }

  .personal-settings-tabbar button:hover {
    background: rgba(213, 182, 55, .06) !important;
    color: var(--totemia-green) !important;
  }

  .personal-settings-tabbar button.active {
    background: transparent !important;
    color: #9a6b00 !important;
    border-bottom-color: var(--totemia-gold) !important;
  }

  .personal-role-preferences-panel {
    padding: 20px !important;
  }

  .personal-role-pref-head {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid var(--totemia-line) !important;
  }

  .personal-role-pref-head h3 {
    margin: 0 !important;
    color: var(--totemia-ink) !important;
    font-size: 20px !important;
    line-height: 1.1 !important;
    letter-spacing: .02em !important;
  }

  .personal-role-pref-head h3::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 18px;
    margin-right: 8px;
    vertical-align: -3px;
    border-radius: 999px;
    background: var(--totemia-gold);
  }

  .personal-role-pref-head .registry-label,
  .personal-role-pref-head p {
    display: none !important;
  }

  .personal-role-pref-grid {
    align-items: start !important;
    gap: 14px !important;
  }

  .role-pref-field {
    gap: 7px !important;
  }

  .role-pref-field select {
    min-height: 42px !important;
    padding: 9px 12px !important;
  }

  .personal-role-pref-footer {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    margin-top: 16px !important;
    padding-top: 14px !important;
    border-top: 1px solid var(--totemia-line) !important;
  }

  .personal-role-pref-footer span {
    display: none !important;
  }

  #role-preferences-save {
    min-width: 152px !important;
    min-height: 38px !important;
    padding: 9px 16px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 900 !important;
  }

  #role-preferences-save:disabled {
    background: #8a9b91 !important;
    border-color: #8a9b91 !important;
    color: #fff8e6 !important;
    opacity: .75 !important;
    cursor: not-allowed !important;
  }


  /* Economic data number readability */
  .official-stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)) !important;
    gap: 14px !important;
  }

  .official-stat {
    min-width: 0 !important;
  }

  .official-stat strong {
    display: block !important;
    white-space: nowrap !important;
    font-size: clamp(17px, 1.35vw, 22px) !important;
    line-height: 1.12 !important;
    letter-spacing: -0.015em !important;
    font-variant-numeric: tabular-nums !important;
  }

  .official-stat strong.datetime-value {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    font-size: 22px !important;
    line-height: 1.15 !important;
    letter-spacing: 0 !important;
  }

  .official-stat span {
    display: block !important;
    margin-bottom: 8px !important;
  }

  .official-stat small {
    display: block !important;
    margin-top: 7px !important;
  }

  @media (max-width: 900px) {
    .official-stat strong {
      white-space: normal !important;
      overflow-wrap: anywhere !important;
    }
  }


  /* Economic data cards: large-money layout */
  .economic-stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 16px !important;
    align-items: stretch !important;
  }

  .economic-stat-grid .official-stat {
    min-width: 0 !important;
    overflow: hidden !important;
    padding: 18px 20px !important;
  }

  .economic-stat-grid .official-stat span {
    margin-bottom: 9px !important;
    white-space: nowrap !important;
  }

  .economic-stat-grid .official-stat strong.economic-money {
    display: flex !important;
    align-items: baseline !important;
    gap: .18em !important;
    white-space: nowrap !important;
    color: var(--totemia-ink) !important;
    font-size: clamp(24px, 2.1vw, 32px) !important;
    line-height: 1.02 !important;
    letter-spacing: -0.04em !important;
    font-variant-numeric: tabular-nums !important;
    margin: 8px 0 7px !important;
  }

  .economic-money-amount {
    min-width: 0 !important;
  }

  .economic-money-currency {
    flex: 0 0 auto !important;
    font-size: .68em !important;
    letter-spacing: -0.015em !important;
  }

  .economic-stat-grid .official-stat strong.economic-count {
    display: block !important;
    color: var(--totemia-ink) !important;
    font-size: clamp(24px, 2.1vw, 32px) !important;
    line-height: 1.02 !important;
    font-variant-numeric: tabular-nums !important;
    margin: 8px 0 7px !important;
  }

  .economic-stat-grid .official-stat small {
    margin-top: 7px !important;
    line-height: 1.35 !important;
  }

  @media (max-width: 760px) {
    .economic-stat-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
      gap: 12px !important;
    }

    .economic-stat-grid .official-stat {
      padding: 15px !important;
    }

    .economic-stat-grid .official-stat strong.economic-money,
    .economic-stat-grid .official-stat strong.economic-count {
      font-size: clamp(18px, 4.8vw, 25px) !important;
    }
  }

  @media (max-width: 520px) {
    .economic-stat-grid {
      grid-template-columns: 1fr !important;
    }

    .economic-stat-grid .official-stat strong.economic-money,
    .economic-stat-grid .official-stat strong.economic-count {
      font-size: clamp(22px, 7vw, 28px) !important;
    }
  }










  /* ── Ministry of Interior registries ──────────────────────────────────── */

  .interior-workspace-tabs-section {
    border-top: 4px solid var(--totemia-green);
  }

  .interior-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 18px;
    padding-top: 14px;
    border-top: 1px solid var(--totemia-line);
  }

  .interior-tabs button {
    background: #ffffff;
    color: var(--totemia-green);
    border: 1px solid var(--totemia-line);
    box-shadow: none;
  }

  .interior-tabs button.active {
    background: var(--totemia-green);
    color: #fff8e6;
    border-color: var(--totemia-green);
  }

  .interior-tab-panel[hidden],
  .hidden {
    display: none !important;
  }

  .interior-tab-stats {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  .interior-tab-stat {
    border-top-color: var(--totemia-green);
  }

  .interior-tab-stat strong {
    font-size: clamp(30px, 2.4vw, 42px);
    font-weight: 950;
    letter-spacing: -.04em;
  }

  .interior-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 4px;
  }

  .interior-chart-card {
    border: 1px solid var(--totemia-line);
    border-top: 4px solid var(--totemia-gold);
    border-radius: 10px;
    background: #ffffff;
    padding: 12px 14px;
    min-width: 0;
  }

  .interior-chart-card.wide {
    grid-column: 1 / -1;
  }

  .interior-chart-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid #e3e6ea;
    padding-bottom: 6px;
    margin-bottom: 8px;
  }

  .interior-chart-head strong {
    color: var(--totemia-green);
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
  }

  .interior-chart-body {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
  }

  .interior-pie {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(20, 23, 20, .08), 0 10px 24px rgba(42, 35, 23, .08);
  }

  .interior-pie div {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--totemia-paper);
    display: grid;
    place-items: center;
    color: var(--totemia-ink);
    font-size: 28px;
    font-weight: 950;
    box-shadow: 0 0 0 1px rgba(222, 211, 191, .9);
  }

  .interior-chart-legend {
    display: grid;
    gap: 8px;
    min-width: 0;
  }

  .interior-legend-row {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    color: var(--totemia-muted);
    font-size: 12px;
    font-weight: 800;
  }

  .interior-legend-row > span {
    width: 10px;
    height: 10px;
    border-radius: 999px;
  }

  .interior-legend-row > div {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .interior-legend-row strong {
    color: var(--totemia-ink);
    font-size: 12px;
    white-space: nowrap;
  }

  .interior-bar-list {
    display: grid;
    gap: 10px;
  }

  .interior-bar-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(160px, 2fr) 48px;
    gap: 10px;
    align-items: center;
    font-size: 12px;
    font-weight: 800;
  }

  .interior-bar-row > div:first-child {
    color: var(--totemia-ink);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .interior-bar-track {
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    background: #f7f8fa;
    border: 1px solid #e3e6ea;
  }

  .interior-bar-track span {
    display: block;
    height: 100%;
    border-radius: 999px;
  }

  .interior-bar-row strong {
    color: var(--totemia-green);
    text-align: right;
    font-size: 13px;
    font-weight: 950;
  }

  .interior-registry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 10px;
  }

  .interior-registry-card {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
    border: 1px solid var(--totemia-line);
    border-top: 4px solid var(--totemia-gold);
    border-radius: 8px;
    background: #ffffff;
    padding: 12px;
  }

  /* Image marks/covers used to lift off the card with a 0 8px 18px drop
   * shadow + inset highlight while every neighbouring surface was already
   * flattened. Drop the shadows so the cards read as a single, cohesive
   * grid instead of a tray of floating chips. */
  .interior-registry-mark,
  .interior-registry-cover {
    width: 76px;
    height: 76px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: #fff8e6;
    font-size: 16px;
    font-weight: 950;
    letter-spacing: .04em;
    object-fit: cover;
    background: var(--totemia-green);
    box-shadow: none;
  }

  .interior-registry-card h3 {
    margin: 4px 0 6px;
    color: var(--totemia-ink);
    font-size: 17px;
    line-height: 1.2;
  }

  .interior-registry-card p {
    margin: 0 0 12px;
    color: var(--totemia-muted);
    font-size: 13px;
    font-weight: 800;
  }

  .interior-registry-editor {
    border: 1px solid var(--totemia-line);
    border-top: 4px solid var(--totemia-gold);
    border-radius: 14px;
    background: #ffffff;
    padding: 18px;
  }

  .interior-registry-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .interior-registry-form-grid label {
    display: grid;
    gap: 6px;
  }

  .interior-registry-form-grid label span {
    color: var(--totemia-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .09em;
    text-transform: uppercase;
  }

  .interior-upload-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    margin-top: 16px;
    padding: 16px;
    border: 1px dashed var(--totemia-gold);
    border-radius: 14px;
    background: #ffffff;
    cursor: pointer;
  }

  .interior-upload-card:hover {
    background: #fff4da;
  }

  .interior-upload-card input {
    display: none;
  }

  .interior-upload-icon {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--totemia-green);
    color: #fff8e6;
  }

  .interior-upload-icon svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .interior-upload-card strong {
    display: block;
    color: var(--totemia-ink);
    font-size: 16px;
    font-weight: 950;
  }

  .interior-upload-card span {
    display: block;
    margin-top: 4px;
    color: var(--totemia-muted);
    font-size: 13px;
    line-height: 1.35;
  }

  .interior-upload-progress {
    margin-top: 10px;
    color: var(--totemia-green);
    font-size: 12px;
    font-weight: 900;
  }

  .interior-registry-preview {
    margin-top: 14px;
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    border: 1px solid var(--totemia-line);
    border-radius: 12px;
    background: #ffffff;
  }

  .interior-fund-card {
    border-top-color: var(--totemia-green);
  }

  @media (max-width: 900px) {
    .interior-chart-grid {
      grid-template-columns: 1fr;
    }

    .interior-chart-body {
      grid-template-columns: 1fr;
      justify-items: center;
    }

    .interior-chart-legend {
      width: 100%;
    }

    .interior-bar-row {
      grid-template-columns: 1fr;
      gap: 6px;
    }

    .interior-bar-row strong {
      text-align: left;
    }
  }


  @media (max-width: 640px) {
    .interior-registry-card,
    .interior-upload-card {
      grid-template-columns: 1fr;
    }
  }


  .interior-upload-bar {
    position: relative;
    width: 100%;
    height: 10px;
    margin-bottom: 7px;
    border-radius: 999px;
    overflow: hidden;
    background: #eadfca;
    border: 1px solid #ddcba8;
  }

  .interior-upload-bar span {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background:
      linear-gradient(90deg, var(--totemia-green), var(--totemia-green-2)),
      repeating-linear-gradient(45deg, rgba(255,255,255,.25) 0 8px, transparent 8px 16px);
    background-blend-mode: overlay;
    transition: width .22s ease;
    animation: interiorUploadPulse 1s linear infinite;
  }

  .interior-upload-progress strong {
    color: var(--totemia-green);
    font-size: 12px;
    font-weight: 900;
  }

  @keyframes interiorUploadPulse {
    from { filter: brightness(1); }
    50% { filter: brightness(1.12); }
    to { filter: brightness(1); }
  }


  /* Smart Interior registry image fitting */
  .interior-registry-cover {
    object-fit: contain !important;
    object-position: center !important;
    padding: 7px;
    background:
      radial-gradient(circle at center, rgba(255,255,255,.82), rgba(255,250,240,.96)),
      #ffffff;
  }

  .interior-registry-cover.fit-square.fit-cover {
    object-fit: cover !important;
    padding: 0;
  }

  .interior-registry-cover.fit-wide,
  .interior-registry-cover.fit-tall {
    object-fit: contain !important;
    padding: 8px;
  }

  .interior-registry-cover.fit-wide {
    background:
      linear-gradient(135deg, rgba(18,60,50,.055), rgba(213,182,55,.08)),
      #ffffff;
  }

  .interior-registry-cover.fit-tall {
    background:
      linear-gradient(135deg, rgba(213,182,55,.08), rgba(18,60,50,.055)),
      #ffffff;
  }

  .interior-registry-preview {
    object-fit: contain !important;
    background:
      radial-gradient(circle at center, rgba(255,255,255,.9), rgba(255,250,240,.98)),
      #ffffff;
  }

  .interior-registry-preview.fit-square.fit-cover {
    object-fit: contain !important;
  }




  /* ── Interior flat editor + square toast ──────────────────────────────── */

  .interior-registry-editor {
    border: 0 !important;
    border-top: 4px solid var(--totemia-gold) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 18px 0 0 !important;
  }

  .interior-registry-editor::before {
    display: none !important;
  }

  .interior-registry-editor > * {
    position: static !important;
  }

  .interior-registry-form-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .interior-registry-form-grid label {
    display: grid !important;
    gap: 6px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .interior-registry-form-grid label:focus-within {
    border: 0 !important;
    box-shadow: none !important;
  }

  .interior-registry-form-grid label span,
  .interior-preview-head span {
    color: var(--totemia-muted) !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    letter-spacing: .08em !important;
    text-transform: uppercase !important;
  }

  .interior-registry-editor input,
  .interior-registry-editor textarea {
    border: 1px solid var(--totemia-line) !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    color: var(--totemia-ink) !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.45 !important;
    padding: 10px 11px !important;
  }

  .interior-registry-editor input:focus,
  .interior-registry-editor textarea:focus {
    border-color: var(--totemia-gold) !important;
    outline: 1px solid var(--totemia-gold) !important;
    box-shadow: none !important;
  }

  .interior-registry-editor textarea {
    height: 96px !important;
    min-height: 96px !important;
    max-height: 96px !important;
    resize: none !important;
    overflow: hidden !important;
  }

  .interior-char-count {
    display: flex !important;
    justify-content: flex-end !important;
    margin-top: 2px !important;
    color: var(--totemia-muted) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
  }

  .interior-upload-card {
    margin-top: 14px !important;
    display: grid !important;
    grid-template-columns: 46px minmax(0, 1fr) !important;
    gap: 12px !important;
    align-items: center !important;
    padding: 12px !important;
    border: 1px solid var(--totemia-line) !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    cursor: pointer !important;
  }

  .interior-upload-card:hover {
    transform: none !important;
    border-color: var(--totemia-gold) !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  .interior-upload-icon {
    width: 46px !important;
    height: 46px !important;
    border-radius: 0 !important;
    background: var(--totemia-green) !important;
    color: #ffffff !important;
    box-shadow: none !important;
  }

  .interior-upload-icon svg {
    width: 25px !important;
    height: 25px !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2.2 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
  }

  .interior-upload-card strong {
    display: block !important;
    color: var(--totemia-ink) !important;
    font-size: 14px !important;
    font-weight: 900 !important;
  }

  .interior-upload-card span {
    display: block !important;
    margin-top: 3px !important;
    color: var(--totemia-muted) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
  }

  .interior-upload-progress {
    margin-top: 10px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .interior-upload-bar {
    height: 7px !important;
    border: 1px solid var(--totemia-line) !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    overflow: hidden !important;
  }

  .interior-upload-bar span {
    display: block !important;
    height: 100% !important;
    background: var(--totemia-gold) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    animation: none !important;
    transition: width .18s linear !important;
  }

  .interior-upload-progress strong {
    display: block !important;
    margin-top: 5px !important;
    color: var(--totemia-green) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
  }

  #interior-registry-preview-wrap {
    margin-top: 14px !important;
  }

  .interior-preview-head {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 8px !important;
  }

  .interior-registry-preview {
    width: 100% !important;
    max-height: 210px !important;
    object-fit: contain !important;
    border: 1px solid var(--totemia-line) !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    padding: 10px !important;
    box-shadow: none !important;
  }

  .interior-image-removal-pending {
    border: 1px solid var(--totemia-line) !important;
    border-left: 5px solid var(--totemia-gold) !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    color: var(--totemia-ink) !important;
    padding: 12px !important;
    box-shadow: none !important;
  }

  .danger-soft {
    color: #7a241d !important;
    border: 1px solid rgba(159, 47, 36, .38) !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
  }

  .danger-soft:hover {
    background: #ffffff !important;
    border-color: var(--totemia-red) !important;
  }

  .interior-toast {
    position: fixed !important;
    top: 18px !important;
    right: 18px !important;
    bottom: auto !important;
    z-index: 99999 !important;

    display: grid !important;
    grid-template-columns: 58px minmax(0, 1fr) 32px !important;
    gap: 0 !important;

    width: min(430px, calc(100vw - 36px)) !important;
    min-height: 68px !important;
    padding: 0 !important;

    border: 1px solid var(--totemia-gold) !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    overflow: hidden !important;

    transform: translateX(10px) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity .12s linear, transform .12s linear !important;
  }

  .interior-toast.show {
    transform: translateX(0) !important;
    opacity: 1 !important;
  }

  .interior-toast-mark {
    width: 58px !important;
    height: 100% !important;
    min-height: 68px !important;
    border-radius: 0 !important;
    background: var(--totemia-gold) !important;
    box-shadow: none !important;
  }

  .interior-toast > div:not(.interior-toast-mark) {
    padding: 14px 16px !important;
    background: #ffffff !important;
  }

  .interior-toast-close {
    position: absolute !important;
    top: 10px !important;
    right: 8px !important;
    display: grid !important;
    width: 28px !important;
    height: 28px !important;
    min-height: 0 !important;
    place-items: center !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--totemia-ink, #1f2229) !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    opacity: .55 !important;
    pointer-events: auto !important;
  }
  .interior-toast-close:hover { opacity: 1 !important; }
  .interior-toast.show { pointer-events: auto !important; }

  .interior-toast > div:not(.interior-toast-mark) > strong:first-child {
    display: block !important;
    margin: 0 0 4px !important;
    color: var(--totemia-ink) !important;
    font-size: 14px !important;
    font-weight: 900 !important;
    line-height: 1.2 !important;
  }

  .interior-toast span {
    display: block !important;
    color: var(--totemia-ink) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
  }

  .interior-toast.error {
    border-color: var(--totemia-red) !important;
    background: #ffffff !important;
  }

  .interior-toast.error .interior-toast-mark {
    background: var(--totemia-gold) !important;
  }

  .interior-toast.error strong {
    color: #7a241d !important;
  }

  @media (max-width: 640px) {
    .interior-toast {
      top: 10px !important;
      right: 10px !important;
      width: calc(100vw - 20px) !important;
      grid-template-columns: 48px minmax(0, 1fr) !important;
    }

    .interior-toast-mark {
      width: 48px !important;
    }

    .interior-upload-card {
      grid-template-columns: 1fr !important;
    }
  }


  /* ── Flat official toast override ─────────────────────────────────────── */

  .interior-toast {
    position: fixed !important;
    top: 76px !important;
    right: 18px !important;
    bottom: auto !important;
    z-index: 99999 !important;

    display: block !important;
    width: min(430px, calc(100vw - 36px)) !important;
    min-height: 54px !important;
    padding: 0 !important;

    border: 1px solid var(--totemia-gold) !important;
    border-radius: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    overflow: hidden !important;

    transform: translateX(8px) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity .12s linear, transform .12s linear !important;
  }

  .interior-toast.show {
    transform: translateX(0) !important;
    opacity: 1 !important;
  }

  .interior-toast-mark {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 6px !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    background: var(--totemia-gold) !important;
    box-shadow: none !important;
    transform-origin: left center !important;
  }

  .interior-toast.show .interior-toast-mark {
    animation: interiorToastTimer 3.2s linear forwards !important;
  }

  .interior-toast > div:not(.interior-toast-mark) {
    min-width: 0 !important;
    padding: 14px 44px 12px 15px !important;
    background: #ffffff !important;
    overflow-wrap: anywhere !important;
  }

  .interior-toast > div:not(.interior-toast-mark) > strong:first-child {
    display: block !important;
    margin: 0 0 3px !important;
    color: var(--totemia-ink) !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.15 !important;
  }

  .interior-toast span {
    display: block !important;
    color: var(--totemia-ink) !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    line-height: 1.3 !important;
  }

  .interior-toast .interior-toast-action {
    color: #241d18 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
  }

  .interior-toast .interior-toast-delete-word {
    display: inline !important;
    color: #9a241d !important;
    font-size: inherit !important;
    font-weight: 800 !important;
  }

  .interior-toast .interior-toast-entity-name {
    display: block !important;
    margin: 2px 0 1px !important;
    color: #050503 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.18 !important;
  }

  .interior-toast .interior-toast-entity-name.old {
    color: #6b5540 !important;
  }

  .interior-toast .interior-toast-entity-name.new {
    color: #123c32 !important;
  }

  .interior-toast .interior-toast-name-change-copy {
    color: #7c6218 !important;
    font-weight: 600 !important;
  }

  .interior-toast.error {
    border-color: var(--totemia-gold) !important;
    background: #ffffff !important;
  }

  .interior-toast.error .interior-toast-mark {
    background: var(--totemia-gold) !important;
  }

  .interior-toast.error strong {
    color: #7a241d !important;
  }

  @keyframes interiorToastTimer {
    from {
      transform: scaleX(1);
    }
    to {
      transform: scaleX(0);
    }
  }

  @media (max-width: 640px) {
    .interior-toast {
      top: 70px !important;
      right: 10px !important;
      width: calc(100vw - 20px) !important;
    }
  }


  /* ── Interior grouped navigation and staff directory ──────────────────── */

  .interior-group-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 10px;
    padding-top: 14px;
    border-top: 1px solid var(--totemia-line);
  }

  .interior-group-tabs button {
    background: #ffffff !important;
    color: var(--totemia-green) !important;
    border: 1px solid var(--totemia-line) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-weight: 900;
  }

  .interior-group-tabs button.active {
    background: var(--totemia-green) !important;
    color: #ffffff !important;
    border-color: var(--totemia-green) !important;
  }

  .interior-tabs {
    border-top: 0 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  .interior-staff-directory {
    display: grid;
    gap: 18px;
  }

  .interior-staff-ladder {
    display: grid;
    gap: 18px;
  }

  .interior-staff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-top: 8px;
  }

  .interior-staff-card {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    border: 1px solid var(--totemia-line);
    border-top: 4px solid var(--staff-role-color, var(--totemia-gold));
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
    padding: 14px;
  }

  .interior-staff-card.empty {
    border-top-color: var(--totemia-line);
  }

  .interior-staff-avatar {
    width: 82px;
    height: 82px;
    object-fit: cover;
    border: 1px solid var(--totemia-line);
    border-radius: 0;
    background: #ffffff;
  }

/* ── Modern popup notifier (rebuilt) ─────────────────────────────────────
   The thin top-right toast with a colored status rail, bold title +
   detailed message, close button, and a timer line that dissolves across
   the bottom until auto-dismiss. Rendered by the shared PortalToastStack
   (src/app/_components/PortalToasts.tsx) and used by the org workspaces
   and the Ministry of Interior. These rules deliberately come last and
   use !important to supersede the legacy flat-toast blocks above. */

.interior-toast-stack {
  position: fixed;
  top: 76px;
  right: 18px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(400px, calc(100vw - 28px));
  pointer-events: none;
}

.interior-toast-stack .interior-toast {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;

  display: grid !important;
  grid-template-columns: 8px minmax(0, 1fr) 28px !important;
  gap: 0 !important;
  align-items: stretch !important;

  width: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;

  border: 1px solid var(--totemia-line, #e6e0d2) !important;
  border-radius: 4px !important;
  background: #ffffff !important;
  box-shadow: 0 8px 22px rgba(18, 24, 21, .14) !important;
  overflow: hidden !important;

  opacity: 1 !important;
  transform: none !important;
  pointer-events: auto !important;
  animation: interior-toast-in .16s ease-out;
}

@keyframes interior-toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Thick bold status rail. animation: none kills the legacy
   `.interior-toast.show .interior-toast-mark` scaleX timer (the old flat
   toast reused the mark as its timer line) — without it the rail shrinks
   away after 3.2s and the toast loses its colored band mid-display. The
   .show variant is listed explicitly because !important conflicts resolve
   by specificity, not order, and the legacy selector carries 3 classes. */
.interior-toast-stack .interior-toast-mark,
.interior-toast-stack .interior-toast.show .interior-toast-mark {
  width: 8px !important;
  height: auto !important;
  min-height: 0 !important;
  border-radius: 0 !important;
  background: var(--totemia-gold, #c4981f) !important;
  box-shadow: none !important;
  animation: none !important;
  transform: none !important;
}

/* Selectors carry `.interior-toast` so they out-rank the legacy
   `.interior-toast > div:not(.interior-toast-mark)` !important blocks
   above (specificity decides !important ties, not source order). */
.interior-toast-stack .interior-toast .interior-toast-body {
  padding: 9px 12px 12px !important;
  background: #ffffff !important;
  min-width: 0;
}

.interior-toast-stack .interior-toast .interior-toast-body > strong:first-child {
  display: block !important;
  margin: 0 0 1px !important;
  color: var(--totemia-ink, #1f2229) !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  letter-spacing: .02em;
  line-height: 1.25 !important;
}

.interior-toast-stack .interior-toast .interior-toast-body span {
  display: block !important;
  color: var(--totemia-muted, #5d564a) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
  overflow-wrap: anywhere;
}

.interior-toast-stack .interior-toast-close {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  align-self: start;
  display: grid !important;
  width: 28px !important;
  height: 28px !important;
  min-height: 0 !important;
  place-items: center !important;
  margin: 2px 0 0;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--totemia-ink, #1f2229) !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  cursor: pointer !important;
  opacity: .5 !important;
  box-shadow: none !important;
  transform: none !important;
}
.interior-toast-stack .interior-toast-close:hover { opacity: 1 !important; }

/* The dissolving timer line. Duration is set inline per toast. */
.interior-toast-stack .interior-toast-timer {
  position: absolute;
  left: 8px;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--totemia-gold, #c4981f);
  transform-origin: left center;
  animation-name: interior-toast-timer;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes interior-toast-timer {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* Tone variants: rail + timer line pick up the status color. Success and
   info read imperial gold (the empire accent), errors read red. */
.interior-toast-stack .interior-toast.tone-success .interior-toast-mark,
.interior-toast-stack .interior-toast.tone-success .interior-toast-timer,
.interior-toast-stack .interior-toast.tone-info .interior-toast-mark,
.interior-toast-stack .interior-toast.tone-info .interior-toast-timer {
  background: var(--totemia-gold, #c4981f) !important;
}
.interior-toast-stack .interior-toast.tone-error .interior-toast-mark,
.interior-toast-stack .interior-toast.tone-error .interior-toast-timer {
  background: var(--totemia-red, #9f2f24) !important;
}
.interior-toast-stack .interior-toast.tone-error .interior-toast-body strong {
  color: #7a241d !important;
}

@media (prefers-reduced-motion: reduce) {
  .interior-toast-stack .interior-toast { animation: none; }
  .interior-toast-stack .interior-toast-timer { animation: none; transform: scaleX(1); }
}

@media (max-width: 640px) {
  .interior-toast-stack {
    top: 64px;
    right: 10px;
    width: calc(100vw - 20px);
  }
}

  .interior-staff-avatar.fallback {
    display: grid;
    place-items: center;
    color: #ffffff;
    background: var(--totemia-green);
    font-size: 18px;
    font-weight: 900;
  }

  .interior-staff-card h3 {
    margin: 4px 0 4px;
    color: var(--totemia-ink);
    font-size: 18px;
    line-height: 1.15;
  }

  .interior-staff-card p {
    margin: 0 0 10px;
    color: var(--totemia-muted);
    font-size: 12px;
    font-weight: 800;
  }

  .interior-staff-editor {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(220px, .8fr) auto;
    gap: 12px;
    align-items: end;
    border: 1px solid var(--totemia-line);
    border-left: 5px solid var(--totemia-gold);
    border-radius: 0;
    background: #ffffff;
    padding: 14px;
    box-shadow: none;
  }

  .interior-staff-editor h3 {
    margin: 4px 0;
    color: var(--totemia-ink);
    font-size: 16px;
  }

  .interior-staff-editor p {
    margin: 0;
    color: var(--totemia-muted);
    font-size: 12px;
    font-weight: 800;
  }

  .interior-staff-editor select {
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  @media (max-width: 780px) {
    .interior-staff-editor {
      grid-template-columns: 1fr;
    }

    .interior-staff-card {
      grid-template-columns: 70px minmax(0, 1fr);
    }

    .interior-staff-avatar {
      width: 70px;
      height: 70px;
    }
  }

  /* ── Party Leader card on the political-party detail panel ──────────── */
  .interior-leader-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin: 14px 0 20px;
    border: 1px solid var(--totemia-line);
    border-left: 5px solid var(--party-accent-color, var(--totemia-gold));
    border-radius: 12px;
    background: #ffffff;
    padding: 16px;
  }

  .interior-party-brief {
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    margin: 12px 0 14px;
    border: 1px solid var(--totemia-line);
    border-left: 5px solid var(--party-accent-color, var(--totemia-gold));
    border-radius: 12px;
    background: #ffffff;
    padding: 14px;
  }

  .interior-party-brief-img,
  .interior-party-brief-mark {
    width: 148px;
    aspect-ratio: 16 / 10;
    border: 1px solid var(--totemia-line);
    border-radius: 8px;
    background: #f7f8fa;
  }

  /* Show the whole emblem (party logos are often wordmarks that crop badly
     under object-fit: cover). */
  .interior-party-brief-img {
    object-fit: contain;
    padding: 4px;
  }

  .interior-party-brief-mark {
    display: grid;
    place-items: center;
    color: var(--totemia-green);
    font-size: 28px;
    font-weight: 900;
  }

  .interior-party-brief h3 {
    margin: 3px 0 6px;
    color: var(--totemia-ink);
    font-size: 20px;
    line-height: 1.15;
  }

  .interior-party-brief p {
    margin: 0;
    color: var(--totemia-muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
  }

  .interior-leader-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 6px;
  }

  .interior-leader-row .public-member-name { flex: 1; min-width: 0; }
  .interior-leader-row .public-member-name strong { font-size: 16px; }

  /* Leader badge sits beside the (now clickable) member identity in the roster. */
  .interior-member-leader-badge {
    margin-left: 10px;
    vertical-align: middle;
  }

  .interior-leader-editor {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(220px, .8fr) auto;
    gap: 12px;
    align-items: end;
    border-top: 1px dashed var(--totemia-line);
    padding-top: 14px;
  }
  .interior-leader-editor h3 {
    margin: 4px 0;
    color: var(--totemia-ink);
    font-size: 14px;
  }
  .interior-leader-editor p {
    margin: 0;
    color: var(--totemia-muted);
    font-size: 12px;
  }
  @media (max-width: 780px) {
    .interior-leader-editor { grid-template-columns: 1fr; }

    .interior-party-brief {
      grid-template-columns: 1fr;
    }
  }


  /* ── Interior workspace sidebar layout ──────────────────────────────── */

  .interior-workspace-shell {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
    margin-bottom: 14px;
  }

  /* Flat left-rail index — modern bold treatment. No rounded card, no boxed
     active pill. The active row is a thick accent left-bar flag (same family
     as .org-status-flag / the banking redesign), auto-themed per ministry via
     --ministry-accent set on the shell scope. */
  .interior-sidebar-nav {
    position: sticky;
    top: calc(var(--masthead-h, 56px) + 60px);
    display: grid;
    gap: 1px;
    min-width: 0;
    padding: 0;
    border: 0;
    border-left: 2px solid var(--totemia-line);
    border-radius: 0;
    background: transparent;
  }

  .interior-sidebar-nav button,
  .interior-sidebar-nav a {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    margin-left: -2px;
    border: 0 !important;
    border-left: 2px solid transparent !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--totemia-muted) !important;
    font: inherit;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none !important;
    transition: color .12s ease, background .12s ease, border-color .12s ease;
  }

  .interior-sidebar-nav button:hover,
  .interior-sidebar-nav a:hover {
    color: var(--totemia-ink) !important;
    background: rgba(18, 60, 50, .045) !important;
    border-left-color: color-mix(in srgb, var(--ministry-accent, var(--totemia-green)) 40%, transparent) !important;
    transform: none;
    text-decoration: none;
  }

  .interior-sidebar-nav button.active,
  .interior-sidebar-nav a.active {
    color: var(--ministry-accent, var(--totemia-green)) !important;
    background: color-mix(in srgb, var(--ministry-accent, var(--totemia-green)) 9%, transparent) !important;
    border-left: 4px solid var(--ministry-accent, var(--totemia-gold)) !important;
    font-weight: 900;
  }

  .interior-workspace-content {
    min-width: 0;
  }

  @media (max-width: 820px) {
    .interior-workspace-shell {
      grid-template-columns: 1fr;
      gap: 10px;
    }

    .interior-sidebar-nav {
      position: static;
      display: flex;
      overflow-x: auto;
      overflow-y: hidden;
      -webkit-overflow-scrolling: touch;
      gap: 2px;
      padding: 0;
      border: 0;
      border-left: 0;
      border-bottom: 2px solid var(--totemia-line);
      border-radius: 0;
      /* Swipe-scroll on mobile, but never render the scrollbar gutter — the
         overlapping active-tab border (margin-bottom) used to force a
         phantom vertical scroll thumb on this strip. */
      scrollbar-width: none;
      -ms-overflow-style: none;
    }

    .interior-sidebar-nav::-webkit-scrollbar {
      display: none;
    }

    .interior-sidebar-nav button,
    .interior-sidebar-nav a {
      flex: 0 0 auto;
      min-height: 40px;
      margin-left: 0;
      white-space: nowrap;
      text-align: center;
      padding: 0 14px;
      border-left: 0 !important;
      border-bottom: 3px solid transparent !important;
      margin-bottom: 0;
      border-radius: 0 !important;
    }

    .interior-sidebar-nav button.active,
    .interior-sidebar-nav a.active {
      border-left: 0 !important;
      border-bottom-color: var(--ministry-accent, var(--totemia-gold)) !important;
    }
  }

  .interior-workspace-content form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    align-items: end;
  }

  .interior-workspace-content form label {
    display: grid;
    gap: 6px;
    min-width: 0;
  }

  .interior-workspace-content form label span {
    color: var(--totemia-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .interior-workspace-content form input,
  .interior-workspace-content form select {
    min-height: 40px;
    border-radius: 6px;
    box-shadow: none;
  }

  .interior-workspace-content form .record-actions.compact {
    margin-top: 0;
  }

  .interior-workspace-content .economic-chart-row .chart-block {
    border-color: var(--totemia-line);
    box-shadow: none;
  }

  .interior-group-tabs,
  .interior-tabs {
    display: none !important;
  }


  /* ── Interior missing-image fallback ──────────────────────────────────── */

  .interior-registry-mark {
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    border: 1px solid var(--totemia-line);
    border-radius: 8px;
    background: var(--totemia-green);
    color: #ffffff;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: .04em;
    box-shadow: none;
  }

  .interior-access-empty-warning {
    border-radius: 0 !important;
    box-shadow: none !important;
  }


  /* ── Interior long description editor ─────────────────────────────────── */

  .interior-registry-editor textarea {
    height: 210px !important;
    min-height: 210px !important;
    max-height: 260px !important;
    resize: none !important;
    overflow-y: auto !important;
  }


  /* ── Interior long registry description editor ─────────────────────────── */

  .interior-registry-editor textarea#interior-registry-description {
    height: 230px !important;
    min-height: 230px !important;
    max-height: 280px !important;
    resize: none !important;
    overflow-y: auto !important;
  }


  /* ── Interior permanent delete modal ──────────────────────────────────── */

  .interior-delete-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(15, 18, 14, .42);
  }

  .interior-delete-panel {
    width: min(520px, 100%);
    display: grid;
    gap: 14px;
    border: 1px solid var(--totemia-line);
    border-top: 6px solid var(--totemia-gold);
    border-radius: 0;
    background: #ffffff;
    padding: 20px;
    box-shadow: none;
  }

  .interior-delete-panel h2 {
    margin: 0;
    color: var(--totemia-ink);
    font-size: 22px;
    line-height: 1.15;
  }

  .interior-delete-word {
    color: #9a241d;
    font-weight: 900;
  }

  .interior-delete-panel p {
    margin: 0;
    color: #302821;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.5;
  }

  .interior-delete-target-name {
    display: inline;
    color: #080806;
    font-size: 14px;
    font-weight: 900;
    background: #fff2bf;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    padding: 1px 3px;
  }

  .interior-delete-panel label {
    display: grid;
    gap: 6px;
  }

  .interior-delete-panel label span {
    color: var(--totemia-muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .interior-delete-panel input {
    border: 1px solid var(--totemia-line);
    border-radius: 0;
    background: #ffffff;
    color: var(--totemia-ink);
    font-size: 14px;
    font-weight: 800;
    padding: 10px 11px;
    box-shadow: none;
    outline: none;
  }

  .interior-delete-panel input:focus {
    border-color: var(--totemia-gold);
    outline: 1px solid var(--totemia-gold);
  }

  .interior-delete-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: stretch;
    gap: 10px;
    margin-top: 4px;
  }

  /* Both actions share one height/shape so Cancel (secondary <button>) and the
     red Delete button line up cleanly on desktop and stack evenly on mobile. */
  .interior-delete-actions > button {
    margin: 0 !important;
    min-height: 38px;
    padding: 9px 16px;
    border-radius: 2px;
    font-weight: 800;
    font-size: 13px;
  }

  .danger-delete {
    background: #7a241d !important;
    border-color: #7a241d !important;
    color: #ffffff !important;
  }

  /* Shared confirm dialog (src/app/_components/ConfirmDialog.tsx): the org
     variant picks up the branded accent for its top bar; destructive
     confirmations switch the bar to the imperial red. */
  .interior-delete-panel.org-confirm-panel {
    border-top-color: var(--party-accent-color, var(--totemia-gold));
  }

  .interior-delete-panel.org-confirm-panel.danger {
    border-top-color: var(--totemia-red, #9f2f24);
  }

  @media (max-width: 640px) {
    .interior-delete-actions {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
    }

    /* Full-width stacked buttons, Cancel then Delete (matches the desktop
       left-to-right order). */
    .interior-delete-actions > button {
      width: 100%;
      margin: 0 !important;
    }
  }


  /* ── Interior registry card cleanup ───────────────────────────────────── */

  .interior-registry-card {
    min-height: 128px !important;
    align-items: start !important;
  }

  .interior-registry-card h3 {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    min-height: 30px !important;
    font-size: 15px !important;
    line-height: 1.15 !important;
  }

  .interior-registry-member-count {
    margin: 3px 0 0 !important;
    color: var(--totemia-ink) !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
  }

  .interior-registry-description-preview {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    margin: 5px 0 0 !important;
    color: var(--totemia-muted) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
  }

  .interior-registry-card .record-actions.compact {
    margin-top: 10px !important;
  }


  /* ── Imperial banking (My Banking page) ─────────────────────────────────
   * Continuous-flow layout. One header card with the balance, a primary
   * Send Funds CTA underneath, then tabbed content. No ministry seal, no
   * giant centered balance, no separate stats tiles. */

  .banking-account-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 22px;
    background: #ffffff;
    border: 1px solid var(--totemia-line);
    border-top: 3px solid var(--totemia-gold);
    border-radius: 12px;
    margin-bottom: 14px;
  }
  .banking-account-identity {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .banking-account-eyebrow {
    color: var(--totemia-muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
  }
  .banking-account-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .banking-account-number {
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--totemia-ink);
  }
  .banking-account-divider {
    color: var(--totemia-line);
    font-weight: 900;
  }
  .banking-account-name {
    color: var(--totemia-green);
    font-weight: 800;
    font-size: 14px;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .banking-account-status {
    margin-left: 4px;
  }
  .banking-account-balance {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    text-align: right;
  }
  .banking-account-balance-label {
    color: var(--totemia-muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
  }
  .banking-account-balance-value {
    font-family: var(--sans);
    font-size: 30px;
    line-height: 1.05;
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: var(--num-feat);
    letter-spacing: -0.02em;
    color: var(--totemia-green);
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .banking-action-row {
    display: flex;
    margin-bottom: 18px;
  }
  .banking-primary-btn {
    border: 0;
    border-radius: 8px;
    background: var(--totemia-green);
    color: #ffffff;
    padding: 12px 22px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .02em;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
  }
  .banking-primary-btn:hover:not(:disabled) {
    background: var(--totemia-green-2);
  }
  .banking-primary-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
  }
  .banking-primary-btn-open {
    background: #ffffff;
    color: var(--totemia-green);
    border: 1px solid var(--totemia-line);
  }
  .banking-primary-btn-open:hover:not(:disabled) {
    background: rgba(213, 182, 55, .08);
  }

  .banking-tab-bar {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--totemia-line);
    margin-bottom: 14px;
  }
  .banking-tab {
    border: 0;
    background: transparent;
    color: var(--totemia-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .02em;
    padding: 10px 16px;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: color .12s ease, border-color .12s ease;
  }
  .banking-tab:hover {
    color: var(--totemia-green);
  }
  .banking-tab.active {
    color: var(--totemia-green);
    border-bottom-color: var(--totemia-gold);
  }

  .banking-overview-section {
    background: #ffffff;
    border: 1px solid var(--totemia-line);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 14px;
  }
  .banking-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
  }
  .banking-section-eyebrow {
    color: var(--totemia-muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
    margin-bottom: 10px;
  }
  .banking-section-head .banking-section-eyebrow {
    margin-bottom: 0;
  }
  .banking-section-meta {
    color: var(--totemia-muted);
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
  }
  .banking-link-btn {
    border: 0;
    background: transparent;
    color: var(--totemia-green);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 0;
  }
  .banking-link-btn:hover {
    color: var(--totemia-gold);
  }

  .banking-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--totemia-line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--totemia-green);
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
    padding: 8px 12px;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
  }
  .banking-export-btn:hover {
    background: rgba(213, 182, 55, .08);
    border-color: var(--totemia-gold);
    color: var(--totemia-green);
  }
  .banking-export-btn svg {
    color: var(--totemia-gold);
    flex-shrink: 0;
  }

  .banking-overview-section #chart-banking-history {
    min-height: 280px;
  }

  .banking-empty-state {
    padding: 22px;
    text-align: center;
    color: var(--totemia-muted);
    background: #ffffff;
    border: 1px dashed var(--totemia-line);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
  }

  /* Imperial transaction table cells */
  .public-ledger-table .tx-date {
    color: var(--totemia-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .public-ledger-table .tx-reason {
    color: var(--totemia-muted);
    font-size: 11px;
    font-weight: 600;
    margin-top: 3px;
    line-height: 1.35;
  }

  /* Paid role inside a transaction reason — bold and tinted with the role's
     own color (Discord salary roles, party/religion payroll roles). Falls
     back to government green when a movement carries no role color. */
  .tx-role-name {
    color: var(--role-color, var(--totemia-green, #123c32));
    font-weight: 900;
  }

  .public-ledger-table .tx-type {
    display: inline-block;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .14em;
    padding: 4px 9px;
    border-radius: 4px;
    background: #eef0f3;
    color: #6e5e2e;
    border: 1px solid var(--totemia-gold-soft);
  }

  .tx-direction-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--totemia-line);
  }

  .tx-direction-pill.in {
    background: #e8f1ea;
    color: #1f5b3b;
    border-color: #cce0c8;
  }

  .interior-staff-compact-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
    gap: 10px !important;
  }

  .interior-staff-compact-card {
    min-height: 0 !important;
    grid-template-columns: 56px minmax(0, 1fr) !important;
    gap: 12px !important;
    align-items: center !important;
    padding: 12px !important;
  }

  .interior-staff-profile-img {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--gold-tint);
    color: var(--gold-deep);
    object-fit: cover;
    font-size: 12px;
    font-weight: 900;
  }

  .interior-staff-compact-card h3 {
    margin: 0 0 4px !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
    letter-spacing: .08em !important;
  }

  .interior-staff-compact-card p {
    margin: 0 0 6px !important;
    font-size: 12px !important;
    line-height: 1.3 !important;
  }

  @media (max-width: 640px) {
    .interior-staff-compact-grid {
      grid-template-columns: 1fr !important;
    }
  }

  .tx-direction-pill.out {
    background: #f7e8e3;
    color: #913025;
    border-color: #e3c6bd;
  }

  .public-ledger-table .tx-amount-cell {
    text-align: right;
    white-space: nowrap;
  }

  .public-ledger-table .tx-amount {
    font-weight: 800;
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: var(--num-feat);
    font-size: 14px;
    font-family: var(--sans);
    letter-spacing: -0.01em;
  }

  .public-ledger-table .tx-amount.in {
    color: #1f5b3b;
  }

  .public-ledger-table .tx-amount.out {
    color: var(--totemia-red);
  }

  .my-banking-transfer-panel {
    background: #ffffff;
    border: 1px solid var(--totemia-line);
    border-radius: 12px;
    padding: 20px 22px;
    margin-top: 18px;
  }

  .transfer-from-display {
    background: #f7f8fa;
    border: 1px solid var(--totemia-gold-soft);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 14px;
  }

  .transfer-from-label {
    color: var(--totemia-muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
    margin-bottom: 4px;
  }

  .transfer-from-value {
    color: var(--totemia-green);
    font-size: 14px;
    font-weight: 800;
  }

  /* ── Mobile continuity fixes ──────────────────────────────────────────── */

  @media (max-width: 640px) {
    html,
    body {
      max-width: 100%;
      overflow-x: hidden;
    }

    .masthead {
      min-height: var(--masthead-h);
      height: auto !important;
      padding: 6px 10px !important;
      gap: 8px !important;
      overflow: hidden;
    }

    .masthead-brand,
    .masthead-wordmark,
    .masthead-user,
    .masthead-profile {
      min-width: 0;
    }

    .masthead-brand {
      gap: 8px !important;
    }

    .masthead-crest {
      width: 30px !important;
      height: 32px !important;
      flex-basis: 30px !important;
    }

    .masthead-title {
      max-width: 178px;
      font-size: 12px !important;
      line-height: 1.04 !important;
      letter-spacing: .03em !important;
      overflow-wrap: anywhere;
    }

    .masthead-sub {
      max-width: 160px;
      font-size: 8px !important;
      line-height: 1.05 !important;
      letter-spacing: .03em !important;
    }

    .masthead-profile-btn {
      max-width: 116px;
      padding: 4px 7px 4px 4px !important;
    }

    .masthead-profile-btn span:not(.masthead-caret),
    .masthead-profile-btn strong {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .official-nav-inner {
      width: 100%;
      min-width: 0;
      padding: 4px 8px !important;
      overflow: hidden;
    }

    .official-nav-primary,
    .official-nav-account {
      min-width: 0;
      max-width: 100%;
      overflow-x: auto;
    }

    .content {
      width: 100%;
      min-width: 0;
      padding: 12px !important;
      overflow: visible;
    }

    .block,
    .official-section,
    .official-filter-panel,
    .official-hero,
    .official-record-hero {
      width: 100%;
      max-width: 100%;
      min-width: 0;
      padding: 16px !important;
      overflow: hidden;
    }

    .official-hero,
    .official-record-hero {
      grid-template-columns: minmax(0, 1fr) !important;
      gap: 14px !important;
    }

    .official-hero h1,
    .official-record-hero h1,
    .official-section-head h2 {
      overflow-wrap: anywhere;
    }

    .chart-row,
    .economic-chart-row {
      grid-template-columns: minmax(0, 1fr) !important;
      gap: 12px !important;
    }

    .chart-block {
      padding: 16px 14px !important;
      overflow: hidden;
    }

    .chart-block h3 {
      align-items: flex-start !important;
      white-space: normal !important;
      overflow-wrap: anywhere;
      line-height: 1.25 !important;
    }

    .chart-area,
    .chart-area-tall {
      width: 100% !important;
      min-height: 280px !important;
    }

    .table-shell {
      width: 100%;
      max-width: 100%;
      overflow-x: auto !important;
      overflow-y: hidden;
    }

    .table-shell table {
      min-width: 620px;
    }

    .table-shell table.mobile-card-table {
      min-width: 0;
      width: 100%;
      border-collapse: separate;
      border-spacing: 0 10px;
    }

    .mobile-card-table thead {
      display: none;
    }

    .mobile-card-table,
    .mobile-card-table tbody,
    .mobile-card-table tr,
    .mobile-card-table td {
      display: block;
    }

    .mobile-card-table tr {
      border: 1px solid var(--totemia-line);
      border-left: 4px solid var(--totemia-gold);
      border-radius: 8px;
      background: #ffffff;
      padding: 8px 10px;
    }

    .mobile-card-table td {
      border: 0 !important;
      padding: 7px 0 !important;
      overflow-wrap: anywhere;
    }

    .mobile-card-table td::before {
      content: attr(data-label);
      display: block;
      margin-bottom: 3px;
      color: var(--totemia-muted);
      font-size: 10px;
      font-weight: 900;
      letter-spacing: .12em;
      text-transform: uppercase;
    }

    .tx-list {
      overflow: visible !important;
    }

    .tx-list-head {
      display: none !important;
    }

    .tx-row {
      grid-template-columns: minmax(0, 1fr) !important;
      gap: 6px !important;
      padding: 12px 14px !important;
    }

    .tx-row > span {
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .tx-row .tx-amount {
      text-align: left;
    }

    .salary-candidate-role.website-role-candidate {
      display: grid !important;
      grid-template-columns: 16px 12px minmax(0, 1fr);
      align-items: center;
      gap: 8px !important;
    }

    .salary-candidate-role.website-role-candidate .salary-candidate-name {
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .salary-candidate-role.website-role-candidate .official-badge {
      grid-column: 2 / -1;
      justify-self: start;
      max-width: 100%;
      margin-left: 0 !important;
      white-space: normal;
      overflow-wrap: anywhere;
      line-height: 1.2;
    }

    .institution-grid,
    .institution-grid.two,
    .ministry-tool-grid,
    .registry-record-grid,
    .portal-card-grid,
    .interior-registry-grid {
      grid-template-columns: minmax(0, 1fr) !important;
      min-width: 0;
    }

    .institution-record,
    .registry-record-card,
    .portal-card {
      min-width: 0;
      max-width: 100%;
    }

    .institution-record {
      grid-template-columns: 54px minmax(0, 1fr) !important;
      gap: 12px !important;
      padding: 14px !important;
    }

    .institution-mark,
    .institution-seal-img {
      width: 50px !important;
      height: 50px !important;
    }

    .institution-body,
    .institution-body h3,
    .institution-body p,
    .portal-card h3,
    .portal-card p {
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .account-settings-page {
      max-width: 100% !important;
    }

    .acct-page-header {
      min-width: 0;
      gap: 10px !important;
      margin-bottom: 16px !important;
    }

    .acct-tabs {
      display: grid !important;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0 !important;
      overflow: visible !important;
    }

    .acct-tab {
      min-width: 0 !important;
      padding: 10px 6px !important;
      white-space: normal !important;
      text-align: center;
      font-size: 11px !important;
      line-height: 1.2 !important;
    }

    .settings-layout {
      grid-template-columns: minmax(0, 1fr) !important;
    }

    .settings-panel {
      min-width: 0;
      padding: 16px !important;
    }

    .personal-role-preferences-panel {
      width: 100%;
      min-width: 0;
      padding: 16px !important;
      margin-top: 12px !important;
    }

    .personal-role-pref-head {
      display: grid !important;
      grid-template-columns: minmax(0, 1fr) !important;
      justify-content: stretch !important;
      align-items: start !important;
      gap: 10px !important;
    }

    .personal-role-pref-head h3 {
      font-size: 18px !important;
      overflow-wrap: anywhere;
    }

    .role-pref-cooldown {
      width: fit-content;
      max-width: 100%;
      border-radius: 8px !important;
      white-space: normal !important;
      line-height: 1.25 !important;
    }

    .personal-role-pref-grid {
      grid-template-columns: minmax(0, 1fr) !important;
    }

    .personal-role-pref-footer {
      display: grid !important;
      justify-content: stretch !important;
    }

    #role-preferences-save {
      width: 100%;
      min-width: 0 !important;
    }

    /* Banking page — phone layout (≤640 here for tablet portrait safety;
     * the narrow-phone tightening is in the ≤600px block below). Account
     * header stacks identity over balance; primary CTA goes full-width;
     * tab bar splits to two columns. */
    .banking-account-card {
      flex-direction: column !important;
      align-items: stretch !important;
      gap: 12px !important;
      padding: 16px !important;
    }
    .banking-account-balance {
      align-items: flex-start !important;
      text-align: left !important;
    }
    .banking-account-balance-value {
      font-size: 28px !important;
    }
    .banking-action-row .banking-primary-btn {
      width: 100%;
    }
    .banking-tab-bar {
      display: grid !important;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .banking-tab {
      padding: 10px 8px !important;
      text-align: center;
    }
    .banking-overview-section {
      padding: 14px !important;
    }
    .banking-section-head {
      flex-wrap: wrap !important;
    }

    .public-ledger-table .tx-date {
      font-size: 11px;
    }

    .public-ledger-table .tx-amount {
      font-size: 13px;
    }
  }

/* Shared ColorStudio (Next civic workspaces). Built entirely on the existing
 * party-color / gradient class vocabulary below; this block only sets the
 * outer rhythm and a couple of solid-mode tweaks. */
.color-studio {
  display: grid;
  gap: 12px;
  margin: 2px 0 0;
}
.color-studio .party-color-presets { margin: 0; }
.color-studio .party-color-stop-panel { margin: 0; padding-bottom: 0; border-bottom: 0; }
.color-studio .party-color-add-row { margin-top: 0; }
.color-studio[data-mode="solid"] .gradient-bar { height: 56px; margin-bottom: 8px; cursor: default; }

/* Continuous backdrop for the public org workspaces (political parties /
 * religions). Ties the hero + sidebar shell together on one soft paper
 * surface instead of leaving cards floating on the bare body gradient. */
.org-workspace {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--totemia-line) 80%, transparent);
  border-radius: 14px;
  background:
    radial-gradient(900px 300px at 100% -40%, rgba(196, 152, 31, .08), transparent 70%),
    radial-gradient(720px 260px at -10% 0%, rgba(18, 60, 50, .06), transparent 70%),
    linear-gradient(180deg, var(--totemia-paper), color-mix(in srgb, var(--totemia-ivory) 55%, var(--totemia-paper)));
}
.org-workspace > .interior-workspace-shell { margin-bottom: 0; }
@media (max-width: 640px) {
  .org-workspace { padding: 10px; border-radius: 12px; }
}

/* Party color editor and leader launch surfaces. */
.party-color-editor-section {
  margin: 2px 0 0;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--totemia-line, var(--line, #e3d8b6));
}
.interior-workspace-content form.party-color-editor-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.party-color-editor-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.party-color-editor-preview {
  width: 46px;
  height: 40px;
  border-radius: 4px;
  border: 1px solid var(--totemia-line, var(--line, #e3d8b6));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.party-color-editor-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.party-color-editor-meta strong { color: var(--totemia-ink, var(--ink)); font-size: 14px; }
.party-color-editor-meta span { color: var(--totemia-muted, var(--ink-2, #525763)); font-size: 12px; }
.party-color-leader-bar-inline {
  margin: 10px 0 0;
  padding: 10px 0 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--totemia-line, var(--line, #e3d8b6));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.party-color-leader-bar-inline .party-color-leader-label {
  flex: 1 1 200px;
  font-size: 12px;
  color: var(--totemia-muted, var(--ink-2, #525763));
}

/* Modal gradient editor. */
.party-color-modal { width: min(720px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow: auto; }
.party-color-sub { margin: -2px 0 14px; font-size: 13px; color: var(--ink-2, #525763); }
.gradient-bar {
  position: relative;
  height: 68px;
  border-radius: 4px;
  border: 1px solid var(--line);
  margin: 4px 0 42px;
  cursor: copy;
  overflow: visible;
  touch-action: pan-y;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15), 0 1px 2px rgba(0, 0, 0, .05);
}
.gradient-bar.is-solid,
.gradient-bar.is-default {
  cursor: copy;
  margin-bottom: 16px;
}
.gradient-bar-fill {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: var(--totemia-gold, var(--gold, #c4981f));
  pointer-events: none;
  transition: background .15s ease;
}
.gradient-stop {
  position: absolute;
  bottom: -14px;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 3px solid #fff;
  background: var(--c, #888);
  transform: translateX(-50%);
  box-shadow: 0 3px 7px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(0, 0, 0, .12);
  cursor: grab;
  padding: 0;
  touch-action: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.gradient-stop:hover { transform: translateX(-50%) translateY(-1px); }
.gradient-stop:active { cursor: grabbing; }
.gradient-stop.selected {
  box-shadow: 0 0 0 3px var(--gold, #c4981f), 0 3px 7px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(0, 0, 0, .12);
  transform: translateX(-50%) translateY(-2px) scale(1.1);
}
.gradient-stop.deleting { opacity: .35; box-shadow: 0 0 0 3px #c0392b, 0 3px 7px rgba(0, 0, 0, .35); }
.gradient-stop-label {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 34px;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(33, 33, 33, .9);
  color: #fff;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 800;
  pointer-events: none;
  white-space: nowrap;
}
.gradient-help { font-size: 12px; color: var(--ink-2, #525763); margin: 2px 0 12px; min-height: 1.4em; line-height: 1.4; }

.party-color-stop-panel { margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line, #e3d8b6); }
.party-color-stop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
}
.party-color-stop-count {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 8px;
  color: var(--ink-2, #525763);
  font-size: 11px;
  font-weight: 800;
}
.party-color-stop-count.full { border-color: #c0392b; color: #9f2f24; background: rgba(192, 57, 43, .08); }
.party-color-stop-empty { color: var(--ink-2, #525763); font-size: 13px; padding: 8px 0 2px; }
.party-color-stop-row {
  display: grid;
  grid-template-columns: 48px minmax(116px, 1fr) minmax(190px, 1.4fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 4px;
}
.party-color-stop-row.solid { grid-template-columns: 48px minmax(116px, 1fr) auto; }
.party-color-stop-row + .party-color-stop-row { margin-top: 6px; }
.party-color-stop-row.selected {
  border-color: color-mix(in srgb, var(--c, #c4981f) 55%, var(--line, #e3d8b6));
  background: color-mix(in srgb, var(--c, #c4981f) 8%, #fff);
}
.party-color-stop-row input[type="color"] {
  appearance: none;
  -webkit-appearance: none;
  width: 48px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.party-color-stop-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.party-color-stop-row input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 3px; }
.party-color-stop-row input[type="color"]::-moz-color-swatch { border: 0; border-radius: 3px; }
.party-color-stop-row input[type="text"],
.party-color-stop-percent input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  font: 13px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface, #fff);
  color: var(--ink);
}
.party-color-stop-row input[type="text"] { text-transform: uppercase; }
.party-color-stop-row input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-tint); }
.party-color-stop-position { display: grid; grid-template-columns: minmax(90px, 1fr) 72px; align-items: center; gap: 8px; }
.party-color-stop-position input[type="range"] { width: 100%; accent-color: var(--c, var(--gold, #c4981f)); }
.party-color-stop-percent { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px; color: var(--ink-2, #525763); font-size: 12px; font-weight: 800; }
.gradient-stop-delete {
  border: 1px solid var(--line);
  background: transparent;
  font-size: 12px;
  line-height: 1;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink, #2a2317);
  font-weight: 700;
}
.gradient-stop-delete:hover { background: rgba(192, 57, 43, .08); border-color: #c0392b; color: #c0392b; }

.party-color-palette-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 2px 0 6px; }
.party-color-palette-hint { font-size: 12px; color: var(--ink-2, #525763); font-weight: 600; }
.party-color-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; margin: 0 0 4px; }
.party-color-preset-swatch {
  border: 1px solid var(--line);
  border-radius: 4px;
  height: 32px;
  cursor: pointer;
  padding: 0;
  transition: transform .12s ease, box-shadow .12s ease;
}
.party-color-preset-swatch:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0, 0, 0, .12); }
.party-color-preset-swatch.blocked { cursor: not-allowed; opacity: .62; }
.party-color-modal .modal-actions { gap: 8px; flex-wrap: wrap; }
.party-color-add-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.party-color-add-row button[disabled],
.party-color-add-row button[data-limit-reached="true"] { opacity: .58; cursor: not-allowed; }

@media (max-width: 640px) {
  .party-color-stop-row { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .party-color-stop-position { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
  .party-color-editor-row { grid-template-columns: 44px 1fr; }
  .party-color-editor-row .official-link-button { grid-column: 1 / -1; }
  .party-color-stop-row { grid-template-columns: 44px minmax(0, 1fr); }
  .party-color-stop-row .gradient-stop-delete { grid-column: 1 / -1; justify-self: start; }
}

/* Branded political-party / religion workspaces. Keep the Interior workspace
 * navigation shape, but let the org color own the active state and remove the
 * stacked-card border treatment from these public org tools. */
.org-workspace {
  gap: 24px;
  padding: 0 0 24px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
}

.org-workspace .official-hero.public-party-hero {
  position: relative;
  overflow: hidden;
  border: 0 !important;
  border-radius: 4px;
  background: #ffffff;
  padding: 30px 28px 28px;
}

.org-workspace .official-hero.public-party-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: var(--party-accent, var(--totemia-gold));
}

/* Workspace hero emblem — neutral white frame ringed in the org's own accent
   (no default gold tint), image contained so wide logos aren't cropped. */
.org-workspace .official-hero.public-party-hero .official-seal {
  width: 84px;
  height: 84px;
  padding: 7px;
  border-radius: 4px;
  background: #ffffff;
  border-color: color-mix(in srgb, var(--party-accent-color, var(--totemia-green)) 24%, var(--totemia-line));
}

.org-workspace .official-hero.public-party-hero .official-seal-img {
  width: 100%;
  height: 100%;
  border-radius: 3px;
  background: #ffffff;
  object-fit: contain;
}

.org-workspace .interior-workspace-shell {
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
}

.org-workspace .interior-sidebar-nav {
  gap: 6px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.org-workspace .interior-sidebar-nav a,
.org-workspace .interior-sidebar-nav button {
  min-height: 44px;
  border-radius: 4px !important;
  padding: 0 16px;
}

.org-workspace .interior-sidebar-nav a:hover,
.org-workspace .interior-sidebar-nav button:hover {
  background: color-mix(in srgb, var(--party-accent-color, #123c32) 10%, #ffffff) !important;
}

.org-workspace .interior-sidebar-nav a.active,
.org-workspace .interior-sidebar-nav button.active {
  border-color: transparent !important;
  border-left: 0 !important;
  background: var(--party-accent, var(--totemia-gold)) !important;
  color: #ffffff !important;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .18);
}

/* Mobile: the .org-workspace grid override is more specific than the base
   interior shell's mobile rule, so it has to restack the columns itself.
   The sidebar becomes a horizontal, swipeable tab strip with the same
   accent-filled active pill. */
@media (max-width: 820px) {
  .org-workspace .interior-workspace-shell {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .org-workspace .interior-sidebar-nav {
    position: static;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding: 4px;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
  }

  .org-workspace .interior-sidebar-nav a,
  .org-workspace .interior-sidebar-nav button {
    flex: 0 0 auto;
    white-space: nowrap;
    scroll-snap-align: start;
  }
}

.org-workspace .interior-workspace-content {
  padding: 0;
  background: #ffffff;
}

.org-workspace .official-section {
  border: 0 !important;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none !important;
  padding: 24px 0;
}

.org-workspace .official-section + .official-section {
  margin-top: 8px;
}

.org-workspace .official-stat {
  border: 0;
  border-radius: 4px;
  background: color-mix(in srgb, var(--party-accent-color, #123c32) 7%, #f7f8fa);
}

/* Directory ("Who holds each role") cards adopt the same bold, flat look as
   the role editor: square 4px corners, a solid accent left bar instead of a
   hairline border, heavier names, and flat holder rows. */
.org-workspace .salary-role-cards {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.org-workspace .salary-role-card {
  border: 0;
  border-radius: 4px;
  background: color-mix(in srgb, var(--role-color, #123c32) 6%, #f8faf9);
  box-shadow: inset 6px 0 0 var(--role-color, var(--party-accent-color, #123c32));
  padding: 16px 18px;
}

.org-workspace .salary-role-card:hover {
  box-shadow: inset 6px 0 0 var(--role-color, var(--party-accent-color, #123c32)),
    0 6px 18px rgba(20, 23, 26, .06);
}

.org-workspace .salary-role-card.is-leader {
  background: color-mix(in srgb, var(--role-color, #c4981f) 9%, #fffdf6);
}

.org-workspace .salary-role-card-name strong {
  font-weight: 900;
  font-size: 15px;
  color: var(--totemia-ink);
}

/* Modern bold chip for role rank / schedule state inside org workspaces —
   flat, square-cornered, tinted by the role's own color instead of the
   legacy rounded gold pill. */
.org-workspace .salary-state {
  border: 0;
  border-radius: 4px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.org-workspace .salary-state.configured {
  background: color-mix(in srgb, var(--role-color, var(--totemia-gold, #c4981f)) 16%, #ffffff);
  color: var(--totemia-ink);
}

.org-workspace .salary-state.unconfigured {
  background: var(--totemia-line, #e6e0d2);
  color: var(--totemia-muted);
}

.org-workspace .salary-role-holder {
  border: 0;
  border-radius: 4px;
  background: #ffffff;
}

.org-workspace .official-link-button,
.org-workspace .official-secondary,
.org-workspace .secondary,
.org-workspace .slim-btn {
  border-radius: 4px !important;
}

.org-workspace .official-link-button:not(.quiet):not(.secondary) {
  border-color: transparent;
  background: var(--party-accent, var(--totemia-gold));
  color: #ffffff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .16);
}

.org-workspace .color-studio .gradient-bar {
  height: 94px;
  border: 0;
  border-radius: 4px;
  box-shadow: none;
}

.org-workspace .color-studio[data-mode="solid"] .gradient-bar {
  height: 82px;
}

.org-workspace .party-color-preset-swatch {
  height: 38px;
  border-radius: 3px;
}

.org-workspace .gradient-stop {
  width: 34px;
  height: 34px;
  border-radius: 3px;
}

.org-workspace .party-color-stop-row input[type="text"],
.org-workspace .party-color-stop-percent input,
.org-workspace .interior-workspace-content form input,
.org-workspace .interior-workspace-content form select {
  border-radius: 4px;
}

.org-workspace .economic-chart-row {
  gap: 24px;
}

.org-workspace .economic-chart-row .chart-block {
  border: 0 !important;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none !important;
  padding: 18px 0 8px;
}

.org-workspace .chart-block-head {
  border-bottom: 0;
  padding-bottom: 0;
}

.org-workspace .chart-block .chart-block-head h3::before {
  width: 5px;
  background: var(--party-accent, var(--totemia-gold));
}

.org-funds-ledger {
  border: 0 !important;
  border-radius: 0 !important;
  overflow: visible;
}

.org-funds-ledger table {
  border-collapse: separate !important;
  border-spacing: 0 8px;
}

.org-funds-ledger thead th {
  background: transparent !important;
  color: rgba(18, 60, 50, .68);
  padding: 0 16px 8px;
}

.org-funds-ledger tbody tr {
  background: color-mix(in srgb, var(--party-accent-color, #123c32) 6%, #f8faf9);
}

.org-funds-ledger td {
  border-top: 0 !important;
  padding: 16px;
}

.org-funds-ledger tbody tr:hover {
  background: color-mix(in srgb, var(--party-accent-color, #123c32) 10%, #ffffff);
}

.org-fund-name {
  display: grid;
  gap: 3px;
  color: var(--totemia-ink, var(--ink));
}

.org-fund-name strong {
  font-size: 15px;
  line-height: 1.15;
}

.org-fund-name span {
  color: var(--totemia-muted, var(--muted));
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.org-funds-ledger .tx-flow.neutral {
  color: var(--party-accent-color, var(--totemia-green));
}

/* Inline rename / delete controls in the funds table (leadership only). */
.org-fund-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.org-fund-rename-input {
  min-height: 34px;
  max-width: 160px;
  padding: 0 10px;
  border: 1px solid var(--totemia-line);
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
}

.org-funds-ledger .tx-amount {
  color: var(--totemia-ink, var(--ink));
  font-size: 16px;
  font-weight: 900;
}

.org-status-badge,
.party-leader-badge {
  border: 0 !important;
  border-radius: 4px !important;
}

.party-leader-badge {
  background: var(--role-color, var(--party-accent, var(--totemia-gold))) !important;
  color: #ffffff !important;
}

/* Vertical role hierarchy (Discord/Roblox style): one role per row, stacked
   top-to-bottom in rank order, collapsed to a header until expanded. Drag a
   row by its handle (or use the ▲/▼ arrows) to reorder. */
.role-add-btn { white-space: nowrap; }

.role-create-inline {
  border: 1px dashed color-mix(in srgb, var(--party-accent-color, #123c32) 32%, var(--totemia-line));
  border-radius: 4px;
  padding: 14px 16px 16px;
  margin: 4px 0 14px;
  background: color-mix(in srgb, var(--party-accent-color, #123c32) 4%, #ffffff);
}

.role-create-inline .role-editor-grid { margin: 0; }

.role-hierarchy-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.role-hierarchy-row {
  border: 0;
  border-radius: 4px;
  background: color-mix(in srgb, var(--role-color, #123c32) 7%, #f8faf9);
  box-shadow: inset 6px 0 0 var(--role-color, var(--party-accent-color, #123c32));
  overflow: hidden;
}

/* Drag states stay neutral-gold on every page (no accent/green fallbacks):
   the lifted row dims, the drop target gets a steady gold ring. */
.role-hierarchy-row.dragging {
  opacity: .55;
  box-shadow:
    inset 6px 0 0 var(--role-color, var(--totemia-line)),
    0 0 0 1px var(--totemia-line, #e6e0d2);
}

.role-hierarchy-row.drag-over {
  box-shadow:
    inset 6px 0 0 var(--role-color, var(--totemia-line)),
    0 0 0 2px var(--totemia-gold, #c4981f);
}

.role-hierarchy-head {
  display: flex;
  align-items: stretch;
  gap: 0;
  /* Click-dragging a row must never select/highlight the label text —
     the browser selection flash read as the row "changing color". */
  user-select: none;
  -webkit-user-select: none;
}

.role-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  flex-shrink: 0;
  color: var(--totemia-muted);
  font-size: 13px;
  cursor: grab;
  user-select: none;
}

.role-drag-handle.locked {
  cursor: default;
  font-size: 7px;
  opacity: .45;
}

.role-rank-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 0 10px;
}

.role-rank-btn {
  border: 0;
  background: transparent;
  color: var(--totemia-muted);
  font-size: 9px;
  line-height: 1;
  padding: 3px 4px;
  border-radius: 3px;
  cursor: pointer;
}

.role-rank-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--role-color, var(--totemia-gold, #c4981f)) 16%, #ffffff);
  color: var(--totemia-ink);
}

.role-rank-btn:disabled { opacity: .3; cursor: default; }

.role-hierarchy-toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  padding: 13px 12px 13px 2px;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}

.role-hierarchy-toggle strong {
  font-size: 14px;
  font-weight: 900;
  color: var(--totemia-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-hierarchy-meta {
  margin-left: auto;
  color: var(--totemia-muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.role-hierarchy-caret {
  color: var(--totemia-muted);
  font-size: 11px;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.role-hierarchy-body { padding: 2px 0 6px; }

/* Nested rows are indented (inline margin-left by depth) and sit inside a
   full-height rail painted in the PARENT role's color (--nest-color, set
   inline by the panel), so the whole nested range reads as one group at a
   glance. The row background also picks up a faint parent tint. */
.role-hierarchy-row.is-nested {
  position: relative;
  background:
    color-mix(in srgb, var(--nest-color, var(--totemia-line)) 4%,
      color-mix(in srgb, var(--role-color, #f8faf9) 7%, #f8faf9));
}

.role-hierarchy-row.is-nested::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 2px;
  background: var(--nest-color, var(--totemia-line));
}

.role-hierarchy-row.is-nested::after {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  width: 8px;
  height: 2px;
  background: color-mix(in srgb, var(--nest-color, var(--totemia-line)) 60%, transparent);
}

/* "Under ‹parent›" chip on nested role headers, tinted by the parent color. */
.role-nest-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .07em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--nest-color, var(--totemia-line)) 16%, #ffffff);
  color: var(--totemia-ink);
  white-space: nowrap;
}

.role-group-badge {
  background: color-mix(in srgb, var(--party-accent-color, #123c32) 12%, #ffffff) !important;
  color: var(--totemia-ink) !important;
  border: 0 !important;
  border-radius: 4px !important;
}

.role-nest-field {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
}

.role-nest-field span {
  color: var(--totemia-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.role-nest-field select {
  min-height: 40px;
  border-radius: 4px;
  border: 1px solid var(--totemia-line);
  background: #ffffff;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
}

.role-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 12px;
  margin: 0 18px 0;
  padding-top: 2px;
}

.role-editor-grid label,
.role-editor-permissions {
  min-width: 0;
}

.role-editor-grid label {
  display: grid;
  gap: 6px;
}

.role-editor-grid label span {
  color: var(--totemia-muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.role-editor-grid input[type="text"],
.role-editor-grid input[type="color"] {
  min-height: 40px;
  border-radius: 4px;
}

.role-editor-permissions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.role-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 18px 0;
  padding-bottom: 16px;
}

.role-editor-footer .record-actions.compact {
  margin-top: 0;
}

.interior-member-leader-badge {
  background: var(--party-accent, var(--totemia-gold)) !important;
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 4px !important;
}

@media (max-width: 820px) {
  .org-workspace .interior-workspace-shell {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .org-workspace .interior-sidebar-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
  }

  .org-workspace .interior-sidebar-nav a.active,
  .org-workspace .interior-sidebar-nav button.active {
    border-bottom-color: transparent !important;
  }
}

/* Account settings polish layered over the legacy portal shell. */

.masthead-menu {
  top: calc(100% + 6px);
  border-color: #d8cfbd;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.masthead-menu button,
.masthead-menu a {
  padding: 10px 12px;
  border-radius: 6px;
}

.account-settings-page.block {
  width: min(1040px, calc(100vw - 48px));
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px;
  box-shadow: none;
}

/* Bold, flat buttons — squared corners, heavy weight, no lift/glow. Matches the
   portal bold system; the soft rounded gold legacy buttons are neutralised. */
.account-settings-page button,
.account-settings-page .slim-btn,
.account-settings-page .official-link-button {
  border-radius: 3px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: none;
}

.account-settings-page button:hover {
  transform: none;
}

.account-settings-page .acct-page-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.account-settings-page .acct-avatar {
  width: 58px;
  height: 58px;
  box-shadow: none;
}

.account-settings-page .acct-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.account-settings-page .acct-handle {
  color: var(--muted);
  font-weight: 700;
}
.account-settings-page .acct-systemid {
  font-size: 11px;
}

.account-settings-shell {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.settings-side-nav {
  position: sticky;
  top: calc(var(--masthead-h, 64px) + 16px);
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

/* Bold flag tabs: heavy uppercase ink text with a thick left accent bar on the
   active tab (the org-status-flag treatment) — no rounded pill. */
.settings-side-tab {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 0 12px 0 13px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
  transition: color .12s ease, background .12s ease, border-color .12s ease;
}

.settings-side-tab:hover {
  color: var(--ink);
  background: var(--surface-2);
  border-left-color: var(--gold-border);
  text-decoration: none;
}

.settings-side-tab.active {
  color: var(--ink);
  background: var(--gold-pale);
  border-left-color: var(--gold);
}

@media (prefers-reduced-motion: reduce) {
  .settings-side-tab { transition: none; }
}

.account-settings-content {
  min-width: 0;
}

.account-settings-page .settings-layout {
  grid-template-columns: minmax(260px, .85fr) minmax(320px, 1.15fr);
  gap: 16px;
}

.account-settings-page .settings-layout.single {
  grid-template-columns: minmax(0, 1fr);
}

.account-settings-page .settings-panel {
  min-width: 0;
  border-radius: 8px;
  padding: 18px;
  box-shadow: none;
}

.account-settings-page .settings-panel-compact {
  max-width: 560px;
}

.account-settings-page .panel-title {
  margin-bottom: 14px;
}

.account-settings-page .settings-field input,
.account-settings-page .settings-field textarea,
.account-settings-page .settings-field select {
  border-radius: 6px;
  background: #ffffff;
}

.account-settings-page .passkey-actions {
  flex-wrap: wrap;
}

.account-settings-page .passkey-actions .slim-btn {
  width: auto;
  min-width: 84px;
  padding: 10px 14px;
}

.account-settings-page .passkey-card {
  align-items: center;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.account-settings-page .passkey-card-name {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

.account-settings-page .passkey-delete-btn {
  align-self: center;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
}

.account-settings-page .discord-profile-card {
  align-items: center;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.account-settings-page .discord-profile-avatar {
  width: 52px;
  height: 52px;
}

.account-settings-page .personal-role-preferences-panel {
  margin-top: 0 !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  background: var(--surface) !important;
  box-shadow: none !important;
}

.account-settings-page .personal-role-pref-head h3 {
  font-size: 16px !important;
  letter-spacing: 0 !important;
}

.account-settings-page .personal-role-pref-head h3::before {
  display: none !important;
}

@media (max-width: 820px) {
  .account-settings-page.block {
    width: min(100%, calc(100vw - 24px));
    padding: 14px;
  }

  .account-settings-shell {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .settings-side-nav {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Stacked in a 2-col grid the left bar reads awkwardly; move the bold accent
     to a bottom bar so the active tab still flags clearly. */
  .settings-side-tab {
    justify-content: center;
    text-align: center;
    padding: 0 12px;
    border-left: 0;
    border-bottom: 3px solid transparent;
  }

  .settings-side-tab:hover {
    border-bottom-color: var(--gold-border);
  }

  .settings-side-tab.active {
    border-bottom-color: var(--gold);
  }

  .account-settings-page .settings-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── Visual selectors (roleplay preferences + residence) ─────────────────────
   Flat, bold radio-card pickers so a party shows its emblem and a region shows
   its flag — pick by sight, not by reading a dropdown line. Shared by the
   Preferences and Residence tabs via OptionPicker. */
.account-settings-page .pref-field-stack {
  display: grid;
  gap: 16px;
}

.account-settings-page .pref-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.account-settings-page .pref-field-label {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

/* Gender — compact two-up segmented control. */
.account-settings-page .pref-segment {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.account-settings-page .pref-segment-btn {
  min-width: 96px;
  padding: 9px 16px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
  cursor: pointer;
}

.account-settings-page .pref-segment-btn:hover:not(:disabled):not(.selected) {
  background: var(--surface-2);
  color: var(--ink);
}

.account-settings-page .pref-segment-btn.selected {
  background: var(--gold);
  color: #1a1000;
}

.account-settings-page .pref-segment-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Party / religion / region option cards. */
.account-settings-page .pref-option-block {
  display: grid;
  gap: 8px;
}

.account-settings-page .pref-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.account-settings-page .pref-option-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: 6px;
  background: #ffffff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}

.account-settings-page .pref-option-card:hover:not(:disabled):not(.selected) {
  border-color: var(--gold-border);
  background: var(--gold-pale);
}

.account-settings-page .pref-option-card.selected {
  border-color: var(--gold-border);
  border-left-color: var(--gold);
  background: var(--gold-pale);
}

.account-settings-page .pref-option-card:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.account-settings-page .pref-seal {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 5px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface);
}

.account-settings-page .pref-seal-fallback {
  display: grid;
  place-items: center;
  background: var(--pref-seal-accent, var(--gold-tint));
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.account-settings-page .pref-option-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.account-settings-page .pref-option-text strong {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-settings-page .pref-option-sub {
  font-size: 11px;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .account-settings-page .pref-option-card { transition: none; }
}

@media (max-width: 560px) {
  .account-settings-page .pref-option-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* ── Bio editor ──────────────────────────────────────────────────────────── */
.account-settings-page .bio-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.account-settings-page .bio-counter {
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.account-settings-page .bio-counter.near-limit {
  color: var(--danger-bright, #c0392b);
}

/* Drop the drag-resize "extender" corner — the field is a fixed bold block. */
.account-settings-page .bio-textarea {
  resize: none;
  min-height: 104px;
}

  /* Public /about list-page refinements — slim hero, taller image area,
   * dense compact card. Lives in its own file because portalShell.css is
   * already over AGENTS.md's 1,200-line hard limit, so any further
   * public-card styling additions go here.
   *
   * Cascade order matters: this file loads AFTER portalShell.css (the SPA
   * shell injects portal theme files in order) so rules here win on tied
   * specificity. */

  /* Slim list-page hero — the seal + descriptive subtitle on the old
   * `.official-hero` variant ate ~30 % of the first viewport before any
   * party card showed. This collapses to one tight row (label + h1 +
   * one-line subtitle) so the cards start higher on the page. */
  .official-hero.public-list-hero {
    padding: 12px 18px;
    margin-bottom: 10px;
    grid-template-columns: minmax(0, 1fr);
  }
  .official-hero.public-list-hero h1 { font-size: 19px; margin: 2px 0; }
  .official-hero.public-list-hero p { font-size: 12px; margin: 0; }
  .official-hero.public-list-hero .registry-label { font-size: 10px; }

  @media (max-width: 720px) {
    .official-hero.public-list-hero { padding: 10px 14px; }
    .official-hero.public-list-hero h1 { font-size: 17px; }
  }

  /* Cover frame — fixed-height banner sized so logos read at a glance
   * without each card growing past one screen-row at 1440p / 4K. The
   * smartPublicCoverFit() classifier sets fit-contain for wide/tall/
   * square logos so nothing is cropped; the override below forces
   * contain in every case because civic logos are not photos and
   * cover-cropping always loses information. */
  .public-party-card .public-party-cover { height: 140px; }
  .public-party-cover-img,
  .public-party-cover-img.fit-cover,
  .public-party-cover-img.fit-contain,
  .public-party-cover-img.fit-square,
  .public-party-cover-img.fit-wide,
  .public-party-cover-img.fit-tall {
    object-fit: contain;
    padding: 4px;
    box-sizing: border-box;
  }

  /* Card body — tighter type so the leader name, member count, and
   * button stack inside ~110 px without wrapping. */
  .public-party-card .public-party-body { padding: 10px 12px 12px; gap: 6px; }
  .public-party-card .public-party-title { font-size: 15px; margin: 1px 0 2px; }
  .public-party-card .official-link-button { padding: 6px 10px; font-size: 12px; }
  .public-party-card .registry-label { font-size: 9px; letter-spacing: .1em; }
  .public-party-card-leader strong { font-size: 12px; }
  .public-party-card-members { font-size: 11px; }
  .public-party-card-info { gap: 3px; }
  .public-party-card-leader { gap: 1px; }

  @media (max-width: 640px) {
    .public-party-card .public-party-cover { height: 160px; }
  }

/* Treasury workspace sidebar shell */

.treasury-workspace-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 14px;
}

.treasury-sidebar-nav {
  position: sticky;
  top: calc(var(--masthead-h, 56px) + 60px);
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--totemia-line);
  border-radius: 8px;
  background: var(--totemia-paper);
}

.treasury-sidebar-nav button,
.treasury-sidebar-nav a {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: var(--totemia-muted) !important;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  box-shadow: none !important;
  transition: color .12s ease, background .12s ease;
}

.treasury-sidebar-nav button:hover,
.treasury-sidebar-nav a:hover {
  color: var(--totemia-ink) !important;
  background: rgba(18, 60, 50, .04) !important;
  transform: none;
}

.treasury-sidebar-nav button.active,
.treasury-sidebar-nav a.active {
  color: var(--totemia-green) !important;
  background: var(--totemia-paper) !important;
  border-color: var(--totemia-line) !important;
  border-left: 3px solid var(--totemia-gold) !important;
  font-weight: 800;
}

.treasury-workspace-content {
  min-width: 0;
}

.treasury-workspace-shell .economic-chart-row {
  grid-template-columns: minmax(0, 1fr);
}

.treasury-workspace-shell .chart-area-tall {
  min-height: 440px;
}

@media (max-width: 860px) {
  .treasury-workspace-shell {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .treasury-sidebar-nav {
    position: static;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 8px;
  }

  .treasury-sidebar-nav button,
  .treasury-sidebar-nav a {
    flex: 0 0 auto;
    min-height: 36px;
    white-space: nowrap;
    text-align: center;
    font-size: 12px;
    padding: 0 14px;
    border-left: 0 !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 6px !important;
  }

  .treasury-sidebar-nav button.active,
  .treasury-sidebar-nav a.active {
    border-left: 0 !important;
    border-bottom-color: var(--totemia-gold) !important;
  }

  .treasury-workspace-shell .chart-area-tall {
    min-height: 340px;
  }
}

/* ── Economic Data internal tabs (modern bold flat strip) ──────────────── */

.economic-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 18px;
  border-bottom: 2px solid var(--totemia-line);
}

.economic-subtabs button {
  flex: 0 0 auto;
  appearance: none;
  margin: 0 0 -2px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--totemia-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition: color .12s ease, border-color .12s ease;
}

.economic-subtabs button:hover {
  color: var(--totemia-ink);
}

.economic-subtabs button.active {
  color: var(--totemia-green);
  border-bottom-color: var(--totemia-green);
}

.economic-tab-panel[hidden] {
  display: none;
}

/* ── Economic Data chart panels ────────────────────────────────────────── */

.economic-distribution-stats {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
  margin: 18px 0 22px;
}

.economic-stat-group {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.economic-stat-group h3 {
  margin: 0;
  color: var(--totemia-green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.economic-stat-group-baseline {
  grid-column: 1 / -1;
}

.economic-stat-group-percentiles {
  grid-column: span 8;
}

.economic-stat-group-concentration {
  grid-column: span 4;
}

.economic-stat-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  min-width: 0;
}

.economic-stat-group-baseline .economic-stat-subgrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.economic-stat-group-concentration .economic-stat-subgrid {
  grid-template-columns: minmax(0, 1fr);
}

.economic-distribution-stats .official-stat {
  min-width: 0;
  padding: 14px 16px;
  overflow: hidden;
}

.economic-distribution-stats .official-stat span {
  white-space: normal;
  overflow-wrap: anywhere;
}

.economic-distribution-stats .official-stat strong.economic-money,
.economic-distribution-stats .official-stat strong.economic-count {
  display: block;
  margin: 6px 0 5px;
  color: var(--totemia-ink);
  font-size: clamp(15px, 1.2vw, 20px);
  line-height: 1.12;
  font-weight: 750;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.economic-stat-grid .official-stat strong.economic-money,
.economic-stat-grid .official-stat strong.economic-count,
.official-stat strong.economic-money .economic-money-amount,
.official-stat strong.economic-money .economic-money-currency {
  letter-spacing: 0 !important;
}

.economic-chart-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

/* Flat modern-bold chart cards: clean line, square corners, no shadow, with a
   thin finance-green top accent so the board reads as one cohesive set. */
.economic-tab-panel .chart-block {
  border: 1px solid var(--totemia-line);
  border-top: 3px solid var(--totemia-green);
  border-radius: 0;
  box-shadow: none;
}

/* Single full-width chart (currency supply lives alone on its tab). */
.economic-chart-solo {
  margin-top: 18px;
}

.economic-chart-solo .chart-area-tall {
  min-height: 420px;
}

.economic-chart-row .chart-area-tall {
  min-height: 380px;
}

.economic-chart-row .economic-chart-feature,
.economic-chart-row .economic-chart-wide {
  grid-column: 1 / -1;
}

.economic-chart-row .economic-chart-feature .chart-area-tall,
.economic-chart-row .economic-chart-wide .chart-area-tall {
  min-height: 410px;
}

.chart-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line-2);
}

.chart-block .chart-block-head h3 {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.chart-block .chart-block-head h3::before {
  flex: 0 0 auto;
}

.chart-block-head .slim-btn {
  flex: 0 0 auto;
  margin-top: -2px;
  white-space: nowrap;
}

.chart-block-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1100px) {
  .economic-stat-group-percentiles,
  .economic-stat-group-concentration {
    grid-column: 1 / -1;
  }

  .economic-stat-group-baseline .economic-stat-subgrid,
  .economic-stat-group-concentration .economic-stat-subgrid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .economic-chart-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .economic-distribution-stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .economic-stat-group,
  .economic-stat-group-baseline,
  .economic-stat-group-percentiles,
  .economic-stat-group-concentration {
    grid-column: 1 / -1;
  }

  .economic-stat-subgrid,
  .economic-stat-group-baseline .economic-stat-subgrid {
    grid-template-columns: minmax(0, 1fr);
  }

  .economic-chart-row .chart-area-tall,
  .economic-chart-row .economic-chart-feature .chart-area-tall,
  .economic-chart-row .economic-chart-wide .chart-area-tall,
  .economic-chart-solo .chart-area-tall {
    min-height: 300px;
  }

  .chart-block-head {
    align-items: stretch;
    flex-direction: column;
  }

  .chart-block-head .slim-btn {
    align-self: flex-start;
  }

  .economic-subtabs {
    margin-bottom: 14px;
  }

  .economic-subtabs button {
    padding: 9px 13px;
    font-size: 11.5px;
    letter-spacing: .05em;
  }
}

/* Discord-branded account-link actions. Uses the checked-in Discord symbol
   asset without recoloring or reshaping it. */

.discord-brand-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid #5865f2;
  border-radius: 8px;
  background: #5865f2;
  color: #fff !important;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: none;
}

.discord-brand-button img {
  display: block;
  width: 22px;
  height: 17px;
  object-fit: contain;
  flex: 0 0 auto;
}

.discord-brand-button:hover,
.account-settings-page .discord-brand-button:hover {
  border-color: #5865f2;
  background: #5865f2;
  color: #fff !important;
  box-shadow: 0 8px 18px rgba(88, 101, 242, .22);
  transform: translateY(-1px);
}

.discord-brand-button:focus,
.discord-brand-button:focus-visible {
  outline: 3px solid rgba(88, 101, 242, .28);
  outline-offset: 2px;
  box-shadow: none;
}

.discord-brand-button:disabled,
.discord-brand-button[aria-disabled="true"] {
  opacity: .62;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (max-width: 980px) {
  .modal-actions > .discord-brand-button {
    width: 100%;
  }
}

  /* /about/laws — Imperial Code landing + document detail.
   * Branding draws on the same gold/green/cream palette as the rest of
   * the portal. The landing page emphasizes large category buttons; the
   * detail page is a two-column layout with a sticky TOC sidebar and a
   * formal legal-document content area.
   */

  /* ── Landing page ──────────────────────────────────────────────── */

  .laws-landing {
    display: block;
  }

  /* Plain page header — no boxed hero, no gold stripe. The title folds into
     the page the way the other public reading pages now read. */
  .laws-landing-head {
    padding: 2px 2px 0;
    margin-bottom: 2px;
  }

  .laws-landing-head h1 {
    margin: 6px 0 5px;
    color: var(--totemia-green);
    font-size: 30px;
    line-height: 1.12;
    letter-spacing: -.02em;
  }

  .laws-landing-head p {
    margin: 0;
    color: var(--totemia-muted);
    font-size: 14px;
    line-height: 1.55;
    max-width: 70ch;
  }

  .laws-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 18px;
  }

  /* Clean category cards — uniform hairline frame, no gold top stripe and no
     decorative corner gradient. The type badge carries the category; hover
     gives a quiet green-tinted lift. */
  .laws-category-card {
    background: var(--totemia-paper);
    border: 1px solid var(--totemia-line);
    border-radius: 10px;
    padding: 20px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  }

  .laws-category-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--totemia-green) 32%, var(--totemia-line));
    box-shadow: 0 10px 22px rgba(42, 35, 23, .08);
  }

  .laws-category-card-title {
    margin: 4px 0 0;
    font-size: 20px;
    color: var(--totemia-green);
    line-height: 1.25;
    font-weight: 800;
  }

  .laws-category-card-tagline {
    color: var(--totemia-muted);
    font-size: 13px;
    line-height: 1.55;
    margin: 4px 0 8px;
    flex: 1;
  }

  .laws-category-card-cta {
    color: var(--totemia-green);
    font-weight: 800;
    font-size: 13px;
    margin: 0;
    letter-spacing: .02em;
  }

  .laws-category-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: var(--totemia-muted);
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .laws-category-card h2 {
    margin: 4px 0 0;
    font-size: 22px;
    color: var(--totemia-green);
    line-height: 1.2;
  }

  .laws-category-card h2 a {
    color: inherit;
    text-decoration: none;
  }

  .laws-category-card h2 a:hover {
    color: var(--totemia-gold);
  }

  .laws-category-card p {
    color: var(--totemia-ink);
    font-size: 13px;
    line-height: 1.55;
    margin: 4px 0 0;
  }

  .laws-category-card .official-link-button {
    align-self: flex-start;
    margin-top: 6px;
  }

  .law-type-badge {
    display: inline-block;
    background: var(--totemia-green);
    color: #fff8e6;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    padding: 3px 9px;
    border-radius: 4px;
    text-transform: uppercase;
  }

  /* ── Search bar ────────────────────────────────────────────────── */

  .laws-search-bar {
    margin: 14px 0 8px;
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .laws-search-input {
    flex: 1;
    max-width: 520px;
    padding: 10px 14px;
    border: 1px solid var(--totemia-line);
    border-radius: 8px;
    background: var(--totemia-paper);
    color: var(--totemia-ink);
    font-size: 14px;
    font-family: inherit;
  }

  .laws-search-input:focus {
    outline: none;
    border-color: var(--totemia-gold);
    box-shadow: 0 0 0 3px rgba(196, 152, 31, .15);
  }

  .laws-search-count {
    color: var(--totemia-muted);
    font-size: 12px;
    font-weight: 600;
  }

  /* ── Detail page layout ────────────────────────────────────────── */

  .law-breadcrumb {
    margin-bottom: 10px;
    font-size: 13px;
  }

  .law-breadcrumb a {
    color: var(--totemia-green);
    text-decoration: none;
    font-weight: 700;
  }

  .law-breadcrumb a:hover {
    text-decoration: underline;
  }

  .law-document-header {
    background: var(--totemia-paper);
    border: 1px solid var(--totemia-line);
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 18px;
  }

  .law-document-header h1 {
    margin: 8px 0 4px;
    font-size: 28px;
    color: var(--totemia-green);
    line-height: 1.15;
  }

  .law-document-summary {
    color: var(--totemia-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 8px 0 0;
    max-width: 760px;
  }

  .law-download-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--totemia-line);
  }

  .law-document-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }

  /* ── TOC sidebar ───────────────────────────────────────────────── */

  .law-toc-sidebar {
    position: sticky;
    top: 84px;
    background: var(--totemia-paper);
    border: 1px solid var(--totemia-line);
    border-radius: 10px;
    padding: 14px 16px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }

  .law-toc-title {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--totemia-muted);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--totemia-line);
  }

  .law-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .law-toc-item {
    margin: 2px 0;
  }

  .law-toc-item a {
    display: block;
    padding: 6px 8px;
    border-left: 2px solid transparent;
    color: var(--totemia-ink);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
    border-radius: 0 4px 4px 0;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
  }

  .law-toc-item a:hover {
    background: rgba(196, 152, 31, .08);
    color: var(--totemia-green);
  }

  .law-toc-item.active > a,
  .law-toc-item a.active {
    border-left-color: var(--totemia-gold);
    background: rgba(196, 152, 31, .12);
    color: var(--totemia-green);
    font-weight: 700;
  }

  .law-toc-item--h1 > a {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--totemia-green);
  }

  .law-toc-item--h2 > a {
    padding-left: 18px;
    font-weight: 600;
  }

  .law-toc-item--h3 > a {
    padding-left: 28px;
    font-size: 12px;
    color: var(--totemia-muted);
  }

  .law-toc-item--h4 > a {
    padding-left: 36px;
    font-size: 12px;
    color: var(--totemia-muted);
  }

  /* ── Document content ──────────────────────────────────────────── */

  .law-document-content {
    background: var(--totemia-paper);
    border: 1px solid var(--totemia-line);
    border-radius: 10px;
    padding: 32px 40px;
    min-width: 0;
  }

  .law-body {
    color: var(--totemia-ink);
    font-size: 15px;
    line-height: 1.75;
  }

  .law-body h1,
  .law-body h2,
  .law-body h3,
  .law-body h4 {
    color: var(--totemia-green);
    line-height: 1.25;
    scroll-margin-top: 80px;
  }

  .law-body h1,
  .law-body .law-chapter {
    font-size: 22px;
    font-weight: 800;
    margin: 44px auto 22px;
    padding: 0 0 14px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--totemia-green);
    border-bottom: 2px solid var(--totemia-gold);
    max-width: 80%;
  }

  .law-body h1:first-child,
  .law-body .law-chapter:first-child {
    margin-top: 4px;
  }

  .law-body h2,
  .law-body .law-section {
    font-size: 18px;
    font-weight: 800;
    margin: 32px 0 14px;
    padding: 8px 12px;
    border-left: 4px solid var(--totemia-gold);
    background: rgba(196, 152, 31, .06);
    color: var(--totemia-green);
    border-radius: 0 4px 4px 0;
  }

  .law-body h3,
  .law-body .law-article {
    font-size: 16px;
    font-weight: 700;
    margin: 22px 0 8px;
    color: var(--totemia-ink);
  }

  .law-body h4,
  .law-body .law-sub-article {
    font-size: 14px;
    font-weight: 700;
    margin: 16px 0 6px;
    color: var(--totemia-ink);
    text-transform: uppercase;
    letter-spacing: .03em;
  }

  .law-body p {
    margin: 0 0 14px;
  }

  .law-body ol,
  .law-body ul {
    margin: 0 0 16px;
    padding-left: 28px;
  }

  .law-body li {
    margin-bottom: 6px;
  }

  /* Pandoc-converted lists often render as "loose" (each <li> contains a
   * <p>). Strip that inner-paragraph margin so the bullets pack tightly,
   * matching the visual rhythm of a tight list. */
  .law-body li > p {
    margin: 0 0 4px;
  }
  .law-body li > p:last-child {
    margin-bottom: 0;
  }

  .law-body ol > li::marker {
    font-weight: 700;
    color: var(--totemia-green);
  }

  .law-body blockquote {
    border-left: 3px solid var(--totemia-gold);
    padding: 4px 0 4px 16px;
    margin: 0 0 16px;
    color: var(--totemia-muted);
    font-style: italic;
  }

  .law-body code {
    background: var(--totemia-ivory);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 13px;
  }

  .law-body pre {
    background: var(--totemia-ivory);
    border: 1px solid var(--totemia-line);
    border-radius: 6px;
    padding: 12px 14px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.55;
  }

  .law-body hr {
    border: none;
    border-top: 1px solid var(--totemia-line);
    margin: 28px 0;
  }

  .law-body a {
    color: var(--totemia-green);
    font-weight: 600;
  }

  /* Search match highlight injected by the client-side search bar. */
  .law-body mark.law-search-hit {
    background: rgba(196, 152, 31, .35);
    color: var(--totemia-ink);
    padding: 0 2px;
    border-radius: 2px;
  }

  .law-body mark.law-search-hit.current {
    background: var(--totemia-gold);
    color: #fff;
  }

  /* Hover-visible "¶" link beside each heading anchor. The renderer
   * injects only the id; this rule decorates without changing markup. */
  .law-body h1,
  .law-body h2,
  .law-body h3,
  .law-body h4 {
    position: relative;
  }
  .law-body h1[id]::after,
  .law-body h2[id]::after,
  .law-body h3[id]::after,
  .law-body h4[id]::after {
    content: "¶";
    color: var(--totemia-gold);
    font-weight: 600;
    margin-left: 10px;
    opacity: 0;
    transition: opacity .15s ease;
    font-size: 14px;
    vertical-align: middle;
  }
  .law-body h1[id]:hover::after,
  .law-body h2[id]:hover::after,
  .law-body h3[id]:hover::after,
  .law-body h4[id]:hover::after {
    opacity: .7;
  }

  /* Print: drop sidebars and decorative chrome so a hard copy is plain
   * legible legal text. Pages still carry the gold chapter rules. */
  @media print {
    .global-nav,
    .masthead,
    .law-breadcrumb,
    .law-download-row,
    .laws-search-bar,
    .law-toc-sidebar,
    .official-action-row {
      display: none !important;
    }
    .law-document-layout {
      grid-template-columns: 1fr;
    }
    .law-document-content,
    .law-document-header {
      border: 0;
      padding: 0;
      background: transparent;
    }
    .law-body {
      font-size: 12pt;
      line-height: 1.5;
      color: #000;
    }
    .law-body h1,
    .law-body .law-chapter {
      page-break-before: always;
    }
    .law-body h1:first-child,
    .law-body .law-chapter:first-child {
      page-break-before: avoid;
    }
  }

  /* ── Hero search bar ───────────────────────────────────────────── */

  .laws-search-bar--hero {
    margin: 0 auto 22px;
    max-width: 640px;
    justify-content: center;
  }

  .laws-search-bar--hero .laws-search-input {
    flex: 1;
    font-size: 15px;
  }

  .laws-search-bar--inline {
    flex: 1 1 240px;
    min-width: 220px;
    margin-left: auto;
  }

  .laws-search-input--small {
    font-size: 13px;
    padding: 8px 12px;
  }

  /* ── "What's Nearby" sidebar block on detail pages ─────────────── */

  .law-toc-nearby {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--totemia-line);
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .law-toc-nearby-title {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--totemia-muted);
  }

  .law-toc-nearby-link {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    background: rgba(196, 152, 31, .07);
    border: 1px solid var(--totemia-line);
    border-radius: 6px;
    text-decoration: none;
    color: var(--totemia-ink);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    transition: background .15s ease, border-color .15s ease;
  }

  .law-toc-nearby-link:hover {
    background: rgba(196, 152, 31, .15);
    border-color: var(--totemia-gold);
    color: var(--totemia-green);
  }

  .law-toc-nearby-arrow {
    color: var(--totemia-gold);
    font-weight: 800;
  }

  /* Imperial Orders use card markup inside the content area; null out
   * the .law-body wrapper styles for that variant so cards aren't
   * boxed-in twice. */
  .law-document-content--orders {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
  }

  /* ── Search results page ───────────────────────────────────────── */

  .laws-search-page .laws-search-bar {
    margin-bottom: 18px;
  }

  .laws-search-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
  }

  .laws-search-sidebar {
    background: var(--totemia-paper);
    border: 1px solid var(--totemia-line);
    border-radius: 10px;
    padding: 14px 16px;
    position: sticky;
    top: 84px;
  }

  .laws-filter-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .laws-filter-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--totemia-ink);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    margin: 2px 0;
    transition: background .15s ease, color .15s ease;
  }

  .laws-filter-link:hover {
    background: rgba(196, 152, 31, .1);
    color: var(--totemia-green);
  }

  .laws-filter-link.active {
    background: rgba(196, 152, 31, .15);
    color: var(--totemia-green);
    font-weight: 800;
  }

  .laws-filter-marker {
    font-family: var(--mono);
    color: var(--totemia-gold);
    font-size: 13px;
    width: 14px;
    text-align: center;
  }

  .laws-search-results {
    min-width: 0;
  }

  .laws-search-summary {
    background: rgba(29, 90, 74, .07);
    border: 1px solid rgba(29, 90, 74, .2);
    border-left: 4px solid var(--totemia-green);
    border-radius: 6px;
    padding: 12px 16px;
    color: var(--totemia-green);
    font-size: 14px;
    margin: 0 0 14px;
  }

  .laws-search-empty {
    background: var(--totemia-paper);
    border: 1px dashed var(--totemia-line);
    border-radius: 8px;
    padding: 24px;
    color: var(--totemia-muted);
    text-align: center;
    font-size: 14px;
  }

  .laws-search-result-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .laws-search-result {
    background: var(--totemia-paper);
    border: 1px solid var(--totemia-line);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 10px;
    transition: border-color .15s ease, transform .1s ease;
  }

  .laws-search-result:hover {
    border-color: var(--totemia-gold);
    transform: translateY(-1px);
  }

  .laws-search-result-title {
    display: block;
    font-size: 15px;
    font-weight: 800;
    color: var(--totemia-red);
    text-decoration: none;
    margin-bottom: 6px;
  }

  .laws-search-result-title:hover {
    text-decoration: underline;
  }

  .laws-search-result-pub {
    font-size: 12px;
    font-weight: 600;
    color: var(--totemia-muted);
  }

  .laws-search-result-snippet {
    color: var(--totemia-ink);
    font-size: 13px;
    line-height: 1.55;
    margin: 0;
  }

  .laws-search-hit {
    background: rgba(196, 152, 31, .4);
    color: var(--totemia-ink);
    padding: 1px 3px;
    border-radius: 2px;
    font-weight: 700;
  }

  /* ── Imperial Orders — decree card layout ──────────────────────── */

  .imperial-orders-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .imperial-order-card {
    background: var(--totemia-paper);
    border: 1px solid var(--totemia-line);
    border-left: 5px solid var(--totemia-gold);
    border-radius: 8px;
    padding: 18px 22px 16px;
    box-shadow: 0 2px 6px rgba(42, 35, 23, .05);
    transition: box-shadow .15s ease, transform .1s ease;
    scroll-margin-top: 80px;
  }

  .imperial-order-card:hover {
    box-shadow: 0 6px 16px rgba(42, 35, 23, .08);
    transform: translateY(-1px);
  }

  .imperial-order-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: 1px solid var(--totemia-line);
    padding-bottom: 8px;
    margin-bottom: 10px;
  }

  .imperial-order-id {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 800;
    color: #fff8e6;
    background: var(--totemia-green);
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .imperial-order-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--totemia-green);
    margin: 0;
    flex: 1;
  }

  .imperial-order-body {
    color: var(--totemia-ink);
    font-size: 14.5px;
    line-height: 1.7;
  }

  .imperial-order-body > *:first-child {
    margin-top: 0;
  }

  .imperial-order-body > *:last-child {
    margin-bottom: 0;
  }

  .imperial-orders-intro {
    background: rgba(196, 152, 31, .07);
    border-left: 4px solid var(--totemia-gold);
    padding: 14px 18px;
    margin: 0 0 18px;
    border-radius: 0 6px 6px 0;
    color: var(--totemia-ink);
    font-size: 14px;
    line-height: 1.6;
  }

  /* ── Responsive ────────────────────────────────────────────────── */

  @media (max-width: 900px) {
    .law-document-layout {
      grid-template-columns: 1fr;
    }
    .law-toc-sidebar {
      position: static;
      max-height: none;
      margin-bottom: 14px;
    }
    .law-document-content {
      padding: 22px 20px;
    }
    .laws-search-layout {
      grid-template-columns: 1fr;
    }
    .laws-search-sidebar {
      position: static;
    }
  }

  @media (max-width: 600px) {
    .laws-category-grid {
      grid-template-columns: 1fr;
    }
    .law-document-header {
      padding: 16px 18px;
    }
    .law-document-header h1 {
      font-size: 22px;
    }
    .law-body {
      font-size: 14.5px;
    }
    .law-body h1,
    .law-body .law-chapter {
      font-size: 20px;
    }
    .law-body h2,
    .law-body .law-section {
      font-size: 17px;
    }
  }

/*
 * Fills missing portal class definitions used by Next.js pages.
 *
 * These class names are referenced in src/app/* components but were
 * never defined in the legacy portal stylesheets — when the user runs
 * with NEXT_PORTAL_ENABLED=true the Next pages render unstyled (huge
 * avatars, broken table layout, etc.). The selectors below match the
 * shape the legacy SPA uses for similar surfaces so Next pages look
 * identical to their SPA counterparts.
 *
 * If you find another missing class referenced by an app/ component,
 * add it here rather than spinning up a parallel CSS module — keep
 * portal styles consolidated.
 */

  /* ── Avatars used in Next directory + interior tables ─────────────── */

  .avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface, #ffffff);
    border: 1px solid var(--line, #e8dfbf);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .avatar-sm.avatar-fallback {
    color: var(--muted, #6a5b3a);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
  }

  /* Identity row used in directory / user-account tables: avatar + name. */
  .user-identity-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .user-identity-line > span {
    display: inline-flex;
    flex-direction: column;
    min-width: 0;
  }

  .user-identity-line strong {
    font-weight: 700;
    line-height: 1.2;
  }

  .user-identity-line .meta {
    color: var(--muted, #6a5b3a);
    font-size: 11px;
  }

  /* Inline medal cell (Next directory). */
  .medal-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .table-medal-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
  }

  .rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 14px;
    border: 1px solid var(--line, #e8dfbf);
    background: var(--surface, #ffffff);
    font-weight: 700;
    font-size: 12px;
  }

  .slim-btn {
    padding: 4px 10px !important;
    font-size: 12px !important;
    min-height: 28px !important;
  }

  .account-picker {
    position: relative;
    min-width: min(360px, 100%);
  }

  .account-picker-input {
    width: 100%;
  }

  .account-picker-menu {
    position: absolute;
    z-index: 30;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    display: none;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--line, #e8dfbf);
    border-radius: 8px;
    background: var(--surface, #ffffff);
    box-shadow: 0 12px 28px rgba(42, 35, 23, .12);
    padding: 4px;
  }

  .account-picker.open .account-picker-menu {
    display: grid;
    gap: 2px;
  }

  .account-picker.open .account-picker-menu:empty::before {
    content: attr(data-empty-message);
    display: block;
    padding: 10px 12px;
    color: var(--muted, #6a5b3a);
    font-size: 12px;
  }

  .account-picker-option {
    display: grid;
    gap: 2px;
    width: 100%;
    padding: 9px 10px;
    border: 0 !important;
    border-radius: 6px !important;
    background: transparent !important;
    color: var(--ink, #2a2317) !important;
    text-align: left;
    box-shadow: none !important;
  }

  .account-picker-option:hover,
  .account-picker-option:focus {
    background: rgba(18, 60, 50, .07) !important;
  }

  .account-picker-option span {
    color: var(--muted, #6a5b3a);
    font-size: 11px;
  }

  .salary-input-wrap {
    display: flex;
    align-items: center;
    min-width: min(260px, 100%);
    border: 1px solid var(--line, #e8dfbf);
    border-radius: 8px;
    background: var(--surface, #ffffff);
    overflow: hidden;
  }

  .salary-input-wrap > span {
    align-self: stretch;
    display: grid;
    place-items: center;
    min-width: 44px;
    padding: 0 10px;
    border-right: 1px solid var(--line, #e8dfbf);
    background: var(--gold-tint, #fff4d8);
    color: var(--gold-deep, #8a6700);
    font-weight: 900;
  }

  .salary-input-wrap input {
    min-width: 0;
    flex: 1 1 auto;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  input[type="color"] {
    width: 46px;
    height: 38px;
    padding: 3px !important;
    border-radius: 8px !important;
    cursor: pointer;
  }

  .checkbox-line {
    display: inline-flex !important;
    align-items: center;
    gap: 8px !important;
    min-height: 28px;
    color: var(--ink, #2a2317);
    font-weight: 700;
  }

  .checkbox-line input {
    width: 16px;
    height: 16px;
  }

  .official-section form fieldset {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .official-section form fieldset legend {
    margin: 0 0 2px;
    color: var(--muted, #6c614f);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
  }

  /* ──────────────────────────────────────────────────────────────────
     Missing class fills for Next.js components that invented class names
     never added to the portal CSS (AGENTS.md Rule 1.6). Styled to match
     the portal tokens + their sibling classes so these components render
     consistently instead of as raw HTML.
     ──────────────────────────────────────────────────────────────────*/

  /* Government / Treasury hub "tool" cards (treasury/page, government/page,
     account detail). Mirrors the SPA institution-record card. */
  .official-link-card {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 16px;
    border: 1px solid var(--line, #e8dfbf);
    border-radius: var(--r, 10px);
    background: var(--surface, #ffffff);
    box-shadow: var(--shadow-xs, 0 1px 2px rgba(42, 35, 23, .05));
  }
  .official-link-mark {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--totemia-paper, #ffffff);
    border: 1px solid var(--line, #e8dfbf);
    font-weight: 800;
    font-size: 14px;
    color: var(--totemia-green, #123c32);
  }
  .official-link-card h3 { margin: 4px 0; }
  .official-link-card p { color: var(--muted, #6a5b3a); margin: 0 0 10px; }

  /* Profile medals grid card (users/[siteUserId] ProfileTabs). */
  .medal-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line, #e8dfbf);
    border-radius: var(--r, 10px);
    background: var(--surface, #ffffff);
  }
  .medal-icon { width: 28px; height: 28px; object-fit: contain; flex-shrink: 0; }
  .medal-icon-text { font-size: 22px; line-height: 1; }
  .medal-icon-fallback {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    border: 1px solid var(--line, #e8dfbf);
    border-radius: 999px;
    background: var(--totemia-paper, #ffffff);
    color: var(--totemia-green, #123c32);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .04em;
  }

  /* Payroll salary table section wrapper (treasury/payroll SalaryTable). */
  .salary-section { margin-top: 16px; }

  /* Government account detail hero (government/accounts/[code]). */
  .account-profile-hero {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--line, #e8dfbf);
    border-radius: var(--r, 10px);
    background: var(--surface, #ffffff);
    border-top: 4px solid var(--gold, #c4981f);
    margin-bottom: 14px;
  }

  /* Profile section header row (users/[siteUserId] ProfileTabs). */
  .profile-section-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 10px;
  }

  /* Profile tab bar — flat bold underline (matches org public tabs). */
  .profile-tabbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 16px 0 18px;
    padding: 0 2px;
    border-bottom: 1px solid var(--totemia-line, var(--line));
  }

  .profile-tab {
    position: relative;
    display: block;
    appearance: none;
    border: 0;
    border-radius: 0;
    margin-bottom: -1px;
    padding: 11px 16px 15px;
    background: transparent;
    color: var(--totemia-muted, var(--muted));
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .01em;
    font-family: inherit;
    cursor: pointer;
    transition: color .12s ease, background-color .12s ease;
  }

  .profile-tab:hover:not(.active) {
    color: var(--totemia-green, var(--ink));
    background-color: color-mix(in srgb, var(--totemia-green, #123c32) 6%, transparent);
  }

  .profile-tab.active {
    color: var(--totemia-ink, var(--ink));
  }

  .profile-tab.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 4px;
    background: var(--totemia-green, #123c32);
    border-radius: 2px 2px 0 0;
  }

  @media (prefers-reduced-motion: reduce) {
    .profile-tab { transition: none; }
  }

  /* Interior account center table (government/ministry-of-interior/account-center). */
  .interior-accounts-table tbody td {
    vertical-align: top;
  }

  .interior-accounts-table .interior-account-user-cell {
    min-width: 180px;
    max-width: 240px;
  }

  .interior-accounts-table .interior-account-user-cell .public-member-identity {
    min-width: 0;
  }

  .interior-accounts-table .interior-account-user-cell .public-member-name {
    min-width: 0;
  }

  .interior-accounts-table .interior-account-user-cell .public-member-name strong,
  .interior-accounts-table .interior-account-user-cell .public-member-name small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .interior-accounts-table .interior-account-role-cell {
    min-width: 200px;
    width: 28%;
  }

  .interior-accounts-table .interior-account-roles {
    display: grid;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .interior-accounts-table .interior-account-roles li {
    padding-left: 8px;
    border-left: 2px solid var(--totemia-gold, #c7971a);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--totemia-ink, var(--ink));
    word-break: break-word;
  }

  .interior-accounts-table .interior-account-role-empty {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(42, 35, 23, 0.58);
  }

  .interior-accounts-table .interior-account-status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding-left: 10px;
    border-left: 3px solid currentColor;
    background: transparent;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.11em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .interior-accounts-table .interior-account-status.active {
    color: #6e4b00;
  }

  .interior-accounts-table .interior-account-status.pending {
    color: rgba(42, 35, 23, 0.58);
  }

  .interior-accounts-table .interior-connection-state {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding-left: 10px;
    border-left: 3px solid currentColor;
    background: transparent;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1.3;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .interior-accounts-table .interior-connection-state.linked {
    color: #4a5f7a;
    border-left-color: #4a5f7a;
  }

  .interior-accounts-table .interior-connection-state.unlinked {
    color: rgba(42, 35, 23, 0.52);
    border-left-color: rgba(42, 35, 23, 0.22);
  }

  /* Actions cell: a deliberate equal-width vertical stack so the two buttons
     line up cleanly and never wrap mid-word or sit at ragged widths — works
     the same on desktop and mobile. */
  .interior-accounts-table .record-actions.compact {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 0;
  }

  .interior-accounts-table td:last-child {
    min-width: 150px;
  }

  .interior-accounts-table .record-actions.compact > .official-link-button {
    width: 100%;
    min-height: 34px;
    padding: 7px 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  .interior-accounts-table .official-link-button:not(.quiet) {
    background: var(--totemia-gold, #c7971a);
    border: 1px solid #8a6320;
    color: #2a2317;
  }

  .interior-accounts-table .official-link-button:not(.quiet):hover {
    background: #d8b14a;
    color: #2a2317;
  }

  .interior-accounts-table .official-link-button.quiet {
    color: #6e4b00 !important;
  }

  .interior-accounts-table .public-member-avatar,
  .interior-accounts-table .public-member-avatar-fallback {
    color: #6e4b00;
  }

  .interior-accounts-table code {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--totemia-ink, var(--ink));
  }

  /* Flat "N shown" count — replaces the legacy rounded gold pill on this
     redesigned surface (no rounded badges per the modern bold look). */
  .interior-account-count {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding-left: 10px;
    border-left: 3px solid var(--totemia-gold, #c7971a);
    color: var(--totemia-ink, var(--ink));
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  /* Bold modern account search — full-width field, heavy text, leading glyph.
     Overrides the cramped multi-column filter grid for the single search box. */
  .interior-account-search-panel {
    display: block;
  }

  .interior-account-search {
    display: grid;
    gap: 8px;
  }

  .interior-account-search-field {
    position: relative;
    display: flex;
    align-items: center;
  }

  .interior-account-search-icon {
    position: absolute;
    left: 14px;
    color: var(--totemia-muted, #8a7d5a);
    pointer-events: none;
  }

  .interior-account-search-field input {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px 12px 44px;
    border: 2px solid var(--totemia-line) !important;
    border-radius: 4px;
    background: #ffffff !important;
    color: var(--totemia-ink, var(--ink));
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.01em;
  }

  .interior-account-search-field input::placeholder {
    color: var(--totemia-muted, #9a8c63);
    font-weight: 700;
  }

  .interior-account-search-field input:focus {
    border-color: var(--totemia-gold) !important;
    outline: 2px solid rgba(213, 182, 55, 0.28) !important;
    outline-offset: 0;
  }

  .interior-account-search-field:focus-within .interior-account-search-icon {
    color: var(--totemia-gold, #c7971a);
  }

  /* Created column: bold ordinal date over the viewer's local clock time
     (rendered client-side by LocalDateTime). */
  .interior-account-created-cell {
    min-width: 150px;
    white-space: normal;
  }

  .local-datetime {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .local-datetime-date {
    color: var(--totemia-ink, var(--ink));
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1.2;
  }

  .local-datetime-time {
    color: rgba(42, 35, 23, 0.58);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
  }

  /* Interior Discord account links (government/ministry-of-interior/links). */
  .interior-links-table .interior-link-discord {
    display: grid;
    gap: 4px;
  }

  .interior-links-table .interior-link-discord strong {
    color: var(--totemia-ink, var(--ink));
    font-size: 0.92rem;
    font-weight: 800;
  }

  .interior-links-table .interior-link-discord small {
    color: rgba(42, 35, 23, 0.58);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
  }

  .interior-links-permissions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .interior-links-empty {
    color: rgba(42, 35, 23, 0.58);
    font-size: 0.78rem;
    font-weight: 700;
  }

  /* Interior account lifecycle table (government/ministry-of-interior). */
  .interior-account-table { width: 100%; border-collapse: collapse; }
  .interior-account-table th,
  .interior-account-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line, #e8dfbf);
  }
  .interior-account-table thead th {
    background: rgba(18, 60, 50, .04);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted, #6a5b3a);
  }

  /* Website-role chips (users/[siteUserId] WebsiteRoleManager). */
  .role-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--totemia-paper, #ffffff);
    border: 1px solid var(--line, #e8dfbf);
    font-size: 11px;
    font-weight: 700;
    color: var(--ink, #2a2317);
  }

  /* Modal close button (shared: medal award, transfer, discord link). */
  .modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    border: 1px solid var(--line, #e8dfbf);
    background: var(--surface, #ffffff);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: var(--muted, #6a5b3a);
  }
  .modal-close-btn:hover { color: var(--ink, #2a2317); background: var(--totemia-paper, #ffffff); }

  /* Profile modals (users/[siteUserId] role + medal management). */
  .profile-dialog-root { z-index: 560; padding: 22px; }
  .profile-dialog {
    position: relative;
    width: min(620px, calc(100vw - 32px));
    max-height: calc(100dvh - 44px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden;
    border-radius: 16px;
    padding: 22px;
  }
  .profile-dialog header { position: relative; padding-right: 44px; }
  .profile-dialog h3 {
    margin: 0;
    font-size: 20px;
    line-height: 1.15;
    color: var(--ink, #2a2317);
  }
  .profile-dialog p {
    margin: 0;
    color: var(--muted, #6a5b3a);
    line-height: 1.55;
  }
  .profile-dialog .modal-actions {
    margin: 2px -22px -22px;
    padding: 14px 22px;
    border-top: 1px solid var(--line, #e8dfbf);
    background: rgba(250, 247, 238, .72);
  }
  .profile-role-review-dialog { width: min(560px, calc(100vw - 32px)); }
  .role-arm-progress { height: 7px; border-radius: 999px; background: rgba(18, 60, 50, .12); overflow: hidden; }
  .role-arm-progress div {
    height: 100%;
    border-radius: inherit;
    background: var(--gold, #c4981f);
  }

  /* Shared safety-arm confirm button (ArmingButton.tsx). Flat modern-bold
     control: light track while arming, a smooth bottom accent fill that runs
     the full duration in one CSS transition, then a solid accent button once
     armed. Replaces the old jerky setInterval width bars. */
  .arming-button {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 24px;
    border: 1px solid var(--totemia-line, #e3e6ea);
    border-radius: 0;
    background: #ffffff;
    color: var(--totemia-muted, #5b636c);
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .02em;
    cursor: not-allowed;
    box-shadow: none;
    transition: color .15s ease, background .15s ease, border-color .15s ease;
  }
  .arming-button.is-arming {
    color: var(--totemia-ink, #14171a);
    border-color: color-mix(in srgb, var(--totemia-green, #196251) 42%, var(--totemia-line, #e3e6ea));
    background: color-mix(in srgb, var(--totemia-green, #196251) 6%, #ffffff);
  }
  .arming-button.danger.is-arming {
    border-color: color-mix(in srgb, var(--totemia-danger, #b3261e) 42%, var(--totemia-line, #e3e6ea));
    background: color-mix(in srgb, var(--totemia-danger, #b3261e) 6%, #ffffff);
  }
  .arming-button.is-armed {
    cursor: pointer;
    color: #ffffff;
    background: var(--totemia-green, #196251);
    border-color: var(--totemia-green, #196251);
  }
  .arming-button.is-armed:hover {
    background: color-mix(in srgb, var(--totemia-green, #196251) 88%, #000000);
  }
  .arming-button.danger.is-armed {
    background: var(--totemia-danger, #b3261e);
    border-color: var(--totemia-danger, #b3261e);
  }
  .arming-button.danger.is-armed:hover {
    background: color-mix(in srgb, var(--totemia-danger, #b3261e) 88%, #000000);
  }
  .arming-button:disabled { box-shadow: none; }
  .arming-button-fill {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 0;
    background: var(--totemia-green, #196251);
    transition-property: width;
    transition-timing-function: linear;
    will-change: width;
  }
  .arming-button.danger .arming-button-fill { background: var(--totemia-danger, #b3261e); }
  .arming-button.is-armed .arming-button-fill { opacity: 0; }
  .arming-button-label { position: relative; z-index: 1; }
  @media (prefers-reduced-motion: reduce) {
    .arming-button-fill { transition-duration: 0ms !important; }
  }

  /* Medal-award modal internals (users/[siteUserId] MedalAwardButton). */
  .modal-medal-award { width: min(760px, calc(100vw - 32px)); max-width: none; }
  .modal-medal-toolbar { display: grid; gap: 6px; margin: 0; }
  .modal-medal-toolbar span {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted, #6a5b3a);
  }
  .modal-medal-toolbar input {
    min-height: 40px;
    border: 1px solid var(--line, #e8dfbf);
    border-radius: 10px;
    padding: 9px 12px;
    font: inherit;
    background: var(--surface, #ffffff);
    color: var(--ink, #2a2317);
  }
  .modal-medal-list {
    display: grid;
    gap: 8px;
    max-height: min(58vh, 560px);
    overflow: auto;
    padding-right: 2px;
  }
  .modal-medal-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line, #e8dfbf);
    border-radius: var(--r, 10px);
    background: var(--surface, #ffffff);
  }
  .modal-medal-identity {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
  }
  .modal-medal-name { min-width: 0; font-size: 13px; line-height: 1.25; }
  .modal-medal-name strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .modal-medal-pill {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--totemia-paper, #ffffff);
    border: 1px solid var(--line, #e8dfbf);
    color: var(--muted, #6a5b3a);
  }
  .modal-medal-counter { display: inline-flex; align-items: center; gap: 8px; }
  .modal-medal-counter input {
    width: 62px;
    height: 34px;
    border: 1px solid var(--line, #e8dfbf);
    border-radius: 8px;
    text-align: center;
    font: inherit;
    font-weight: 800;
    color: var(--ink, #2a2317);
  }
  .modal-medal-empty {
    padding: 18px;
    border: 1px dashed var(--line, #e8dfbf);
    border-radius: 10px;
    background: var(--totemia-paper, #ffffff);
    color: var(--muted, #6a5b3a);
    text-align: center;
    font-weight: 700;
  }
  .counter-btn {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line, #e8dfbf);
    border-radius: 8px;
    background: var(--totemia-paper, #ffffff);
    color: var(--totemia-green, #123c32);
    font: inherit;
    font-weight: 900;
    cursor: pointer;
  }
  .counter-btn:hover:not(:disabled) {
    background: var(--totemia-green, #123c32);
    color: #ffffff;
  }
  .counter-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
  }

  /* Generic primary action button used by a couple of Next modals
     (WebsiteRoleManager, TransferPanel). Matches the filled green
     official-link-button. */
  button.primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--totemia-green, #123c32);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }
  button.primary:hover { filter: brightness(1.08); }
  button.primary:disabled { opacity: .55; cursor: not-allowed; }

  /* ──────────────────────────────────────────────────────────────────
     System-wide Next.js anchor fixes. The SPA built buttons/nav/cards as
     <button> elements (no underline). The Next app uses <Link> (renders
     <a>, underlined by default), so every link-styled-as-button showed an
     underline. Reset text-decoration on those classes (buttons are
     unaffected — they never underline). Content links inside tables get
     the SPA's hover-only underline.

     UNIVERSAL RULE: anchors never underline by default anywhere in the
     portal. Per-class lists kept missing new surfaces (user identity
     links in role cards, application/audit panels, …), so the browser
     default leaked back on every new page. Surfaces that want an
     underline (hover states, readable law text) opt back in with their
     own higher-specificity rules, which all still apply.
     ──────────────────────────────────────────────────────────────────*/
  a {
    text-decoration: none;
  }

  /* Identity rows (avatar + name) inherit the surrounding ink instead of
     the browser's link blue; the name darkens via each surface's hover. */
  a.user-identity-line,
  .user-identity-line a {
    color: inherit;
  }
  .user-identity-line:hover strong {
    color: var(--gold-deep, #8a6700);
  }

  .official-link-button,
  .official-secondary,
  .secondary,
  .official-nav-link,
  .portal-nav-link,
  .settings-side-tab,
  .official-link-card,
  .public-party-card,
  .medal-card,
  .party-doc-color-cta,
  .party-doc-leader-identity,
  .public-member-identity,
  .user-open-btn,
  .slim-btn,
  .official-badge,
  .role-badge,
  .official-nav-menu a,
  .hub-card a,
  .institution-record a {
    text-decoration: none;
  }
  .official-link-button:hover,
  .official-secondary:hover,
  .secondary:hover,
  .official-nav-link:hover,
  .portal-nav-link:hover,
  .settings-side-tab:hover,
  .slim-btn:hover,
  .official-nav-menu a:hover,
  .hub-card a:hover,
  .institution-record a:hover {
    text-decoration: none;
  }
  .public-ledger-table a,
  .table-shell a,
  .directory-table a {
    text-decoration: none;
  }
  .public-ledger-table a:hover,
  .table-shell a:hover,
  .directory-table a:hover {
    text-decoration: underline;
  }

  /* Empty seal boxes. The Next hub heroes (treasury, government, payroll,
     home, interior, account detail) render
     <div class="official-seal"> with no child, while the SPA fills it
     with the crest / ministry image. Paint the imperial crest as a
     background ONLY when the seal is empty (:empty), so SPA seals that
     contain an <img> child are left untouched. */
  .official-seal:empty {
    background-image: url("/assets/coats-of-arms/Imperial_Coat_of_Arms_Totemia.png");
    background-size: 60px 60px;
    background-position: center;
    background-repeat: no-repeat;
  }

  /* Government-account Operations tab (Next port of the SPA transfer/print). */
  .ops-mode-toggle {
    display: inline-flex;
    gap: 6px;
    margin: 4px 0 16px;
    padding: 4px;
    border: 1px solid var(--totemia-line);
    border-radius: 10px;
    background: var(--surface-2);
  }
  .ops-mode-pill {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--totemia-muted);
    font-weight: 800;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 7px;
    cursor: pointer;
    box-shadow: none;
  }
  .ops-mode-pill.active { background: var(--totemia-green); color: #fff; }
  .ops-from-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--totemia-line);
    border-radius: 10px;
    background: var(--surface-2);
  }
  .ops-from-line span {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--totemia-muted);
  }
  .ops-from-line strong { font-family: var(--mono); font-weight: 800; color: var(--totemia-ink); }
  .ops-auth-line { margin: 12px 0; font-size: 12px; color: var(--totemia-muted); }
  .ops-submit {
    appearance: none;
    border: 1px solid var(--gold-deep);
    border-radius: 8px;
    background: var(--totemia-gold);
    color: #1a1000;
    font-weight: 900;
    font-size: 14px;
    padding: 12px 22px;
    cursor: pointer;
    transition: filter .1s linear;
  }
  .ops-submit:hover:not(:disabled) { filter: brightness(.97); }
  .ops-submit:disabled { opacity: .5; cursor: not-allowed; }

  /* Native select styled to match portal controls (Next map viewers, etc.). */
  select.official-select {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    border: 1px solid var(--line, #e3e6ea);
    border-radius: 8px;
    background-color: var(--surface, #ffffff);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%235b636c' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round' d='M1.5 2.25L6 6.25l4.5-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding: 8px 34px 8px 12px;
    min-height: 36px;
    min-width: min(200px, 100%);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink, #14171a);
    cursor: pointer;
    box-shadow: var(--shadow-xs, 0 1px 3px rgba(0, 0, 0, .06));
    transition: border-color .12s ease, box-shadow .12s ease;
  }
  select.official-select:hover {
    border-color: var(--gold-border, #e0cd84);
  }
  select.official-select:focus {
    outline: none;
    border-color: var(--gold, #c4981f);
    box-shadow: 0 0 0 2px rgba(196, 152, 31, .22);
  }
  @media (prefers-reduced-motion: reduce) {
    select.official-select { transition: none; }
  }

/* Laws readability pass. This layers over 13-laws.css without introducing
 * a separate visual system.
 */

.laws-category-card,
.law-document-header,
.law-document-content,
.law-toc-sidebar,
.laws-search-sidebar,
.laws-search-result,
.laws-access-section {
  box-shadow: none;
  border-radius: 8px;
}

.laws-category-grid {
  gap: 14px;
}

.laws-category-card {
  padding: 18px 18px 16px;
  transition: border-color .15s ease, background .15s ease;
}

.laws-category-card::before {
  display: none;
}

.laws-category-card:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--totemia-gold);
  background: #ffffff;
}

.laws-category-card-title,
.laws-category-card h2 {
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0;
}

.laws-category-card-tagline,
.laws-category-card p {
  font-size: 13px;
  line-height: 1.6;
}

.laws-category-card-cta {
  letter-spacing: 0;
}

.law-type-badge {
  border-radius: 3px;
  letter-spacing: .06em;
}

.laws-access-section {
  margin-top: 20px;
  background: var(--totemia-paper);
  border: 1px solid var(--totemia-line);
  padding: 16px 18px;
}

.laws-access-section .official-section-head {
  margin-bottom: 10px;
}

.laws-search-input:focus {
  box-shadow: none;
  outline: 2px solid rgba(196, 152, 31, .3);
  outline-offset: 1px;
}

.law-document-header h1 {
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: 0;
}

.law-document-summary {
  max-width: 840px;
}

.law-download-row {
  align-items: flex-start;
}

.law-download-menu {
  position: relative;
  flex: 0 0 auto;
}

.law-download-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  list-style: none;
}

.law-download-toggle::-webkit-details-marker {
  display: none;
}

.law-download-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  min-width: 210px;
  background: var(--totemia-paper);
  border: 1px solid var(--totemia-line);
  border-radius: 8px;
  padding: 6px;
}

.law-download-option {
  display: grid;
  gap: 1px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--totemia-ink);
  text-decoration: none;
}

.law-download-option:hover {
  background: rgba(196, 152, 31, .1);
  color: var(--totemia-green);
}

.law-download-option span {
  font-weight: 800;
  font-size: 13px;
}

.law-download-option small {
  color: var(--totemia-muted);
  font-size: 11px;
}

.law-body {
  font-size: 15px;
  line-height: 1.72;
}

.law-body h1,
.law-body .law-chapter {
  font-size: 21px;
  letter-spacing: .02em;
  max-width: none;
}

.law-body h2,
.law-body .law-section {
  border-left-width: 3px;
  border-radius: 0 3px 3px 0;
}

.law-toc-item--h1 > a,
.laws-filter-marker,
.imperial-order-id {
  font-family: inherit;
}

.laws-filter-marker {
  width: 12px;
  height: 12px;
  border: 1px solid var(--totemia-gold);
  border-radius: 3px;
  flex: 0 0 auto;
}

.laws-filter-link.active .laws-filter-marker {
  background: var(--totemia-gold);
}

.laws-search-summary {
  box-shadow: none;
}

.laws-search-result {
  padding: 0;
  overflow: hidden;
  transition: border-color .15s ease, background .15s ease;
}

.laws-search-result:hover {
  transform: none;
  background: #ffffff;
}

.laws-search-result-link {
  display: grid;
  gap: 6px;
  padding: 14px 18px;
  color: inherit;
  text-decoration: none;
}

.laws-search-result-title {
  color: var(--totemia-green);
  margin-bottom: 0;
}

.laws-search-result-section {
  color: var(--totemia-muted);
  font-size: 12px;
  font-weight: 800;
}

.laws-search-result-snippet {
  display: block;
}

.laws-search-result-link:hover .laws-search-result-title {
  text-decoration: underline;
}

.publication-landing .official-section,
.publication-detail {
  box-shadow: none;
}

.publication-landing {
  width: min(1320px, 100%);
}

.publication-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 18px;
}

.publication-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.publication-result {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  margin: 0;
  border-top: 5px solid var(--totemia-gold);
  background: #ffffff;
}

.publication-result-link {
  grid-template-rows: auto 1fr;
  gap: 0;
  height: 100%;
  padding: 0;
}

.publication-result-media {
  display: block;
  height: 170px;
  border-bottom: 1px solid var(--totemia-line);
  background: var(--surface-2);
}

.publication-result-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.publication-result-main {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 16px 18px 18px;
}

.publication-result-actions {
  border-top: 1px solid var(--totemia-line);
  padding: 10px 18px 14px;
}

.publication-timeline-count {
  display: block;
  margin-top: 8px;
  color: var(--totemia-green);
  font-size: 12px;
  font-weight: 800;
}

.publication-project-finder {
  margin-bottom: 18px;
}

.publication-project-list {
  display: grid;
  gap: 1px;
  border: 1px solid var(--totemia-line);
  background: var(--totemia-line);
}

.publication-project-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 14px;
  padding: 13px 14px;
  background: var(--totemia-paper);
  color: var(--totemia-ink);
  text-decoration: none;
}

.publication-project-link strong {
  min-width: 0;
  color: var(--totemia-green);
  font-size: 14px;
}

.publication-project-link span,
.publication-project-link small {
  color: var(--totemia-muted);
  font-size: 12px;
}

.publication-project-link small {
  grid-column: 1 / -1;
}

.publication-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto 14px;
  color: var(--totemia-muted);
  font-size: 13px;
}

.publication-breadcrumb span:last-child {
  color: var(--totemia-ink);
  font-weight: 800;
}

.publication-detail {
  width: min(1240px, calc(100vw - 32px));
  margin-inline: auto;
  overflow: hidden;
  border-top: 6px solid var(--totemia-gold);
}

.publication-cover {
  margin: 0;
  border-bottom: 1px solid var(--totemia-line);
  background: var(--surface-2);
}

.publication-cover img {
  display: block;
  width: 100%;
  max-height: 460px;
  object-fit: cover;
}

.publication-document-header {
  border: 0;
  border-bottom: 1px solid var(--totemia-line);
  border-radius: 0;
  margin: 0;
  padding: clamp(22px, 4vw, 42px) clamp(22px, 5vw, 58px);
}

.publication-detail-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.publication-detail-kicker {
  display: inline-block;
  border-left: 4px solid var(--totemia-gold);
  padding-left: 10px;
  color: var(--totemia-green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.publication-document-header h1 {
  max-width: 980px;
  margin-top: 12px;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: .98;
}

.publication-body-section {
  padding: clamp(28px, 4vw, 50px) clamp(22px, 5vw, 58px);
}

.publication-body:empty::before {
  content: "No body text provided.";
  color: var(--totemia-muted);
}

.publication-body {
  width: min(100%, 1040px);
  font-size: 18px;
  line-height: 1.78;
}

.publication-body .publication-align-center {
  text-align: center;
}

.publication-body .publication-align-right {
  text-align: right;
}

.publication-body .publication-align-justify {
  text-align: justify;
}

.publication-inline-image {
  display: grid;
  gap: 7px;
  margin: 20px 0;
}

.publication-inline-image img {
  width: 100%;
  max-height: 560px;
  object-fit: contain;
  border: 1px solid var(--totemia-line);
  background: var(--surface-2);
}

.publication-inline-image figcaption {
  color: var(--totemia-muted);
  font-size: 12px;
}

.publication-image-left {
  float: left;
  width: min(42%, 360px);
  margin: 6px 22px 16px 0;
}

.publication-image-right {
  float: right;
  width: min(42%, 360px);
  margin: 6px 0 16px 22px;
}

.publication-image-center {
  width: min(100%, 760px);
  margin-inline: auto;
}

.publication-image-wide {
  width: 100%;
}

.publication-downloads .record-actions {
  align-items: flex-start;
}

.publication-downloads .official-link-button {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.publication-timeline {
  margin-top: 20px;
}

.publication-timeline.horizontal {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.publication-timeline.horizontal .history-story {
  min-width: 240px;
  border-left: 3px solid var(--totemia-gold);
  padding-left: 14px;
}

.publication-timeline.horizontal .history-story-node {
  display: none;
}

.publication-timeline-image {
  display: block;
  width: min(100%, 640px);
  margin-top: 12px;
  border: 1px solid var(--totemia-line);
  border-radius: 6px;
  background: var(--surface-2);
}

.publication-workspace-panel {
  display: grid;
  gap: 18px;
}

.interior-workspace-content form.publication-editor-form,
form.publication-editor-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  width: min(100%, 920px);
  max-width: 100%;
  padding-top: 16px;
  border-top: 1px solid var(--totemia-line);
}

.publication-editor-grid,
.publication-timeline-draft {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.publication-editor-grid .wide,
.publication-timeline-draft .wide,
.publication-editor-form .official-section-head,
.publication-timeline-editor,
.publication-timeline-draft .record-actions {
  grid-column: 1 / -1;
}

.publication-editor-form label,
.publication-timeline-draft label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--totemia-ink);
  font-weight: 800;
}

.publication-editor-form input,
.publication-editor-form select,
.publication-editor-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--totemia-line);
  border-radius: 6px;
  background: var(--totemia-paper);
  color: var(--totemia-ink);
  font: inherit;
  font-weight: 500;
  padding: 9px 10px;
}

.publication-editor-form textarea {
  min-height: 112px;
  resize: vertical;
}

.publication-timeline-editor {
  display: grid;
  gap: 12px;
}

.publication-timeline-draft {
  padding: 12px 0;
  border-top: 1px solid var(--totemia-line);
}

.publication-timeline-image-upload {
  display: grid;
  gap: 8px;
  align-content: start;
  font-weight: 900;
}

.publication-publisher-error {
  margin: 0;
  color: #8f1f1f;
  font-weight: 800;
}

.publication-publisher-result {
  margin: 0;
  color: var(--totemia-green);
  font-weight: 800;
}

.publication-upload-progress {
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--totemia-line);
  border-radius: 999px;
  background: var(--surface-2);
}

.publication-upload-progress span {
  display: block;
  height: 100%;
  background: var(--totemia-gold);
}

.publication-studio {
  display: grid;
  gap: 18px;
}

.publication-studio-head,
.publication-studio-layout,
.publication-timeline-grid {
  display: grid;
  gap: 16px;
}

.publication-studio-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.publication-save-state {
  border-left: 3px solid var(--totemia-muted);
  padding: 3px 0 3px 10px;
  color: var(--totemia-muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.publication-save-state.saving {
  border-left-color: var(--totemia-gold);
  color: var(--totemia-gold);
}

.publication-save-state.saved {
  border-left-color: var(--totemia-green);
  color: var(--totemia-green);
}

.publication-save-state.error {
  border-left-color: #8f1f1f;
  color: #8f1f1f;
}

.publication-studio-layout {
  grid-template-columns: minmax(0, 1fr) minmax(250px, 310px);
  align-items: start;
}

.publication-canvas,
.publication-settings-rail,
.publication-timeline-builder {
  border-top: 1px solid var(--totemia-line);
  padding-top: 16px;
}

.publication-title-input,
.publication-summary-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--totemia-line);
  border-radius: 0;
  background: transparent;
  color: var(--totemia-ink);
  font: inherit;
}

.publication-title-input {
  min-height: 58px;
  font-size: 38px;
  font-weight: 900;
  line-height: 1.08;
}

.publication-summary-input {
  min-height: 72px;
  margin-top: 8px;
  resize: vertical;
  font-size: 16px;
  line-height: 1.6;
}

.publication-toolbar,
.publication-insert-row,
.publication-insert-row form,
.publication-upload-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.publication-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-top: 14px;
  padding: 8px 0;
  border-top: 1px solid var(--totemia-line);
  border-bottom: 1px solid var(--totemia-line);
  background: var(--totemia-paper);
}

.publication-tool-button {
  min-width: 34px;
  min-height: 34px;
  border: 1px solid var(--totemia-line);
  border-radius: 6px;
  background: var(--totemia-paper);
  color: var(--totemia-ink);
  font-weight: 900;
}

.publication-tool-button.active,
.publication-tool-button:hover {
  border-color: var(--totemia-gold);
  color: var(--totemia-green);
}

.publication-insert-row {
  padding: 10px 0;
}

.publication-insert-row input,
.publication-insert-row select,
.publication-settings-rail input,
.publication-settings-rail select,
.publication-date-picker input,
.publication-date-picker select,
.publication-timeline-builder input,
.publication-timeline-builder textarea {
  border: 1px solid var(--totemia-line);
  border-radius: 6px;
  background: var(--totemia-paper);
  color: var(--totemia-ink);
  font: inherit;
  padding: 8px 9px;
}

.publication-file-input,
.publication-file-picker input {
  display: none;
}

.publication-cover-control {
  display: grid;
  gap: 8px;
  font-weight: 900;
}

.publication-cover-control img,
.publication-timeline-image-upload img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border: 1px solid var(--totemia-line);
  background: var(--surface-2);
}

.publication-cover-control strong,
.publication-timeline-image-upload strong {
  border-left: 3px solid var(--totemia-muted);
  padding-left: 9px;
  color: var(--totemia-muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.publication-date-picker {
  display: grid;
  gap: 10px;
  margin: 0;
  border: 1px solid var(--totemia-line);
  padding: 12px;
}

.publication-date-picker > span {
  color: var(--totemia-green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.publication-date-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.publication-editor-surface {
  min-height: 520px;
  padding: 26px 0 40px;
}

.publication-editor-surface .ProseMirror {
  min-height: 480px;
  outline: 0;
  font-size: 16px;
  line-height: 1.78;
}

.publication-editor-surface .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--totemia-muted);
  pointer-events: none;
  height: 0;
}

.publication-editor-surface .ProseMirror img {
  display: block;
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
  border: 1px solid var(--totemia-line);
  background: var(--surface-2);
}

.publication-editor-surface .ProseMirror img[data-align="left"] {
  float: left;
  width: min(42%, 360px);
  margin: 6px 22px 16px 0;
}

.publication-editor-surface .ProseMirror img[data-align="right"] {
  float: right;
  width: min(42%, 360px);
  margin: 6px 0 16px 22px;
}

.publication-editor-surface .ProseMirror img[data-align="center"] {
  margin: 18px auto;
}

.publication-editor-surface .ProseMirror img[data-align="wide"] {
  width: 100%;
  margin: 18px 0;
}

.publication-settings-rail {
  display: grid;
  gap: 13px;
}

.publication-settings-rail label {
  display: grid;
  gap: 6px;
  font-weight: 900;
}

.publication-release-box {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--totemia-line);
  padding-top: 12px;
}

.publication-release-box p {
  margin: 0;
  color: var(--totemia-muted);
  font-size: 13px;
  line-height: 1.5;
}

.publication-timeline-builder {
  display: grid;
  gap: 14px;
}

.publication-timeline-grid {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
}

.publication-timeline-preview {
  display: grid;
  gap: 10px;
  align-content: start;
  border-left: 1px solid var(--totemia-line);
  padding-left: 14px;
}

.publication-timeline-preview.horizontal {
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  overflow-x: auto;
}

.publication-timeline-preview article {
  display: grid;
  gap: 4px;
  border-left: 3px solid var(--totemia-gold);
  padding-left: 10px;
}

.publication-timeline-preview time,
.publication-timeline-preview span {
  color: var(--totemia-muted);
  font-size: 12px;
}

.imperial-orders-list {
  gap: 10px;
}

.imperial-order-card {
  padding: 0;
  box-shadow: none;
  transition: border-color .15s ease, background .15s ease;
  overflow: hidden;
}

.imperial-order-card:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--totemia-gold);
}

.imperial-order-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 15px 18px;
  cursor: pointer;
  list-style: none;
}

.imperial-order-summary::-webkit-details-marker {
  display: none;
}

.imperial-order-title {
  font-size: 15px;
  line-height: 1.35;
}

.imperial-order-action {
  color: var(--totemia-muted);
  font-size: 12px;
  font-weight: 800;
}

.imperial-order-card[open] .imperial-order-action {
  color: var(--totemia-green);
}

.imperial-order-body {
  border-top: 1px solid var(--totemia-line);
  padding: 14px 18px 18px;
}

@media (max-width: 700px) {
  .publication-editor-grid,
  .publication-timeline-draft {
    grid-template-columns: minmax(0, 1fr);
  }

  .publication-image-left,
  .publication-image-right {
    float: none;
    width: 100%;
    margin: 18px 0;
  }

  .publication-studio-head,
  .publication-studio-layout,
  .publication-timeline-grid,
  .publication-detail-heading,
  .publication-date-inline {
    grid-template-columns: minmax(0, 1fr);
  }

  .publication-settings-rail,
  .publication-timeline-preview {
    border-left: 0;
    padding-left: 0;
  }

  .publication-title-input {
    font-size: 30px;
  }

  .publication-timeline.horizontal,
  .publication-timeline-preview.horizontal {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow-x: visible;
  }

  .law-download-menu,
  .law-download-toggle,
  .law-download-options {
    width: 100%;
  }

  .law-download-options {
    position: static;
    margin-top: 6px;
  }

  .imperial-order-summary {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* Government menu + mobile masthead navigation */
.mobile-nav-toggle {
  display: none;
}

/* Account links (Profile / Settings / Sign Out) live in the hamburger drawer
 * only — the desktop path is the top-right avatar menu. */
.mobile-nav-account {
  display: none;
}

/* ── Desktop mega-menus (Government + About) ─────────────────────────
 * Larger, city-government-style dropdown panels. They open on click (the
 * shared .official-nav-dropdown.open rule in 01-variables-base.css drives
 * visibility) and keep the brand gold/green/cream look. */
.government-nav-menu {
  width: min(880px, calc(100vw - 32px));
  padding: 18px;
}

.government-nav-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.government-nav-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.government-nav-column .registry-label {
  padding: 2px 10px 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--totemia-line);
}

.official-nav-menu .government-nav-column a {
  border-top: 0 !important;
  border-radius: 8px;
  padding: 9px 10px !important;
  font-size: 13.5px;
  line-height: 1.3;
}

.government-nav-column a.active {
  background: rgba(213, 182, 55, .16);
  color: var(--totemia-green);
}

/* About panel: two columns of richer items (title + one-line descriptor). */
.about-nav-menu {
  width: min(560px, calc(100vw - 32px));
  padding: 14px;
}

.about-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.official-nav-menu .about-nav-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px !important;
  border-radius: 10px;
  line-height: 1.35;
}

.about-nav-item-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--totemia-ink);
}

.about-nav-item-desc {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--totemia-muted);
}

.official-nav-menu .about-nav-item:hover .about-nav-item-title,
.official-nav-menu .about-nav-item.active .about-nav-item-title {
  color: var(--totemia-green);
}

.official-nav-menu .about-nav-item.active {
  background: rgba(213, 182, 55, .14);
}

@media (max-width: 720px) {
  /* Inside the mobile drawer the mega-menus collapse to a single column and
   * drop their fixed desktop widths. */
  .government-nav-menu,
  .about-nav-menu {
    width: 100% !important;
  }
  .about-nav-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  /* Lock the page behind the open drawer. overflow:hidden on the body alone
   * let the page keep scrolling/rubber-banding underneath on mobile, so lock
   * the documentElement too and stop scroll chaining with overscroll-behavior
   * (the JS toggles `mobile-nav-open` on both <html> and <body>). */
  html.mobile-nav-open,
  body.mobile-nav-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  /* Menu toggle sits at the far LEFT of the masthead (account/profile stays
   * on the right). Two distinct corners, the standard app-bar layout — not
   * two near-identical round buttons crowded together on the right. */
  .mobile-nav-toggle {
    position: fixed;
    top: max(6px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
    z-index: 1200;
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #fff;
    box-shadow: none;
    transition: color .1s linear;
  }

  .mobile-nav-toggle.active {
    border: 0;
    background: transparent;
    color: #fff;
  }

  /* Three 2px bars with a 5px gap. The outer bars sit exactly (gap + bar) =
   * 7px from the centre line, so translating them ±7px lands both diagonals on
   * the same point — a clean, symmetric X rather than the previous half-formed
   * cross (2.5px bars never reached centre with a 7px shift). */
  .mobile-nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .16s cubic-bezier(.2, .8, .2, 1), opacity .1s linear;
  }

  .mobile-nav-toggle.active span:first-child {
    transform: translateY(7px) rotate(45deg);
  }

  .mobile-nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .mobile-nav-toggle.active span:last-child {
    transform: translateY(-7px) rotate(-45deg);
  }

  .masthead {
    /* Reserve room for the toggle on the left and the profile button on the
     * right so the brand/title never slides under either. */
    padding-left: calc(64px + env(safe-area-inset-left)) !important;
    padding-right: calc(64px + env(safe-area-inset-right)) !important;
  }

  .masthead-user {
    position: absolute;
    right: max(10px, env(safe-area-inset-right));
    top: max(6px, env(safe-area-inset-top));
    z-index: 1210;
  }

  .masthead-profile-btn {
    min-width: 44px;
    max-width: none !important;
    width: 44px;
    height: 44px;
    justify-content: center;
    padding: 4px !important;
  }

  .masthead-profile-btn > span:not(.masthead-avatar):not(.masthead-caret),
  .masthead-profile-btn > strong {
    display: none !important;
  }

  .masthead-caret {
    display: none;
  }

  .global-nav {
    min-height: 0;
    padding: 0 !important;
    border-bottom: 0 !important;
  }

  .global-nav > .official-nav-inner,
  .global-nav .official-nav-inner {
    position: fixed;
    top: var(--masthead-h, 56px);
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1100;
    display: none;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 12px 14px 24px !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--totemia-paper);
    border-top: 1px solid var(--totemia-line);
    box-shadow: none;
  }

  .global-nav .official-nav-inner.mobile-open,
  body.mobile-nav-open .global-nav .official-nav-inner {
    display: flex;
    animation: governmentMenuIn .12s cubic-bezier(.2, .8, .2, 1);
  }

  .official-nav-inner,
  .official-nav-primary,
  .official-nav-account {
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    overflow: visible !important;
  }

  .official-nav-primary > *,
  .official-nav-account > *,
  .official-nav-dropdown {
    flex: 0 0 auto !important;
  }

  .official-nav-primary > .official-nav-link,
  .official-nav-account > .official-nav-link,
  .official-nav-account > button,
  .mobile-nav-account > .official-nav-link,
  .mobile-nav-account > button,
  .official-nav-trigger {
    width: 100%;
    justify-content: space-between !important;
    border: 0;
    border-radius: 6px;
    padding: 13px 14px !important;
    text-align: left;
  }

  /* Account section: shown only in the drawer, separated by a divider. */
  .mobile-nav-account {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--totemia-line);
  }

  .mobile-nav-account > button {
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
  }

  .official-nav-dropdown {
    width: 100%;
  }

  /* In the drawer the dropdowns are a true accordion: collapsed by default,
   * expanded only when their trigger marks the group `open`. display:none
   * (rather than opacity) means a collapsed group cannot be scrolled to or
   * focused, so the drawer stays short and the page does not need to scroll. */
  .official-nav-menu,
  .government-nav-menu {
    position: static !important;
    width: 100%;
    min-width: 0;
    display: none;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    border: 1px solid var(--totemia-line);
    border-top: 1px solid var(--totemia-line);
    border-radius: 6px;
    box-shadow: none;
    padding: 8px;
    margin-top: 4px;
    background: var(--surface-2);
  }

  .official-nav-dropdown.open > .official-nav-menu,
  .official-nav-dropdown.open > .government-nav-menu {
    display: block;
    animation: governmentMenuIn .12s cubic-bezier(.2, .8, .2, 1);
  }

  .official-nav-dropdown:not(.open) .official-nav-caret {
    transform: none;
  }

  .official-nav-dropdown.open .official-nav-caret {
    transform: rotate(180deg);
  }

  .government-nav-columns {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .government-nav-column a {
    padding: 10px 12px !important;
  }
}

/* Public government information pages */
.government-profile-hero {
  position: relative;
  grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
  min-height: 180px;
  border-top-color: var(--totemia-green);
  animation: governmentPageIn .22s ease-out;
}

.government-hero-flag {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  min-height: 132px;
  place-items: center;
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--totemia-line) 80%, transparent);
  border-radius: 4px;
  background: #fff;
}

.government-hero-flag img {
  width: 100%;
  height: 100%;
  max-height: 150px;
  object-fit: contain;
}

.government-hero-copy {
  position: relative;
  z-index: 1;
}

.government-native-title {
  margin-bottom: 8px !important;
  color: var(--totemia-green) !important;
  font-weight: 800;
}

.government-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
}

.government-main-column {
  min-width: 0;
}

.government-info-doc {
  box-shadow: none !important;
  /* Government records are flat, square-cornered documents — match the
     modern org surfaces instead of the rounded 12px party-doc default. */
  border-radius: 4px !important;
}

.government-page-layout > .government-main-column .party-doc-section:first-child,
.government-page-layout > .government-portrait-panel {
  border-top: 0;
}

/* ── Ministry identity accents ──────────────────────────────────────
   Each ministry workspace carries its own accent so it reads as that
   office at a glance: the Ministry of Finance is the imperial dark
   green; the Ministry of Interior is a medium blue. The accent colors
   the hero's top rule, frames the seal, and marks the active sidebar
   tab — nothing decorative beyond that. */
.ministry-accent-finance {
  --ministry-accent: var(--totemia-green, #196251);
}

.ministry-accent-interior {
  --ministry-accent: #4387d9;
}

.ministry-accent-infrastructure {
  --ministry-accent: #173e68;
}

.ministry-accent-agriculture {
  --ministry-accent: #c6a100;
}

.ministry-accent-engineering {
  --ministry-accent: #980812;
}

.official-hero.ministry-accent-finance,
.official-hero.ministry-accent-interior,
.official-hero.ministry-accent-infrastructure,
.official-hero.ministry-accent-agriculture,
.official-hero.ministry-accent-engineering {
  border-top: 3px solid var(--ministry-accent);
}

.official-hero.ministry-accent-interior h1 {
  color: var(--ministry-accent);
}

.official-hero.ministry-accent-finance .official-seal,
.official-hero.ministry-accent-interior .official-seal,
.official-hero.ministry-accent-infrastructure .official-seal,
.official-hero.ministry-accent-agriculture .official-seal,
.official-hero.ministry-accent-engineering .official-seal {
  background: #ffffff;
  border-color: color-mix(in srgb, var(--ministry-accent) 38%, var(--totemia-line));
}

.official-hero.ministry-accent-finance .official-seal-img,
.official-hero.ministry-accent-interior .official-seal-img,
.official-hero.ministry-accent-infrastructure .official-seal-img,
.official-hero.ministry-accent-agriculture .official-seal-img,
.official-hero.ministry-accent-engineering .official-seal-img {
  object-fit: contain;
}

/* The active sidebar tab is themed by --ministry-accent directly in the base
   .interior-sidebar-nav rule (06-interior-staff.css), which the per-ministry
   --ministry-accent values below cascade into — no separate override needed. */

/* Illustrative diagram on the public /government/about page. Flat white
   card framing the supplied structure image — no decorative treatment. */
.government-structure-figure {
  margin: 18px 0 0;
  padding: 16px;
  border: 1px solid var(--totemia-line);
  border-radius: 4px;
  background: #ffffff;
}

.government-structure-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

.government-structure-figure figcaption {
  margin-top: 10px;
  color: var(--totemia-muted);
  font-size: 12.5px;
  text-align: center;
}

.government-quote-panel {
  margin-top: 12px;
  padding: 12px 16px;
  border-left: 3px solid var(--totemia-gold);
  background: #ffffff;
}

.government-quote-panel p {
  max-width: 92ch;
  margin: 0;
  color: var(--totemia-ink);
  line-height: 1.62;
  font-size: 14px;
}

.government-quote-panel p + p {
  margin-top: 12px;
}

.government-info-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0 18px;
  margin: 14px 0 0;
}

.government-info-item {
  display: grid;
  grid-template-columns: minmax(120px, .5fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid color-mix(in srgb, var(--totemia-line) 62%, transparent);
}

.government-info-item dt,
.government-chancellor-facts dt {
  margin: 0;
  color: var(--totemia-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.government-info-item dd,
.government-chancellor-facts dd {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
  color: var(--totemia-ink);
  font-size: 14px;
  line-height: 1.45;
}

.government-info-item dd span:first-child {
  font-weight: 800;
  color: var(--totemia-green);
}

.government-portrait-panel {
  padding: 24px;
  border-left: 1px solid color-mix(in srgb, var(--totemia-line) 70%, transparent);
}

.government-portrait-frame {
  display: grid;
  width: 100%;
  aspect-ratio: 3 / 4;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--totemia-line);
  border-radius: 4px;
  background: #ffffff;
}

/* Absolutely fill the frame box so the image is contained within the fixed
 * 3:4 frame — NOT sized to its own min-content. As an in-flow grid item a
 * taller-than-3:4 portrait (most Minecraft skins are ~1:2) grew the grid row
 * to its intrinsic height and overflowed the aspect-ratio frame, which
 * `overflow:hidden` then clipped — cropping the head and feet. Only portraits
 * that happened to be exactly 3:4 (e.g. the Interior minister) escaped it.
 * Absolute positioning takes the image out of flow, so the frame keeps its
 * 3:4 box and `contain` shows the whole portrait, never cropped. */
.government-portrait-frame > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.government-portrait-placeholder {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 18px;
  text-align: center;
  color: var(--totemia-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.government-portrait-placeholder img {
  width: min(120px, 70%);
  max-height: 160px;
  object-fit: contain;
}

/* Portrait + caption infobox. The holder's name sits directly beneath the
 * portrait (instead of buried in the record table) so a reader — or a crawler
 * — sees who currently holds the office at a glance. */
.government-portrait-figure {
  margin: 0;
}

.government-portrait-nameplate {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 3px solid var(--totemia-gold);
  text-align: center;
}

.government-portrait-nameplate .registry-label {
  justify-self: center;
}

.government-portrait-nameplate strong {
  color: var(--totemia-green);
  font-size: 22px;
  line-height: 1.14;
}

.government-portrait-nameplate-sub {
  color: var(--totemia-muted);
  font-size: 13px;
  font-weight: 700;
}

.government-portrait-facts {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  text-align: left;
}

.government-portrait-facts div {
  border-left: 3px solid var(--totemia-gold);
  padding-left: 10px;
}

.government-portrait-facts dt {
  margin: 0 0 2px;
  color: var(--totemia-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.government-portrait-facts dd {
  margin: 0;
  color: var(--totemia-ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

/* The list hero is intentionally slim (.public-list-hero), so the summary
 * stats sit as a tidy chip row directly beneath the hero copy rather than
 * fighting the single-column hero grid. */
.government-record-stats {
  display: flex;
  gap: 10px;
  margin: 10px 0 0;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.government-record-stats div {
  min-width: 120px;
  padding: 12px 16px;
  border: 1px solid color-mix(in srgb, var(--totemia-line) 78%, transparent);
  border-radius: 4px;
  background: #ffffff;
  text-align: center;
}

.government-record-stats dt {
  margin: 0;
  color: var(--totemia-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.government-record-stats dd {
  margin: 4px 0 0;
  color: var(--totemia-green);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
}

.government-related-links {
  align-items: center;
}

/* Chancellor succession roster. Portrait-first cards in a responsive grid so
 * the page reads as a proper gallery of officeholders rather than a flat list,
 * and the sitting chancellor is clearly flagged. */
.government-chancellor-roster {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  margin: 14px 0 0;
  padding: 0;
}

.government-chancellor-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--totemia-line) 70%, transparent);
  border-radius: 4px;
  background: #ffffff;
  animation: governmentCardIn .26s ease-out both;
}

.government-chancellor-card.is-current {
  border-color: var(--totemia-gold);
  box-shadow: 0 0 0 1px var(--totemia-gold), 0 10px 26px rgba(42, 35, 23, .1);
}

.government-chancellor-card .government-chancellor-portrait {
  width: 100%;
}

.government-chancellor-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Flat left-bar status flag (modern bold treatment) — not a rounded pill. */
.government-chancellor-current {
  border-left: 3px solid var(--totemia-gold);
  padding: 1px 0 1px 8px;
  color: var(--totemia-green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.government-chancellor-card-body h3 {
  margin: 6px 0 12px;
  color: var(--totemia-green);
  font-size: 19px;
  line-height: 1.15;
}

.government-chancellor-facts {
  display: grid;
  gap: 12px;
  margin: 0;
}

.government-chancellor-facts div {
  min-width: 0;
}

@keyframes governmentCardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes governmentMenuIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes governmentPageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
  .government-page-layout {
    grid-template-columns: 1fr;
  }

  /* On a stacked layout the portrait + nameplate move ABOVE the long
   * constitution text instead of being stranded at the very bottom of the
   * page (the previous behaviour the user reported). */
  .government-page-layout > .government-portrait-panel {
    order: -1;
    padding: 0 0 4px;
    border-top: 0;
    border-left: 0;
  }

  .government-page-layout > .government-main-column .party-doc-section:first-child {
    border-top: 1px solid color-mix(in srgb, var(--totemia-line) 70%, transparent);
    margin-top: 6px;
    padding-top: 18px;
  }

  .government-portrait-figure {
    max-width: 320px;
    margin: 0 auto;
  }

  .government-record-stats div {
    flex: 1 1 130px;
  }
}

@media (max-width: 640px) {
  .government-profile-hero {
    grid-template-columns: 1fr;
  }

  /* Cap the portrait so a full-width phone frame is not enormous, and keep
   * the image contained (never cropped) and centred within it. */
  .government-portrait-figure {
    max-width: 260px;
  }

  .government-hero-flag {
    max-height: 160px;
  }

  .government-quote-panel {
    padding: 10px 12px;
  }

  .government-quote-panel p {
    font-size: 13px;
  }

  .government-info-item {
    grid-template-columns: 1fr;
  }

  .government-chancellor-roster {
    grid-template-columns: 1fr;
  }

  .government-chancellor-card .government-chancellor-portrait {
    max-width: 240px;
    margin: 0 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav-toggle span,
  .global-nav .official-nav-inner.mobile-open,
  body.mobile-nav-open .global-nav .official-nav-inner,
  .government-profile-hero,
  .government-chancellor-card {
    animation: none;
    transition: none;
  }
}

/* Government public-page refinements */
.government-portrait-frame {
  position: relative;
}

.government-portrait-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Edit controls sit centered along the bottom of the portrait as two clean
 * circular buttons (no pill, no drop shadow). The wrapper spans the frame
 * width so the button row centers; it is click-through, only the buttons and
 * toast catch input. */
.government-portrait-upload {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  z-index: 2;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.government-portrait-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.government-portrait-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--totemia-green);
  border-radius: 999px;
  background: var(--totemia-paper);
  color: var(--totemia-green);
  box-shadow: none;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .1s ease;
}

.government-portrait-icon-button svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
}

.government-portrait-icon-button:hover,
.government-portrait-icon-button:focus-visible {
  background: color-mix(in srgb, var(--totemia-gold) 18%, var(--totemia-paper));
  border-color: var(--totemia-gold);
}

.government-portrait-icon-button:active {
  transform: scale(.93);
}

.government-portrait-icon-button.danger {
  border-color: var(--totemia-red);
  background: var(--totemia-paper);
  color: var(--totemia-red);
}

.government-portrait-icon-button.danger:hover,
.government-portrait-icon-button.danger:focus-visible {
  background: #fff1ea;
  border-color: var(--totemia-red);
}

.government-portrait-icon-button:disabled,
.government-portrait-icon-button.is-busy {
  opacity: .72;
  cursor: progress;
}

.government-portrait-spinner {
  animation: governmentPortraitSpin .7s linear infinite;
  transform-origin: center;
}

.government-portrait-upload.compact .government-portrait-icon-button {
  width: 31px;
  height: 31px;
}

.government-portrait-upload.compact .government-portrait-icon-button svg {
  width: 16px;
  height: 16px;
}

.government-portrait-message {
  max-width: min(220px, 72vw);
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--totemia-line);
  border-radius: 8px;
  background: var(--totemia-paper);
  color: var(--totemia-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  word-break: break-word;
  pointer-events: auto;
}

.government-portrait-message.is-error {
  border-color: color-mix(in srgb, var(--totemia-red) 60%, var(--totemia-line));
  background: #fff1ea;
  color: var(--totemia-red);
}

.government-portrait-message.is-ok {
  border-color: color-mix(in srgb, var(--totemia-green) 45%, var(--totemia-line));
  color: var(--totemia-green);
}

@keyframes governmentPortraitSpin {
  to { transform: rotate(360deg); }
}

@media (hover: none) {
  /* Comfortable tap targets on touch devices without overwhelming the image. */
  .government-portrait-icon-button { width: 38px; height: 38px; }
  .government-portrait-upload.compact .government-portrait-icon-button { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .government-portrait-spinner { animation-duration: 1.4s; }
}

.government-carousel {
  display: grid;
  gap: 16px;
  margin-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--totemia-line) 70%, transparent);
  padding-top: 18px;
}

.institution-record.ministry-card,
.government-carousel.ministry-card-carousel {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ministry-accent-color, var(--totemia-green)) 24%, var(--totemia-line));
  border-top: 0;
  border-radius: 4px;
  box-shadow: none;
  background: #ffffff;
}

.institution-record.ministry-card {
  padding-top: 26px;
  /* The base .institution-record track is 62px, but the ministry seal frame is
     64px — that 2px mismatch let the seal overflow its column and read as
     off-centre. Match the track to the frame and centre it in the column. */
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: start;
}

.government-carousel.ministry-card-carousel {
  padding: 28px 18px 18px;
}

.institution-record.ministry-card::before,
.government-carousel.ministry-card-carousel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 9px;
  background: var(--ministry-accent-color, var(--totemia-green));
}

.institution-record.ministry-card .institution-mark.has-seal {
  width: 64px;
  height: 64px;
  padding: 5px;
  justify-self: center;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--ministry-accent-color, var(--totemia-green)) 28%, var(--totemia-line));
  border-radius: 4px;
  background: #ffffff;
}

.institution-record.ministry-card .institution-seal-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.institution-record.ministry-card .registry-label,
.government-carousel.ministry-card-carousel .registry-label {
  color: var(--ministry-accent-color, var(--totemia-green));
}

.institution-record.ministry-card h3,
.government-carousel.ministry-card-carousel h3 {
  font-weight: 900;
}

/* Equal-height ministry cards: rows stretch, and the holder block +
   "Open office" button pin to the card bottom so every card presents
   the identity box and action at the same position. */
.institution-grid.ministry-card-grid {
  align-items: stretch;
}

.institution-record.ministry-card .institution-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
}

.institution-record.ministry-card .institution-body > .official-link-button {
  margin-top: 14px;
  align-self: flex-start;
}

.ministry-card-holder {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding-left: 11px;
  border-left: 3px solid var(--ministry-accent-color, var(--totemia-green));
}

.institution-record.ministry-card .ministry-card-holder {
  margin-top: auto;
}

.ministry-card-holder .ministry-holder-line,
.ministry-card-holder .ministry-holder-vacant {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
}

.ministry-card-holder .ministry-holder-line {
  color: var(--totemia-ink);
}

.ministry-card-holder .ministry-holder-line strong {
  color: var(--totemia-ink);
  font-weight: 800;
}

.ministry-holder-vacant {
  color: var(--totemia-ink);
  font-weight: 800;
}

.government-carousel-holder {
  margin-top: 16px;
}

.government-carousel.ministry-card-carousel .government-carousel-seal {
  border-color: color-mix(in srgb, var(--ministry-accent-color, var(--totemia-green)) 28%, var(--totemia-line));
  border-radius: 4px;
}

.government-carousel.ministry-card-carousel .government-carousel-controls,
.government-carousel.ministry-card-carousel .government-carousel-toolbar h3 {
  color: var(--ministry-accent-color, var(--totemia-green));
}

.government-carousel.ministry-card-carousel .government-carousel-controls button {
  border-radius: 4px;
  border-color: color-mix(in srgb, var(--ministry-accent-color, var(--totemia-green)) 30%, var(--totemia-line));
  color: var(--ministry-accent-color, var(--totemia-green));
}

.government-carousel.ministry-card-carousel .government-carousel-dots button.active {
  background: var(--ministry-accent-color, var(--totemia-green));
}

.government-carousel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.government-carousel-toolbar h3 {
  margin: 4px 0 0;
  color: var(--totemia-green);
  font-size: 22px;
  line-height: 1.16;
}

.government-carousel-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--totemia-green);
  font-size: 12px;
  font-weight: 900;
}

.government-carousel-controls button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--totemia-gold) 72%, var(--totemia-line));
  border-radius: 999px;
  background: #ffffff;
  color: var(--totemia-green);
  box-shadow: none;
  cursor: pointer;
}

.government-carousel-controls button:hover,
.government-carousel-controls button:focus-visible {
  border-color: var(--totemia-gold);
  background: color-mix(in srgb, var(--totemia-gold) 14%, #ffffff);
}

.government-carousel-controls svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.government-carousel-stage {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
  animation: governmentCarouselForward .22s ease-out;
}

.government-carousel-stage.back {
  animation-name: governmentCarouselBack;
}

.government-carousel-media {
  display: grid;
  grid-template-columns: minmax(170px, 230px) 76px;
  gap: 14px;
  align-items: start;
}

.government-carousel-portrait {
  width: 100%;
}

.government-carousel-seal {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border: 1px solid var(--totemia-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--totemia-green);
  font-weight: 900;
}

.government-carousel-seal img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.government-carousel-copy > p {
  max-width: 82ch;
  margin: 0;
  color: var(--totemia-ink);
  font-size: 14px;
  line-height: 1.68;
}

.government-carousel-facts {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0 22px;
  margin-top: 18px;
}

.government-carousel-facts .government-info-item {
  grid-template-columns: 1fr;
  gap: 6px;
}

.government-carousel-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.government-carousel-dots button {
  width: 36px;
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--totemia-line) 80%, transparent);
  box-shadow: none;
  cursor: pointer;
}

.government-carousel-dots button.active {
  background: var(--totemia-gold);
}

.government-emperor-record {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.government-emperor-primary {
  border-top: 1px solid var(--totemia-line);
  padding-top: 14px;
}

.government-emperor-primary strong {
  display: block;
  margin-top: 4px;
  color: var(--totemia-green);
  font-size: 30px;
  line-height: 1.08;
}

.government-emperor-style {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  border-top: 1px solid color-mix(in srgb, var(--totemia-line) 70%, transparent);
  padding-top: 14px;
}

.government-emperor-style div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.government-emperor-style span {
  border: 1px solid var(--totemia-line);
  border-left: 3px solid var(--totemia-line);
  border-radius: 4px;
  padding: 6px 10px 6px 8px;
  background: #ffffff;
  color: var(--totemia-ink);
  font-size: 13px;
  font-weight: 800;
}

.government-emperor-style span.primary {
  border-color: var(--totemia-gold);
  border-left-color: var(--totemia-gold);
  color: var(--totemia-green);
}

/* Full ceremonial designation — a formal enumeration of the Emperor's
   titles, flat with the standard gold accent bar (no rounded panel). */
.government-emperor-designation {
  border-top: 1px solid color-mix(in srgb, var(--totemia-line) 70%, transparent);
  padding-top: 14px;
}

.government-emperor-designation ol {
  list-style: none;
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
}

.government-emperor-designation li {
  border-left: 3px solid var(--totemia-gold);
  padding: 2px 0 2px 10px;
  color: var(--totemia-ink);
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.35;
}

.government-emperor-designation li:first-child {
  color: var(--totemia-green);
}

.government-emperor-support {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 22px;
  margin: 0;
}

.government-emperor-support div {
  border-top: 1px solid color-mix(in srgb, var(--totemia-line) 70%, transparent);
  padding: 12px 0;
}

.government-emperor-support dt {
  margin: 0 0 6px;
  color: var(--totemia-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.government-emperor-support dd {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--totemia-ink);
  font-size: 14px;
  line-height: 1.42;
}

.government-emperor-support dd span:first-child {
  color: var(--totemia-green);
  font-weight: 800;
}

@keyframes governmentCarouselForward {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes governmentCarouselBack {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 820px) {
  .government-carousel-stage,
  .government-carousel-media,
  .government-emperor-style,
  .government-emperor-support {
    grid-template-columns: 1fr;
  }

  .government-carousel-seal {
    width: 64px;
    height: 64px;
    justify-self: center;
  }

  .government-carousel-facts {
    grid-template-columns: 1fr;
  }

  .government-carousel-copy {
    order: -1;
  }

  .government-carousel-portrait {
    width: min(100%, 240px);
    justify-self: center;
  }
}

@media (max-width: 560px) {
  .government-carousel-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .government-emperor-primary strong {
    font-size: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .government-carousel-stage {
    animation: none;
  }
}

/* Ministry of Interior registry editor layout.
   Keep this after the shared form rules so the editor is not scattered by
   .interior-workspace-content form's auto-fit grid. */

.interior-workspace-content form.interior-registry-editor {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 18px !important;
  align-items: start !important;
  max-width: 100% !important;
}

.interior-workspace-content form.interior-registry-editor > .interior-inline-head {
  margin: 0 !important;
}

.interior-workspace-content form.interior-registry-editor > .interior-registry-form-grid,
.interior-workspace-content form.interior-registry-editor > .interior-upload-card,
.interior-workspace-content form.interior-registry-editor > .interior-upload-progress,
.interior-workspace-content form.interior-registry-editor > #interior-registry-preview-wrap,
.interior-workspace-content form.interior-registry-editor > .record-actions.compact {
  grid-column: 1 !important;
}

.interior-workspace-content form.interior-registry-editor > .interior-registry-form-grid {
  width: min(100%, 920px) !important;
}

.interior-workspace-content form.interior-registry-editor .interior-registry-form-grid label:not(.wide) {
  max-width: min(100%, 420px) !important;
}

.interior-workspace-content textarea {
  resize: none !important;
}

.interior-workspace-content form.interior-registry-editor textarea#interior-registry-description {
  height: 160px !important;
  min-height: 160px !important;
  max-height: 160px !important;
  overflow-y: auto !important;
}

.interior-workspace-content form.interior-registry-editor .interior-accent-field {
  max-width: min(100%, 420px) !important;
}

.interior-workspace-content form.party-color-editor-section label.wide {
  width: min(100%, 920px) !important;
}

.interior-workspace-content form.party-color-editor-section textarea {
  min-height: 150px !important;
  max-height: 150px !important;
  overflow-y: auto !important;
}

.interior-workspace-content form.party-color-editor-section .interior-accent-field {
  max-width: min(100%, 420px) !important;
}

.interior-workspace-content form.party-color-editor-section .interior-accent-field input[type="color"],
.interior-workspace-content form.interior-registry-editor .interior-accent-field input[type="color"] {
  width: 72px !important;
  min-width: 72px !important;
  height: 42px !important;
  padding: 2px !important;
  cursor: pointer !important;
}

.interior-workspace-content form.interior-registry-editor .interior-accent-field input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0 !important;
}

.interior-workspace-content form.party-color-editor-section .interior-accent-field input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0 !important;
}

.interior-workspace-content form.party-color-editor-section .interior-accent-field input[type="color"]::-webkit-color-swatch,
.interior-workspace-content form.party-color-editor-section .interior-accent-field input[type="color"]::-moz-color-swatch,
.interior-workspace-content form.interior-registry-editor .interior-accent-field input[type="color"]::-webkit-color-swatch,
.interior-workspace-content form.interior-registry-editor .interior-accent-field input[type="color"]::-moz-color-swatch {
  border: 0 !important;
  border-radius: 3px !important;
}

.interior-workspace-content form.interior-registry-editor > .interior-upload-card,
.interior-workspace-content form.interior-registry-editor > .interior-upload-progress,
.interior-workspace-content form.interior-registry-editor > #interior-registry-preview-wrap {
  width: min(100%, 760px) !important;
  margin-top: 0 !important;
}

.interior-workspace-content form.interior-registry-editor > .interior-upload-card {
  border: 0 !important;
  border-top: 1px solid var(--line, #e3d8b6) !important;
  border-bottom: 1px solid var(--line, #e3d8b6) !important;
  background: transparent !important;
  padding: 12px 0 !important;
  border-radius: 0 !important;
  grid-template-columns: 46px minmax(0, 1fr) !important;
}

.interior-workspace-content form.interior-registry-editor .interior-upload-card input[type="file"] {
  display: none !important;
}

.interior-workspace-content form.interior-registry-editor .interior-upload-icon {
  width: 42px !important;
  height: 42px !important;
}

.interior-workspace-content form.interior-registry-editor .interior-upload-card span {
  font-size: 11px !important;
  line-height: 1.25 !important;
}

.interior-workspace-content form.interior-registry-editor .interior-upload-progress {
  display: grid !important;
  gap: 5px !important;
}

.interior-workspace-content form.interior-registry-editor .interior-upload-progress.hidden {
  display: none !important;
}

.interior-workspace-content form.interior-registry-editor .interior-upload-bar {
  margin-bottom: 0 !important;
}

.interior-workspace-content form.interior-registry-editor .interior-preview-head {
  align-items: center !important;
  width: min(100%, 520px) !important;
}

.interior-workspace-content form.interior-registry-editor .interior-registry-preview {
  display: block !important;
  width: min(100%, 520px) !important;
  height: auto !important;
  max-height: 320px !important;
  object-fit: contain !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

.interior-workspace-content form.interior-registry-editor > .record-actions.compact {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin-top: 2px !important;
}

@media (max-width: 640px) {
  .interior-workspace-content form.interior-registry-editor > .interior-registry-form-grid,
  .interior-workspace-content form.interior-registry-editor > .interior-upload-card,
  .interior-workspace-content form.interior-registry-editor > .interior-upload-progress,
  .interior-workspace-content form.interior-registry-editor > #interior-registry-preview-wrap {
    width: 100% !important;
  }

  .interior-workspace-content form.interior-registry-editor .interior-registry-form-grid label:not(.wide) {
    max-width: none !important;
  }
}

/* Focused Next public-page polish. Loaded after the shared portal shell. */

.home-quick-actions {
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.public-list-hero,
.party-doc,
.official-hero.public-party-hero,
.religion-card,
.chart-block {
  box-shadow: none !important;
}

.religion-card,
.religion-card:hover,
.party-doc-color-cta:hover {
  transform: none !important;
}

.public-party-cover,
.public-party-cover-empty,
.public-party-cover-img.fit-wide,
.public-party-cover-img.fit-tall {
  background: #ffffff !important;
}

.public-party-cover-fallback {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 1px solid var(--totemia-line, var(--line));
  border-radius: 12px;
  background: var(--surface-2, #f7f8fa);
  color: var(--totemia-green, #123c32);
  font-size: 18px;
  font-weight: 900;
}

.public-party-cover-detail .public-party-cover-fallback {
  width: 92px;
  height: 92px;
  font-size: 22px;
}

.religion-card .public-party-cover {
  height: 160px;
}

.religion-card .public-party-cover-img.fit-contain {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  padding: 8px;
  box-sizing: border-box;
  object-fit: contain;
}

.public-member-list {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
}

.public-member-list .public-member-identity {
  width: max-content;
}

.party-doc-stat .public-member-identity {
  width: max-content;
}

/* Totemic-language transcription on the Decree of Union document. Same
   italic treatment used for native titles elsewhere on public pages. */
.decree-native {
  font-style: italic;
}

/* ── Portal-wide search (/search) ───────────────────────────────────
 * One continuous surface: a header with the big query field flows into a
 * section facet rail + a hairline-divided results list. No stacked hero
 * box, no per-result cards, no gold top stripe — just the brand
 * gold/green/cream palette used with restraint. */
.site-search {
  background: #ffffff;
  border: 1px solid var(--totemia-line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 18px;
}

.site-search-head {
  padding: 24px 26px 20px;
  border-bottom: 1px solid var(--totemia-line);
}
.site-search-head h1 {
  margin: 6px 0 4px;
  color: var(--totemia-green);
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.site-search-tagline {
  margin: 0 0 16px;
  color: var(--totemia-muted);
  font-size: 13.5px;
}

.site-search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 640px;
  padding: 0 14px;
  background: var(--totemia-paper);
  border: 1px solid var(--totemia-line);
  border-radius: 12px;
  transition: border-color .12s, box-shadow .12s;
}
.site-search-field:focus-within {
  border-color: var(--totemia-gold);
  box-shadow: 0 0 0 3px rgba(196, 152, 31, .15);
}
.site-search-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--totemia-muted);
}
.site-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 13px 0;
  font-size: 15px;
  color: var(--totemia-ink);
  font-family: inherit;
}
.site-search-input:focus { outline: none; }
.site-search-clear {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--totemia-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px;
}
.site-search-clear:hover { color: var(--totemia-green); }

.site-search-body {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  align-items: stretch;
}
.site-search-filters {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 14px;
  border-right: 1px solid var(--totemia-line);
}
.site-search-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: var(--totemia-ink);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  padding: 9px 12px;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.site-search-filter:hover {
  background: rgba(196, 152, 31, .08);
  color: var(--totemia-green);
}
.site-search-filter.active {
  background: rgba(196, 152, 31, .14);
  border-left-color: var(--totemia-gold);
  color: var(--totemia-green);
}
.site-search-filter .count {
  font-size: 11px;
  font-weight: 800;
  color: var(--totemia-muted);
  font-variant-numeric: tabular-nums;
}
.site-search-filter.active .count { color: var(--totemia-green); }

.site-search-results {
  padding: 18px 22px;
  min-width: 0;
}
.site-search-summary {
  margin: 0 0 8px;
  color: var(--totemia-muted);
  font-size: 12.5px;
  font-weight: 700;
}
.site-search-summary strong { color: var(--totemia-green); }
.site-search-result-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-search-result + .site-search-result {
  border-top: 1px solid color-mix(in srgb, var(--totemia-line) 70%, transparent);
}
.site-search-result > a {
  display: block;
  padding: 13px 10px;
  text-decoration: none;
  border-radius: 9px;
}
.site-search-result > a:hover { background: var(--totemia-ivory); }
.site-search-result-kicker {
  display: block;
  margin-bottom: 3px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--totemia-muted);
}
.site-search-result-title {
  display: block;
  font-size: 15.5px;
  font-weight: 800;
  color: var(--totemia-green);
  line-height: 1.3;
}
.site-search-result > a:hover .site-search-result-title { text-decoration: underline; }
.site-search-result-snippet {
  display: block;
  margin-top: 3px;
  color: var(--totemia-ink);
  font-size: 13px;
  line-height: 1.55;
}
.site-search-hit {
  background: rgba(196, 152, 31, .32);
  color: var(--totemia-ink);
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 700;
}
.site-search-empty {
  padding: 26px 10px;
  color: var(--totemia-muted);
  font-size: 13.5px;
}

@media (max-width: 760px) {
  .site-search-body { grid-template-columns: 1fr; }
  .site-search-filters {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--totemia-line);
    padding: 12px;
  }
  .site-search-filter {
    flex: 0 0 auto;
    border-left: 0;
    border-bottom: 3px solid transparent;
    border-radius: 8px;
    white-space: nowrap;
  }
  .site-search-filter.active {
    border-left-color: transparent;
    border-bottom-color: var(--totemia-gold);
  }
  .site-search-results { padding: 16px; }
  .site-search-head { padding: 20px 18px 16px; }
  .site-search-head h1 { font-size: 24px; }
}

.history-reader-stage {
  display: grid;
  grid-template-columns: minmax(120px, 170px) minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}

.history-year-rail {
  position: sticky;
  top: calc(var(--masthead-h, 56px) + 20px);
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
}

.history-year-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-year-link {
  border-left: 2px solid var(--totemia-line, var(--line));
  color: var(--totemia-ink, var(--ink));
  font-size: 14px;
  font-weight: 800;
  padding: 8px 10px;
  text-decoration: none;
}

.history-year-link:hover,
.history-year-link:focus-visible {
  border-left-color: var(--totemia-gold, var(--gold));
  background: var(--surface-2, #f7f8fa);
  color: var(--totemia-green, #123c32);
}

.history-story-panel {
  min-width: 0;
}

.history-year-section {
  scroll-margin-top: calc(var(--masthead-h, 56px) + 18px);
  margin-bottom: 30px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--totemia-line, var(--line));
}

.history-year-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.history-year-heading {
  margin: 0 0 8px;
  color: var(--totemia-green, #123c32);
  font-size: 27px;
  letter-spacing: -.02em;
}

.history-story-entry {
  margin: 0;
  max-width: 78ch;
  padding: 14px 0;
  border-top: 1px solid color-mix(in srgb, var(--totemia-line, var(--line)) 70%, transparent);
  color: var(--totemia-ink, var(--ink));
  font-size: 15.5px;
  line-height: 1.72;
  white-space: pre-wrap;
}

.history-entry-list {
  min-width: 0;
}

.chart-area-circle {
  min-height: 300px;
}

@media (max-width: 720px) {
  .masthead-user .masthead-profile-btn[href="/login"] {
    width: auto;
    min-width: 60px;
    height: 44px;
    padding: 4px 10px !important;
    white-space: nowrap;
  }

  .global-nav .official-nav-inner.mobile-open {
    box-shadow: none !important;
  }

  .history-reader-stage {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .history-year-rail {
    position: static;
  }

  .history-year-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    gap: 4px;
  }

  .history-year-link {
    border: 1px solid var(--totemia-line, var(--line));
    border-radius: 7px;
    padding: 7px 9px;
    text-align: center;
  }

  .history-story-entry {
    font-size: 15px;
    line-height: 1.7;
  }
}

/* Educational / public-information pages (About Us, etc.) read like articles.
 * Widen the measure, enlarge body type, give paragraphs real rhythm, and make
 * headings confident so the content flows instead of feeling chunked. */
.readable-doc .party-doc-about h2 {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 4px 0 14px;
}
.readable-doc .party-doc-members h2 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.readable-doc .public-party-description {
  font-size: 15.5px;
  line-height: 1.8;
  max-width: 72ch;
  color: var(--totemia-ink, var(--ink));
}
.readable-doc .public-party-description + .public-party-description {
  margin-top: 14px;
}
.readable-doc .party-doc-section {
  padding: 22px 26px;
}
.readable-doc .party-doc-section > .registry-label {
  margin-bottom: 8px;
}
@media (max-width: 720px) {
  .readable-doc .party-doc-about h2 { font-size: 23px; }
  .readable-doc .public-party-description { font-size: 15px; line-height: 1.75; }
}

/* ── Continuous educational documents (The Government, Decree of Union) ──
 * One surface, no stacked hero box and no gold top stripe. The title folds
 * into the document as a headline, sections are divided by hairlines only,
 * and short explanatory sections sit in a compact grid so the reader scrolls
 * far less while the type stays large and legible. The single .party-doc
 * border is the only frame — no stacked hero box, no gold top stripe. */
.edu-doc-headline {
  padding: 26px 26px 18px;
}
.edu-doc-headline .registry-label {
  margin-bottom: 8px;
}
.edu-doc-headline h1 {
  margin: 0;
  color: var(--totemia-green);
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.edu-doc-native {
  margin: 6px 0 0;
  color: var(--totemia-muted);
  font-style: italic;
  font-size: 15px;
}
.edu-doc .party-doc-about {
  padding-top: 20px;
  padding-bottom: 20px;
}
.edu-doc-lead {
  font-size: 16.5px !important;
  line-height: 1.7 !important;
  max-width: 76ch;
  color: var(--totemia-ink, var(--ink));
}

/* Section headings inside an educational doc (e.g. the Decree transcriptions)
 * read as confident green headings, matching the rest of the public surface. */
.edu-doc .party-doc-section > h2 {
  margin: 2px 0 10px;
  color: var(--totemia-green);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

/* Compact two-column layout for the short structural sections. No per-item
 * boxes — the whole document stays continuous; columns just halve the height
 * so the page reads without endless scrolling. */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 32px;
  margin-top: 14px;
}
.edu-grid-item {
  min-width: 0;
}
.edu-grid-item .registry-label {
  margin-bottom: 4px;
}
.edu-grid-item h2 {
  margin: 2px 0 8px;
  color: var(--totemia-green);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}
.edu-grid-item .public-party-description {
  font-size: 14.5px !important;
  line-height: 1.6 !important;
  max-width: none;
}

/* Diagram sits at the BOTTOM of the document, full width. It is part of the
 * continuous surface — only a top hairline divides it, no boxed frame. */
.edu-figure {
  margin: 0;
  padding: 22px 26px 26px;
  border: 0;
  border-top: 1px solid color-mix(in srgb, var(--totemia-line) 70%, transparent);
  border-radius: 0;
  background: transparent;
}
.edu-figure img {
  border: 1px solid var(--totemia-line);
  border-radius: 10px;
}

@media (max-width: 720px) {
  .edu-doc-headline { padding: 20px 20px 14px; }
  .edu-doc-headline h1 { font-size: 24px; }
  .edu-doc-lead { font-size: 15.5px !important; }
  .edu-grid { grid-template-columns: 1fr; gap: 18px; }
  .edu-figure { padding: 18px 20px 20px; }
}

/* ── Org public tab bar (Members/Followers · Donate · Documents · Articles) ── */
.org-tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 4px 0 18px;
  padding: 0 2px;
  border-bottom: 1px solid var(--totemia-line);
}
.org-tab {
  appearance: none;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--totemia-muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .01em;
  padding: 11px 14px 10px;
  text-decoration: none;
  cursor: pointer;
  transition: color .1s linear, border-color .1s linear;
}
.org-tab:hover { color: var(--totemia-green); }
/* Active tab is marked by the underline, not a text-color change — the
   label deepens to full ink while the gold bar carries the "you are here". */
.org-tab.active {
  color: var(--totemia-ink);
  border-bottom-color: var(--totemia-gold);
}

/* ── Donate tab ───────────────────────────────────────────────────────────── */
.donate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
@media (max-width: 860px) {
  .donate-layout { grid-template-columns: minmax(0, 1fr); }
}
.donate-message {
  margin: 6px 0 16px;
  padding: 12px 14px;
  border-left: 3px solid var(--totemia-gold);
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
  color: var(--totemia-ink);
  line-height: 1.55;
}
.donate-status { margin: 12px 0; }
.donate-remaining {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--totemia-line);
  border-radius: 10px;
  background: var(--surface-2);
}
.donate-remaining span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--totemia-muted);
}
.donate-remaining strong {
  font-size: 24px;
  font-weight: 800;
  color: var(--totemia-green);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -.01em;
}
.donate-remaining small { color: var(--totemia-muted); font-size: 11px; }
.donate-presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.donate-preset {
  appearance: none;
  border: 1px solid var(--totemia-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--totemia-ink);
  font-weight: 800;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  padding: 11px 8px;
  cursor: pointer;
  transition: border-color .1s linear, background .1s linear;
}
.donate-preset:hover:not(:disabled) { border-color: var(--totemia-gold); }
.donate-preset.active {
  border-color: var(--totemia-gold);
  background: var(--gold-pale);
  color: var(--gold-deep);
}
.donate-preset:disabled { opacity: .45; cursor: not-allowed; }
.donate-custom { display: block; margin-bottom: 14px; }
.donate-submit {
  appearance: none;
  width: 100%;
  border: 1px solid var(--gold-deep);
  border-radius: 8px;
  background: var(--totemia-gold);
  color: #1a1000;
  font-weight: 900;
  font-size: 14px;
  padding: 13px;
  cursor: pointer;
  transition: filter .1s linear;
}
.donate-submit:hover:not(:disabled) { filter: brightness(.97); }
.donate-submit:disabled { opacity: .5; cursor: not-allowed; }

.donate-ledger-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.donate-ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 6px;
  border-top: 1px solid var(--totemia-line);
}
.donate-ledger-row:first-child { border-top: 0; }
.donate-ledger-amount {
  font-weight: 800;
  font-size: 14px;
  color: var(--totemia-green);
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}
.donate-raised {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--totemia-line);
  border-radius: 10px;
  background: var(--surface-2);
}
.donate-raised span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--totemia-muted);
}
.donate-raised strong {
  font-size: 20px;
  font-weight: 800;
  color: var(--totemia-green);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -.01em;
}
.donate-ledger-toggle {
  appearance: none;
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--totemia-line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--totemia-green);
  font-weight: 800;
  font-size: 12.5px;
  padding: 9px;
  cursor: pointer;
  transition: background .1s linear;
}
.donate-ledger-toggle:hover { background: var(--surface-2); }

/* ── Documents / Articles placeholders ───────────────────────────────────── */
.org-tab-placeholder { text-align: center; padding: 40px 24px; }
.org-tab-placeholder h2 { margin: 8px 0 8px; }
.org-tab-placeholder p { color: var(--totemia-muted); max-width: 46ch; margin: 0 auto; }

/* Public historical archives: chancellor records and the official timeline. */

.government-chancellor-directory,
.government-chancellor-profile,
.history-reader {
  font-family: var(--sans);
}

.government-chancellor-directory-hero {
  place-items: center;
  min-height: 128px;
  text-align: center;
}

.government-chancellor-directory-hero .government-native-title {
  margin-bottom: 0 !important;
}

.government-chancellor-directory .party-doc-section {
  padding: 34px;
}

.government-chancellor-roster {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 34px 22px;
  margin: 0;
}

.government-chancellor-card,
.government-chancellor-card.is-current {
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  animation: none;
}

.government-chancellor-card .government-chancellor-portrait {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background: var(--surface-2);
}

.government-chancellor-portrait-link {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
}

.government-chancellor-portrait-link > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.government-chancellor-portrait-link .government-portrait-placeholder {
  width: 100%;
  height: 100%;
}

.government-chancellor-card-body {
  display: block;
  padding-top: 12px;
  color: var(--totemia-ink);
  text-decoration: none;
}

.government-chancellor-card-body h2 {
  margin: 0 0 3px;
  color: var(--totemia-green);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.government-chancellor-card-body span {
  display: block;
  color: var(--totemia-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.government-chancellor-card-body p {
  margin: 7px 0 0;
  color: var(--totemia-muted);
  font-size: 12px;
  line-height: 1.45;
}

.government-chancellor-card-body strong {
  display: inline-block;
  margin-top: 8px;
  color: var(--totemia-green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.government-chancellor-card:hover .government-chancellor-portrait,
.government-chancellor-card:focus-within .government-chancellor-portrait {
  border-color: var(--totemia-gold);
}

.government-chancellor-profile {
  overflow: hidden;
  border: 1px solid var(--totemia-line);
  border-radius: 10px;
  background: var(--totemia-paper);
}

.government-chancellor-profile-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  min-height: 480px;
  border-bottom: 1px solid var(--totemia-line);
}

.government-chancellor-profile-portrait {
  aspect-ratio: auto;
  min-height: 480px;
  border: 0;
  border-radius: 0;
  background: var(--surface-2);
}

.government-chancellor-profile-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 54px;
}

.government-chancellor-back-link {
  margin-bottom: 34px;
  color: var(--totemia-green);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.government-chancellor-back-link:hover {
  text-decoration: underline;
}

.government-chancellor-profile-copy h1 {
  margin: 10px 0 8px;
  color: var(--totemia-green);
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1.02;
}

.government-chancellor-profile-copy p {
  margin: 0 0 18px;
  color: var(--totemia-muted);
  font-size: 15px;
  line-height: 1.55;
}

.government-chancellor-profile-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 260px);
  gap: 48px;
  max-width: 980px;
  margin: 0 auto;
  padding: 52px 34px 64px;
}

.government-chancellor-profile-main {
  min-width: 0;
}

.government-chancellor-biography {
  margin-bottom: 42px;
}

.government-chancellor-biography p {
  margin: 18px 0 0;
  color: var(--totemia-ink);
  font-size: 17px;
  line-height: 1.82;
}

.government-chancellor-office-record {
  padding-top: 20px;
  border-top: 1px solid var(--totemia-line);
}

.government-chancellor-profile-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 26px;
  margin: 14px 0 0;
}

.government-chancellor-profile-facts div {
  padding: 16px 0;
  border-top: 1px solid color-mix(in srgb, var(--totemia-line) 72%, transparent);
}

.government-chancellor-profile-facts dt {
  color: var(--totemia-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.government-chancellor-profile-facts dd {
  margin: 5px 0 0;
  color: var(--totemia-ink);
  font-size: 14px;
  line-height: 1.5;
}

.government-chancellor-profile-rail {
  padding-left: 28px;
  border-left: 1px solid var(--totemia-line);
}

.government-chancellor-profile-rail nav {
  display: grid;
  margin-top: 12px;
}

.government-chancellor-profile-rail a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--totemia-line);
  color: var(--totemia-green);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.government-chancellor-profile-rail a.active {
  color: var(--totemia-gold-deep, var(--gold-deep));
}

.government-chancellor-profile-rail small {
  color: var(--totemia-muted);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

/* The card base (.party-doc) clips with overflow:hidden, which would trap the
   sticky year bar inside the card. Clip only the horizontal axis (so long
   lines can never escape the card and get sliced by the body's overflow-x:clip)
   while leaving the vertical axis visible so the year bar can still pin. */
.history-reader {
  overflow-x: clip;
  overflow-y: visible;
}

.history-time-nav {
  position: sticky;
  top: var(--masthead-h, 56px);
  z-index: 30;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 12px;
  align-items: center;
  padding: 16px 22px;
  background: var(--totemia-green);
  /* Square: the bar now sits below the document title, not at the card's top
     edge, and pins flush to the viewport when scrolled. */
  border-radius: 0;
  box-shadow: 0 6px 16px rgba(8, 20, 16, 0.14);
}

.history-time-years {
  display: grid;
  grid-template-columns: repeat(5, minmax(72px, 1fr));
  gap: 6px;
}

.history-time-year,
.history-time-arrow {
  border: 0;
  box-shadow: none;
  cursor: pointer;
}

.history-time-year {
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, .68);
  font-size: 13px;
  font-weight: 800;
  padding: 8px 12px;
}

.history-time-year:hover,
.history-time-year:focus-visible {
  background: rgba(255, 255, 255, .1);
  color: #ffffff;
}

.history-time-year.active {
  background: #ffffff;
  color: var(--totemia-green);
}

.history-time-arrow {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
}

.history-time-arrow svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.history-time-arrow:disabled {
  opacity: .28;
  cursor: default;
}

.history-stage {
  padding: 34px 42px 44px;
  /* Year switches scroll here; clear the masthead + pinned year bar. */
  scroll-margin-top: calc(var(--masthead-h, 56px) + 80px);
}

.history-time-heading {
  margin-bottom: 22px;
}

.history-time-heading h2 {
  margin: 3px 0 0;
  color: var(--totemia-green);
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.035em;
}

.history-stage-body {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}

/* Left contents rail — a quick jump list of the year's named events. */
.history-contents {
  position: sticky;
  /* Sit just under the pinned year bar (masthead + bar height). */
  top: calc(var(--masthead-h, 56px) + 90px);
  align-self: start;
  min-width: 0;
  max-width: 100%;
}

.history-contents-label {
  margin-bottom: 12px;
  color: var(--totemia-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.history-contents ul {
  margin: 0;
  padding: 0;
  min-width: 0;
  list-style: none;
  border-left: 1px solid var(--totemia-line);
}

.history-contents-link {
  display: block;
  width: 100%;
  margin-left: -1px;
  padding: 6px 14px;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  color: var(--totemia-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.history-contents-link:hover,
.history-contents-link:focus-visible {
  color: var(--totemia-ink);
}

.history-contents-link.active {
  border-left-color: var(--totemia-gold);
  color: var(--totemia-green);
  font-weight: 800;
}

/* Right story stream — one node per grouped story, not per paragraph. */
.history-stream {
  position: relative;
  min-width: 0;
  padding-left: 34px;
}

.history-story-main,
.history-story-lead,
.history-story-para,
.history-quote p,
.history-doc-line,
.history-doc-clause {
  min-width: 0;
  overflow-wrap: anywhere;
}

.history-stream::before {
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 7px;
  width: 1px;
  background: var(--totemia-line);
  content: "";
}

.history-story {
  position: relative;
  padding: 4px 0 30px;
  /* Jumps from the contents rail must clear the pinned year bar. */
  scroll-margin-top: calc(var(--masthead-h, 56px) + 96px);
}

.history-story:last-child {
  padding-bottom: 4px;
}

.history-story-node {
  position: absolute;
  top: 12px;
  left: -34px;
  width: 14px;
  height: 14px;
  border: 4px solid var(--totemia-paper);
  border-radius: 50%;
  background: var(--totemia-gold);
  box-shadow: 0 0 0 1px var(--totemia-gold);
}

.history-story-main {
  min-width: 0;
}

.history-story-realm {
  display: inline-block;
  margin-bottom: 9px;
  padding: 2px 9px;
  border: 1px solid var(--totemia-line);
  border-radius: 999px;
  color: var(--totemia-green);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.history-story-title {
  margin: 0 0 8px;
  color: var(--totemia-green);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.22;
}

.history-story-lead {
  margin: 0;
  max-width: 74ch;
  color: var(--totemia-ink);
  font-size: 15.5px;
  line-height: 1.78;
}

.history-story-para {
  margin: 13px 0 0;
  max-width: 74ch;
  color: var(--totemia-ink);
  font-size: 15px;
  line-height: 1.76;
}

.history-quote {
  margin: 15px 0 0;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--totemia-gold);
}

.history-quote p {
  margin: 0;
  max-width: 72ch;
  color: var(--totemia-ink);
  font-size: 15px;
  font-style: italic;
  line-height: 1.74;
}

.history-quote-cite {
  display: block;
  margin-top: 9px;
  color: var(--totemia-muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.history-quote-cite::before {
  content: "— ";
}

.history-doc {
  margin: 16px 0 0;
  max-width: 68ch;
  border: 1px solid var(--totemia-line);
  border-radius: 10px;
  background: var(--totemia-paper);
  overflow: hidden;
}

.history-doc-title {
  padding: 10px 18px;
  border-bottom: 1px solid var(--totemia-line);
  background: #f7f8fa;
  color: var(--totemia-green);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.history-doc-body {
  display: grid;
  gap: 11px;
  padding: 16px 18px;
}

.history-doc-line,
.history-doc-clause {
  margin: 0;
  color: var(--totemia-ink);
  font-size: 14px;
  line-height: 1.66;
}

.history-doc-clause {
  padding-left: 16px;
  text-indent: -16px;
  font-weight: 600;
}

.history-stats {
  margin: 15px 0 0;
  max-width: 340px;
  border: 1px solid var(--totemia-line);
  border-radius: 8px;
  overflow: hidden;
}

.history-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--totemia-line);
}

.history-stat-row:last-child {
  border-bottom: 0;
}

.history-stat-row dt {
  color: var(--totemia-muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.history-stat-row dd {
  margin: 0;
  color: var(--totemia-ink);
  font-size: 13px;
  font-weight: 800;
}

/* Collapse the timeline to a single reading column before the two-column grid
   gets cramped on tablets — the contents rail + story column fighting for
   width was what pushed text off the right edge. The inline story titles serve
   as the in-year navigation once the rail is gone. */
@media (max-width: 900px) {
  .history-stage-body {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .history-contents {
    display: none;
  }

  .history-stream {
    padding-left: 28px;
  }

  .history-stream::before {
    left: 6px;
  }

  .history-story-node {
    left: -28px;
  }
}

@media (max-width: 980px) {
  .government-chancellor-roster {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .government-chancellor-profile-hero {
    grid-template-columns: minmax(0, 1fr) minmax(280px, .9fr);
  }

  .government-chancellor-profile-copy {
    padding: 38px;
  }
}

@media (max-width: 720px) {
  .mobile-nav-toggle,
  .mobile-nav-toggle:hover,
  .mobile-nav-toggle:focus-visible,
  .mobile-nav-toggle.active {
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #ffffff !important;
    box-shadow: none !important;
    transform: none !important;
  }

  .government-chancellor-directory .party-doc-section {
    padding: 24px 18px;
  }

  .government-chancellor-roster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px 14px;
  }

  .government-chancellor-card .government-chancellor-portrait {
    max-width: none;
    margin: 0;
  }

  .government-chancellor-profile {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .government-chancellor-profile-hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .government-chancellor-profile-portrait {
    min-height: 340px;
  }

  .government-chancellor-profile-copy {
    padding: 30px 22px 34px;
  }

  .government-chancellor-back-link {
    margin-bottom: 24px;
  }

  .government-chancellor-profile-copy h1 {
    font-size: 36px;
  }

  .government-chancellor-profile-body {
    grid-template-columns: 1fr;
    gap: 38px;
    padding: 34px 22px 48px;
  }

  .government-chancellor-profile-facts {
    grid-template-columns: 1fr;
  }

  .government-chancellor-profile-rail {
    padding: 0;
    border-left: 0;
  }

  .history-time-nav {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 4px;
    padding: 12px 10px;
  }

  .history-time-years {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .history-time-years::-webkit-scrollbar {
    display: none;
  }

  .history-time-year {
    min-width: 66px;
    padding: 7px 10px;
  }

  .history-stage {
    padding: 26px 20px 34px;
  }

  .history-time-heading h2 {
    font-size: 30px;
  }

  .history-story-lead {
    font-size: 15px;
    line-height: 1.72;
  }

  .history-story-title {
    font-size: 19px;
  }
}

/* Home page — full-bleed photo carousel hero (modelled on the City of San
   Luis home page), a centered quick-access tile deck that overlaps the hero,
   and a clean dated news notice. Gold is used only as a thin accent. */

/* The hero breaks out of the centered 1180px content column to span the full
   viewport, so `overflow-x: clip` keeps the 100vw breakout from spawning a
   horizontal scrollbar. `clip` (not `hidden`) leaves the sticky masthead
   working. */
body {
  overflow-x: clip;
}

/* Full-bleed: span the whole viewport width regardless of the centered
   content column, and pull up under the nav so the hero meets it edge-to-edge.
   The −16px cancels `.content`'s top padding. */
.home-hero-carousel {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  margin-top: -16px;
}

.home-hero-stage {
  position: relative;
  width: 100%;
  height: clamp(460px, 80vh, 820px);
  overflow: hidden;
  background: #0b1f1a;
}

.home-hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.75s ease;
}

.home-hero-slide.active {
  opacity: 1;
}

.home-hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: auto;
}

.home-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(8, 20, 16, 0.34) 0%,
    rgba(8, 20, 16, 0.44) 55%,
    rgba(8, 20, 16, 0.68) 100%
  );
}

.home-hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* Extra bottom padding lifts the welcome above the tile deck that overlaps
     the lower edge of the hero. */
  padding: clamp(24px, 5vw, 64px) clamp(20px, 5vw, 64px) clamp(64px, 12vh, 150px);
}

.home-hero-welcome {
  max-width: 760px;
  color: #fff;
}

.home-hero-kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--gold, #d8b14a);
  margin-bottom: 10px;
}

.home-hero-welcome h1 {
  color: #fff;
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-size: clamp(2.1rem, 5.2vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.04;
  margin: 0 0 0.42em;
}

.home-hero-welcome p {
  color: rgba(255, 255, 255, 0.94);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  margin: 0 auto;
  max-width: 58ch;
}

.home-hero-native {
  margin-top: 8px !important;
  font-style: italic;
  color: rgba(255, 255, 255, 0.8) !important;
}

/* Quick-access tile deck — a single continuous white bar that overlaps the
   bottom of the hero (the connected quick-link card in the San Luis layout).
   The three links live inside one rounded surface, divided by hairlines, so
   they read as one toolbar rather than three separate floating cards. */
.home-tile-deck {
  display: flex;
  align-items: stretch;
  position: relative;
  z-index: 3;
  width: min(720px, 100%);
  margin: -40px auto 0;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e3e6ea);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(20, 30, 26, 0.12);
  overflow: hidden;
}

.home-tile {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 14px;
  text-decoration: none;
  transition: background 0.15s ease;
}

/* Hairline separators keep the bar continuous instead of gapped tiles. */
.home-tile + .home-tile {
  border-left: 1px solid var(--line, #e3e6ea);
}

.home-tile:hover {
  background: rgba(18, 60, 50, 0.05);
}

.home-tile-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--totemia-green, #123c32);
  color: #fff;
  transition: transform 0.15s ease;
}

.home-tile:hover .home-tile-icon {
  transform: translateY(-2px);
}

.home-tile-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  stroke: none;
}

.home-tile-label {
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink, #14171a);
  text-align: center;
}

/* Central-government News band. The colored surround mirrors the civic
   homepage reference while keeping Totemia's green/gold brand treatment. */
.home-news {
  position: relative;
  width: 100vw;
  margin: 44px calc(50% - 50vw) 0;
  padding: clamp(42px, 6vw, 72px) 24px clamp(52px, 7vw, 86px);
  overflow: hidden;
  border-top: 6px solid var(--totemia-gold, #c4981f);
  background: var(--totemia-green, #123c32);
  color: #ffffff;
}

.home-news::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(18, 60, 50, .98), rgba(18, 60, 50, .82)),
    url("/assets/courasel/original/totemia-10.png") center / cover no-repeat;
  opacity: .72;
}

.home-news-inner {
  position: relative;
  z-index: 1;
  width: min(1320px, 100%);
  margin: 0 auto;
}

.home-news-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.home-news-head .registry-label {
  color: var(--totemia-gold-soft, #dcc48a);
}

.home-news h2 {
  margin: 2px 0 0;
  color: #ffffff;
  font-size: clamp(2.15rem, 5vw, 3.45rem);
  font-weight: 900;
  line-height: .98;
}

.home-news-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}

.home-news-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.home-news-tag {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--totemia-green, #123c32);
}

.home-news-card,
.home-news-empty {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .18);
  border-top: 4px solid var(--totemia-gold, #c4981f);
  border-radius: 8px;
  background: #ffffff;
  color: var(--totemia-ink, #14171a);
  box-shadow: 0 22px 46px rgba(4, 14, 11, .22);
}

.home-news-card-media,
.home-news-card-date {
  position: relative;
  display: block;
  height: 180px;
  background: #0b1f1a;
  text-decoration: none;
}

.home-news-card-date {
  display: grid;
  height: auto;
  min-height: 74px;
  align-items: end;
  padding: 14px;
  background: #ffffff;
}

.home-news-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-news-card-media time,
.home-news-card-date time {
  position: absolute;
  left: 14px;
  bottom: -14px;
  display: inline-block;
  max-width: calc(100% - 28px);
  padding: 8px 10px;
  border-left: 4px solid var(--totemia-gold, #c4981f);
  background: var(--totemia-green, #123c32);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.home-news-card-date time {
  position: static;
  max-width: 100%;
}

.home-news-card-body {
  display: grid;
  gap: 9px;
  padding: 26px 18px 18px;
}

.home-news-card.coverless .home-news-card-body {
  padding-top: 14px;
}

.home-news-card h3,
.home-news-empty h3 {
  margin: 0;
  font-size: clamp(1.08rem, 1.8vw, 1.45rem);
  line-height: 1.22;
}

.home-news-card h3 a {
  color: var(--ink, #14171a);
  text-decoration: none;
}

.home-news-card h3 a:hover {
  color: var(--totemia-green, #123c32);
}

.home-news-card p,
.home-news-empty p {
  margin: 0;
  color: var(--muted, #5b636c);
  font-size: 14px;
  line-height: 1.55;
}

.home-news-read {
  display: inline-flex;
  width: fit-content;
  margin-top: 2px;
  border-bottom: 2px solid var(--totemia-gold, #c4981f);
  color: var(--totemia-green, #123c32);
  font-weight: 900;
  text-decoration: none;
}

.home-news-empty {
  max-width: 760px;
  padding: 22px 26px;
}

.home-news-native {
  margin-top: 6px !important;
  font-style: italic;
  color: var(--muted, #5b636c) !important;
}

/* Anonymous sign-in call to action. */
.home-signin-cta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e3e6ea);
  border-radius: 8px;
  padding: 24px 26px;
  margin-top: 28px;
}

.home-signin-cta h2 {
  margin: 0 0 4px;
}

.home-signin-cta p {
  margin: 0;
  color: var(--muted, #5b636c);
}

@media (max-width: 720px) {
  .home-hero-carousel {
    margin-top: -12px;
  }
}

@media (max-width: 1180px) {
  .home-news-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .home-news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .home-tile-deck {
    margin-top: -28px;
    width: calc(100% - 24px);
  }

  .home-tile {
    padding: 16px 8px;
    gap: 8px;
  }

  .home-tile-icon {
    width: 46px;
    height: 46px;
  }

  .home-tile-icon svg {
    width: 20px;
    height: 20px;
  }

  .home-tile-label {
    font-size: 0.78rem;
  }

  .home-news {
    padding: 34px 14px 42px;
  }

  .home-news-head {
    align-items: start;
    flex-direction: column;
  }

  .home-news-grid {
    grid-template-columns: 1fr;
  }

  .home-news-card-media {
    height: 186px;
  }

  .home-news-empty {
    padding: 18px;
  }
}

/* Personal banking redesign. Loaded after the shared portal styles so the
   migrated Next page can move away from the old pill-heavy SPA treatment. */

.banking-account-card {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 24px;
  background: var(--surface, #fff);
  border: 1px solid rgba(18, 60, 50, 0.16);
  border-top: 0;
  border-radius: 18px;
  padding: 24px 28px;
}

.banking-account-identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.banking-account-eyebrow,
.banking-section-eyebrow {
  color: rgba(18, 60, 50, 0.66);
  letter-spacing: 0.16em;
}

.banking-account-row {
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.banking-account-number {
  color: var(--ink, #14171a);
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.banking-account-name {
  color: var(--totemia-green, #123c32);
  font-size: 1rem;
  font-weight: 800;
}

.banking-account-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 0 0 10px;
  border-left: 3px solid currentColor;
  border-radius: 0;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  line-height: 1;
  text-transform: uppercase;
}

.banking-account-status.active {
  color: #155642;
}

.banking-account-status.limited {
  color: #8a6320;
}

.banking-account-balance {
  min-width: 260px;
  display: grid;
  place-content: center end;
  padding-left: 28px;
  border-left: 1px solid rgba(18, 60, 50, 0.12);
  text-align: right;
}

.banking-account-balance-label {
  color: rgba(18, 60, 50, 0.66);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
}

.banking-account-balance-value {
  color: var(--totemia-green, #123c32);
  display: inline-block;
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.055em;
  transform-origin: center bottom;
}

.banking-balance-steady {
  color: var(--totemia-green, #123c32);
}

.banking-balance-negative {
  color: #a84a3c;
  animation: banking-balance-red-dance 3.2s ease-in-out infinite;
  text-shadow: 0 0 12px rgba(168, 74, 60, 0.16);
}

.banking-balance-debt {
  color: #bb332d;
  animation: banking-balance-red-dance 2.4s ease-in-out infinite;
  text-shadow: 0 0 18px rgba(187, 51, 45, 0.22);
}

.banking-balance-debt-critical {
  color: #d11f1f;
  animation: banking-balance-red-alert 1.45s ease-in-out infinite;
  text-shadow: 0 0 22px rgba(209, 31, 31, 0.28);
}

.banking-balance-wealth-growth {
  color: #158153;
  animation: banking-balance-green-dance 3.8s ease-in-out infinite;
  text-shadow: 0 12px 24px rgba(21, 129, 83, 0.12);
}

.banking-balance-wealth-strong {
  color: #6d3fc7;
  animation: banking-balance-purple-dance 3.1s ease-in-out infinite;
  text-shadow: 0 0 18px rgba(109, 63, 199, 0.18), 0 14px 28px rgba(109, 63, 199, 0.14);
}

.banking-balance-wealth-major {
  color: #b78305;
  animation: banking-balance-gold-dance 2.6s ease-in-out infinite;
  text-shadow: 0 0 16px rgba(212, 175, 55, 0.32), 0 14px 30px rgba(183, 131, 5, 0.18);
}

@keyframes banking-balance-green-dance {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  24% { transform: translate3d(1px, -2px, 0) rotate(-0.35deg) scale(1.012); }
  52% { transform: translate3d(-1px, 1px, 0) rotate(0.25deg) scale(1.004); }
  76% { transform: translate3d(2px, -1px, 0) rotate(-0.2deg) scale(1.016); }
}

@keyframes banking-balance-purple-dance {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); filter: saturate(1); }
  20% { transform: translate3d(-2px, -2px, 0) rotate(-0.5deg) scale(1.018); }
  45% { transform: translate3d(2px, 1px, 0) rotate(0.45deg) scale(1.006); filter: saturate(1.14); }
  70% { transform: translate3d(-1px, -1px, 0) rotate(-0.25deg) scale(1.024); }
}

@keyframes banking-balance-gold-dance {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); filter: saturate(1) brightness(1); }
  18% { transform: translate3d(2px, -3px, 0) rotate(0.45deg) scale(1.02); }
  40% { transform: translate3d(-2px, 1px, 0) rotate(-0.35deg) scale(1.012); filter: saturate(1.22) brightness(1.04); }
  64% { transform: translate3d(1px, -2px, 0) rotate(0.32deg) scale(1.03); }
  82% { transform: translate3d(-1px, 1px, 0) rotate(-0.18deg) scale(1.006); }
}

@keyframes banking-balance-red-dance {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
  28% { transform: translate3d(-1px, 1px, 0) rotate(-0.25deg); opacity: .9; }
  54% { transform: translate3d(1px, 0, 0) rotate(0.2deg); opacity: .96; }
  78% { transform: translate3d(0, 1px, 0) rotate(-0.12deg); opacity: .88; }
}

@keyframes banking-balance-red-alert {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); opacity: 1; }
  22% { transform: translate3d(-2px, 1px, 0) rotate(-0.45deg) scale(1.006); opacity: .84; }
  44% { transform: translate3d(2px, 0, 0) rotate(0.4deg) scale(1.014); opacity: 1; }
  66% { transform: translate3d(-1px, 1px, 0) rotate(-0.28deg) scale(1.004); opacity: .9; }
}

.banking-tab-bar {
  width: fit-content;
  gap: 0;
  margin-top: 20px;
  margin-bottom: 16px;
  padding: 4px;
  background: rgba(18, 60, 50, 0.06);
  border: 1px solid rgba(18, 60, 50, 0.1);
  border-radius: 12px;
}

.banking-tab {
  border: 0;
  border-radius: 9px;
  margin: 0;
  padding: 10px 16px;
  color: rgba(20, 23, 26, 0.62);
}

.banking-tab.active {
  background: #fff;
  border-bottom-color: transparent;
  color: var(--totemia-green, #123c32);
}

.banking-overview-section {
  border-color: rgba(18, 60, 50, 0.12);
  border-radius: 18px;
  padding: 22px 24px;
}

.banking-chart-section {
  padding-bottom: 12px;
}

.banking-chart-frame {
  min-height: 270px;
}

.banking-section-head {
  border-bottom: 1px solid rgba(18, 60, 50, 0.08);
  padding-bottom: 12px;
}

.banking-link-btn,
.banking-export-btn {
  border-radius: 2px;
}

.banking-ledger-table {
  overflow: hidden;
  border: 1px solid rgba(18, 60, 50, 0.1);
  border-radius: 14px;
}

.banking-ledger-table table {
  border-collapse: collapse;
}

.banking-ledger-table thead th {
  background: #f7f9f8;
  color: rgba(18, 60, 50, 0.66);
  letter-spacing: 0.14em;
}

.banking-ledger-table tbody tr {
  transition: background 0.12s ease;
}

.banking-ledger-table tbody tr:hover {
  background: rgba(18, 60, 50, 0.035);
}

.banking-ledger-table .tx-counterparty {
  color: var(--ink, #14171a);
}

.banking-ledger-table .tx-flow {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  color: rgba(20, 23, 26, 0.74);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.banking-ledger-table .tx-flow-mark {
  width: 34px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
}

.banking-ledger-table .tx-flow.in {
  color: #17654c;
}

.banking-ledger-table .tx-flow.out {
  color: #944030;
}

.banking-ledger-table .tx-type {
  display: block;
  margin-top: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(42, 35, 23, 0.58);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.banking-ledger-table .tx-amount {
  font-size: 0.96rem;
}

.banking-ledger-table .tx-amount.in {
  color: #17654c;
}

.banking-ledger-table .tx-amount.out {
  color: #944030;
}

@media (max-width: 720px) {
  .banking-account-card,
  .banking-account-balance {
    display: block;
    text-align: left;
  }

  .banking-account-card {
    padding: 20px;
  }

  .banking-account-balance {
    min-width: 0;
    margin-top: 18px;
    padding: 16px 0 0;
    border-left: 0;
    border-top: 1px solid rgba(18, 60, 50, 0.12);
  }

  .banking-tab-bar {
    width: 100%;
  }

  .banking-tab {
    flex: 1;
  }

  .banking-overview-section {
    padding: 18px;
  }

  /* Transaction viewing on phones: the 4-column ledger table forced
     horizontal scrolling and cut off the amount/flow columns. Collapse
     each row into a stacked record — date + amount on the first line,
     counterparty/reason below, flow flag last — so the whole movement is
     readable without panning. Applies everywhere BankingLedgerTable is
     used (central transaction log, GBA/POBA/ROBA ledgers, my-banking). */
  .banking-ledger-table {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .banking-ledger-table table,
  .banking-ledger-table tbody,
  .banking-ledger-table tbody tr,
  .banking-ledger-table tbody td {
    display: block;
    width: 100%;
  }

  .banking-ledger-table thead {
    display: none;
  }

  .banking-ledger-table tbody tr {
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(18, 60, 50, 0.12);
    border-radius: 2px;
    background: #ffffff;
  }

  .banking-ledger-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .banking-ledger-table tbody tr.banking-ledger-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 14px;
    align-items: start;
  }

  .banking-ledger-table tbody td {
    padding: 0;
    border: 0;
  }

  .banking-ledger-table .banking-ledger-row td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .banking-ledger-table .banking-ledger-row td:nth-child(4) {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    text-align: right;
  }

  .banking-ledger-table .banking-ledger-row td:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .banking-ledger-table .banking-ledger-row td:nth-child(3) {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .banking-ledger-table .tx-flow {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .banking-ledger-table .tx-flow-mark {
    width: 22px;
  }

  .banking-ledger-table .tx-type {
    display: inline-block;
    margin: 0 0 0 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .banking-account-balance-value {
    animation: none;
    transform: none;
  }
}

/* POBA / ROBA org account pages share the GBA account navigation while carrying
   the party/religion brand accent through the hero, active tab, and fund rows. */
.org-account-view .org-account-hero {
  position: relative;
  overflow: hidden;
  border-top: 0 !important;
}

.org-account-view .org-account-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: var(--party-accent, var(--totemia-gold));
}

.org-account-view .official-seal {
  width: 88px;
  height: 88px;
  padding: 7px;
  border-radius: 4px;
  border-color: color-mix(in srgb, var(--party-accent-color, var(--totemia-green)) 24%, var(--totemia-line));
  background: #ffffff;
}

.org-account-view .official-seal-img {
  width: 100%;
  height: 100%;
  border-radius: 3px;
  background: #ffffff;
  object-fit: contain;
}

.org-account-view .fund-tab.active {
  border-bottom-color: transparent !important;
  background-image: var(--party-accent, var(--totemia-gold)) !important;
  background-position: left bottom !important;
  background-repeat: no-repeat !important;
  background-size: 100% 5px !important;
}

.org-account-view .official-stat {
  border: 0;
  border-radius: 4px;
  background: var(--totemia-ivory);
}

.org-account-view .official-stat.major strong {
  color: var(--totemia-green);
}

.org-account-view .related-fund-record {
  border: 0;
  background: var(--totemia-ivory);
  padding-left: 20px;
  border-radius: 4px;
}

.org-account-view .related-fund-record .fund-line {
  display: block;
  background: var(--party-accent, var(--totemia-gold));
  width: 6px;
}

.org-account-view .official-link-button,
.org-account-view .official-secondary,
.org-account-view .secondary,
.org-account-view .fund-tab {
  border-radius: 2px !important;
}

.operation-form-grid .settings-field > span,
.operation-form-grid .combobox-label {
  color: rgba(18, 60, 50, 0.66);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.operation-form-grid .settings-field input,
.operation-form-grid .combobox-input {
  min-height: 40px;
  border-color: rgba(18, 60, 50, 0.14);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink, #14171a);
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: var(--num-feat);
}

.operation-form-grid .combobox-selected {
  min-height: 48px;
  border-color: rgba(18, 60, 50, 0.16);
  border-radius: 8px;
  background: #ffffff;
}

.operation-form-grid .combobox-option {
  color: var(--ink, #14171a);
  box-shadow: none;
}

.operation-form-grid .combobox-option-main strong,
.operation-form-grid .combobox-selected-info strong {
  color: var(--totemia-green, #123c32);
  font-weight: 900;
}

.operation-form-grid .combobox-account-avatar {
  border-radius: 8px;
  object-fit: contain;
}

.operation-form-grid .combobox-option .tx-amount {
  font-size: 0.86rem;
  font-weight: 900;
}

/* Public party/religion detail pages: late brand overrides for the shared
 * party-doc shell and tab bar. */
.party-detail-scope .party-doc {
  position: relative;
  overflow: hidden;
  border: 0 !important;
  border-radius: 6px;
  background: #ffffff;
}

.party-detail-scope .party-doc::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: var(--party-accent, var(--totemia-gold));
}

.party-detail-scope .party-doc-hero {
  padding-top: 32px;
}

.party-detail-scope .party-doc-color-cta,
.party-detail-scope .official-link-button,
.party-detail-scope .official-secondary,
.party-detail-scope .secondary {
  border-radius: 4px !important;
}

.party-detail-scope .party-doc-color-cta {
  border-color: color-mix(in srgb, var(--party-accent-color, #123c32) 24%, var(--totemia-line));
}

.party-detail-scope .org-tabbar {
  gap: 2px;
  padding: 0 2px;
  border-bottom: 1px solid var(--totemia-line);
}

.party-detail-scope .org-tab {
  position: relative;
  display: block;
  border: 0;
  border-radius: 0;
  margin-bottom: -1px;
  padding: 11px 16px 15px;
  background: transparent;
  transition: color .12s ease, background-color .12s ease;
}

.party-detail-scope .org-tab:hover {
  color: var(--party-accent-color, var(--totemia-green));
  background-color: color-mix(in srgb, var(--party-accent-color, #123c32) 6%, transparent);
}

/* Active tab: ink label + a thick on-brand bar. Uses ::after with `background`
   (not background-image) so solid hex accents and multi-stop gradients both
   render — background-image ignores plain colors, which is why the bar vanished. */
.party-detail-scope .org-tab.active {
  color: var(--totemia-ink);
}

.party-detail-scope .org-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 6px;
  background: var(--party-accent, var(--party-accent-color, var(--totemia-gold)));
  border-radius: 2px 2px 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .party-detail-scope .org-tab {
    transition: none;
  }
}

.party-detail-scope .party-doc-section,
.party-detail-scope .party-doc-stat {
  border-color: transparent !important;
  box-shadow: none !important;
}

/* No tinted boxes around the leader / member-count stats — they read as plain
   figures on the white surface. The only accent kept is the leader card's
   dynamic left bar (see .party-doc-stat-leader). */
.party-detail-scope .party-doc-stat {
  background: transparent;
}

.party-detail-scope .party-leader-badge,
.party-detail-scope .public-member-badge {
  border: 0 !important;
  border-radius: 4px !important;
  background: var(--role-color, var(--party-accent, var(--totemia-gold))) !important;
  color: #ffffff !important;
}

/* Featured roles on the public org page stack top-to-bottom — each role
   takes its own full-width row under the leader/head card — while the
   role's holders flow left-to-right inside the row and wrap. */
.party-doc-stat.party-doc-stat-featured {
  flex-basis: 100%;
  min-width: 100%;
  border-left: 3px solid var(--party-accent-color, var(--totemia-gold));
  padding-left: 13px;
}

.party-doc-featured-holders {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
}

/* Region document page (/maps/regions/<slug>) — overview stat grid + ordered
   boundary-vertex table. Reuses portal tokens; no new look. */
.region-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin: 0;
}

.region-overview-grid dd {
  margin: 4px 0 0;
  color: var(--totemia-ink);
  font-size: 15px;
}

.region-overview-grid dd strong {
  font-size: 22px;
  font-weight: 800;
  color: var(--party-accent-color, var(--totemia-green));
  font-variant-numeric: tabular-nums lining-nums;
}

.region-vertex-table td {
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: 0.02em;
}

/* Modern bold pass for the org surfaces: public party/religion list cards,
 * payroll receipts, the workspace audit log, and the shared in-house confirm
 * dialog. Everything reuses the established tokens and the flat left-bar
 * status treatment from the banking redesign (22-banking-redesign.css) —
 * no rounded pill badges, no decorative gradients on functional surfaces. */

/* ── Shared flat status flag (replaces .official-badge pills) ─────────── */

.org-status-flag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 0 0 10px;
  border-left: 3px solid currentColor;
  background: transparent;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.org-status-flag.ok { color: #155642; }
.org-status-flag.warn { color: #8a6320; }
.org-status-flag.bad { color: #9a241d; }
.org-status-flag.muted { color: var(--totemia-muted, #6a5b3a); }

/* ── In-house confirm dialog (no native window.confirm) ───────────────── */

.interior-delete-panel.org-confirm-panel {
  position: relative;
  overflow: hidden;
  border-top: 0;
  padding-top: 26px;
}

/* Accent strip uses background (not border) so per-org gradient accents
 * render; falls back to gold outside branded scopes. */
.interior-delete-panel.org-confirm-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: var(--party-accent, var(--totemia-gold, #d5b637));
}

.interior-delete-panel.org-confirm-panel.danger::before {
  background: #9a241d;
}

/* ── Public party / religion list ─────────────────────────────────────── */

/* Document-style page heading: the boxed hero read as a stray bordered bar
 * above the cards. Flat bold title instead. */
.official-hero.public-list-hero {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 14px 2px 4px;
  margin-bottom: 4px;
}

.official-hero.public-list-hero h1 {
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 900;
  letter-spacing: -0.025em;
  margin: 0;
}

.official-hero.public-list-hero .registry-label {
  color: var(--totemia-muted, #6a5b3a);
}

/* Thicker brand line + bolder card type. */
.public-party-card.party-accent::before {
  height: 10px;
}

.public-party-card {
  border-radius: 6px;
  overflow: hidden;
}

.public-party-card .public-party-title {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -0.015em;
}

.public-party-card .public-party-body {
  gap: 8px;
}

.public-party-card-leader {
  border-left: 3px solid var(--party-accent-color, var(--totemia-gold, #d5b637));
  padding-left: 9px;
}

.public-party-card-leader strong {
  font-size: 13px;
  font-weight: 800;
  color: var(--totemia-ink, #14171a);
}

.public-party-card-members,
.public-party-card .public-party-meta {
  font-weight: 800;
  color: var(--totemia-ink, #14171a);
}

/* ── Payroll receipt document ──────────────────────────────────────────── */

.org-receipt-hero {
  position: relative;
  overflow: hidden;
  border-top: 0 !important;
}

.org-receipt-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: var(--party-accent, var(--totemia-gold, #d5b637));
}

.org-receipt-hero {
  padding-top: 24px;
}

.org-receipt-seal {
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--party-accent-color, var(--totemia-green, #123c32)) 24%, var(--totemia-line, #e8dfbf));
  border-radius: 4px;
  background: #ffffff;
}

.org-receipt-seal img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.org-receipt-seal-fallback {
  color: var(--totemia-muted, #6a5b3a);
  font-size: 20px;
  font-weight: 900;
  text-transform: uppercase;
}

.org-receipt-hero h1 {
  font-weight: 900;
  letter-spacing: -0.02em;
}

/* Flat bold stat band — no boxed old-school stat cards. */
.org-receipt-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0;
  margin: 14px 0 18px;
  border: 1px solid rgba(18, 60, 50, 0.12);
  border-radius: 6px;
  background: var(--surface, #ffffff);
}

.org-receipt-stat {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 16px 18px;
  border-left: 1px solid rgba(18, 60, 50, 0.1);
  min-width: 0;
}

.org-receipt-stat:first-child {
  border-left: 0;
}

.org-receipt-stat > span {
  color: rgba(18, 60, 50, 0.66);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.org-receipt-stat > strong {
  color: var(--totemia-green, #123c32);
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1.1;
}

.org-receipt-stat.major > strong {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.org-receipt-stat.bad > strong {
  color: #9a241d;
}

.org-receipt-stat > small {
  color: var(--totemia-muted, #6a5b3a);
  font-size: 0.74rem;
  font-weight: 700;
}

/* Cost-by-role reuses the salary-role-card family (08-party-colors.css owns
 * the left role-color bar + tint inside .org-workspace). Receipt additions: */
.org-receipt-role-total {
  color: var(--totemia-green, #123c32);
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums lining-nums;
}

.org-receipt-role-meta {
  color: var(--totemia-muted, #6a5b3a);
  font-size: 0.78rem;
  font-weight: 700;
}

/* Payments table: bold ink identity links (no default purple), avatars,
 * role color marks, tabular amounts. */
.org-receipt-table a,
.org-receipt-table a strong {
  color: var(--totemia-ink, #14171a);
  text-decoration: none;
}

.org-receipt-table a:hover strong {
  color: var(--totemia-green, #123c32);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.org-receipt-table .user-identity-line strong {
  font-weight: 800;
}

.org-receipt-table td {
  vertical-align: middle;
}

.org-receipt-role-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: var(--totemia-ink, #14171a);
}

.org-receipt-role-mark {
  width: 4px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 2px;
  background: var(--role-color, var(--party-accent-color, var(--totemia-gold, #d5b637)));
}

.org-receipt-amount {
  font-weight: 900;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--totemia-green, #123c32);
}

/* ── Workspace audit log ──────────────────────────────────────────────── */

.org-audit-list {
  display: grid;
  gap: 0;
  border: 1px solid rgba(18, 60, 50, 0.12);
  border-radius: 6px;
  background: var(--surface, #ffffff);
  overflow: hidden;
}

.org-audit-entry {
  display: grid;
  grid-template-columns: 4px minmax(150px, 190px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 12px 0;
  border-top: 1px solid rgba(18, 60, 50, 0.08);
}

.org-audit-entry:first-child {
  border-top: 0;
}

.org-audit-mark {
  align-self: stretch;
  background: var(--audit-color, var(--totemia-gold, #d5b637));
}

.org-audit-action {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.org-audit-action strong {
  color: var(--audit-color, var(--totemia-ink, #14171a));
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.org-audit-action time {
  color: var(--totemia-muted, #6a5b3a);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.org-audit-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.org-audit-body p {
  margin: 0;
  color: var(--totemia-ink, #14171a);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.org-audit-actor {
  justify-self: end;
}

.org-audit-actor a {
  color: var(--totemia-ink, #14171a);
  text-decoration: none;
}

.org-audit-actor a:hover strong {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.org-audit-actor .user-identity-line strong {
  font-weight: 800;
  font-size: 0.84rem;
}

/* Category accents — same palette the rest of the portal already uses. */
.org-audit-entry.cat-role { --audit-color: #b78305; }
.org-audit-entry.cat-member { --audit-color: #155642; }
.org-audit-entry.cat-fund { --audit-color: #1d4ed8; }
.org-audit-entry.cat-payroll { --audit-color: var(--totemia-green, #123c32); }
.org-audit-entry.cat-danger { --audit-color: #9a241d; }
.org-audit-entry.cat-policy { --audit-color: #6d28d9; }

@media (max-width: 760px) {
  .org-audit-entry {
    grid-template-columns: 4px minmax(0, 1fr);
    align-items: start;
    row-gap: 6px;
  }

  .org-audit-mark {
    grid-row: 1 / span 3;
  }

  .org-audit-actor {
    justify-self: start;
  }

  .org-receipt-stat {
    border-left: 0;
    border-top: 1px solid rgba(18, 60, 50, 0.1);
  }

  .org-receipt-stat:first-child {
    border-top: 0;
  }
}

/* ── Government account / fund detail polish ─────────────────────────────── */

/* Thick accent rule under the fund tab navigation, matching the bold accent
   strip the public party / religion documents carry. The accent inherits the
   account's --party-accent (government green for GAs, org color elsewhere). */
.org-account-view .fund-tab-bar {
  border-bottom-width: 4px;
  border-bottom-color: var(--party-accent, var(--totemia-gold, #d5b637));
}

/* Salary edit editor: align with the bold look. The inline editor used to
   inherit the global gold focus glow (the "excessive yellow shadow"); here the
   field reads flat with square corners and a role-tinted green focus ring. */
.org-workspace .salary-role-card-edit .settings-field > span {
  color: var(--totemia-muted, #6a5b3a);
  font-weight: 900;
  letter-spacing: 0.09em;
}

.org-workspace .salary-role-card-edit input[type="text"] {
  border-radius: 4px;
  border-color: color-mix(
    in srgb,
    var(--role-color, var(--totemia-green, #123c32)) 30%,
    var(--totemia-line, #e6e0d2)
  );
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--totemia-ink, #14171a);
}

.org-workspace .salary-role-card-edit input[type="text"]:focus {
  border-color: var(--role-color, var(--totemia-green, #123c32));
  box-shadow: 0 0 0 3px
    color-mix(in srgb, var(--role-color, var(--totemia-green, #123c32)) 18%, transparent);
}

/* Interactive funding / surplus bar: the committed and excess segments respond
   to hover and keyboard focus so their exact-amount tooltips feel discoverable
   rather than static. Motion is a tiny brightness shift only. */
.payroll-funding-bar .payroll-funding-fill,
.payroll-funding-bar .payroll-funding-fill-excess {
  cursor: help;
  outline: none;
}

.payroll-funding-bar .payroll-funding-fill:hover,
.payroll-funding-bar .payroll-funding-fill:focus-visible,
.payroll-funding-bar .payroll-funding-fill-excess:hover,
.payroll-funding-bar .payroll-funding-fill-excess:focus-visible {
  filter: brightness(1.07);
}

.payroll-funding-bar .payroll-funding-fill-excess:focus-visible {
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.55), 0 0 0 1px rgba(18, 60, 50, 0.22);
}

@media (prefers-reduced-motion: reduce) {
  .payroll-funding-bar .payroll-funding-fill:hover,
  .payroll-funding-bar .payroll-funding-fill:focus-visible,
  .payroll-funding-bar .payroll-funding-fill-excess:hover,
  .payroll-funding-bar .payroll-funding-fill-excess:focus-visible {
    filter: none;
  }
}

/* Schedule planner: balance the row on wider screens so the date controls sit
   opposite the "next release" summary instead of leaving an empty gap beside
   it — the abrupt seam between the polished funding block and this row. */
@media (min-width: 760px) {
  .compact-schedule-planner {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    column-gap: 24px;
  }

  .compact-schedule-controls {
    justify-content: flex-end;
  }
}

/* Modern login surface. Overrides the legacy signin rules in portalShell.css
   without adding more code to that oversized shell file. */
.signin-wrap {
  width: min(100%, 430px);
  max-width: none;
  margin: clamp(24px, 5vh, 56px) auto;
}

.signin-card {
  padding: 34px 34px 32px;
  border: 1px solid var(--totemia-line);
  border-top: 4px solid var(--totemia-green);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.signin-title {
  margin-bottom: 6px;
  color: var(--totemia-green);
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.12;
}

.signin-sub {
  max-width: 34ch;
  margin: 0 auto 24px;
  color: var(--totemia-muted);
  font-size: 13px;
  line-height: 1.55;
}

.signin-error {
  margin-bottom: 14px;
}

.signin-field {
  gap: 6px;
  margin-bottom: 14px;
}

.signin-field label {
  color: var(--totemia-muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
}

.signin-field input {
  min-height: 44px;
  border-color: var(--totemia-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--totemia-ink);
  font-size: 15px;
}

.signin-field input:focus {
  border-color: var(--totemia-gold);
  box-shadow: 0 0 0 3px rgba(196, 152, 31, .16);
}

.signin-btn {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--totemia-green);
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: none;
  transform: none;
}

.signin-btn:hover,
.signin-btn:focus-visible {
  background: var(--totemia-green-2);
  box-shadow: none;
  transform: none;
}

.signin-btn:active {
  transform: none;
}

.signin-btn:disabled {
  background: color-mix(in srgb, var(--totemia-green) 55%, #ffffff);
}

.signin-card .password-meter {
  border-radius: 8px;
  box-shadow: none;
}

@media (max-width: 520px) {
  .signin-wrap {
    margin: 18px auto;
  }

  .signin-card {
    padding: 28px 22px 24px;
  }

  .signin-title {
    font-size: 23px;
  }
}

/* Article studio and shared notifier overrides. Loaded late on purpose so
   older portal surfaces stop falling back to cramped editor/toast rules. */

.publication-workspace-shell {
  width: min(1560px, calc(100vw - 32px));
  margin: 0 auto 28px;
}

.publication-workspace-editor {
  border-top: 6px solid var(--totemia-gold);
}

.org-content-workspace-shell {
  grid-template-columns: minmax(176px, 220px) minmax(0, 1fr);
}

.org-content-workspace-shell .interior-workspace-content {
  min-width: 0;
}

.org-content-workspace-shell .interior-tab-panel {
  padding: 0;
  border: 0;
  background: transparent;
}

.publication-workspace-panel {
  width: 100%;
}

.publication-editor-shell {
  display: grid;
  gap: 12px;
}

.publication-editor-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.publication-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.publication-action-tile {
  position: relative;
  display: grid;
  gap: 7px;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--totemia-line);
  border-top: 8px solid var(--party-accent-color, var(--totemia-gold));
  background: #fff;
  color: var(--totemia-ink);
  text-decoration: none;
  box-shadow: none;
}

.publication-action-tile:hover {
  border-color: var(--party-accent-color, var(--totemia-gold));
}

.publication-action-tile strong {
  color: var(--totemia-ink);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.05;
}

.publication-action-tile small {
  color: var(--totemia-muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.publication-studio {
  min-width: 0;
}

.publication-studio-layout {
  grid-template-columns: minmax(680px, 1fr) minmax(320px, 410px);
  gap: 28px;
}

.publication-canvas,
.publication-settings-rail {
  min-width: 0;
}

.publication-canvas {
  padding-right: clamp(0px, 1.5vw, 18px);
}

.publication-settings-rail {
  position: sticky;
  top: calc(var(--masthead-h, 56px) + 18px);
  align-self: start;
  padding: 18px;
  border: 1px solid var(--totemia-line);
  border-top: 5px solid var(--party-accent-color, var(--totemia-gold));
  background: #fff;
}

.publication-settings-rail .publication-date-inline {
  grid-template-columns: minmax(0, 1fr);
}

.publication-toolbar {
  top: var(--masthead-h, 56px);
  border-radius: 0;
}

.publication-style-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  padding: 10px 0;
  border-bottom: 1px solid var(--totemia-line);
}

.publication-style-row label {
  display: grid;
  gap: 4px;
  min-width: 120px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.publication-style-row select {
  min-height: 34px;
}

.publication-document-dropzone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px dashed var(--party-accent-color, var(--totemia-gold));
  border-left: 5px solid var(--party-accent-color, var(--totemia-gold));
  background: #fff;
}

.publication-document-dropzone.has-file {
  border-style: solid;
}

.publication-document-dropzone > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.publication-document-dropzone strong {
  overflow-wrap: anywhere;
  color: var(--totemia-ink);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.25;
}

.publication-document-dropzone small {
  color: var(--totemia-muted);
  font-size: 12px;
  font-weight: 800;
}

.publication-swatch-group {
  display: flex;
  gap: 5px;
  align-items: center;
}

.publication-color-swatch {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border: 1px solid var(--totemia-line);
  border-radius: 0;
  box-shadow: none;
}

.publication-color-swatch.background {
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.88);
}

.interior-delete-panel.article-link-modal {
  width: min(620px, 100%);
  border-top-color: var(--party-accent-color, var(--totemia-gold));
}

.article-link-modal .article-link-actions {
  flex-wrap: wrap;
}

.article-link-modal p {
  color: var(--totemia-muted);
}

.article-external-modal-root {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 18, 14, .48);
}

.article-external-modal {
  width: min(520px, 100%);
  display: grid;
  gap: 14px;
  justify-items: center;
  border: 1px solid var(--totemia-line);
  border-top: 8px solid var(--totemia-gold);
  background: #fff;
  padding: 24px 24px 0;
  color: var(--totemia-ink);
  text-align: center;
}

.article-external-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid #edc6c6;
  background: #f7d1d1;
  color: #5d1e1e;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.article-external-modal h2 {
  margin: 0;
  color: var(--totemia-ink);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.1;
}

.article-external-modal p {
  margin: 0;
  color: var(--totemia-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}

.article-external-modal strong {
  color: #080806;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.article-external-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: calc(100% + 48px);
  margin-top: 4px;
  border-top: 1px solid var(--totemia-line);
}

.article-external-actions button {
  min-height: 58px;
  border: 0;
  border-right: 1px solid var(--totemia-line);
  border-radius: 0;
  background: #fff;
  color: #b71919;
  font-size: 15px;
  font-weight: 900;
  box-shadow: none;
}

.article-external-actions button:last-child {
  border-right: 0;
  color: var(--totemia-green);
}

.publication-editor-surface .ProseMirror {
  overflow-wrap: break-word;
  word-break: normal;
}

.publication-editor-surface .ProseMirror span[data-size="lead"],
.publication-body span[data-size="lead"] {
  font-size: 1.16em;
  line-height: 1.6;
  font-weight: 700;
}

.publication-editor-surface .ProseMirror span[data-size="large"],
.publication-body span[data-size="large"] {
  font-size: 1.38em;
  line-height: 1.35;
  font-weight: 800;
}

.publication-editor-surface .ProseMirror span[data-size="display"],
.publication-body span[data-size="display"] {
  display: inline-block;
  font-size: 1.72em;
  line-height: 1.12;
  font-weight: 900;
}

.publication-editor-surface .ProseMirror img[data-width="25"],
.publication-inline-image.publication-image-width-25 {
  width: 25%;
}

.publication-editor-surface .ProseMirror img[data-width="50"],
.publication-inline-image.publication-image-width-50 {
  width: 50%;
}

.publication-editor-surface .ProseMirror img[data-width="75"],
.publication-inline-image.publication-image-width-75 {
  width: 75%;
}

.publication-editor-surface .ProseMirror img[data-width="100"],
.publication-inline-image.publication-image-width-100 {
  width: 100%;
}

.publication-editor-surface .ProseMirror img[data-align="left"],
.publication-image-left {
  max-width: min(52%, 520px);
}

.publication-editor-surface .ProseMirror img[data-align="right"],
.publication-image-right {
  max-width: min(52%, 520px);
}

.publication-editor-surface .ProseMirror img[data-align="center"] {
  margin-left: auto;
  margin-right: auto;
}

.publication-editor-surface .ProseMirror img[data-align="wide"] {
  width: 100% !important;
  max-width: 100%;
}

.publication-timeline-draft .wide {
  grid-column: 1 / -1;
}

.toast-stack {
  width: min(420px, calc(100vw - 28px));
}

.toast-stack .toast,
.interior-toast-stack .interior-toast {
  border-left: 1px solid var(--totemia-line, var(--line, #e3e6ea)) !important;
  border-radius: 0 !important;
  padding-top: 15px !important;
  overflow: hidden !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
}

.toast-stack .toast::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: var(--totemia-gold, var(--gold, #c4981f));
  transform-origin: left center;
  animation: toast-life 5200ms linear forwards;
}

.toast-stack .toast p,
.toast-stack .toast > div:not(.life) {
  margin: 0;
  color: var(--totemia-muted, var(--muted, #5b636c));
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.toast-stack .toast .life,
.interior-toast-stack .interior-toast-timer {
  top: 0 !important;
  bottom: auto !important;
  left: 0 !important;
  right: 0 !important;
  height: 6px !important;
  border-radius: 0 !important;
  z-index: 1 !important;
}

.interior-toast-stack .interior-toast {
  grid-template-columns: minmax(0, 1fr) 30px !important;
}

.interior-toast-stack .interior-toast-mark {
  display: none !important;
}

.interior-toast-stack .interior-toast .interior-toast-body {
  padding-top: 11px !important;
}

@media (max-width: 980px) {
  .publication-workspace-shell {
    width: min(100%, calc(100vw - 20px));
  }

  .publication-studio-layout,
  .publication-action-grid,
  .org-content-workspace-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .publication-settings-rail {
    position: static;
  }

  .publication-editor-nav {
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .publication-editor-surface .ProseMirror img[data-width],
  .publication-inline-image[class*="publication-image-width"] {
    width: 100%;
    max-width: 100%;
  }

  .publication-document-dropzone,
  .article-external-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .publication-document-dropzone {
    align-items: stretch;
  }

  .article-external-actions button {
    border-right: 0;
    border-bottom: 1px solid var(--totemia-line);
  }

  .article-external-actions button:last-child {
    border-bottom: 0;
  }
}

img.twemoji {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin: 0 .05em 0 .1em;
  vertical-align: -0.12em;
  object-fit: contain;
}

img.totemia-custom-flag {
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(20, 23, 26, .18);
}

/* Ministry of Interior — Account Center "Create Website Identity" panel and
 * the one-time recovery-password reveal. Modern bold treatment: full-width
 * readable fields (not the 9px settings sidebar), flat surfaces, and a copy
 * affordance so the temp password never has to be highlighted by hand. Uses
 * the shared portal tokens only — no new color system. */

.account-creator {
  margin-top: 4px;
}

.account-creator-intro {
  margin: 2px 0 18px;
  max-width: 64ch;
  color: var(--totemia-muted);
  font-size: 14px;
  line-height: 1.55;
}

.account-creator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.account-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

/* Role spans the full width on its own row so the long option labels read. */
.account-field-role {
  grid-column: 1 / -1;
}

.account-field-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--totemia-muted);
}

.account-field-label em {
  margin-left: 6px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: color-mix(in srgb, var(--totemia-muted) 70%, transparent);
  text-transform: none;
}

.account-creator .account-field input,
.account-creator .account-field select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--totemia-line);
  border-radius: 0;
  background: #ffffff;
  color: var(--totemia-ink);
  font-size: 15px;
  font-weight: 600;
  box-shadow: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}

.account-creator .account-field input::placeholder {
  color: color-mix(in srgb, var(--totemia-muted) 72%, transparent);
  font-weight: 500;
}

.account-creator .account-field input:focus,
.account-creator .account-field select:focus {
  outline: none;
  border-color: var(--totemia-green);
  box-shadow: inset 0 0 0 1px var(--totemia-green);
}

.account-creator-actions {
  display: flex;
  margin-top: 18px;
}

.account-creator-submit {
  min-height: 46px;
  padding: 0 26px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.account-creator-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── One-time recovery-password reveal ─────────────────────────────────── */

.credential-reveal {
  margin-top: 18px;
  border: 1px solid var(--totemia-line);
  border-left: 6px solid var(--totemia-gold);
  background: color-mix(in srgb, var(--totemia-gold) 6%, #ffffff);
  padding: 16px 18px;
}

.credential-reveal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.credential-reveal-note {
  margin: 0 0 12px;
  color: var(--totemia-ink);
  font-size: 13.5px;
  line-height: 1.5;
}

.credential-reveal-note strong {
  font-weight: 800;
}

.credential-copy-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.credential-code {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  min-height: 50px;
  border: 1px solid color-mix(in srgb, var(--totemia-gold) 38%, var(--totemia-line));
  background: #ffffff;
  color: var(--totemia-ink);
  font-family: var(--mono, "SFMono-Regular", "Consolas", "Liberation Mono", monospace);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.06em;
  overflow-x: auto;
  white-space: nowrap;
  user-select: all;
}

.credential-copy-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  min-height: 50px;
  border: 0;
  border-radius: 0;
  background: var(--totemia-green);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: none;
  transition: background .12s ease, transform .08s ease;
}

.credential-copy-btn:hover {
  background: color-mix(in srgb, var(--totemia-green) 88%, #000000);
}

.credential-copy-btn:active {
  transform: translateY(1px);
}

.credential-copy-btn.is-copied {
  background: #155642;
}

.credential-copy-btn svg {
  display: block;
}

@media (max-width: 640px) {
  .account-creator-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-creator-actions,
  .account-creator-submit {
    width: 100%;
  }

  .account-creator-submit {
    justify-content: center;
  }

  .credential-copy-row {
    flex-direction: column;
  }

  .credential-copy-btn {
    justify-content: center;
    padding: 12px 18px;
  }
}

