:root {
  color-scheme: light;
  --red: #d71920;
  --red-dark: #a90f17;
  --red-soft: #fff1f2;
  --charcoal: #1f2933;
  --ink: #344054;
  --muted: #667085;
  --line: #d9e1ea;
  --surface: #ffffff;
  --surface-muted: #f5f7fa;
  --surface-tint: #f8fbfc;
  --teal: #0f766e;
  --teal-soft: #e6f6f4;
  --amber: #8a4b00;
  --amber-soft: #fff6df;
  --danger: #b42318;
  --danger-soft: #fff2f1;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-md: 0 14px 34px rgba(16, 24, 40, .10);
  --radius: 8px;
  --radius-lg: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  min-height: 100vh;
  margin: 0;
  background: var(--surface-muted);
  color: var(--charcoal);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

svg {
  display: block;
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

:focus-visible {
  outline: 3px solid #b42318;
  outline-offset: 3px;
}

.app-view > header h1[tabindex="-1"]:focus {
  outline: none !important;
}

.noscript {
  padding: 16px;
  background: var(--danger-soft);
  color: var(--danger);
  text-align: center;
}

.app-shell {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.app-shell.auth-mode {
  grid-template-columns: minmax(0, 1fr);
}

.auth-mode .sidebar {
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  display: none;
}

.sidebar {
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand {
  width: 100%;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
  line-height: 1.2;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: .78rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  background: var(--red);
  color: #fff;
  box-shadow: 0 10px 20px rgba(215, 25, 32, .22);
}

.brand-mark svg {
  fill: currentColor;
  stroke: none;
  width: 22px;
  height: 22px;
}

.brand-mark.large {
  width: 52px;
  height: 52px;
}

.brand-mark.large svg {
  width: 28px;
  height: 28px;
}

.nav-list {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 6px;
}

.nav-button,
.tool-card,
.link-button,
.back-button,
.button {
  border: 0;
  cursor: pointer;
}

.nav-button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}

.nav-button:hover,
.nav-button[aria-current="page"] {
  background: var(--red-soft);
  color: var(--red-dark);
}

.nav-button:active {
  transform: scale(.98);
}

.icon,
.tool-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.icon {
  width: 22px;
  height: 22px;
}

.sidebar-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-tint);
}

.sidebar-label,
.section-label {
  display: block;
  margin: 0 0 4px;
  color: var(--red-dark);
  font-size: .74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar-card strong {
  display: block;
  font-size: .98rem;
}

.mini-progress,
.progress-track {
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf3;
}

.mini-progress {
  height: 8px;
  margin-top: 10px;
}

.mini-progress span,
.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red-dark), var(--red));
  transition: width .42s var(--ease);
}

.workspace {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  min-width: 0;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: pageIn .24s var(--ease);
}

.auth-view {
  min-height: 100vh;
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(215, 25, 32, .08), transparent 42%),
    linear-gradient(315deg, rgba(15, 118, 110, .10), transparent 36%),
    var(--surface-muted);
}

.auth-panel {
  min-height: calc(100vh - 64px);
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  align-items: center;
  gap: 48px;
}

.auth-panel.compact {
  max-width: 480px;
  display: flex;
  justify-content: center;
}

.auth-copy h1,
.page-header h1,
.form-heading h1 {
  margin: 0;
  color: var(--charcoal);
  font-size: clamp(2.1rem, 5vw, 4.6rem);
  line-height: 1;
}

.auth-copy p,
.lead {
  max-width: 640px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.auth-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.auth-card {
  width: 100%;
  padding: clamp(22px, 4vw, 32px);
}

.form-heading h2,
.panel h2,
.form-heading h1 {
  margin: 0;
  color: var(--charcoal);
  font-size: 1.35rem;
  line-height: 1.18;
}

.form-heading p,
.panel p,
.muted {
  color: var(--muted);
}

.form-heading p {
  margin: 8px 0 22px;
}

.field {
  display: grid;
  gap: 7px;
  margin: 14px 0;
  color: var(--ink);
  font-size: .92rem;
  font-weight: 750;
}

.field input {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fff;
  color: var(--charcoal);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}

.field input:focus {
  border-color: rgba(215, 25, 32, .65);
  box-shadow: 0 0 0 4px rgba(215, 25, 32, .10);
  outline: none;
}

.form-message {
  min-height: 22px;
  margin: 10px 0;
  color: var(--danger);
  font-size: .92rem;
}

.form-message.success {
  color: var(--teal);
}

.button-stack,
.split-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-stack {
  flex-direction: column;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  padding: 11px 16px;
  font-weight: 800;
  text-decoration: none;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}

.button.fit {
  width: fit-content;
}

.button.primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 12px 24px rgba(215, 25, 32, .22);
}

.button.secondary {
  background: var(--charcoal);
  color: #fff;
}

.button.subtle,
.button.ghost {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button.danger {
  background: var(--danger);
  color: #fff;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary:hover,
.button.secondary:hover,
.button.danger:hover {
  box-shadow: var(--shadow-md);
}

.button:active,
.tool-card:active,
.back-button:active {
  transform: scale(.98);
}

.button:disabled {
  cursor: progress;
  opacity: .68;
  transform: none;
}

.switch-copy {
  margin: 16px 0 0;
  color: var(--muted);
  text-align: center;
}

.link-button {
  padding: 0;
  background: none;
  color: var(--red-dark);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.back-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .18s var(--ease), background .18s var(--ease);
}

.back-button:hover {
  background: var(--surface-muted);
}

.app-view {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  padding: clamp(20px, 4vw, 40px);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 24px;
  max-width: 1180px;
}

.page-header h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.compact-header {
  justify-content: flex-start;
}

.dashboard-grid,
.settings-grid,
.scanner-layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
  align-items: start;
}

.panel {
  padding: clamp(18px, 3vw, 24px);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.progress-panel,
.units-panel {
  grid-column: 1;
}

.next-panel,
.support-panel {
  grid-column: 2;
}

.progress-value {
  color: var(--red-dark);
  font-size: clamp(2rem, 6vw, 3.8rem);
  line-height: 1;
}

.progress-track {
  height: 14px;
}

.unit-list {
  display: grid;
  gap: 10px;
}

.unit-row {
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--charcoal);
  text-align: left;
  cursor: pointer;
  transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}

.unit-row:hover,
.tool-card:hover {
  border-color: rgba(215, 25, 32, .28);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.unit-number,
.unit-state,
.tool-icon {
  border-radius: var(--radius);
}

.unit-number {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red-soft);
  color: var(--red-dark);
  font-weight: 900;
}

.unit-row strong,
.unit-row small {
  display: block;
}

.unit-row small,
.tool-card small {
  color: var(--muted);
  font-size: .86rem;
}

.unit-state {
  padding: 6px 10px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: .78rem;
  font-weight: 850;
}

.unit-row.complete .unit-state {
  background: var(--teal-soft);
  color: var(--teal);
}

.unit-row.locked,
.unit-row.locked:hover {
  cursor: not-allowed;
  border-color: var(--line);
  background: #f6f7f9;
  box-shadow: none;
  opacity: .76;
  transform: none;
}

.unit-row.locked .unit-state {
  background: #e7e9ed;
  color: #596273;
}

.status-dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 6px var(--teal-soft);
}

.quick-actions {
  display: grid;
  gap: 10px;
}

.tool-card {
  min-height: 82px;
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--charcoal);
  text-align: left;
  transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}

.tool-card strong,
.tool-card small {
  display: block;
}

.tool-icon {
  width: 42px;
  height: 42px;
  background: var(--surface-muted);
  color: var(--red-dark);
}

.survey-progress {
  display: inline-flex;
  width: fit-content;
  margin: 4px 0 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--red-soft);
  color: var(--red-dark);
  font-size: .78rem;
  font-weight: 850;
}

.survey-card {
  max-width: 760px;
  margin: 0 auto;
}

.survey-card .button[hidden] {
  display: none;
}

.survey-card fieldset:focus {
  outline: none;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 14px;
  color: var(--charcoal);
  font-size: 1.25rem;
  font-weight: 850;
}

.survey-question {
  margin-bottom: 6px;
  line-height: 1.4;
  text-wrap: pretty;
}

.survey-instruction {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 650;
}

.rating-options {
  display: grid;
  gap: 10px;
}

.rating-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}

.rating-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

.rating-option:has(input:checked) {
  border-color: rgba(215, 25, 32, .65);
  background: var(--red-soft);
  box-shadow: 0 0 0 4px rgba(215, 25, 32, .08);
}

