/* The Ledger — "Corps + Governance" panel ("The Boardroom").
 * Scoped entirely under #panel-corps. Institutional, polished, teal/gold. */

#panel-corps {
  --c-bg: #0d1219;
  --c-panel-2: #182130;
  --c-line: rgba(126, 224, 163, 0.16);
  --c-teal: #7ee0a3;
  --c-teal-dim: rgba(126, 224, 163, 0.10);
  --c-gold: #f0b429;
  --c-gold-dim: rgba(240, 180, 41, 0.12);
  --c-ink: #e4eaf4;
  --c-muted: #74809a;
  --c-down: #ff5c7a;
  --c-serif: Georgia, 'Times New Roman', 'Palatino Linotype', serif;

  background:
    radial-gradient(120% 90% at 100% 0%, rgba(126, 224, 163, 0.05), transparent 55%),
    radial-gradient(100% 80% at 0% 100%, rgba(240, 180, 41, 0.05), transparent 55%),
    var(--panel);
  border-color: rgba(126, 224, 163, 0.20);
}

/* Faint ledger-paper pinstripe used on cards + motion documents. */
#panel-corps .c-paper {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 26px),
    var(--c-panel-2);
}

/* ── Header ─────────────────────────────────────────────────────────────── */
#panel-corps .c-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
#panel-corps .c-head h2 { margin: 0; }
#panel-corps .c-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

#panel-corps .c-seat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--c-gold);
  background: var(--c-gold-dim);
  border: 1px solid rgba(240, 180, 41, 0.3);
  border-radius: 8px;
  padding: 5px 10px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
#panel-corps .c-seat:hover { border-color: var(--c-gold); transform: translateY(-1px); }
#panel-corps .c-seat:focus-visible { outline: 2px solid var(--c-gold); outline-offset: 1px; }
#panel-corps .c-seat-ico { font-size: 9px; flex: 0 0 auto; }
/* No-seat note — plain muted text, deliberately NOT a pill. It just says what
   it says; the gold "New corp" button carries the affordance. */
#panel-corps .c-seat-none {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--c-muted);
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
#panel-corps .c-link-btn {
  background: transparent;
  border: none;
  color: var(--c-gold);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0 0 0 2px;
}
#panel-corps .c-link-btn:hover { text-decoration: underline; }

#panel-corps .c-refresh {
  color: var(--c-teal);
  border-color: var(--c-line);
  /* Icon-only compact refresh — the rail has room for exactly one labeled
     action (New corp); refresh goes quiet as a ⟳ glyph with a tooltip. */
  padding: 5px 9px;
  line-height: 1.2;
  min-height: 0;
}
#panel-corps .c-new { color: var(--c-gold); border-color: rgba(240, 180, 41, 0.35); }

/* ── Formation form ─────────────────────────────────────────────────────── */
#panel-corps .c-form {
  border: 1px solid var(--c-line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}
#panel-corps .c-form-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-teal);
  margin-bottom: 10px;
}
#panel-corps .c-form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
#panel-corps .c-form-row label { font-size: 12px; }
#panel-corps .c-form-hint { font-size: 11px; color: var(--c-muted); margin-top: 8px; }
#panel-corps .c-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
#panel-corps .c-form-submit { background: var(--c-gold); border-color: var(--c-gold); color: #1a1404; }
#panel-corps .c-form-submit:hover { filter: brightness(1.06); }

/* ── Corps list (ticker board) ──────────────────────────────────────────── */
#panel-corps .c-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
#panel-corps .c-card {
  position: relative;
  background: var(--c-panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-1);
}
#panel-corps .c-card:hover:not(.c-card-npc) {
  border-color: var(--c-teal);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}
#panel-corps .c-card:focus-visible { outline: none; box-shadow: var(--ring); }

#panel-corps .c-card-mine {
  border-color: rgba(240, 180, 41, 0.45);
  background: linear-gradient(180deg, rgba(240, 180, 41, 0.07), var(--c-panel-2) 42%);
}
#panel-corps .c-card-npc {
  cursor: default;
  opacity: 0.82;
  border-style: dashed;
  background:
    repeating-linear-gradient(135deg, rgba(139, 150, 168, 0.03) 0 6px, transparent 6px 12px),
    var(--c-panel-2);
}

