:root {
  color-scheme: light;
  --paper: #f5f0e7;
  --paper-deep: #ebe3d7;
  --surface: #fffdf8;
  --surface-soft: #faf6ee;
  --surface-tint: #edf3ef;
  --ink: #213431;
  --ink-soft: #5f6d69;
  --ink-faint: #87918e;
  --teal-950: #123b37;
  --teal-900: #194a44;
  --teal-700: #327069;
  --teal-500: #63928a;
  --teal-200: #bfd2cb;
  --teal-100: #e1ebe6;
  --clay-700: #9c4d3c;
  --clay-600: #b35f49;
  --clay-100: #f3ded5;
  --gold-600: #a8792d;
  --gold-100: #f3ead2;
  --danger: #a7443e;
  --danger-soft: #f8e4df;
  --success: #31715d;
  --success-soft: #e2f0e9;
  --warning: #95681f;
  --warning-soft: #f6ebce;
  --line: #ded7ca;
  --line-strong: #c9c1b4;
  --shadow-sm: 0 2px 10px rgb(32 48 44 / 7%);
  --shadow-md: 0 16px 44px rgb(38 50 46 / 12%);
  --shadow-lg: 0 28px 80px rgb(30 45 41 / 18%);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 30px;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", STSong, serif;
  --ease: cubic-bezier(.2, .72, .24, 1);
}

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

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 400 15px/1.65 var(--font-sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

button,
select {
  cursor: pointer;
}

button,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: .52;
}

a {
  color: var(--teal-700);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

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

h1,
h2,
h3,
h4 {
  line-height: 1.3;
}

small,
.muted,
.helper-text {
  color: var(--ink-soft);
}

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

:focus-visible {
  outline: 3px solid rgb(179 95 73 / 32%);
  outline-offset: 2px;
}

::selection {
  color: var(--surface);
  background: var(--teal-700);
}

/* Shared app chrome */

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

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 11px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgb(25 74 68 / 12%);
  background: rgb(250 247 240 / 88%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: var(--teal-950);
  text-decoration: none;
}

.brand::before {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px 11px 11px 4px;
  color: var(--surface);
  background: var(--teal-900);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 16%);
  content: "拾";
  font: 700 18px/1 var(--font-serif);
}

