:root {
  --ink: #102a43;
  --muted: #627d98;
  --line: #d9e2ec;
  --paper: rgba(255, 255, 255, 0.88);
  --teal: #0f766e;
  --teal-deep: #115e59;
  --teal-soft: #ccfbf1;
  --sand: #f4f7f5;
  --danger: #b91c1c;
  --ok: #047857;
  --shadow: 0 10px 30px rgba(16, 42, 67, 0.08);
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Vazirmatn", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: #e8eef2;
  -webkit-tap-highlight-color: transparent;
}
body { overflow-x: hidden; }
button, a { font-family: inherit; }
img { max-width: 100%; height: auto; display: block; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(15, 118, 110, 0.18), transparent 55%),
    radial-gradient(900px 500px at -10% 20%, rgba(14, 116, 144, 0.14), transparent 50%),
    linear-gradient(180deg, #eef5f3 0%, #e7edf2 45%, #e4ebe8 100%);
}

.splash {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.splash-inner { text-align: center; display: grid; gap: 6px; }
.splash-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.splash-mark {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--teal-deep);
  line-height: 1.15;
}
.splash-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.app {
  min-height: 100vh;
  padding: calc(58px + var(--safe-top)) 0 calc(78px + var(--safe-bottom));
}
.app.sub-page {
  padding-bottom: calc(8px + var(--safe-bottom));
  min-height: 0;
}
.app.sub-page .main {
  padding-bottom: 8px;
}
.app.is-navigating .bottom-nav {
  opacity: 0.55;
  pointer-events: none;
}
.topbar {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(244, 247, 245, 0.82);
  border-bottom: 1px solid rgba(217, 226, 236, 0.9);
}
.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  min-height: calc(56px + var(--safe-top));
  padding: var(--safe-top) 14px 0;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
}
.topbar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
}
.topbar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--teal-deep);
  flex-shrink: 0;
}
.topbar-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  padding: 0;
}
.icon-btn svg { width: 22px; height: 22px; }
#header-back svg {
  transform: scaleX(-1);
}
.topbar-spacer { width: 40px; height: 40px; }

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 14px 28px;
}

.page-loading {
  min-height: 40vh;
  display: grid;
  place-items: center;
  gap: 12px;
  color: var(--muted);
}
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(15, 118, 110, 0.2);
  border-top-color: var(--teal);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.home-hero {
  margin-bottom: 18px;
  padding: 8px 4px 4px;
}
.home-hero h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: -0.03em;
}
.home-hero p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.course-list {
  display: grid;
  gap: 12px;
}
.course-item {
  width: 100%;
  text-align: right;
  border: 1px solid rgba(217, 226, 236, 0.95);
  background: var(--paper);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.course-item:active { transform: scale(0.985); }
.course-item.is-locked {
  opacity: 0.72;
  cursor: default;
}
.course-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.course-item h2 {
  margin: 0;
  font-size: 18px;
}
.course-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.course-meta {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--teal-soft);
  color: var(--teal-deep);
  font-weight: 600;
}
.pill.is-muted {
  background: #eef2f6;
  color: var(--muted);
  font-weight: 500;
}

.exam-shell {
  display: grid;
  gap: 14px;
}
.exam-progress {
  display: grid;
  gap: 8px;
}
.exam-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(217, 226, 236, 0.9);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #14b8a6, #0f766e);
  transition: width 0.25s ease;
}

.study-review-list {
  display: grid;
  gap: 14px;
}
.study-review-item {
  margin: 0;
}
.question-panel {
  background: var(--paper);
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px 16px 16px;
  display: grid;
  gap: 16px;
}
.q-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-deep);
  letter-spacing: 0.02em;
}
.blocks {
  display: grid;
  gap: 12px;
}
.block-text {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.9;
  text-align: justify;
}
.block-image {
  border-radius: 14px;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid var(--line);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px;
}
.block-image img {
  width: auto;
  height: auto;
  max-width: 66%;
  max-height: 280px;
  object-fit: contain;
  background: #fff;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: auto;
}

