:root {
  --ink: #17211c;
  --muted: #627068;
  --paper: #f4f5ef;
  --surface: #ffffff;
  --line: #d9dfd8;
  --forest: #173f35;
  --forest-2: #235e4d;
  --mint: #b8efd5;
  --lime: #dff29a;
  --amber: #f2bd67;
  --danger: #a43b35;
  --shadow: 0 20px 55px rgba(22, 42, 34, 0.09);
  --radius-lg: 24px;
  --radius-md: 16px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(184, 239, 213, 0.32), transparent 28rem),
    var(--paper);
  line-height: 1.55;
}

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

:focus-visible {
  outline: 3px solid #6dcfa8;
  outline-offset: 3px;
}

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.flash-messages { display: grid; gap: 10px; margin: 22px 0 -30px; }
.flash-message { margin: 0; padding: 13px 16px; border: 1px solid #9bcdb6; border-radius: 11px; color: var(--forest); background: #eaf8f0; font-weight: 700; }
.flash-error { color: #752c27; border-color: #e4aaa6; background: #fff0ee; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 84px;
  border-bottom: 1px solid rgba(23, 63, 53, 0.12);
}

.brand, .login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #fff;
  background: var(--forest);
  font: 800 19px/1 Georgia, serif;
  box-shadow: 0 7px 18px rgba(23, 63, 53, 0.2);
}

.brand strong, .login-brand strong { display: block; letter-spacing: -0.02em; }
.brand small, .login-brand small { display: block; color: var(--muted); font-size: 0.72rem; }

.header-actions { display: flex; align-items: center; gap: 16px; }
.header-actions form { margin: 0; }

