:root {
  color-scheme: light;
  --canvas: #f2f5f4;
  --surface: #ffffff;
  --surface-2: #e9eeec;
  --surface-3: #dfe7e3;
  --ink: #17211d;
  --ink-soft: #435149;
  --muted: #66736c;
  --line: #ccd6d1;
  --line-strong: #9eada6;
  --green: #286a50;
  --green-deep: #184b38;
  --green-soft: #dcebe3;
  --coral: #a34538;
  --coral-soft: #f4dfda;
  --amber: #8a5a10;
  --amber-soft: #f4e8ce;
  --blue: #2d607a;
  --blue-soft: #dceaf0;
  --violet: #66527f;
  --violet-soft: #e9e3ef;
  --focus: #16755b;
  --shadow: 0 12px 32px rgba(24, 43, 34, 0.09);
  --shadow-small: 0 4px 14px rgba(24, 43, 34, 0.08);
  --radius: 6px;
  --topbar-height: 68px;
  --sidebar-width: 246px;
  --content-max: 1500px;
  --font-body: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Songti SC", "Noto Serif SC", STSong, serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #151a18;
  --surface: #1d2421;
  --surface-2: #252e2a;
  --surface-3: #2e3934;
  --ink: #eef4f0;
  --ink-soft: #c7d2cc;
  --muted: #97a79f;
  --line: #36433d;
  --line-strong: #596861;
  --green: #75b89a;
  --green-deep: #9bcdb6;
  --green-soft: #263e33;
  --coral: #df887b;
  --coral-soft: #4b302c;
  --amber: #e2b466;
  --amber-soft: #493d27;
  --blue: #78b4d0;
  --blue-soft: #263d49;
  --violet: #b9a2d2;
  --violet-soft: #383045;
  --focus: #7dc6a6;
  --shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
  --shadow-small: 0 5px 16px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

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

button,
label,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

button:not(:disabled),
[role="button"]:not([aria-disabled="true"]),
label.file-button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  margin-bottom: 10px;
  font-size: 40px;
}

h2 {
  margin-bottom: 8px;
  font-size: 28px;
}

h3 {
  margin-bottom: 8px;
  font-size: 19px;
}

p:last-child,
ul:last-child,
ol:last-child {
  margin-bottom: 0;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus), transparent 45%);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.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;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 10px 14px;
  transform: translateY(-150%);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface);
}

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

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 80;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(320px, 640px) 1fr;
  align-items: center;
  min-height: var(--topbar-height);
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--canvas), transparent 4%);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.brand img {
  flex: 0 0 36px;
}

.brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.brand-copy strong {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.search-trigger {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  text-align: left;
}

.search-trigger:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-small);
  color: var(--ink-soft);
}

.search-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

kbd {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 8px;
}

.build-badge {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
}

.icon-button:hover {
  border-color: var(--line);
  background: var(--surface);
}

.icon-button svg,
.nav-item svg,
.primary-button svg,
.secondary-button svg,
.text-button svg,
.file-button svg,
.boundary-note svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.sidebar {
  position: fixed;
  z-index: 70;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  min-height: 0;
  padding: 18px 12px 14px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--canvas);
}

.primary-nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  gap: 10px;
  border-left: 3px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.nav-item.is-active {
  border-left-color: var(--green);
  background: var(--green-soft);
  color: var(--green-deep);
  font-weight: 700;
}

.nav-count {
  min-width: 24px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.sidebar-status {
  margin-top: auto;
  padding: 16px 10px 10px;
}

.status-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.status-row strong {
  color: var(--ink);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 5px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-3);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 220ms ease;
}

.sidebar-status p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.boundary-note {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  margin-top: 10px;
  padding: 12px 10px;
  gap: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.boundary-note svg {
  margin-top: 2px;
  color: var(--green);
}

.boundary-note p {
  margin: 0;
  font-size: 11px;
  line-height: 1.55;
}

.boundary-note strong {
  color: var(--ink-soft);
}

.main-content {
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: calc(var(--topbar-height) + 30px) clamp(20px, 3vw, 48px) 64px;
}

.view {
  width: min(100%, var(--content-max));
  margin: 0 auto;
}

.view.is-active {
  animation: view-in 180ms ease-out both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  min-width: 0;
  margin-bottom: 28px;
  gap: 24px;
}

.page-heading > div:first-child {
  min-width: 0;
  max-width: 880px;
}

.page-heading p:not(.eyebrow) {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

.compact-heading h1 {
  font-size: 38px;
}

.curriculum-search-band {
  margin: -8px 0 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.curriculum-search-field {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 34px;
  align-items: center;
  max-width: 720px;
  min-height: 44px;
  padding: 0 5px 0 13px;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.curriculum-search-field:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green), transparent 86%);
  color: var(--green-deep);
}

.curriculum-search-field input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.curriculum-search-field input::placeholder {
  color: var(--muted);
}

.curriculum-search-clear {
  width: 30px;
  height: 30px;
}

.curriculum-search-status {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.curriculum-search-results {
  max-width: 720px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.curriculum-search-result-list {
  display: grid;
}

.curriculum-search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px 0;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.curriculum-search-result:hover {
  color: var(--green-deep);
}

.curriculum-search-result span,
.curriculum-search-result small,
.curriculum-search-result strong {
  display: block;
  min-width: 0;
}

.curriculum-search-result small,
.curriculum-search-empty {
  color: var(--muted);
  font-size: 12px;
}

.curriculum-search-result strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.curriculum-search-empty {
  margin: 12px 0 0;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--green);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
  text-transform: uppercase;
}

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.primary-button,
.secondary-button,
.text-button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  gap: 8px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  border: 1px solid var(--green-deep);
  background: var(--green-deep);
  color: #fff;
}

.primary-button:hover {
  background: var(--green);
}

.secondary-button,
.file-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
}

.secondary-button:hover,
.file-button:hover {
  border-color: var(--green);
  color: var(--green-deep);
}

.text-button {
  min-height: 34px;
  padding: 0;
  background: transparent;
  color: var(--green-deep);
}

.text-button:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dashboard-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 0.7fr)) minmax(260px, 1.5fr);
  margin-bottom: 40px;
  border-block: 1px solid var(--line);
  background: var(--surface);
}

.metric-block,
.next-step {
  min-width: 0;
  padding: 20px clamp(16px, 2.4vw, 28px);
  border-right: 1px solid var(--line);
}

.dashboard-band > :last-child {
  border-right: 0;
}

.metric-block {
  display: grid;
  align-content: center;
}

.metric-block span,
.next-step > span {
  color: var(--muted);
  font-size: 12px;
}

.metric-block strong {
  margin: 1px 0;
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.metric-block small {
  color: var(--muted);
  font-size: 11px;
}

.next-step {
  display: grid;
  align-content: center;
  justify-items: start;
  background: var(--green-soft);
}

.next-step strong {
  margin: 3px 0 4px;
  font-family: var(--font-display);
  font-size: 18px;
}

.section-block {
  padding: 6px 0 42px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 18px;
}

.section-heading h2,
.section-heading p {
  margin-bottom: 0;
}

.small-heading {
  align-items: start;
}

.small-heading h2 {
  font-size: 23px;
}

.workflow-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-block: 1px solid var(--line);
  background: var(--surface);
}