.options {
  display: grid;
  gap: 10px;
}
.option {
  width: 100%;
  text-align: right;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.option:active { transform: scale(0.99); }
.option.is-selected {
  border-color: var(--teal);
  background: linear-gradient(180deg, #f0fdfa, #ffffff);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}
.option-badge {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--teal-deep);
  background: var(--teal-soft);
}
.option.is-selected .option-badge {
  background: var(--teal);
  color: #fff;
}
.option-body {
  min-width: 0;
}
.option-body .block-text {
  font-size: 14.5px;
  text-align: right;
  line-height: 1.75;
}
.option-body .block-image {
  border: 0;
  background: transparent;
  padding: 4px 0;
}
.option-body .block-image img {
  max-width: 66%;
  max-height: 120px;
  margin-inline: auto;
}

.exam-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 8px;
  position: relative;
  z-index: 1;
}
.exam-actions .btn-block {
  width: 100%;
}
.study-actions {
  border-top: 1px solid rgba(217, 226, 236, 0.9);
  margin-top: 16px;
  padding-top: 16px;
}
.btn {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
a.btn,
a.btn:hover,
a.btn:visited,
a.btn:active {
  text-decoration: none;
  color: inherit;
}
a.btn.btn-primary,
a.btn.btn-primary:hover,
a.btn.btn-primary:visited {
  color: #fff;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(135deg, #0f766e, #0e7490);
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.25);
}
.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.btn-ghost {
  background: transparent;
  color: var(--teal-deep);
  border: 1.5px dashed rgba(15, 118, 110, 0.35);
}
.nav-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 16px;
  width: 100%;
  margin-top: 0;
  box-sizing: border-box;
}
.nav-row > .btn {
  flex: 1 1 0;
  min-width: 0;
  max-width: calc(50% - 8px);
  box-shadow: none !important;
  margin: 0;
}

.explanation-box {
  border-radius: 16px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  background: linear-gradient(180deg, #f0fdfa, #ffffff);
  padding: 12px;
  display: grid;
  gap: 10px;
}
.explanation-box h3 {
  margin: 0;
  font-size: 14px;
  color: var(--teal-deep);
}
.explanation-zoom-tip {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.block-image--zoomable {
  position: relative;
  width: 100%;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #f8fafc;
  cursor: zoom-in;
  font: inherit;
  color: inherit;
  text-align: inherit;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px;
}
.block-image--zoomable img {
  width: auto;
  height: auto;
  max-width: 66%;
  max-height: 280px;
  object-fit: contain;
  background: #fff;
  pointer-events: none;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: auto;
}
.option-body .block-image--zoomable {
  border: 0;
  background: transparent;
  padding: 4px 0;
}
.option-body .block-image--zoomable img {
  max-width: 66%;
  max-height: 120px;
}
.zoom-hint {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(16, 42, 67, 0.72);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 6px;
  pointer-events: none;
  letter-spacing: 0;
  opacity: 0.9;
}

body.zoom-open { overflow: hidden; }
.img-zoom {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: stretch;
}
.img-zoom.hidden { display: none !important; }
.img-zoom-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(4, 10, 16, 0.94);
  cursor: pointer;
}
.img-zoom-shell {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-sizing: border-box;
}
.img-zoom-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: rgba(8, 18, 28, 0.72);
  backdrop-filter: blur(10px);
}
.img-zoom-btn {
  min-width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}
.img-zoom-btn--text { font-size: 14px; }
.img-zoom-btn--close { background: rgba(185, 28, 28, 0.85); }
.img-zoom-level {
  min-width: 56px;
  text-align: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.img-zoom-stage {
  position: relative;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border-radius: 0;
  background: #0b1220;
  touch-action: pan-x pan-y;
  cursor: grab;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8px;
  min-height: 0;
}
.img-zoom-stage.is-zoomed { cursor: grab; }
.img-zoom-stage.is-panning { cursor: grabbing; }
.img-zoom-target {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0 auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: auto;
  background: #fff;
  border-radius: 4px;
}

.result-panel {
  background: var(--paper);
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 20px 16px;
  display: grid;
  gap: 16px;
}
.result-panel h1 {
  margin: 0;
  font-size: 24px;
}
.result-score {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 18px 12px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ccfbf1, #f8fffd);
  border: 1px solid rgba(15, 118, 110, 0.15);
}
.result-score .big {
  font-size: 42px;
  font-weight: 800;
  color: var(--teal-deep);
  line-height: 1;
}
.result-score .label {
  color: var(--muted);
  font-size: 13px;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow);
}
.stat-card strong {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--teal-deep);
  line-height: 1.2;
  letter-spacing: 0.02em;
}
.stat-card span,
.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}
.stat-card small {
  font-size: 11px;
  font-weight: 500;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}