.rating-option:hover {
  transform: translateY(-1px);
}

.scanner-layout,
.settings-grid {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  align-items: start;
}

.camera-frame {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #111827, #273545);
}

.camera-frame video {
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: cover;
}

.camera-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  color: #fff;
  text-align: center;
}

.camera-empty svg {
  width: 44px;
  height: 44px;
}

.camera-empty span {
  color: rgba(255,255,255,.78);
}

.clean-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
}

.danger-panel {
  border-color: rgba(180, 35, 24, .28);
  background: linear-gradient(180deg, var(--surface), var(--danger-soft));
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .app-shell:not(.auth-mode) {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
  width: 100%;
  max-width: 100vw;
  min-width: 0;
    position: static;
    height: auto;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    display: flex;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-button {
    flex: 0 0 116px;
  }

  .nav-button {
    justify-content: center;
  }

  .sidebar-card {
    display: none;
  }

  .auth-panel,
  .dashboard-grid,
  .scanner-layout,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .progress-panel,
  .units-panel,
  .next-panel,
  .support-panel {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .auth-view,
  .app-view {
  width: 100%;
  max-width: 100vw;
    padding: 18px;
  }

  .auth-panel {
    min-height: calc(100vh - 36px);
    gap: 24px;
  }

  .auth-copy h1,
  .page-header h1,
  .form-heading h1 {
    font-size: 2.2rem;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header .button.fit,
  .split-actions .button.fit {
    width: 100%;
  }

  .compact-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .brand {
  width: 100%;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
    align-items: flex-start;
  }

  .nav-list {
    width: 100%;
  }

  .nav-button {
    flex-basis: 96px;
  }

  .nav-button {
    min-height: 48px;
    padding: 8px;
    flex-direction: column;
    gap: 4px;
    font-size: .82rem;
    text-align: center;
  }

  .panel-heading {
    flex-direction: column;
  }

  .unit-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .unit-state {
    grid-column: 2;
    width: fit-content;
  }

  .camera-frame,
  .camera-frame video {
    min-height: 300px;
  }
}

@media (max-width: 460px) {
  .auth-view,
  .app-view,
  .sidebar {
  width: 100%;
  max-width: 100vw;
  min-width: 0;
    padding-left: 14px;
    padding-right: 14px;
  }

  .auth-card,
  .panel {
    padding: 18px;
  }

  .button-stack,
  .split-actions {
    display: grid;
  }

  .button.fit {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}





/* Corporate learning refinements */
.learner-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.learner-stats span {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-tint);
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.35;
}

.learner-stats strong {
  color: var(--charcoal);
  font-size: 1.35rem;
  line-height: 1;
}

.scenario-card.compact {
  display: grid;
  gap: 14px;
  margin: 2px 0 18px;
}

.scenario-card.compact strong,
.scenario-card.compact span {
  display: block;
}

.scenario-card.compact strong {
  color: var(--charcoal);
  font-size: 1.1rem;
  line-height: 1.25;
}

.scenario-card.compact span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.scenario-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.scenario-meta div {
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.scenario-meta dt,
.scenario-meta dd {
  margin: 0;
}

.scenario-meta dt {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.scenario-meta dd {
  color: var(--charcoal);
  font-weight: 850;
}

@media (max-width: 720px) {
  body {
    font-size: 17px;
  }

  .learner-stats,
  .scenario-meta {
    grid-template-columns: 1fr;
  }

  .learner-stats span,
  .scenario-meta div {
    min-height: 58px;
  }
}


/* Premium presentation pass */
:root {
  --red: #c91822;
  --red-dark: #8f1118;
  --red-soft: #fff0f1;
  --charcoal: #151923;
  --ink: #2f3541;
  --muted: #5f6878;
  --line: rgba(33, 41, 54, .13);
  --surface: #ffffff;
  --surface-muted: #eef2f5;
  --surface-tint: #f7f9fb;
  --gold: #a98145;
  --gold-soft: #fff7e8;
  --shadow-sm: 0 10px 28px rgba(21, 25, 35, .08);
  --shadow-md: 0 24px 60px rgba(21, 25, 35, .14);
  --radius-lg: 8px;
}

body {
  background:
    linear-gradient(135deg, rgba(21, 25, 35, .055), transparent 34%),
    linear-gradient(180deg, #f7f9fb 0%, #eef2f5 100%);
}

.app-shell:not(.auth-mode) {
  background: linear-gradient(180deg, #f7f9fb 0%, #edf1f4 100%);
}

.sidebar {
  background: linear-gradient(180deg, #151923 0%, #202735 100%);
  border-right: 1px solid rgba(255, 255, 255, .08);
  color: #fff;
  box-shadow: 18px 0 48px rgba(21, 25, 35, .12);
}

.sidebar .brand strong,
.sidebar .sidebar-card strong {
  color: #fff;
}

.sidebar .brand small,
.sidebar .sidebar-label {
  color: rgba(255, 255, 255, .68);
}

.sidebar .brand-mark {
  background: linear-gradient(135deg, #f8fafc, #dfe5ea);
  color: var(--red-dark);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .22);
}

.sidebar .nav-button {
  color: rgba(255, 255, 255, .78);
}

.sidebar .nav-button:hover,
.sidebar .nav-button[aria-current="page"] {
  background: rgba(255, 255, 255, .09);
  color: #fff;
}

.sidebar-card {
  border-color: rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.auth-view {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, #111722 0%, #1c2432 56%, #303744 100%);
}

.auth-view::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, .08), transparent 32%),
    linear-gradient(270deg, rgba(201, 24, 34, .18), transparent 42%);
  pointer-events: none;
}

.auth-panel {
  position: relative;
  z-index: 1;
}

.auth-copy h1,
.auth-copy p {
  color: #fff;
}

.auth-copy p {
  color: rgba(255, 255, 255, .76);
}

.auth-copy .brand-mark.large {
  background: #fff;
  color: var(--red-dark);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .22);
}

.auth-copy h1,
.page-header h1,
.form-heading h1 {
  font-weight: 900;
}

.page-header {
  padding-top: 4px;
}

.section-label,
.sidebar-label {
  color: var(--red-dark);
  font-weight: 900;
}

.auth-card,
.panel {
  position: relative;
  overflow: hidden;
  border-color: rgba(33, 41, 54, .12);
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow-sm);
}

.auth-card::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--red-dark), var(--red));
  opacity: .72;
  pointer-events: none;
}

.auth-card {
  backdrop-filter: blur(18px);
}

.panel-heading h2,
.form-heading h2,
.form-heading h1 {
  letter-spacing: 0;
}

.field input,
textarea {
  border-color: rgba(33, 41, 54, .16);
  background: rgba(255, 255, 255, .94);
}

.field input:focus,
textarea:focus {
  border-color: rgba(143, 17, 24, .62);
  box-shadow: 0 0 0 4px rgba(143, 17, 24, .1);
}

.button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  letter-spacing: 0;
}

.button.primary {
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  box-shadow: 0 16px 34px rgba(143, 17, 24, .24);
}