#panel-corps .c-card-top { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
#panel-corps .c-mono {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 22px;
  border-radius: 10px;
  color: var(--c-teal);
  background: linear-gradient(135deg, rgba(126, 224, 163, 0.18), rgba(240, 180, 41, 0.14));
  border: 1px solid var(--c-line);
}
#panel-corps .c-card-mine .c-mono {
  color: var(--c-gold);
  border-color: rgba(240, 180, 41, 0.4);
  background: linear-gradient(135deg, rgba(240, 180, 41, 0.16), rgba(126, 224, 163, 0.10));
}
#panel-corps .c-card-npc .c-mono {
  color: var(--c-muted);
  border-color: var(--border);
  background: var(--c-panel);
}

/* Avatar letter monograms are replaced by the same SVG function glyphs the
   casual tiles carry — a brass icon for sovereign corps, teal/gold for player
   corps. The glyph inherits currentColor, so the per-card hue applies. */
#panel-corps .c-card .c-mono-glyph svg { width: 62%; height: 62%; display: block; }
#panel-corps .c-card-npc .c-mono-glyph { color: var(--brass); }
#panel-corps .c-mono-lg.c-mono-glyph svg { width: 56%; height: 56%; }

#panel-corps .c-card-name { font-size: 14px; font-weight: 650; color: var(--c-ink); line-height: 1.2; }
#panel-corps .c-card-ticker {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--c-muted);
  letter-spacing: 0.08em;
}
#panel-corps .c-seat-mark { color: var(--c-gold); font-size: 12px; margin-left: 4px; }
/* P1 bloc member chip (inert) — the anchor corp's card no longer repeats its
   own bloc name under the title, so this chip is members (partners) only: one
   compact muted "▸ bloc" line under the ticker. Never wraps
   ([[no-text-stacking]]). */
#panel-corps .c-bloc-chip {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--c-muted);
  margin-top: 1px;
}
/* Bloc anchors (incl. blocs-of-one, where the bloc name IS the corp name)
   replace that redundant text chip with a small gold syndicate mark at the
   card's top-right. .c-card-id flexes so the mark rides the far right; the
   mark top-aligns onto the corp-title line (never above the card top margin),
   so it reads as a header badge, not a float. */
#panel-corps .c-card-id { flex: 1 1 auto; min-width: 0; }
#panel-corps .c-bloc-mark {
  flex: 0 0 auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-top: 6px;
  color: var(--c-gold);
  opacity: 0.95;
}
#panel-corps .c-bloc-mark svg { width: 100%; height: 100%; display: block; }
#panel-corps .c-bloc-mark:hover { opacity: 1; }
#panel-corps .c-npc-tag {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: 1px;
}
/* NPC text tag replaced by a small brass function glyph — same mark as the
   casual tiles, so a sovereign corp reads identically everywhere. */
#panel-corps .c-npc-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border-color: rgba(212, 180, 122, 0.45);
  border-radius: 5px;
  color: var(--brass);
  vertical-align: -3px;
  background: rgba(212, 180, 122, 0.06);
}
#panel-corps .c-npc-glyph svg {
  width: 11px;
  height: 11px;
}

#panel-corps .c-card-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0 8px;
}
#panel-corps .c-card-stat { display: flex; flex-direction: column; gap: 1px; }
#panel-corps .c-card-stat span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-muted);
}
#panel-corps .c-card-stat b { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--c-ink); }

#panel-corps .c-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#panel-corps .c-type-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-teal);
  border: 1px solid var(--c-line);
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--c-teal-dim);
}
/* Dark-board scandal badge — a targeted corp whose public trust was dinged.
   Amber while trust recovers, red once it drops ≤ 50. */
#panel-corps .c-trust-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-gold);
  border: 1px solid rgba(240, 180, 41, 0.35);
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--c-gold-dim);
}
#panel-corps .c-trust-badge.low {
  color: var(--c-down);
  border-color: rgba(255, 92, 122, 0.40);
  background: rgba(255, 92, 122, 0.10);
}
#panel-corps .c-npc-note { font-size: 11px; color: var(--c-muted); font-family: var(--mono); }

/* ── Abraham Project hero (Phase D, §5.5x) ────────────────────────────────
   The arena-only Project card renders full-width above the boardroom grid —
   the one flagship tile on the corps panel. It earns a black-and-gold
   "vault" treatment (controller: "design think black and gold with shadow but
   you have free rein regardless"): obsidian body, gold ember-shadow + a thin
   gold top keyline, the ₿ tile struck as a gold coin, and a gilded wordmark.
   Still a real card, not a sovereign tile; reuses the .c-card language below
   (radius family, c-card-stats grid, c-status-pill + c-stat rows). */
