/* ══════════════════════════════════════════════
   Кабинет репетитора — Modern Design System
   ══════════════════════════════════════════════ */

/* ─── CSS Variables ──────────────────────────── */
:root {
  color-scheme: dark;
  --bg-primary: #101816;
  --bg-card: #172320;
  --bg-input: #111c19;
  --bg-hover: #233831;
  --border: #31463e;
  --border-active: #507568;
  --text-primary: #edf7f2;
  --text-secondary: #c0d4ca;
  --text-muted: #a4bdb1;
  --accent: #83d7b8;
  --accent-bright: #a4e7cf;
  --accent-dim: #59bc9c;
  --on-accent: #0e2a20;
  --accent-glow: #83d7b835;
  --success: #a3ddaa;
  --success-bg: #263f32;
  --danger: #ffc1cd;
  --danger-bg: #482b36;
  --warning: #f8d99a;
  --warning-bg: #413622;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Shadows */
  --shadow-card: 0 3px 12px #00000026;
  --shadow-button: 0 3px 8px #00000030;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.25s;

  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text-primary);
}

/* ─── Reset & Base ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* ─── Typography ─────────────────────────────── */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }

.text-muted { color: var(--text-secondary); }
.text-small { font-size: 0.8rem; color: var(--text-muted); }

/* ─── Card ─────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.card:hover {
  border-color: var(--border-active);
}

/* ─── Buttons ────────────────────────────────── */
button, .btn {
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: var(--on-accent);
  box-shadow: var(--shadow-button);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px #00000050;
  filter: brightness(1.1);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-button);
}

.btn-secondary {
  background: rgba(131, 215, 184, 0.1);
  color: var(--accent-bright);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: rgba(131, 215, 184, 0.18);
  border-color: var(--border-active);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.btn-danger:hover {
  background: #57333f;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(131, 215, 184, 0.1);
  color: var(--accent-bright);
  font-size: 1.1rem;
}
.btn-icon:hover {
  background: rgba(131, 215, 184, 0.2);
}

/* ─── Inputs ─────────────────────────────────── */
input, textarea, select {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  width: 100%;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b97b8'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
textarea { resize: vertical; min-height: 80px; }

/* ─── Forms ──────────────────────────────────── */
form { display: flex; flex-direction: column; gap: 14px; }

/* ─── Auth Screen ────────────────────────────── */
.auth-wrapper {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 5vw, 72px);
  background: radial-gradient(ellipse at top right, #1d362e, transparent 55%);
}

.auth-layout {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  width: min(100%, 1030px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  box-shadow: 0 18px 55px #00000048;
  overflow: hidden;
}

.auth-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 44px;
  padding: clamp(28px, 4.6vw, 64px);
  color: #e3f5ed;
  background:
    radial-gradient(ellipse at 100% 100%, #2b624f 0%, transparent 55%),
    repeating-linear-gradient(135deg, #ffffff0a 0 1px, transparent 1px 26px),
    #123e34;
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--accent);
  color: var(--on-accent);
}
.auth-intro .brand-mark { color: #174f40; background: #d8f1df; }

.eyebrow {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  line-height: 1.4;
}
.auth-intro .eyebrow { color: #bce6cf; }
.auth-intro h2 {
  margin: 12px 0 18px;
  color: #fff;
  font-size: clamp(2rem, 4vw, 3.35rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}
.auth-intro-copy > p:last-child { max-width: 32ch; line-height: 1.6; }
.auth-features { display: flex; flex-wrap: wrap; gap: 10px; }
.auth-features span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #ffffff40;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 0.83rem;
}

.auth-card {
  align-self: center;
  border: 0;
  box-shadow: none;
  padding: clamp(28px, 4.4vw, 60px);
}
.auth-card h1 { margin: 8px 0; font-size: clamp(1.6rem, 2.8vw, 2.2rem); }
.auth-subtitle { color: var(--text-secondary); margin-bottom: 24px; line-height: 1.5; }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 22px;
  background: var(--bg-primary);
  border-radius: 10px;
}
.auth-tab { background: transparent; color: var(--text-secondary); padding-inline: 6px; }
.auth-tab.active { color: var(--accent); background: var(--bg-hover); box-shadow: var(--shadow-card); }
.auth-form > .btn-primary { width: 100%; }
.auth-footnote { color: var(--text-secondary); font-size: 0.86rem; line-height: 1.5; margin-top: 16px; }
.tutor-code { color: var(--text-secondary); font-size: 0.875rem; }
.tutor-code summary { cursor: pointer; }
.tutor-code .field { margin-top: 10px; }
.field { display: grid; gap: 6px; font-size: 0.875rem; font-weight: 650; min-width: 0; }
.form-error { color: var(--danger); font-size: 0.875rem; line-height: 1.4; }
.form-error:empty { display: none; }

/* ─── Dashboard Layout ───────────────────────── */
.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px 24px 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar h1 { font-size: 1.25rem; margin-top: 3px; }
.topbar-user { min-width: 0; }

.dashboard-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(20px, 4vw, 40px);
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse at 100% 100%, #29483d, transparent 70%),
    #1b3029;
}
.dashboard-intro h2 { font-size: clamp(1.75rem, 3.8vw, 2.75rem); margin: 6px 0 8px; }
.dashboard-intro p:not(.eyebrow) { color: var(--text-secondary); line-height: 1.45; }
.dashboard-intro button { flex-shrink: 0; }
.section-help { margin-top: 6px; color: var(--text-secondary); line-height: 1.5; font-size: 0.9rem; }
.schedule-card { margin-bottom: 20px; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(131, 215, 184, 0.08);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--on-accent);
}

/* ─── Tabs ───────────────────────────────────── */
.tab-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: rgba(131, 215, 184, 0.04);
  border-radius: var(--radius-md);
  padding: 5px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}
.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(131, 215, 184, 0.08);
}
.tab-btn.active {
  background: var(--bg-hover);
  color: var(--accent);
}