.brand strong,
.brand-title {
  display: block;
  overflow: hidden;
  font: 700 19px/1.2 var(--font-serif);
  letter-spacing: .08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small,
.brand-subtitle {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font: 500 11px/1.2 var(--font-sans);
  letter-spacing: .08em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.role-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(255 253 248 / 72%);
  box-shadow: var(--shadow-sm);
}

.role-switch button,
.role-switch .role-option {
  min-height: 34px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition: color .18s var(--ease), background-color .18s var(--ease), box-shadow .18s var(--ease);
}

.role-switch button:hover,
.role-switch .role-option:hover {
  color: var(--teal-950);
  background: var(--teal-100);
}

.role-switch button.active,
.role-switch button[aria-pressed="true"],
.role-switch .role-option.active {
  color: #fff;
  background: var(--teal-900);
  box-shadow: 0 3px 9px rgb(18 59 55 / 22%);
}

.demo-toolbar {
  width: min(272px, 24vw);
  align-self: start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgb(255 253 248 / 78%);
  box-shadow: var(--shadow-sm);
}

.demo-toolbar h2,
.demo-toolbar h3 {
  margin-bottom: 8px;
  color: var(--teal-950);
  font: 700 17px/1.35 var(--font-serif);
}

.demo-toolbar p {
  margin-bottom: 14px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.65;
}

.demo-toolbar .button + .button {
  margin-top: 9px;
}

/* Parent/mobile prototype */

.parent-stage {
  display: grid;
  grid-template-columns: minmax(430px, 468px) minmax(220px, 272px);
  justify-content: center;
  align-items: start;
  gap: clamp(24px, 4vw, 50px);
  max-width: 1040px;
  min-height: calc(100vh - 70px);
  padding: clamp(24px, 4vh, 44px) 24px 56px;
  margin: 0 auto;
}

.phone {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: min(820px, calc(100vh - 118px));
  min-height: 680px;
  overflow: hidden;
  border: 1px solid rgb(87 89 80 / 22%);
  border-radius: 34px;
  background: var(--surface-soft);
  box-shadow: var(--shadow-lg), inset 0 0 0 6px rgb(255 255 255 / 42%);
}

.phone::before {
  position: absolute;
  z-index: 5;
  top: 10px;
  left: 50%;
  width: 56px;
  height: 5px;
  border-radius: 99px;
  background: rgb(18 59 55 / 20%);
  content: "";
  transform: translateX(-50%);
  pointer-events: none;
}

.app-header {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 70px;
  padding: 22px 22px 12px;
  border-bottom: 1px solid rgb(222 215 202 / 72%);
  background: rgb(255 253 248 / 92%);
}

.app-header h1,
.app-header h2 {
  margin: 0;
  color: var(--teal-950);
  font: 700 19px/1.3 var(--font-serif);
  letter-spacing: .03em;
}

.app-header .header-copy {
  min-width: 0;
}

.app-header .eyebrow {
  margin-bottom: 2px;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.screen {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 22px 20px 30px;
  overflow-y: auto;
  background: var(--surface-soft);
}

.screen.with-bottom-nav,
.screen.has-bottom-nav {
  padding-bottom: 104px;
}

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

.page-heading h1,
.page-heading h2 {
  margin-bottom: 4px;
  color: var(--teal-950);
  font: 700 clamp(23px, 5vw, 28px)/1.28 var(--font-serif);
  letter-spacing: .02em;
}

.page-heading p {
  max-width: 32em;
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--clay-700);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 24px 0 12px;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
  color: var(--teal-950);
  font-size: 16px;
}

.card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card + .card {
  margin-top: 14px;
}

.card-header,
.card-footer,
.detail-row,
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-header {
  margin-bottom: 14px;
}

.card-header h2,
.card-header h3 {
  margin: 0;
  color: var(--teal-950);
  font-size: 16px;
}

.card-footer {
  padding-top: 14px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.card-accent {
  border-color: var(--teal-200);
  background: var(--surface-tint);
}

.card-warm {
  border-color: #e7c9bd;
  background: #faf0e9;
}

/* Buttons and compact controls */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  box-shadow: none;
  transition: transform .16s var(--ease), background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease), box-shadow .16s var(--ease);
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button-primary {
  color: #fff;
  background: var(--teal-900);
  border-color: var(--teal-900);
  box-shadow: 0 7px 16px rgb(18 59 55 / 18%);
}

.button-primary:hover:not(:disabled) {
  background: var(--teal-950);
  border-color: var(--teal-950);
  box-shadow: 0 9px 20px rgb(18 59 55 / 24%);
}

.button-ghost {
  color: var(--teal-900);
  border-color: var(--teal-200);
  background: rgb(255 253 248 / 70%);
}

.button-ghost:hover:not(:disabled) {
  border-color: var(--teal-500);
  background: var(--teal-100);
}

.button-danger {
  color: var(--danger);
  border-color: #e7beb8;
  background: var(--danger-soft);
}

.button-danger:hover:not(:disabled) {
  color: #8f332f;
  border-color: #d99d95;
  background: #f4d5cf;
}

.button-link {
  min-height: auto;
  padding: 3px 0;
  color: var(--teal-700);
  border: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
}

.button-link:hover:not(:disabled) {
  color: var(--teal-950);
  transform: none;
}

.button-small {
  min-height: 34px;
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 12px;
}

.button-block {
  width: 100%;
}

.button-row,
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.icon-button,
.back-button {
  display: inline-grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--teal-900);
  background: var(--surface);
  font-size: 18px;
}

.icon-button:hover,
.back-button:hover {
  border-color: var(--teal-200);
  background: var(--teal-100);
}

/* Navigation */