#panel-corps .c-card-abraham {
  cursor: default;
  position: relative;
  border-color: rgba(240, 180, 41, 0.42);
  border-radius: 14px;
  background:
    radial-gradient(130% 130% at 100% -12%, rgba(240, 180, 41, 0.13), transparent 55%),
    radial-gradient(90% 120% at 0% 112%, rgba(240, 180, 41, 0.07), transparent 60%),
    linear-gradient(180deg, #171c25 0%, #0a0d12 82%);
  box-shadow:
    inset 0 1px 0 rgba(255, 233, 173, 0.08),
    0 18px 42px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(240, 180, 41, 0.10),
    0 4px 26px rgba(240, 180, 41, 0.13);
  margin-bottom: 14px;
}
/* Gold top keyline — inset from the corners so it never fights the radius. */
#panel-corps .c-card-abraham::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 1px;
  background: linear-gradient(90deg, rgba(240, 180, 41, 0), rgba(240, 180, 41, 0.8), rgba(240, 180, 41, 0));
  pointer-events: none;
}
/* ₿ tile → gold coin: dark glyph on a struck-gold face with a dark collar. */
#panel-corps .c-card-abraham .c-mono {
  color: #191102;
  font-size: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255, 226, 148, 0.8);
  background: radial-gradient(120% 130% at 30% 22%, #ffe294 0%, #f2b62d 52%, #9a6c14 100%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.55),
    0 0 0 3px rgba(0, 0, 0, 0.32),
    0 2px 12px rgba(240, 180, 41, 0.4);
}
/* Gilded wordmark — solid gold baseline, gradient-gold clipped to the ink only
   where background-clip:text is supported (an engine without it must still show
   the name, never an invisible transparent glyph). */
#panel-corps .c-card-abraham .c-card-name { color: #e6c96c; }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  #panel-corps .c-card-abraham .c-card-name {
    color: transparent;
    background: linear-gradient(180deg, #fff0bd 0%, #f6cf5f 55%, #c89f30 100%);
    -webkit-background-clip: text;
    background-clip: text;
  }
}
#panel-corps .c-card-abraham .c-card-ticker {
  color: #c7b180;
  letter-spacing: 0.14em;
}
#panel-corps .c-card-abraham .c-card-top { margin-bottom: 12px; }
#panel-corps .c-card-abraham .c-status-pill { margin-left: auto; }
/* Pills re-cut in the card's gold family (pass = lit gold, nominal = tarnished). */
#panel-corps .c-card-abraham .c-status-pass {
  background: rgba(240, 180, 41, 0.16);
  color: #f7cf67;
  border: 1px solid rgba(240, 180, 41, 0.5);
}
#panel-corps .c-card-abraham .c-status-expired {
  background: rgba(212, 180, 122, 0.08);
  color: #a6946c;
  border: 1px solid rgba(212, 180, 122, 0.32);
}
#panel-corps .c-card-abraham .c-card-stats {
  margin: 12px 0 10px;
  gap: 6px 14px;
}
#panel-corps .c-card-abraham .c-card-stat span { color: #96a0b4; }
#panel-corps .c-card-abraham .c-card-stat b { color: #f5e3b0; font-size: 14px; }
#panel-corps .c-abraham-book {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 18px;
  border-top: 1px solid rgba(240, 180, 41, 0.18);
  padding-top: 12px;
  margin-top: 2px;
}
#panel-corps .c-abraham-book .c-stat { display: flex; flex-direction: column; gap: 1px; }
#panel-corps .c-abraham-book .c-stat-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: #8d96ab; }
#panel-corps .c-abraham-book .c-stat-val { font-family: var(--mono); font-size: 13px; font-weight: 600; color: #ece2c4; }
#panel-corps .c-abraham-book .c-coin-row .c-stat-lbl { color: var(--c-gold); }
#panel-corps .c-open-hint { font-size: 11px; color: var(--c-muted); font-family: var(--mono); }

/* ── Detail view ────────────────────────────────────────────────────────── */
#panel-corps .c-back {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--c-muted);
  font: inherit;
  font-size: 12px;
  padding: 5px 11px;
  cursor: pointer;
}
#panel-corps .c-back:hover { color: var(--c-teal); border-color: var(--c-line); }