.button.secondary {
  background: linear-gradient(135deg, #151923, #303846);
  box-shadow: 0 14px 30px rgba(21, 25, 35, .16);
}

.button.subtle,
.button.ghost {
  border-color: rgba(33, 41, 54, .14);
  background: rgba(255, 255, 255, .86);
}

.button.primary:hover,
.button.secondary:hover,
.button.danger:hover {
  box-shadow: var(--shadow-md);
}

.progress-track,
.mini-progress {
  background: #dfe6ed;
  box-shadow: inset 0 1px 2px rgba(21, 25, 35, .08);
}

.progress-track span,
.mini-progress span {
  background: linear-gradient(90deg, var(--red-dark), var(--red));
}

.progress-value {
  color: var(--red-dark);
  font-weight: 950;
}

.unit-row,
.tool-card,
.rating-option,
.scenario-meta div,
.learner-stats span {
  border-color: rgba(33, 41, 54, .12);
  background: linear-gradient(180deg, #fff, #f8fafc);
}

.unit-row:hover,
.tool-card:hover,
.rating-option:hover {
  border-color: rgba(169, 129, 69, .38);
  box-shadow: 0 16px 34px rgba(21, 25, 35, .1);
}

.unit-number,
.tool-icon {
  background: linear-gradient(135deg, var(--red-soft), var(--gold-soft));
  color: var(--red-dark);
}

.unit-state {
  background: var(--gold-soft);
  color: #7a5523;
}

.unit-row.complete .unit-state {
  background: var(--teal-soft);
  color: var(--teal);
}

.status-dot {
  background: var(--teal);
  box-shadow: 0 0 0 6px var(--teal-soft), 0 0 0 10px rgba(15, 118, 110, .08);
}

.camera-frame {
  border-color: rgba(255, 255, 255, .1);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .06), transparent 34%),
    linear-gradient(135deg, #111722, #273241);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.danger-panel {
  border-color: rgba(180, 35, 24, .22);
  background: linear-gradient(180deg, #fff, #fff5f4);
}

@media (max-width: 980px) {
  .sidebar {
    box-shadow: 0 18px 42px rgba(21, 25, 35, .16);
  }
}

@media (max-width: 720px) {
  .auth-view::before {
    opacity: .72;
  }

  .auth-copy p {
    font-size: 1rem;
  }
}


/* Sidebar navigation polish: keep admin access in the sidebar and anchor the bottom progress panel. */
.nav-button {
  text-decoration: none;
}

.dashboard-nav[hidden] {
  display: none;
}

.sidebar {
  padding-bottom: 0;
}

.sidebar-card {
  margin: auto -24px 0;
  padding: 18px 24px 22px;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
}


@media (max-width: 980px) {
  .sidebar {
    padding-bottom: 16px;
  }

  .sidebar-card {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }
}


/* Fixed desktop sidebar: prevents blank left-column space while scrolling long pages. */
@media (min-width: 981px) {
  .app-shell:not(.auth-mode) {
    display: block;
    min-height: 100vh;
  }

  .app-shell:not(.auth-mode) .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    height: 100dvh;
    z-index: 30;
  }

  .app-shell:not(.auth-mode) .workspace {
    width: auto;
    max-width: none;
    margin-left: var(--sidebar-width);
  }
}


/* Collapsible phone navigation. */
.mobile-nav-toggle {
  display: none;
}

.mobile-nav-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

@media (max-width: 980px) {
  .app-shell:not(.auth-mode) .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    height: auto;
    padding: 12px 14px;
  }

  .app-shell:not(.auth-mode) .brand {
    min-width: 0;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .08);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: .9rem;
    font-weight: 850;
    transition: background .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
  }

  .mobile-nav-toggle:hover,
  .mobile-nav-toggle[aria-expanded="true"] {
    border-color: rgba(255, 255, 255, .28);
    background: rgba(255, 255, 255, .14);
  }

  .mobile-nav-toggle:active {
    transform: scale(.98);
  }

  .app-shell:not(.auth-mode) .nav-list {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
    max-height: 0;
    margin: 0;
    overflow: hidden;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: max-height .28s var(--ease), opacity .2s var(--ease), transform .2s var(--ease), padding .2s var(--ease);
  }

  .app-shell:not(.auth-mode).nav-open .nav-list {
    max-height: 380px;
    padding-top: 4px;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .app-shell:not(.auth-mode) .nav-button {
    flex: initial;
    flex-direction: row;
    justify-content: flex-start;
    min-height: 46px;
    padding: 10px 12px;
    font-size: .94rem;
    text-align: left;
  }

  .app-shell:not(.auth-mode) .nav-button .icon {
    width: 24px;
    height: 24px;
  }
}
/* Phone app shell: compact top bar, thumb-friendly bottom tabs, and flatter content. */
@media (max-width: 720px) {
  :root {
    --phone-header-height: 62px;
    --phone-tab-height: 70px;
  }

  html {
    scroll-padding-top: calc(var(--phone-header-height) + 12px);
  }

  body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #f4f6f8;
    font-size: 16px;
  }

  .app-shell:not(.auth-mode) {
    display: block;
    min-height: 100dvh;
    padding-bottom: calc(var(--phone-tab-height) + env(safe-area-inset-bottom, 0px));
    background: #f4f6f8;
  }

  .app-shell:not(.auth-mode) .sidebar {
    position: sticky;
    inset: 0 0 auto;
    z-index: 60;
    width: 100%;
    height: var(--phone-header-height);
    display: flex;
    align-items: center;
    gap: 0;
    padding: 9px 16px;
    border: 0;
    border-bottom: 1px solid rgba(33, 41, 54, .12);
    background: #fff;
    color: var(--charcoal);
    box-shadow: 0 6px 20px rgba(21, 25, 35, .07);
  }


  .app-shell:not(.auth-mode) .brand {
    width: auto;
    align-items: center;
    gap: 10px;
  }

  .app-shell:not(.auth-mode) .brand-mark {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(143, 17, 24, .12);
    background: var(--red-soft);
    color: var(--red-dark);
    box-shadow: none;
  }

  .app-shell:not(.auth-mode) .brand-mark svg {
    width: 19px;
    height: 19px;
  }

  .app-shell:not(.auth-mode) .brand strong {
    color: var(--charcoal);
    font-size: .94rem;
    line-height: 1.2;
  }

  .app-shell:not(.auth-mode) .brand small,
  .app-shell:not(.auth-mode) .mobile-nav-toggle,
  .app-shell:not(.auth-mode) .sidebar-card {
    display: none;
  }

  .app-shell:not(.auth-mode) .nav-list {
    position: fixed;
    inset: auto 0 0;
    z-index: 70;
    width: 100%;
    min-height: calc(var(--phone-tab-height) + env(safe-area-inset-bottom, 0px));
    max-height: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
    gap: 2px;
    overflow: visible;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(33, 41, 54, .12);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 -8px 24px rgba(21, 25, 35, .09);
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  @supports (backdrop-filter: blur(14px)) {
    .app-shell:not(.auth-mode) .nav-list {
      background: rgba(255, 255, 255, .94);
      backdrop-filter: blur(14px);
    }
  }

  .app-shell:not(.auth-mode) .nav-button {
    position: relative;
    min-width: 0;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 5px 2px;
    border-radius: 8px;
    background: transparent;
    color: #5f6878;
    font-size: .7rem;
    font-weight: 750;
    line-height: 1.1;
    text-align: center;
  }

  .app-shell:not(.auth-mode) .nav-button .icon {
    width: 23px;
    height: 23px;
    transition: transform .18s var(--ease);
  }
  .app-shell:not(.auth-mode) .dashboard-nav[hidden] {
    display: none;
  }

  .app-shell:not(.auth-mode) .nav-button:hover,
  .app-shell:not(.auth-mode) .nav-button[aria-current="page"] {
    background: var(--red-soft);
    color: var(--red-dark);
  }

  .app-shell:not(.auth-mode) .nav-button[aria-current="page"] .icon {
    transform: translateY(-1px);
  }

  .app-shell:not(.auth-mode) .workspace {
    min-height: calc(100dvh - var(--phone-header-height));
    padding-bottom: 0;
  }

  .app-view {
    min-height: calc(100dvh - var(--phone-header-height) - var(--phone-tab-height));
    padding: 20px 16px 28px;
  }

  .page-header {
    gap: 14px;
    margin-bottom: 18px;
    padding-top: 0;
  }

  .page-header h1,
  .form-heading h1 {
    font-size: 1.8rem;
    line-height: 1.12;
  }

  .lead {
    margin-top: 9px;
    font-size: .96rem;
    line-height: 1.55;
  }

  .section-label {
    margin-bottom: 3px;
    font-size: .68rem;
    letter-spacing: 0;
  }

  .compact-header {
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: start;
  }

  .compact-header .back-button {
    width: 44px;
    height: 44px;
  }

  .dashboard-grid,
  .settings-grid,
  .scanner-layout {
    gap: 12px;
  }

  .panel {
    padding: 18px;
    border-color: rgba(33, 41, 54, .12);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 3px 14px rgba(21, 25, 35, .06);
  }

  .panel::before {
    display: none;
  }

  .panel-heading {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
  }

  .panel-heading h2,
  .form-heading h2 {
    font-size: 1.12rem;
    line-height: 1.25;
  }

  .progress-value {
    flex: 0 0 auto;
    font-size: 2.1rem;
  }

  .progress-track {
    height: 10px;
  }

  .learner-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  .learner-stats span {
    min-height: 62px;
    align-content: start;
    padding: 2px 9px;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    font-size: .72rem;
  }

  .learner-stats span:first-child {
    padding-left: 0;
  }

  .learner-stats span:last-child {
    padding-right: 0;
    border-right: 0;
  }

  .learner-stats strong {
    font-size: 1.2rem;
  }

  .scenario-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .scenario-meta div {
    min-height: 50px;
    padding: 2px 8px;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
  }

  .scenario-meta div:first-child {
    padding-left: 0;
  }

  .scenario-meta div:last-child {
    padding-right: 0;
    border-right: 0;
  }

  .scenario-meta dt {
    font-size: .66rem;
  }

  .scenario-meta dd {
    overflow-wrap: anywhere;
    font-size: .78rem;
  }

  .unit-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 11px;
    min-height: 68px;
    padding: 12px;
    background: #fff;
  }

  .unit-state {
    grid-column: auto;
    padding: 5px 8px;
    font-size: .7rem;
  }

  .unit-number {
    width: 36px;
    height: 36px;
  }

  .unit-row small,
  .tool-card small {
    font-size: .79rem;
  }

  .tool-card,
  .rating-option {
    background: #fff;
  }

  .button {
    min-height: 48px;
  }

  .button.primary {
    background: var(--red);
    box-shadow: 0 7px 16px rgba(143, 17, 24, .18);
  }

  .button.secondary {
    background: var(--charcoal);
    box-shadow: 0 7px 16px rgba(21, 25, 35, .13);
  }

  .camera-frame,
  .camera-frame video {
    min-height: min(62vh, 360px);
  }
}

