/* ═══════════════════════════════════════════════════════════════════════════
   QMTTargetSheet — "Select Target Exam & Subject" bottom sheet
   ───────────────────────────────────────────────────────────────────────────
   Theme-aware (Light Mode default, matte graphite under body.dark), scoped
   entirely under `.qts-root` / `.qmt-exam-trigger`.
   ═══════════════════════════════════════════════════════════════════════════ */

.qts-root {
  --qts-canvas: #f8f9fb;
  --qts-sheet: #ffffff;
  --qts-sheet-2: #f3f4f6;
  --qts-card: #ffffff;
  --qts-card-2: #f3f4f6;
  --qts-line: rgba(15, 23, 42, .08);
  --qts-line-strong: rgba(15, 23, 42, .16);
  --qts-text: #111827;
  --qts-text-2: #4b5563;
  --qts-text-3: #6b7280;
  --qts-cyan: #4338ca;
  --qts-blue: #4338ca;
  --qts-indigo: #4338ca;
  --qts-teal: #059669;
  --qts-scrim: rgba(15, 23, 42, .45);
  --qts-pill-active-bg: rgba(67, 56, 202, .10);
  --qts-pill-active-bd: #4338ca;
  --qts-pill-active-tx: #4338ca;
  --qts-card-active-bg: rgba(67, 56, 202, .06);
  --qts-badge-bg: #f3f4f6;
  --qts-badge-bd: rgba(15, 23, 42, .08);
  --qts-badge-tx: #374151;
  --qts-ghost-hover: #e5e7eb;
  --qts-primary-bg: #4338ca;
  --qts-primary-hover: #3730a3;
  --qts-sheet-shadow: 0 -12px 32px rgba(15, 23, 42, .16);
  --qts-dialog-shadow: 0 24px 60px rgba(15, 23, 42, .22);
  --qts-radius: 12px;
  position: fixed;
  top: 0;
  left: 0;
  right: auto;
  bottom: auto;
  width: var(--qmt-vw, 100vw);
  max-width: var(--qmt-vw, 100vw);
  height: var(--qmt-vh, 100svh);
  overflow: hidden;
  z-index: 2400;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

body.dark .qts-root {
  --qts-canvas: #121212;
  --qts-sheet: #18181c;
  --qts-sheet-2: #1c1c21;
  --qts-card: #1c1c21;
  --qts-card-2: #222228;
  --qts-line: #2a2a32;
  --qts-line-strong: #3a3a44;
  --qts-text: #f4f4f5;
  --qts-text-2: #a1a1aa;
  --qts-text-3: #71717a;
  --qts-cyan: #818cf8;
  --qts-blue: #818cf8;
  --qts-indigo: #4f46e5;
  --qts-teal: #10b981;
  --qts-scrim: rgba(0, 0, 0, .65);
  --qts-pill-active-bg: rgba(99, 102, 241, .16);
  --qts-pill-active-bd: #6366f1;
  --qts-pill-active-tx: #a5b4fc;
  --qts-card-active-bg: rgba(99, 102, 241, .08);
  --qts-badge-bg: rgba(255, 255, 255, .06);
  --qts-badge-bd: rgba(255, 255, 255, .1);
  --qts-badge-tx: #d4d4d8;
  --qts-ghost-hover: #2c2c35;
  --qts-primary-bg: #4f46e5;
  --qts-primary-hover: #4338ca;
  --qts-sheet-shadow: 0 -16px 40px rgba(0, 0, 0, .55);
  --qts-dialog-shadow: 0 30px 70px rgba(2, 6, 23, .7);
}

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

.qts-backdrop {
  position: absolute;
  inset: 0;
  background: var(--qts-scrim);
  animation: qtsFade .2s ease both;
}

.qts-sheet {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: min(520px, 100%);
  max-height: 93%;
  display: flex;
  flex-direction: column;
  color: var(--qts-text);
  background: var(--qts-sheet);
  border: 1px solid var(--qts-line);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  box-shadow: var(--qts-sheet-shadow);
  overflow: hidden;
  animation: qtsSheetUp .26s cubic-bezier(.22, 1, .36, 1) both;
}

.qts-root.is-closing .qts-sheet { animation: qtsSheetDown .22s ease-in both; }
.qts-root.is-closing .qts-backdrop { animation: qtsFadeOut .22s ease both; }

/* Grabber */
.qts-grab {
  display: block;
  width: 46px;
  height: 4px;
  margin: 10px auto 2px;
  border-radius: 999px;
  background: rgba(148, 163, 184, .4);
  flex: none;
  cursor: grab;
  touch-action: none;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.qts-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-width: 0;
  gap: 12px;
  padding: 12px 20px 10px;
  flex: none;
}

.qts-head-main { min-width: 0; }

.qts-title {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -.015em;
  color: var(--qts-text);
}

.qts-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--qts-text-2);
}