.stat .k {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.stat .v {
  font-size: 20px;
  font-weight: 800;
}
.stat .v.is-ok { color: var(--ok); }
.stat .v.is-bad { color: var(--danger); }
.wrong-list {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.wrong-list h2 {
  margin: 0 0 8px;
  font-size: 15px;
}
.wrong-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #fee2e2;
  color: var(--danger);
  font-weight: 700;
  font-size: 13px;
}
.empty-note {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.tg-blocked {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
}
.tg-blocked-inner {
  max-width: 360px;
  background: var(--paper);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.tg-blocked h1 { margin: 0 0 8px; font-size: 22px; }
.tg-blocked p { margin: 0; color: var(--muted); line-height: 1.7; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 60;
  background: rgba(16, 42, 67, 0.92);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  max-width: min(90vw, 420px);
  text-align: center;
}
.app.sub-page .toast {
  bottom: calc(24px + var(--safe-bottom));
}

.empty-state {
  min-height: 40vh;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  color: var(--muted);
}
.empty-state.compact { min-height: 180px; padding: 20px 8px; }
.empty-state h4 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 720px;
  display: flex;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  border-top: 1px solid rgba(217, 226, 236, 0.95);
  padding-bottom: var(--safe-bottom);
  z-index: 40;
  box-shadow: 0 -8px 28px rgba(16, 42, 67, 0.06);
}
.bottom-nav.hidden { display: none; }
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 2px 8px;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--teal-deep); }
.nav-item.hidden { display: none; }

/* Shared cards / sections */
.section { display: grid; gap: 14px; }
.card {
  background: var(--paper);
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.card-head h3 { margin: 0; font-size: 15px; }
.info-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #eef6f4;
  border: 1px solid rgba(15, 118, 110, 0.12);
  color: var(--muted);
  font-size: 13px;
}
.info-banner p { margin: 0; line-height: 1.7; }
.btn-block { width: 100%; display: block; text-align: center; text-decoration: none; }
.btn-sm { padding: 9px 12px; font-size: 13px; border-radius: 12px; }