/* Clean interaction pass: restrained product motion and responsive navigation. */
:root {
  --motion-fast: 160ms;
  --motion-base: 220ms;
  --motion-ease: cubic-bezier(.22, 1, .36, 1);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 6px;
  background: #fff;
  color: #161b24;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
  transform: translateY(-160%);
  transition: transform var(--motion-fast) var(--motion-ease);
}

.skip-link:focus {
  transform: translateY(0);
}

button:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
}

[aria-busy="true"] {
  cursor: progress;
}

.button:focus-visible,
.nav-button:focus-visible,
.tool-card:focus-visible,
.unit-row:focus-visible,
.rating-option:focus-within,
.back-button:focus-visible,
.filter-button:focus-visible,
.admin-list-item button:focus-visible,
.mobile-nav-toggle:focus-visible {
  outline: 3px solid rgba(215, 25, 32, .34);
  outline-offset: 3px;
}

body.app-page .auth-view {
  background: #202630 url("../office-vn.webp") center / cover no-repeat;
}

body.app-page .auth-view::before {
  background: rgba(15, 20, 28, .68);
}

body.app-page .auth-copy h1,
body.app-page .auth-copy p {
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .32);
}

body.app-page .auth-copy h1 {
  max-width: 9ch;
  font-size: 4rem;
  line-height: 1.02;
  text-wrap: balance;
}

body.app-page .auth-copy p {
  max-width: 48ch;
  color: rgba(255, 255, 255, .86);
}

body.app-page .auth-card {
  border-color: rgba(255, 255, 255, .36);
  background: #fff;
  box-shadow: 0 24px 64px rgba(7, 12, 20, .26);
  backdrop-filter: none;
}

body.app-page .auth-card::before,
body.app-page .panel::before {
  display: none;
}

body.app-page .page-header h1 {
  font-size: 2.45rem;
  line-height: 1.08;
  text-wrap: balance;
}

body.app-page .lead {
  max-width: 64ch;
  text-wrap: pretty;
}

body.app-page .section-label,
body.app-page .sidebar-label,
body.admin-page .section-label {
  font-size: .8rem;
  font-weight: 800;
  text-transform: none;
}

body.app-page .panel,
body.app-page .unit-row,
body.app-page .tool-card,
body.app-page .rating-option {
  border-color: #dbe1e8;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

body.app-page .button.primary,
body.app-page .button.secondary,
body.app-page .button.danger {
  box-shadow: 0 6px 16px rgba(21, 25, 35, .13);
}

body.app-page .button.primary {
  background: var(--red);
}

body.app-page .button.secondary {
  background: var(--charcoal);
}

body.app-page .button:hover,
body.app-page .unit-row:hover,
body.app-page .tool-card:hover {
  box-shadow: 0 7px 18px rgba(21, 25, 35, .09);
}

body.app-page .mini-progress span,
body.app-page .progress-track span {
  background: var(--red);
}

@media (max-width: 720px) {
  body.app-page .auth-view {
    padding: 20px 16px;
    background-position: 58% center;
  }

  body.app-page .auth-panel {
    min-height: calc(100dvh - 40px);
    align-content: center;
  }

  body.app-page .auth-copy h1 {
    max-width: 12ch;
    font-size: 2.35rem;
  }

  body.app-page .auth-copy p {
    font-size: .96rem;
  }

  body.app-page .app-shell:not(.auth-mode) {
    padding-bottom: 0;
  }

  body.app-page .app-shell:not(.auth-mode) .sidebar {
    height: 62px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
  }

  body.app-page .app-shell:not(.auth-mode) .mobile-nav-toggle {
    min-height: 42px;
    display: inline-flex;
    border-color: #dbe1e8;
    background: #fff;
    color: var(--charcoal);
  }

  body.app-page .app-shell:not(.auth-mode) .mobile-nav-toggle:hover,
  body.app-page .app-shell:not(.auth-mode) .mobile-nav-toggle[aria-expanded="true"] {
    border-color: rgba(215, 25, 32, .28);
    background: var(--red-soft);
    color: var(--red-dark);
  }

  body.app-page .app-shell:not(.auth-mode) .nav-list {
    position: absolute;
    inset: calc(100% + 6px) 10px auto;
    z-index: 70;
    width: auto;
    min-height: 0;
    max-height: calc(100dvh - 82px);
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #dbe1e8;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
  }

  body.app-page .app-shell:not(.auth-mode).nav-open .nav-list {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  body.app-page .app-shell:not(.auth-mode) .nav-button {
    min-height: 48px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    font-size: .92rem;
    text-align: left;
  }

  body.app-page .app-shell:not(.auth-mode) .workspace,
  body.app-page .app-view {
    min-height: calc(100dvh - 62px);
  }

  body.app-page .page-header h1 {
    font-size: 1.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skip-link,
  body.app-page .app-shell:not(.auth-mode) .nav-list {
    transition: none !important;
  }
}

/* CARE / REAL AR workshop */
.ar-experience-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 16px;
  align-items: start;
}

.ar-camera-panel {
  min-width: 0;
}

.ar-camera-frame {
  isolation: isolate;
  aspect-ratio: 16 / 10;
  min-height: 480px;
  border-color: #cfd6df;
  background: #171b24 url("../office-vn.webp") center / cover no-repeat;
}

.ar-camera-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(14, 19, 27, .48);
}

.ar-camera-frame video {
  position: absolute;
  inset: 0;
  min-height: 0;
  object-fit: cover;
}

.ar-mindar-surface {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.ar-mindar-surface:empty {
  display: none;
}

.ar-mindar-surface video,
.ar-mindar-surface canvas,
.ar-mindar-surface > div {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

.ar-mindar-surface video {
  object-fit: cover;
}

.ar-camera-frame .camera-empty {
  position: relative;
  z-index: 1;
  max-width: 32ch;
  transition: opacity var(--motion-fast) var(--motion-ease), visibility var(--motion-fast) var(--motion-ease);
}

.ar-camera-frame .camera-empty[hidden] {
  display: none;
}

.ar-camera-frame.has-card-overlay .camera-empty {
  visibility: hidden;
  opacity: 0;
}

.ar-camera-frame .camera-empty strong {
  font-size: 1.1rem;
}

.ar-reticle {
  position: absolute;
  inset: 16%;
  z-index: 2;
  display: none;
  border: 1px solid rgba(255, 255, 255, .74);
  border-radius: 8px;
  pointer-events: none;
}

.camera-active .ar-reticle {
  display: block;
}

.ar-camera-frame.target-detected .ar-reticle {
  border-color: rgba(96, 218, 179, .92);
  box-shadow: 0 0 0 1px rgba(19, 135, 105, .28), inset 0 0 24px rgba(19, 135, 105, .18);
}

.ar-camera-frame.target-detected .ar-reticle::before,
.ar-camera-frame.target-detected .ar-reticle::after,
.ar-camera-frame.target-detected .ar-reticle span::before,
.ar-camera-frame.target-detected .ar-reticle span::after {
  border-color: #60dab3;
}

.ar-reticle::before,
.ar-reticle::after,
.ar-reticle span::before,
.ar-reticle span::after {
  content: "";
  position: absolute;
  width: 34px;
  height: 34px;
  border-color: #fff;
  border-style: solid;
}

.ar-reticle::before {
  top: -2px;
  left: -2px;
  border-width: 3px 0 0 3px;
}

.ar-reticle::after {
  top: -2px;
  right: -2px;
  border-width: 3px 3px 0 0;
}

.ar-reticle span::before {
  bottom: -2px;
  left: -2px;
  border-width: 0 0 3px 3px;
}

.ar-reticle span::after {
  right: -2px;
  bottom: -2px;
  border-width: 0 3px 3px 0;
}

.ar-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.ar-overlay[hidden] {
  display: none;
}

.ar-visual {
  position: absolute;
  inset: 0;
}

.ar-visual img {
  position: absolute;
  right: var(--ar-character-edge, 2%);
  bottom: var(--ar-character-bottom, -3%);
  width: min(var(--ar-character-width, 64%), 440px);
  height: var(--ar-character-height, 86%);
  object-fit: contain;
  object-position: bottom;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .28));
}

.ar-camera-frame[data-card^="care"] .ar-visual img {
  right: auto;
  left: var(--ar-character-edge, 2%);
}


.ar-overlay-copy {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 3;
  width: min(310px, calc(100% - 36px));
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border-left: 4px solid var(--red);
  border-radius: 6px;
  background: rgba(255, 255, 255, .96);
  color: var(--charcoal);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .2);
}

