/* ── RESET & BASE ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  overflow-x: hidden;
  max-width: 100%;
}
body {
  font-family: 'Inter', 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── LAYOUT ───────────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; max-width: 100%; overflow-x: hidden; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--ease-slow);
  padding: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.25rem 1.25rem 1.125rem;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.logo-icon { font-size: 22px; line-height: 1; }
.logo-text {
  font-family: 'Inter', 'DM Sans', sans-serif;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  font-size: 17px;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0.5rem 0.625rem 0.75rem;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.2);
  padding: 1rem 0.75rem 0.3rem;
  pointer-events: none;
  user-select: none;
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), box-shadow var(--ease);
  text-decoration: none;
  user-select: none;
  position: relative;
}
.nav-item i {
  width: 16px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
  opacity: 0.8;
  transition: color var(--ease), opacity var(--ease);
}
.nav-item span { flex: 1; line-height: 1; }
.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
}
.nav-item:hover i { opacity: 1; }
.nav-item.active {
  background: var(--primary-subtle);
  color: rgba(255,255,255,0.95);
  font-weight: 500;
  box-shadow: inset 3px 0 0 var(--primary);
}
.nav-item.active i { color: var(--primary-hover); opacity: 1; }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease-slow);
  backdrop-filter: blur(1px);
}
.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--sidebar-border);
  align-items: center;
  padding: 0 0.75rem 0 1rem;
  gap: 0.875rem;
  z-index: 200;
}
.menu-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 17px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--ease), background var(--ease);
  flex-shrink: 0;
}
.menu-btn:hover { color: white; background: rgba(255,255,255,0.07); }
.topbar-title {
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  font-size: 16px;
  letter-spacing: -0.01em;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-streak { color: var(--warning); font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding: 2rem;
  min-height: 100vh;
  overflow-x: hidden;
}

.impersonation-banner {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: .85rem 1rem;
  background: var(--primary-pale);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius);
  color: var(--text-primary);
}
.impersonation-banner-text {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
  font-size: .92rem;
}
.impersonation-banner-text i { color: var(--primary); }
.impersonation-banner-text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page { display: none; }
.page.active { display: block; }

/* ── TYPOGRAPHY ───────────────────────────────────────────────────── */
.page-title {
  font-family: 'Inter', 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 24px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}
.page-subtitle { font-size: 14px; color: var(--text-secondary); font-weight: 400; margin-bottom: 1.75rem; }
.section-title {
  font-family: 'Inter', 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
}

/* ── CARDS ────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card-lg { border-radius: var(--radius-lg); }

/* ── FOCUS VISIBLE (global) ────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { border-radius: var(--radius-sm); }

/* ── GLOBAL SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }

/* ── GLOBAL PLACEHOLDER ────────────────────────────────────────── */
::placeholder { color: var(--text-muted); opacity: 1; }

/* ── SKELETON LOADER ───────────────────────────────────────────── */
@keyframes skeleton-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.skeleton { background: var(--surface-2); border-radius: var(--radius-sm); animation: skeleton-pulse 1.6s ease infinite; }
.skeleton-text { height: 14px; border-radius: 4px; }
.skeleton-title { height: 22px; border-radius: 4px; }
.skeleton-card { height: 120px; border-radius: var(--radius); border: 1px solid var(--border); }

/* ── LOADING STATE ─────────────────────────────────────────────── */
.loading {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 4rem 2rem;
  color: var(--text-secondary); font-size: 14px;
}
.loading i { color: var(--primary); }

/* ── DASHBOARD ───────────────────────────────────────────────────── */
.dashboard-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.625rem 1.75rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.dashboard-hero .page-title { margin-bottom: 0.25rem; }
.dashboard-hero .page-subtitle { margin-bottom: 0; }
.dashboard-hero-action { flex-shrink: 0; }
.dashboard-section { margin-bottom: 1.75rem; }

/* ── DASHBOARD MODULE GRID (new) ───────────────────────────────── */
.dashboard-module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.dashboard-module-grid--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ── PREMIUM MODULE CARD (dmc-*) ───────────────────────────────── */
.dmc {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  font-family: 'Inter', 'DM Sans', sans-serif;
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.18s;
  position: relative;
  width: 100%;
}
.dmc:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(108,116,220,0.2);
  transform: translateY(-2px);
}
.dmc:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.dmc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.dmc-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.dmc-arrow {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11px;
  flex-shrink: 0;
  transition: background var(--ease), color var(--ease), transform var(--ease);
}
.dmc:hover .dmc-arrow {
  background: var(--primary-pale);
  color: var(--primary-hover);
  transform: translateX(2px);
}
.dmc-body { flex: 1; min-width: 0; }
.dmc-title {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 0.3rem;
}
.dmc-text {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.dmc-meta {
  display: inline-flex;
  align-items: center;
  background: var(--primary-pale);
  color: var(--primary-hover);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.025em;
  align-self: flex-start;
}

/* ── FEATURED CARD (Study Plan hub) ───────────────────────────────── */
.dmc-featured {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.375rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
  width: 100%;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.dmc-featured::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
}
.dmc-featured:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.dmc-featured-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  background: var(--primary-subtle);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.dmc-featured-body { flex: 1; min-width: 0; }
.dmc-featured-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.dmc-featured-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}
.dmc-featured-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.dmc-featured-chips span {
  font-size: 11px;
  font-weight: 500;
  background: var(--primary-pale);
  color: var(--primary);
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.dmc-featured-arrow {
  color: var(--primary);
  font-size: 15px;
  flex-shrink: 0;
  transition: transform var(--ease);
}
.dmc-featured:hover .dmc-featured-arrow { transform: translateX(3px); }

@media (max-width: 640px) {
  .dmc-featured { flex-direction: column; align-items: flex-start; gap: 0.875rem; }
  .dmc-featured-arrow { display: none; }
}

/* Legacy card (preserved for compat) */
.dashboard-module-card {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: 1fr auto;
  align-items: start;
  gap: 0.8rem;
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s, transform 0.15s;
}
.dashboard-module-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.dashboard-module-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.dashboard-module-icon {
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  background: var(--primary-light); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
.dashboard-module-body { min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.dashboard-module-title { font-weight: 700; font-size: 15px; color: var(--text-primary); }
.dashboard-module-text { font-size: 13px; line-height: 1.35; color: var(--text-secondary); }
.dashboard-module-meta {
  grid-column: 2; align-self: end; width: fit-content;
  border-radius: 999px; background: var(--primary-pale); color: var(--primary-hover);
  padding: 0.2rem 0.55rem; font-size: 11px; font-weight: 600;
}
.dashboard-module-arrow {
  grid-column: 3; grid-row: 1 / span 2; align-self: center;
  color: var(--text-muted); font-size: 13px; transition: color var(--ease), transform var(--ease);
}
.dashboard-module-card:hover .dashboard-module-arrow { color: var(--primary); transform: translateX(2px); }

/* ── GRID ─────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

/* ── BUTTONS ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background var(--ease), color var(--ease), border-color var(--ease), transform var(--ease), box-shadow var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn:not(:disabled):active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-primary); }
.btn-secondary { background: var(--surface); border: 1px solid var(--border-2); color: var(--text-primary); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--surface-hover); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid transparent; }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-success { background: var(--success-bg); color: var(--success); border: 1px solid transparent; }
.btn-success:hover { background: var(--success); color: white; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 15px; border-radius: var(--radius); }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 12px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ── ICON BUTTONS ─────────────────────────────────────────────────── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--text-primary);
}
.icon-btn--danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger-bg);
  color: var(--danger);
}

/* ── BADGE / PILL ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}
.badge-orange { background: var(--primary-light); color: var(--primary); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: var(--surface-2); color: var(--text-secondary); }

/* ── PROGRESS BAR ─────────────────────────────────────────────────── */
.progress-bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 99px; transition: width 0.4s ease; }
.progress-fill.success { background: var(--success); }

/* ── CATEGORY TABS ────────────────────────────────────────────────── */
.cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 1rem; }
.cat-tab {
  padding: 5px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.cat-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ── SURVIVAL SCENARIO GRID ───────────────────────────────────────── */
.scenario-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--card);
  text-align: center;
}
.scenario-card:hover { border-color: var(--primary); background: var(--primary-light); }
.scenario-card.active { border-color: var(--primary); background: var(--primary-light); }
.scenario-card .sc-icon { font-size: 28px; margin-bottom: 6px; }
.scenario-card h4 { font-size: 13px; font-weight: 500; color: var(--text-primary); }