.environment-chip, .pill, .privacy-note {
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.environment-chip { padding: 7px 11px; color: var(--forest); background: rgba(184, 239, 213, 0.55); }
.text-button { padding: 7px 0; border: 0; color: var(--muted); background: none; text-decoration: none; cursor: pointer; }
.text-button:hover { color: var(--ink); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  gap: 28px;
  padding: 72px 0 38px;
}

.hero-copy {
  min-height: 430px;
  padding: clamp(36px, 6vw, 76px);
  border-radius: var(--radius-lg);
  color: #f7fbf8;
  background:
    linear-gradient(125deg, rgba(255, 255, 255, 0.03), transparent 50%),
    var(--forest);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 14px;
  color: #3c725f;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero .eyebrow { color: var(--mint); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -0.035em; }
h1 { max-width: 740px; margin-bottom: 22px; font: 600 clamp(2.65rem, 6vw, 5.6rem)/0.98 Georgia, serif; }
h2 { margin-bottom: 12px; font: 600 clamp(2rem, 4vw, 3.2rem)/1.05 Georgia, serif; }
h3 { margin-bottom: 4px; font-size: 1.3rem; }

.hero-summary { max-width: 650px; color: rgba(247, 251, 248, 0.74); font-size: 1.08rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 34px; }
.hero-actions form { margin: 0; }
.append-note { max-width: 640px; margin: 18px 0 0; color: rgba(247, 251, 248, 0.62); font-size: 0.8rem; }

.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 11px;
  font-weight: 760;
  text-decoration: none;
  cursor: pointer;
}

.primary-button { padding: 13px 18px; color: var(--forest); background: var(--lime); }
.primary-button:hover { background: #eafbaf; transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled { opacity: 0.65; cursor: wait; transform: none; }
.secondary-button { padding: 10px 14px; color: var(--forest); border: 1px solid #bed4ca; background: #f6fbf8; }
.secondary-button:hover { border-color: var(--forest-2); }
.hero .secondary-button { color: #f7fbf8; border-color: rgba(247, 251, 248, 0.35); background: rgba(255, 255, 255, 0.08); }
.hero .secondary-button:hover { border-color: var(--mint); background: rgba(255, 255, 255, 0.13); }
.hero-link { color: rgba(247, 251, 248, 0.78); font-size: 0.88rem; font-weight: 700; text-underline-offset: 4px; }
.hero-link:hover { color: #fff; }

.poll-state { display: inline-flex; align-items: center; gap: 8px; color: rgba(247, 251, 248, 0.64); font-size: 0.82rem; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgba(184, 239, 213, 0.12); }
.poll-state.is-error { color: #ffd4cb; }
.poll-state.is-error .pulse { background: #f48270; }

.verification-result {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid #a8d9c2;
  border-radius: 14px;
  background: linear-gradient(135deg, #f2fbf6, #f9fcfa);
}

.verification-result.is-failed { border-color: #e4aaa6; background: #fff7f6; }
.verification-result-heading { display: flex; align-items: center; gap: 12px; }
.verification-result-heading h4 { margin: 0; font-size: 1.08rem; }
.verification-result-heading .event-type { margin-bottom: 1px; }
.verification-mark {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: var(--forest-2);
  font-weight: 900;
}
.verification-result.is-failed .verification-mark { background: var(--danger); }
.verification-mark.is-ready { color: var(--forest); background: var(--lime); }
.verification-result > p { margin: 12px 0; color: var(--muted); }
.verification-checks { display: grid; gap: 7px; margin: 14px 0; padding: 0; list-style: none; }
.verification-checks li { display: flex; justify-content: space-between; gap: 20px; padding-top: 7px; border-top: 1px solid rgba(23, 63, 53, 0.1); }
.verification-checks strong { color: var(--forest-2); font-size: 0.82rem; text-align: right; }
.verification-checks li.is-failed strong { color: var(--danger); }
.verification-result .verification-footnote { margin-bottom: 0; font-size: 0.78rem; }

.status-panel {
  align-self: end;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.status-label { color: var(--muted); font-size: 0.75rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.status-heading { display: flex; align-items: center; gap: 11px; margin: 16px 0 12px; font-size: 1.38rem; }
.status-icon { width: 14px; height: 14px; border: 4px solid rgba(35, 94, 77, 0.14); border-radius: 50%; background: var(--forest-2); }
.status-pending { background: var(--amber); }
.status-attention { background: var(--danger); }
.status-not_started { background: #a8b0ab; }
.status-panel > p { color: var(--muted); }

.compact-facts, .evidence-grid, .technical-facts { margin: 0; }
.compact-facts { display: grid; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.compact-facts div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; }
dt { color: var(--muted); font-size: 0.73rem; font-weight: 720; letter-spacing: 0.05em; text-transform: uppercase; }
dd { margin: 0; }

.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 0.76rem; overflow-wrap: anywhere; }
code { padding: 2px 5px; border-radius: 5px; color: #285343; background: #e9eee9; font-family: "SFMono-Regular", Consolas, monospace; font-size: 0.86em; }
.hero code { color: #dff9ed; background: rgba(255, 255, 255, 0.09); }

.explainer, .evidence-section { padding: 74px 0; }
.section-heading { max-width: 700px; margin-bottom: 36px; }
.split-heading { display: flex; max-width: none; align-items: end; justify-content: space-between; gap: 24px; }

.journey { display: grid; grid-template-columns: repeat(5, 1fr); margin: 0; padding: 0; list-style: none; counter-reset: journey; }
.journey li { position: relative; min-height: 190px; padding: 25px 24px; border-top: 1px solid #bfc9c2; border-bottom: 1px solid #bfc9c2; }
.journey li + li { border-left: 1px solid #bfc9c2; }
.journey li:first-child { border-left: 1px solid #bfc9c2; border-radius: 14px 0 0 14px; }
.journey li:last-child { border-right: 1px solid #bfc9c2; border-radius: 0 14px 14px 0; }
.journey strong { display: block; margin: 14px 0 8px; font-size: 1.05rem; }
.journey p { margin: 0; color: var(--muted); font-size: 0.84rem; }
.step-number { color: var(--forest-2); font: 700 0.72rem/1 "SFMono-Regular", monospace; }

.privacy-note { margin: 0 0 7px; padding: 8px 12px; color: var(--forest-2); background: rgba(184, 239, 213, 0.35); }
.privacy-note span { margin-right: 5px; color: #47a57f; }

.event-list { display: grid; gap: 18px; }
.event-card { display: grid; grid-template-columns: 70px 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 13px 35px rgba(31, 55, 45, 0.05); }
.event-rail { display: flex; justify-content: center; padding-top: 27px; color: var(--forest); background: #eaf1eb; }
.event-rail span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--mint); font-weight: 800; }
.event-content { min-width: 0; padding: 28px; }
.event-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.event-header time { color: var(--muted); font-size: 0.82rem; }
.event-type { margin-bottom: 5px; color: var(--forest-2); font: 700 0.72rem/1.2 "SFMono-Regular", monospace; }
.event-statuses { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.pill { padding: 7px 10px; white-space: nowrap; }
.pill-proof { color: #245c48; background: #ddf6e8; }
.pill-anchor { color: #5f491e; background: #fff0cf; }
.pill-anchor.is-confirmed { color: #245c48; background: #ddf6e8; }
.pill.is-invalid { color: #7d2f2a; background: #ffe0dd; }

.evidence-grid { display: grid; grid-template-columns: 1fr 1fr 2fr 0.65fr; gap: 18px; margin-top: 26px; padding: 19px 0; border-top: 1px solid #e6ebe6; border-bottom: 1px solid #e6ebe6; }
.evidence-grid dd { margin-top: 5px; }
.digest { max-width: 100%; }

.event-actions { display: flex; align-items: flex-start; gap: 18px; margin-top: 20px; }
.processing-note { padding: 10px 0; color: var(--muted); font-size: 0.85rem; }
details { flex: 1; min-width: 0; }
summary { width: max-content; padding: 10px 0; color: var(--forest-2); font-size: 0.85rem; font-weight: 760; cursor: pointer; }
.technical-facts { display: grid; grid-template-columns: 0.5fr 1.5fr 2fr 0.5fr; gap: 14px; padding: 17px; border-radius: 12px; background: #f4f7f4; }
.technical-facts dd { margin-top: 5px; }
.local-chain-note { margin: 11px 0 0; color: var(--muted); font-size: 0.82rem; }
.inline-link { display: inline-block; margin-top: 12px; color: var(--forest-2); font-weight: 760; }

.empty-state { padding: 68px 24px; text-align: center; border: 1px dashed #aebbb3; border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.5); }
.empty-mark { display: block; margin-bottom: 12px; color: var(--forest-2); font: 700 2rem/1 monospace; }
.empty-state p { color: var(--muted); }

.boundary-grid { display: grid; grid-template-columns: 1.2fr 0.8fr 0.8fr; gap: 20px; padding: 50px 0 90px; }
.boundary-card { padding: 25px; border-radius: var(--radius-md); }
.boundary-card > span { font-size: 0.76rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.boundary-card ul { margin: 17px 0 0; padding-left: 20px; }
.boundary-card li + li { margin-top: 7px; }
.boundary-private { color: #3d443f; border: 1px solid #cbd3cd; background: #e8ece8; }
.boundary-public { color: #fff; background: var(--forest); }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 25px 0 40px; color: var(--muted); border-top: 1px solid #cbd3cd; font-size: 0.76rem; }
footer p { margin: 0; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 30px; background: var(--forest); }
.login-shell { width: min(450px, 100%); }
.login-brand { margin: 0 0 20px; color: #fff; }
.login-brand small { color: rgba(255, 255, 255, 0.62); }
.login-brand .brand-mark { color: var(--forest); background: var(--lime); }
.login-card { padding: clamp(28px, 7vw, 45px); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25); }
.login-card h1 { margin-bottom: 12px; font-size: 2.7rem; }
.login-card > p:not(.eyebrow):not(.form-error) { color: var(--muted); }
.login-card form { display: grid; gap: 9px; margin-top: 28px; }
.login-card label { margin-top: 9px; font-size: 0.8rem; font-weight: 760; }
.login-card input { width: 100%; padding: 12px 13px; border: 1px solid #bdc8c0; border-radius: 9px; background: #fbfcfb; }
.login-card input:focus { border-color: var(--forest-2); outline: 3px solid rgba(109, 207, 168, 0.25); }
.full-button { width: 100%; margin-top: 16px; }
.form-error { padding: 10px 12px; border-radius: 8px; color: #752c27; background: #ffe3df; font-size: 0.86rem; }
.login-help { margin: 22px 0 0; font-size: 0.78rem; text-align: center; }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .hero-copy { min-height: auto; }
  .status-panel { width: min(560px, 100%); }
  .journey { grid-template-columns: 1fr 1fr; gap: 10px; }
  .journey li, .journey li:first-child, .journey li:last-child { min-height: 150px; border: 1px solid #bfc9c2; border-radius: 12px; }
  .evidence-grid { grid-template-columns: 1fr 1fr; }
  .technical-facts { grid-template-columns: 1fr 1fr; }
  .boundary-grid { grid-template-columns: 1fr 1fr; }
  .boundary-grid > div:first-child { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .page-shell { width: min(100% - 24px, 1180px); }
  .environment-chip { display: none; }
  .hero { padding-top: 30px; }
  .hero-copy { padding: 30px 24px; border-radius: 18px; }
  h1 { font-size: 2.65rem; }
  h2 { font-size: 2.05rem; }
  .explainer, .evidence-section { padding: 52px 0; }
  .journey { grid-template-columns: 1fr; }
  .split-heading, .event-header, .event-actions { align-items: flex-start; flex-direction: column; }
  .privacy-note { align-self: flex-start; }
  .event-card { grid-template-columns: 48px 1fr; }
  .event-rail { padding-top: 23px; }
  .event-rail span { width: 27px; height: 27px; }
  .event-content { padding: 22px 18px; }
  .event-statuses { justify-content: flex-start; }
  .evidence-grid, .technical-facts, .boundary-grid { grid-template-columns: 1fr; }
  .boundary-grid > div:first-child { grid-column: auto; }
  details { width: 100%; }
  .verification-checks li { align-items: flex-start; flex-direction: column; gap: 2px; }
  .verification-checks strong { text-align: left; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