#panel-corps .c-detail-head {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 14px 0 16px;
}
#panel-corps .c-mono-lg { width: 64px; height: 64px; font-size: 34px; border-radius: 14px; }
#panel-corps .c-detail-id { min-width: 0; }
#panel-corps .c-detail-name { font-size: 20px; font-weight: 700; color: var(--c-ink); line-height: 1.2; }
#panel-corps .c-detail-ticker {
  font-family: var(--mono);
  color: var(--c-gold);
  font-size: 15px;
  letter-spacing: 0.08em;
  margin-left: 8px;
}
#panel-corps .c-detail-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
#panel-corps .c-seat-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-gold);
  border: 1px solid rgba(240, 180, 41, 0.4);
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--c-gold-dim);
}
#panel-corps .c-favor {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-teal);
  border: 1px solid var(--c-line);
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--c-teal-dim);
  font-family: var(--mono);
}
#panel-corps .c-favor-allied,
#panel-corps .c-favor-respected { color: var(--c-gold); border-color: rgba(240, 180, 41, 0.4); background: var(--c-gold-dim); }

/* ── Stat blocks ────────────────────────────────────────────────────────── */
#panel-corps .c-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
#panel-corps .c-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--c-panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
#panel-corps .c-stat-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-muted);
}
#panel-corps .c-stat-val { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--c-ink); }
#panel-corps .c-stat-treasury {
  border-color: rgba(240, 180, 41, 0.45);
  background: linear-gradient(135deg, rgba(240, 180, 41, 0.16), rgba(240, 180, 41, 0.05));
}
#panel-corps .c-stat-treasury .c-stat-val { color: var(--c-gold); font-size: 24px; }

/* Phase B corps-lender line — a teal-tinted stat card on desktop. The value is
   a compound sentence ("X of Y lent · $Z fees"), so it gets a smaller mono than
   the bare numbers; the 560px block below stretches it to a fullwidth bar. */
#panel-corps .c-stat-lending { border-color: rgba(126, 224, 163, 0.3); }
#panel-corps .c-stat-lending .c-stat-val { font-size: 15px; line-height: 1.45; color: var(--c-teal); }

#panel-corps .c-detail-notes {
  font-size: 12px;
  color: var(--c-muted);
  font-family: var(--mono);
  margin: -8px 0 14px;
}
#panel-corps .c-detail-actions {
  display: flex;
  gap: 8px;
  margin: 2px 0 14px;
}

/* ── Sections ───────────────────────────────────────────────────────────── */
#panel-corps .c-section { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 18px; }
#panel-corps .c-section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-gold);
  margin: 0 0 12px;
}

/* Share distribution */
#panel-corps .c-dist-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--c-panel-2);
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
#panel-corps .c-seg { height: 100%; flex: 0 0 auto; min-width: 2px; transition: filter 0.15s ease; }
#panel-corps .c-seg:hover { filter: brightness(1.25); }
#panel-corps .c-dist-empty { padding: 8px; color: var(--c-muted); font-size: 12px; }
#panel-corps .c-dist-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--c-muted);
}
#panel-corps .c-legend-item { display: inline-flex; align-items: center; gap: 5px; }
#panel-corps .c-legend-item i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
#panel-corps .c-legend-item b { color: var(--c-ink); font-family: var(--mono); font-weight: 600; }

#panel-corps .c-share-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#panel-corps .c-share-table th {
  text-align: left;
  color: var(--c-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}
#panel-corps .c-share-table th,
#panel-corps .c-share-table td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--border); }
#panel-corps .c-share-table td.num, #panel-corps .c-share-table th.num { text-align: right; }
#panel-corps .c-share-table td { font-family: var(--mono); }
#panel-corps .c-td-name { font-family: var(--sans); color: var(--c-ink); }
#panel-corps tr.me { background: rgba(126, 224, 163, 0.07); }
#panel-corps .c-you { color: var(--c-gold); font-size: 11px; font-family: var(--mono); }

/* ── Governance ─────────────────────────────────────────────────────────── */
#panel-corps .c-res-form {
  border: 1px solid var(--c-line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}
