/* PHARAOH SOVEREIGN CEO — Founder Command Centre.
   Colour never carries meaning on its own: every risk and status is also a word, a
   position and a luminance step. That keeps the interface readable for colour-blind
   users, in greyscale, and in a screen reader. */

:root {
  --bg: #0d1117; --panel: #151b24; --panel-2: #1c2431;
  --line: #2a3441; --line-strong: #3d4a5c;
  --ink: #e8edf4; --ink-dim: #97a3b4; --ink-faint: #6b7788;
  --gold: #c9a227; --gold-dim: #8d7220; --focus: #7aa7ff;

  /* Risk: distinguished by LUMINANCE and border weight first, hue second. */
  --risk-green-bg: #16241c; --risk-green-ink: #86d9a6; --risk-green-line: #2f5d42;
  --risk-amber-bg: #2b2415; --risk-amber-ink: #ecc46a; --risk-amber-line: #6e5722;
  --risk-red-bg:   #2e1a1c; --risk-red-ink:  #f39a9a;  --risk-red-line:  #7a3439;

  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.sr-only, .skip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto;
  background: var(--panel); padding: 8px 12px; z-index: 100; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px; background: linear-gradient(180deg, #121821, #0f151d);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; letter-spacing: .14em; font-size: 13px; }
.brand-text b { color: var(--gold); letter-spacing: .18em; }
.mark { width: 16px; height: 16px; flex: none;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.company-select { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: 6px 10px; font: inherit; font-size: 13px; }
.chain { font: 12px var(--mono); color: var(--ink-dim); }
.chain[data-ok="true"]::before  { content: "◆ ledger verified"; color: var(--risk-green-ink); }
.chain[data-ok="false"]::before { content: "▲ LEDGER BROKEN";   color: var(--risk-red-ink); }

.shell { display: grid; grid-template-columns: 210px 1fr; min-height: calc(100vh - 96px); }
.sidenav { border-right: 1px solid var(--line); padding: 16px 10px; display: flex;
  flex-direction: column; gap: 2px; background: #10161e; position: sticky; top: 49px; align-self: start; }
.sidenav a { padding: 8px 12px; border-radius: 6px; color: var(--ink-dim); font-size: 14px;
  display: flex; justify-content: space-between; align-items: center; }
.sidenav a:hover { background: var(--panel-2); color: var(--ink); }
.sidenav a[aria-current="page"] { background: var(--panel-2); color: var(--ink); box-shadow: inset 3px 0 0 var(--gold); }
.main { padding: 24px 28px 48px; min-width: 0; }
.foot { border-top: 1px solid var(--line); padding: 14px 20px; color: var(--ink-faint); font-size: 12px; }

h1 { font-size: 21px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 26px 0 10px; color: var(--ink-dim); text-transform: uppercase;
  letter-spacing: .1em; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 6px; }
.sub { color: var(--ink-dim); margin: 0 0 18px; font-size: 14px; }
.muted { color: var(--ink-faint); }

.grid { display: grid; gap: 14px; }
.grid.k4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.k2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .label { color: var(--ink-faint); font-size: 12px; text-transform: uppercase; letter-spacing: .09em; margin-bottom: 6px; }
.stat .value { font: 600 26px/1.1 var(--sans); font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; color: var(--ink-dim); font-weight: 400; }

ul.list { list-style: none; margin: 0; padding: 0; }
ul.list > li { padding: 11px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px;
  align-items: flex-start; justify-content: space-between; }
ul.list > li:last-child { border-bottom: 0; }
.rank { font: 600 12px var(--mono); color: var(--gold); min-width: 20px; }
.why { color: var(--ink-faint); font-size: 12.5px; }

.badge { font: 600 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 8px; border-radius: 5px; border: 1px solid; white-space: nowrap; }
.badge.green { background: var(--risk-green-bg); color: var(--risk-green-ink); border-color: var(--risk-green-line); }
.badge.amber { background: var(--risk-amber-bg); color: var(--risk-amber-ink); border-color: var(--risk-amber-line); border-width: 2px; }
.badge.red   { background: var(--risk-red-bg);   color: var(--risk-red-ink);   border-color: var(--risk-red-line);   border-width: 2px; }
.badge.grey  { background: var(--panel-2); color: var(--ink-dim); border-color: var(--line-strong); }
.pill { background: var(--gold); color: #1a1405; border-radius: 999px; font: 700 11px var(--mono); padding: 2px 7px; }
.pill:empty { display: none; }

button { font: 500 13px var(--sans); padding: 7px 13px; border-radius: 6px; cursor: pointer;
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line-strong); }
button:hover { border-color: var(--gold-dim); }
button.primary { background: var(--gold); color: #1a1405; border-color: var(--gold); font-weight: 600; }
button.danger { border-color: var(--risk-red-line); color: var(--risk-red-ink); }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--ink-faint); font-weight: 600; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .08em; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
code, .mono { font: 12px var(--mono); color: var(--ink-dim); }

textarea, input[type=text] { width: 100%; background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 10px; font: inherit; }
.answer { white-space: pre-wrap; background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--gold); border-radius: 6px; padding: 14px; margin-top: 14px; }
.note { background: var(--risk-amber-bg); border: 1px solid var(--risk-amber-line);
  color: var(--risk-amber-ink); border-radius: 6px; padding: 10px 12px; font-size: 13px; }

.tree { list-style: none; padding-left: 0; margin: 0; }
.tree ul { list-style: none; margin: 4px 0; padding-left: 18px; border-left: 1px solid var(--line-strong); }
.tree li { padding: 4px 0 4px 10px; }
.tree .kind { font: 10px var(--mono); color: var(--ink-faint); letter-spacing: .1em;
  text-transform: uppercase; margin-right: 8px; }

@media (max-width: 780px) {
  .shell { grid-template-columns: 1fr; }
  .sidenav { position: static; flex-direction: row; overflow-x: auto; border-right: 0;
    border-bottom: 1px solid var(--line); }
  .main { padding: 18px 14px 40px; }
}
