/* TradeTruth styles. No external fonts or scripts (strict CSP). */
:root {
  --ink: #16233b;
  --ink-2: #3c4a63;
  --muted: #646d7d;
  --paper: #f6f2ea;
  --card: #fffdf8;
  --line: #e2d9c8;
  --accent: #f2b33d;
  --accent-ink: #8a5600;
  --focus: #1f5fd1;
  --owned: #9a4f06; --owned-bg: #fcefd7;
  --linked: #73358a; --linked-bg: #f3e7f8;
  --verified: #1d7146; --verified-bg: #e2f2e8;
  --independent: #245f7c; --independent-bg: #e2eef5;
  --unchecked: #555d6b; --unchecked-bg: #eaecf0;
  --radius: 12px;
  --serif: "Iowan Old Style", "Charter", "Palatino Linotype", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef1f6; --ink-2: #c7cedb; --muted: #9aa3b3;
    --paper: #10161f; --card: #18202c; --line: #2a3443;
    --accent-ink: #f2b33d; --focus: #7fb0ff;
    --owned: #f5b766; --owned-bg: #3a2a12;
    --linked: #d9a6ec; --linked-bg: #33213b;
    --verified: #7fd6a4; --verified-bg: #16352a;
    --independent: #8cc6e6; --independent-bg: #16303d;
    --unchecked: #b6bdc9; --unchecked-bg: #262e3a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.55 var(--sans); }
a { color: inherit; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-family: var(--serif); font-size: clamp(1.9rem, 4.5vw, 2.9rem); letter-spacing: -.01em; }
h2 { font-family: var(--serif); font-size: 1.45rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.sr, .skip:not(:focus) { 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; z-index: 10; background: var(--card); padding: 8px 12px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.hp { position: absolute; left: -9999px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Header */
.top { background: #16233b; color: #fffaf0; padding-top: env(safe-area-inset-top); }
.top-in { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.25rem; letter-spacing: -.01em; }
.brand b { color: #f2b33d; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { text-decoration: none; padding: 10px 12px; border-radius: 8px; color: #dfe5ef; font-size: .95rem; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.menu { display: none; margin-left: auto; position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 10px 14px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; min-height: 44px; }
.menu summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-width: 230px; z-index: 5; box-shadow: 0 12px 30px rgba(0,0,0,.18); }
.menu-panel a { display: block; padding: 12px; text-decoration: none; border-radius: 8px; }
.menu-panel a:hover { background: var(--paper); }
@media (max-width: 860px) { .nav { display: none; } .menu { display: block; } }

.adminbar { background: var(--card); border-bottom: 1px solid var(--line); }
.adminbar .wrap { display: flex; gap: 16px; align-items: center; min-height: 48px; flex-wrap: wrap; }
.adminbar form { margin-left: auto; }
.linkish { background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; min-height: 44px; }

main.wrap { padding-top: 28px; padding-bottom: 48px; }
section { margin-bottom: 36px; }
.flash { background: var(--verified-bg); color: var(--verified); padding: 12px 16px; border-radius: 10px; }
.alert { background: var(--owned-bg); color: var(--owned); padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }
.alert ul { margin: 0; padding-left: 20px; }

/* Hero and search */
.hero { padding: 28px 0 8px; max-width: 760px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 600; color: var(--accent-ink); margin-bottom: .6em; }
.lede { font-size: 1.12rem; color: var(--ink-2); max-width: 680px; }
.search { display: flex; gap: 8px; margin: 18px 0 14px; max-width: 640px; }
.search input { flex: 1; min-width: 0; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 48px; width: 100%; }
textarea { min-height: 0; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
button, .btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 10px 20px; border-radius: 10px; border: 1.5px solid var(--ink); background: var(--ink); color: var(--paper); text-decoration: none; cursor: pointer; white-space: nowrap; }
.search button { background: var(--accent); border-color: var(--accent); color: #16233b; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: .92rem; }
@media (max-width: 520px) { .search { flex-direction: column; } }

.trade-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); text-decoration: none; font-weight: 500; }
.pill:hover { border-color: var(--ink); }
.pill.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-family: var(--serif); font-size: 2rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .92rem; }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* Cards */
.sec-head { margin-bottom: 14px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.grid .card { margin-bottom: 0; }
.card.flat { background: transparent; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.brand-card .owner, .brand-card .trades, .note { font-size: .93rem; color: var(--ink-2); margin: .6em 0 0; }
.brand-card .trades { color: var(--muted); }
.note { color: var(--accent-ink); }
.owner-card .kind, .node-kind { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; margin: 0 0 4px; }
.owner-card .count { font-weight: 600; color: var(--owned); }
ul.plain { list-style: none; padding: 0; margin: 0; }
.owner-card li, .list-links li { padding: 6px 0; border-top: 1px solid var(--line); }
.links li { padding: 8px 0; }
.links p { margin: 4px 0 0; color: var(--ink-2); font-size: .95rem; }
.empty { text-align: left; padding: 28px; }
.cta-in { display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cta-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.group { margin-bottom: 22px; }
.group-head { font-size: 1.1rem; }

/* Badges: color shown as a solid rounded-square marker */
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 8px; font-size: .85rem; font-weight: 600; }
.chip .mark { width: 11px; height: 11px; border-radius: 3px; background: currentColor; flex: none; }
.chip-owned { color: var(--owned); background: var(--owned-bg); }
.chip-linked { color: var(--linked); background: var(--linked-bg); }
.chip-verified_independent { color: var(--verified); background: var(--verified-bg); }
.chip-independent { color: var(--independent); background: var(--independent-bg); }
.chip-unchecked { color: var(--unchecked); background: var(--unchecked-bg); }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--unchecked-bg); color: var(--unchecked); text-transform: uppercase; letter-spacing: .04em; }
.tag-confirmed { background: var(--verified-bg); color: var(--verified); }
.tag-reported { background: var(--owned-bg); color: var(--owned); }
.tag-correction { background: var(--linked-bg); color: var(--linked); }
.tag-apply { background: var(--verified-bg); color: var(--verified); }

/* Company page */
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 14px; }
.company-head { max-width: 780px; }
.company-head .chip { font-size: .95rem; padding: 7px 12px; }
.explain-line { color: var(--muted); margin-top: 10px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.chain { list-style: none; padding: 0; margin: 0; }
.node { position: relative; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 22px; display: flex; flex-direction: column; }
.node:not(:last-child)::after { content: ""; position: absolute; left: 24px; bottom: -23px; height: 22px; border-left: 2px dashed var(--muted); }
.node a, .node > span:not(.node-kind):not(.node-date) { font-weight: 600; }
.node-this { background: var(--owned-bg); border-color: transparent; }
.node-date { font-size: .85rem; color: var(--muted); }
.facts dl { margin: 0; }
.facts dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-top: 12px; }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.sub { margin-top: 18px; }
.sources { list-style: none; padding: 0; margin: 0; }
.sources li { padding: 12px 0; border-top: 1px solid var(--line); }
.sources li:first-child { border-top: 0; padding-top: 0; }
.sources p { margin: 6px 0 0; }
.src-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .88rem; }
.src-head .kind, .src-head .about { color: var(--muted); }
.src-meta { font-size: .88rem; color: var(--muted); }

/* Prose */
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.4em; }
.badge-key dt { margin-top: 14px; }
.badge-key dd { margin: 6px 0 0; color: var(--ink-2); }