/* ── PHRASE LIST ITEMS ────────────────────────────────────────────── */
.phrase-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 6px;
  transition: border-color 0.12s;
}
.phrase-item:hover { border-color: var(--border-2); }
.phrase-item .pi-text .en { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.phrase-item .pi-text .pt { font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 300; }
.phrase-item .pi-btn {
  background: var(--primary-light);
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  flex-shrink: 0;
  transition: background var(--ease), color var(--ease);
}
.phrase-item .pi-btn:hover { background: var(--primary); color: white; }

/* ── STAT CARDS ───────────────────────────────────────────────────── */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.stat-card .stat-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stat-card .stat-value { font-weight: 700; font-size: 26px; color: var(--text-primary); letter-spacing: -0.02em; }
.stat-card .stat-sub { font-size: 11px; color: var(--muted-2); margin-top: 2px; }

/* ── INPUT FIELD ──────────────────────────────────────────────────── */
.input-row { display: flex; gap: 8px; }
.input-row input {
  flex: 1;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.input-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-pale); }
.input-row input::placeholder { color: var(--text-muted); }

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ── SPIN ANIMATION ───────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.fa-spin { animation: spin 1s linear infinite; }

/* ── EMPTY STATE ──────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state i { font-size: 36px; margin-bottom: 0.75rem; display: block; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ── TOAST NOTIFICATIONS ──────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 320px;
  line-height: 1.4;
}
.toast--visible { opacity: 1; transform: translateY(0); }
.toast--success { background: var(--success); color: white; }
.toast--error { background: var(--danger); color: white; }
.toast--info { background: var(--primary); color: white; }

/* ── MODAL LAYOUT ─────────────────────────────────────────────────── */
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.5rem 1.75rem 1.25rem; border-bottom: 1px solid var(--border);
}
.modal-title { font-weight: 700; font-size: 17px; color: var(--text-primary); }
.modal-body  { padding: 1.5rem 1.75rem; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 1.25rem 1.75rem; border-top: 1px solid var(--border);
  background: rgba(108,116,220,0.02);
}

/* ── FORM ─────────────────────────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.form-input {
  width: 100%; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem; font-size: 14px; font-family: inherit;
  background: var(--surface-2); color: var(--text-primary); outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-pale); }
.form-input::placeholder { color: var(--text-muted); }
select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; min-height: 80px; line-height: 1.5; }

/* ── AUDIO SECTION ────────────────────────────────────────────────── */
.audio-section {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; background: var(--surface-2);
}
.audio-section-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1rem; gap: 8px;
}
.audio-tabs {
  display: flex; border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 1rem;
}
.audio-tab {
  flex: 1; padding: 0.55rem 0.5rem; background: var(--surface); border: none;
  border-right: 1px solid var(--border-2);
  font-size: 12px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; transition: background var(--ease), color var(--ease);
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.audio-tab:last-child { border-right: none; }
.audio-tab.active { background: var(--primary); color: white; }
.audio-tab:hover:not(.active) { background: var(--surface-hover); color: var(--text-primary); }
.audio-panel { animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }

/* ── DROP ZONE ────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border-2); border-radius: var(--radius);
  padding: 2rem 1rem; text-align: center; cursor: pointer;
  transition: all 0.15s; background: var(--surface);
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--primary); background: var(--primary-pale); }
.drop-zone.has-file { border-style: solid; border-color: var(--success); background: var(--success-bg); }

/* ── SIDEBAR FOOTER ───────────────────────────────────────────────── */
.sidebar-footer {
  padding: 0.625rem;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex-shrink: 0;
}

.sidebar-theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.38);
  font-size: 12px;
  font-family: 'Inter', 'DM Sans', sans-serif;
  font-weight: 500;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  transition: color var(--ease), background var(--ease), border-color var(--ease);
}
.sidebar-theme-toggle i { font-size: 12px; flex-shrink: 0; }
.sidebar-theme-toggle:hover {
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.05);
  border-color: var(--sidebar-border);
}

.sidebar-streak {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(232,165,48,0.08);
  border: 1px solid rgba(232,165,48,0.15);
}
.streak-num {
  font-family: 'Inter', 'DM Sans', sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: var(--warning);
  line-height: 1;
  min-width: 24px;
}
.streak-label {
  font-size: 11.5px;
  color: rgba(255,255,255,0.4);
  line-height: 1.3;
  flex: 1;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0.45rem 0.625rem;
  border-radius: var(--radius-sm);
  transition: background var(--ease);
}
.sidebar-user:hover { background: rgba(255,255,255,0.04); }

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255,255,255,0.48);
  font-size: 12.5px;
  font-weight: 400;
  min-width: 0;
  overflow: hidden;
}
.sidebar-user-info i { font-size: 15px; flex-shrink: 0; }
.sidebar-user-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-logout {
  background: none;
  border: none;
  color: rgba(255,255,255,0.28);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 13px;
  flex-shrink: 0;
  transition: color var(--ease), background var(--ease);
}
.sidebar-logout:hover { color: var(--danger); background: rgba(224,90,90,0.1); }

/* ── AUTH SCREEN ──────────────────────────────────────────────────── */
@keyframes auth-enter {
  from { opacity: 0; transform: translateY(14px) scale(0.984); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

#auth-screen {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.75rem 2.25rem 2.25rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18), 0 1px 4px rgba(0,0,0,0.1);
  animation: auth-enter 0.35s cubic-bezier(0.22,1,0.36,1) both;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 0.35rem;
}
.auth-logo-icon { font-size: 28px; }
.auth-logo-text {
  font-weight: 800;
  font-size: 22px;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.auth-tagline {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 1.75rem;
}

.auth-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 1.5rem;
  gap: 3px;
}
.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.6rem;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.auth-form { display: flex; flex-direction: column; gap: 1rem; }

.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.auth-field input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.72rem 0.925rem;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface-2);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.auth-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-pale);
}
.auth-field input::placeholder { color: var(--text-muted); }

.auth-field-password {
  position: relative;
}
.auth-field-password input {
  padding-right: 2.75rem;
  width: 100%;
}
.auth-pwd-toggle {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.auth-pwd-toggle:hover { color: var(--text-secondary); }
.auth-pwd-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.auth-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(224,90,90,0.2);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-size: 13px;
  font-weight: 500;
}

.auth-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(61,190,122,0.2);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-size: 13px;
  font-weight: 500;
}