.workflow-strip button {
  position: relative;
  display: grid;
  align-content: start;
  min-width: 0;
  min-height: 136px;
  padding: 20px 18px;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.workflow-strip button:last-child {
  border-right: 0;
}

.workflow-strip button:hover {
  background: var(--surface-2);
}

.workflow-strip button::after {
  position: absolute;
  top: 50%;
  right: -8px;
  z-index: 2;
  width: 14px;
  height: 14px;
  transform: translateY(-50%) rotate(45deg);
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--surface);
  content: "";
}

.workflow-strip button:last-child::after {
  display: none;
}

.workflow-strip button:hover::after {
  background: var(--surface-2);
}

.workflow-strip span {
  margin-bottom: 12px;
  color: var(--green);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.workflow-strip strong {
  font-family: var(--font-display);
  font-size: 17px;
}

.workflow-strip small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.split-section {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
  gap: clamp(28px, 5vw, 72px);
  padding-top: 8px;
}

.axis-panel,
.course-preview {
  min-width: 0;
}

.axis-panel .diagram {
  width: 100%;
  max-height: 270px;
  margin: 10px 0 18px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.axis-panel > p {
  color: var(--ink-soft);
}

.course-list {
  border-top: 1px solid var(--line);
}

.course-list-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 76px;
  padding: 10px 4px;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.course-list-item:hover {
  background: var(--surface-2);
}

.course-index-number {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.course-list-item strong,
.course-list-item small {
  display: block;
}

.course-list-item strong {
  font-size: 14px;
}

.course-list-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.course-list-item > svg {
  width: 17px;
  color: var(--muted);
}

.curriculum-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 190px;
  align-items: start;
  min-height: 680px;
  border-top: 1px solid var(--line);
}

.course-index,
.reader-outline {
  position: sticky;
  top: calc(var(--topbar-height) + 18px);
  max-height: calc(100vh - var(--topbar-height) - 36px);
  overflow: auto;
}

.course-index {
  padding: 18px 18px 24px 0;
  border-right: 1px solid var(--line);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 16px;
  gap: 6px;
}

.filter-chip {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.filter-chip:hover,
.filter-chip.is-active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-deep);
}

.course-tree-group {
  margin-bottom: 16px;
}

.course-tree-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 38px;
  padding: 0 7px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.course-tree-title svg {
  width: 15px;
  transition: transform 160ms ease;
}

.course-tree-group.is-collapsed .course-tree-title svg {
  transform: rotate(-90deg);
}

.course-tree-group.is-collapsed .course-tree-items {
  display: none;
}

.course-tree-items {
  display: grid;
  gap: 2px;
}

.course-tree-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  width: 100%;
  min-height: 38px;
  padding: 7px;
  gap: 8px;
  border-left: 2px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
}

.course-tree-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.course-tree-item.is-active {
  border-left-color: var(--green);
  background: var(--green-soft);
  color: var(--green-deep);
  font-weight: 700;
}

.lesson-status-dot {
  width: 8px;
  height: 8px;
  margin: 5px auto 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.lesson-status-dot.is-complete {
  border-color: var(--green);
  background: var(--green);
}

.lesson-reader {
  min-width: 0;
  min-height: 680px;
  padding: 34px clamp(24px, 4vw, 62px) 80px;
  background: var(--surface);
}

.reader-empty {
  display: grid;
  justify-items: center;
  max-width: 520px;
  margin: 80px auto;
  color: var(--muted);
  text-align: center;
}

.image-viewer-trigger {
  display: grid;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
  text-align: inherit;
}

.image-viewer-trigger:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 4px;
}

.image-viewer-preview {
  display: block;
  width: 100%;
  max-height: 440px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
}

.image-viewer-hint {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.reader-empty .image-viewer-trigger {
  width: min(100%, 420px);
  margin-bottom: 24px;
}

.reader-empty .image-viewer-preview {
  max-height: 250px;
}

.reader-empty h2 {
  margin-bottom: 8px;
}

.lesson-header {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.lesson-header h2 {
  margin: 10px 0 12px;
  font-size: 38px;
}

.lesson-lead {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.75;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.evidence-tag,
.risk-tag,
.material-tag,
.lesson-type-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.evidence-tag.verified {
  border-color: color-mix(in srgb, var(--green), transparent 55%);
  background: var(--green-soft);
  color: var(--green-deep);
}

.evidence-tag.classroom {
  border-color: color-mix(in srgb, var(--blue), transparent 55%);
  background: var(--blue-soft);
  color: var(--blue);
}

.evidence-tag.pending {
  border-color: color-mix(in srgb, var(--amber), transparent 55%);
  background: var(--amber-soft);
  color: var(--amber);
}

.risk-tag.high,
.risk-tag.extreme {
  border-color: color-mix(in srgb, var(--coral), transparent 50%);
  background: var(--coral-soft);
  color: var(--coral);
}

.lesson-section {
  padding-top: 34px;
  scroll-margin-top: calc(var(--topbar-height) + 24px);
}

.lesson-section h3 {
  margin-bottom: 14px;
  font-size: 23px;
}

.lesson-section > p,
.lesson-section > ul,
.lesson-section > ol {
  max-width: 820px;
  color: var(--ink-soft);
}

.lesson-section li + li {
  margin-top: 8px;
}

.plain-language {
  display: none;
  margin: 16px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  color: var(--ink-soft);
}

body.is-plain-language .plain-language {
  display: block;
}

.process-steps {
  display: grid;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: process-step;
}

.process-step {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  min-width: 0;
  padding: 0 0 22px;
  gap: 14px;
  counter-increment: process-step;
}

.process-step::before {
  display: grid;
  z-index: 2;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--green);
  border-radius: 50%;
  background: var(--surface);
  color: var(--green-deep);
  content: counter(process-step, decimal-leading-zero);
  font-size: 11px;
  font-weight: 800;
}

.process-step::after {
  position: absolute;
  top: 34px;
  bottom: 0;
  left: 16px;
  width: 1px;
  background: var(--line);
  content: "";
}

.process-step:last-child::after {
  display: none;
}

.step-body {
  min-width: 0;
  padding-top: 3px;
}

.step-body h4 {
  margin: 0 0 6px;
  font-family: var(--font-body);
  font-size: 15px;
}

.step-body p {
  margin-bottom: 10px;
  color: var(--ink-soft);
}

.step-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.step-checks span {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-size: 10px;
}

.detail-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.detail-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: var(--surface);
}

.detail-table th,
.detail-table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  text-align: left;
  vertical-align: top;
}

.detail-table th {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 750;
}

.detail-table tr:last-child td {
  border-bottom: 0;
}

.callout {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  margin: 18px 0;
  padding: 15px 16px;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  background: var(--green-soft);
}