.ar-camera-frame[data-card^="care"] .ar-overlay-copy {
  right: 18px;
  left: auto;
}

.ar-overlay-copy span {
  color: var(--red-dark);
  font-size: .72rem;
  font-weight: 900;
}

.ar-overlay-copy strong {
  font-size: 1.25rem;
}

.ar-overlay-copy p {
  margin: 0;
  color: var(--ink);
  font-size: .88rem;
  line-height: 1.4;
}

.ar-effect {
  position: absolute;
  top: 8%;
  left: 6%;
  z-index: 2;
  width: 170px;
  height: 170px;
  color: #fff;
  opacity: .46;
  transform: scale(.58);
  transform-origin: top left;
}

.ar-camera-frame[data-card^="care"] .ar-effect {
  right: 6%;
  left: auto;
  transform-origin: top right;
}

.effect-person {
  position: absolute;
  right: 10px;
  bottom: 14px;
  width: 42px;
  height: 74px;
  border-radius: 40% 40% 18% 18%;
  background: rgba(255, 255, 255, .9);
}

.effect-person::before {
  content: "";
  position: absolute;
  top: -24px;
  left: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: inherit;
}

.effect-beam {
  position: absolute;
  top: 40px;
  left: 0;
  width: 132px;
  height: 56px;
  background: rgba(255, 221, 92, .74);
  clip-path: polygon(0 42%, 100% 0, 100% 100%, 0 58%);
  transform-origin: left center;
  animation: arSpotlight 2.4s ease-in-out infinite;
}

.effect-scale-beam {
  position: absolute;
  top: 72px;
  left: 24px;
  width: 122px;
  height: 5px;
  border-radius: 3px;
  background: #fff;
  transform-origin: center;
  animation: arBalance 2.8s ease-in-out infinite;
}

.effect-scale-beam::before {
  content: "";
  position: absolute;
  top: -35px;
  left: 57px;
  width: 7px;
  height: 94px;
  border-radius: 3px;
  background: #fff;
}

.effect-scale-pan {
  position: absolute;
  top: 80px;
  width: 50px;
  height: 24px;
  border-bottom: 4px solid #ffd95c;
  border-radius: 0 0 50% 50%;
}

.effect-scale-pan.left {
  left: 10px;
  animation: arPanLeft 2.8s ease-in-out infinite;
}

.effect-scale-pan.right {
  right: 10px;
  animation: arPanRight 2.8s ease-in-out infinite;
}

.effect-compass-ring {
  position: absolute;
  inset: 18px;
  border: 6px solid rgba(255, 255, 255, .88);
  border-radius: 50%;
  box-shadow: 0 0 0 7px rgba(215, 25, 32, .72);
}

.effect-compass-needle {
  position: absolute;
  top: 34px;
  left: 80px;
  width: 10px;
  height: 104px;
  background: #ffd95c;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  transform-origin: center;
  animation: arCompass 2.6s cubic-bezier(.22, 1, .36, 1) infinite;
}

.effect-gap {
  position: absolute;
  inset: 48px 0 0;
  border-bottom: 58px solid rgba(12, 17, 24, .8);
  clip-path: polygon(0 0, 42% 0, 50% 100%, 58% 0, 100% 0, 100% 100%, 0 100%);
}

.effect-bridge-deck {
  position: absolute;
  top: 67px;
  left: 20px;
  width: 130px;
  height: 24px;
  border: 4px solid #ffd95c;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.92) 0 14px, #ffd95c 14px 18px);
  transform-origin: left center;
  animation: arBridge 2.6s ease-in-out infinite;
}

.effect-breath-ring {
  position: absolute;
  inset: 50px;
  border: 3px solid rgba(129, 230, 217, .9);
  border-radius: 50%;
  animation: arBreathe 2.8s ease-out infinite;
}

.effect-breath-ring.two {
  animation-delay: .7s;
}

.effect-breath-ring.three {
  animation-delay: 1.4s;
}

.effect-blur-text {
  position: absolute;
  top: 74px;
  left: 22px;
  font-size: 1.05rem;
  font-weight: 950;
  filter: blur(5px);
  animation: arSharpen 2.8s ease-in-out infinite;
}

.effect-lens {
  position: absolute;
  top: 35px;
  left: 38px;
  width: 82px;
  height: 82px;
  border: 7px solid #fff;
  border-radius: 50%;
  animation: arLens 2.8s ease-in-out infinite;
}

.effect-lens::after {
  content: "";
  position: absolute;
  right: -38px;
  bottom: -26px;
  width: 48px;
  height: 9px;
  border-radius: 5px;
  background: #fff;
  transform: rotate(45deg);
}

.effect-question-mark {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #fff;
  font-size: 7rem;
  font-weight: 950;
  text-shadow: 0 0 22px rgba(255, 217, 92, .9);
  animation: arQuestion 2s ease-in-out infinite;
}

.effect-step {
  position: absolute;
  bottom: 24px;
  width: 34px;
  border: 3px solid rgba(255, 255, 255, .7);
  background: rgba(255, 255, 255, .2);
  animation: arStep 2.4s ease-in-out infinite;
}

.effect-step.one { left: 4px; height: 28px; }
.effect-step.two { left: 43px; height: 54px; animation-delay: .2s; }
.effect-step.three { left: 82px; height: 82px; animation-delay: .4s; }
.effect-step.four { left: 121px; height: 112px; animation-delay: .6s; }

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 154px;
  padding: 3px;
  border: 1px solid #d6dde6;
  border-radius: 7px;
  background: #f3f5f7;
}

.segmented-control button {
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .78rem;
  font-weight: 900;
  cursor: pointer;
}

.segmented-control button[aria-pressed="true"] {
  background: #fff;
  color: var(--red-dark);
  box-shadow: 0 1px 4px rgba(21, 25, 35, .12);
}

.ar-card-picker {
  display: grid;
  gap: 8px;
}

.ar-card-option {
  width: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid #dbe1e8;
  border-radius: 7px;
  background: #fff;
  color: var(--charcoal);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--motion-ease), background var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease);
}

.ar-card-option:hover {
  border-color: rgba(215, 25, 32, .38);
  transform: translateY(-1px);
}

.ar-card-option[aria-pressed="true"] {
  border-color: rgba(215, 25, 32, .54);
  background: var(--red-soft);
}

.ar-card-option:focus-visible,
.segmented-control button:focus-visible {
  outline: 3px solid #b42318;
  outline-offset: 2px;
}

.ar-card-letter {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 950;
}

.ar-card-option strong,
.ar-card-option small {
  display: block;
}

.ar-card-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.3;
}

.ar-fallback-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.45;
}

.ar-workshop-timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid #dbe1e8;
  border-left: 1px solid #dbe1e8;
}

.ar-workshop-step {
  min-height: 150px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 16px;
  border-right: 1px solid #dbe1e8;
  border-bottom: 1px solid #dbe1e8;
}

.ar-workshop-step > span {
  color: var(--red-dark);
  font-size: .75rem;
  font-weight: 950;
}

.ar-workshop-step h3 {
  margin: 0 0 7px;
  font-size: .95rem;
}