.auth-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.825rem;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
  box-shadow: 0 2px 8px rgba(108,116,220,0.28);
  margin-top: 0.125rem;
}
.auth-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 4px 20px rgba(108,116,220,0.42);
  transform: translateY(-1px);
}
.auth-btn:active:not(:disabled) { transform: scale(0.99); box-shadow: none; }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.auth-social {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.auth-social-label {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.auth-social-label::before,
.auth-social-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-social-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.auth-social-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.18s, background 0.18s, transform 0.18s, box-shadow 0.18s;
  box-shadow: var(--shadow-sm);
}
.auth-social-btn:hover {
  border-color: var(--border-2);
  background: var(--surface);
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
}
.auth-social-btn:active { transform: scale(0.94); }
.auth-social-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-switch a { color: var(--primary); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .topbar { display: flex; }
  .main-content { margin-left: 0; padding: 1rem; padding-top: calc(var(--topbar-h) + 1rem); }
  .impersonation-banner { align-items: stretch; flex-direction: column; }
  .impersonation-banner-text span { white-space: normal; }
  .dashboard-hero { flex-direction: column; align-items: stretch; gap: 1rem; padding: 1.25rem; overflow: hidden; }
  .dashboard-hero > div { min-width: 0; }
  .sp-hero-actions { flex-shrink: 1; }
  .dashboard-hero-action { width: 100%; }
  .page-title { font-size: 21px; word-break: break-word; overflow-wrap: break-word; }
  .dashboard-module-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dashboard-module-grid--compact { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .cls-card-header,
  .cls-plan-section-head,
  .cls-plan-add {
    flex-direction: column;
    align-items: stretch;
  }
  .cls-member {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .auth-card { padding: 2rem 1.5rem; }
}

@media (max-width: 480px) {
  .dashboard-module-grid { grid-template-columns: 1fr; }
  .dmc { padding: 1rem; }
}

/* ── STUDY PLAN ───────────────────────────────────────────────────── */

/* Topic pills row */
.sp-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: none;
  margin-bottom: 1.75rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.sp-pills::-webkit-scrollbar { display: none; }
.sp-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  flex-shrink: 0;
}
.sp-pill:hover { border-color: var(--border-2); color: var(--text-primary); }
.sp-pill--active { background: var(--primary-pale); border-color: var(--primary); color: var(--primary); }
.sp-pill-emoji { font-size: 14px; line-height: 1; }
.sp-pill-count {
  font-size: 11px;
  background: var(--surface-2);
  padding: 1px 7px;
  border-radius: 20px;
  color: var(--text-muted);
  font-weight: 600;
}
.sp-pill--active .sp-pill-count { background: var(--primary-subtle); color: var(--primary); }

/* Study plan hero actions */
.sp-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* Topic header */
.sp-thdr {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 1.25rem;
}
.sp-thdr-emoji { font-size: 26px; line-height: 1.2; flex-shrink: 0; margin-top: 1px; }
.sp-thdr-body { flex: 1; min-width: 0; }
.sp-thdr-name { font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 0; line-height: 1.2; }
.sp-thdr-meta { font-size: 13px; color: var(--text-muted); margin: 3px 0 0; }
.sp-thdr-actions { display: flex; gap: 4px; flex-shrink: 0; padding-top: 2px; }

/* Practice CTA */
.sp-practice {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 1.125rem 1.375rem;
  margin-bottom: 1.75rem;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.sp-practice:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.sp-practice-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.sp-practice-body { flex: 1; min-width: 0; }
.sp-practice-title { font-size: 14px; font-weight: 700; color: var(--text-primary); margin: 0; }
.sp-practice-desc { font-size: 12px; color: var(--text-secondary); margin: 2px 0 0; }
.sp-practice-badge {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.sp-practice-badge--ok { background: var(--success-bg); color: var(--success); }
.sp-practice-arrow { font-size: 13px; color: var(--primary); flex-shrink: 0; opacity: 0.6; }

/* Empty states */
.sp-empty-pills {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0.25rem 0 1.5rem;
}
.sp-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 2rem;
  text-align: center;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  min-height: 260px;
  gap: 8px;
}
.sp-detail-empty i { font-size: 30px; color: var(--text-muted); opacity: 0.25; }
.sp-detail-empty p { font-size: 14px; color: var(--text-secondary); margin: 0; }
.sp-detail-empty small { font-size: 12px; color: var(--text-muted); }

.sp-tabs {
  display: flex;
  gap: 0;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0;
  width: 100%;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.sp-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  transition: color var(--ease), border-color var(--ease);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.sp-tab:hover { color: var(--text-primary); background: none; }
.sp-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; background: none; }

/* ── STUDY PLAN — Words toolbar, filter, pagination ─────────────────── */
.sp-words-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.sp-words-actions { display: flex; gap: 8px; flex-shrink: 0; }
.sp-words-search-wrap {
  flex: 1;
  min-width: 160px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  color: var(--muted);
  font-size: 13px;
  transition: border-color 0.15s;
}
.sp-words-search-wrap:focus-within {
  border-color: var(--primary);
  color: var(--primary);
}
.sp-words-search-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  font-family: inherit;
  padding: 7px 0;
  width: 100%;
}
.sp-words-filters-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.sp-words-filter-group {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.sp-words-type-btn {
  padding: 4px 14px;
  border-radius: 99px;
  border: 1px solid var(--border-2);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.sp-words-type-btn:hover { border-color: var(--primary); color: var(--primary); }
.sp-words-type-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.sp-words-audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid var(--border-2);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.sp-words-audio-btn:hover { border-color: var(--primary); color: var(--primary); }
.sp-words-audio-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.sp-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sp-pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
  background: var(--card);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}
.sp-pagination-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.sp-pagination-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.sp-pagination-info { font-size: 13px; font-weight: 600; color: var(--text-primary); min-width: 70px; text-align: center; }
.sp-pagination-meta { text-align: center; font-size: 11px; color: var(--muted); margin-top: 6px; }

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

.sp-item-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sp-item-card:hover {
  border-color: var(--border-2);
  box-shadow: 0 2px 8px var(--surface-2);
}
.sp-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.sp-item-text { flex: 1; min-width: 0; }
.sp-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding-top: 1px;
}
.sp-item-en { font-weight: 600; font-size: 15px; color: var(--text-primary); line-height: 1.3; word-break: break-word; overflow-wrap: break-word; }
.sp-item-pt { font-size: 13px; color: var(--muted); margin-top: 2px; }
.sp-item-example {
  font-size: 12px;
  color: var(--info);
  font-style: italic;
  margin-top: 6px;
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.sp-item-example i { font-size: 9px; opacity: 0.5; flex-shrink: 0; }
.sp-item-notes {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.sp-item-notes i { font-size: 11px; color: var(--primary); flex-shrink: 0; }
.sp-item-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.sp-item-audio-btn { color: var(--success) !important; }

.sp-note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.sp-note-card:hover { box-shadow: var(--shadow); }
.sp-note-summary {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}
.sp-note-summary:hover { background: var(--primary-pale); }
.sp-note-card--expanded .sp-note-summary { background: var(--primary-pale); }
.sp-note-summary-left { flex: 1; min-width: 0; }
.sp-note-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-note-preview {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-note-summary-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.sp-note-date { font-size: 11px; color: var(--muted-2); }
.sp-note-dirty-badge { font-size: 11px; color: var(--primary); font-weight: 600; }
.sp-note-chevron { font-size: 11px; color: var(--muted); transition: transform 0.2s ease; }
.sp-note-chevron--open { transform: rotate(180deg); }
.sp-note-body { border-top: 1px solid var(--border); padding: 12px 16px 14px; }

.sp-modules-grid { display: flex; flex-direction: column; gap: 8px; }
.sp-module-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Flashcard session */
.sp-fc-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.sp-fc-progress { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; max-width: 400px; }
.sp-fc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-2); transition: background 0.3s; }
.sp-fc-dot.done { background: var(--success); }
.sp-fc-dot.current { background: var(--primary); width: 18px; border-radius: 4px; }
.sp-fc-stage { width: 100%; max-width: 420px; perspective: 1000px; cursor: pointer; }
.sp-fc-inner { position: relative; width: 100%; height: 250px; transform-style: preserve-3d; transition: transform 0.5s cubic-bezier(0.4,0,0.2,1); }
.sp-fc-inner.flipped { transform: rotateY(180deg); }
.sp-fc-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--radius); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; background: var(--card); }
.sp-fc-back { transform: rotateY(180deg); background: var(--primary-pale); border-color: var(--border-2); }

/* Modal */
.sp-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  backdrop-filter: blur(2px);
}
.sp-modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  position: relative; box-shadow: var(--shadow-lg);
}
.sp-modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; font-size: 18px; color: var(--muted);
  cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.sp-modal-close:hover { color: var(--text-primary); background: var(--surface-2); }