.tab-panel { display: none; animation: fadeInUp 0.3s var(--ease) both; }
.tab-panel.active { display: block; }

/* ─── Stats Cards ────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  transition: transform var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-active);
}

.stat-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 8px;
  border-radius: 9px;
  background: var(--bg-hover);
  color: var(--accent);
}
.stat-value { font-size: 1.7rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Grid Layout ────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 20px;
}
.grid-wide { grid-column: 1 / -1; }

/* ─── Items ──────────────────────────────────── */
.item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease);
}
.item:hover {
  border-color: var(--border-active);
  background: rgba(131, 215, 184, 0.04);
}

.item:has(.board-booking-actions) { flex-wrap: wrap; }
.board-booking-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.board-booking-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 8px;
  text-decoration: none;
  font-size: .85rem;
  white-space: nowrap;
}

.item-info { flex: 1; min-width: 0; }
.item-title { overflow-wrap: anywhere; font-weight: 650; font-size: 0.95rem; }
.item-sub { overflow-wrap: anywhere; font-size: 0.8rem; color: var(--text-secondary); margin-top: 3px; }

/* ─── Badge ──────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-accent {
  background: rgba(131, 215, 184, 0.15);
  color: var(--accent-bright);
}
.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);
}

/* ─── Empty state ────────────────────────────── */
.empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}
.empty-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ─── Calendar ───────────────────────────────── */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.calendar-title {
  font-weight: 600;
  font-size: 1rem;
  text-transform: capitalize;
  color: var(--text-primary);
}

.calendar-nav {
  display: flex;
  gap: 6px;
}