#panel-corps .c-res-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-teal);
  margin-bottom: 8px;
}
#panel-corps .c-res-form textarea {
  width: 100%;
  background: var(--c-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--c-ink);
  padding: 9px 10px;
  font: inherit;
  font-family: var(--c-serif);
  font-size: 14px;
  resize: vertical;
  min-height: 46px;
}
#panel-corps .c-res-form textarea:focus { outline: none; border-color: var(--c-teal); box-shadow: var(--ring); }
#panel-corps .c-res-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
#panel-corps .c-res-hint { font-size: 11px; color: var(--c-gold); }
#panel-corps .c-res-submit { background: var(--c-gold); border-color: var(--c-gold); color: #1a1404; }
#panel-corps .c-res-submit:hover { filter: brightness(1.06); }

#panel-corps .c-gov-block { margin-top: 4px; }
#panel-corps .c-gov-lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-muted);
  margin: 16px 0 8px;
}

/* Motion cards — like signed documents */
#panel-corps .c-motion {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px 14px 18px;
  margin-bottom: 12px;
}
#panel-corps .c-motion-rule {
  position: absolute;
  top: 0;
  left: 12px;
  right: 12px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, var(--c-teal), var(--c-gold));
}
#panel-corps .c-motion-num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--c-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
#panel-corps .c-motion-body {
  font-family: var(--c-serif);
  font-size: 15px;
  color: var(--c-ink);
  line-height: 1.5;
  margin-bottom: 10px;
}
#panel-corps .c-motion-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 12px;
  color: var(--c-muted);
  font-family: var(--mono);
}
#panel-corps .c-motion-meta b { color: var(--c-ink); font-family: var(--sans); }
#panel-corps .c-motion-expiry { color: var(--c-gold); }
#panel-corps .c-weight {
  display: block;
  font-size: 11px;
  color: var(--c-teal);
  font-family: var(--mono);
  margin: 8px 0 4px;
}
#panel-corps .c-motion-voted { font-size: 12px; color: var(--c-gold); font-style: italic; margin-top: 6px; }

#panel-corps .c-vote-ctl { display: flex; gap: 10px; margin-top: 10px; }
#panel-corps .c-vote {
  flex: 1;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.06s ease, background-color 0.15s ease, color 0.15s ease, filter 0.15s ease;
}
#panel-corps .c-vote:disabled { opacity: 0.4; cursor: not-allowed; }
#panel-corps .c-vote-for { background: rgba(126, 224, 163, 0.12); border-color: rgba(126, 224, 163, 0.5); color: var(--c-teal); }
#panel-corps .c-vote-for:hover:not(:disabled) { background: var(--c-teal); color: #06241a; }
#panel-corps .c-vote-against { background: rgba(255, 92, 122, 0.12); border-color: rgba(255, 92, 122, 0.5); color: var(--c-down); }
#panel-corps .c-vote-against:hover:not(:disabled) { background: var(--c-down); color: #fff; }
#panel-corps .c-vote-locked {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  font-size: 12px;
  color: var(--c-muted);
  border: 1px dashed var(--border);
  border-radius: 999px;
  padding: 8px;
}
#panel-corps .c-lock-chip {
  display: inline-block;
  padding: 1px 4px;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--c-muted);
  font-family: var(--mono);
}

/* Decided-vote history */
#panel-corps .c-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
#panel-corps .c-hist-motion {
  font-family: var(--c-serif);
  color: var(--c-ink);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#panel-corps .c-hist-meta { font-family: var(--mono); font-size: 12px; color: var(--c-muted); flex: 0 0 auto; }
#panel-corps .c-status-pill {
  flex: 0 0 auto;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
  padding: 2px 8px;
}
#panel-corps .c-status-pass { background: rgba(126, 224, 163, 0.14); color: var(--c-teal); border: 1px solid rgba(126, 224, 163, 0.4); }
#panel-corps .c-status-fail { background: rgba(255, 92, 122, 0.14); color: var(--c-down); border: 1px solid rgba(255, 92, 122, 0.4); }
#panel-corps .c-status-expired { background: rgba(139, 150, 168, 0.14); color: var(--c-muted); border: 1px solid rgba(139, 150, 168, 0.4); }

/* ── States ──────────────────────────────────────────────────────────────── */
#panel-corps .c-loading {
  color: var(--c-muted);
  font-family: var(--mono);
  font-size: 13px;
  padding: 20px 0;
}
#panel-corps .c-empty { color: var(--c-muted); font-size: 13px; padding: 14px 0; }
#panel-corps.c-busy { opacity: 0.9; }
#panel-corps.c-busy .c-card { cursor: wait; }

