:root {
  --canvas: #FAFAFC;
  --surface: #FFFFFF;
  --subtle: #F2F4F7;
  --ink: #0B0F17;
  --ink-secondary: #475467;
  --border: #E4E7EC;
  --border-strong: #98A2B3;
  --obsidian: #090D16;
  --forest: #065F46;
  --forest-hover: #064E3B;
  --forest-tint: #ECFDF5;
  --crimson: #B42318;
  --crimson-tint: #FEF3F2;
  --amber: #B54708;
  --amber-tint: #FFFAEB;
  --ease-precise: cubic-bezier(0.2, 0, 0, 1);
}

/* Preflight Reset (Self-Hosted — Zero External CDN) */
*, ::before, ::after {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: var(--border);
  -webkit-tap-highlight-color: transparent;
}

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

html.antialiased {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--canvas);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.55;
  margin: 0;
}

h1, h2, h3, h4, p, ul, pre {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

button {
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 0;
}

input, select, textarea {
  font: inherit;
  color: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
  text-indent: 0;
}

svg {
  display: block;
}

h1, h2, h3 {
  text-wrap: balance;
  line-height: 1.2;
  letter-spacing: -0.018em;
}

p {
  text-wrap: pretty;
  max-width: 68ch;
}

.editorial-head {
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.tabular {
  font-family: 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
}

.concentric-shell {
  border-radius: 16px;
  padding: 8px;
  background-color: var(--subtle);
  border: 1px solid var(--border);
}

.concentric-inner {
  border-radius: 8px;
  background-color: var(--surface);
  border: 1px solid var(--border);
}

.btn-primary {
  background-color: var(--forest);
  color: #FFFFFF;
  border: 1px solid transparent;
  border-radius: 8px;
  transition-property: background-color, transform, opacity;
  transition-duration: 150ms;
  transition-timing-function: var(--ease-precise);
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  transition-property: background-color, border-color, transform, opacity;
  transition-duration: 150ms;
  transition-timing-function: var(--ease-precise);
}
.btn-secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tab-btn {
  border-radius: 6px;
  transition-property: background-color, color, opacity;
  transition-duration: 140ms;
  transition-timing-function: var(--ease-precise);
}
.tab-btn-active { background-color: var(--ink); color: #FFFFFF; }
.tab-btn-idle { background-color: transparent; color: var(--ink-secondary); }

@media (hover: hover) {
  .btn-primary:hover:not(:disabled) { background-color: var(--forest-hover); }
  .btn-secondary:hover:not(:disabled) { background-color: var(--subtle); border-color: var(--ink); }
  .tab-btn-idle:hover { background-color: #E5E7EB; color: var(--ink); }
  .row-interactive:hover { background-color: #F8FAFC; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn-primary:not(:disabled):active,
  .btn-secondary:not(:disabled):active {
    transform: scale(0.96);
  }
  .view-swap {
    animation: cleanFade 190ms var(--ease-precise) both;
  }
  @keyframes cleanFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

.field-control {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background-color: var(--surface);
  color: var(--ink);
  transition-property: border-color, box-shadow;
  transition-duration: 140ms;
}
.field-control:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(6, 95, 70, 0.16);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #D0D5DD;
  border-radius: 999px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--forest);
  border: 2px solid #FFFFFF;
  box-shadow: 0 1px 3px rgba(11, 15, 23, 0.3);
  cursor: pointer;
}

.modal-scroll { overscroll-behavior: contain; }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 2px;
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--obsidian);
  color: #FFFFFF;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.skip-link:focus { left: 12px; }
.kbd {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #D0D5DD;
  background: #F9FAFB;
  color: #344054;
}

/* Self-Hosted Utility Classes */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sticky { position: sticky; }
.fixed { position: fixed; }
.top-0 { top: 0; }
.right-5 { right: 1.25rem; }
.bottom-5 { bottom: 1.25rem; }
.inset-0 { inset: 0; }
.z-30 { z-index: 30; }
.z-50 { z-index: 50; }

.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.grid { display: grid; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.shrink-0 { flex-shrink: 0; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-center { align-items: center; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2 / span 2; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-x-5 { column-gap: 1.25rem; }
.gap-y-1 { row-gap: 0.25rem; }

.space-y-1 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.25rem; }
.space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.5rem; }
.space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
.space-y-5 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.25rem; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.5rem; }
.space-y-7 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.75rem; }

.divide-y > :not([hidden]) ~ :not([hidden]) {
  border-top-width: 1px;
  border-bottom-width: 0;
}
.divide-\[\#E4E7EC\] > :not([hidden]) ~ :not([hidden]) {
  border-color: #E4E7EC;
}

.min-h-screen { min-height: 100vh; }
.w-2 { width: 0.5rem; }
.h-2 { height: 0.5rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-full { width: 100%; }
.max-w-lg { max-width: 32rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-7xl { max-width: 80rem; }
.max-h-72 { max-height: 18rem; }
.max-h-\[90vh\] { max-height: 90vh; }

.mx-auto { margin-left: auto; margin-right: auto; }
.ml-2 { margin-left: 0.5rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-1\.5 { margin-bottom: 0.375rem; }
.mb-2 { margin-bottom: 0.5rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-3\.5 { padding: 0.875rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-7 { padding: 1.75rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-3\.5 { padding-left: 0.875rem; padding-right: 0.875rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-3\.5 { padding-top: 0.875rem; padding-bottom: 0.875rem; }
.py-7 { padding-top: 1.75rem; padding-bottom: 1.75rem; }
.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 0.75rem; }
.pt-6 { padding-top: 1.5rem; }
.pt-20 { padding-top: 5rem; }
.pb-3 { padding-bottom: 0.75rem; }
.pb-4 { padding-bottom: 1rem; }
.pb-6 { padding-bottom: 1.5rem; }

.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.whitespace-pre-wrap { white-space: pre-wrap; }

.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

.border { border-width: 1px; }
.border-2 { border-width: 2px; }
.border-t { border-top-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-\[\#E4E7EC\] { border-color: #E4E7EC; }
.border-\[\#065F46\] { border-color: #065F46; }
.border-slate-700 { border-color: #334155; }
.border-slate-800 { border-color: #1E293B; }

.bg-transparent { background-color: transparent; }
.bg-white { background-color: #FFFFFF; }
.bg-white\/95 { background-color: rgba(255, 255, 255, 0.95); }
.bg-black\/50 { background-color: rgba(0, 0, 0, 0.5); }
.bg-black\/55 { background-color: rgba(0, 0, 0, 0.55); }
.bg-slate-200 { background-color: #E2E8F0; }
.bg-slate-800 { background-color: #1E293B; }
.bg-slate-950\/70 { background-color: rgba(2, 6, 23, 0.7); }
.bg-emerald-400 { background-color: #34D399; }
.bg-emerald-700 { background-color: #047857; }
.bg-\[\#090D16\] { background-color: #090D16; }
.bg-\[\#ECFDF5\] { background-color: #ECFDF5; }
.bg-\[\#ECFDF5\]\/40 { background-color: rgba(236, 253, 245, 0.4); }
.bg-\[\#F2F4F7\] { background-color: #F2F4F7; }
.bg-\[\#F2F4F7\]\/70 { background-color: rgba(242, 244, 247, 0.7); }
.bg-\[\#FAFAFC\] { background-color: #FAFAFC; }
.bg-\[\#FEF3F2\] { background-color: #FEF3F2; }
.bg-\[\#FFFAEB\] { background-color: #FFFAEB; }

.backdrop-blur {
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.shadow-xl {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.font-sans { font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-\[11px\] { font-size: 11px; line-height: 1rem; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-5xl { font-size: 3rem; line-height: 1; }

.leading-relaxed { line-height: 1.625; }
.tracking-tight { letter-spacing: -0.025em; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-white { color: #FFFFFF; }
.text-emerald-300 { color: #6EE7B7; }
.text-emerald-400 { color: #34D399; }
.text-slate-200 { color: #E2E8F0; }
.text-slate-300 { color: #CBD5E1; }
.text-slate-400 { color: #94A3B8; }
.text-slate-500 { color: #64748B; }
.text-slate-600 { color: #475569; }
.text-slate-700 { color: #334155; }
.text-\[\#065F46\] { color: #065F46; }
.text-\[\#0B0F17\] { color: #0B0F17; }
.text-\[\#475467\] { color: #475467; }
.text-\[\#B42318\] { color: #B42318; }
.text-\[\#B54708\] { color: #B54708; }

.underline { text-decoration-line: underline; }
.cursor-pointer { cursor: pointer; }
.transition-colors { transition-property: color, background-color, border-color; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.duration-150 { transition-duration: 150ms; }

.hover\:bg-emerald-600:hover { background-color: #059669; }
.hover\:bg-slate-100:hover { background-color: #F1F5F9; }
.hover\:bg-slate-700:hover { background-color: #334155; }
.hover\:bg-slate-800:hover { background-color: #1E293B; }
.hover\:text-\[\#0B0F17\]:hover { color: #0B0F17; }
.focus\:outline-none:focus { outline: 2px solid transparent; outline-offset: 2px; }

/* Must follow display utilities (.flex/.grid/.block) so modal/tab toggling always wins */
.hidden { display: none !important; }

@media (min-width: 640px) {
  .sm\:inline { display: inline; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sm\:p-8 { padding: 2rem; }
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
  .sm\:py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
  .sm\:text-xs { font-size: 0.75rem; line-height: 1rem; }
  .sm\:text-sm { font-size: 0.875rem; line-height: 1.25rem; }
  .sm\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
}

@media (min-width: 768px) {
  .md\:inline { display: inline; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .lg\:col-span-4 { grid-column: span 4 / span 4; }
  .lg\:col-span-5 { grid-column: span 5 / span 5; }
  .lg\:col-span-7 { grid-column: span 7 / span 7; }
  .lg\:col-span-8 { grid-column: span 8 / span 8; }
}

@media (min-width: 1280px) {
  .xl\:flex-row { flex-direction: row; }
  .xl\:items-center { align-items: center; }
  .xl\:justify-between { justify-content: space-between; }
}
