/* ==========================================================================
   Volrad Learning PWA — Modern Mobile-First Design System (Light & Dark)
   ========================================================================== */

:root,
:root[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-elevated: #ffffff;
  --bg-subtle: #eef2f9;
  --bg-glass: rgba(255, 255, 255, 0.86);
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: rgba(79, 70, 229, 0.11);
  --primary-text: #4338ca;

  --accent: #0ea5e9;
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.14);
  --success-text: #047857;
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --warning-text: #b45309;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --danger-text: #b91c1c;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px -6px rgba(15, 23, 42, 0.09);
  --shadow-lg: 0 18px 40px -12px rgba(15, 23, 42, 0.16);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --header-height: 60px;
  --bottom-nav-height: 68px;
}

:root[data-theme="dark"] {
  --bg: #0b1120;
  --bg-elevated: #141d31;
  --bg-subtle: #1c2740;
  --bg-glass: rgba(15, 23, 42, 0.86);
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: #24314d;
  --border-strong: #334569;

  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-soft: rgba(99, 102, 241, 0.18);
  --primary-text: #a5b4fc;

  --accent: #38bdf8;
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.18);
  --success-text: #6ee7b7;
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.18);
  --warning-text: #fcd34d;
  --danger: #f87171;
  --danger-hover: #ef4444;
  --danger-soft: rgba(248, 113, 113, 0.16);
  --danger-text: #fca5a5;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 26px -6px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 44px -12px rgba(0, 0, 0, 0.6);
}

/* Base Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

.hidden {
  display: none !important;
}

/* App Layout */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: calc(var(--header-height) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 960px;
  height: var(--header-height);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.brand-icon {
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary-text);
  letter-spacing: 0.04em;
}

.desktop-nav {
  display: none;
  align-items: center;
  gap: 6px;
}

.desktop-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
}

.desktop-nav-btn svg {
  width: 18px;
  height: 18px;
}

.desktop-nav-btn:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.desktop-nav-btn.active {
  background: var(--primary-soft);
  color: var(--primary-text);
}

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

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--border);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn-sm {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 20px;
}

:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* Main Content */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 24px);
}

/* Bottom Mobile Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.bottom-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  transition: color 0.15s ease, background 0.15s ease;
}

.bottom-nav-btn svg {
  width: 22px;
  height: 22px;
}

.bottom-nav-btn.active {
  color: var(--primary-text);
  background: var(--primary-soft);
}

@media (min-width: 768px) {
  .desktop-nav {
    display: flex;
  }
  .bottom-nav {
    display: none;
  }
  .app-main {
    padding: 24px 24px 48px;
  }
}

/* Common Cards & Typography */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.page-subtitle {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

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

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

.section-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 13px;
  font-weight: 600;
  font-size: 14.5px;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 10px;
}

.btn-xs {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-success-soft {
  background: var(--success-soft);
  color: var(--success-text);
}

.btn-warning-soft {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text);
}

/* Badges & Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-primary {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.badge-success {
  background: var(--success-soft);
  color: var(--success-text);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.badge-neutral {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

/* Form Inputs */
.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Segmented Controls / Tabs */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
}