@media (max-width: 560px) {
  #panel-corps .c-form-row { grid-template-columns: 1fr; }
  #panel-corps .c-detail-name { font-size: 17px; }
  #panel-corps .c-mono-lg { width: 52px; height: 52px; font-size: 28px; }
  /* Lending becomes a fullwidth bar spanning the whole stat row — label on the
     left, the "X of Y lent · $Z fees" value right-aligned. It wraps (not
     overflows) on the narrowest phones via the .c-stat-val overflow-wrap guard. */
  #panel-corps .c-stat-lending {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 10px 12px;
  }
  #panel-corps .c-stat-lending .c-stat-val { font-size: 13px; text-align: right; }
}

/* ── Casual "Trading Groups" widget — corps collapse to a compact grid of
   monogram icon tiles in the 300px right rail under the order ticket
   (styles.css §11.1 casual grid). Hovering a tile reveals treasury/AUM/holders
   + type in a small popover; player corps still open their room on click
   (the drill-in detail is capped + scrollable so it can't blow the layout).
   No long card list, no rail-height filler. Immersive renders the full card
   list via corps.js and is untouched here (all rules casual-scoped). */
body[data-ui-mode="casual"] #panel-corps { padding: 14px; }
body[data-ui-mode="casual"] #panel-corps .c-head { margin-bottom: 12px; }
body[data-ui-mode="casual"] #panel-corps .c-head-actions { gap: 6px; }
body[data-ui-mode="casual"] #panel-corps .c-seat { max-width: 100%; }

/* Icon grid — "1×2" strips: desktop rows of two wide ledger-strip tiles, each
   a bounded brass rectangle with the glyph centered above the ticker. Phones
   drop back to a 5-square-chip strip (square monogram chips, no tile box). */
body[data-ui-mode="casual"] #panel-corps .c-icons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  justify-content: center;
  max-width: 100%;
  min-width: 0;
}
/* Strip tile — the whole tile is the bounded brass rectangle (glyph zone +
   ticker line inside it), so a row of two reads as a pair of ledgers. */
body[data-ui-mode="casual"] #panel-corps .c-icon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  cursor: pointer;
  padding: 9px 8px 8px;
  border: 1px solid rgba(240, 180, 41, 0.4);
  border-radius: 12px;
  background: var(--panel-2);
  transition: border-color 0.12s ease, transform 0.12s ease;
}
body[data-ui-mode="casual"] #panel-corps .c-icon:hover,
body[data-ui-mode="casual"] #panel-corps .c-icon:focus-visible {
  border-color: var(--c-gold);
  transform: translateY(-1px);
}
/* NPC tiles are clickable like every other tile — the detail room opens for
   sovereign entities too (removed the read-only cursor override). */
body[data-ui-mode="casual"] #panel-corps .c-icon.c-icon-npc { cursor: pointer; }
/* The glyph zone — a short full-width strip (not a square) inside the tile. */
body[data-ui-mode="casual"] #panel-corps .c-icon-mono {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  height: 30px;
  color: var(--text);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
}
body[data-ui-mode="casual"] #panel-corps .c-icon.c-icon-npc .c-icon-mono {
  color: var(--brass);
}
body[data-ui-mode="casual"] #panel-corps .c-icon.c-icon-mine {
  border-color: var(--c-gold);
}
body[data-ui-mode="casual"] #panel-corps .c-icon.c-icon-mine .c-icon-mono {
  color: var(--c-gold);
}
/* The tile title (ticker) sits centered under the icon so every tile in a
   row shares a straight title line. The flex + fixed height center the glyph
   in a stable box (no ascender/descender asymmetry), so the title's visual
   center rides the same axis as the icon's — "aligned to the center". */
body[data-ui-mode="casual"] #panel-corps .c-icon-title {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 11px;
  max-width: 100%;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body[data-ui-mode="casual"] #panel-corps .c-icon.c-icon-npc .c-icon-title { color: var(--brass); }
body[data-ui-mode="casual"] #panel-corps .c-icon.c-icon-mine .c-icon-title { color: var(--c-gold); }
/* NPC funds draw a brass function glyph; player corps draw a gold glyph from
   PLAYER_GLYPHS — both are SVG icons, so every chip centers its artwork the
   same way (no text-letter baseline to sit high in the box). */
