:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --accent: #14b8a6;
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

h1, h2, h3 {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
}

h1 {
  font-size: 36px;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 18px;
}

p {
  margin: 0 0 16px 0;
  max-width: 70ch;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--primary);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 12px;
  z-index: 100;
}

.skip-link:focus {
  left: 16px;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
}

.brand-link:hover {
  text-decoration: none;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
}

.brand-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: rgba(20, 184, 166, 0.14);
  padding: 4px 8px;
  border-radius: 12px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-item {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 12px;
  text-decoration: none;
}

.nav-item:hover,
.nav-item[aria-current="page"] {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  text-decoration: none;
}


.btn-primary,
.btn-secondary,
.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: #1d4ed8;
  text-decoration: none;
}

.btn-accent {
  background: var(--accent);
  color: var(--text);
}

.btn-accent:hover {
  background: #2dd4bf;
  text-decoration: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: rgba(15, 23, 42, 0.16);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.btn-compact {
  min-height: 44px;
  padding: 8px 12px;
  font-size: 14px;
}

.workbench-section {
  padding-top: 24px;
  padding-bottom: 48px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}

.hero-compact {
  margin-bottom: 24px;
}

.hero-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.hero-share-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.share-note {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.hero-lead {
  color: var(--muted);
  font-size: 16px;
  margin: 0;
  max-width: 70ch;
}

.workbench-shell {
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  padding: 24px;
}

.wb-grid {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 24px;
  align-items: start;
}

.wb-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.wb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.wb-pane-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wb-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}


.wb-dropzone {
  border: 1px dashed rgba(37, 99, 235, 0.45);
  background: var(--bg);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.wb-dropzone.is-dragover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}

.wb-dropzone-text {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 8px 0;
  max-width: none;
}

.wb-textarea {
  width: 100%;
  min-height: 240px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}

.wb-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.wb-opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
}

.wb-check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.wb-select,
.wb-input-sm {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

.wb-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wb-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text);
  border: 1px solid rgba(15, 23, 42, 0.1);
}

.wb-badge-accent {
  background: rgba(20, 184, 166, 0.12);
  border-color: rgba(20, 184, 166, 0.35);
}

.wb-col-drawer {
  padding: 12px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.1);
}

.wb-col-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  max-height: 120px;
  overflow-y: auto;
}

.wb-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
}


.wb-table-wrap {
  width: 100%;
  max-height: 360px;
  overflow: auto;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  background: var(--surface);
}

.wb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

.wb-table th,
.wb-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  border-right: 1px solid rgba(15, 23, 42, 0.06);
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wb-table th {
  position: sticky;
  top: 0;
  background: var(--bg);
  color: var(--text);
  font-weight: 700;
  z-index: 2;
  border-bottom: 1px solid rgba(15, 23, 42, 0.16);
}

.wb-row-num {
  color: var(--text);
  font-size: 12px;
  font-family: ui-monospace, monospace;
  background: var(--bg);
}

.wb-null {
  color: var(--muted);
  font-style: italic;
}

.wb-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.wb-status {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--text);
}

.wb-status-error {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.35);
}

.wb-privacy {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(20, 184, 166, 0.1);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.wb-sheet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wb-sheet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: var(--surface);
  cursor: pointer;
  font-size: 14px;
}

.wb-sheet-item.is-active {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.06);
}

.steps-section,
.deep-dive-section,
.spec-section,
.related-section,
.faq-section,
.legal-section {
  padding-top: 48px;
  padding-bottom: 48px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.section-intro {
  margin-bottom: 24px;
}

.section-intro p {
  margin-top: 8px;
  color: var(--muted);
}

.ledger-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.ledger-step {
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-top: 3px solid var(--primary);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

.step-index {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.step-title {
  margin-bottom: 8px;
}

.step-desc {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}


.deep-dive-grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 32px;
  align-items: start;
}

.prose-col h2 {
  margin-top: 32px;
  margin-bottom: 12px;
}

.prose-col h2:first-child {
  margin-top: 0;
}

.prose-col h3 {
  margin-top: 24px;
  margin-bottom: 8px;
}

.prose-col ul,
.prose-col ol {
  margin: 0 0 16px 0;
  padding-left: 24px;
  max-width: 70ch;
}

.prose-col li {
  margin-bottom: 8px;
}

.prose-col code {
  font-family: ui-monospace, monospace;
  font-size: 14px;
  background: rgba(15, 23, 42, 0.06);
  padding: 4px 8px;
  border-radius: 12px;
}

.specimen-card {
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  position: sticky;
  top: 72px;
}

.specimen-header {
  margin-bottom: 16px;
}

.specimen-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.specimen-block {
  margin-bottom: 16px;
}

.specimen-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.specimen-code {
  margin: 0;
  padding: 12px;
  background: var(--bg);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
}

.specimen-rule {
  padding: 8px 12px;
  margin-bottom: 16px;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}

.specimen-table-wrap,
.spec-table-container {
  overflow-x: auto;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  background: var(--surface);
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

.spec-table th,
.spec-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.spec-table th {
  background: var(--bg);
  font-weight: 700;
  color: var(--text);
}

.spec-table tr:last-child td {
  border-bottom: none;
}


.related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.related-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.related-card:hover {
  border-color: var(--primary);
  text-decoration: none;
}

.related-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.related-desc {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.related-cta {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 70ch;
}

.faq-item {
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  padding: 16px 24px;
}

.faq-q {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.faq-a {
  margin-top: 12px;
  color: var(--muted);
  font-size: 16px;
}

.faq-a p {
  margin: 0;
}

.legal-card {
  background: var(--surface);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

.legal-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.legal-meta {
  margin: 8px 0 0 0;
  font-size: 14px;
  color: var(--muted);
}

.site-footer {
  background: var(--surface);
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  padding-top: 48px;
  padding-bottom: 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 32px;
}

.footer-brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.footer-tagline,
.footer-contact {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}

.footer-heading {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.footer-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 12px;
  color: var(--muted);
}

.footer-bottom p {
  margin: 0;
}

@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 22px;
  }

  .workbench-shell,
  .legal-card {
    padding: 16px;
  }

  .wb-grid,
  .ledger-steps,
  .deep-dive-grid,
  .related-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .specimen-card {
    position: static;
  }

  .wb-actions .btn-primary,
  .wb-actions .btn-accent,
  .wb-actions .btn-secondary {
    width: 100%;
  }
}
