/* Receipt Vault — Real World Activated
   Same credit-desk language as the rest of the suite: deep green-black
   canvas, hairline rules, serif display headings, monospace figures.
   Everything on this page is a labeled local preview — nothing is live. */

:root {
  --ink: #f2f7f1;
  --muted: #93a396;
  --muted-strong: #c3cfc4;
  --canvas: #060d09;
  --canvas-soft: #0a130d;
  --panel: #0d1912;
  --panel-raised: #122217;
  --line: rgba(196, 224, 200, 0.13);
  --line-strong: rgba(196, 224, 200, 0.27);
  --green: #00c805;
  --green-bright: #72ff78;
  --green-pale: #d7ffda;
  --green-dim: rgba(0, 200, 5, 0.12);
  --amber: #f2c94c;
  --amber-dim: rgba(242, 201, 76, 0.12);
  --danger: #ff6b72;
  --danger-dim: rgba(255, 107, 114, 0.12);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
  --pointer-x: 80%;
  --pointer-y: 8%;
  color-scheme: dark;
  font-family: var(--sans);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse 60% 42% at var(--pointer-x) var(--pointer-y), rgba(0, 200, 5, 0.05), transparent 70%),
    radial-gradient(ellipse 90% 40% at 85% -5%, rgba(0, 200, 5, 0.07), transparent),
    var(--canvas);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
code { font-family: var(--mono); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed; z-index: 1000; top: 12px; left: 12px;
  padding: 10px 14px;
  color: #061009;
  background: var(--green-bright);
  border-radius: var(--radius-sm);
  transform: translateY(-180%);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

:is(a, button, input, select, textarea, summary, pre):focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Reveal (driven by ../app.js) ────────────────────────── */
html.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.19, 1, 0.22, 1);
}
html.js .reveal.is-visible { opacity: 1; transform: none; }

/* ── Top bar ─────────────────────────────────────────────── */
.top-bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-wrap: wrap; gap: 12px 20px;
  align-items: center; justify-content: space-between;
  width: min(1360px, calc(100% - 48px));
  min-height: 78px;
  margin: 0 auto;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  transition: background 0.3s ease;
}
.top-bar.is-scrolled {
  background: color-mix(in srgb, var(--canvas) 86%, transparent);
  backdrop-filter: blur(10px);
}
.wordmark { display: inline-flex; gap: 10px; align-items: center; text-decoration: none; letter-spacing: -0.02em; }
.wordmark svg { width: 32px; color: var(--green-bright); }
.wordmark span { font-size: 16px; font-weight: 520; white-space: nowrap; }
.wordmark b { font-weight: 800; }
.product-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.product-nav a {
  padding: 8px 12px;
  color: var(--muted-strong);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}
.product-nav a:hover { color: var(--ink); }
.product-nav a.is-active { color: var(--green-pale); background: var(--green-dim); }
.top-actions { display: flex; gap: 10px; align-items: center; }
.mode-chip {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 8px 12px;
  color: var(--muted-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}
.mode-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; }

/* ── Shared furniture ────────────────────────────────────── */
.vault-main { width: min(1360px, calc(100% - 48px)); margin: 0 auto; }
.eyebrow {
  margin: 0 0 12px;
  color: var(--green-bright);
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.section-head {
  display: flex; flex-wrap: wrap; gap: 16px 40px;
  align-items: end; justify-content: space-between;
  margin-bottom: 28px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 500;
  letter-spacing: -0.02em;
}
.section-note { max-width: 440px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.section-note b { color: var(--muted-strong); }
.section-note code { font-size: 12px; color: var(--muted-strong); }

.vault-section { padding: 72px 0 12px; }

/* ── Tags ────────────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  vertical-align: 2px;
}
.tag-sample { color: var(--amber); background: var(--amber-dim); border: 1px solid rgba(242, 201, 76, 0.35); }
.tag-config { color: var(--muted-strong); background: rgba(196, 224, 200, 0.07); border: 1px solid var(--line-strong); }

/* ── Masthead ────────────────────────────────────────────── */
.masthead { padding: clamp(56px, 9vh, 110px) 0 24px; max-width: 900px; }
.masthead h1 {
  margin: 0 0 20px;
  font-family: var(--serif);
  font-size: clamp(36px, 5.4vw, 64px);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -0.025em;
}
.masthead-lede { max-width: 700px; margin: 0 0 28px; color: var(--muted-strong); font-size: 15.5px; line-height: 1.7; }

.disclosure {
  display: grid; gap: 6px;
  max-width: 760px;
  margin: 0 0 26px;
  padding: 16px 18px;
  border: 1px solid rgba(242, 201, 76, 0.3);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-md);
  background: var(--amber-dim);
  font-size: 13px; line-height: 1.6;
}
.disclosure strong { color: var(--amber); letter-spacing: 0.01em; }
.disclosure span { color: var(--muted-strong); }
.disclosure em { font-style: normal; font-weight: 700; color: var(--ink); }

.quickstart-steps {
  list-style: none;
  counter-reset: qstep;
  margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 10px 18px;
}
.quickstart-steps li {
  counter-increment: qstep;
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--muted-strong);
  font-size: 13px; font-weight: 600;
}
.quickstart-steps li::before {
  content: counter(qstep);
  flex: none;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: 50%;
  color: var(--green-bright);
  font-family: var(--mono); font-size: 11px; font-weight: 400;
}
.quickstart-steps li:not(:last-child)::after {
  content: "→";
  margin-left: 8px;
  color: var(--muted);
  font-weight: 400;
}