.sp-modal-title { font-weight: 700; font-size: 18px; margin-bottom: 1.25rem; color: var(--text-primary); }

/* Emoji/color pickers */
.sp-emoji-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.sp-emoji-btn { background: var(--card); border: 1.5px solid var(--border); border-radius: 8px; font-size: 20px; padding: 6px 8px; cursor: pointer; transition: all 0.12s; }
.sp-emoji-btn:hover { border-color: var(--primary); }
.sp-emoji-btn.active { border-color: var(--primary); background: var(--primary-light); }
.sp-color-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.sp-color-btn { width: 32px; height: 32px; border-radius: 50%; border: 2.5px solid transparent; cursor: pointer; transition: transform 0.12s; }
.sp-color-btn:hover { transform: scale(1.15); }
.sp-color-btn.active { border-color: var(--text-primary); transform: scale(1.1); }

/* ── STUDY PLAN — Audio section ───────────────────────────────────── */
.sp-audio-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: var(--surface-2);
  margin-top: 0.75rem;
}
.sp-audio-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.sp-audio-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.sp-audio-tab {
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.sp-audio-tab:hover { color: var(--text-primary); border-color: var(--primary); }
.sp-audio-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.sp-audio-panel { padding: 4px 0; }

.sp-rec-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
  animation: pulse 1s infinite;
  flex-shrink: 0;
}

/* ── STUDY PLAN — Flashcard tab header ────────────────────────────── */
.sp-fc-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.sp-fc-tab-stats {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
  align-items: center;
}
.sp-fc-start-btn {
  background: var(--primary-pale);
  border: 1.5px solid var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.sp-fc-start-btn:hover { background: var(--primary); color: white; }

/* ── STUDY PLAN — Flashcard session ───────────────────────────────── */
.sp-fc-session-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 520px;
  margin: 0 auto;
  padding-bottom: 2rem;
}

/* Session header */
.sp-fc-session-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sp-fc-exit-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px solid var(--border);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.sp-fc-exit-btn:hover { border-color: var(--danger); color: var(--danger); }
.sp-fc-session-info { display: flex; align-items: center; gap: 10px; }
.sp-fc-counter {
  font-weight: 700;
  font-size: 20px;
  color: var(--text-primary);
}
.sp-fc-counter-sep { color: var(--muted); font-size: 16px; }
.sp-fc-learned-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--success);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
}

/* Progress bar */
.sp-fc-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.sp-fc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-mid));
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Card face text */
.sp-fc-face-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.sp-fc-face-word {
  font-weight: 700;
  font-size: 32px;
  text-align: center;
  color: var(--text-primary);
  line-height: 1.2;
  word-break: break-word;
}
.sp-fc-face-translation {
  font-weight: 600;
  font-size: 26px;
  color: var(--primary);
  text-align: center;
  word-break: break-word;
}
.sp-fc-face-note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  font-style: italic;
  margin-top: 10px;
  max-width: 90%;
  display: flex;
  align-items: flex-start;
  gap: 5px;
}
.sp-fc-face-note i { color: var(--primary); flex-shrink: 0; margin-top: 2px; }
.sp-fc-flip-hint {
  position: absolute;
  bottom: 14px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0.65;
}
.sp-fc-flip-hint--back { color: var(--primary); }

/* Navigation row */
.sp-fc-nav-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sp-fc-nav-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.sp-fc-nav-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.sp-fc-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.sp-fc-nav-btn--next {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.sp-fc-nav-btn--next:hover:not(:disabled) { filter: brightness(0.9); }
.sp-fc-flip-btn {
  flex: 1;
  height: 46px;
  border: 1.5px solid var(--primary);
  background: var(--primary-pale);
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
}
.sp-fc-flip-btn:hover { background: var(--primary); color: white; }

/* Keyboard hint */
.sp-fc-kbd-hint {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
}
.sp-fc-kbd-hint kbd {
  display: inline-block;
  background: var(--border);
  border: 1px solid var(--border-2);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-family: monospace;
  margin: 0 1px;
}

/* Action strip */
.sp-fc-actions {
  width: 100%;
  display: flex;
  gap: 8px;
}
.sp-fc-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 8px;
  border: 1.5px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.15s;
}
.sp-fc-action-btn i { font-size: 17px; }
.sp-fc-action-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-pale); }
.sp-fc-action-btn.learned { border-color: var(--success); color: var(--success); background: var(--success-bg); }
.sp-fc-action-btn.active { border-color: var(--primary); color: var(--primary); background: var(--primary-pale); }

/* Note editor */
.sp-fc-note-editor {
  width: 100%;
  background: var(--card);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.sp-fc-note-editor-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Session summary */
.sp-fc-summary {
  text-align: center;
  padding: 2rem 1rem;
  width: 100%;
}
.sp-fc-summary-icon { font-size: 56px; margin-bottom: 1rem; line-height: 1; }
.sp-fc-summary h3 {
  font-weight: 700;
  font-size: 24px;
  margin-bottom: 6px;
}
.sp-fc-summary p { font-size: 14px; color: var(--muted); margin-bottom: 1.5rem; }
.sp-fc-summary-stats { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.sp-fc-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 28px;
  min-width: 90px;
}
.sp-fc-stat-num {
  font-weight: 700;
  font-size: 30px;
  line-height: 1;
}
.sp-fc-stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sp-fc-summary-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── STUDY PLAN — Shadowing Mode ────────────────────────────────── */
/* ── Shadowing panel (bottom sheet) ──────────────────────────── */
.sp-sh-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 500;
  background: var(--surface);
  border-top: 1.5px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 70vh;
  overflow-y: auto;
}
.sp-sh-panel--open {
  transform: translateY(0);
  box-shadow: 0 -4px 32px rgba(0,0,0,0.25);
}
.sp-sh-panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.sp-sh-panel-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sp-sh-exit-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  transition: color 0.15s;
}
.sp-sh-exit-btn:hover { color: var(--text-primary); }
.sp-sh-listen-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.sp-sh-listen-btn:hover { border-color: var(--primary); color: var(--primary); }
.sp-sh-rec-btn {
  width: 100%;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.sp-sh-rec-btn:hover { border-color: var(--primary); background: var(--primary-pale); color: var(--primary); }
.sp-sh-rec-btn--active {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  animation: sp-sh-pulse 1.5s ease infinite;
}
.sp-sh-rec-btn--active:hover { background: var(--danger); color: #fff; }
@keyframes sp-sh-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,90,90,0.35); }
  50% { box-shadow: 0 0 0 8px rgba(224,90,90,0); }
}
.sp-sh-rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  animation: pulse 1s infinite;
}
.sp-sh-playback {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.sp-sh-playback-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sp-sh-next-btn {
  width: 100%;
  padding: 0.875rem;
  border-radius: var(--radius-lg);
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter 0.15s;
}
.sp-sh-next-btn:hover { filter: brightness(0.9); }

/* ── STUDY PLAN — Rating buttons (Errei / Difícil / Bom / Fácil) ────── */
.sp-fc-rating-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  margin-bottom: 4px;
}
.sp-fc-rating-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.1s;
}
.sp-fc-rating-btn:active { transform: scale(0.96); }
.sp-fc-rating-label {
  font-size: 13px;
  font-weight: 700;
}
.sp-fc-rating-interval {
  font-size: 10px;
  opacity: 0.8;
  font-weight: 500;
}
.sp-fc-rating-again,
.sp-fc-rating-hard,
.sp-fc-rating-good,
.sp-fc-rating-easy  { background: var(--surface-2); border-color: var(--border); color: var(--text-secondary); }
.sp-fc-rating-again:hover,
.sp-fc-rating-hard:hover,
.sp-fc-rating-good:hover,
.sp-fc-rating-easy:hover  { background: var(--surface-hover); border-color: var(--border-2); color: var(--text-primary); }
@media (max-width: 480px) {
  .sp-fc-rating-btn { padding: 8px 4px; }
  .sp-fc-rating-label { font-size: 12px; }
}