.qts-close {
  flex: none;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--qts-line);
  background: var(--qts-card-2);
  color: var(--qts-text-2);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.qts-close svg { width: 16px; height: 16px; }
.qts-close:hover { background: var(--qts-ghost-hover); color: var(--qts-text); border-color: var(--qts-line-strong); }
.qts-close:active { transform: scale(.94); }

/* ── Body / steps ───────────────────────────────────────────────────────── */
.qts-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.qts-step {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: qtsStepIn .22s cubic-bezier(.22, 1, .36, 1) both;
}

.qts-step[hidden] { display: none !important; }

.qts-step-head { flex: none; padding: 2px 20px 0; }

/* Search field */
.qts-search {
  position: relative;
  display: flex;
  align-items: center;
  height: 42px;
  border-radius: 8px;
  background: var(--qts-canvas);
  border: 1px solid var(--qts-line);
  transition: border-color .15s ease;
}

.qts-search:focus-within {
  border-color: var(--qts-indigo);
}

.qts-search-ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  color: var(--qts-text-3);
  pointer-events: none;
}

.qts-search-ico svg { width: 16px; height: 16px; }

.qts-search-input {
  width: 100%;
  height: 100%;
  padding: 0 12px 0 38px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--qts-text) !important;
  font-family: inherit;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
}

.qts-search-input::placeholder { color: var(--qts-text-3); opacity: 1; }
.qts-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

/* Category filters */
.qts-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.qts-pills::-webkit-scrollbar { display: none; }

.qts-pill {
  flex: none;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--qts-line);
  background: transparent;
  color: var(--qts-text-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.qts-pill:hover { color: var(--qts-text); border-color: var(--qts-line-strong); }

.qts-pill.is-active {
  background: var(--qts-pill-active-bg);
  border-color: var(--qts-pill-active-bd);
  color: var(--qts-pill-active-tx);
  box-shadow: none;
}

/* Scroll lists */
.qts-list {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 10px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(161, 161, 170, .35) transparent;
}

.qts-list::-webkit-scrollbar { width: 5px; }
.qts-list::-webkit-scrollbar-thumb { background: rgba(161, 161, 170, .35); border-radius: 999px; }

/* ── Step 1 · exam cards ────────────────────────────────────────────────── */
.qts-exam-card {
  position: relative;
  flex: none;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  text-align: left;
  border-radius: var(--qts-radius);
  border: 1px solid var(--qts-line);
  background: var(--qts-card);
  color: inherit;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.qts-exam-card:hover { border-color: var(--qts-line-strong); background: var(--qts-card-2); }
.qts-exam-card:active { transform: scale(.994); }

.qts-exam-card.is-current {
  border-color: var(--qts-indigo);
  background: var(--qts-card-active-bg);
  box-shadow: none;
}

.qts-exam-card:focus-visible,
.qts-subject:focus-visible,
.qts-pill:focus-visible,
.qts-back:focus-visible,
.qts-btn:focus-visible,
.qts-close:focus-visible {
  outline: 2px solid var(--qts-blue);
  outline-offset: 2px;
}

.qts-exam-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.qts-exam-name {
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--qts-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qts-tier-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--qts-badge-bg);
  border: 1px solid var(--qts-badge-bd);
  color: var(--qts-badge-tx);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
}

.qts-current-dot {
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--qts-indigo);
  box-shadow: none;
  flex: none;
}

.qts-exam-meta {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  max-width: 100%;
  font-size: 12px;
  font-weight: 600;
  color: var(--qts-text-2);
}

.qts-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  white-space: nowrap;
}

.qts-meta svg { width: 14px; height: 14px; color: var(--qts-text-3); }

