/* ============================================================
   Swotter App Styles — White-first, high-contrast
   ============================================================ */

/* App root takes over when navigating to app routes */
#app-root:not(:empty) ~ * { display: none; }
#app-root:not(:empty) { min-height: 100vh; }

/* Hide landing content when app is active */
body.app-active > nav,
body.app-active > section,
body.app-active > footer { display: none; }

/* ---- APP NAV ---- */
.app-nav {
  background: var(--bg, #ffffff);
  border-bottom: 2px solid var(--black, #111111);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-nav .nav-inner {
  height: 56px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--mid, #555555);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-link:hover { color: var(--black, #111111); }

.btn-small {
  font-size: 0.75rem;
  padding: 6px 14px;
  border: 1.5px solid var(--border, #d0d0cc);
  background: var(--bg, #ffffff);
  color: var(--mid, #555555);
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.btn-small:hover {
  border-color: var(--black, #111111);
  color: var(--black, #111111);
}

/* ---- ONBOARDING ---- */
.onboarding-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.onboard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 48px;
}

.onboard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.35;
  transition: opacity 0.3s;
}
.onboard-step.active { opacity: 1; }
.onboard-step.done { opacity: 0.6; }

.step-circle {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--border, #d0d0cc);
  background: var(--bg-soft, #f8f8f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted, #888888);
}
.onboard-step.active .step-circle {
  background: var(--orange, #f97316);
  border-color: var(--orange, #f97316);
  color: #ffffff;
}
.onboard-step.done .step-circle {
  background: var(--green-bg, #f0fdf4);
  border-color: var(--green, #16a34a);
  color: var(--green, #16a34a);
}

.onboard-step span {
  font-size: 0.8rem;
  color: var(--muted, #888888);
  font-weight: 500;
}
.onboard-step.active span { color: var(--black, #111111); }

.onboard-connector {
  width: 40px;
  height: 1.5px;
  background: var(--border, #d0d0cc);
  margin: 0 12px;
}

.onboard-card {
  background: var(--bg, #ffffff);
  border: 2px solid var(--black, #111111);
  padding: 36px 32px;
  box-shadow: 4px 4px 0 var(--black, #111111);
}

.onboard-card h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--black, #111111);
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}

.onboard-subtitle {
  font-size: 0.9rem;
  color: var(--mid, #555555);
  margin-bottom: 32px;
  line-height: 1.6;
}

.hidden { display: none !important; }

/* ---- FORM ELEMENTS ---- */
.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dark, #2a2a2a);
  margin-bottom: 8px;
}

.form-group .optional {
  color: var(--muted, #888888);
  font-weight: 400;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg, #ffffff);
  border: 1.5px solid var(--border, #d0d0cc);
  color: var(--black, #111111);
  font-size: 0.92rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--orange, #f97316);
  box-shadow: 0 0 0 3px var(--orange-bg, #fff4eb);
}
.form-input::placeholder {
  color: var(--light-text, #bbbbbb);
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg, #ffffff);
  border: 1.5px solid var(--border, #d0d0cc);
  color: var(--black, #111111);
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23555555' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  -webkit-appearance: none;
}
.form-select:focus {
  border-color: var(--orange, #f97316);
  outline: none;
}
.form-select option {
  background: var(--bg, #ffffff);
  color: var(--black, #111111);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Chips */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 7px 16px;
  border: 1.5px solid var(--border, #d0d0cc);
  background: var(--bg, #ffffff);
  color: var(--mid, #555555);
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover {
  border-color: var(--black, #111111);
  color: var(--black, #111111);
}
.chip.selected {
  background: var(--orange, #f97316);
  border-color: var(--orange, #f97316);
  color: #ffffff;
  font-weight: 700;
}

/* Hours slider */
.hours-slider {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hours-slider input[type="range"] {
  flex: 1;
  height: 4px;
  appearance: none;
  background: var(--border, #d0d0cc);
  outline: none;
}
.hours-slider input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--orange, #f97316);
  border: 2px solid var(--black, #111111);
  cursor: pointer;
}
.hours-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--orange, #f97316);
  border: 2px solid var(--black, #111111);
  cursor: pointer;
}

.hours-display {
  font-size: 0.88rem;
  color: var(--black, #111111);
  font-weight: 700;
  min-width: 110px;
  text-align: right;
}

/* ---- BUTTONS ---- */
.btn-primary {
  width: 100%;
  padding: 13px 24px;
  background: var(--black, #111111);
  color: #ffffff;
  border: 2px solid var(--black, #111111);
  font-size: 0.9rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  letter-spacing: -0.01em;
}
.btn-primary:hover:not(:disabled) {
  background: var(--orange, #f97316);
  border-color: var(--orange, #f97316);
}
.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 12px 24px;
  background: var(--bg, #ffffff);
  color: var(--dark, #2a2a2a);
  border: 1.5px solid var(--border, #d0d0cc);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover {
  border-color: var(--black, #111111);
  color: var(--black, #111111);
}

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.btn-row .btn-primary { flex: 1; }

.btn-add-subject {
  width: 100%;
  padding: 13px;
  background: var(--bg, #ffffff);
  border: 1.5px dashed var(--border-dark, #aaaaaa);
  color: var(--muted, #888888);
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  margin-bottom: 24px;
  transition: all 0.15s;
  font-weight: 500;
}
.btn-add-subject:hover {
  border-color: var(--orange, #f97316);
  color: var(--orange, #f97316);
}
.btn-add-subject span {
  font-size: 1.1rem;
  margin-right: 4px;
}

/* ---- SUBJECT ROWS ---- */
.subject-row {
  background: var(--bg-soft, #f8f8f6);
  border: 1.5px solid var(--border, #d0d0cc);
  padding: 20px;
  margin-bottom: 12px;
}

.subject-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.subject-number {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--orange, #f97316);
  background: var(--orange-bg, #fff4eb);
  border: 1px solid var(--orange-line, rgba(249,115,22,0.3));
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.subject-remove {
  background: none;
  border: none;
  color: var(--muted, #888888);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: all 0.15s;
}
.subject-remove:hover {
  color: var(--red, #dc2626);
}

.subject-fields .form-group { margin-bottom: 14px; }
.subject-fields .form-group:last-child { margin-bottom: 0; }

/* ---- GENERATING STATE ---- */
.generating-state, .error-state {
  text-align: center;
  padding: 48px 24px;
}

.gen-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border, #d0d0cc);
  border-top-color: var(--orange, #f97316);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- QUEUE PAGE ---- */
.queue-page {
  padding: 32px 0 80px;
}

.queue-greeting h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--black, #111111);
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}

.queue-date-label {
  font-size: 0.9rem;
  color: var(--mid, #555555);
  margin-bottom: 32px;
}

.queue-stats-bar {
  display: flex;
  gap: 0;
  margin-bottom: 32px;
  border: 2px solid var(--black, #111111);
}

.queue-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 16px 24px;
  border-right: 1.5px solid var(--border, #d0d0cc);
}
.queue-stat:last-child { border-right: none; }

.stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--black, #111111);
  letter-spacing: -0.04em;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--mid, #555555);
  font-weight: 500;
}

/* ---- SESSION CARDS ---- */
.queue-sessions {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 2px solid var(--black, #111111);
}

.session-card {
  display: flex;
  gap: 16px;
  background: var(--bg, #ffffff);
  border-bottom: 1.5px solid var(--border, #d0d0cc);
  padding: 20px;
  transition: background 0.15s;
}
.session-card:last-child { border-bottom: none; }
.session-card:hover { background: var(--bg-soft, #f8f8f6); }
.session-card.current {
  border-left: 3px solid var(--orange, #f97316);
  background: var(--orange-bg, #fff4eb);
}
.session-card.done {
  opacity: 0.45;
}

.session-number {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--border, #d0d0cc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--muted, #888888);
  background: var(--bg-soft, #f8f8f6);
}
.session-number.active {
  background: var(--orange, #f97316);
  border-color: var(--orange, #f97316);
  color: #ffffff;
}
.session-number.completed {
  background: var(--green-bg, #f0fdf4);
  border-color: var(--green, #16a34a);
  color: var(--green, #16a34a);
}
.session-number.skipped {
  background: var(--bg-soft, #f8f8f6);
  color: var(--light-text, #bbbbbb);
  border-color: var(--border, #d0d0cc);
}

.session-body { flex: 1; min-width: 0; }

.session-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.session-subject-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 10px;
  border: 1px solid;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.session-duration {
  font-size: 0.78rem;
  color: var(--muted, #888888);
  font-weight: 600;
}

.session-topic {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--black, #111111);
  margin-bottom: 6px;
  line-height: 1.3;
}

.session-reason {
  font-size: 0.82rem;
  color: var(--mid, #555555);
  line-height: 1.5;
  margin-bottom: 10px;
}

.session-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.session-priority {
  font-size: 0.75rem;
  font-weight: 600;
}

.session-board {
  font-size: 0.72rem;
  color: var(--muted, #888888);
}

.session-actions {
  display: flex;
  gap: 8px;
}

.btn-complete {
  padding: 8px 20px;
  background: var(--black, #111111);
  color: #ffffff;
  border: 2px solid var(--black, #111111);
  font-size: 0.8rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-complete:hover:not(:disabled) {
  background: var(--orange, #f97316);
  border-color: var(--orange, #f97316);
}
.btn-complete:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-skip {
  padding: 8px 16px;
  background: var(--bg, #ffffff);
  color: var(--mid, #555555);
  border: 1.5px solid var(--border, #d0d0cc);
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-skip:hover:not(:disabled) {
  border-color: var(--black, #111111);
  color: var(--black, #111111);
}
.btn-skip:disabled { opacity: 0.4; cursor: not-allowed; }

.session-done-label {
  font-size: 0.78rem;
  color: var(--muted, #888888);
  font-style: italic;
}

/* ---- EMPTY STATE ---- */
.empty-queue {
  text-align: center;
  padding: 64px 24px;
  border: 2px solid var(--black, #111111);
  background: var(--bg-soft, #f8f8f6);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.empty-queue h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--black, #111111);
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}

.empty-queue p {
  font-size: 0.9rem;
  color: var(--mid, #555555);
  margin-bottom: 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.empty-queue .btn-primary {
  width: auto;
  display: inline-block;
}

/* ---- WEEK PLAN ---- */
.week-overview {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 2px solid var(--black, #111111);
}

.day-block {
  background: var(--bg, #ffffff);
  border-bottom: 1.5px solid var(--border, #d0d0cc);
  overflow: hidden;
}
.day-block:last-child { border-bottom: none; }
.day-block.today {
  border-left: 3px solid var(--orange, #f97316);
  background: var(--orange-bg, #fff4eb);
}
.day-block.past {
  opacity: 0.5;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--bg-ruled, #f2f2ef);
  background: var(--bg-soft, #f8f8f6);
}

.day-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--black, #111111);
}

.today-badge {
  font-size: 0.65rem;
  background: var(--orange, #f97316);
  color: #ffffff;
  padding: 2px 8px;
  margin-left: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.day-meta {
  font-size: 0.75rem;
  color: var(--muted, #888888);
}

.day-sessions {
  padding: 10px 20px;
}

.mini-session {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
}
.mini-session:not(:last-child) {
  border-bottom: 1px solid var(--bg-ruled, #f2f2ef);
}
.mini-session.done { opacity: 0.4; text-decoration: line-through; }
.mini-session.skipped { opacity: 0.35; }

.mini-subject {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--orange, #f97316);
  width: 100px;
  flex-shrink: 0;
}

.mini-topic {
  font-size: 0.82rem;
  color: var(--dark, #2a2a2a);
  flex: 1;
  font-weight: 500;
}

.mini-time {
  font-size: 0.72rem;
  color: var(--muted, #888888);
  font-weight: 600;
}

/* ---- LOADING STATE ---- */
.loading-state {
  text-align: center;
  padding: 80px 24px;
}
.loading-state p {
  color: var(--mid, #555555);
  font-size: 0.9rem;
}

/* ---- LANDING PAGE CTA BUTTON ---- */
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  padding: 13px 28px;
  background: var(--black, #111111);
  color: #ffffff;
  border: 2px solid var(--black, #111111);
  font-size: 0.92rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  letter-spacing: -0.01em;
}
.hero-cta:hover {
  background: var(--orange, #f97316);
  border-color: var(--orange, #f97316);
}
.hero-cta-arrow {
  font-size: 1.1rem;
  transition: transform 0.2s;
}
.hero-cta:hover .hero-cta-arrow {
  transform: translateX(3px);
}

.closing-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  padding: 15px 40px;
  background: var(--orange, #f97316);
  color: #ffffff;
  border: 2px solid var(--orange, #f97316);
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.closing-cta:hover {
  background: var(--orange-dark, #e8650a);
  border-color: var(--orange-dark, #e8650a);
}

/* ---- AUTH ERROR ---- */
.auth-error {
  background: var(--red-bg, #fef2f2);
  border: 1.5px solid var(--red, #dc2626);
  color: var(--red, #dc2626);
  padding: 12px 16px;
  font-size: 0.88rem;
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ---- USER DROPDOWN MENU ---- */
.nav-user-menu {
  position: relative;
}

.btn-user {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg, #ffffff);
  border: 2px solid var(--black, #111111);
  min-width: 200px;
  overflow: hidden;
  box-shadow: 4px 4px 0 var(--black, #111111);
  z-index: 200;
}

.dropdown-email {
  padding: 11px 16px;
  font-size: 0.75rem;
  color: var(--muted, #888888);
  border-bottom: 1.5px solid var(--border, #d0d0cc);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--bg-soft, #f8f8f6);
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--dark, #2a2a2a);
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
  font-weight: 500;
  border-bottom: 1px solid var(--bg-ruled, #f2f2ef);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover {
  background: var(--bg-soft, #f8f8f6);
}
.dropdown-item.dropdown-danger {
  color: var(--red, #dc2626);
}
.dropdown-item.dropdown-danger:hover {
  background: var(--red-bg, #fef2f2);
}

/* ---- DRIFT BANNER ---- */
.drift-banner {
  background: var(--orange-bg, #fff4eb);
  border: 1.5px solid var(--orange, #f97316);
  border-left: 4px solid var(--orange, #f97316);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.drift-banner-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.drift-banner-content {
  flex: 1;
}

.drift-banner-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--orange-dark, #e8650a);
  margin-bottom: 4px;
}

.drift-banner-text {
  font-size: 0.82rem;
  color: var(--mid, #555555);
  line-height: 1.5;
}

.drift-banner-text strong {
  color: var(--black, #111111);
  font-weight: 600;
}

/* Rescheduled badge on session cards */
.session-rescheduled-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--orange, #f97316);
  background: var(--orange-bg, #fff4eb);
  border: 1px solid var(--orange-line, rgba(249,115,22,0.3));
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.session-drift-note {
  font-size: 0.78rem;
  color: var(--orange, #f97316);
  opacity: 0.9;
  margin-bottom: 8px;
  font-style: italic;
}

/* Rescheduled session card */
.session-card.rescheduled {
  border-left: 3px solid var(--orange, #f97316);
  background: var(--orange-bg, #fff4eb);
}

/* ---- SESSION RUNNER ---- */
.session-runner-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  background: var(--bg, #ffffff);
}

.runner-header {
  width: 100%;
  max-width: 520px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  padding-bottom: 16px;
  border-bottom: 1.5px solid var(--border, #d0d0cc);
}

.runner-back-btn {
  background: none;
  border: none;
  color: var(--mid, #555555);
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  padding: 8px 0;
  transition: color 0.15s;
  font-weight: 500;
}
.runner-back-btn:hover { color: var(--black, #111111); }

.runner-status-pill {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green, #16a34a);
  background: var(--green-bg, #f0fdf4);
  border: 1.5px solid var(--green, #16a34a);
  padding: 5px 14px;
  animation: pulse-glow 2s ease-in-out infinite;
}
.runner-status-pill.times-up {
  color: var(--orange, #f97316);
  background: var(--orange-bg, #fff4eb);
  border-color: var(--orange, #f97316);
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

/* Timer ring */
.runner-timer-section {
  margin-bottom: 40px;
}

.runner-timer-ring {
  position: relative;
  width: 200px;
  height: 200px;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-track {
  fill: none;
  stroke: var(--border, #d0d0cc);
  stroke-width: 6;
}

.timer-progress {
  fill: none;
  stroke: var(--green, #16a34a);
  stroke-width: 6;
  stroke-linecap: square;
  transition: stroke-dashoffset 1s linear, stroke 0.5s ease;
}

.timer-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.timer-digits {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--black, #111111);
  letter-spacing: -0.05em;
  line-height: 1;
}

.timer-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted, #888888);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Context */
.runner-context {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.runner-subject-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 12px;
  border: 1.5px solid;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.runner-exam-info {
  font-size: 0.78rem;
  color: var(--muted, #888888);
  font-weight: 500;
}

.runner-topic {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--black, #111111);
  text-align: center;
  margin-bottom: 12px;
  line-height: 1.2;
  max-width: 520px;
  letter-spacing: -0.03em;
}

.runner-reason {
  font-size: 0.88rem;
  color: var(--mid, #555555);
  text-align: center;
  line-height: 1.6;
  max-width: 440px;
  margin-bottom: 20px;
}

.runner-meta {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted, #888888);
  margin-bottom: 40px;
  flex-wrap: wrap;
  justify-content: center;
  font-weight: 500;
}

/* Actions */
.runner-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 40px;
}

.btn-runner-complete {
  padding: 14px 32px;
  background: var(--black, #111111);
  color: #ffffff;
  border: 2px solid var(--black, #111111);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-runner-complete:hover:not(:disabled) {
  background: var(--orange, #f97316);
  border-color: var(--orange, #f97316);
}
.btn-runner-complete:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-runner-end-early {
  padding: 14px 24px;
  background: var(--bg, #ffffff);
  color: var(--mid, #555555);
  border: 1.5px solid var(--border, #d0d0cc);
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-runner-end-early:hover:not(:disabled) {
  border-color: var(--black, #111111);
  color: var(--black, #111111);
}
.btn-runner-end-early:disabled { opacity: 0.4; cursor: not-allowed; }

.runner-tip {
  background: var(--bg-soft, #f8f8f6);
  border: 1.5px solid var(--border, #d0d0cc);
  padding: 16px 20px;
  font-size: 0.82rem;
  color: var(--mid, #555555);
  line-height: 1.5;
  max-width: 440px;
  text-align: center;
}
.runner-tip strong {
  color: var(--black, #111111);
}

/* Completion screen */
.runner-complete-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
  animation: fadeIn 0.4s ease;
}

.complete-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.runner-complete-screen h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--black, #111111);
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}

.complete-subject {
  font-size: 0.92rem;
  color: var(--orange, #f97316);
  margin-bottom: 8px;
  font-weight: 600;
}

.complete-message {
  font-size: 0.92rem;
  color: var(--mid, #555555);
}

/* Start session button in queue */
.btn-start-session {
  padding: 8px 20px;
  background: var(--green, #16a34a);
  color: #ffffff;
  border: 2px solid var(--green, #16a34a);
  font-size: 0.8rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-start-session:hover {
  background: #15803d;
  border-color: #15803d;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .onboarding-wrap { padding: 24px 16px 60px; }
  .onboard-card { padding: 24px 20px; }
  .onboard-step span { display: none; }
  .onboard-connector { width: 24px; }

  .queue-stats-bar { flex-wrap: wrap; }
  .queue-stat { border-right: none; border-bottom: 1px solid var(--border, #d0d0cc); }
  .queue-stat:last-child { border-bottom: none; }
  .session-card { padding: 16px; gap: 12px; }
  .session-top { flex-wrap: wrap; gap: 8px; }

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

  .nav-actions { gap: 8px; }

  .mini-subject { width: 80px; }

  /* Session runner mobile */
  .session-runner-page { padding: 16px; }
  .runner-timer-ring { width: 180px; height: 180px; }
  .timer-digits { font-size: 2.2rem; }
  .runner-topic { font-size: 1.25rem; }
  .runner-actions { flex-direction: column; width: 100%; max-width: 320px; }
  .btn-runner-complete, .btn-runner-end-early { width: 100%; text-align: center; }
  .runner-meta { gap: 12px; }
  .session-actions { flex-wrap: wrap; }

  /* AI help mobile */
  .ai-help-panel { border-radius: 0; }
  .ai-help-panel.expanded { max-height: 70vh; }
  .ai-quick-actions { gap: 6px; }
  .ai-quick-btn { font-size: 0.72rem; padding: 6px 10px; }
  .ai-messages { max-height: 280px; }
}

/* ============================================================
   AI STUDY HELP CHAT PANEL
   ============================================================ */

.ai-help-panel {
  width: 100%;
  max-width: 520px;
  margin-top: 32px;
  background: var(--bg, #ffffff);
  border: 2px solid var(--black, #111111);
  box-shadow: 4px 4px 0 var(--black, #111111);
  overflow: hidden;
  transition: all 0.3s ease;
}

.ai-help-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: transparent;
  border: none;
  width: 100%;
  cursor: pointer;
  transition: background 0.15s;
}
.ai-help-toggle:hover {
  background: var(--bg-soft, #f8f8f6);
}

.ai-help-toggle-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-help-icon {
  width: 32px;
  height: 32px;
  background: #7c3aed;
  border: 2px solid var(--black, #111111);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.ai-help-toggle-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--black, #111111);
  font-family: 'Inter', sans-serif;
}

.ai-help-toggle-hint {
  font-size: 0.75rem;
  color: var(--muted, #888888);
}

.ai-help-chevron {
  font-size: 0.75rem;
  color: var(--muted, #888888);
  transition: transform 0.3s;
}
.ai-help-panel.expanded .ai-help-chevron {
  transform: rotate(180deg);
}

.ai-help-body {
  display: none;
  border-top: 1.5px solid var(--border, #d0d0cc);
}
.ai-help-panel.expanded .ai-help-body {
  display: block;
}

/* Rate limit bar */
.ai-rate-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg-soft, #f8f8f6);
  border-bottom: 1px solid var(--border, #d0d0cc);
}

.ai-rate-label {
  font-size: 0.72rem;
  color: var(--muted, #888888);
  font-weight: 500;
}

.ai-rate-dots {
  display: flex;
  gap: 3px;
}

.ai-rate-dot {
  width: 6px;
  height: 6px;
  background: var(--border, #d0d0cc);
}
.ai-rate-dot.used {
  background: #7c3aed;
}
.ai-rate-dot.used.warning {
  background: var(--orange, #f97316);
}

/* Quick action buttons */
.ai-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border, #d0d0cc);
}

.ai-quick-btn {
  padding: 6px 14px;
  background: var(--bg-soft, #f8f8f6);
  border: 1.5px solid var(--border, #d0d0cc);
  color: var(--dark, #2a2a2a);
  font-size: 0.78rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.ai-quick-btn:hover:not(:disabled) {
  border-color: #7c3aed;
  color: #7c3aed;
  background: #f5f3ff;
}
.ai-quick-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Messages area */
.ai-messages {
  max-height: 360px;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  background: var(--bg, #ffffff);
}

.ai-messages::-webkit-scrollbar { width: 4px; }
.ai-messages::-webkit-scrollbar-track { background: transparent; }
.ai-messages::-webkit-scrollbar-thumb {
  background: var(--border, #d0d0cc);
}

.ai-msg {
  max-width: 90%;
  padding: 11px 16px;
  font-size: 0.85rem;
  line-height: 1.6;
  animation: fadeInMsg 0.3s ease;
}

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

.ai-msg.user {
  align-self: flex-end;
  background: #f5f3ff;
  border: 1.5px solid #c4b5fd;
  color: #4c1d95;
}

.ai-msg.assistant {
  align-self: flex-start;
  background: var(--bg-soft, #f8f8f6);
  border: 1.5px solid var(--border, #d0d0cc);
  color: var(--dark, #2a2a2a);
}

.ai-msg.assistant strong {
  color: var(--black, #111111);
}

/* Typing indicator */
.ai-msg.typing {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: #7c3aed;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Welcome message */
.ai-welcome {
  text-align: center;
  padding: 20px;
}

.ai-welcome-text {
  font-size: 0.82rem;
  color: var(--mid, #555555);
  line-height: 1.6;
}

.ai-welcome-text strong {
  color: #7c3aed;
}

/* Input area */
.ai-input-area {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1.5px solid var(--border, #d0d0cc);
  background: var(--bg-soft, #f8f8f6);
}

.ai-input {
  flex: 1;
  padding: 9px 13px;
  background: var(--bg, #ffffff);
  border: 1.5px solid var(--border, #d0d0cc);
  color: var(--black, #111111);
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  resize: none;
  min-height: 40px;
  max-height: 80px;
  transition: border-color 0.15s;
}
.ai-input:focus {
  border-color: #7c3aed;
}
.ai-input::placeholder {
  color: var(--light-text, #bbbbbb);
}

.ai-send-btn {
  padding: 9px 18px;
  background: #7c3aed;
  border: 2px solid #7c3aed;
  color: white;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.ai-send-btn:hover:not(:disabled) {
  background: #6d28d9;
  border-color: #6d28d9;
}
.ai-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Rate limit reached state */
.ai-rate-limit-msg {
  text-align: center;
  padding: 20px;
  font-size: 0.82rem;
  color: var(--orange, #f97316);
  line-height: 1.6;
}

.ai-rate-limit-msg strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.88rem;
  color: var(--black, #111111);
}

/* ============================================================
   STUDY MATERIALS PANEL
   ============================================================ */

.study-materials-panel {
  width: 100%;
  max-width: 520px;
  margin-top: 24px;
  background: var(--bg, #ffffff);
  border: 2px solid var(--black, #111111);
  box-shadow: 4px 4px 0 var(--black, #111111);
  overflow: hidden;
  transition: all 0.3s ease;
}

.study-materials-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: transparent;
  border: none;
  width: 100%;
  cursor: pointer;
  transition: background 0.15s;
  color: var(--black, #111111);
}
.study-materials-toggle:hover {
  background: var(--bg-soft, #f8f8f6);
}

.study-mat-icon {
  width: 32px;
  height: 32px;
  background: var(--green, #16a34a);
  border: 2px solid var(--black, #111111);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.study-materials-body {
  display: none;
  border-top: 1.5px solid var(--border, #d0d0cc);
}
.study-materials-panel.expanded .study-materials-body {
  display: block;
}

/* Content Tabs */
.content-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1.5px solid var(--border, #d0d0cc);
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg-soft, #f8f8f6);
}
.content-tabs::-webkit-scrollbar { display: none; }

.content-tab {
  flex: 1;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted, #888888);
  font-size: 0.78rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  min-width: 0;
}
.content-tab:hover {
  color: var(--black, #111111);
  background: var(--bg-ruled, #f2f2ef);
}
.content-tab.active {
  color: var(--green, #16a34a);
  border-bottom-color: var(--green, #16a34a);
  background: var(--bg, #ffffff);
}

/* Content Body */
.content-body {
  min-height: 120px;
  max-height: 480px;
  overflow-y: auto;
  padding: 0;
  scroll-behavior: smooth;
}
.content-body::-webkit-scrollbar { width: 4px; }
.content-body::-webkit-scrollbar-track { background: transparent; }
.content-body::-webkit-scrollbar-thumb {
  background: var(--border, #d0d0cc);
}

.content-placeholder {
  padding: 20px;
}

/* Loading spinner */
.content-loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 32px 20px;
}
.content-spinner-dots {
  display: flex;
  gap: 6px;
}
.content-spinner-dots div {
  width: 8px;
  height: 8px;
  background: var(--green, #16a34a);
  animation: contentDotBounce 1.2s ease-in-out infinite;
}
.content-spinner-dots div:nth-child(2) { animation-delay: 0.2s; }
.content-spinner-dots div:nth-child(3) { animation-delay: 0.4s; }
@keyframes contentDotBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
.content-spinner-label {
  font-size: 0.8rem;
  color: var(--mid, #555555);
  margin: 0;
}

/* Empty state */
.content-empty {
  text-align: center;
  padding: 28px 20px;
}
.content-empty p {
  font-size: 0.82rem;
  color: var(--mid, #555555);
  margin-bottom: 16px;
  line-height: 1.6;
}
.btn-generate-content {
  padding: 9px 22px;
  background: var(--green, #16a34a);
  border: 2px solid var(--green, #16a34a);
  color: white;
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-generate-content:hover { opacity: 0.85; }

/* Rendered content */
.content-rendered {
  padding: 20px;
  font-size: 0.84rem;
  line-height: 1.75;
  color: var(--dark, #2a2a2a);
}

/* Study content typography */
.sc-h1 {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--black, #111111);
  margin: 0 0 14px 0;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border, #d0d0cc);
  letter-spacing: -0.02em;
}
.sc-h2 {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green, #16a34a);
  margin: 18px 0 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sc-h3 {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--black, #111111);
  margin: 12px 0 6px 0;
}
.sc-p {
  margin: 0 0 10px 0;
  color: var(--dark, #2a2a2a);
}
.sc-hr {
  border: none;
  border-top: 1px solid var(--border, #d0d0cc);
  margin: 16px 0;
}
.sc-list {
  padding-left: 18px;
  margin: 8px 0;
}
.sc-list li {
  margin-bottom: 6px;
  color: var(--dark, #2a2a2a);
}
.sc-code {
  background: var(--bg-ruled, #f2f2ef);
  border: 1px solid var(--border, #d0d0cc);
  padding: 1px 5px;
  font-size: 0.8em;
  font-family: monospace;
  color: var(--black, #111111);
}
.sc-tip {
  color: var(--muted, #888888);
  font-style: italic;
  font-size: 0.8em;
}

/* Recall Q&A blocks */
.sc-q {
  background: var(--green-bg, #f0fdf4);
  border-left: 3px solid var(--green, #16a34a);
  padding: 8px 12px;
  margin: 10px 0 4px 0;
  font-weight: 700;
  color: var(--black, #111111);
  font-size: 0.84rem;
}
.sc-a {
  background: var(--bg-soft, #f8f8f6);
  border-left: 3px solid var(--border, #d0d0cc);
  padding: 8px 12px;
  margin: 0 0 14px 0;
  color: var(--mid, #555555);
  font-size: 0.82rem;
}

/* Mobile */
@media (max-width: 600px) {
  .study-materials-panel { box-shadow: none; }
  .content-tab { font-size: 0.72rem; padding: 9px 6px; }
  .content-body { max-height: 380px; }
}