/* ── STUDY PLAN — Spaced Repetition UI ───────────────────────────────── */
.sp-fc-mode-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 3px;
}
.sp-fc-mode-btn {
  background: none;
  border: none;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.sp-fc-mode-btn.active {
  background: var(--primary);
  color: #fff;
}
.sp-fc-sr-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--info-pale, #e8f4fd);
  color: var(--info, #2196f3);
  white-space: nowrap;
}
.sp-fc-allgood {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 2.5rem 1.5rem;
  text-align: center;
}
.sp-fc-allgood-icon {
  font-size: 52px;
  line-height: 1;
}
.sp-fc-allgood h3 {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
}
.sp-fc-allgood p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}
.sp-fc-allgood-next {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  margin: 4px auto 0;
}
/* Due-count badge on the Flashcards tab button */
.sp-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  margin-left: 5px;
  vertical-align: middle;
}

@media (max-width: 480px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}

/* ── Role badge ──────────────────────────────────────────────────── */
.sidebar-role-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 6px;
  letter-spacing: .3px;
  text-transform: uppercase;
}

/* ── Admin panel ─────────────────────────────────────────────────── */
.admin-stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.admin-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1.5rem;
  min-width: 130px;
  text-align: center;
}
.admin-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}
.admin-stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .3rem;
}
.admin-card-hint {
  margin-top: .25rem;
  color: var(--text-muted);
  font-size: .84rem;
}
.admin-empty-action {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 1rem 1.25rem 0;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font-size: .9rem;
}
.admin-empty-action i { color: var(--primary); }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.admin-table th {
  text-align: left;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.admin-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-row-inactive td { opacity: .55; }
.admin-email { color: var(--text-muted); font-size: .85rem; }
.admin-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.admin-role-select {
  padding: .3rem .5rem;
  font-size: .82rem;
  height: auto;
  max-width: 130px;
}
.admin-self-label { color: var(--text-muted); font-size: .85rem; font-style: italic; }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-error   { background: var(--danger-bg); color: var(--danger); }
.card-header   { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }

/* ── Classes (turmas) ────────────────────────────────────────────── */
.cls-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 1rem;
  overflow: hidden;
}
.cls-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.cls-card-name  { font-weight: 700; font-size: 1rem; }
.cls-card-desc  { font-size: .85rem; color: var(--text-muted); margin-top: .2rem; }
.cls-card-actions { display: flex; gap: .5rem; align-items: center; flex-shrink: 0; }
.cls-plan-section {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.cls-plan-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .75rem;
}
.cls-plan-add {
  display: flex;
  gap: .5rem;
  align-items: center;
  min-width: min(360px, 100%);
}
.cls-plan-add .form-input { min-width: 0; }
.cls-plan-list,
.cls-member-plans,
.cls-plan-check-list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.cls-member-plans { margin-top: .35rem; }
.cls-plan-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  max-width: 100%;
  padding: .25rem .5rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--plan-color, var(--primary)) 35%, transparent);
  background: color-mix(in srgb, var(--plan-color, var(--primary)) 12%, transparent);
  color: var(--text-primary);
  font-size: .78rem;
  line-height: 1.2;
}
.cls-plan-chip button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.cls-plan-chip button:hover { color: var(--danger); }
.cls-member-no-plans {
  color: var(--text-muted);
  font-size: .8rem;
}
.cls-plan-check-list {
  flex-direction: column;
  flex-wrap: nowrap;
}
.cls-plan-check {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
.cls-members    { padding: .75rem 1.25rem; display: flex; flex-direction: column; gap: .4rem; }
.cls-member {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .9rem;
  padding: .35rem .5rem;
  border-radius: 8px;
}
.cls-member:hover { background: var(--hover-bg, #f5f3f0); }
.cls-member-email { color: var(--text-muted); font-size: .8rem; margin-left: .25rem; }
.cls-member .icon-btn { margin-left: auto; }
.cls-empty-members { color: var(--text-muted); font-size: .85rem; margin: 0; padding: .25rem 0; }

/* ── Topic shared / owner badges ─────────────────────────────────── */
.sp-shared-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: 9px;
  vertical-align: middle;
  margin-left: 5px;
}
.sp-topic-owner-label {
  font-size: .78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .3rem;
  white-space: nowrap;
}

/* ── Nav notification badge ──────────────────────────────────────── */
.nav-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

/* ── Plan invites banner (student) ───────────────────────────────── */
.sp-plan-invites-banner {
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.sp-plan-invites-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sp-plan-invites-list { display: flex; flex-direction: column; gap: .6rem; }
.sp-plan-invite-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.sp-plan-invite-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.sp-plan-invite-info { flex: 1; min-width: 0; }
.sp-plan-invite-name { font-weight: 700; font-size: .95rem; }
.sp-plan-invite-desc { font-size: .82rem; color: var(--text-muted); margin-top: .15rem; }
.sp-plan-invite-from { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }
.sp-plan-invite-actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* ── Shared topics section ───────────────────────────────────────── */
.sp-shared-section { margin-top: 2rem; }
.sp-shared-section-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

/* ── Share modal sections (teacher) ──────────────────────────────── */
.sp-share-section { }
.sp-share-section-label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.sp-share-class-row {
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  padding: .6rem .75rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: .9rem;
  margin-bottom: .4rem;
  transition: background .15s;
}
.sp-share-class-row:hover { background: var(--hover-bg, #f5f3f0); }
.sp-share-class-empty { opacity: .5; cursor: default; }

/* ── Class invite cards (student) ───────────────────────────────── */
.cls-invites-section { margin-bottom: 1.5rem; }
.cls-section-title {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.cls-invite-card {
  background: var(--primary-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .9rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .6rem;
  flex-wrap: wrap;
}
.cls-invite-info { flex: 1; min-width: 0; }
.cls-invite-name { font-weight: 700; font-size: .95rem; }
.cls-invite-desc { font-size: .82rem; color: var(--text-muted); margin-top: .15rem; }
.cls-invite-from { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }
.cls-invite-actions { display: flex; gap: .4rem; align-items: center; flex-shrink: 0; }

/* ── Class member rows ───────────────────────────────────────────── */
.cls-member-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cls-member-name { font-weight: 600; font-size: .9rem; }

/* ── Classes modal ───────────────────────────────────────────────── */
.cls-modal-box { max-width: 460px; width: 100%; }
/* ── Student Performance View ────────────────────────────────────── */
.sp-act-student-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.sp-act-student-card:hover {
  border-color: var(--orange);
  box-shadow: 0 4px 16px rgba(108,116,220,0.12);
  transform: translateY(-2px);
}

/* ── Attempt Card (collapsible) ──────────────────────────────────── */
.sp-act-attempt-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: all 0.2s;
}

.sp-act-attempt-card:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow);
}

.sp-act-attempt-header {
  padding: 0.75rem 1rem;
  background: linear-gradient(to right, rgba(108,116,220,0.03), transparent);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.sp-act-attempt-header:hover {
  background: linear-gradient(to right, rgba(108,116,220,0.06), transparent);
}

.sp-act-attempt-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 500px;
  overflow-y: auto;
}

.sp-act-attempt-body.hidden {
  display: none;
}

/* ── Answer rows in attempt ──────────────────────────────────────── */
.sp-act-answer-row {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(0,0,0,0.02);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  border-left: 3px solid var(--border);
}

.sp-act-answer-row i { flex-shrink: 0; margin-top: 2px; }

/* ── FILL BLANK: Input integrado na frase ────────────────────────────── */
.sp-act-fillblank-card {
  background: var(--surface);
  border: 2px solid var(--border);
}

.sp-act-fillblank-statement {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 1.25rem;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 15px;
  line-height: 1.8;
  word-spacing: 0.1em;
}

.sp-act-fillblank-statement span {
  display: inline;
}

.sp-act-fillblank-input {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  height: 36px;
  padding: 0 10px;
  border: 2px solid var(--orange);
  border-radius: 4px;
  background: var(--primary-pale);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
  transition: all 0.2s ease;
  outline: none;
  box-sizing: border-box;
}

.sp-act-fillblank-input:focus {
  border-color: var(--orange);
  background: linear-gradient(135deg, var(--orange-pale) 0%, var(--orange-light) 100%);
  box-shadow: 0 0 0 3px rgba(108,116,220,0.15);
  transform: scale(1.05);
}

.sp-act-fillblank-input::placeholder {
  color: rgba(108,116,220,0.5);
  font-weight: 400;
}

/* ── Question text ───────────────────────────────────────────────────── */
.sp-act-question-text {
  font-size: 15px;
  line-height: 1.8;
  padding: 1rem;
  background: rgba(108,116,220,0.03);
  border-left: 4px solid var(--orange);
  border-radius: 4px;
  color: var(--text-primary);
}

/* ── Multiple Choice: Botões modernos ─────────────────────────────────── */
.sp-act-alts {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

.sp-act-alt-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1rem;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.sp-act-alt-btn:hover {
  border-color: var(--primary);
  background: var(--primary-pale);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(108,116,220,0.15);
}

.sp-act-alt-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 2px 12px rgba(108,116,220,0.2);
  transform: translateX(4px);
}

.sp-act-alt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-mid) 100%);
  border-radius: 4px;
  color: white;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

/* ── True/False: Botões lado a lado ──────────────────────────────────── */
.sp-act-truefalse-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.sp-act-truefalse-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  min-height: 100px;
}

.sp-act-truefalse-btn i {
  font-size: 24px;
}

.sp-act-truefalse-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sp-act-truefalse-btn.selected {
  border-color: var(--orange);
  background: var(--primary-pale);
  box-shadow: 0 4px 16px rgba(108,116,220,0.15);
}

.sp-act-truefalse-true.selected i {
  color: var(--success);
}

.sp-act-truefalse-false.selected i {
  color: var(--danger);
}

/* ── Result feedback cards ───────────────────────────────────────────── */
.sp-act-result-correct {
  padding: 1rem;
  background: var(--success-bg);
  border: 2px solid var(--success);
  border-radius: 8px;
}

.sp-act-result-wrong {
  padding: 1rem;
  background: var(--danger-bg);
  border: 2px solid var(--danger);
  border-radius: 8px;
}

.sp-act-result-icon {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Player improvements ─────────────────────────────────────────────── */
.sp-act-player-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.sp-act-player-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 0.75rem;
  background: var(--orange-pale);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.sp-act-player-type i {
  font-size: 13px;
}

.sp-act-fillblank-card .sp-act-player-type {
  background: var(--orange-pale);
  color: var(--orange);
}

/* ── Exercise Group Cards ────────────────────────────────────────── */
.sp-act-exercise-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
}

.sp-act-exercise-group:hover {
  border-color: var(--orange);
  box-shadow: 0 2px 8px rgba(108,116,220,0.12);
}

.sp-act-exercise-header {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  user-select: none;
  transition: all 0.2s ease;
}

.sp-act-exercise-header:hover {
  background: var(--primary-pale);
}

.sp-act-exercise-header i:last-child {
  transition: transform 0.2s ease;
}

.sp-act-exercise-group .sp-act-exercise-body.hidden ~ .sp-act-exercise-header i:last-child {
  transform: rotate(-90deg);
}

.sp-act-exercise-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: slideDown 0.2s ease;
}