.week-grid {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(105px, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  max-height: min(550px, 65vh);
  overflow: auto;
}

.cal-corner, .cal-day-head { position: sticky; top: 0; z-index: 4; }

.cal-corner {
  grid-area: 1 / 1;
  min-height: 54px;
  border-bottom: 1px solid var(--border);
  background: #1c2c27;
}

.cal-day-head {
  min-height: 54px;
  padding: 8px;
  text-align: center;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: capitalize;
  background: #1c2c27;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.cal-day-head b {
  display: block;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 2px;
}
.cal-day-head.today {
  background: #274138;
}
.cal-day-head.today b {
  color: var(--accent-bright);
}

.cal-time {
  min-height: 0;
  overflow: hidden;
  padding: 2px 8px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  border-bottom: 1px solid rgba(131, 215, 184, 0.06);
  display: flex;
  align-items: flex-start;
}

.cal-cell {
  min-height: 0;
  border-radius: 0;
  border: none;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid rgba(131, 215, 184, 0.06);
  background: transparent;
  position: relative;
  cursor: pointer;
  transition: background var(--duration) var(--ease);
  padding: 0;
  color: inherit;
  font: inherit;
}
.cal-cell:not(.static):hover {
  background: var(--bg-hover);
}

.cal-slot {
  position: absolute;
  z-index: 2;
  inset: 3px;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 500;
  text-align: left;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
  overflow: hidden;
}

.slot-label, .slot-course { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.slot-course { font-size: 0.72rem; }
.cal-booking {
  position: relative;
  z-index: 3;
  min-width: 0;
}
.cal-booking .cal-slot { padding: 2px 6px; gap: 1px; line-height: 1; }
.cal-booking .cal-slot > span { flex-shrink: 0; }
.cal-booking .slot-label { font-weight: 700; }
.cal-cell.compact .cal-slot { justify-content: center; padding: 0 4px; }
.cal-cell.compact .slot-label { display: none; }
.calendar-agenda { display: none; }

.slot-time {
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.9;
}

.cal-slot.free {
  background: #224438;
  color: #b9eed9;
  box-shadow: none;
}
.cal-slot.free:hover {
  background: #2b5445;
}

.cal-slot.booked {
  background: #2c374c;
  color: #d4e0fa;
}

.cal-slot.my-booking {
  background: var(--accent);
  color: var(--on-accent);
}

.cal-slot.overlap {
  background: var(--warning-bg);
  color: var(--warning);
}

.cal-cell.static { cursor: default; }
.cal-cell:has(.cal-slot) { z-index: 3; }

.legend {
  display: flex;
  gap: 18px;
  margin: 14px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.legend-dot.free { background: #85c4a9; }
.legend-dot.booked { background: #91a6d4; }
.legend-dot.mine { background: var(--accent); }
.legend-dot.overlap { background: var(--warning); }

/* ─── Bulk Slot Form ─────────────────────────── */
.bulk-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}
.bulk-form .full-width { grid-column: 1 / -1; }

.weekday-picker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.weekday-picker label {
  position: relative;
  min-width: 0;
}

.weekday-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.weekday-picker span {
  display: flex;
  justify-content: center;
  padding: 9px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(131, 215, 184, 0.06);
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.weekday-picker input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 4px 14px rgba(131, 215, 184, 0.25);
}

.bulk-preview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px dashed var(--border-active);
  border-radius: var(--radius-sm);
  background: #22342b;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.bulk-preview b {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success);
  font-weight: 600;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ─── Course & Student Lists ─────────────────── */
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin: 6px 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.check-row:hover {
  border-color: var(--border-active);
  background: rgba(131, 215, 184, 0.06);
}
.check-row input:is([type="checkbox"], [type="radio"]) {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.bulk-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 14px 0;
}

/* ─── Divider ────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ─── Separator Label ────────────────────────── */
.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Modal ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  padding: 24px;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  pointer-events: none;
}
.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s var(--ease);
}
.modal-overlay.visible .modal-card {
  transform: scale(1) translateY(0);
}

.modal-icon { font-size: 2.5rem; margin-bottom: 12px; }
.modal-card h3 { margin-bottom: 8px; }
.modal-card p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 24px; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.modal-actions button {
  min-width: 100px;
  justify-content: center;
}

/* ─── Toast ──────────────────────────────────── */
#toasts {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  font-size: 0.9rem;
  pointer-events: auto;
  animation: toastIn 0.35s var(--ease) both;
  max-width: 360px;
}
.toast.removing {
  animation: toastOut 0.3s var(--ease) both;
}

.toast-icon { font-size: 1.2rem; flex-shrink: 0; }

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(40px) scale(0.95); }
}

