:root {
  color-scheme: dark;
  --bg: #191410;
  --surface: #211a14;
  --surface-raised: #2a2119;
  --surface-soft: #30251b;
  --text: #f7ede0;
  --dim: #ad9a84;
  --muted: #796a5b;
  --line: rgba(247, 237, 224, .11);
  --accent: #f2a65a;
  --accent-deep: #c9701e;
  --green: #7fd8a6;
  --red: #e0763f;
  --blue: #8ec5d6;
  --shadow: 0 24px 70px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(90% 48% at 8% -8%, rgba(242, 166, 90, .13), transparent 68%),
    radial-gradient(70% 45% at 100% 28%, rgba(116, 73, 39, .12), transparent 70%),
    var(--bg);
  font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.hidden { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.5rem;
  padding: calc(.8rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right)) .8rem calc(1rem + env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: .025em;
  text-decoration: none;
}

.mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: .68rem;
  background: linear-gradient(155deg, var(--accent), var(--accent-deep));
  box-shadow: 0 8px 24px rgba(201, 112, 30, .18);
}

.mark span {
  display: block;
  width: .72rem;
  height: .72rem;
  border: .18rem solid #2a1708;
  border-radius: 50%;
}

.net {
  display: flex;
  align-items: center;
  max-width: 13rem;
  margin: 0;
  color: var(--dim);
  font-size: .69rem;
  line-height: 1.15;
  text-align: right;
}

.net .dot {
  flex: 0 0 auto;
  width: .5rem;
  height: .5rem;
  margin-right: .42rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 .2rem rgba(127, 216, 166, .08);
}

.net.off .dot { background: var(--red); box-shadow: 0 0 0 .2rem rgba(224, 118, 63, .08); }

main {
  width: min(100%, 44rem);
  min-height: calc(100dvh - 8rem);
  margin: 0 auto;
  padding: 2.25rem calc(1.1rem + env(safe-area-inset-right)) 2rem calc(1.1rem + env(safe-area-inset-left));
}