/* Forms */
.form { display: grid; gap: 16px; max-width: 720px; }
.form.narrow { max-width: 420px; }
.form label { display: grid; gap: 6px; font-weight: 600; }
.form .opt { font-weight: 400; color: var(--muted); font-size: .88rem; }
.form fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; gap: 6px 18px; flex-wrap: wrap; }
.form legend { font-weight: 600; padding: 0 4px; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; min-height: 44px; }
label.check input { width: 22px; height: 22px; min-height: 0; flex: none; }
.attest { align-items: flex-start; }
.attest input { margin-top: 3px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 620px) { .row2 { grid-template-columns: 1fr; } }
.form .btn, .form button { justify-self: start; }

/* Admin */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.table th { border-top: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
@media (max-width: 620px) { .table th:nth-child(3), .table td:nth-child(3) { display: none; } }
.sub-head { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 10px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 6px; } }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.inline-actions span { flex: 1; min-width: 200px; }
.src-admin { display: flex; gap: 12px; align-items: flex-start; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.src-admin .sources { flex: 1; }
.danger h2 { color: var(--owned); }
.danger form { display: grid; gap: 10px; justify-items: start; }

/* Footer */
.foot { border-top: 1px solid var(--line); padding: 28px 0 calc(28px + env(safe-area-inset-bottom)); font-size: .93rem; color: var(--ink-2); }
.foot p { margin: 0 0 .5em; }