.ar-workshop-step p {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: .82rem;
  line-height: 1.4;
}

.ar-workshop-step small {
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.35;
}

.ar-print-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.print-ar-card {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid #dbe1e8;
  border-radius: 8px;
  background: #fff;
  text-align: center;
  break-inside: avoid;
}

.print-ar-card header {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
}

.print-ar-card header > span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 950;
}

.print-ar-card small {
  color: var(--red-dark);
  font-weight: 900;
}

.print-ar-card h3 {
  margin: 1px 0 0;
  font-size: 1rem;
}

.print-ar-card > strong {
  min-height: 42px;
  align-content: center;
  color: var(--charcoal);
  font-size: .86rem;
  line-height: 1.35;
}

.print-ar-card img {
  width: min(100%, 150px);
  height: auto;
  aspect-ratio: 1;
}

.print-ar-card p {
  margin: 0;
  color: var(--muted);
  font-size: .74rem;
  line-height: 1.35;
}

@keyframes arSpotlight {
  0%, 100% { transform: rotate(-10deg); opacity: .5; }
  50% { transform: rotate(9deg); opacity: 1; }
}

@keyframes arBalance {
  0%, 100% { transform: rotate(-9deg); }
  50% { transform: rotate(0deg); }
}

@keyframes arPanLeft {
  0%, 100% { transform: translateY(-9px); }
  50% { transform: translateY(0); }
}

@keyframes arPanRight {
  0%, 100% { transform: translateY(9px); }
  50% { transform: translateY(0); }
}

@keyframes arCompass {
  0% { transform: rotate(-140deg); }
  60%, 100% { transform: rotate(24deg); }
}

@keyframes arBridge {
  0%, 18% { transform: scaleX(.08); opacity: .45; }
  70%, 100% { transform: scaleX(1); opacity: 1; }
}