.nav-tabs {
  display: flex;
  gap: 5px;
  padding: 4px;
  margin-bottom: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tabs button,
.nav-tabs a {
  display: inline-flex;
  flex: 1 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 0;
  border-radius: 9px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.nav-tabs button:hover,
.nav-tabs a:hover {
  color: var(--teal-900);
  background: rgb(255 253 248 / 70%);
}

.nav-tabs .active,
.nav-tabs [aria-selected="true"] {
  color: var(--teal-950);
  background: var(--surface);
  box-shadow: 0 2px 8px rgb(42 56 51 / 9%);
}

.bottom-nav {
  position: sticky;
  z-index: 10;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  min-height: 74px;
  padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: rgb(255 253 248 / 94%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.bottom-nav button,
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 5px 8px;
  border: 0;
  border-radius: 12px;
  color: var(--ink-faint);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

.bottom-nav button:hover,
.bottom-nav a:hover,
.bottom-nav .active,
.bottom-nav [aria-current="page"] {
  color: var(--teal-900);
  background: var(--teal-100);
}

.bottom-nav .nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

/* Stats, chips and lists */

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

.stat {
  min-width: 0;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat strong,
.stat-value {
  display: block;
  overflow: hidden;
  margin-bottom: 4px;
  color: var(--teal-950);
  font: 700 24px/1.15 var(--font-serif);
  text-overflow: ellipsis;
}

.stat span,
.stat-label {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.stat-featured {
  color: #fff;
  border-color: var(--teal-900);
  background: var(--teal-900);
}

.stat-featured strong,
.stat-featured .stat-value,
.stat-featured span,
.stat-featured .stat-label {
  color: inherit;
}

.chip,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: fit-content;
  min-height: 25px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

button.chip {
  transition: color .15s var(--ease), border-color .15s var(--ease), background-color .15s var(--ease);
}

button.chip:hover,
.chip.active,
.chip[aria-pressed="true"] {
  color: var(--teal-950);
  border-color: var(--teal-200);
  background: var(--teal-100);
}

.badge-success,
.badge.mastered {
  color: var(--success);
  border-color: #b9d7c8;
  background: var(--success-soft);
}

.badge-warning,
.badge.learning,
.badge.unmastered {
  color: var(--warning);
  border-color: #e7d39f;
  background: var(--warning-soft);
}

.badge-danger,
.badge.failed,
.badge.revoked {
  color: var(--danger);
  border-color: #e6bdb7;
  background: var(--danger-soft);
}

.badge-neutral {
  color: var(--ink-soft);
  border-color: var(--line);
  background: var(--paper);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.mistake-list {
  display: grid;
  gap: 12px;
}

.mistake-card {
  position: relative;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}

button.mistake-card,
a.mistake-card {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
}

.mistake-card:hover {
  border-color: var(--teal-200);
  box-shadow: 0 8px 22px rgb(33 52 49 / 10%);
  transform: translateY(-1px);
}

.mistake-thumb {
  display: grid;
  min-height: 82px;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background:
    linear-gradient(rgb(99 146 138 / 9%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(99 146 138 / 9%) 1px, transparent 1px),
    #fbfaf5;
  background-size: 14px 14px;
}

.mistake-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mistake-content {
  min-width: 0;
}

.mistake-content h3,
.mistake-title {
  display: -webkit-box;
  overflow: hidden;
  margin: 5px 0 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mistake-meta,
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  color: var(--ink-soft);
  font-size: 11px;
}

.empty-state {
  display: grid;
  min-height: 250px;
  place-items: center;
  padding: 34px 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--ink-soft);
  background: rgb(255 253 248 / 52%);
  text-align: center;
}

.empty-state::before {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  margin: 0 auto 15px;
  border-radius: 22px 22px 22px 8px;
  color: var(--teal-700);
  background: var(--teal-100);
  content: "册";
  font: 700 27px/1 var(--font-serif);
}

.empty-state h2,
.empty-state h3 {
  margin-bottom: 7px;
  color: var(--teal-950);
  font-size: 17px;
}

.empty-state p {
  max-width: 26em;
  margin: 0 auto 17px;
  font-size: 13px;
}

/* Forms */

.form {
  display: grid;
  gap: 16px;
}

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

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field > label,
.field-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.field > label small,
.field-label small {
  margin-left: 4px;
  font-weight: 400;
}

.required {
  margin-left: 3px;
  color: var(--clay-700);
}

.input,
.select,
.textarea,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 1px 2px rgb(27 45 40 / 3%);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background-color .16s var(--ease);
}

.input,
.select,
.field input,
.field select {
  min-height: 44px;
  padding: 9px 12px;
}

.select,
.field select {
  padding-right: 34px;
}

.textarea,
.field textarea {
  min-height: 96px;
  padding: 11px 12px;
  line-height: 1.6;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: #9ca4a1;
}

.input:hover:not(:disabled),
.select:hover:not(:disabled),
.textarea:hover:not(:disabled),
.field input:hover:not(:disabled),
.field select:hover:not(:disabled),
.field textarea:hover:not(:disabled) {
  border-color: var(--teal-500);
}

.input:focus,
.select:focus,
.textarea:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--teal-700);
  outline: none;
  box-shadow: 0 0 0 3px rgb(99 146 138 / 18%);
}

.field-error,
.error-text {
  color: var(--danger);
  font-size: 12px;
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea,
.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.checkbox,
.radio {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.checkbox input,
.radio input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  accent-color: var(--teal-900);
}

.code-input {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .22em;
  text-align: center;
}

/* Capture and OCR flow */

.photo-frame {
  position: relative;
  display: grid;
  min-height: 280px;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(rgb(25 74 68 / 4%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(25 74 68 / 4%) 1px, transparent 1px),
    #e9e5dc;
  background-size: 22px 22px;
}

.photo-frame::after {
  position: absolute;
  inset: 20px;
  border: 2px solid rgb(255 253 248 / 85%);
  border-radius: 12px;
  content: "";
  box-shadow: 0 0 0 999px rgb(18 33 30 / 20%);
  pointer-events: none;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: contain;
  background: #fff;
}

.photo-frame .photo-hint {
  position: relative;
  z-index: 2;
  max-width: 230px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #fff;
  background: rgb(18 59 55 / 80%);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.capture {
  display: grid;
  gap: 16px;
}

.capture-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.capture-button {
  position: relative;
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--clay-600);
  box-shadow: 0 0 0 2px var(--clay-600), 0 8px 20px rgb(156 77 60 / 26%);
}

.capture-button:hover {
  background: var(--clay-700);
  transform: scale(1.02);
}

.capture-button::after {
  width: 22px;
  height: 22px;
  border: 3px solid rgb(255 255 255 / 88%);
  border-radius: 5px;
  content: "";
}

.processing {
  display: grid;
  min-height: 390px;
  place-items: center;
  padding: 34px 20px;
  text-align: center;
}

.processing-indicator,
.spinner {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto 22px;
  border: 2px solid var(--teal-200);
  border-radius: 24px 24px 24px 8px;
  background: var(--teal-100);
}

.processing-indicator::after,
.spinner::after {
  position: absolute;
  inset: 19px;
  border: 3px solid var(--teal-200);
  border-top-color: var(--teal-900);
  border-radius: 50%;
  content: "";
  animation: spin .85s linear infinite;
}

.processing h2,
.processing h3 {
  margin-bottom: 7px;
  color: var(--teal-950);
}

.processing p {
  max-width: 270px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 13px;
}

.progress {
  width: min(250px, 90%);
  height: 7px;
  margin: 20px auto 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--teal-100);
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal-700);
  transition: width .35s var(--ease);
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 2px 0 18px;
}

.step {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 5px;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}

.step::before {
  position: relative;
  z-index: 2;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  content: attr(data-step);
  font-size: 10px;
}

.step:not(:first-child)::after {
  position: absolute;
  z-index: 1;
  top: 13px;
  right: 50%;
  width: 100%;
  height: 1px;
  background: var(--line-strong);
  content: "";
}

.step.active,
.step.complete {
  color: var(--teal-900);
}

.step.active::before,
.step.complete::before {
  color: #fff;
  border-color: var(--teal-900);
  background: var(--teal-900);
}

.step.complete:not(:first-child)::after {
  background: var(--teal-700);
}

.detail {
  display: grid;
  gap: 14px;
}

.detail-section {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.detail-section h2,
.detail-section h3 {
  margin-bottom: 10px;
  color: var(--teal-950);
  font-size: 14px;
}

.detail-row {
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail-row:first-child {
  padding-top: 0;
}

.detail-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.detail-label {
  flex: 0 0 78px;
  color: var(--ink-soft);
  font-size: 12px;
}

.detail-value {
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.notice,
.alert {
  padding: 12px 14px;
  border: 1px solid #dfcfaa;
  border-radius: 11px;
  color: #765921;
  background: var(--warning-soft);
  font-size: 12px;
}

.notice-success,
.alert-success {
  color: var(--success);
  border-color: #b9d7c8;
  background: var(--success-soft);
}

.notice-danger,
.alert-danger {
  color: var(--danger);
  border-color: #e7beb8;
  background: var(--danger-soft);
}

/* Admin */

.admin-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: calc(100vh - 70px);
  background: #f4f1ea;
}

.sidebar {
  position: sticky;
  top: 70px;
  align-self: start;
  height: calc(100vh - 70px);
  padding: 26px 17px;
  overflow-y: auto;
  color: #ecf3ef;
  background: var(--teal-950);
}

.sidebar-heading {
  padding: 0 11px;
  margin-bottom: 14px;
  color: rgb(236 243 239 / 58%);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.sidebar nav,
.sidebar-nav {
  display: grid;
  gap: 5px;
}

.sidebar button,
.sidebar a,
.sidebar-nav button,
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  color: rgb(236 243 239 / 72%);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  transition: color .16s var(--ease), background-color .16s var(--ease);
}

.sidebar button:hover,
.sidebar a:hover,
.sidebar .active,
.sidebar [aria-current="page"] {
  color: #fff;
  background: rgb(255 255 255 / 11%);
}

.sidebar .active,
.sidebar [aria-current="page"] {
  box-shadow: inset 3px 0 0 var(--clay-600);
}

.sidebar-footer {
  padding-top: 18px;
  margin-top: 24px;
  border-top: 1px solid rgb(255 255 255 / 11%);
}

.admin-main {
  min-width: 0;
  padding: clamp(24px, 3.5vw, 46px);
}

.admin-main > .page-heading {
  margin-bottom: 24px;
}

.admin-main > .page-heading h1 {
  font-size: 29px;
}

.admin-main .stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 22px;
}

.admin-main .stat {
  padding: 18px;
}

.admin-main .stat strong,
.admin-main .stat-value {
  font-size: 27px;
}

.admin-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.admin-toolbar .filter-row {
  flex: 1;
  padding: 0;
  margin: 0;
  overflow: visible;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: var(--ink-soft);
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}

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

.table tbody tr:hover td {
  background: #fbfaf5;
}

.table .actions {
  flex-wrap: nowrap;
}

.table-empty {
  padding: 50px 20px !important;
  color: var(--ink-soft);
  text-align: center !important;
}

/* Dialogs and feedback */

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(14 32 29 / 48%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in .18s var(--ease) both;
}

.modal {
  width: min(480px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  padding: 22px;
  overflow-y: auto;
  border: 1px solid rgb(255 255 255 / 44%);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 28px 80px rgb(14 32 29 / 28%);
  animation: modal-in .22s var(--ease) both;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
  color: var(--teal-950);
  font: 700 20px/1.35 var(--font-serif);
}

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

.toast-root {
  position: fixed;
  z-index: 200;
  top: 82px;
  right: 20px;
  display: grid;
  width: min(360px, calc(100vw - 40px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--teal-200);
  border-radius: 12px;
  color: var(--ink);
  background: rgb(255 253 248 / 96%);
  box-shadow: 0 14px 38px rgb(26 43 38 / 18%);
  font-size: 13px;
  pointer-events: auto;
  animation: toast-in .25s var(--ease) both;
}

.toast::before {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--success);
  content: "";
}

.toast.error {
  border-color: #e6bdb7;
}

.toast.error::before {
  background: var(--danger);
}

/* Authentication and utility compositions */

.auth-card {
  width: min(100%, 390px);
  padding: 26px 22px;
  margin: 18px auto 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.auth-mark {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  margin: 0 auto 17px;
  border-radius: 19px 19px 19px 7px;
  color: #fff;
  background: var(--teal-900);
  font: 700 28px/1 var(--font-serif);
}

.auth-card h1,
.auth-card h2 {
  margin-bottom: 8px;
  color: var(--teal-950);
  font: 700 24px/1.35 var(--font-serif);
  text-align: center;
}

.auth-card > p {
  margin-bottom: 20px;
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
}

.student-card {
  display: flex;
  align-items: center;
  gap: 13px;
}

.avatar {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px 14px 14px 5px;
  color: var(--teal-950);
  background: var(--teal-100);
  font: 700 16px/1 var(--font-serif);
}

.student-card-content {
  min-width: 0;
  flex: 1;
}

.student-card-content strong {
  display: block;
  overflow: hidden;
  color: var(--teal-950);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-card-content small {
  display: block;
  margin-top: 2px;
}

.list-row {
  min-height: 48px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.list-row:first-child {
  padding-top: 0;
}

.list-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.stack {
  display: grid;
  gap: 12px;
}

.divider {
  height: 1px;
  margin: 18px 0;
  border: 0;
  background: var(--line);
}

.spacer {
  flex: 1;
}

.sticky-actions {
  position: sticky;
  z-index: 6;
  bottom: -30px;
  display: flex;
  gap: 10px;
  padding: 12px 0 2px;
  margin-top: 18px;
  background: var(--surface-soft);
  box-shadow: 0 -10px 18px var(--surface-soft);
}

.sticky-actions .button {
  flex: 1;
}

.text-danger {
  color: var(--danger) !important;
}

.text-success {
  color: var(--success) !important;
}

.text-center {
  text-align: center;
}

/* App-specific compositions */

.demo-code,
.table-code,
.generated-code > strong {
  font-variant-numeric: tabular-nums;
}

.demo-code {
  margin: 8px 0 5px;
  overflow-wrap: anywhere;
  color: var(--teal-950);
  font: 800 27px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .14em;
}

.demo-caption {
  margin: 14px 0 0 !important;
  color: var(--ink-faint) !important;
  font-size: 11px !important;
  text-align: center;
}

.login-form {
  margin-top: 18px;
}

.bind-preview {
  margin-top: 18px;
}

.capture-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 20px;
  margin-top: 15px;
  border: 1px solid var(--teal-200);
  border-left: 4px solid var(--clay-600);
  border-radius: var(--radius-lg);
  background: var(--surface-tint);
}

.capture-hero h3 {
  margin-bottom: 6px;
  color: var(--teal-950);
  font: 700 18px/1.4 var(--font-serif);
}

.capture-hero p:last-child {
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.capture-hero .button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.success-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 520px;
  padding: 36px 20px;
  text-align: center;
}

.success-mark {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  margin-bottom: 22px;
  border: 1px solid #b9d7c8;
  border-radius: 24px 24px 24px 8px;
  color: #fff;
  background: var(--success);
  box-shadow: 0 12px 26px rgb(49 113 93 / 20%);
}

.success-mark svg {
  width: 34px;
  height: 34px;
  stroke-width: 2.2;
}

.success-panel h2 {
  max-width: 330px;
  margin-bottom: 9px;
  color: var(--teal-950);
  font: 700 25px/1.4 var(--font-serif);
}

.success-panel > p:not(.eyebrow) {
  max-width: 310px;
  margin-bottom: 24px;
  color: var(--ink-soft);
  font-size: 13px;
}

.success-panel .actions {
  display: grid;
  width: min(100%, 310px);
  gap: 9px;
}

.camera-view {
  min-height: 100%;
  align-content: start;
}

.camera-live {
  min-height: 420px;
  border-color: rgb(255 255 255 / 20%);
  background: #263a36;
}

.camera-live img {
  min-height: 420px;
  object-fit: cover;
  filter: saturate(.86) contrast(.96) brightness(.9);
}

.preview-photo img {
  transition: transform .22s var(--ease);
}

.preview-photo.is-cropped::after {
  inset: 42px;
  border-color: #f2d3c6;
  box-shadow: 0 0 0 999px rgb(18 33 30 / 32%);
}

.image-tools {
  justify-content: center;
  margin-top: 13px;
}

.demo-scenario {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  margin-top: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink-soft);
  background: var(--paper);
  font-size: 12px;
}

.progress-label {
  margin: 8px 0 0 !important;
  color: var(--teal-700) !important;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.review-image,
.detail-photo,
.admin-modal-photo {
  display: grid;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.review-image {
  min-height: 190px;
  margin-bottom: 14px;
}

.review-image img {
  width: 100%;
  height: 190px;
  object-fit: contain;
}

.review-form {
  margin-top: 16px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
}

.summary-strip span {
  min-width: 0;
  padding: 9px 8px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-strip span + span {
  border-left: 1px solid var(--line);
}

.detail-photo {
  min-height: 260px;
}

.detail-photo img {
  width: 100%;
  height: 260px;
  object-fit: contain;
}

.settings-list {
  padding-block: 5px;
}

.settings-row,
.admin-list-button {
  width: 100%;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  text-align: left;
}

.settings-row {
  min-height: 52px;
}

.settings-row:hover,
.admin-list-button:hover {
  color: var(--teal-950);
  background: var(--surface-tint);
}

.settings-row > span,
.admin-list-button > span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.settings-row > svg {
  flex: 0 0 auto;
  color: var(--ink-faint);
}

.student-management .card-footer {
  justify-content: flex-end;
}

.generated-code {
  display: grid;
  justify-items: center;
  padding: 24px 18px;
  margin-bottom: 16px;
  border: 1px solid var(--teal-200);
  border-radius: var(--radius-lg);
  background: var(--surface-tint);
  text-align: center;
}

.generated-code p {
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 13px;
}

.generated-code > strong {
  margin-bottom: 8px;
  color: var(--teal-950);
  font: 800 34px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .17em;
}

.generated-code small {
  font-size: 11px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .8fr);
  align-items: stretch;
  gap: 18px;
  margin-bottom: 20px;
}

.admin-quick-actions {
  min-width: 0;
}

.admin-grid .card + .card {
  margin-top: 0;
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quick-action {
  display: grid;
  align-content: start;
  justify-items: start;
  min-height: 130px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface-soft);
  text-align: left;
  transition: transform .16s var(--ease), border-color .16s var(--ease), background-color .16s var(--ease), box-shadow .16s var(--ease);
}

.quick-action:hover {
  border-color: var(--teal-200);
  background: var(--surface-tint);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.quick-action > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-bottom: 13px;
  border-radius: 10px;
  color: var(--teal-900);
  background: var(--teal-100);
}

.quick-action strong {
  display: block;
  margin-bottom: 3px;
  color: var(--teal-950);
  font-size: 14px;
}

.quick-action small {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.5;
}

.admin-recent,
.log-table {
  margin-top: 18px;
}

.admin-list-button small {
  display: block;
  margin-top: 2px;
}

.admin-list-button > span:first-child {
  display: grid;
  gap: 0;
}

.admin-question-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  max-width: 340px;
}

.admin-question-cell img {
  flex: 0 0 60px;
  width: 60px;
  height: 44px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.admin-question-cell strong {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.table-code {
  color: var(--teal-950);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  letter-spacing: .1em;
}

.admin-modal-photo {
  min-height: 250px;
  margin: 14px 0;
}

.admin-modal-photo img {
  width: 100%;
  height: 280px;
  object-fit: contain;
}

.admin-filter-form .form-grid {
  flex: 1;
  width: min(100%, 640px);
}

.sidebar-footer strong {
  display: block;
  margin: 3px 0;
  color: #fff;
  font-size: 14px;
}

.sidebar-footer small {
  display: block;
  color: rgb(236 243 239 / 58%);
  font-size: 10px;
}

@keyframes spin {
  to { transform: rotate(1turn); }
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.985);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
}

@media (max-width: 900px) {
  .parent-stage {
    grid-template-columns: minmax(400px, 468px);
  }

  .demo-toolbar {
    width: 100%;
  }

  .admin-shell {
    grid-template-columns: 196px minmax(0, 1fr);
  }

  .admin-main {
    padding: 28px 22px;
  }

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

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

@media (max-width: 680px) {
  body {
    background: var(--surface-soft);
  }

  .topbar {
    position: relative;
    min-height: 62px;
    padding: 8px 12px;
  }

  .brand::before {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
    border-radius: 10px 10px 10px 4px;
    font-size: 16px;
  }

  .brand strong,
  .brand-title {
    font-size: 16px;
  }

  .brand small,
  .brand-subtitle {
    display: none;
  }

  .role-switch button,
  .role-switch .role-option {
    min-height: 44px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .topbar-actions > .button:not(.icon-button) {
    min-height: 44px;
    padding: 6px 9px;
    font-size: 11px;
  }

  .button,
  .icon-button,
  .back-button,
  .nav-tabs button,
  .nav-tabs a,
  button.chip {
    min-height: 44px;
  }

  .parent-stage {
    display: block;
    min-height: calc(100vh - 62px);
    padding: 0;
  }

  .phone {
    height: auto;
    min-height: calc(100vh - 62px);
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .phone::before {
    display: none;
  }

  .demo-toolbar {
    display: none;
  }

  .app-header {
    position: sticky;
    top: 0;
    min-height: 58px;
    padding: 10px 16px;
  }

  .screen {
    padding: 20px 16px 28px;
    overflow: visible;
  }

  .capture-hero {
    grid-template-columns: 1fr;
  }

  .capture-hero .button {
    width: 100%;
  }

  .camera-live,
  .camera-live img {
    min-height: min(55vh, 440px);
  }

  .success-panel {
    min-height: calc(100vh - 120px);
  }

  .bottom-nav {
    position: sticky;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 88vh;
    padding: 20px 17px max(20px, env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
  }

  .toast-root {
    top: 70px;
    right: 12px;
    width: calc(100vw - 24px);
  }

  .admin-shell {
    display: block;
    min-height: calc(100vh - 62px);
  }

  .sidebar {
    position: sticky;
    z-index: 40;
    top: 0;
    height: auto;
    padding: 8px 10px;
    overflow-x: auto;
  }

  .sidebar-heading,
  .sidebar-footer {
    display: none;
  }

  .sidebar nav,
  .sidebar-nav {
    display: flex;
    width: max-content;
    gap: 4px;
  }

  .sidebar button,
  .sidebar a,
  .sidebar-nav button,
  .sidebar-nav a {
    width: auto;
    min-height: 44px;
    padding: 7px 11px;
    white-space: nowrap;
  }

  .sidebar .active,
  .sidebar [aria-current="page"] {
    box-shadow: inset 0 -3px 0 var(--clay-600);
  }

  .admin-main {
    padding: 22px 15px 36px;
  }

  .admin-main > .page-heading h1 {
    font-size: 24px;
  }

  .admin-toolbar {
    display: grid;
    align-items: stretch;
  }

  .admin-toolbar .filter-row {
    overflow-x: auto;
  }

  .admin-filter-form .form-grid {
    width: 100%;
  }

  .quick-action-grid {
    grid-template-columns: 1fr;
  }

  .quick-action {
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    min-height: 80px;
  }

  .quick-action > span {
    grid-row: span 2;
    margin: 0 12px 0 0;
  }

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

@media (max-width: 430px) {
  .topbar {
    align-items: center;
  }

  .brand {
    gap: 8px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .role-switch {
    gap: 2px;
    padding: 3px;
  }

  .role-switch button,
  .role-switch .role-option {
    padding-inline: 8px;
  }

  .page-heading {
    gap: 10px;
  }

  .page-heading h1,
  .page-heading h2 {
    font-size: 23px;
  }

  .stats-grid {
    gap: 7px;
  }

  .stat {
    padding: 12px 9px;
  }

  .stat strong,
  .stat-value {
    font-size: 21px;
  }

  .mistake-card {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 11px;
    padding: 12px;
  }

  .mistake-thumb {
    min-height: 74px;
  }

  .photo-frame,
  .photo-frame img {
    min-height: 240px;
  }

  .generated-code > strong {
    font-size: 29px;
    letter-spacing: .12em;
  }

  .button-row > .button,
  .actions > .button {
    flex: 1 1 auto;
  }

  .modal-footer .button {
    flex: 1;
  }

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

  .admin-main .stat {
    padding: 13px 11px;
  }
}

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

@media (forced-colors: active) {
  .brand::before,
  .capture-button,
  .processing-indicator,
  .spinner {
    border: 2px solid CanvasText;
  }

  .empty-state {
    border-style: solid;
  }
}