.hero { max-width: 34rem; margin: 7vh auto 0; }
.hero h1, .organization-heading h1 { margin: 0; font-size: clamp(2rem, 9vw, 3.15rem); line-height: 1.04; letter-spacing: -.035em; }
.lede { margin: 1rem 0 1.7rem; color: var(--dim); font-size: 1.03rem; line-height: 1.62; }
.eyebrow, .card-kicker { margin: 0 0 .55rem; color: var(--accent); font-size: .7rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow.danger { color: var(--red); }

.pulse {
  width: 2.1rem;
  height: 2.1rem;
  margin-top: 2rem;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.gate-note, .verification-card {
  display: flex;
  gap: .9rem;
  align-items: flex-start;
  margin: 1.4rem 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, .025);
}

.gate-note strong, .verification-card strong { display: block; margin-bottom: .2rem; font-size: .9rem; }
.gate-note p { margin: 0; color: var(--dim); font-size: .82rem; line-height: 1.45; }
.gate-icon, .status-glyph { color: var(--accent); font-size: 1.35rem; line-height: 1; }
.verification-card code { color: var(--dim); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .72rem; }

.primary, .secondary {
  width: 100%;
  min-height: 3.25rem;
  padding: .85rem 1rem;
  border-radius: .9rem;
  font-weight: 720;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.primary { border: 1px solid transparent; color: #2b1707; background: linear-gradient(155deg, #f5b36f, var(--accent)); box-shadow: 0 12px 30px rgba(201, 112, 30, .14); }
.secondary { border: 1px solid rgba(242, 166, 90, .34); color: var(--text); background: rgba(242, 166, 90, .08); }
.primary:active, .secondary:active { transform: translateY(1px); }
.primary:focus-visible, .secondary:focus-visible, .tab:focus-visible, input:focus-visible { outline: 3px solid rgba(142, 197, 214, .55); outline-offset: 2px; }
.primary[disabled], .secondary[disabled] { cursor: wait; opacity: .55; }

.fineprint, .risk-line { margin: .9rem 0; color: var(--muted); font-size: .72rem; text-align: center; }

.seat { padding-bottom: 2rem; }
.organization-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.organization-heading h1 { overflow-wrap: anywhere; font-size: clamp(2rem, 8vw, 2.8rem); }
.seat-badge { flex: 0 0 auto; margin-top: 1.5rem; padding: .42rem .65rem; border: 1px solid rgba(242, 166, 90, .22); border-radius: 99rem; color: var(--accent); background: rgba(242, 166, 90, .06); font-size: .64rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }

.storage-strip { margin: 1.25rem 0; padding: .7rem .8rem; border-radius: .72rem; color: var(--dim); background: rgba(255, 255, 255, .025); font-size: .72rem; line-height: 1.4; }
.storage-strip.safe { color: var(--green); }
.storage-strip.risk { color: #e6bd8f; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; margin: 1.4rem 0 1rem; padding: .25rem; border-radius: .9rem; background: rgba(255, 255, 255, .035); }
.tab { min-height: 2.65rem; border: 0; border-radius: .68rem; color: var(--dim); background: transparent; font-weight: 700; cursor: pointer; }
.tab.active { color: var(--text); background: var(--surface-raised); box-shadow: 0 8px 20px rgba(0, 0, 0, .13); }
.count { display: inline-grid; min-width: 1.25rem; height: 1.25rem; margin-left: .25rem; place-items: center; border-radius: 99rem; background: rgba(255, 255, 255, .08); font-size: .68rem; }

.panel { display: grid; gap: .9rem; }
.card { padding: 1.15rem; border: 1px solid var(--line); border-radius: 1.05rem; background: linear-gradient(150deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .015)); box-shadow: var(--shadow); }
.card h2, .ledger-intro h2 { margin: 0; font-size: 1.15rem; line-height: 1.25; }
.card-copy, .ledger-intro p { margin: .6rem 0 1rem; color: var(--dim); font-size: .84rem; line-height: 1.5; }

label { display: block; margin: 1.1rem 0 .45rem; color: var(--text); font-size: .8rem; font-weight: 650; }
input { width: 100%; min-height: 3.2rem; margin-bottom: .75rem; padding: .75rem .85rem; border: 1px solid rgba(247, 237, 224, .16); border-radius: .8rem; color: var(--text); background: rgba(0, 0, 0, .18); }
input::placeholder { color: var(--muted); }

.status-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.status { display: inline-flex; align-items: center; min-height: 1.6rem; padding: .25rem .55rem; border-radius: 99rem; font-size: .63rem; font-weight: 780; letter-spacing: .045em; text-transform: uppercase; }
.staged-status { color: #e9c595; background: rgba(242, 166, 90, .1); }
.preview-status { color: var(--blue); background: rgba(142, 197, 214, .1); }
.proposed-value { margin: .7rem 0; color: var(--text); font-size: 1.45rem; font-weight: 680; overflow-wrap: anywhere; }
.change-line { display: grid; gap: .2rem; margin: 1rem 0; padding: .9rem; border-radius: .8rem; background: rgba(127, 216, 166, .06); }
.change-line span { color: var(--dim); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.change-line strong { color: var(--green); overflow-wrap: anywhere; }

.section-title-row { display: flex; align-items: center; justify-content: space-between; }
.number-badge { display: grid; min-width: 2.1rem; height: 2.1rem; padding: 0 .4rem; place-items: center; border-radius: 99rem; color: var(--dim); background: rgba(255, 255, 255, .05); font-size: .78rem; }
.value-list { display: grid; gap: .25rem; margin: .9rem 0 0; padding: 0; list-style: none; }
.value-list li { display: flex; justify-content: space-between; gap: .75rem; padding: .64rem .2rem; border-top: 1px solid rgba(247, 237, 224, .07); color: var(--dim); font-size: .8rem; }
.value-list li::after { content: "Open"; flex: 0 0 auto; color: var(--accent); font-size: .64rem; font-weight: 740; text-transform: uppercase; }
.value-list .more { color: var(--muted); font-style: italic; }
.value-list .more::after { content: ""; }

.ledger-intro { padding: .5rem .2rem .2rem; }
.ledger { display: grid; gap: .75rem; margin: 0; padding: 0; list-style: none; counter-reset: none; }
.record { display: grid; grid-template-columns: 2.25rem 1fr; gap: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(255, 255, 255, .025); }
.record-seq { display: grid; width: 2.25rem; height: 2.25rem; place-items: center; border-radius: .72rem; color: var(--accent); background: rgba(242, 166, 90, .09); font-size: .75rem; font-weight: 800; }
.record h3 { margin: .08rem 0 .25rem; font-size: .92rem; }
.record p { margin: 0; color: var(--dim); font-size: .75rem; line-height: 1.4; }
.record time { display: block; margin-top: .55rem; color: var(--muted); font-size: .65rem; }
.record.committed h3::after { content: "Persisted"; margin-left: .5rem; color: var(--green); font-size: .55rem; letter-spacing: .06em; text-transform: uppercase; }

.blocked { margin-top: 4vh; }
.error-facts { display: grid; gap: .55rem; margin: 1.2rem 0; }
.error-facts div { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem .8rem; border-radius: .7rem; background: rgba(224, 118, 63, .06); }
.error-facts dt { color: var(--dim); font-size: .72rem; }
.error-facts dd { margin: 0; color: var(--text); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .68rem; text-align: right; overflow-wrap: anywhere; }
.blocking-law { margin: 1rem 0 1.4rem; color: #e6bd8f; font-size: .8rem; line-height: 1.5; }

footer { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; padding: 1.2rem calc(1rem + env(safe-area-inset-right)) calc(1.3rem + env(safe-area-inset-bottom)) calc(1rem + env(safe-area-inset-left)); color: var(--muted); font-size: .63rem; text-align: center; }

@media (min-width: 42rem) {
  .topbar { padding-left: 1.5rem; padding-right: 1.5rem; }
  main { padding-top: 3rem; }
  .card { padding: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