/* Profile */
.profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 2px;
}
.profile-header-text {
  flex: 1;
  min-width: 0;
}
.profile-header #btn-buy-sub {
  flex-shrink: 0;
  white-space: nowrap;
}
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #14b8a6, #0f766e);
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  flex-shrink: 0;
}
.profile-avatar--photo {
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
}
.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-header h2 { margin: 0; font-size: 18px; }
.profile-header small { color: var(--muted); }
.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.profile-stat {
  background: var(--paper);
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.profile-stat strong {
  display: block;
  font-size: 18px;
  color: var(--teal-deep);
  line-height: 1.2;
}
.profile-stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.profile-entry-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.profile-entry-card {
  appearance: none;
  border: 1px solid rgba(217, 226, 236, 0.95);
  background: var(--paper);
  border-radius: 16px;
  padding: 16px;
  text-align: right;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: grid;
  gap: 4px;
}
.profile-entry-card strong {
  font-size: 16px;
  color: var(--teal-deep);
}
.profile-entry-card span {
  font-size: 12px;
  color: var(--muted);
}
.profile-drill-list {
  display: grid;
  gap: 10px;
}
.profile-drill-card {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(217, 226, 236, 0.95);
  background: var(--paper);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: right;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.profile-drill-card-main {
  flex: 1;
  display: grid;
  gap: 6px;
  min-width: 0;
}
.profile-drill-card-main strong {
  font-size: 15px;
  color: var(--ink);
}
.profile-drill-card-main > span {
  font-size: 12px;
  color: var(--muted);
}
.profile-drill-chevron {
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  display: inline-block;
  transform: scaleX(-1);
}
.profile-type-card {
  margin: 0;
}
.profile-actions {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}
.profile-sub-list {
  margin: 10px 0 14px;
  padding-inline-start: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}
.attempt-history { display: grid; gap: 10px; }
.attempt-row {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.attempt-row-top,
.attempt-row-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.attempt-row-top strong { font-size: 14px; }
.attempt-score {
  font-weight: 800;
  color: var(--teal-deep);
}
.attempt-row-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.attempt-wrong {
  margin-top: 8px;
  font-size: 12px;
  color: var(--danger);
}
.attempt-wrong.is-ok { color: var(--ok); }

/* Help */
.help-hero {
  text-align: center;
  padding: 8px 4px 4px;
}
.help-hero h2 { margin: 0 0 6px; font-size: 22px; }
.help-hero p { margin: 0; color: var(--muted); font-size: 14px; }
.help-steps {
  background: var(--paper);
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.help-steps h3 { margin: 0 0 12px; font-size: 15px; }
.help-steps ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.help-steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink);
}
.help-steps li span {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--teal-soft);
  color: var(--teal-deep);
  font-weight: 800;
  font-size: 12px;
}
.support-btn { margin-top: 4px; }

/* Admin */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.admin-header--rich {
  align-items: flex-start;
  margin-bottom: 4px;
}
.admin-kicker {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--teal-deep);
  opacity: 0.85;
}
.admin-header h2 { margin: 0; font-size: 22px; font-weight: 800; }
.admin-badge {
  background: linear-gradient(180deg, #f0fdfa, #e6fffa);
  color: var(--teal-deep);
  font-size: 12px;
  font-weight: 800;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.18);
}
.admin-tab-panel { margin-top: 4px; }
.admin-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs--grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  overflow: visible;
}
.admin-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}
.admin-tabs--grid .admin-tab {
  display: grid;
  justify-items: center;
  gap: 4px;
  white-space: normal;
  min-height: 58px;
  font-size: 12px;
}
.admin-tab.active {
  border-color: rgba(15, 118, 110, 0.35);
  background: linear-gradient(180deg, #f0fdfa, #ffffff);
  color: var(--teal-deep);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.08);
}
.admin-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.admin-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.admin-stat.wide { grid-column: 1 / -1; }
.admin-stat span {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--teal-deep);
  line-height: 1.2;
}
.admin-stat small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.admin-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-pay-card .admin-pay-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.admin-pay-card .admin-pay-top h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}
.admin-pay-meta {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.5;
}
.admin-pay-meta strong { color: var(--muted); font-weight: 600; }
.admin-pay-meta code {
  font-size: 11px;
  background: var(--teal-soft);
  padding: 1px 6px;
  border-radius: 6px;
}
.receipt-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.receipt-modal-card {
  width: min(420px, 100%);
  max-height: min(86vh, 720px);
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.receipt-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.receipt-modal-body {
  padding: 12px;
  overflow: auto;
  text-align: center;
}
.receipt-modal-img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  margin: 0 auto;
}
.admin-user-row--rich {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-user-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.admin-user-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink);
}
.admin-user-seen {
  display: block;
  margin-top: 4px;
}
.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-broadcast-card {
  margin-bottom: 4px;
}
.admin-broadcast-card textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
  min-height: 72px;
}
.admin-text-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.admin-text-modal-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 14px;
  display: grid;
  gap: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}
.admin-text-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.admin-text-modal-card textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
  min-height: 96px;
}
.admin-text-modal-actions {
  display: grid;
  gap: 8px;
}
.admin-toolbar { margin-bottom: 12px; }
.search-bar input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
}
.admin-order-list,
.admin-user-list,
.admin-course-list {
  display: grid;
  gap: 10px;
}
.admin-order-row,
.admin-user-row,
.admin-course-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.admin-order-row-top,
.admin-order-row-meta,
.admin-order-row-bottom,
.admin-course-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.admin-order-row-top code {
  font-size: 11px;
  color: var(--teal-deep);
}
.order-status {
  font-size: 12px;
  font-weight: 800;
  color: var(--teal-deep);
  background: var(--teal-soft);
  padding: 4px 8px;
  border-radius: 999px;
}
.admin-order-row-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}
.admin-order-row-bottom {
  margin-top: 8px;
  font-size: 12px;
}
.admin-user-main {
  display: grid;
  gap: 4px;
}
.admin-user-main strong { font-size: 14px; }
.admin-user-id {
  font-size: 12px;
  color: var(--teal-deep);
}
.admin-user-main small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.admin-course-top h3 { margin: 0; font-size: 15px; }
.admin-course-top p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.admin-danger-card {
  border-color: rgba(185, 28, 28, 0.25);
  background: linear-gradient(180deg, #fff5f5, #ffffff);
}
.admin-reset-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin: 0 0 12px;
}
.admin-reset-btn {
  background: linear-gradient(135deg, #b91c1c, #9f1239) !important;
}
.admin-course-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.admin-sort-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(217, 226, 236, 0.9);
}
.admin-sort-list {
  display: grid;
  gap: 8px;
}
.admin-sort-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 12px;
  background: var(--paper);
}
.admin-sort-row.is-active {
  border-color: rgba(15, 118, 110, 0.45);
  background: var(--teal-soft);
}
.admin-sort-rank {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-deep);
  background: rgba(15, 118, 110, 0.1);
}
.admin-sort-title {
  flex: 1;
  min-width: 0;
  text-align: right;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}