/* ─── Loading Skeleton ───────────────────────── */
.skeleton {
  background: linear-gradient(90deg, rgba(131, 215, 184, 0.05) 25%, rgba(131, 215, 184, 0.1) 50%, rgba(131, 215, 184, 0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 16px; margin: 8px 0; }
.skeleton-card { height: 120px; margin: 10px 0; }

/* ─── Spinner ────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent-glow);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Animations ─────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in { animation: fadeIn 0.3s var(--ease) both; }
.fade-in-up { animation: fadeInUp 0.4s var(--ease) both; }

/* staggered children */
.stagger > *:nth-child(1) { animation-delay: 0s; }
.stagger > *:nth-child(2) { animation-delay: 0.05s; }
.stagger > *:nth-child(3) { animation-delay: 0.1s; }
.stagger > *:nth-child(4) { animation-delay: 0.15s; }
.stagger > *:nth-child(5) { animation-delay: 0.2s; }

/* ─── Search ─────────────────────────────────── */
.search-box { max-width: 380px; margin: 16px 0; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.section-heading h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.student-item { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(140px, 1.3fr) auto; }
.student-person, .student-courses { display: flex; align-items: center; gap: 8px; min-width: 0; }
.student-courses { flex-wrap: wrap; }
.student-courses .badge { overflow-wrap: anywhere; }
.remove-assignment-form { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; }

.form-dialog {
  width: min(520px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 24px 80px #00000065;
}
.form-dialog::backdrop { background: #080f0cd0; }
.form-dialog form { margin-top: 18px; }
.booking-time { margin-top: 8px; color: var(--text-secondary); text-transform: capitalize; }
.course-picker { min-width: 0; border: 0; font-size: 0.875rem; }
.course-picker legend { font-weight: 650; }
.course-options { max-height: 180px; overflow-y: auto; padding: 4px; }
.course-options span { overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.weekday-picker input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
  .dashboard { padding: 14px 16px 32px; }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .topbar-user { width: 100%; justify-content: space-between; }

  .grid { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .bulk-form { grid-template-columns: 1fr; }
  .bulk-columns { grid-template-columns: 1fr; }
  .weekday-picker { grid-template-columns: repeat(4, 1fr); }

  .tab-nav { gap: 2px; padding: 3px; }
  .tab-btn { padding: 8px 14px; font-size: 0.82rem; }

  .week-grid { display: none; }
  .calendar-agenda { display: grid; gap: 14px; }
  .agenda-day { display: grid; gap: 6px; min-width: 0; }
  .agenda-day h3 { text-transform: capitalize; font-size: 0.9rem; }
  .agenda-day button { padding: 0; background: transparent; min-width: 0; }
  .agenda-day .slot-label, .agenda-day .slot-course { white-space: normal; overflow-wrap: anywhere; }
  .agenda-day .cal-slot {
    position: static;
    width: 100%;
    padding: 9px 12px;
    min-height: 44px;
    font-size: 0.85rem;
  }

  .card { padding: 20px; }

  .auth-layout { grid-template-columns: 1fr; }
  .auth-intro { padding: 22px 24px; gap: 22px; }
  .auth-intro h2 { font-size: clamp(1.55rem, 6vw, 2rem); margin: 7px 0; }
  .auth-features { display: none; }
  .auth-card { padding: 24px; }
  .dashboard-intro { align-items: flex-start; flex-direction: column; gap: 14px; }
  .student-item { grid-template-columns: minmax(0, 1fr) auto; }
  .student-courses { grid-column: 1 / -1; grid-row: 2; }
  .remove-assignment-form { grid-template-columns: minmax(0, 1fr); }

  .modal-card { padding: 24px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.4rem; }

  h1 { font-size: 1.4rem; }
  .section-heading { flex-wrap: wrap; }
  .student-item { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .student-person { max-width: 100%; }
  .calendar-header { gap: 6px; }
  .calendar-title { font-size: 0.82rem; }
  .today-button { padding-inline: 6px; font-size: 0.75rem; }
  .tab-btn { gap: 4px; padding-inline: 8px; }
  .tab-btn svg { width: 16px; }
  #toasts { inset-inline: 12px; align-items: flex-end; }
}

/* ─── Scrollbar ──────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(131, 215, 184, 0.2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(131, 215, 184, 0.35); }

/* ─── Selection ──────────────────────────────── */
::selection {
  background: rgba(131, 215, 184, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
