:root {
  --brand: #8f1d21;
  --brand-2: #b3373b;
  --brand-soft: #f8eded;
  --ink: #1d1a19;
  --ink-2: #5b5552;
  --ink-3: #8c8581;
  --line: #e8e3df;
  --bg: #f7f5f3;
  --card: #ffffff;
  --green: #1f7a4d; --green-bg: #e6f4ec;
  --amber: #9a6200; --amber-bg: #fdf3dc;
  --red: #b42318;   --red-bg: #fde9e7;
  --blue: #1f5a96;  --blue-bg: #e7f0fa;
  --grey: #6b6560;  --grey-bg: #efedeb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(30, 20, 15, .05), 0 4px 16px rgba(30, 20, 15, .05);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 28px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; font-family: var(--sans); font-weight: 600; }
small, .muted { color: var(--ink-3); }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 236px; flex: none; background: #1d1716; color: #e9e2de; padding: 20px 14px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; color: #fff; padding: 4px 8px 22px; }
.brand:hover { text-decoration: none; }
.brand b { display: block; font-family: var(--serif); font-size: 18px; font-weight: 600; }
.brand small { color: #a99f9a; font-size: 12px; }
.logo { width: 38px; height: 38px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; font-family: var(--serif); font-weight: 600; }
nav a { display: flex; gap: 10px; align-items: center; color: #d5ccc7; padding: 9px 10px; border-radius: 8px; margin-bottom: 2px; font-weight: 500; }
nav a i { font-style: normal; width: 18px; text-align: center; opacity: .8; }
nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
nav a.on { background: var(--brand); color: #fff; }
.side-foot { margin-top: auto; font-size: 12px; color: #a99f9a; padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; min-width: 0; }
.top { position: sticky; top: 0; z-index: 20; background: rgba(247,245,243,.9); backdrop-filter: blur(8px); padding: 14px 28px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; }
.search-results { position: absolute; top: 44px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); display: none; max-height: 360px; overflow: auto; }
.search-results.open { display: block; }
.search-results a { display: block; padding: 9px 12px; color: var(--ink); border-bottom: 1px solid var(--line); }
.search-results a:hover { background: var(--brand-soft); text-decoration: none; }
.view { padding: 26px 28px 60px; max-width: 1280px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.loading, .empty { padding: 40px; text-align: center; color: var(--ink-3); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Cards & tiles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card > h2, .card > h3 { margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.tile .k { color: var(--ink-3); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.tile .v { font-family: var(--serif); font-size: 26px; font-weight: 600; margin-top: 4px; }
.tile .s { color: var(--ink-2); font-size: 12.5px; }
.tile.alert .v { color: var(--red); }

dl.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 24px; margin: 0; }
dl.facts div { min-width: 0; }
dl.facts dt { color: var(--ink-3); font-size: 12px; }
dl.facts dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #faf8f6; font-size: 12px; color: var(--ink-2); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--brand); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.link { cursor: pointer; }
tr.link:hover td { background: #fcf7f6; }
tr.dim td { color: var(--ink-3); }

table.policies td:first-child { min-width: 250px; }
table.policies select { padding: 5px 8px; font-size: 13px; }
.pnote { font-size: 12px; color: var(--ink-3); margin-top: 3px; max-width: 340px; }

/* Pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.blue { background: var(--blue-bg); color: var(--blue); }
.pill.grey { background: var(--grey-bg); color: var(--grey); }

/* Forms & buttons */
input, select, textarea {
  font: inherit; color: inherit; background: #fff; border: 1px solid #d9d2cd; border-radius: 9px; padding: 9px 11px; outline: none; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(143,29,33,.12); }
textarea { width: 100%; min-height: 140px; resize: vertical; }
label { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: 4px; }
.btn { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-weight: 600; border-radius: 9px; padding: 9px 14px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #cfc6c0; text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); }
.btn.wa { background: #1f9d55; border-color: #1f9d55; color: #fff; }
.btn.wa:hover { background: #188a49; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters label { min-width: 140px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { font: inherit; border: 0; background: none; padding: 8px 13px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.seg button.on { background: var(--brand); color: #fff; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid .wide { grid-column: span 2; }
.form-grid .full { grid-column: 1 / -1; }

/* Gap bar */
.bar { height: 8px; background: var(--grey-bg); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.bar.mid > span { background: #d99a1e; }
.bar.low > span { background: var(--red); }
.gapbox { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gapcard { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.gapcard .big { font-family: var(--serif); font-size: 22px; font-weight: 600; }

.callout { border-left: 4px solid var(--blue); background: var(--blue-bg); padding: 10px 14px; border-radius: 6px; margin: 8px 0; }
.callout.red { border-color: var(--red); background: var(--red-bg); }
.callout.amber { border-color: #d99a1e; background: var(--amber-bg); }
.callout.green { border-color: var(--green); background: var(--green-bg); }

.steps { counter-reset: s; }
.step { position: relative; padding-left: 40px; margin-bottom: 18px; }
.step::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
pre.msg { white-space: pre-wrap; background: #f3f8f4; border: 1px solid #d6e9dc; border-radius: 10px; padding: 12px 14px; font: 13px/1.5 var(--sans); margin: 8px 0; max-height: 340px; overflow: auto; }
.nominee-block { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: #fdfcfb; }
.nominee-block h3 { margin-bottom: 10px; display: flex; justify-content: space-between; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: #1d1716; color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; transition: .25s; z-index: 100; font-weight: 500; }
.toast.err { background: var(--red); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, dl.facts, .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .side { position: fixed; left: -260px; z-index: 50; transition: left .2s; }
  .side.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .menu-btn { display: inline-block; font-size: 20px; background: none; border: 0; cursor: pointer; }
  .top { padding: 10px 16px; }
  .view { padding: 18px 16px 50px; }
  .g4, .g3, .g2, dl.facts, .form-grid, .gapbox { grid-template-columns: minmax(0, 1fr); }
  .form-grid .wide { grid-column: auto; }
  h1 { font-size: 23px; }
}