.sp-act-exercise-body.hidden {
  display: none;
}

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

/* ── Question Items ──────────────────────────────────────────────── */
.sp-act-question-item {
  padding: 0.875rem;
  background: rgba(232, 88, 26, 0.03);
  border: 1px solid rgba(232, 88, 26, 0.1);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.sp-act-question-item:hover {
  background: rgba(232, 88, 26, 0.06);
  border-color: rgba(232, 88, 26, 0.2);
}

/* ── Fill Blank Preview ──────────────────────────────────────────┐ */
.sp-act-blank-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  height: 32px;
  padding: 0 8px;
  background: linear-gradient(135deg, var(--orange-pale) 0%, var(--orange-light) 100%);
  border: 2px dashed var(--orange);
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.sp-act-blank-preview::after {
  content: '→ clique para preencher';
  position: absolute;
  top: -20px;
  left: 0;
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.sp-act-blank-preview:hover {
  background: var(--orange-light);
  border-color: var(--orange);
  transform: scale(1.05);
}

/* ── Exercise Hint ───────────────────────────────────────────────── */
.sp-exercise-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  background: rgba(42, 125, 79, 0.06);
  border: 1px solid rgba(42, 125, 79, 0.15);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-primary);
  margin-top: 0.5rem;
}

.sp-exercise-hint i {
  color: var(--success);
  flex-shrink: 0;
  font-size: 13px;
}

/* ── Activities: toolbar & type badge ────────────────────────────── */
.sp-acts-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.sp-act-type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(232, 88, 26, 0.12);
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ── Activities: student view preview ────────────────────────────── */
.sp-acts-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.sp-act-preview-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-primary);
}

/* ── Activities: activity item (teacher list) ────────────────────── */
.sp-act-item {
  padding: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.625rem;
  transition: border-color 0.15s;
}

.sp-act-item:hover {
  border-color: var(--orange);
}

/* ── Activities: player container ────────────────────────────────── */
.sp-act-player {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 0 2rem;
}

.sp-act-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.sp-act-player-progress-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.sp-act-player-statement {
  font-size: 17px;
  line-height: 1.7;
  font-weight: 500;
  color: var(--text-primary);
  margin: 1.25rem 0 1.5rem;
  word-break: break-word;
}

.sp-act-blank {
  display: inline-block;
  padding: 1px 10px;
  border-bottom: 2px solid var(--orange);
  color: var(--orange);
  font-weight: 700;
  letter-spacing: 2px;
}