.segmented-btn {
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.segmented-btn.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Learn Hub & Learning Modes
   ========================================================================== */

.hero-banner {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 55%, #0ea5e9 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.hero-sub {
  margin: 4px 0 0;
  font-size: 13.5px;
  opacity: 0.9;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.hero-metric {
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 10px 12px;
}

.hero-metric-val {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
}

.hero-metric-lbl {
  font-size: 11.5px;
  opacity: 0.88;
  margin-top: 3px;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 600px) {
  .mode-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.mode-card {
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.mode-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.mode-card:active {
  transform: scale(0.99);
}

.mode-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary-text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
  font-weight: 800;
}

.mode-icon.cs {
  background: rgba(14, 165, 233, 0.14);
  color: var(--accent);
}

.mode-icon.write {
  background: var(--success-soft);
  color: var(--success-text);
}

.mode-icon.quiz {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.mode-info h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
}

.mode-info p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .filter-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Active Study Session */
.study-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.study-progress-wrap {
  flex: 1;
}

.study-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.25s ease;
}

/* 3D Flip Flashcard */
.flashcard-stage {
  perspective: 1200px;
  margin: 14px 0 18px;
}

.flashcard {
  position: relative;
  width: 100%;
  min-height: 310px;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.flashcard-back {
  transform: rotateY(180deg);
  overflow-y: auto;
}

.flashcard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.flashcard-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px 6px;
}

.flashcard-word {
  font-size: clamp(24px, 6.5vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  word-break: break-word;
}

.flashcard-hint {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.flashcard-trans-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  text-align: left;
}

.trans-chip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 13px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.trans-chip-row.is-known {
  opacity: 0.68;
  border-style: dashed;
}

.trans-chip-text {
  font-size: 16px;
  font-weight: 700;
  word-break: break-word;
}

.trans-chip-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.study-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.study-secondary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
}

/* Writing Practice & Quiz Cards */
.prompt-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px 20px;
  box-shadow: var(--shadow-md);
  text-align: center;
  margin-bottom: 16px;
}

.prompt-word {
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 800;
  margin: 14px 0 6px;
  line-height: 1.25;
  word-break: break-word;
}

.write-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.write-input {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  min-height: 52px;
  border-radius: 15px;
}

.feedback-box {
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 12px;
  border: 1px solid transparent;
}

.feedback-box.correct {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success-text);
}

.feedback-box.wrong {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger-text);
}

.feedback-box.warn {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning-text);
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 600px) {
  .quiz-options {
    grid-template-columns: 1fr 1fr;
  }
}

.quiz-option {
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  text-align: left;
  font-size: 15.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.quiz-option-key {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quiz-option.correct {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success-text);
}

.quiz-option.correct .quiz-option-key {
  background: var(--success);
  color: #ffffff;
}

.quiz-option.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger-text);
}

.quiz-option.wrong .quiz-option-key {
  background: var(--danger);
  color: #ffffff;
}

.quiz-option.dimmed {
  opacity: 0.55;
}

/* Session Summary */
.summary-card {
  text-align: center;
  padding: 30px 20px;
}

.summary-score {
  font-size: 46px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1.1;
  margin: 10px 0;
}

/* ==========================================================================
   Words & Known Library List
   ========================================================================== */

.toolbar-card {
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-row {
  display: flex;
  gap: 8px;
}

.word-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.word-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.word-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.word-card-en {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  word-break: break-word;
}

.word-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.word-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.word-trans-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.word-trans-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--bg-subtle);
}

.word-trans-item.is-known {
  background: var(--success-soft);
}

.word-trans-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.word-trans-cs {
  font-weight: 600;
  font-size: 14.5px;
  word-break: break-word;
}

.word-trans-time {
  font-size: 11px;
  color: var(--text-muted);
}

.word-trans-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

/* ==========================================================================
   Settings, Statistics & JSON Importer
   ========================================================================== */

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

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-tile {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dropzone-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.dropzone-sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

.import-preview {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.import-errors {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--danger-text);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.setting-info strong {
  display: block;
  font-size: 14.5px;
}

.setting-info span {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  transition: background 0.2s ease;
  cursor: pointer;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.switch input:checked + .switch-slider {
  background: var(--primary);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 13px;
}

/* Empty & Loading States */
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}

.empty-state h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 17px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 28px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow-lg);
}

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

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.modal-message {
  margin: 10px 0 20px;
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + env(safe-area-inset-top) + 10px);
  right: 16px;
  left: 16px;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  max-width: 440px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease;
}

.toast.success {
  background: #065f46;
  color: #ecfdf5;
}

.toast.error {
  background: #991b1b;
  color: #fef2f2;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