body[data-ui-mode="casual"] #panel-corps .c-icon-mono-glyph svg {
  width: 26px;
  height: 26px;
}
body[data-ui-mode="casual"] #panel-corps .c-icon:not(.c-icon-npc) .c-icon-mono-glyph {
  color: var(--c-gold);
}
/* Desktop Casual — one-line ticker strips (controller: "one line strips per
   corp", no scroll). Each corp is a full-width row: glyph · name · ticker ·
   treasury · holders, all on one line; long content ellipsizes (min-width:0)
   so the rail never scrolls sideways. */
body[data-ui-mode="casual"] #panel-corps .c-strips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
body[data-ui-mode="casual"] #panel-corps .c-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
body[data-ui-mode="casual"] #panel-corps .c-strip:hover,
body[data-ui-mode="casual"] #panel-corps .c-strip:focus-visible {
  border-color: var(--c-gold);
  background: rgba(240, 180, 41, 0.06);
}
body[data-ui-mode="casual"] #panel-corps .c-strip-mono {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--muted);
}
body[data-ui-mode="casual"] #panel-corps .c-strip.c-strip-npc .c-strip-mono { color: var(--brass); }
body[data-ui-mode="casual"] #panel-corps .c-strip.c-strip-mine .c-strip-mono { color: var(--c-gold); }
body[data-ui-mode="casual"] #panel-corps .c-strip-name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
body[data-ui-mode="casual"] #panel-corps .c-strip-ticker {
  flex: 0 0 auto;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
body[data-ui-mode="casual"] #panel-corps .c-strip.c-strip-mine .c-strip-ticker { color: var(--c-gold); }
body[data-ui-mode="casual"] #panel-corps .c-strip-meta {
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  gap: 10px;
  color: var(--muted);
  white-space: nowrap;
}
/* Phones — square monogram chips in a 5-across strip, no tile box (the glyph
   square carries the rim). */
@media (max-width: 640px) {
  /* Phones: a centered 3×3 grid — three across, justify-center so the strip
     never eats the side margins. Bigger tap targets than the old 5-across
     chip strip, fewer rows. */
  body[data-ui-mode="casual"] #panel-corps .c-icons {
    grid-template-columns: repeat(3, minmax(48px, 62px));
    gap: 10px;
    justify-content: center;
  }
  body[data-ui-mode="casual"] #panel-corps .c-icon {
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
  }
  body[data-ui-mode="casual"] #panel-corps .c-icon-mono {
    height: auto;
    aspect-ratio: 1;
    border-radius: 10px;
    background: var(--panel-2);
    border: 1px solid rgba(240, 180, 41, 0.4);
    transition: border-color 0.12s ease;
  }
  /* No hover lift on phones — hover is meaningless on a touch surface. The
     border brighten stays. */
  body[data-ui-mode="casual"] #panel-corps .c-icon.c-icon-npc .c-icon-mono {
    background: rgba(212, 180, 122, 0.06);
    border-color: rgba(240, 180, 41, 0.5);
  }
  body[data-ui-mode="casual"] #panel-corps .c-icon.c-icon-mine .c-icon-mono {
    border-color: var(--c-gold);
  }
  body[data-ui-mode="casual"] #panel-corps .c-icon-mono-glyph svg {
    width: 70%;
    height: 70%;
  }
  /* Hover popovers overflow the phone viewport — kill them entirely. */
  body[data-ui-mode="casual"] #panel-corps .c-icon-tip { display: none !important; }
}
body[data-ui-mode="casual"] #panel-corps .c-icon-seat {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c-gold);
  color: #0d0e13;
  font-size: 7px;
  line-height: 12px;
  text-align: center;
}

/* Hover popover — full detail for the hovered corp, above the tile. */
body[data-ui-mode="casual"] #panel-corps .c-icon-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: 200px;
  padding: 9px 11px;
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  text-align: left;
}
body[data-ui-mode="casual"] #panel-corps .c-icon:hover .c-icon-tip,
body[data-ui-mode="casual"] #panel-corps .c-icon:focus-within .c-icon-tip { display: block; }
body[data-ui-mode="casual"] #panel-corps .c-icon-tip-name {
  display: block;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--c-ink);
}
body[data-ui-mode="casual"] #panel-corps .c-icon-tip-ticker {
  display: inline-block;
  margin-top: 2px;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  text-transform: uppercase;
}
body[data-ui-mode="casual"] #panel-corps .c-icon-tip-stats {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--c-line);
  font-size: 9.5px;
  color: var(--c-muted);
}
body[data-ui-mode="casual"] #panel-corps .c-icon-tip-stats span { display: flex; flex-direction: column; gap: 2px; }
body[data-ui-mode="casual"] #panel-corps .c-icon-tip-stats b { color: var(--c-ink); font-size: 11px; }
body[data-ui-mode="casual"] #panel-corps .c-icon-tip-foot {
  display: block;
  margin-top: 8px;
  font-size: 9.5px;
  color: var(--c-gold);
}