.admin-sort-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.admin-sort-actions .btn-sm {
  min-width: 36px;
  padding-inline: 8px;
}
.btn-danger-outline {
  background: #fff;
  color: var(--danger);
  border: 1.5px solid rgba(185, 28, 28, 0.35);
}
.btn-danger-outline:active {
  background: #fff5f5;
}
.admin-options-grid {
  display: grid;
  gap: 10px;
  margin: 10px 0;
}
.option-editor {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}
.wizard-card { overflow: hidden; }
.wizard-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.wizard-step {
  display: grid;
  justify-items: center;
  gap: 4px;
  opacity: 0.45;
}
.wizard-step.is-active,
.wizard-step.is-done { opacity: 1; }
.wizard-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.wizard-step.is-active .wizard-num,
.wizard-step.is-done .wizard-num {
  background: var(--teal);
  color: #fff;
}
.wizard-label { font-size: 10px; color: var(--muted); text-align: center; }
.wizard-pane h4 { margin: 0 0 8px; font-size: 15px; color: var(--ink); }
.wizard-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.wizard-check {
  margin: 10px 0 0;
  padding-inline-start: 18px;
  color: var(--muted);
  line-height: 1.8;
  font-size: 13px;
}
.wizard-error {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid rgba(185, 28, 28, 0.25);
  color: #991b1b;
  font-size: 13px;
  font-weight: 700;
}
.file-picked {
  margin: -4px 0 10px;
  font-size: 12px;
  color: var(--teal-deep);
  font-weight: 600;
}
.reset-steps {
  display: flex;
  gap: 8px;
  margin: 10px 0 12px;
}
.reset-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fee2e2;
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
  opacity: 0.35;
}
.reset-dot.on { opacity: 1; background: var(--danger); color: #fff; }
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.filter-chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.filter-chip.active {
  border-color: rgba(15, 118, 110, 0.35);
  background: var(--teal-soft);
  color: var(--teal-deep);
}
.log-group { margin-bottom: 14px; }
.log-group-title {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--teal-deep);
}
.perm-grid {
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
}
.perm-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}
.perm-item--sensitive {
  border-color: rgba(180, 83, 9, 0.35);
  background: #fffbeb;
}
.perm-item span {
  display: grid;
  gap: 2px;
  line-height: 1.35;
}
.perm-item strong {
  color: var(--ink);
  font-size: 13px;
}
.perm-item small {
  color: var(--muted);
  font-size: 11px;
}
.adm-panel { display: grid; gap: 12px; }
.adm-add-card { margin: 0; }
.adm-section-label {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--teal-deep);
}
.adm-preview {
  border: 1.5px dashed rgba(15, 118, 110, 0.28);
  background: #f7fffd;
  border-radius: 14px;
  padding: 12px;
  margin: 4px 0 8px;
}
.adm-preview.is-empty { background: #f8fafc; border-color: var(--line); }
.adm-preview-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}
.adm-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 2px 0;
}
.adm-list-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}
.adm-list-head span {
  font-size: 12px;
  font-weight: 800;
  color: var(--teal-deep);
  background: var(--teal-soft);
  padding: 4px 10px;
  border-radius: 999px;
}
.adm-list { display: grid; gap: 10px; }
.adm-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 12px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}
.adm-card--super {
  background: linear-gradient(180deg, #f0fdfa 0%, #ffffff 55%);
  border-color: rgba(15, 118, 110, 0.22);
}
.adm-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.adm-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(145deg, #0f766e, #134e4a);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}
.adm-avatar--photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.adm-card-meta { min-width: 0; flex: 1; }
.adm-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.adm-card-title-row strong {
  font-size: 15px;
  line-height: 1.35;
}
.adm-role-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  white-space: nowrap;
}
.adm-role-pill.is-super {
  background: rgba(15, 118, 110, 0.12);
  color: var(--teal-deep);
}
.adm-role-pill.is-muted {
  background: #f8fafc;
  color: var(--muted);
}
.adm-card-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.adm-card-ids span[dir="ltr"] {
  color: var(--teal-deep);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.adm-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.adm-perm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.adm-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: #334155;
}
.adm-chip--more {
  background: var(--teal-soft);
  border-color: transparent;
  color: var(--teal-deep);
}
.adm-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.adm-btn-danger {
  color: #b91c1c !important;
  border-color: rgba(185, 28, 28, 0.25) !important;
}
.adm-locked-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.adm-perm-modal-card {
  max-height: min(88vh, 720px);
  overflow: auto;
}
.field {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  font-size: 13px;
  color: var(--muted);
}
.field input,
.field textarea,
.field select {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  width: 100%;
}
.field textarea { resize: vertical; }
.section-head h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

/* Light motion — GPU friendly */
.page-enter {
  animation: pageEnter 0.22s ease both;
}
.exam-enter-next {
  animation: examNext 0.24s ease both;
}
.exam-enter-prev {
  animation: examPrev 0.24s ease both;
}
.exam-enter-fade {
  animation: pageEnter 0.18s ease both;
}
.course-item,
.nav-item,
.btn,
.option {
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.motion-card:active,
.course-item:active,
.btn:active {
  transform: scale(0.985);
}
.option.is-selected {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes examNext {
  from { opacity: 0; transform: translateX(-18px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes examPrev {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .page-enter,
  .exam-enter-next,
  .exam-enter-prev,
  .exam-enter-fade {
    animation: none !important;
  }
  .course-item,
  .nav-item,
  .btn,
  .option {
    transition: none !important;
  }
}

@media (min-width: 640px) {
  .main { padding-inline: 20px; }
  .question-panel, .result-panel { padding: 22px 22px; }
  .home-hero h1 { font-size: 32px; }
  .admin-tabs--grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Study architecture */
.study-page { display: grid; gap: 12px; }
.study-title { margin: 0; font-size: 22px; color: var(--ink); }
.study-crumb { margin: 0; font-size: 12px; color: var(--muted); }
.study-list { display: grid; gap: 10px; }
.study-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow);
}
.study-card h3 { margin: 0 0 4px; font-size: 16px; }
.study-card p { margin: 0; color: var(--muted); font-size: 13px; }
.study-card--stack { flex-direction: column; align-items: stretch; }
.resource-row {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}
.resource-row-main { flex: 1; min-width: 0; }
.resource-row-main h3 { margin: 0 0 4px; font-size: 15px; }
.resource-row-main p { margin: 0; color: var(--muted); font-size: 12px; }
.resource-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.resource-icon--pdf { background: #fef2f2; color: #b91c1c; }
.resource-icon--link { background: var(--teal-soft); color: var(--teal-deep); }
.resource-icon--folder { background: #ecfdf5; color: #047857; font-size: 18px; }
.type-row { display: grid; gap: 8px; margin-top: 10px; }
.meta-chip {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--teal-deep);
  background: var(--teal-soft);
  padding: 3px 8px;
  border-radius: 999px;
}
.feedback { border-radius: 14px; padding: 10px 12px; font-weight: 700; font-size: 14px; }
.feedback.ok { background: #ecfdf5; color: #047857; }
.feedback.bad { background: #fef2f2; color: #b91c1c; }
.feedback.skip { background: #fffbeb; color: #b45309; }
.option.is-locked {
  cursor: default;
}
.option.is-correct { border-color: #059669; background: #ecfdf5; }
.option.is-wrong { border-color: #dc2626; background: #fef2f2; }
.subject-bar { margin-bottom: 10px; }
.subject-bar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.bottom-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* Phase-2 exams */
.study-subtitle { margin: 16px 0 8px; font-size: 15px; color: var(--ink); }
.exam-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--teal-deep);
  background: var(--teal-soft);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
}
.q-map {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 12px;
}
.q-map-dot {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.q-map-dot.is-answered { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-deep); }
.q-map-dot.is-current { outline: 2px solid var(--teal); }
.q-map-dot.is-empty { opacity: 0.85; }
.info-banner {
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.info-banner p { margin: 0; font-size: 13px; color: var(--muted); }
.admin-stack { display: grid; gap: 12px; width: 100%; max-width: 100%; }
.admin-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}
.admin-card h3 { margin: 0 0 10px; font-size: 15px; color: var(--ink); }
.admin-form {
  display: grid;
  gap: 4px;
  width: 100%;
  min-width: 0;
}
.admin-form > .field,
.admin-form > label:not(.check-row) {
  display: grid;
  gap: 6px;
  margin: 8px 0;
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
}
.admin-form input,
.admin-form select,
.admin-form textarea {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  outline: none;
  -moz-appearance: textfield;
  appearance: none;
}
.admin-form select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7c85' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 32px;
}
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}
.admin-form input[type="number"]::-webkit-outer-spin-button,
.admin-form input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.admin-form input[type="checkbox"],
.admin-form input[type="radio"] {
  width: 18px;
  min-width: 18px;
  max-width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  appearance: auto;
  -webkit-appearance: auto;
  accent-color: var(--teal);
  flex-shrink: 0;
}
.admin-form input[type="radio"]:focus,
.admin-form input[type="checkbox"]:focus {
  box-shadow: none;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
  margin: 4px 0 8px;
}
.form-row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row > label,
.form-row > .field {
  display: grid;
  gap: 6px;
  margin: 0;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
}
.form-row input {
  width: 100%;
  min-width: 0;
  padding: 10px 8px;
  text-align: center;
  direction: ltr;
}
.quota-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
  margin: 4px 0 8px;
}
.quota-grid > label {
  display: grid;
  gap: 6px;
  margin: 0;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
}
.quota-grid input {
  width: 100%;
  min-width: 0;
  text-align: center;
  direction: ltr;
}
.admin-mini-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 12px;
  display: grid;
  gap: 8px;
}
.admin-mini-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f7faf9;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink);
}
.check-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin: 8px 0 !important;
  color: var(--ink) !important;
  font-size: 13px !important;
}
.admin-form .btn {
  width: 100%;
  margin-top: 4px;
}
@media (max-width: 380px) {
  .form-row,
  .form-row--2,
  .quota-grid {
    grid-template-columns: 1fr;
  }
  .form-row input { text-align: start; }
}

.type-toggle { display:flex; gap:14px; margin:6px 0 10px; font-size:13px; }
.type-toggle label { display:flex; align-items:center; gap:6px; color:var(--ink); }
.type-toggle--radio {
  flex-wrap: nowrap;
  align-items: center;
  gap: 16px;
  margin: 10px 0 12px;
}
.type-toggle--radio label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  line-height: 1;
}
.admin-sep { border:0; border-top:1px dashed var(--line); margin:14px 0; }
.admin-subh { margin:0 0 8px; font-size:14px; color:var(--ink); }
.upload-chip {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-deep);
  font-size: 12px;
  font-weight: 700;
}
.upload-preview {
  margin: 0 0 12px;
  display: grid;
  gap: 8px;
  min-width: 0;
}
.admin-img-preview {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #f7faf9;
  padding: 0;
  cursor: zoom-in;
}
.admin-img-preview img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: #fff;
}
.option-editor {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
  overflow: hidden;
  min-width: 0;
}
.option-editor .field { margin: 8px 0; }
.option-editor strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 14px;
}
.admin-q-thumb {
  margin: 8px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  max-width: 160px;
}
.admin-q-thumb img {
  display: block;
  width: 100%;
  max-height: 100px;
  object-fit: contain;
}

/* Shop */
.shop-type-grid { display: grid; gap: 10px; margin-top: 12px; }
.shop-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.shop-card-row code {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.shop-actions {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
.receipt-zone {
  width: 100%;
  appearance: none;
  border: 1.5px dashed rgba(15, 118, 110, 0.35);
  background: #f8fffd;
  border-radius: 16px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}
.receipt-preview {
  min-height: 160px;
  display: grid;
  place-items: center;
  padding: 16px;
}
.receipt-preview.has-image {
  padding: 0;
  min-height: 0;
}
.receipt-placeholder {
  display: grid;
  gap: 6px;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}
.receipt-placeholder span { font-size: 28px; line-height: 1; }
.receipt-placeholder strong { color: var(--ink); font-size: 14px; }
.receipt-placeholder small { font-size: 12px; }
.receipt-preview img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #0f172a08;
}
.receipt-preview img.hidden { display: none; }
