/* Layout: a fixed top bar, then a two-pane workspace: detail panel on the left, network canvas on the right; stacks on phones. */
:root {
  --bg: #f6f5f1; --panel: #ffffff; --fg: #1d2129; --muted: #6a7080; --line: #dcdad2;
  --accent: #0f6e6a; --accent-ink: #ffffff; --accent-soft: #e2f0ee;
  --warn: #b7791f; --warn-soft: #fbf0d9; --bad: #b3261e; --bad-soft: #f9e1df; --good: #2f7d4f;
  --node-company: #0f6e6a; --node-person: #c86f2a; --node-root: #1d2129; --edge: #9aa0ad;
  --node-sole: #7b5fd1; --node-dissolved: #d93a32; --node-stopped: #c9a227;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #15171c; --panel: #1d2026; --fg: #e8e8e3; --muted: #9aa0ad; --line: #30343c;
  --accent: #46b8b0; --accent-ink: #0d1b1a; --accent-soft: #1b312f;
  --warn: #e0a84a; --warn-soft: #3a2d14; --bad: #ef7b73; --bad-soft: #3d1f1d; --good: #6cc48f;
  --node-company: #46b8b0; --node-person: #e8955a; --node-root: #e8e8e3; --edge: #5b6170;
  --node-sole: #a68cf2; --node-dissolved: #f0645c; --node-stopped: #e3c14a; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #15171c; --panel: #1d2026; --fg: #e8e8e3; --muted: #9aa0ad; --line: #30343c;
  --accent: #46b8b0; --accent-ink: #0d1b1a; --accent-soft: #1b312f;
  --warn: #e0a84a; --warn-soft: #3a2d14; --bad: #ef7b73; --bad-soft: #3d1f1d; --good: #6cc48f;
  --node-company: #46b8b0; --node-person: #e8955a; --node-root: #e8e8e3; --edge: #5b6170;
  --node-sole: #a68cf2; --node-dissolved: #f0645c; --node-stopped: #e3c14a; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font-body); display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 6px 12px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; min-width: 0; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

header.top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.brand { font-weight: 700; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search { flex: 1 1 260px; display: flex; gap: 6px; position: relative; }
.search input { flex: 1; }
.suggest { position: absolute; top: 100%; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; margin-top: 4px;
  max-height: 60vh; overflow: auto; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 20; }
.suggest .row { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; cursor: pointer; border-top: 1px solid var(--line); }
.suggest .row:first-child { border-top: 0; }
.suggest .row:hover, .suggest .row.active { background: var(--accent-soft); }
.suggest .head { padding: 6px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: var(--bg); }
.userbox { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

main.work { flex: 1; display: grid; grid-template-columns: minmax(320px, 440px) 1fr; min-height: 0; }
.panel { overflow: auto; border-right: 1px solid var(--line); background: var(--panel); padding-block: 18px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: 16px; min-width: 0; }
.canvas { position: relative; min-height: 360px; min-width: 0; }
.canvas #graph { position: absolute; inset: 0; }
.canvas .controls { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.canvas .legend { position: absolute; bottom: max(10px, env(safe-area-inset-bottom, 0px)); left: 10px; display: flex; flex-direction: column; gap: 5px;
  font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; max-height: calc(100% - 80px); overflow: auto; }
.legend span { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; flex: none; }
.legend i.c { width: 10px; height: 10px; border-radius: 50%; }
.canvas .empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 20px; }
.canvas .tip { position: absolute; pointer-events: none; background: var(--fg); color: var(--bg); padding: 6px 9px; border-radius: 6px; font-size: 12px; max-width: 260px; }
@media (max-width: 820px) { main.work { grid-template-columns: 1fr; grid-template-rows: auto 1fr; } .panel { border-right: 0; border-bottom: 1px solid var(--line); max-height: 55vh; padding-right: max(16px, env(safe-area-inset-right, 0px)); } .canvas { min-height: 45vh; } }

h1 { font-size: 20px; margin: 0 0 4px; text-wrap: balance; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 8px; }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); text-transform: capitalize; }
.pill.active { color: var(--good); border-color: var(--good); }
.pill.dissolved, .pill.insolvency { color: var(--bad); border-color: var(--bad); }
.pill.suspended { color: var(--warn); border-color: var(--warn); }
dl.facts { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; margin: 10px 0 0; }
dl.facts dt { color: var(--muted); } dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
ul.links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
ul.links li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); }
ul.links li .who { flex: 1; min-width: 0; }
ul.links li .what { font-size: 12px; color: var(--muted); white-space: nowrap; }
ul.links li.ended { opacity: .6; }
.type-tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; color: #fff; white-space: nowrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin-top: 12px; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.tile b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12px; color: var(--muted); }
.box { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-top: 12px; }
.box.warn { border-color: var(--warn); background: var(--warn-soft); }
.box.err { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
form.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
form.grid .full { grid-column: 1 / -1; }
form.grid label .search { flex: none; }
form.grid label .search input { color: var(--fg); }
form.grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chips a { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.crumb { font-size: 12px; margin-bottom: 10px; }
.pathline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.pathline .arrow { color: var(--muted); }
.toast { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 50; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: rise .2s ease-out; } @keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } } }

.table-wrap { overflow-x: auto; }
table.fin { border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
table.fin th, table.fin td { padding: 3px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.fin tbody th { text-align: left; color: var(--muted); font-weight: normal; }
ul.caen { list-style: none; padding: 0; margin: 6px 0; font-size: 12px; columns: 2 280px; }
ul.caen li { break-inside: avoid; padding: 1px 0; }
.suggest .sub { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