/* Drill-in detail stays capped + scrollable inside the rail so opening a
   room from a tile can never grow the layout height. */
body[data-ui-mode="casual"] #panel-corps .c-body.c-detail {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* ── Text overflow guards: no section may overflow horizontally ──────────── */
#panel-corps .c-card-name, #panel-corps .c-card-ticker, #panel-corps .c-card-stat,
#panel-corps .c-detail-name, #panel-corps .c-detail-ticker, #panel-corps .c-detail-notes,
#panel-corps .c-npc-note, #panel-corps .c-open-hint, #panel-corps .c-type-badge,
#panel-corps .c-stat-lbl, #panel-corps .c-stat-val,
#panel-corps .c-dist-empty, #panel-corps .c-dist-legend, #panel-corps .c-legend-item,
#panel-corps .c-td-name, #panel-corps .c-section-title, #panel-corps .c-gov-lbl,
#panel-corps .c-motion-body, #panel-corps .c-motion-num, #panel-corps .c-motion-meta,
#panel-corps .c-motion-expiry, #panel-corps .c-weight, #panel-corps .c-motion-voted,
#panel-corps .c-hist-motion, #panel-corps .c-hist-meta, #panel-corps .c-status-pill,
#panel-corps .c-favor, #panel-corps .c-seat, #panel-corps .c-seat-badge,
#panel-corps .c-form-title, #panel-corps .c-res-title, #panel-corps .c-form-hint,
#panel-corps .c-res-hint, #panel-corps .c-empty, #panel-corps .c-loading {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Phones: the Trading Groups header buttons (refresh / new corp) shrink to
   compact touch targets so the panel head doesn't crowd the strip below. */
@media (max-width: 640px) {
  #panel-corps .c-head-actions .btn {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 7px;
    line-height: 1.2;
  }
  /* Corps events strip: cap at ~5 rows on phones — past that the list
     scrolls internally instead of growing the panel. */
  #panel-corps .c-life-rows {
    max-height: 150px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* Market history strip — corps lifecycle feed (018): who formed, who got
   absorbed, who went under. Dead corps leave the board, so this is where the
   roster tells its story. */
#panel-corps .c-life {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  min-width: 0;
}
#panel-corps .c-life-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
#panel-corps .c-life-head > span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}
#panel-corps .c-life-refresh {
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1.4;
  min-height: 0;
}
#panel-corps .c-life-rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
#panel-corps .c-life-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
  min-width: 0;
}
#panel-corps .c-life-row:last-child { border-bottom: none; }
#panel-corps .c-life-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
}
#panel-corps .c-life-formed   { background: rgba(126, 224, 163, 0.16); color: #7ee0a3; }
#panel-corps .c-life-split    { background: rgba(140, 120, 220, 0.16); color: #a99ae0; }
#panel-corps .c-life-merge    { background: rgba(58, 168, 224, 0.16);  color: #6ec0ea; }
#panel-corps .c-life-blowup   { background: rgba(240, 166, 35, 0.16);  color: #f0b429; }
#panel-corps .c-life-bankrupt { background: rgba(230, 90, 90, 0.16);   color: #ee8a8a; }
#panel-corps .c-life-takeover { background: rgba(230, 195, 122, 0.16); color: #e6c37a; }
#panel-corps .c-life-scandal  { background: rgba(207, 120, 200, 0.16); color: #d58ac8; }
#panel-corps .c-life-exodus   { background: rgba(120, 140, 180, 0.16); color: #90a0c0; }
#panel-corps .c-life-seed     { background: rgba(90, 210, 200, 0.16);  color: #7adfd4; }
#panel-corps .c-life-misc     { background: var(--panel-2);            color: var(--muted); }
#panel-corps .c-life-ticker {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--text);
  white-space: nowrap;
}
#panel-corps .c-life-text {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
#panel-corps .c-life-text b { color: var(--text); font-weight: 600; }
#panel-corps .c-life-time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
#panel-corps .c-life-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 6px 0;
}

