:root {
  --paper: #f5f2ea;
  --surface: #fffef9;
  --ink: #151515;
  --muted: #727069;
  --line: #d8d3c8;
  --line-dark: #a9a398;
  --accent: #b99758;
  --accent-soft: #e8dcc2;
  --success: #32715d;
  --danger: #a33d32;
  --sans: "DM Sans", sans-serif;
  --mono: "IBM Plex Mono", monospace;
  --radius: 2px;
  --space-1: .375rem;
  --space-2: .75rem;
  --space-3: 1.125rem;
  --space-4: 1.75rem;
  --space-5: 2.75rem;
  --space-6: 4.5rem;
  --shadow: 0 18px 60px rgba(33, 30, 23, .08);
  --ease: cubic-bezier(.22, .75, .22, 1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); line-height: 1.45; }
button, input, textarea { font: inherit; }
button { color: inherit; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .035; z-index: 20; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E"); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.masthead { padding: 2rem clamp(1.25rem, 4.5vw, 5.5rem) 4.5rem; border-bottom: 1px solid var(--ink); }
.masthead__top { display: flex; align-items: center; justify-content: space-between; padding-bottom: 4rem; }
.brand { width: 180px; height: auto; display: block; }
.eyebrow, .kicker, .dialog-index { font: 500 .69rem/1.2 var(--mono); letter-spacing: .16em; }
.eyebrow { color: var(--muted); }
.masthead__grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr); gap: clamp(2rem, 8vw, 8rem); align-items: end; }
.kicker { margin: 0 0 1.25rem; color: var(--accent); text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(3.1rem, 7.7vw, 8.4rem); line-height: .87; letter-spacing: -.075em; font-weight: 600; }
h1 em { color: var(--muted); font-style: normal; font-weight: 400; }
.intro-copy { padding-bottom: .65rem; }
.intro-copy > p { margin: 0 0 1.75rem; font-size: clamp(1rem, 1.4vw, 1.2rem); line-height: 1.55; }
.legend { display: grid; gap: .55rem; color: var(--muted); font-size: .78rem; }
.legend span { padding-top: .55rem; border-top: 1px solid var(--line); }
.legend b { color: var(--ink); font-weight: 600; }
main { width: min(1480px, calc(100% - clamp(2rem, 7vw, 9rem))); margin: 0 auto; }
.control-deck { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 2rem; align-items: center; margin: 0 calc(clamp(1rem, 2vw, 2rem) * -1); padding: 1rem clamp(1rem, 2vw, 2rem); background: rgba(245,242,234,.92); border-bottom: 1px solid var(--line-dark); backdrop-filter: blur(18px); }
.progress-copy { display: flex; justify-content: space-between; margin-bottom: .5rem; font: 500 .68rem/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
#saveStatus { color: var(--success); }
.progress-track { height: 3px; background: var(--line); overflow: hidden; }
.progress-bar { width: 0; height: 100%; background: var(--ink); transition: width .45s var(--ease); }
.controls { display: flex; align-items: stretch; gap: .55rem; }
.search-wrap { width: clamp(190px, 22vw, 320px); display: flex; gap: .6rem; align-items: center; padding: .65rem .8rem; background: var(--surface); border: 1px solid var(--line); }
.search-wrap svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; flex: none; }
.search-wrap input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; }
.button { border: 1px solid var(--line-dark); background: transparent; padding: .68rem .85rem; cursor: pointer; white-space: nowrap; transition: background .2s var(--ease), color .2s var(--ease), border .2s var(--ease); }
.button:hover, .button[aria-pressed="true"] { background: var(--ink); color: white; border-color: var(--ink); }
.button--dark { background: var(--ink); color: white; border-color: var(--ink); min-width: 92px; }
.button--dark:hover { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.menu-wrap { position: relative; }
.export-menu { position: absolute; right: 0; top: calc(100% + .45rem); width: 170px; background: var(--surface); border: 1px solid var(--ink); box-shadow: var(--shadow); }
.export-menu button { width: 100%; display: block; border: 0; padding: .85rem 1rem; background: none; text-align: left; cursor: pointer; }
.export-menu button + button { border-top: 1px solid var(--line); }
.export-menu button:hover { background: var(--accent-soft); }
.session-nav { display: flex; gap: .4rem; padding: 1.35rem 0 1rem; overflow-x: auto; scrollbar-width: thin; }
.session-nav a { flex: none; padding: .5rem .7rem; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font: 500 .69rem/1.2 var(--mono); text-transform: uppercase; transition: .2s var(--ease); }
.session-nav a:hover { color: var(--ink); border-color: var(--ink); }
.workflow-root { padding: 2rem 0 6rem; }
.session { margin-bottom: 6rem; scroll-margin-top: 90px; }
.session-header { display: grid; grid-template-columns: 92px minmax(0, 1fr) minmax(260px, .55fr); gap: 1.4rem; align-items: start; padding: 0 0 1.5rem; border-bottom: 2px solid var(--ink); }
.session-index { font: 500 .75rem/1 var(--mono); color: var(--accent); padding-top: .55rem; }
.session-header h2 { margin: 0; font-size: clamp(2rem, 4vw, 4.5rem); line-height: .95; letter-spacing: -.055em; }
.session-objective { margin: .45rem 0 0; color: var(--muted); max-width: 46ch; }
.session-count { text-align: right; font: 500 .68rem/1.3 var(--mono); color: var(--muted); text-transform: uppercase; padding-top: .55rem; }
.workflow-card { display: grid; grid-template-columns: minmax(240px, .75fr) minmax(560px, 1.7fr); gap: 2rem; padding: 1.4rem 0; border-bottom: 1px solid var(--line); transition: background .2s var(--ease), opacity .2s var(--ease); }
.workflow-card:hover { background: rgba(255,254,249,.52); }
.workflow-heading { display: grid; grid-template-columns: 42px 1fr 10px; gap: .75rem; align-items: start; padding-top: .25rem; }
.workflow-number { font: 400 .68rem/1.3 var(--mono); color: var(--muted); }
.workflow-heading h3 { margin: 0; font-size: 1.02rem; line-height: 1.35; font-weight: 600; }
.parent-label { display: block; margin-top: .3rem; color: var(--accent); font: 500 .63rem/1.25 var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.status-dot { width: 8px; height: 8px; margin-top: .32rem; border: 1px solid var(--line-dark); border-radius: 50%; }
.workflow-card.is-complete .status-dot { background: var(--success); border-color: var(--success); }
.rating-grid { display: grid; grid-template-columns: repeat(3, minmax(132px, 1fr)) minmax(92px, .72fr); gap: .75rem; }
.rating-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.rating-group legend, .hours-field span, .notes-field > span { display: block; margin-bottom: .55rem; color: var(--muted); font: 500 .64rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .045em; }
.rating-scale { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line-dark); }
.rating-scale button { height: 38px; border: 0; border-right: 1px solid var(--line); background: var(--surface); cursor: pointer; font: 500 .72rem/1 var(--mono); transition: .15s var(--ease); }
.rating-scale button:last-child { border-right: 0; }
.rating-scale button:hover { background: var(--accent-soft); }
.rating-scale button.is-selected { background: var(--ink); color: white; }
.hours-field input { width: 100%; height: 40px; border: 1px solid var(--line-dark); background: var(--surface); padding: 0 .65rem; outline: 0; }
.hours-field input:focus, .notes-field textarea:focus, .search-wrap:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.notes-field { grid-column: 2; display: block; margin-top: -.35rem; }
.notes-field textarea { width: 100%; resize: vertical; min-height: 56px; border: 1px solid var(--line); background: rgba(255,254,249,.55); padding: .7rem; outline: 0; line-height: 1.4; }
.empty-state { padding: 6rem 0 9rem; text-align: center; }
.empty-state p { font-size: 1.6rem; }
.empty-state button, .reset { border: 0; padding: 0; background: none; border-bottom: 1px solid currentColor; cursor: pointer; }
footer { display: flex; justify-content: space-between; align-items: center; padding: 2rem clamp(1.25rem, 4.5vw, 5.5rem); border-top: 1px solid var(--ink); font: 400 .68rem/1.3 var(--mono); color: var(--muted); }
footer div { display: flex; align-items: center; gap: 1.25rem; }
footer img { width: 116px; }
.reset:hover { color: var(--danger); }
dialog { width: min(480px, calc(100% - 2rem)); padding: 0; border: 1px solid var(--ink); background: var(--surface); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(15,15,14,.58); backdrop-filter: blur(5px); }
dialog form { padding: 2rem; }
dialog h2 { margin: .8rem 0; font-size: 2rem; letter-spacing: -.04em; }
dialog p { color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 2rem; }
.button--danger { background: var(--danger); border-color: var(--danger); color: white; }
.button--danger:hover { background: #7d2d26; }
@media (max-width: 1040px) {
  .control-deck { grid-template-columns: 1fr; gap: .85rem; }
  .controls { justify-content: stretch; }
  .search-wrap { flex: 1; width: auto; }
  .workflow-card { grid-template-columns: 1fr; gap: 1rem; }
  .notes-field { grid-column: 1; }
}
@media (max-width: 760px) {
  .masthead { padding-bottom: 2.8rem; }
  .masthead__top { padding-bottom: 3rem; }
  .brand { width: 145px; }
  .eyebrow { display: none; }
  .masthead__grid { grid-template-columns: 1fr; gap: 2rem; }
  h1 { font-size: clamp(3.2rem, 16vw, 5.6rem); }
  main { width: calc(100% - 2rem); }
  .control-deck { position: relative; margin: 0; padding-inline: 0; backdrop-filter: none; }
  .controls { display: grid; grid-template-columns: 1fr 1fr; }
  .search-wrap { grid-column: 1 / -1; }
  .button--dark { width: 100%; }
  .session { margin-bottom: 4.2rem; }
  .session-header { grid-template-columns: 44px 1fr; }
  .session-objective { grid-column: 2; }
  .session-count { display: none; }
  .workflow-card { padding: 1.2rem 0 1.5rem; }
  .rating-grid { grid-template-columns: 1fr 1fr; }
  .rating-group[data-field="judgment"] { grid-column: 1 / -1; }
  .hours-field { align-self: end; }
  footer { align-items: flex-start; gap: 2rem; }
  footer div { align-items: flex-start; flex-direction: column; gap: .6rem; }
}
@media (max-width: 440px) {
  .rating-grid { grid-template-columns: 1fr; }
  .rating-group[data-field="judgment"] { grid-column: auto; }
  .hours-field { width: 50%; }
  footer { flex-direction: column; }
}
@media print {
  .grain, .control-deck, .session-nav, footer, dialog { display: none !important; }
  body { background: white; }
  .masthead { padding: 1rem 0 2rem; }
  main { width: 100%; }
  .workflow-card { break-inside: avoid; }
}