/* ── Activities: result feedback ─────────────────────────────────── */
.sp-act-player-result {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin: 1rem 0;
}

.sp-act-result-correct {
  background: rgba(0, 212, 170, 0.08);
  border: 1.5px solid var(--success);
}

.sp-act-result-wrong {
  background: rgba(255, 80, 80, 0.07);
  border: 1.5px solid var(--danger);
}

.sp-act-result-icon {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 17px;
  font-weight: 700;
}

.sp-act-explanation {
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(232, 88, 26, 0.07);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--orange);
  font-size: 13px;
  color: var(--text-primary);
}

/* ── Activities: results screen ──────────────────────────────────── */
.sp-act-results {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  padding: 1.5rem 0 2rem;
}

.sp-act-results-icon {
  font-size: 52px;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.sp-act-results-score {
  font-size: 52px;
  font-weight: 800;
  line-height: 1;
  margin: 0.25rem 0;
  letter-spacing: -0.02em;
}

.sp-act-results-detail {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.sp-act-results-breakdown {
  text-align: left;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* ── Student Exercise Stat Cards ─────────────────────────────────── */
.sp-exercise-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.sp-exercise-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sp-exercise-stat-card:hover {
  border-color: var(--orange);
  box-shadow: 0 2px 8px rgba(108,116,220,0.1);
}

.sp-exercise-stat-header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
}

.sp-exercise-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--orange-pale) 0%, var(--orange-light) 100%);
  color: var(--orange);
}

.sp-exercise-stat-info {
  flex: 1;
  min-width: 0;
}

.sp-exercise-stat-name {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.sp-exercise-stat-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sp-ex-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.sp-ex-status-not-started {
  background: rgba(0,0,0,0.06);
  color: var(--muted);
}

.sp-ex-status-in-progress {
  background: var(--warning-bg);
  color: var(--warning);
}

.sp-ex-status-completed {
  background: rgba(16,185,129,0.12);
  color: var(--success);
}

.sp-exercise-stat-scores {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  text-align: right;
}

.sp-exercise-stat-score-val {
  font-weight: 800;
  font-size: 20px;
  line-height: 1;
}

.sp-exercise-stat-actions {
  display: flex;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding: 0.625rem 1rem;
  background: rgba(0,0,0,0.015);
}

.sp-exercise-stat-history {
  padding: 0 1rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.sp-exercise-stat-history.hidden {
  display: none;
}

.sp-ex-attempt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.625rem;
  background: rgba(108,116,220,0.03);
  border: 1px solid rgba(108,116,220,0.08);
  border-radius: var(--radius-sm);
  font-size: 12px;
  gap: 8px;
}

/* ── Edit Question Card ──────────────────────────────────────────── */
.sp-edit-question-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem;
  margin-bottom: 0.625rem;
  transition: border-color 0.15s;
}

.sp-edit-question-card:hover {
  border-color: var(--orange);
}

.sp-edit-question-card .form-group {
  margin-bottom: 0.625rem;
}

.sp-edit-question-card .form-group:last-child {
  margin-bottom: 0;
}

.sp-edit-deleted-q {
  opacity: 0.45;
  border: 1px dashed var(--danger);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
  background: rgba(220, 53, 69, 0.04);
}

/* ── Utility ─────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Tiptap note editor ──────────────────────────────────────────── */
.sp-notes-list { display: flex; flex-direction: column; gap: 12px; }

.sp-note-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.sp-tb-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-primary);
  line-height: 1.5;
  min-width: 28px;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.sp-tb-btn:hover { background: var(--primary-pale); border-color: var(--border); }
.sp-tb-btn.is-active { background: var(--primary-pale); border-color: var(--primary); color: var(--primary); }
.sp-tb-sep {
  display: inline-block;
  width: 1px;
  background: var(--border);
  margin: 3px 4px;
  align-self: stretch;
}

/* Editor container — visible click target */
.sp-note-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  cursor: text;
  background: var(--surface-2);
  transition: border-color 0.15s;
}
.sp-note-editor:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(108,116,220,0.1);
}

/* ProseMirror editor area */
.sp-note-editor .ProseMirror {
  outline: none;
  padding: 6px 4px;
  min-height: 72px;
  line-height: 1.7;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  word-break: break-word;
}
.sp-note-editor .ProseMirror.ProseMirror-focused { outline: none; }
.sp-note-editor .ProseMirror > *:first-child { margin-top: 0; }
.sp-note-editor .ProseMirror > *:last-child { margin-bottom: 0; }
.sp-note-editor .ProseMirror p { margin: 0 0 0.45em; }

.sp-note-editor .ProseMirror h1 { font-size: 1.35em; font-weight: 700; margin: 0.8em 0 0.3em; font-family: inherit; color: var(--text-primary); }
.sp-note-editor .ProseMirror h2 { font-size: 1.15em; font-weight: 700; margin: 0.7em 0 0.3em; font-family: inherit; color: var(--text-primary); }
.sp-note-editor .ProseMirror h3 { font-size: 1em; font-weight: 500; margin: 0.6em 0 0.25em; font-family: inherit; color: var(--text-primary); }

.sp-note-editor .ProseMirror ul,
.sp-note-editor .ProseMirror ol { padding-left: 1.5em; margin: 0.3em 0; }
.sp-note-editor .ProseMirror li { margin: 0.15em 0; }
.sp-note-editor .ProseMirror li p { margin: 0; }

.sp-note-editor .ProseMirror blockquote {
  border-left: 3px solid var(--primary);
  margin: 0.5em 0;
  padding: 4px 12px;
  color: var(--muted);
  font-style: italic;
}

.sp-note-editor .ProseMirror code {
  background: rgba(108,116,220,0.12);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 0.87em;
  font-family: monospace;
  color: var(--primary);
}
.sp-note-editor .ProseMirror pre {
  background: var(--sidebar-bg);
  color: var(--text-secondary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0.5em 0;
}
.sp-note-editor .ProseMirror pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 13px;
}

.sp-note-editor .ProseMirror a { color: var(--primary); text-decoration: underline; }
.sp-note-editor .ProseMirror a:hover { color: var(--primary-hover); }

.sp-note-editor .ProseMirror table { border-collapse: collapse; width: 100%; margin: 0.5em 0; overflow: hidden; border-radius: 4px; }
.sp-note-editor .ProseMirror th,
.sp-note-editor .ProseMirror td { border: 1px solid var(--border); padding: 5px 9px; font-size: 13px; position: relative; }
.sp-note-editor .ProseMirror th { background: var(--primary-pale); font-weight: 700; text-align: left; }
.sp-note-editor .ProseMirror .selectedCell::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(108,116,220,0.08);
  pointer-events: none;
}
.sp-note-editor .ProseMirror .column-resize-handle {
  position: absolute;
  right: -2px;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
  cursor: col-resize;
}

/* Placeholder text */
.sp-note-editor .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--muted);
  pointer-events: none;
  height: 0;
}

/* Note footer (save/cancel actions + status) */
.sp-note-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
  gap: 8px;
}
.sp-note-actions { display: flex; align-items: center; gap: 6px; }
.sp-note-status { font-size: 12px; color: var(--muted); font-style: italic; min-height: 16px; }
.sp-note-status--ok { color: var(--success); font-style: normal; font-weight: 600; }
.sp-note-status--err { color: var(--danger); font-style: normal; }