.qts-mocks {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--qts-text-3);
  font-size: 11.5px;
  font-weight: 700;
}

.qts-select {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--qts-blue);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  flex: none;
}

.qts-select svg { width: 13px; height: 13px; }

/* ── Step 2 · subject drill-down ────────────────────────────────────────── */
/* Step 2 replaces the title header with its own "‹ Back to Exams" row. */
.qts-root[data-step="2"] .qts-head { display: none; }

.qts-step2-head {
  flex: none;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px 8px;
}

.qts-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 2px;
  border: 0;
  background: transparent;
  color: var(--qts-blue);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}

.qts-back svg { width: 17px; height: 17px; }
.qts-back:hover { color: var(--qts-indigo); }

.qts-close--inline { width: 32px; height: 32px; }

.qts-exam-chip {
  flex: none;
  min-width: 0;
  max-width: calc(100% - 40px);
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 20px 2px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--qts-canvas);
  border: 1px solid var(--qts-line);
  font-size: 12.5px;
  color: var(--qts-text-2);
  overflow: hidden;
}

.qts-chip-label { flex: none; }
.qts-chip-exam { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--qts-text); font-weight: 600; white-space: nowrap; }
.qts-chip-dash { flex: none; color: var(--qts-text-3); }
.qts-chip-tier { min-width: 0; color: var(--qts-text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qts-tier-badge--chip { margin-left: auto; }

.qts-list--subjects { padding-top: 10px; }

.qts-subject {
  flex: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
  border-radius: 10px;
  border: 1px solid var(--qts-line);
  background: var(--qts-card);
  color: inherit;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.qts-subject:hover { border-color: var(--qts-line-strong); background: var(--qts-card-2); }
.qts-subject:active { transform: scale(.996); }

.qts-subject.is-selected {
  border-color: var(--qts-pill-active-bd);
  background: var(--qts-pill-active-bg);
  box-shadow: none;
}

.qts-sub-ico {
  flex: none;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 17px;
  line-height: 1;
  border: 1px solid var(--qts-line);
  background: var(--qts-card-2);
}

.qts-sub-ico--indigo,
.qts-sub-ico--green,
.qts-sub-ico--amber,
.qts-sub-ico--purple,
.qts-sub-ico--cyan,
.qts-sub-ico--rose,
.qts-sub-ico--slate { background: var(--qts-card-2); border-color: var(--qts-line); }

.qts-sub-body {
  min-width: 0;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qts-sub-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--qts-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qts-sub-desc {
  font-size: 12px;
  font-weight: 400;
  color: var(--qts-text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qts-sub-badge {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--qts-card-2);
  border: 1px solid var(--qts-line);
  color: var(--qts-text-2);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.qts-radio {
  flex: none;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1.5px solid var(--qts-line-strong);
  background: transparent;
  color: transparent;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.qts-radio svg { width: 11px; height: 11px; }

.qts-subject.is-selected .qts-radio {
  border-color: var(--qts-indigo);
  background: var(--qts-primary-bg);
  color: #ffffff;
  box-shadow: none;
}

/* ── Empty state ────────────────────────────────────────────────────────── */
.qts-empty {
  margin: auto;
  padding: 26px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  color: var(--qts-text-3);
  font-size: 12.5px;
}

.qts-empty b { color: var(--qts-text); font-size: 14px; font-weight: 800; }
.qts-empty-ico { display: inline-flex; margin-bottom: 4px; color: var(--qts-text-3); }
.qts-empty-ico svg { width: 28px; height: 28px; }

/* ── Sticky footer actions ──────────────────────────────────────────────── */
.qts-actions {
  flex: none;
  display: flex;
  gap: 8px;
  align-items: stretch;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--qts-sheet);
  border-top: 1px solid var(--qts-line);
}

.qts-btn {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 8px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color .15s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.qts-btn:active { transform: scale(.98); }

.qts-btn--ghost {
  flex: 0 0 34%;
  padding: 11px 12px;
  border: 1px solid var(--qts-line-strong);
  background: var(--qts-card-2);
  color: var(--qts-text);
}

.qts-btn--ghost:hover { background: var(--qts-ghost-hover); color: var(--qts-text); }

.qts-btn--primary {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: 0;
  color: #ffffff;
  background: var(--qts-primary-bg);
  box-shadow: none;
}

.qts-btn--primary:hover { background: var(--qts-primary-hover); }
.qts-btn--primary:disabled { opacity: .7; cursor: default; }

.qts-btn-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
  color: #ffffff;
}

.qts-btn-check svg { width: 12px; height: 12px; }

/* ── Page scroll lock while the sheet is open ───────────────────────────── */
body.qts-open { overflow: hidden !important; }

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes qtsFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes qtsFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes qtsSheetUp {
  from { opacity: .55; transform: translateY(28px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes qtsSheetDown {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(26px); }
}
@keyframes qtsStepIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.qts-root[data-step="2"] .qts-step--subjects { animation-name: qtsStepIn; }

/* ── Desktop / tablet: centered dialog ──────────────────────────────────── */
@media (min-width: 560px) {
  .qts-root { align-items: center; padding: 20px; }
  .qts-sheet {
    width: min(480px, 100%);
    max-height: 100%;
    border: 1px solid var(--qts-line);
    border-radius: 16px;
    box-shadow: var(--qts-dialog-shadow);
  }
  .qts-grab { display: none; }
  .qts-head { padding-top: 18px; }
}

/* Very narrow phones: keep the wide Tier-2 / CBT-2 badges + radios inside
   the card instead of letting them push the row past the viewport. */
@media (max-width: 400px) {
  .qts-subject { gap: 9px; padding: 10px 10px; }
  .qts-sub-ico { width: 36px; height: 36px; border-radius: 11px; font-size: 17px; }
  .qts-sub-name { font-size: 13.5px; }
  .qts-sub-desc { font-size: 11px; }
  .qts-sub-badge { font-size: 10px; padding: 3px 7px; }
  .qts-radio { width: 20px; height: 20px; }
}

/* iOS auto-zoom guard: focusable inputs must render >=16px on touch. */
@media (max-width: 640px), (pointer: coarse) {
  .qts-search-input { font-size: 16px !important; }
}

@media (max-width: 359px) {
  .qts-head, .qts-step-head, .qts-step2-head { padding-left: 15px; padding-right: 15px; }
  .qts-list { padding-left: 15px; padding-right: 15px; }
  .qts-exam-chip { margin-left: 15px; margin-right: 15px; }
  .qts-actions { padding-left: 15px; padding-right: 15px; }
  .qts-mocks { display: none; }
}

/* ── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .qts-sheet,
  .qts-backdrop,
  .qts-step,
  .qts-root.is-closing .qts-sheet,
  .qts-root.is-closing .qts-backdrop { animation: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Hierarchy bar trigger — the exam pill now opens the sheet (the native
   <select> stays in the DOM, visually hidden, for legacy code paths).
   ═══════════════════════════════════════════════════════════════════════════ */
.qmt-exam-pill .qmt-exam-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

.qmt-exam-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 34px;
  padding: 7px 28px 7px 23px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #0f172a;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

body.dark .qmt-exam-trigger { color: #f1f5f9; }

.qmt-exam-trigger-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qmt-exam-trigger:focus-visible {
  outline: 2px solid rgba(34, 211, 238, .7);
  outline-offset: 1px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALWAYS-ON HEADER CONTEXT ROW — exam · subject · tier
   Lives inside the app header (desktop sticky .top-bar / mobile fixed
   .mobile-tab-header) so the target context never scrolls away.
   Text stays deliberately small + compact, like the reference screenshot.
   ═══════════════════════════════════════════════════════════════════════════ */
.qmt-header-ctx,
.qmt-ctx-mount--header {
  width: 100%;
  min-width: 0;
}

.top-bar > .qmt-ctx-mount--header {
  max-width: 1200px;
  margin: 8px auto 0;
  min-width: 0;
}

.mobile-tab-header > .qmt-ctx-mount--header {
  margin: 0;
  padding: 0;
}

.qmt-ctx-mount--header .qmt-ctx-shell,
.qmt-ctx-mount--header .qmt-ctx-top {
  min-width: 0;
  width: 100%;
}

.qmt-ctx-mount--header .qmt-ctx-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.qmt-ctx-mount--header .qmt-exam-pill {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 42%;
}

.qmt-ctx-mount--header .qmt-exam-trigger {
  min-height: 30px;
  padding: 5px 24px 5px 20px;
  font-size: 11.5px;
}

.qmt-ctx-mount--header .qmt-exam-chev {
  right: 9px;
  width: 12px;
  height: 12px;
}

.qmt-ctx-mount--header .qmt-tier-tabs {
  flex: 0 0 auto;
  padding: 3px;
  gap: 2px;
}

.qmt-ctx-mount--header .qmt-tier-tab {
  padding: 4px 9px;
  font-size: 11px;
}

/* Subject pill — opens the exam's subject list (sheet step 2) */
.qmt-subject-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 34%;
  padding: 5px 22px 5px 8px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #dbe3ef;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  color: #0f172a;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, background .15s ease;
}

.qmt-subject-pill:hover { border-color: #94a3b8; }

body.dark .qmt-subject-pill {
  background: #131a29;
  border-color: rgba(56, 189, 248, .24);
  color: #f1f5f9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

body.dark .qmt-subject-pill:hover { border-color: rgba(56, 189, 248, .42); }

.qmt-subject-pill:focus-visible {
  outline: 2px solid rgba(56, 189, 248, .65);
  outline-offset: 1px;
}

.qmt-subject-pill-ico {
  flex: none;
  font-size: 12px;
  line-height: 1;
}

.qmt-subject-pill-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qmt-subject-caret {
  position: absolute;
  right: 8px;
  width: 12px;
  height: 12px;
  color: #64748b;
  pointer-events: none;
}

body.dark .qmt-subject-caret { color: #8b9bb4; }

/* Source filter (All Mocks · PYQ Bank · Logged) stays in page content */
.qmt-source-mount {
  width: 100%;
  min-width: 0;
  margin: 0 0 10px;
}

.qmt-source-mount .qmt-source-seg { margin: 0; }

/* Narrow phones: keep all three controls on one compact row */
@media (max-width: 380px) {
  .qmt-ctx-mount--header .qmt-exam-trigger {
    padding: 5px 22px 5px 19px;
    font-size: 11px;
  }
  .qmt-ctx-mount--header .qmt-exam-dot { left: 9px; width: 6px; height: 6px; }
  .qmt-ctx-mount--header .qmt-tier-tab { padding: 4px 7px; font-size: 10.5px; }
  .qmt-subject-pill { font-size: 11px; padding: 5px 20px 5px 7px; }
  .qmt-subject-pill-ico { font-size: 11px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   v3 — COMPACT PREMIUM HEADER (brand row + exam · subject · tier row)
   Pehle row `space-between` par thi (teeno control door-door, alag heights).
   Ab: ek hi 34px grid row — [ Exam ⌄ ][ Subject ⌄ ][ Prelims | Mains ] — glass
   chips, same radius/height, sliding-look gradient active tab, halka hairline.
   Sirf header context row + brand strip touch hoti hai (page content nahi).
   ═══════════════════════════════════════════════════════════════════════════ */
.qmt-ctx-mount--header {
  --qmt-chip-h: 34px;
  --qmt-chip-r: 8px;
  --qmt-chip-bg: #ffffff;
  --qmt-chip-bd: rgba(15, 23, 42, 0.10);
  --qmt-chip-ink: #111827;
  --qmt-chip-mute: #6b7280;
  --qmt-seg-bg: #f3f4f6;
}
body.dark .qmt-ctx-mount--header {
  --qmt-chip-bg: #1c1c21;
  --qmt-chip-bd: rgba(255, 255, 255, .10);
  --qmt-chip-ink: #f4f4f5;
  --qmt-chip-mute: #a1a1aa;
  --qmt-seg-bg: #121215;
}

.qmt-ctx-mount--header .qmt-ctx-top {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) auto;
  align-items: stretch;
  justify-content: stretch;
  gap: 6px;
}

.qmt-ctx-mount--header .qmt-exam-pill {
  display: flex;
  align-items: center;
  max-width: none;
  min-width: 0;
  height: var(--qmt-chip-h);
  border-radius: var(--qmt-chip-r);
  background: var(--qmt-chip-bg);
  border: 1px solid var(--qmt-chip-bd);
  box-shadow: none;
}
body.dark .qmt-ctx-mount--header .qmt-exam-pill { box-shadow: none; }
.qmt-ctx-mount--header .qmt-exam-trigger {
  width: 100%;
  height: 100%;
  min-height: 0 !important;
  justify-content: flex-start;
  padding: 0 21px 0 22px;
  border-radius: var(--qmt-chip-r);
  color: var(--qmt-chip-ink);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}
.qmt-ctx-mount--header .qmt-exam-dot { left: 11px; width: 6px; height: 6px; }
.qmt-ctx-mount--header .qmt-exam-chev {
  right: 8px;
  width: 12px;
  height: 12px;
  color: var(--qmt-chip-mute);
}

.qmt-ctx-mount--header .qmt-subject-pill {
  width: 100%;
  max-width: none;
  height: var(--qmt-chip-h);
  min-height: 0 !important;
  padding: 0 22px 0 10px;
  gap: 6px;
  border-radius: var(--qmt-chip-r);
  background: var(--qmt-chip-bg);
  border: 1px solid var(--qmt-chip-bd);
  color: var(--qmt-chip-ink);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  box-shadow: none;
}
body.dark .qmt-ctx-mount--header .qmt-subject-pill { box-shadow: none; }
.qmt-ctx-mount--header .qmt-subject-pill-ico { display: none; }
.qmt-ctx-mount--header .qmt-subject-caret { right: 8px; color: var(--qmt-chip-mute); }

.qmt-ctx-mount--header .qmt-tier-tabs {
  height: var(--qmt-chip-h);
  padding: 3px;
  gap: 2px;
  border-radius: var(--qmt-chip-r);
  background: var(--qmt-seg-bg);
  border: 1px solid var(--qmt-chip-bd);
  box-shadow: none;
}
.qmt-ctx-mount--header .qmt-tier-tab {
  height: 100%;
  min-height: 0 !important;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
}
.qmt-ctx-mount--header .qmt-tier-tab.is-active {
  background: #4338ca;
  color: #ffffff;
  box-shadow: none;
}
body.dark .qmt-ctx-mount--header .qmt-tier-tab.is-active {
  background: #4f46e5;
}

.qmt-ctx-mount--header .qmt-exam-pill,
.qmt-ctx-mount--header .qmt-subject-pill {
  transition: border-color .15s ease, transform .12s ease;
}
.qmt-ctx-mount--header .qmt-exam-pill:active,
.qmt-ctx-mount--header .qmt-subject-pill:active { transform: scale(.985); }

.mobile-tab-header .hm-top-header,
.top-bar .hm-top-header { min-height: 40px; }
.mobile-tab-header .hm-app-icon,
.top-bar .hm-app-icon,
.mobile-tab-header .hm-profile-btn,
.top-bar .hm-profile-btn { width: 32px; height: 32px; border-radius: 8px; }
.mobile-tab-header .hm-brand,
.top-bar .hm-brand { gap: 10px; }
.mobile-tab-header .hm-brand-name,
.top-bar .hm-brand-name { font-size: 14px; letter-spacing: -.015em; }
.mobile-tab-header .hm-status-pill,
.top-bar .hm-status-pill { font-size: 11px; }
.mobile-tab-header .hm-avatar { width: 32px; height: 32px; }

@media (max-width: 860px) {
  .mobile-tab-header {
    gap: 6px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(15, 23, 42, .08);
    background-image: none;
    background-color: #ffffff;
  }
  body.dark .mobile-tab-header {
    background-color: #141417;
    border-bottom-color: rgba(255, 255, 255, .08);
    box-shadow: none;
  }
}

/* Very narrow phones: keep one row, trim paddings */
@media (max-width: 380px) {
  .qmt-ctx-mount--header { --qmt-chip-h: 32px; --qmt-chip-r: 11px; }
  .qmt-ctx-mount--header .qmt-ctx-top { gap: 5px; }
  .qmt-ctx-mount--header .qmt-exam-trigger { font-size: 11.5px; padding: 0 19px 0 20px; }
  .qmt-ctx-mount--header .qmt-subject-pill { font-size: 11.5px; padding: 0 20px 0 9px; }
  .qmt-ctx-mount--header .qmt-tier-tab { padding: 0 8px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .qmt-ctx-mount--header .qmt-exam-pill,
  .qmt-ctx-mount--header .qmt-subject-pill { transition: none; }
}