@keyframes arBreathe {
  0% { transform: scale(.35); opacity: .9; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes arSharpen {
  0%, 25% { filter: blur(6px); opacity: .6; }
  70%, 100% { filter: blur(0); opacity: 1; }
}

@keyframes arLens {
  0%, 100% { transform: translateX(-24px); }
  55% { transform: translateX(35px); }
}

@keyframes arQuestion {
  0%, 100% { transform: translateY(0); opacity: .7; }
  50% { transform: translateY(-8px); opacity: 1; }
}

@keyframes arStep {
  0%, 22% { background: rgba(255, 255, 255, .2); }
  42%, 100% { background: #ffd95c; border-color: #ffd95c; }
}

@media (max-width: 980px) {
  .ar-experience-layout {
    grid-template-columns: 1fr;
  }

  .ar-print-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .ar-camera-panel,
  .ar-card-browser,
  .ar-workshop-panel,
  .ar-print-panel {
    padding: 14px;
  }

  .ar-camera-frame {
    min-height: 410px;
    aspect-ratio: 4 / 5;
  }

  .ar-reticle {
    inset: 14% 10%;
  }

  .ar-camera-frame {
    --ar-character-edge: -7%;
    --ar-character-bottom: -1%;
    --ar-character-width: 82%;
    --ar-character-height: 72%;
  }


  .ar-effect,
  .ar-camera-frame[data-card^="care"] .ar-effect {
    top: 14%;
    right: auto;
    left: 50%;
    width: 145px;
    height: 145px;
    transform: translateX(-50%);
  }

  .ar-overlay-copy,
  .ar-camera-frame[data-card^="care"] .ar-overlay-copy {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }

  .ar-card-browser .panel-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .segmented-control {
    min-width: 142px;
  }

  .ar-workshop-timeline {
    grid-template-columns: 1fr;
  }

  .ar-workshop-step {
    min-height: 0;
  }

  .ar-print-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ar-effect *,
  .ar-overlay {
    animation: none !important;
  }
}

/* Completion milestones and full-screen reward swipe. */
.milestone-path {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
}

.milestone-path li {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding-top: 11px;
  border-top: 3px solid var(--line);
}

.milestone-path li.active {
  border-top-color: var(--red);
}

.milestone-path li.complete {
  border-top-color: var(--teal);
}

.milestone-marker {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: transparent;
}

.milestone-marker svg,
.achievement-icon svg,
.completion-wipe-check svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.milestone-path li.active .milestone-marker {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red-dark);
}

.milestone-path li.complete .milestone-marker {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.milestone-path strong,
.milestone-path small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.milestone-path strong {
  color: var(--charcoal);
  font-size: .86rem;
}

.milestone-path small {
  margin-top: 2px;
  color: var(--muted);
  font-size: .72rem;
  white-space: nowrap;
}

.path-achievement {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 2px 0 18px;
  padding: 12px 0;
  border-top: 1px solid rgba(20, 132, 116, .24);
  border-bottom: 1px solid rgba(20, 132, 116, .24);
  color: var(--teal);
}

.path-achievement[hidden],
.completion-wipe[hidden] {
  display: none;
}

.achievement-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--teal-soft);
}

.achievement-icon svg {
  fill: currentColor;
  stroke-width: 1.5;
}

.path-achievement small,
.path-achievement strong {
  display: block;
}

.path-achievement small {
  font-size: .68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.path-achievement strong {
  color: var(--charcoal);
  font-size: 1rem;
}

.unit-row.complete .unit-number {
  background: var(--teal);
  color: #fff;
}

.completion-wipe {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  pointer-events: auto;
}

.completion-wipe-surface {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: var(--red);
  color: #fff;
  transform: translateX(-105%);
  will-change: transform;
}

.completion-wipe.is-active .completion-wipe-surface {
  animation: completionSwipe .86s cubic-bezier(.76, 0, .24, 1) both;
}

.completion-wipe-check {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 50%;
}

.completion-wipe-check svg {
  width: 28px;
  height: 28px;
}

.completion-wipe-copy {
  display: grid;
  gap: 3px;
}

.completion-wipe-copy small {
  color: rgba(255, 255, 255, .82);
  font-size: .76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.completion-wipe-copy strong {
  max-width: min(560px, 70vw);
  color: #fff;
  font-size: clamp(1.35rem, 4vw, 2.4rem);
  line-height: 1.1;
  text-wrap: balance;
}

@keyframes completionSwipe {
  0% { transform: translateX(-105%); }
  42%, 58% { transform: translateX(0); }
  100% { transform: translateX(105%); }
}

@media (max-width: 620px) {
  .milestone-path {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .milestone-path li {
    min-height: 50px;
    padding: 7px 0;
    border-top-width: 1px;
  }

  .completion-wipe-surface {
    gap: 12px;
  }

  .completion-wipe-check {
    width: 46px;
    height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .completion-wipe.is-active .completion-wipe-surface {
    animation: none;
  }
}

/* Production interaction and account states */
button,
input,
select,
textarea {
  font: inherit;
}

.field input[aria-invalid="true"],
.dashboard-select input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, .14);
}

.field-help {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: .82rem;
}

.auth-help {
  min-height: 44px;
  justify-self: center;
}

.account-actions,
.account-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.account-links {
  margin: 18px 0 0;
  font-size: .9rem;
}

.account-links a {
  color: var(--red-dark);
  font-weight: 700;
}

.confirm-dialog {
  width: min(92vw, 520px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--charcoal);
  box-shadow: 0 28px 80px rgba(16, 24, 40, .28);
}

.confirm-dialog::backdrop {
  background: rgba(16, 24, 40, .56);
}

.confirm-dialog form {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.confirm-dialog h2,
.confirm-dialog p {
  margin: 0;
}

.confirm-dialog-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
}

.confirm-dialog-icon svg {
  width: 24px;
  height: 24px;
}

.confirm-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.privacy-page {
  min-height: 100vh;
  background: var(--surface-muted);
}

.privacy-shell {
  width: min(100% - 32px, 820px);
  margin: 0 auto;
  padding: 32px 0 64px;
}

.privacy-header,
.privacy-content {
  background: var(--surface);
  border: 1px solid var(--line);
}

.privacy-header {
  padding: 26px;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 0;
}

.privacy-header h1,
.privacy-header p,
.privacy-content h2,
.privacy-content p,
.privacy-content ul {
  margin-top: 0;
}

.privacy-content {
  display: grid;
  gap: 22px;
  padding: 26px;
  border-radius: 0 0 var(--radius) var(--radius);
}

.privacy-content section + section {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

@media (max-width: 520px) {
  .confirm-dialog-actions .button,
  .account-actions .button {
    width: 100%;
  }
}
@media (max-width: 980px) {
  body.app-page .app-shell:not(.auth-mode) .sidebar {
    position: sticky;
    top: 0;
    z-index: 60;
    height: 68px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid #dbe1e8;
    background: #fff;
    color: var(--charcoal);
    box-shadow: 0 6px 20px rgba(21, 25, 35, .08);
  }

  body.app-page .app-shell:not(.auth-mode) .brand strong {
    color: var(--charcoal);
  }

  body.app-page .app-shell:not(.auth-mode) .brand small,
  body.app-page .app-shell:not(.auth-mode) .sidebar-card {
    display: none;
  }

  body.app-page .app-shell:not(.auth-mode) .brand-mark {
    background: var(--red-soft);
    color: var(--red-dark);
    box-shadow: none;
  }

  body.app-page .app-shell:not(.auth-mode) .mobile-nav-toggle {
    min-height: 44px;
    border-color: #dbe1e8;
    background: #fff;
    color: var(--charcoal);
  }

  body.app-page .app-shell:not(.auth-mode) .mobile-nav-toggle:hover,
  body.app-page .app-shell:not(.auth-mode) .mobile-nav-toggle[aria-expanded="true"] {
    border-color: rgba(215, 25, 32, .28);
    background: var(--red-soft);
    color: var(--red-dark);
  }

  body.app-page .app-shell:not(.auth-mode) .nav-list {
    position: absolute;
    inset: calc(100% + 6px) 10px auto;
    z-index: 70;
    width: auto;
    min-height: 0;
    max-height: calc(100dvh - 86px);
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #dbe1e8;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .16);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
  }

  body.app-page .app-shell:not(.auth-mode).nav-open .nav-list {
    max-height: calc(100dvh - 86px);
    padding: 8px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  body.app-page .app-shell:not(.auth-mode) .nav-button {
    min-height: 48px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    color: var(--charcoal);
    font-size: .92rem;
    text-align: left;
  }

  body.app-page .app-shell:not(.auth-mode) .nav-button:hover,
  body.app-page .app-shell:not(.auth-mode) .nav-button[aria-current="page"] {
    background: var(--red-soft);
    color: var(--red-dark);
  }
}
/* 2026-07 guided home, compact mobile header, and simplified AR controls. */
.app-shell {
  overflow-x: clip;
}

.mobile-header-actions,
.header-ar-button {
  display: none;
}

.ar-retry-button[hidden],
.tutorial-actions .button[hidden],
.tutorial-step[hidden] {
  display: none !important;
}

.danger-panel {
  border-color: rgba(180, 35, 24, .34);
  background: #fff0f1;
}

.ar-camera-controls {
  display: grid;
  justify-items: start;
  gap: 18px;
  margin-top: 8px;
}

.ar-retry-button,
.tutorial-close {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

.ar-retry-button {
  background: var(--red);
  color: #fff;
  box-shadow: 0 10px 24px rgba(180, 35, 24, .2);
}

.ar-retry-button:hover {
  background: var(--red-dark);
}

.ar-retry-button:focus-visible,
.header-ar-button:focus-visible,
.tutorial-close:focus-visible,
.disclosure-panel summary:focus-visible {
  outline: 3px solid rgba(215, 25, 32, .25);
  outline-offset: 3px;
}

.ar-retry-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ar-retry-button[aria-busy="true"] svg {
  animation: arRetrySpin .8s linear infinite;
}

@keyframes arRetrySpin {
  to { transform: rotate(360deg); }
}

.disclosure-panel {
  margin-top: 16px;
  padding: 0;
}

.disclosure-panel summary {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  cursor: pointer;
  list-style: none;
}

.disclosure-panel summary::-webkit-details-marker {
  display: none;
}

.disclosure-panel summary h2,
.disclosure-panel .disclosure-content h3 {
  margin: 0;
  letter-spacing: 0;
}

.disclosure-panel summary h2 {
  font-size: 1.15rem;
}

.disclosure-panel summary svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--red-dark);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .2s var(--ease);
}

.disclosure-panel[open] summary svg {
  transform: rotate(180deg);
}

.disclosure-panel .disclosure-content {
  display: grid;
  gap: 16px;
  padding: 20px 22px 22px;
  border-top: 1px solid #dbe1e8;
}

.disclosure-panel .disclosure-content h3 {
  font-size: .95rem;
  color: var(--muted);
}

.tutorial-dialog {
  width: min(92vw, 620px);
  max-height: min(88vh, 720px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--charcoal);
  box-shadow: 0 30px 90px rgba(16, 24, 40, .3);
}

.tutorial-dialog::backdrop {
  background: rgba(16, 24, 40, .62);
}

.tutorial-shell {
  display: grid;
  gap: 20px;
  padding: 22px;
}

.tutorial-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tutorial-step-count {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 850;
}

.tutorial-close {
  background: var(--surface-muted);
  color: var(--charcoal);
}

.tutorial-close:hover {
  background: var(--red-soft);
  color: var(--red-dark);
}

.tutorial-close svg,
.tutorial-destinations svg,
.tutorial-continue-preview svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tutorial-step h2,
.tutorial-step p {
  margin-top: 0;
}

.tutorial-step h2 {
  margin-bottom: 8px;
  font-size: 1.65rem;
}

.tutorial-step > p:last-of-type {
  max-width: 58ch;
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.tutorial-destinations {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tutorial-destinations > span {
  min-height: 88px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-tint);
  color: var(--red-dark);
  text-align: center;
}

.tutorial-destinations strong {
  color: var(--charcoal);
  font-size: .88rem;
}

.tutorial-continue-preview {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--red);
  color: #fff;
  font-weight: 850;
  box-shadow: 0 14px 30px rgba(143, 17, 24, .2);
}

.tutorial-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

@media (max-width: 980px) {
  body.app-page .app-shell:not(.auth-mode) .sidebar {
    grid-template-columns: auto minmax(0, 1fr);
    align-self: start;
  }

  body.app-page .app-shell:not(.auth-mode) .brand {
    width: 44px;
    min-width: 44px;
  }

  .mobile-header-actions {
    display: flex;
    justify-self: end;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .header-ar-button {
    width: 44px;
    height: 44px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border: 0;
    border-radius: var(--radius);
    background: var(--red);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(180, 35, 24, .2);
  }

  .header-ar-button:hover {
    background: var(--red-dark);
  }

  .header-ar-button svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  body.app-page .app-shell:not(.auth-mode) .mobile-nav-toggle {
    display: inline-flex;
  }
}

@media (max-width: 520px) {
  body.app-page .app-shell:not(.auth-mode) .sidebar {
    height: 64px;
    padding: 9px 10px;
  }

  body.app-page .app-shell:not(.auth-mode) .mobile-nav-toggle {
    gap: 6px;
    padding-inline: 10px;
    font-size: .8rem;
  }

  .tutorial-shell {
    gap: 16px;
    padding: 18px;
  }

  .tutorial-destinations {
    grid-template-columns: 1fr;
  }

  .tutorial-destinations > span {
    min-height: 58px;
    grid-template-columns: auto 1fr;
    justify-items: start;
    text-align: left;
  }

  .disclosure-panel summary,
  .disclosure-panel .disclosure-content {
    padding-inline: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ar-retry-button[aria-busy="true"] svg {
    animation: none;
  }
}

/* Echoes & Rewards */
.home-echo-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding-block: 16px;
  border-left: 4px solid var(--red) !important;
}

.home-echo-mark,
.reward-card-icon,
.activity-icon,
.reward-next-row > span:first-child {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
}

.home-echo-mark {
  width: 50px;
  height: 50px;
}

.home-echo-mark svg,
.reward-sync-notice svg,
.reward-card-icon svg,
.badge-icon svg,
.earn-status svg,
.activity-icon svg,
.reward-next-row svg,
.reward-dialog-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-echo-panel > div:nth-child(2) {
  display: grid;
  gap: 2px;
}

.home-echo-panel > div > span {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

.home-echo-panel > div > strong {
  color: var(--red-dark);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1;
}

.home-echo-panel > div > strong small {
  color: var(--charcoal);
  font-size: .95rem;
}

.home-echo-panel p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .82rem;
}

.rewards-page {
  color: var(--charcoal);
}

.rewards-header,
.reward-sync-notice,
.reward-summary,
.reward-tabs,
.reward-tab-panel {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
}

.rewards-header {
  margin-bottom: 18px;
}

.reward-sync-notice {
  min-height: 62px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #c9d7e4;
  border-radius: var(--radius);
  background: var(--surface-tint);
  color: var(--ink);
}

.reward-sync-notice > svg {
  color: var(--teal);
}

.reward-sync-notice > span {
  display: grid;
  gap: 2px;
}

.reward-sync-notice small {
  color: var(--muted);
  line-height: 1.4;
}

.reward-sync-notice[data-tone="secure"] {
  border-color: #a8d8d2;
  background: var(--teal-soft);
}

.reward-sync-notice[data-tone="pending"] {
  border-color: #ead39b;
  background: var(--amber-soft);
}

.reward-summary {
  display: grid;
  grid-template-columns: minmax(250px, .72fr) minmax(0, 1.8fr);
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.reward-balance-card {
  min-height: 142px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 22px 26px;
  background: var(--red);
  color: #fff;
}

.reward-balance-card > span,
.reward-balance-card > small {
  font-weight: 750;
}

.reward-balance-card > small {
  color: #fff;
}

.reward-balance-card > strong {
  font-size: clamp(2.7rem, 6vw, 4.4rem);
  line-height: 1;
  letter-spacing: -.04em;
}

.reward-summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.reward-summary-metrics > div {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 20px 24px;
  border-left: 1px solid var(--line);
}

.reward-summary-metrics dt {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 750;
}

.reward-summary-metrics dd {
  margin: 0;
  color: var(--charcoal);
  font-size: clamp(1.1rem, 2.5vw, 1.45rem);
  font-weight: 850;
}

.reward-tabs {
  display: flex;
  overflow-x: auto;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  scrollbar-width: thin;
}

.reward-tabs [role="tab"] {
  min-width: max-content;
  min-height: 50px;
  flex: 1 0 auto;
  padding: 10px 22px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
  font-weight: 800;
  cursor: pointer;
}

.reward-tabs [role="tab"]:hover {
  background: var(--surface-muted);
}

.reward-tabs [role="tab"][aria-selected="true"] {
  border-bottom-color: var(--red);
  color: var(--red-dark);
}

.reward-tab-panel {
  padding-bottom: 40px;
}

.reward-section-heading,
.reward-open-section > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.reward-section-heading h2,
.reward-open-section h2,
.reward-open-section h3 {
  margin: 0;
  color: var(--charcoal);
}

.reward-section-heading p,
.reward-open-section header p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.reward-summary-layout,
.reward-history-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.reward-open-section,
.earn-group {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.reward-next-list,
.reward-activity-list,
.redemption-history {
  display: grid;
}

.reward-next-row,
.reward-activity-row,
.redemption-row {
  min-width: 0;
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.reward-next-row:first-child,
.reward-activity-row:first-child,
.redemption-row:first-child {
  border-top: 0;
}

.reward-next-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.reward-next-row > span:first-child,
.activity-icon {
  width: 38px;
  height: 38px;
}

.reward-next-row > span:nth-child(2),
.reward-activity-row > span:nth-child(2),
.redemption-row > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.reward-next-row small,
.reward-activity-row small,
.redemption-row small {
  color: var(--muted);
  line-height: 1.4;
}

.reward-next-row > strong {
  color: var(--teal);
  font-size: .82rem;
}

.badge-collection {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.badge-card {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  column-gap: 12px;
  row-gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.badge-card.earned {
  border-color: #9dd4ce;
  box-shadow: inset 4px 0 0 var(--teal);
}

.badge-card.locked {
  background: var(--surface-muted);
}

.badge-icon {
  grid-row: 1 / span 5;
  width: 52px;
  height: 52px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
}

.badge-card.locked .badge-icon {
  background: #e0e5eb;
  color: #5f6975;
}

.badge-state {
  width: max-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: .72rem;
}

.badge-card.locked .badge-state {
  background: #e3e7ec;
  color: #4a5562;
}

.badge-card h3,
.badge-card p {
  margin: 0;
}

.badge-card h3 {
  font-size: 1rem;
}

.badge-card p {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.45;
}

.badge-requirement {
  color: var(--ink) !important;
  font-weight: 650;
}

.badge-progress {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.badge-progress > span {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce2e8;
}

.badge-progress i {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--teal);
}

.badge-progress small {
  color: var(--muted);
}

.earn-breakdown {
  display: grid;
  gap: 16px;
}

.earn-group {
  padding: 0;
  overflow: hidden;
}

.earn-group > header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-tint);
}

.earn-group h3,
.earn-group p {
  margin: 0;
}

.earn-group p {
  margin-top: 5px;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.45;
}

.earn-row {
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(128px, auto);
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
}

.earn-group > header + .earn-row {
  border-top: 0;
}

.earn-row > div {
  display: grid;
  gap: 3px;
}

.earn-row > div span {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
}

.earn-value {
  color: var(--red-dark);
  white-space: nowrap;
}

.earn-status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  color: #5f6975;
  font-size: .8rem;
  font-weight: 800;
}

.earn-status svg {
  width: 18px;
  height: 18px;
}

.earn-row.earned .earn-status {
  color: var(--teal);
}

.reward-catalog {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.reward-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.reward-card-icon {
  width: 52px;
  height: 52px;
}

.reward-card-copy h3,
.reward-card-copy p {
  margin: 0;
}

.reward-card-copy p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.reward-cost {
  display: block;
  margin-top: 10px;
  color: var(--red-dark);
  font-size: 1.2rem;
}

.reward-card-status {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink);
  font-size: .86rem;
}

.reward-card-status li::before {
  content: "•";
  margin-right: 8px;
  color: var(--teal);
}

.reward-card > .button {
  min-width: 112px;
}

.reward-card > .button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reward-card > details {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.reward-card > details summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--teal);
  font-size: .84rem;
  font-weight: 800;
  cursor: pointer;
}

.reward-card > details p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.5;
}

.reward-card .button.reward-locked:disabled {
  border-color: #cfd5dc;
  background: #e5e8ec;
  color: #5d6670;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}

.reward-activity-row {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.activity-points {
  color: var(--teal);
  white-space: nowrap;
}

.reward-activity-row.spent .activity-points {
  color: var(--red-dark);
}

.activity-status,
.redemption-status {
  width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: .72rem;
  font-weight: 800;
  text-transform: capitalize;
}

.redemption-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.redemption-status[data-status="pending"],
.redemption-status[data-status="approved"] {
  background: var(--amber-soft);
  color: var(--amber);
}

.redemption-status[data-status="rejected"],
.redemption-status[data-status="cancelled"] {
  background: var(--danger-soft);
  color: var(--danger);
}

.reward-empty-state {
  margin: 0;
  padding: 20px 0;
  color: var(--muted);
  line-height: 1.5;
}

.redemption-confirm-summary {
  display: grid;
  gap: 0;
  margin: 16px 0;
  border-block: 1px solid var(--line);
}

.redemption-confirm-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.redemption-confirm-summary > div:first-child {
  border-top: 0;
}

.redemption-confirm-summary dd {
  margin: 0;
  font-weight: 850;
}

.reward-dialog-icon {
  background: var(--teal-soft) !important;
  color: var(--teal) !important;
}

@media (max-width: 980px) {
  .reward-summary {
    grid-template-columns: 1fr;
  }

  .reward-balance-card {
    min-height: 124px;
  }

  .reward-summary-metrics > div:first-child {
    border-left: 0;
  }

  .badge-collection {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reward-summary-layout,
  .reward-history-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .home-echo-panel {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .home-echo-panel > .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .reward-sync-notice {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .reward-sync-notice .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .reward-summary-metrics {
    grid-template-columns: 1fr;
  }

  .reward-summary-metrics > div {
    min-height: 74px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .badge-collection,
  .reward-catalog {
    grid-template-columns: 1fr;
  }

  .earn-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .earn-status {
    grid-column: 1 / -1;
  }

  .reward-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .reward-card > .button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .reward-activity-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .activity-status {
    grid-column: 2 / -1;
  }
}

@media (max-width: 480px) {
  .rewards-page {
    padding-inline: 14px;
  }

  .reward-tabs [role="tab"] {
    min-height: 48px;
    padding-inline: 16px;
  }

  .badge-card {
    padding: 16px;
  }

  .badge-icon {
    width: 46px;
    height: 46px;
  }

  .reward-section-heading,
  .reward-open-section > header {
    flex-direction: column;
  }

  .reward-activity-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .activity-points,
  .activity-status {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .badge-progress i,
  .reward-balance-card > strong {
    transition: none !important;
  }
}