/* Readonly note content (shared topics) */
.sp-note-body .sp-note-content { font-size: 14px; line-height: 1.7; font-family: inherit; color: var(--text-primary); word-break: break-word; }
.sp-note-body .sp-note-content > *:first-child { margin-top: 0; }
.sp-note-body .sp-note-content > *:last-child { margin-bottom: 0; }
.sp-note-body .sp-note-content p { margin: 0 0 0.45em; }
.sp-note-body .sp-note-content h1 { font-size: 1.35em; font-weight: 700; margin: 0.8em 0 0.3em; font-family: inherit; }
.sp-note-body .sp-note-content h2 { font-size: 1.15em; font-weight: 700; margin: 0.7em 0 0.3em; font-family: inherit; }
.sp-note-body .sp-note-content h3 { font-size: 1em; font-weight: 500; margin: 0.6em 0 0.25em; font-family: inherit; }
.sp-note-body .sp-note-content ul,
.sp-note-body .sp-note-content ol { padding-left: 1.5em; margin: 0.3em 0; }
.sp-note-body .sp-note-content li { margin: 0.15em 0; }
.sp-note-body .sp-note-content blockquote { border-left: 3px solid var(--primary); margin: 0.5em 0; padding: 4px 12px; color: var(--muted); font-style: italic; }
.sp-note-body .sp-note-content code { background: var(--primary-pale); border-radius: 3px; padding: 1px 4px; font-size: 0.87em; font-family: monospace; color: var(--primary); }
.sp-note-body .sp-note-content pre { background: var(--sidebar-bg); color: var(--text-secondary); padding: 10px 14px; border-radius: var(--radius-sm); overflow-x: auto; margin: 0.5em 0; }
.sp-note-body .sp-note-content pre code { background: none; color: inherit; padding: 0; font-size: 13px; }
.sp-note-body .sp-note-content a { color: var(--primary); text-decoration: underline; }
.sp-note-body .sp-note-content table { border-collapse: collapse; width: 100%; margin: 0.5em 0; }
.sp-note-body .sp-note-content th,
.sp-note-body .sp-note-content td { border: 1px solid var(--border); padding: 5px 9px; font-size: 13px; }
.sp-note-body .sp-note-content th { background: var(--primary-pale); font-weight: 700; text-align: left; }

/* Wide modal for note creation */
.sp-modal--wide { max-width: 680px !important; }

/* ── Study Plan Hub ──────────────────────────────────────────────────────── */
.sp-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 1.5rem; }
.sp-hub-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 1.125rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  position: relative;
}
.sp-hub-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.sp-hub-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sp-hub-card--active { border-color: var(--primary); background: var(--primary-pale); }
.sp-hub-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.sp-hub-card--active .sp-hub-card-icon { background: var(--primary); color: #fff; }
.sp-hub-card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.sp-hub-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; flex: 1; }
.sp-hub-card-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
}
.sp-hub-card-badge--ok { background: var(--success-bg); color: var(--success); }
.sp-hub-content { margin-top: 0; }

/* ── Study Plan — Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Hub: 2 colunas no tablet */
  .sp-hub { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* Practice CTA */
  .sp-practice { padding: 0.875rem 1rem; gap: 0.75rem; }
  .sp-practice-arrow { display: none; }

  /* Flashcard: largura total */
  .sp-fc-session-wrap { max-width: 100%; }
  .sp-fc-stage { max-width: 100%; }

  /* Modal: padding menor */
  .sp-modal { padding: 20px 18px; }
}

@media (max-width: 480px) {
  /* ── Overflow global ── */
  .page { overflow-x: hidden; }

  /* ── Hub: 2 colunas compactas ── */
  .sp-hub { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 1.25rem; }
  .sp-hub-card { padding: 0.75rem; gap: 6px; }
  .sp-hub-card-icon { width: 30px; height: 30px; font-size: 13px; }
  .sp-hub-card-title { font-size: 13px; }
  .sp-hub-card-desc { display: none; }
  .sp-hub-card-badge { font-size: 10px; padding: 2px 6px; }

  /* ── Topic header ── */
  .sp-thdr { gap: 8px; margin-bottom: 0.875rem; flex-wrap: wrap; }
  .sp-thdr-emoji { font-size: 22px; }
  .sp-thdr-name { font-size: 15px; }
  .sp-thdr-meta { font-size: 12px; }

  /* ── Practice CTA ── */
  .sp-practice { padding: 0.75rem; gap: 0.625rem; margin-bottom: 1.125rem; }
  .sp-practice-icon { width: 34px; height: 34px; font-size: 14px; }
  .sp-practice-title { font-size: 13px; }
  .sp-practice-desc { display: none; }

  /* ── Pills ── */
  .sp-pills { margin-bottom: 1.125rem; }
  .sp-pill { padding: 6px 10px; font-size: 12px; }

  /* ── Words toolbar: vertical stack ── */
  .sp-words-toolbar { flex-direction: column; align-items: stretch; }
  .sp-words-actions { justify-content: flex-start; flex-wrap: wrap; }
  .sp-words-search-wrap { min-width: 0; width: 100%; }
  .sp-words-filters-row { gap: 8px; }
  .sp-words-filter-group { flex-wrap: wrap; gap: 4px; }

  /* ── Item cards: text wrap ── */
  .sp-item-top { flex-wrap: wrap; gap: 8px; }
  .sp-item-text { min-width: 0; width: 100%; }
  .sp-item-actions { width: 100%; justify-content: flex-end; }
  .sp-item-pt { word-break: break-word; }

  /* ── Flashcard session ── */
  .sp-fc-inner { height: 200px; }
  .sp-fc-face { padding: 14px; }
  .sp-fc-face-word { font-size: 24px; }
  .sp-fc-face-translation { font-size: 20px; }
  .sp-fc-nav-btn { width: 40px; height: 40px; }
  .sp-fc-flip-btn { height: 40px; font-size: 13px; }
  .sp-fc-kbd-hint { display: none; }
  .sp-fc-action-btn { padding: 10px 4px; font-size: 10px; }
  .sp-fc-action-btn i { font-size: 15px; }

  /* ── Flashcard summary ── */
  .sp-fc-stat { padding: 12px 16px; min-width: 0; flex: 1; }
  .sp-fc-stat-num { font-size: 24px; }

  /* ── Rating buttons ── */
  .sp-fc-rating-btn { padding: 6px 2px; min-width: 0; }
  .sp-fc-rating-label { font-size: 11px; }
  .sp-fc-rating-interval { font-size: 9px; }

  /* ── Shadowing ── */
  .sp-fc-shadow-step-label { min-width: 0; }

  /* ── Modal: drawer bottom ── */
  .sp-modal-overlay { padding: 0; align-items: flex-end; }
  .sp-modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; padding: 20px 16px 28px; }
  .sp-modal--wide { max-width: 100% !important; }

  /* ── Empty state ── */
  .sp-detail-empty { padding: 2.5rem 1rem; min-height: 160px; }
  .sp-detail-empty i { font-size: 24px; }

  /* ── Plan invites banner ── */
  .sp-plan-invite-card { flex-wrap: wrap; gap: 8px; }
  .sp-plan-invite-actions { width: 100%; justify-content: flex-end; }
}

/* ── Flashcard Focus Mode Overlay ───────────────────────────────────────── */
.sp-fc-focus-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  justify-content: center;
  padding: 1.5rem 1.25rem 3rem;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}
.sp-fc-focus-overlay--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.sp-fc-focus-overlay #sp-fc-session {
  width: 100%;
  max-width: 560px;
  padding-top: 0.25rem;
}
@media (max-width: 480px) {
  .sp-fc-focus-overlay { padding: 0.75rem 0.75rem 2rem; }
}