.callout.warning {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.callout.danger {
  border-left-color: var(--coral);
  background: var(--coral-soft);
}

.callout.info {
  border-left-color: var(--blue);
  background: var(--blue-soft);
}

.callout svg {
  width: 20px;
  margin-top: 1px;
}

.callout strong,
.callout p {
  display: block;
  margin: 0;
}

.callout p {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 13px;
}

.lesson-reader > .image-viewer-trigger {
  margin: 18px 0;
}

.lesson-photo-gallery {
  margin: 22px 0 28px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.lesson-photo-gallery-header h3 {
  margin: 0;
  font-size: 18px;
}

.lesson-photo-gallery-header p {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.lesson-photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.lesson-photo-card {
  min-width: 0;
  margin: 0;
}

.lesson-photo-card .image-viewer-trigger {
  height: 210px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--canvas);
}

.lesson-photo-card .image-viewer-preview {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
}

.lesson-photo-card figcaption {
  display: grid;
  gap: 4px;
  padding-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.lesson-photo-card figcaption strong {
  color: var(--text);
  font-size: 13px;
}

@media (max-width: 620px) {
  .lesson-photo-gallery {
    padding: 14px;
    border-radius: 14px;
  }

  .lesson-photo-grid {
    grid-template-columns: 1fr;
  }

  .lesson-photo-card .image-viewer-trigger {
    height: 190px;
  }
}

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

.remediation-item {
  padding: 18px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.remediation-item:nth-child(2n) {
  border-right: 0;
}

.remediation-item h4 {
  font-family: var(--font-body);
  font-size: 14px;
}

.remediation-item p {
  color: var(--muted);
  font-size: 12px;
}

.sop-records {
  display: grid;
  margin-top: 18px;
  gap: 10px;
}

.sop-record {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.sop-record > summary {
  display: flex;
  min-height: 52px;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
}

.sop-record > summary::-webkit-details-marker {
  display: none;
}

.sop-record > summary::after {
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  color: var(--muted);
  content: "";
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.sop-record[open] > summary {
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.sop-record[open] > summary::after {
  transform: rotate(225deg) translateY(-2px);
}

.sop-record-title {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
}

.sop-record-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sop-record-group {
  min-width: 0;
  padding: 15px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.sop-record-group:nth-child(2n) {
  border-right: 0;
}

.sop-record-group:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.sop-record-group h4 {
  margin: 0 0 8px;
  font-family: var(--font-body);
  font-size: 13px;
}

.sop-record-group ul {
  margin: 0;
  padding-left: 17px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.65;
}

.sop-record-group li + li {
  margin-top: 6px;
}

.lesson-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 42px;
  padding-top: 20px;
  gap: 16px;
  border-top: 1px solid var(--line);
}

.reader-outline {
  padding: 22px 0 22px 18px;
  border-left: 1px solid var(--line);
}

.outline-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.reader-outline nav {
  display: grid;
  gap: 2px;
}

.reader-outline a {
  padding: 6px 8px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.reader-outline a:hover,
.reader-outline a.is-active {
  border-left-color: var(--green);
  color: var(--green-deep);
}

.reader-meta {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.training-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.training-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  min-height: 158px;
  padding: 20px;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.training-card h2 {
  margin-bottom: 5px;
  font-size: 20px;
}

.training-card p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.training-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
}

.training-icon svg {
  width: 22px;
  height: 22px;
}

.training-icon.green { background: var(--green-soft); color: var(--green-deep); }
.training-icon.amber { background: var(--amber-soft); color: var(--amber); }
.training-icon.blue { background: var(--blue-soft); color: var(--blue); }
.training-icon.red { background: var(--coral-soft); color: var(--coral); }

.challenge-table-section {
  margin-top: 42px;
}

.challenge-levels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1px solid var(--line);
  background: var(--surface);
}

.challenge-levels button {
  display: grid;
  min-width: 0;
  min-height: 126px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.challenge-levels button:last-child {
  border-right: 0;
}

.challenge-levels button:hover {
  background: var(--surface-2);
}

.challenge-levels span {
  color: var(--muted);
  font-size: 11px;
}

.challenge-levels strong {
  margin: 5px 0;
  font-family: var(--font-display);
  font-size: 23px;
  font-variant-numeric: tabular-nums;
}

.challenge-levels small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.live-training {
  margin-top: 24px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.training-question {
  max-width: 860px;
  margin: 0 auto;
}

.training-question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}

.question-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.question-option {
  min-height: 72px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-soft);
  text-align: left;
}

.question-option:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.question-option.is-correct {
  border-color: var(--green);
  background: var(--green-soft);
}

.question-option.is-wrong {
  border-color: var(--coral);
  background: var(--coral-soft);
}

.training-feedback {
  margin-top: 16px;
  padding: 14px;
  border-left: 3px solid var(--green);
  background: var(--surface-2);
}

/* Workshop */
.workshop-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  gap: 18px;
}

.workshop-main,
.workshop-ledger {
  min-width: 0;
}

.workshop-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.workshop-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}

.field-label {
  display: grid;
  min-width: 130px;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.field-label select,
.field-label input {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.comparison-stage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.swatch-panel {
  position: relative;
  display: grid;
  grid-template-rows: minmax(190px, 1fr) auto;
  min-width: 0;
  border-right: 1px solid var(--line);
}

.swatch-panel:last-child {
  border-right: 0;
}

.swatch-color {
  position: relative;
  min-height: 190px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.swatch-caption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 62px;
  padding: 10px 14px;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.swatch-caption strong,
.swatch-caption small {
  display: block;
}

.swatch-caption small {
  color: var(--muted);
  font-size: 10px;
}

.swatch-caption code {
  color: var(--muted);
  font-size: 11px;
}

.state-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.state-tabs button {
  min-height: 42px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.state-tabs button:last-child {
  border-right: 0;
}

.state-tabs button.is-active {
  background: var(--green-soft);
  color: var(--green-deep);
  font-weight: 750;
}

.diagnostic-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
  border-block: 1px solid var(--line);
}

.diagnostic-axis {
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--line);
}

.diagnostic-axis:last-child {
  border-right: 0;
}

.diagnostic-axis span,
.diagnostic-axis strong,
.diagnostic-axis small {
  display: block;
}

.diagnostic-axis span {
  color: var(--muted);
  font-size: 10px;
}

.diagnostic-axis strong {
  margin: 2px 0;
  font-size: 13px;
}

.diagnostic-axis small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pigment-section {
  margin-top: 24px;
}

.reference-color-input {
  width: 42px;
  min-width: 42px;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.reference-hex-input,
.reference-label-input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  box-sizing: border-box;
}

.pigment-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}

.pigment-section-header h2 {
  margin: 0;
  font-size: 21px;
}

.pigment-section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.effect-color-guidance {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.effect-color-guidance > strong {
  display: block;
  font-size: 12px;
}

.effect-color-guidance ul {
  display: grid;
  margin: 7px 0 0;
  padding-left: 18px;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.pigment-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.pigment-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.pigment-card-header {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  margin-bottom: 9px;
  gap: 8px;
}

.pigment-swatch {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 50%;
}

.pigment-card strong,
.pigment-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pigment-card strong {
  font-size: 12px;
}

.pigment-card small {
  color: var(--muted);
  font-size: 9px;
}

.dose-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.dose-buttons button {
  min-height: 34px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.dose-buttons button:hover {
  border-color: var(--green);
  color: var(--green-deep);
}

.dose-buttons button.is-selected,
.quick-dose-buttons button.is-selected {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-deep);
  font-weight: 750;
}

.workshop-actions {
  display: flex;
  flex-wrap: wrap;
  margin-top: 16px;
  gap: 8px;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  gap: 7px;
  border: 1px solid color-mix(in srgb, var(--coral), transparent 35%);
  border-radius: var(--radius);
  background: var(--coral-soft);
  color: var(--coral);
  font-weight: 750;
}

.workshop-ledger {
  position: sticky;
  top: calc(var(--topbar-height) + 18px);
  align-self: start;
  max-height: calc(100vh - var(--topbar-height) - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.ledger-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.ledger-header h2 {
  margin-bottom: 2px;
  font-size: 19px;
}

.ledger-header p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.ledger-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.ledger-summary div {
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.ledger-summary div:nth-child(2n) {
  border-right: 0;
}

.ledger-summary div:nth-last-child(-n+2) {
  border-bottom: 0;
}

.ledger-summary span,
.ledger-summary strong {
  display: block;
}

.ledger-summary span {
  color: var(--muted);
  font-size: 9px;
}

.ledger-summary strong {
  margin-top: 2px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.ledger-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ledger-event {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  padding: 12px 14px;
  gap: 9px;
  border-bottom: 1px solid var(--line);
}

.ledger-event:last-child {
  border-bottom: 0;
}

.ledger-event-index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.ledger-event strong,
.ledger-event small {
  display: block;
}

.ledger-event strong {
  font-size: 11px;
}

.ledger-event small {
  color: var(--muted);
  font-size: 9px;
}

.ledger-event > time {
  color: var(--muted);
  font-size: 9px;
}

.ledger-empty {
  padding: 26px 18px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.timer {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.timer.is-urgent {
  border-color: var(--coral);
  color: var(--coral);
}

/* Cases */
.case-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.case-toolbar > span {
  color: var(--muted);
  font-size: 12px;
}

.segmented-control {
  display: inline-flex;
  max-width: 100%;
  padding: 3px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.segmented-control button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.segmented-control button.is-active,
.segmented-control button[aria-selected="true"] {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  color: var(--ink);
  font-weight: 750;
}

.case-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.58fr) minmax(0, 1.42fr);
  min-height: 640px;
  border-top: 1px solid var(--line);
}

.case-list {
  border-right: 1px solid var(--line);
}

.case-list-item {
  display: grid;
  width: 100%;
  min-height: 96px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  background: transparent;
  text-align: left;
}

.case-list-item:hover {
  background: var(--surface-2);
}

.case-list-item.is-active {
  border-left-color: var(--green);
  background: var(--green-soft);
}

.case-list-item strong,
.case-list-item small {
  display: block;
}

.case-list-item strong {
  margin: 3px 0;
  font-size: 13px;
}

.case-list-item small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.case-stage {
  min-width: 0;
  padding: 28px clamp(20px, 4vw, 52px) 60px;
  background: var(--surface);
}

.case-header {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.case-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
  border-block: 1px solid var(--line);
}

.case-facts div {
  padding: 12px;
  border-right: 1px solid var(--line);
}

.case-facts div:last-child {
  border-right: 0;
}

.case-facts dt {
  color: var(--muted);
  font-size: 10px;
}

.case-facts dd {
  margin: 3px 0 0;
  font-size: 12px;
  font-weight: 700;
}

.case-question {
  padding-top: 24px;
}

.case-question h3 {
  font-family: var(--font-body);
  font-size: 17px;
}

.case-options {
  display: grid;
  gap: 8px;
}

.case-option {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  min-height: 58px;
  padding: 12px;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-soft);
  text-align: left;
}

.case-option:hover {
  border-color: var(--green);
}

.case-option.is-correct {
  border-color: var(--green);
  background: var(--green-soft);
}

.case-option.is-wrong {
  border-color: var(--coral);
  background: var(--coral-soft);
}

.case-option-letter {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 10px;
  font-weight: 800;
}

.case-result {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  background: var(--green-soft);
}

.case-result.is-wrong {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

/* Records */
.record-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
  border-block: 1px solid var(--line);
  background: var(--surface);
}

.record-summary div {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.record-summary div:last-child {
  border-right: 0;
}

.record-summary span,
.record-summary strong {
  display: block;
}

.record-summary span {
  color: var(--muted);
  font-size: 11px;
}

.record-summary strong {
  margin-top: 4px;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-tabs {
  margin-bottom: 14px;
}

.record-list {
  border-top: 1px solid var(--line);
}

.record-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 72px;
  padding: 12px 6px;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.record-item-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--green-deep);
}

.record-item-icon svg {
  width: 17px;
}

.record-item strong,
.record-item small {
  display: block;
}

.record-item strong {
  font-size: 13px;
}

.record-item small,
.record-item time {
  color: var(--muted);
  font-size: 10px;
}

.record-empty {
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
}

/* Dialogs */
dialog {
  width: min(calc(100% - 28px), 760px);
  max-height: min(82vh, 760px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(12, 20, 16, 0.54);
  backdrop-filter: blur(2px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px 18px;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin: 0;
  font-size: 21px;
}

.dialog-header p {
  margin-bottom: 2px;
}

.dialog-search-field {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  margin: 16px 18px 10px;
  padding: 0 12px;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--canvas);
}

.dialog-search-field input {
  width: 100%;
  min-height: 48px;
  border: 0;
  outline: 0;
  background: transparent;
}

.search-hints {
  display: flex;
  flex-wrap: wrap;
  padding: 0 18px 12px;
  gap: 6px;
}

.search-hints button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
}

.search-results {
  max-height: 52vh;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.search-result {
  display: grid;
  width: 100%;
  min-height: 74px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.search-result:hover {
  background: var(--surface-2);
}

.search-result strong,
.search-result small {
  display: block;
}

.search-result small {
  color: var(--muted);
  font-size: 10px;
}

.search-empty {
  padding: 42px 18px;
  color: var(--muted);
  text-align: center;
}

.info-dialog #info-dialog-body {
  max-height: 68vh;
  padding: 20px;
  overflow: auto;
}

.info-dialog #info-dialog-body > *:last-child {
  margin-bottom: 0;
}

.image-viewer-dialog {
  width: min(96vw, 1200px);
  max-height: min(94dvh, 1000px);
}

.image-viewer-header {
  align-items: flex-start;
}

.image-viewer-meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.image-viewer-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 8px 18px;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.image-viewer-zoom-button {
  display: inline-flex;
  min-width: 68px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.image-viewer-zoom-button:hover,
.image-viewer-zoom-button:focus-visible {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-deep);
  outline: 0;
}

.image-viewer-zoom-button svg {
  width: 15px;
  height: 15px;
}

.image-viewer-zoom-status {
  min-width: 42px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.image-viewer-zoom-hint {
  margin: 0;
  padding: 7px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}

.image-viewer-body {
  max-height: calc(94dvh - 170px);
  min-height: 160px;
  padding: 18px;
  overflow: auto;
  background: var(--canvas);
  overscroll-behavior: contain;
}

.image-viewer-body:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.image-viewer-stage {
  display: grid;
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  place-items: center;
}

.image-viewer-body img {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  cursor: zoom-in;
}

.image-viewer-body img[data-zoomed="true"] {
  cursor: zoom-out;
}

.toast-region {
  position: fixed;
  z-index: 180;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(360px, calc(100% - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow-small);
  font-size: 12px;
  animation: toast-in 180ms ease both;
}

.toast.error {
  border-color: var(--coral);
  background: var(--coral-soft);
  color: var(--coral);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.mobile-only {
  display: none;
}

.sidebar-scrim {
  display: none;
}

@media (max-width: 1220px) {
  :root {
    --sidebar-width: 220px;
  }

  .topbar {
    grid-template-columns: var(--sidebar-width) minmax(280px, 560px) 1fr;
  }

  .curriculum-layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .reader-outline {
    display: none;
  }

  .training-card {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .training-card .secondary-button {
    grid-column: 2;
    justify-self: start;
  }

  .pigment-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  :root {
    --sidebar-width: 250px;
  }

  .mobile-only {
    display: inline-grid;
  }

  .topbar {
    grid-template-columns: 44px minmax(140px, 1fr) 40px auto;
    gap: 8px;
  }

  .search-trigger {
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--muted);
  }

  .search-trigger span,
  .search-trigger kbd {
    display: none;
  }

  .build-badge {
    display: none;
  }

  .sidebar {
    transform: translateX(-102%);
    transition: transform 190ms ease;
    box-shadow: var(--shadow);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    inset: var(--topbar-height) 0 0 0;
    z-index: 60;
    display: block;
    background: rgba(12, 20, 16, 0.4);
  }

  .main-content {
    width: 100%;
    margin-left: 0;
  }

  .dashboard-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .next-step {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

  .metric-block:nth-child(3) {
    border-right: 0;
  }

  .split-section {
    grid-template-columns: 1fr;
  }

  .curriculum-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .lesson-reader {
    padding-inline: 28px;
  }

  .training-grid {
    grid-template-columns: 1fr;
  }

  .workshop-shell {
    grid-template-columns: 1fr;
  }

  .workshop-ledger {
    position: static;
    max-height: none;
  }

  .pigment-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  :root {
    --topbar-height: 62px;
  }

  body {
    font-size: 14px;
  }

  .topbar {
    padding: 0 10px;
  }

  .brand img {
    width: 32px;
    height: 32px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .brand-copy small {
    display: none;
  }

  .search-trigger {
    width: 38px;
    height: 38px;
    min-height: 38px;
  }

  .topbar-actions .icon-button {
    width: 38px;
    height: 38px;
  }

  .main-content {
    padding: calc(var(--topbar-height) + 22px) 14px calc(34px + env(safe-area-inset-bottom));
  }

  .page-heading,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 20px;
    gap: 12px;
  }

  .page-heading .primary-button,
  .page-heading .heading-actions {
    align-self: stretch;
  }

  .curriculum-search-band {
    margin-top: -4px;
    margin-bottom: 16px;
    padding-bottom: 14px;
  }

  .curriculum-search-field,
  .curriculum-search-results {
    max-width: none;
  }

  .curriculum-search-field {
    min-height: 42px;
  }

  .heading-actions {
    justify-content: stretch;
  }

  .heading-actions > * {
    flex: 1 1 auto;
  }

  h1,
  .compact-heading h1 {
    font-size: 28px;
  }

  .dashboard-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-block {
    padding: 14px 10px;
  }

  .metric-block strong {
    font-size: 24px;
  }

  .metric-block span,
  .metric-block small {
    overflow-wrap: anywhere;
  }

  .workflow-strip {
    grid-template-columns: 1fr;
  }

  .workflow-strip button {
    grid-template-columns: 38px minmax(0, 1fr);
    min-height: 82px;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workflow-strip button:last-child {
    border-bottom: 0;
  }

  .workflow-strip button::after {
    display: none;
  }

  .workflow-strip span {
    grid-row: 1 / 3;
    margin: 2px 0 0;
  }

  .workflow-strip small {
    grid-column: 2;
  }

  .curriculum-layout {
    display: block;
    border-top: 0;
  }

  .course-index {
    position: static;
    max-height: none;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .course-tree {
    max-height: 340px;
    overflow: auto;
  }

  .lesson-reader {
    min-height: 520px;
    padding: 24px 16px 54px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .reader-empty {
    margin-block: 48px;
  }

  .remediation-grid {
    grid-template-columns: 1fr;
  }

  .sop-record-body {
    grid-template-columns: 1fr;
  }

  .sop-record-group,
  .sop-record-group:nth-child(2n),
  .sop-record-group:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sop-record-group:last-child {
    border-bottom: 0;
  }

  .remediation-item,
  .remediation-item:nth-child(2n) {
    border-right: 0;
  }

  .lesson-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .lesson-footer > * {
    width: 100%;
  }

  .training-card {
    grid-template-columns: 44px minmax(0, 1fr);
    padding: 16px;
  }

  .training-icon {
    width: 42px;
    height: 42px;
  }

  .challenge-levels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .challenge-levels button:nth-child(2) {
    border-right: 0;
  }

  .challenge-levels button:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .question-options {
    grid-template-columns: 1fr;
  }

  .comparison-stage {
    min-height: 220px;
  }

  .swatch-panel {
    grid-template-rows: 150px auto;
  }

  .swatch-color {
    min-height: 150px;
  }

  .swatch-caption {
    grid-template-columns: 1fr;
    min-height: 76px;
  }

  .swatch-caption code {
    display: none;
  }

  .diagnostic-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .diagnostic-axis:nth-child(2) {
    border-right: 0;
  }

  .diagnostic-axis:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .workshop-shell {
    padding-bottom: 0;
  }

  .workshop-desktop-controls {
    display: none;
  }

  .mobile-workshop-flow,
  .mobile-workshop-panel,
  .mobile-reference-editor,
  .mobile-challenge-setup,
  .mobile-guidance-summary,
  .mobile-pigment-controls,
  .mobile-pigment-strip,
  .mobile-dose-control,
  .mobile-cup-record {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .mobile-workshop-flow {
    display: grid;
    gap: 8px;
  }

  .mobile-workshop-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 3px;
    gap: 3px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
  }

  .mobile-workshop-tabs button {
    display: grid;
    min-height: 48px;
    place-content: center;
    gap: 1px;
    border-radius: 9px;
    color: var(--muted);
    text-align: center;
  }

  .mobile-workshop-tabs button.is-active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-small);
  }

  .mobile-workshop-tabs strong,
  .mobile-workshop-tabs small {
    display: block;
  }

  .mobile-workshop-tabs strong {
    font-size: 14px;
  }

  .mobile-workshop-tabs small {
    font-size: 9px;
  }

  .mobile-workshop-panel {
    display: grid;
    gap: 8px;
    outline: 0;
  }

  .mobile-workshop-live-loop {
    display: grid;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--canvas), var(--surface) 38%);
  }

  .mobile-free-tools {
    display: grid;
    min-width: 0;
    max-width: 100%;
    gap: 7px;
    position: static;
  }

  .mobile-challenge-setup,
  .mobile-guidance-summary,
  .mobile-pigment-controls,
  .mobile-challenge-status {
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
  }

  .mobile-color-entries {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    min-width: 0;
    min-height: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .mobile-color-entries .mobile-color-entry {
    display: grid;
    grid-template-rows: auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink-soft);
    overflow: hidden;
  }

  .mobile-workshop-flow .mobile-color-entries .mobile-color-entry {
    display: block;
    grid-template-rows: auto;
    min-height: 0;
    border: 1px solid var(--line);
  }

  .mobile-workshop-flow .mobile-color-entries .mobile-color-entry:last-child {
    border-right: 1px solid var(--line);
  }

  .mobile-workshop-flow .mobile-color-entries .mobile-color-entry .mobile-color-entry-main {
    min-height: 44px;
  }

  .mobile-workshop-flow .mobile-color-entries .mobile-color-entry .mobile-color-swatch {
    position: static;
    display: block;
    min-height: 28px;
    box-shadow: 0 0 0 1px var(--line-strong), 0 2px 7px rgba(0, 0, 0, 0.12);
  }

  .mobile-color-entries .mobile-color-entry:hover,
  .mobile-color-entries .mobile-color-entry[aria-expanded="true"],
  .mobile-color-entries .mobile-color-entry[aria-pressed="true"],
  .mobile-color-entries .mobile-color-entry.is-active {
    border-color: var(--green);
    background: color-mix(in srgb, var(--green-soft), var(--surface) 74%);
    color: var(--ink);
  }

  .mobile-color-entry-main {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) 14px;
    align-items: center;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 5px 7px;
    gap: 6px;
    background: transparent;
    color: inherit;
    text-align: left;
    touch-action: manipulation;
  }

  .mobile-color-entry-main > svg {
    width: 14px;
    height: 14px;
    color: var(--muted);
  }

  .mobile-color-entry-swatch,
  .mobile-reference-swatch,
  .mobile-color-swatch,
  [data-mobile-color-swatch] {
    width: 28px;
    height: 28px;
    min-height: 28px;
    grid-row: auto;
    flex: 0 0 auto;
    border: 2px solid var(--surface);
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--line-strong), 0 2px 7px rgba(0, 0, 0, 0.12);
  }

  .mobile-workshop-flow .mobile-color-entry .mobile-color-swatch {
    width: 28px;
    height: 28px;
    min-height: 28px;
  }

  .mobile-color-entry-copy,
  .mobile-color-entry > div,
  .mobile-color-entry > span:not(.mobile-color-entry-swatch):not(.mobile-reference-swatch):not(.mobile-color-swatch) {
    min-width: 0;
  }

  .mobile-color-entry strong,
  .mobile-color-entry code {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-color-entry strong {
    color: var(--ink);
    font-size: 11px;
    line-height: 1.2;
  }

  .mobile-color-entry code {
    margin-top: 1px;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 8px;
    line-height: 1.2;
  }

  .mobile-reference-editor,
  .mobile-reference-palette {
    display: grid;
    padding: 8px;
    gap: 7px;
    border: 1px solid color-mix(in srgb, var(--green), var(--line) 68%);
    border-radius: 11px;
    background: var(--surface);
  }

  .mobile-reference-palette-heading,
  .reference-color-inputs {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
  }

  .mobile-reference-palette-heading strong {
    font-size: 12px;
  }

  .mobile-reference-palette-heading small {
    color: var(--muted);
    font-size: 9px;
    line-height: 1.35;
  }

  .mobile-section-heading,
  .mobile-pigment-heading {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
  }

  .mobile-section-heading h2,
  .mobile-pigment-heading h2 {
    margin: 0;
    font-size: 16px;
  }

  .mobile-section-heading p,
  .mobile-pigment-heading p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
  }

  .mobile-section-heading > span,
  .mobile-pigment-heading > strong {
    flex: 0 0 auto;
    padding: 4px 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 10px;
  }

  .reference-color-surface,
  .reference-color-palette-surface {
    position: relative;
    width: 100%;
    height: 132px;
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    background:
      linear-gradient(to top, #000, transparent),
      linear-gradient(to right, #fff, hsl(var(--palette-hue) 100% 50%));
    cursor: crosshair;
    touch-action: none;
  }

  .reference-color-surface:focus-visible,
  .reference-color-palette-surface:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--green), transparent 68%);
    outline-offset: 2px;
  }

  .reference-color-marker,
  .reference-color-palette-surface > .target-color-palette-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    transform: translate(-50%, -50%);
  }

  .reference-hue-control,
  .mobile-reference-palette .target-hue-control {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 10px;
  }

  .reference-hue-control input[type="range"],
  .mobile-reference-palette .target-hue-control input[type="range"] {
    width: 100%;
    min-width: 0;
    margin: 0;
    accent-color: var(--green);
  }

  .mobile-reference-inputs,
  .reference-color-inputs {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    min-width: 0;
    align-items: center;
    gap: 7px;
  }

  .mobile-reference-editor input[type="color"] {
    width: 42px;
    min-width: 42px;
    height: 38px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-2);
  }

  .mobile-reference-editor input[type="text"] {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--ink);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-transform: uppercase;
  }

  .mobile-reference-editor input[aria-invalid="true"] {
    border-color: var(--coral);
    background: color-mix(in srgb, var(--coral-soft), var(--surface) 76%);
  }

  .challenge-target-palette {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 10px;
    gap: 7px;
  }

  .challenge-target-palette button {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    min-height: 66px;
    padding: 7px;
    gap: 2px 7px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--ink-soft);
    text-align: left;
  }

  .challenge-target-palette button.is-selected {
    border-color: var(--green);
    background: var(--green-soft);
  }

  .challenge-target-palette button > span {
    grid-row: 1 / 3;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 50%;
  }

  .challenge-target-palette strong,
  .challenge-target-palette small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .challenge-target-palette strong {
    font-size: 11px;
  }

  .challenge-target-palette small {
    color: var(--muted);
    font-size: 8px;
  }

  .challenge-level-field {
    display: grid;
    margin-top: 10px;
    gap: 5px;
    color: var(--muted);
    font-size: 10px;
  }

  .challenge-level-field select {
    width: 100%;
    min-height: 40px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--ink);
  }

  .challenge-start-summary {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    gap: 8px;
    border-top: 1px solid var(--line);
  }

  .challenge-start-swatch {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 50%;
  }

  .challenge-start-summary strong,
  .challenge-start-summary small {
    display: block;
  }

  .challenge-start-summary small {
    color: var(--muted);
    font-size: 9px;
  }

  .challenge-start-summary .primary-button {
    min-height: 38px;
    padding-inline: 10px;
    font-size: 11px;
  }

  .mobile-challenge-status {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) auto;
    align-items: center;
    gap: 8px;
  }

  .mobile-challenge-status div span,
  .mobile-challenge-status div strong {
    display: block;
  }

  .mobile-challenge-status div span {
    color: var(--muted);
    font-size: 9px;
  }

  .mobile-challenge-status div strong {
    font-size: 11px;
  }

  .mobile-challenge-status .timer {
    min-height: 34px;
    padding-inline: 7px;
    font-size: 10px;
  }

  .mobile-challenge-status .secondary-button {
    grid-column: 1 / -1;
    min-height: 34px;
  }

  .mobile-workshop-panel .workshop-live-observation {
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
  }

  .mobile-workshop-flow .comparison-stage {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 110px;
  }

  .mobile-workshop-flow .swatch-panel,
  .mobile-workshop-flow .swatch-panel:last-child {
    grid-template-rows: 60px auto;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .mobile-workshop-flow .swatch-panel:last-child {
    border-right: 0;
  }

  .mobile-workshop-flow .mobile-color-entries .mobile-color-entry,
  .mobile-workshop-flow .mobile-color-entries .mobile-color-entry:last-child {
    display: block;
    min-height: 0;
    border: 1px solid var(--line);
  }

  .mobile-workshop-flow .mobile-color-entries .mobile-color-entry .mobile-color-swatch {
    min-height: 34px;
  }

  .mobile-workshop-flow .swatch-color {
    min-height: 60px;
  }

  .mobile-workshop-flow .swatch-caption {
    min-height: 46px;
    padding: 5px 7px;
  }

  .mobile-workshop-flow .swatch-caption strong {
    font-size: 10px;
  }

  .mobile-workshop-flow .swatch-caption small {
    overflow: hidden;
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-workshop-flow .swatch-caption code {
    display: none;
  }

  .mobile-workshop-flow .state-tabs,
  .mobile-workshop-flow .diagnostic-panel {
    margin-top: 5px;
  }

  .mobile-workshop-flow .diagnostic-panel {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mobile-workshop-flow .diagnostic-axis,
  .mobile-workshop-flow .diagnostic-axis:nth-child(2) {
    min-height: 48px;
    padding: 5px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .mobile-workshop-flow .diagnostic-axis:last-child {
    border-right: 0;
  }

  .mobile-workshop-flow .diagnostic-axis strong {
    font-size: 9px;
    line-height: 1.25;
  }

  .mobile-workshop-flow .diagnostic-axis small {
    display: none;
  }

  .mobile-workshop-live-loop .workshop-live-observation,
  .mobile-workshop-live-loop .mobile-guidance-summary,
  .mobile-workshop-live-loop .mobile-pigment-controls {
    margin: 0;
  }

  .mobile-guidance-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    border-color: color-mix(in srgb, var(--green), var(--line) 58%);
    background: color-mix(in srgb, var(--green-soft), var(--surface) 74%);
  }

  .mobile-guidance-summary[data-mobile-live-guidance] {
    isolation: isolate;
  }

  .mobile-guidance-copy span,
  .mobile-guidance-copy strong,
  .mobile-guidance-copy small {
    display: block;
  }

  .mobile-guidance-copy span {
    color: var(--green-deep);
    font-size: 9px;
    font-weight: 750;
  }

  .mobile-guidance-copy strong {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.4;
  }

  .mobile-guidance-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.45;
  }

  .mobile-guidance-summary > button {
    min-height: 38px;
    align-self: start;
    padding: 0 8px;
    border: 1px solid var(--green);
    border-radius: 8px;
    color: var(--green-deep);
    font-size: 10px;
  }

  .mobile-guidance-details {
    border-top: 1px solid color-mix(in srgb, var(--line), transparent 15%);
  }

  .mobile-guidance-details summary,
  .mobile-session-actions > summary {
    display: flex;
    min-height: 38px;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    cursor: pointer;
    font-size: 10px;
    list-style: none;
  }

  .mobile-guidance-details summary::-webkit-details-marker,
  .mobile-session-actions > summary::-webkit-details-marker {
    display: none;
  }

  .mobile-guidance-details ol,
  .mobile-guidance-details p,
  .mobile-guidance-details small {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
  }

  .mobile-pigment-strip {
    display: grid;
    grid-auto-columns: 68px;
    grid-auto-flow: column;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-top: 7px;
    padding: 1px 1px 5px;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
    scroll-padding-inline: 1px;
    scroll-snap-type: x proximity;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-pigment-strip::-webkit-scrollbar {
    height: 4px;
  }

  .mobile-pigment-strip::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: var(--line-strong);
  }

  .mobile-pigment-strip [data-select-pigment],
  .mobile-pigment-strip [data-pigment-id],
  .mobile-pigment-strip .quick-pigment-button {
    display: grid;
    width: 68px;
    min-width: 0;
    min-height: 58px;
    place-items: center;
    gap: 3px;
    padding: 6px 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 750;
    line-height: 1.2;
    scroll-snap-align: start;
    text-align: center;
    touch-action: manipulation;
  }

  .mobile-pigment-strip [data-select-pigment]:hover,
  .mobile-pigment-strip [data-select-pigment].is-selected,
  .mobile-pigment-strip [data-select-pigment][aria-pressed="true"],
  .mobile-pigment-strip [data-pigment-id].is-selected,
  .mobile-pigment-strip [data-pigment-id][aria-pressed="true"],
  .mobile-pigment-strip .quick-pigment-button.is-selected {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green-deep);
  }

  .mobile-pigment-strip .quick-pigment-swatch,
  .mobile-pigment-strip .pigment-swatch,
  .mobile-pigment-strip [data-pigment-swatch] {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    border: 1px solid rgba(0, 0, 0, 0.24);
    border-radius: 50%;
  }

  .mobile-dose-control {
    display: grid;
    margin-top: 7px;
    padding: 9px;
    gap: 7px;
    border: 1px solid color-mix(in srgb, var(--green), var(--line) 68%);
    border-radius: 10px;
    background: color-mix(in srgb, var(--green-soft), var(--surface) 84%);
  }

  .mobile-dose-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 2px 8px;
  }

  .mobile-dose-value span,
  .mobile-dose-value strong,
  .mobile-dose-heading small {
    font-family: var(--font-body);
  }

  .mobile-dose-value {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 7px;
  }

  .mobile-dose-value span {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
  }

  .mobile-dose-value strong {
    color: var(--green-deep);
    font-size: 18px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
  }

  .mobile-dose-heading small {
    grid-column: 1;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.35;
  }

  .mobile-dose-heading b {
    color: var(--ink-soft);
    font-weight: 750;
    font-variant-numeric: tabular-nums;
  }

  .mobile-dose-restart {
    display: inline-flex;
    grid-column: 2;
    grid-row: 1 / 3;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    align-self: center;
    padding: 0 8px;
    gap: 4px;
    border: 1px solid var(--green);
    border-radius: 8px;
    background: var(--green-soft);
    color: var(--green-deep);
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
    touch-action: manipulation;
  }

  .mobile-dose-slider {
    width: 100%;
    height: 32px;
    margin: 0;
    padding: 0;
    background: transparent;
    cursor: ew-resize;
    touch-action: pan-y;
  }

  .mobile-dose-slider::-webkit-slider-runnable-track {
    height: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: linear-gradient(to right, var(--green) 0 var(--dose-progress), var(--surface-2) var(--dose-progress) 100%);
  }

  .mobile-dose-slider::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    margin-top: -9px;
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 1px var(--green-deep), 0 2px 7px rgba(0, 0, 0, 0.18);
    -webkit-appearance: none;
  }

  .mobile-dose-slider::-moz-range-track {
    height: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
  }

  .mobile-dose-slider::-moz-range-progress {
    height: 8px;
    border-radius: 999px;
    background: var(--green);
  }

  .mobile-dose-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 1px var(--green-deep), 0 2px 7px rgba(0, 0, 0, 0.18);
  }

  .mobile-dose-slider:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--green), transparent 68%);
    outline-offset: 3px;
  }

  .mobile-dose-scale {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 9px;
    font-variant-numeric: tabular-nums;
  }

  .mobile-coach-heading,
  .mobile-coach-difference,
  .mobile-coach-action {
    min-width: 0;
  }

  .mobile-coach-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .mobile-coach-heading span,
  .mobile-coach-heading small,
  .mobile-coach-difference span,
  .mobile-coach-difference strong,
  .mobile-coach-action span,
  .mobile-coach-action strong {
    display: block;
    font-family: var(--font-body);
  }

  .mobile-coach-heading span,
  .mobile-coach-difference span,
  .mobile-coach-action span {
    color: var(--green-deep);
    font-size: 10px;
    font-weight: 750;
  }

  .mobile-coach-heading small {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 10px;
  }

  .mobile-coach-difference,
  .mobile-coach-action {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: baseline;
    margin: 0;
    gap: 8px;
  }

  .mobile-coach-difference strong,
  .mobile-coach-action strong {
    color: var(--ink);
    font-size: 11px;
    line-height: 1.35;
  }

  .mobile-pigment-strip [data-select-pigment],
  .mobile-dose-restart,
  .mobile-session-actions summary,
  .mobile-session-actions button {
    touch-action: manipulation;
  }

  .mobile-cup-record {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    width: 100%;
    min-width: 0;
    min-height: 34px;
    margin-top: 2px;
    padding: 5px 7px;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    color: var(--ink-soft);
    text-align: left;
    touch-action: manipulation;
  }

  .mobile-cup-record:hover {
    border-color: var(--green);
    background: color-mix(in srgb, var(--green-soft), var(--surface) 82%);
  }

  .mobile-cup-record-action {
    display: inline-flex;
    align-items: center;
    gap: 3px;
  }

  .mobile-cup-record-action svg {
    width: 13px;
    height: 13px;
  }

  .cup-record-dialog {
    display: grid;
    min-width: 0;
    gap: 10px;
  }

  .cup-record-dialog .ledger-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cup-record-composition {
    margin: 0;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--ink-soft);
    font-size: 10px;
    line-height: 1.45;
  }

  .cup-record-event-list {
    display: grid;
    max-height: min(44dvh, 360px);
    margin: 0;
    padding: 0;
    gap: 6px;
    overflow-y: auto;
    list-style: none;
    overscroll-behavior: contain;
  }

  .cup-record-event {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    min-width: 0;
    padding: 8px;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
  }

  .cup-record-event .ledger-event-index {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green-deep);
    font-size: 9px;
    font-variant-numeric: tabular-nums;
    font-weight: 750;
  }

  .cup-record-event > div {
    min-width: 0;
  }

  .cup-record-event strong,
  .cup-record-event small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cup-record-event strong {
    font-size: 11px;
  }

  .cup-record-event small,
  .cup-record-event time,
  .cup-record-dialog > small {
    color: var(--muted);
    font-size: 9px;
  }

  .cup-record-event time {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .mobile-cup-record-summary {
    min-width: 0;
    overflow: hidden;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-cup-record-action {
    color: var(--green-deep);
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
  }

  .mobile-session-actions {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
  }

  .mobile-session-actions > summary {
    justify-content: center;
  }

  .mobile-session-actions > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 8px 8px;
    gap: 6px;
  }

  .mobile-session-actions .secondary-button,
  .mobile-session-actions .danger-button {
    width: 100%;
    min-height: 38px;
    padding: 0 6px;
    font-size: 10px;
  }

  .pigment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .case-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .case-layout {
    display: block;
    min-height: 0;
    border-top: 0;
  }

  .case-list {
    display: grid;
    grid-auto-columns: minmax(220px, 75vw);
    grid-auto-flow: column;
    margin-bottom: 12px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    scroll-snap-type: x mandatory;
  }

  .case-list-item {
    min-height: 104px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    scroll-snap-align: start;
  }

  .case-stage {
    min-height: 520px;
    padding: 22px 16px 46px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .case-facts {
    grid-template-columns: 1fr;
  }

  .case-facts div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .case-facts div:last-child {
    border-bottom: 0;
  }

  .record-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .record-summary div:nth-child(2) {
    border-right: 0;
  }

  .record-summary div:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .record-tabs {
    display: flex;
    width: 100%;
  }

  .record-tabs button {
    flex: 1 0 auto;
  }

  .record-item {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .record-item time {
    grid-column: 2;
  }

  dialog {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
  }

  .image-viewer-dialog {
    width: calc(100% - 12px);
    max-height: calc(100dvh - 12px);
  }

  .image-viewer-controls {
    min-height: 50px;
    padding-inline: 10px;
    gap: 6px;
  }

  .image-viewer-zoom-button {
    min-width: 60px;
    min-height: 34px;
    padding-inline: 7px;
    font-size: 11px;
  }

  .image-viewer-zoom-status {
    min-width: 38px;
    font-size: 11px;
  }

  .image-viewer-zoom-hint {
    padding: 6px 10px;
    font-size: 10px;
  }

  .image-viewer-body {
    max-height: calc(100dvh - 164px);
    padding: 10px;
  }
}

@media (max-width: 390px) {
  .brand-copy strong {
    max-width: 124px;
  }

  .dashboard-band {
    grid-template-columns: 1fr;
  }

  .metric-block,
  .metric-block:nth-child(3) {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-block strong {
    grid-row: 1 / 3;
    grid-column: 2;
  }

  .next-step {
    grid-column: auto;
  }

  .challenge-levels {
    grid-template-columns: 1fr;
  }

  .challenge-levels button,
  .challenge-levels button:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .challenge-levels button:last-child {
    border-bottom: 0;
  }

  .workshop-toolbar-group,
  .field-label,
  .workshop-toolbar-group .secondary-button,
  .workshop-toolbar-group .primary-button {
    width: 100%;
  }

  .comparison-stage {
    grid-template-columns: 1fr;
  }

  .swatch-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .swatch-panel:last-child {
    border-bottom: 0;
  }

  /* The workshop keeps target/current side by side even at 320px. The
     generic small-card stack above is for other comparison views. */
  .mobile-workshop-flow .comparison-stage {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-workshop-flow .swatch-panel,
  .mobile-workshop-flow .swatch-panel:last-child {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .mobile-workshop-flow .swatch-panel:last-child {
    border-right: 0;
  }

  .mobile-workshop-flow .mobile-color-entries .mobile-color-entry,
  .mobile-workshop-flow .mobile-color-entries .mobile-color-entry:last-child {
    display: block;
    min-height: 0;
    border: 1px solid var(--line);
  }

  .swatch-color {
    min-height: 120px;
  }

  .mobile-workshop-flow .swatch-color {
    min-height: 60px;
  }

  .mobile-workshop-flow .mobile-color-entries .mobile-color-entry .mobile-color-swatch {
    min-height: 34px;
  }

  .mobile-dose-value {
    display: grid;
    align-items: start;
    gap: 2px;
  }

  .mobile-dose-value strong {
    font-size: 17px;
  }

  .mobile-dose-restart {
    min-width: 96px;
  }

  .pigment-grid {
    grid-template-columns: 1fr;
  }

  .record-summary {
    grid-template-columns: 1fr;
  }

  .record-summary div,
  .record-summary div:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .record-summary div:last-child {
    border-bottom: 0;
  }
}

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