.noscript-note, .crypto-warning {
  margin: 24px 0 0; padding: 14px 16px;
  border: 1px solid rgba(255, 107, 114, 0.4);
  border-radius: var(--radius-md);
  background: var(--danger-dim);
  color: var(--ink); font-size: 13px; line-height: 1.6;
}
.crypto-warning code { font-size: 12px; color: var(--muted-strong); }

/* ── Panels ──────────────────────────────────────────────── */
.panel {
  display: flex; flex-direction: column;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel-raised), var(--panel) 55%);
}
.panel-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; display: flex; gap: 10px; align-items: center; }
.panel-sub { flex-basis: 100%; margin: 2px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.panel-fine { margin: 14px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.panel-fine code { font-size: 11px; color: var(--muted-strong); }

/* ── Create grid & form ──────────────────────────────────── */
.create-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; align-items: start; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.field.span-2 { grid-column: span 2; }
.field label { color: var(--muted-strong); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }
.field .unit { color: var(--muted); font-weight: 400; text-transform: lowercase; letter-spacing: 0; }
.field input, .field select {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  color: var(--ink);
  background: var(--canvas-soft);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.field input::placeholder { color: var(--muted); opacity: 0.7; }
.field input:hover, .field select:hover { border-color: var(--green-bright); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted-strong) 50%), linear-gradient(135deg, var(--muted-strong) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field input[type="date"] { color-scheme: dark; }

.field-hint { margin: 12px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.6; }

.form-error {
  margin: 12px 0 0; padding: 10px 14px;
  border-left: 3px solid var(--danger);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--danger-dim);
  color: var(--ink);
  font-size: 12.5px; line-height: 1.55;
}

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* ── Preview panel ───────────────────────────────────────── */
.preview-panel { position: sticky; top: 96px; }
.json-view {
  max-height: 320px; overflow: auto;
  margin: 0; padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--canvas);
  color: var(--muted-strong);
  font-family: var(--mono); font-size: 11px; line-height: 1.55;
  white-space: pre; tab-size: 2;
}
.canonical-view { min-height: 120px; white-space: pre-wrap; word-break: break-word; }
.digest-line { margin: 14px 0 10px; color: var(--muted); font-size: 11.5px; }
.digest-line code { display: inline-block; max-width: 100%; word-break: break-all; color: var(--green-pale); font-size: 11px; }

.status-rows { margin: 0; display: grid; gap: 0; }
.status-row {
  display: flex; flex-wrap: wrap; gap: 4px 20px;
  align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.status-row dt { color: var(--muted); font-size: 12.5px; }
.status-row dd { margin: 0; text-align: right; }

.status-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.05em;
}
.status-pill[data-tone="idle"] { color: var(--muted-strong); background: rgba(196, 224, 200, 0.08); }
.status-pill[data-tone="ok"] { color: var(--green-pale); background: var(--green-dim); }
.status-pill[data-tone="hold"] { color: var(--amber); background: var(--amber-dim); }
.status-pill[data-tone="bad"] { color: var(--danger); background: var(--danger-dim); }

/* ── Vault ───────────────────────────────────────────────── */
.record-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px; font-weight: 400;
  letter-spacing: 0.06em;
}
.vault-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.vault-empty { margin: 6px 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.vault-empty b { color: var(--muted-strong); }

.record-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.record-item details {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--canvas-soft);
}
.record-item details[open] { border-color: var(--line-strong); }
.record-item summary {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  align-items: center;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}
.record-item summary::-webkit-details-marker { display: none; }
.record-item summary::before {
  content: "▸";
  color: var(--green-bright);
  font-size: 12px;
  transition: transform 0.2s ease;
}
.record-item details[open] summary::before { transform: rotate(90deg); }
.record-title { font-size: 13.5px; font-weight: 650; }
.record-sub { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.record-flags { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.record-body { padding: 0 14px 14px; display: grid; gap: 12px; }
.record-body .json-view { max-height: 260px; }
.record-digest { margin: 0; color: var(--muted); font-size: 11.5px; }
.record-digest code { display: inline-block; max-width: 100%; word-break: break-all; color: var(--green-pale); font-size: 11px; }
.record-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Verify ──────────────────────────────────────────────── */
.verify-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; align-items: start; }
.json-input {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55;
  resize: vertical;
}
.json-input::placeholder { color: var(--muted); opacity: 0.7; }
.file-button { cursor: pointer; }
.file-button:has(input:focus-visible) { outline: 2px solid var(--green-bright); outline-offset: 2px; }

.verify-result { display: grid; gap: 10px; }
.verify-idle { margin: 0; color: var(--muted); font-size: 13px; }
.verdict {
  margin: 0; padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-size: 12.5px; line-height: 1.55;
  color: var(--muted-strong);
}
.verdict b {
  display: block; margin-bottom: 4px;
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.verdict[data-tone="ok"] { border-color: rgba(114, 255, 120, 0.4); background: var(--green-dim); }
.verdict[data-tone="ok"] b { color: var(--green-bright); }
.verdict[data-tone="bad"] { border-color: rgba(255, 107, 114, 0.4); background: var(--danger-dim); }
.verdict[data-tone="bad"] b { color: var(--danger); }
.verdict[data-tone="warn"] { border-color: rgba(242, 201, 76, 0.4); background: var(--amber-dim); }
.verdict[data-tone="warn"] b { color: var(--amber); }
.verdict-digests { margin: 8px 0 0; display: grid; gap: 6px; font-size: 11px; }
.verdict-digests span { color: var(--muted); }
.verdict-digests code { display: block; word-break: break-all; color: var(--green-pale); font-size: 10.5px; }
.verdict[data-tone="bad"] .verdict-digests code.is-mismatch { color: var(--danger); }

/* ── Buttons ─────────────────────────────────────────────── */
.primary-button {
  display: inline-flex; gap: 14px; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px;
  color: #061009;
  background: var(--green-bright);
  border: 0; border-radius: 999px;
  font-size: 13px; font-weight: 800;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.primary-button:hover:not(:disabled) { background: #99ff9e; }
.primary-button:active:not(:disabled) { transform: scale(0.98); }
.primary-button:disabled { opacity: 0.4; cursor: not-allowed; }
.ghost-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: 0 14px;
  color: var(--muted-strong);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.ghost-button:hover:not(:disabled) { color: var(--ink); border-color: var(--green-bright); }
.ghost-button:disabled { opacity: 0.4; cursor: not-allowed; }
.danger-ghost:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }
.danger-ghost.is-armed { color: var(--danger); border-color: var(--danger); background: var(--danger-dim); }

/* ── Boundaries & footer ─────────────────────────────────── */
.boundaries { max-width: 860px; padding: 72px 0 40px; }
.boundaries h2 {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 500; letter-spacing: -0.02em;
}
.boundaries ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.boundaries li {
  padding: 12px 0 12px 18px;
  border-left: 2px solid var(--line-strong);
  color: var(--muted);
  font-size: 13px; line-height: 1.65;
}
.boundaries b { color: var(--muted-strong); }
.boundaries a { color: var(--green-pale); text-underline-offset: 3px; }
.boundaries a:hover { color: var(--green-bright); }
.boundaries code { font-size: 12px; color: var(--muted-strong); }

.vault-footer {
  width: min(1360px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 44px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px; line-height: 1.65;
}
.vault-footer p { margin: 0 0 8px; max-width: 820px; }
.vault-footer b { color: var(--muted-strong); }
.footer-meta a { color: var(--muted-strong); text-underline-offset: 3px; }
.footer-meta a:hover { color: var(--ink); }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed; z-index: 100; bottom: 24px; left: 50%;
  max-width: min(480px, calc(100vw - 40px));
  padding: 0;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.is-visible {
  padding: 12px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--panel-raised);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  color: var(--ink);
  font-size: 13px;
  transform: translate(-50%, 0);
  opacity: 1;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .create-grid { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .verify-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .vault-section { padding-top: 56px; }
  .top-bar { position: static; }
}
@media (max-width: 560px) {
  .vault-main, .top-bar, .vault-footer { width: calc(100% - 32px); }
  .field-grid { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
  .panel { padding: 18px 14px; }
  .record-flags { margin-left: 0; flex-basis: 100%; }
  .form-actions .primary-button { width: 100%; }
  .vault-actions { flex-basis: 100%; }
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
