:root {
  color-scheme: light;
  --ink: #071821;
  --muted: #637077;
  --paper: #f5f1e8;
  --surface: #fffdf8;
  --line: #d8d3c8;
  --gold: #d9940d;
  --gold-bright: #f2a515;
  --green: #147264;
  --sidebar: #081923;
  --sidebar-soft: #102a36;
  --shadow: 0 22px 60px rgb(7 24 33 / 0.1);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { background: var(--paper); scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 8%, rgb(242 165 21 / 0.1), transparent 24rem),
    var(--paper);
}

button, a { font: inherit; }
a { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 3px; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.8rem 1rem;
  color: white;
  background: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.launch-notice {
  position: fixed;
  z-index: 10;
  top: 0;
  right: 0;
  left: 0;
  min-height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  color: #fff7e4;
  background: #9f6500;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-align: center;
}

.launch-notice span {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #fff1bf;
  box-shadow: 0 0 0 0.3rem rgb(255 241 191 / 0.15);
}

.app-frame {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 18.5rem minmax(0, 1fr);
  padding-top: 2.6rem;
}

.sidebar {
  position: fixed;
  top: 2.6rem;
  bottom: 0;
  left: 0;
  width: 18.5rem;
  display: flex;
  flex-direction: column;
  padding: 2rem 1.25rem 1.3rem;
  color: #f5f1e8;
  background:
    linear-gradient(165deg, rgb(242 165 21 / 0.11), transparent 34%),
    var(--sidebar);
  border-right: 1px solid rgb(255 255 255 / 0.08);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0 0 2rem;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 2.9rem;
  height: 2.9rem;
  display: grid;
  place-items: center;
  border-radius: 0.75rem;
  color: var(--ink);
  background: var(--gold-bright);
  font: 900 1.45rem/1 Georgia, serif;
}

.brand strong, .brand small { display: block; }
.brand strong { font: 700 1.08rem/1.1 Georgia, serif; letter-spacing: 0.01em; }
.brand small { margin-top: 0.22rem; color: #aebdc4; font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase; }

.menu-button { display: none; }

nav { display: grid; gap: 0.18rem; }

nav a {
  display: grid;
  grid-template-columns: 1.7rem 1fr auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.67rem 0.75rem;
  border-radius: 0.55rem;
  color: #c8d3d8;
  text-decoration: none;
  font-size: 0.84rem;
}

nav a:hover, nav a:focus-visible { color: white; background: var(--sidebar-soft); }
.nav-number { color: currentColor; opacity: 0.55; font-size: 0.68rem; font-variant-numeric: tabular-nums; }
.nav-lock { font-size: 0.68rem; opacity: 0.62; }

.sidebar-status {
  margin-top: auto;
  padding: 1rem;
  border: 1px solid rgb(255 255 255 / 0.11);
  border-radius: 0.8rem;
  background: rgb(255 255 255 / 0.035);
}

.status-label, .sidebar-status strong, .sidebar-status small { display: block; }
.status-label { color: #8fa2aa; font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; }
.sidebar-status strong { margin: 0.35rem 0; color: #ffce67; }
.sidebar-status small { color: #aebdc4; }

main {
  grid-column: 2;
  min-width: 0;
  padding: clamp(1.5rem, 4vw, 4rem);
}

.workspace-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2.2rem;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1, h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.035em;
}

h1 { max-width: 15ch; margin-bottom: 0; font-size: clamp(2.5rem, 4.8vw, 5.6rem); line-height: 0.96; }
h2 { font-size: clamp(2rem, 3.3vw, 3.6rem); line-height: 1.02; }

.identity-lock {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 0 0 auto;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: rgb(255 253 248 / 0.66);
}

.identity-lock strong, .identity-lock small { display: block; }
.identity-lock strong { font-size: 0.82rem; }
.identity-lock small { margin-top: 0.16rem; color: var(--muted); font-size: 0.7rem; }
.lock-icon { width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; color: #8a5700; background: #fff0c7; font-weight: 900; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(18rem, 0.72fr);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.readiness-card { padding: clamp(1.6rem, 4vw, 3.8rem); }
.readiness-card h2 { max-width: 16ch; margin-bottom: 1.3rem; }
.readiness-card > p:not(.eyebrow) { max-width: 67ch; color: var(--muted); font-size: 1rem; line-height: 1.7; }

.readiness-meter { height: 0.5rem; margin-top: 2rem; border-radius: 10rem; background: #e9e3d7; overflow: hidden; }
.readiness-meter span { display: block; width: 57%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--gold)); }
.meter-legend { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.75rem; font-size: 0.75rem; }
.meter-legend span { color: var(--muted); }

.boundary-card {
  padding: clamp(1.6rem, 3vw, 2.8rem);
  color: white;
  background: var(--ink);
}

.boundary-card .eyebrow { color: #edb74d; }
.boundary-card > strong { display: block; max-width: 12ch; font: 500 clamp(1.8rem, 2.8vw, 3rem)/1.08 Georgia, serif; }
.boundary-card ul { display: grid; gap: 0.9rem; margin: 2rem 0 0; padding: 0; list-style: none; color: #b9c6cb; font-size: 0.82rem; }
.boundary-card li { position: relative; padding-left: 1.2rem; }
.boundary-card li::before { position: absolute; left: 0; color: var(--gold-bright); content: "•"; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 1rem 0 5rem;
  border: 1px solid var(--line);
  background: rgb(255 253 248 / 0.72);
}

.metrics article { padding: 1.2rem 1.35rem; border-right: 1px solid var(--line); }
.metrics article:last-child { border-right: 0; }
.metrics span, .metrics strong, .metrics small { display: block; }
.metrics span { color: var(--muted); font-size: 0.65rem; letter-spacing: 0.09em; text-transform: uppercase; }
.metrics strong { margin: 0.4rem 0 0.2rem; font: 600 1.35rem Georgia, serif; }
.metrics small { color: var(--muted); font-size: 0.72rem; }

.office-suite { margin: 0 0 5rem; scroll-margin-top: 4rem; }
.office-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.office-card { min-height: 10.5rem; padding: 1.35rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgb(255 253 248 / 0.72); }
.office-card > span { color: var(--green); font: 700 0.72rem/1 ui-monospace, monospace; }
.office-card h3 { margin: 1.3rem 0 0.55rem; font: 600 1.25rem/1.1 Georgia, serif; }
.office-card p { min-height: 2.5rem; color: var(--muted); font-size: 0.72rem; line-height: 1.55; }
.office-card strong { color: #875500; font-size: 0.65rem; letter-spacing: 0.05em; text-transform: uppercase; }
.workspace-gate { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; color: #e9f6f3; background: var(--green); font-size: 0.75rem; }
.workspace-gate span { color: #cfe8e3; text-align: right; }

.modules-section { scroll-margin-top: 4rem; }
.section-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.65fr); gap: 2rem; align-items: end; margin-bottom: 2rem; }
.section-heading h2 { max-width: 17ch; margin-bottom: 0; }
.section-heading > p { margin-bottom: 0; color: var(--muted); line-height: 1.65; }

.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }

.module-card {
  min-height: 13rem;
  display: flex;
  flex-direction: column;
  padding: 1.4rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgb(255 253 248 / 0.72);
}

.module-top { display: flex; justify-content: space-between; gap: 1rem; }
.module-number { color: var(--green); font: 700 0.75rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.module-state { padding: 0.28rem 0.45rem; border-radius: 0.3rem; color: #875500; background: #fff0c8; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.module-card h3 { margin: 2.2rem 0 0.55rem; font: 600 1.45rem/1.1 Georgia, serif; }
.module-card code { margin-top: auto; color: var(--muted); font-size: 0.68rem; overflow-wrap: anywhere; }

.workflow-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 0.8fr);
  gap: 3rem;
  align-items: start;
  margin-top: 5rem;
  padding: clamp(1.6rem, 4vw, 3.8rem);
  color: white;
  background: var(--green);
}

.workflow-section .eyebrow { color: #c8f1e9; }
.workflow-section h2 { max-width: 13ch; }
.workflow-section p { max-width: 62ch; color: #d2ebe6; line-height: 1.65; }
.workflow-intro { min-width: 0; }
.workflow-steps { grid-row: span 2; display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.workflow-steps li { display: grid; grid-template-columns: 2.4rem 1fr; gap: 0.8rem; padding: 1rem 0; border-bottom: 1px solid rgb(255 255 255 / 0.16); }
.workflow-steps li > span { color: #fff; font: 700 0.72rem/1 ui-monospace, monospace; }
.workflow-steps strong, .workflow-steps small { display: block; }
.workflow-steps small { margin-top: 0.3rem; color: #edf7f5; }
.workflow-steps .ready small { color: #ffe1a5; }

.workflow-status {
  max-width: 48rem;
  margin-top: 1.2rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgb(255 255 255 / 0.2);
  color: #f8fbfa;
  background: rgb(7 24 33 / 0.2);
  font-size: 0.78rem;
  line-height: 1.5;
}
.workflow-status[data-state="success"] { border-color: rgb(255 225 165 / 0.7); color: #fff0ca; }
.workflow-status[data-state="error"] { border-color: rgb(255 205 205 / 0.65); color: #ffe1e1; }

.access-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.9rem;
}
.access-actions[hidden] { display: none; }
.access-action { border-color: #fff1cc; color: var(--ink); background: #fff1cc; }
.access-action:disabled { color: #66747a; background: #d9e3e0; cursor: wait; }
.access-actions small { flex-basis: 100%; color: #d2ebe6; line-height: 1.5; }

.workflow-console {
  grid-column: 1 / -1;
  min-width: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 18px 45px rgb(3 25 29 / 0.22);
}

.workflow-toolbar, .record-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.workflow-toolbar { padding: 1.3rem 1.4rem; border-bottom: 1px solid var(--line); }
.workflow-toolbar .eyebrow { margin-bottom: 0.35rem; }
.workflow-toolbar h3, .record-heading h3 { margin: 0; font: 600 1.35rem/1.1 Georgia, serif; }
.secondary-action {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  color: var(--ink);
  background: white;
  font-weight: 750;
}
.secondary-action:disabled { color: #8b9498; background: #f1eee7; cursor: not-allowed; }

.draft-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.draft-tabs button {
  flex: 1 0 auto;
  padding: 0.85rem 1rem;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: #f7f3eb;
  font-size: 0.76rem;
  font-weight: 800;
}
.draft-tabs button[aria-selected="true"] { color: var(--ink); background: white; box-shadow: inset 0 -3px var(--gold); }

.draft-form { padding: 1.4rem; }
.draft-form[hidden] { display: none; }
.draft-form fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  border: 0;
}
.draft-form fieldset:disabled { opacity: 0.58; }
.draft-form legend { grid-column: 1 / -1; margin-bottom: 0.25rem; font: 600 1.2rem/1.2 Georgia, serif; }
.draft-form label { display: grid; gap: 0.38rem; color: #38484f; font-size: 0.72rem; font-weight: 750; }
.draft-form input, .draft-form select, .draft-form textarea {
  width: 100%;
  min-height: 2.8rem;
  padding: 0.68rem 0.72rem;
  border: 1px solid #c9c5bb;
  border-radius: 0;
  color: var(--ink);
  background: white;
  font: 400 0.86rem/1.3 Inter, ui-sans-serif, sans-serif;
}
.draft-form textarea { resize: vertical; }
.draft-form input:focus-visible, .draft-form select:focus-visible, .draft-form textarea:focus-visible {
  outline: 3px solid rgb(242 165 21 / 0.35);
  border-color: #8b5a00;
}
.draft-form .span-all, .draft-form .revision-field { grid-column: 1 / -1; }
.draft-form .revision-field { padding-top: 0.4rem; border-top: 1px dashed var(--line); color: var(--muted); }

.primary-action {
  justify-self: start;
  padding: 0.9rem 1.15rem;
  border: 1px solid var(--ink);
  color: white;
  background: var(--ink);
  font-weight: 800;
  cursor: pointer;
}
.primary-action:disabled, fieldset:disabled .primary-action { color: #aeb8bc; background: #344851; cursor: not-allowed; }

.record-region { border-top: 1px solid var(--line); }
.record-heading { padding: 1.2rem 1.4rem; }
.record-heading span { color: var(--muted); font-size: 0.72rem; }
.record-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.record-card { min-width: 0; padding: 1rem 1.2rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.record-card:nth-child(2n) { border-right: 0; }
.record-card span, .record-card strong { display: block; }
.record-card span { color: var(--green); font-size: 0.64rem; font-weight: 850; letter-spacing: 0.07em; text-transform: uppercase; }
.record-card strong { margin-top: 0.4rem; font: 600 1rem/1.25 Georgia, serif; }
.record-card p { margin: 0.65rem 0; color: var(--muted); font-size: 0.74rem; line-height: 1.5; }
.record-card code { display: block; color: #657278; font-size: 0.62rem; overflow-wrap: anywhere; }
.empty-state { grid-column: 1 / -1; margin: 0; padding: 1.3rem 1.4rem; color: var(--muted); }

footer { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.68rem; }

.error-page {
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 1.2rem;
  padding: clamp(2rem, 8vw, 8rem);
}

.error-page h1 { max-width: 12ch; }
.error-page > p:not(.eyebrow) { max-width: 46rem; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }
.error-return { padding: 0.9rem 1.1rem; color: var(--ink); background: var(--gold-bright); font-weight: 850; text-decoration: none; }

@media (max-width: 1100px) {
  .app-frame { grid-template-columns: 15rem minmax(0, 1fr); }
  .sidebar { width: 15rem; }
  .module-grid, .office-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-frame { display: block; }
  .sidebar { position: sticky; z-index: 5; top: 2.6rem; width: 100%; height: auto; padding: 1rem; overflow: visible; }
  .brand { margin: 0; }
  .sidebar-status { display: none; }
  .menu-button { position: absolute; top: 1rem; right: 1rem; display: block; padding: 0.65rem 0.8rem; border: 1px solid rgb(255 255 255 / 0.2); color: white; background: transparent; }
  nav { max-height: calc(100vh - 9rem); margin-top: 1rem; overflow-y: auto; }
  .js nav { display: none; }
  .js nav[data-open] { display: grid; }
  main { padding: 1.25rem; }
  .workspace-header, .section-heading { display: grid; grid-template-columns: 1fr; align-items: start; }
  .identity-lock { justify-self: stretch; }
  h1 { font-size: clamp(2.7rem, 14vw, 4.6rem); }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics article:nth-child(2) { border-right: 0; }
  .metrics article:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .module-grid, .office-grid { grid-template-columns: 1fr; }
  .workspace-gate { display: grid; }
  .workspace-gate span { text-align: left; }
  .workflow-section { grid-template-columns: 1fr; }
  .draft-form fieldset, .record-list { grid-template-columns: 1fr; }
  .record-card { border-right: 0; }
  .workflow-toolbar { align-items: flex-start; }
  footer { display: grid; }
}

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