/* ============================================================
     Weekend School V1 — Editorial Warm Design System
     Display: Fraunces (modern serif)
     Body:    DM Sans
     ============================================================ */

  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--cream);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    text-rendering: optimizeLegibility;
  }
  button { font-family: inherit; cursor: pointer; }
  input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
  a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
  a:hover { color: var(--accent-dark); }
  h1, h2, h3, h4, h5, h6 { margin: 0; font-family: var(--font-display); font-weight: 500; letter-spacing: -0.015em; line-height: 1.15; color: var(--ink); }

  /* ---------- Design Tokens ---------- */
  :root {
    --font-display: 'Fraunces', 'Georgia', serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Warm neutrals */
    --cream: #FDF8F3;
    --cream-deep: #F5EDE2;
    --surface: #FFFFFF;
    --surface-warm: #FBF4EB;
    --border: #ECE0D0;
    --border-strong: #DCC9B0;

    /* Ink (text) */
    --ink: #1A1614;
    --ink-medium: #4A3F36;
    --ink-muted: #8B7A6B;
    --ink-soft: #B0A294;

    /* Accents */
    --accent: #D9594C;             /* terracotta */
    --accent-dark: #B8483D;
    --accent-light: #FCEBE7;
    --accent-glow: rgba(217, 89, 76, 0.18);

    --teal: #2C5F5D;               /* deep teal — cool contrast */
    --teal-dark: #1F4847;
    --teal-light: #DAE9E8;

    --gold: #C99B45;               /* warm amber for warnings */
    --gold-light: #FBF1DB;

    --leaf: #5B8C5A;               /* warm green for success */
    --leaf-light: #DCEBDA;

    --rose: #C44545;               /* warm red for danger */
    --rose-light: #FBE0E0;

    /* Radii */
    --r-xs: 4px;
    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 22px;
    --r-xl: 32px;

    /* Shadows — warm, layered */
    --sh-1: 0 1px 2px rgba(46, 26, 16, 0.04), 0 1px 1px rgba(46, 26, 16, 0.06);
    --sh-2: 0 2px 4px rgba(46, 26, 16, 0.04), 0 4px 12px rgba(46, 26, 16, 0.06);
    --sh-3: 0 4px 8px rgba(46, 26, 16, 0.05), 0 12px 28px rgba(46, 26, 16, 0.08);
    --sh-4: 0 24px 48px rgba(46, 26, 16, 0.10), 0 8px 16px rgba(46, 26, 16, 0.06);
    --sh-glow: 0 8px 32px var(--accent-glow);

    /* Easing */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* ---------- Grain overlay (subtle warmth) ---------- */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.4;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.07 0 0 0 0 0.04 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }
  #app, .top-bar, .modal-backdrop, .toast-container, #modal-root { position: relative; z-index: 2; }

  /* ---------- App shell ---------- */
  #app { min-height: 100vh; }
  .bootstrap-loading {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100vh; color: var(--ink-muted); gap: 18px;
  }
  .spinner {
    width: 36px; height: 36px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ---------- Loading skeleton ---------- */
  .skeleton {
    background: linear-gradient(100deg, var(--cream-deep) 30%, var(--surface-warm) 50%, var(--cream-deep) 70%);
    background-size: 200% 100%;
    animation: sk-shimmer 1.3s ease-in-out infinite;
    border-radius: var(--r-sm);
  }
  @keyframes sk-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
  .skeleton-list { display: flex; flex-direction: column; gap: 12px; }
  .skeleton-row {
    display: flex; align-items: center; gap: 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: 16px;
  }
  .skeleton-row .sk-avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }
  .skeleton-row .sk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
  .skeleton-row .sk-line { height: 13px; width: 70%; }
  .skeleton-row .sk-line.short { width: 40%; height: 11px; }

  /* ---------- Layout helpers ---------- */
  .container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
  .container-narrow { max-width: 520px; margin: 0 auto; padding: 0 20px; }
  .stack > * + * { margin-top: 14px; }
  .stack-lg > * + * { margin-top: 24px; }
  .row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

  /* ---------- TopBar ---------- */
  .top-bar {
    position: sticky; top: 0; z-index: 20;
    background: rgba(253, 248, 243, 0.85);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 14px 22px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px;
  }
  .top-bar h1 {
    font-size: 19px; font-weight: 600; letter-spacing: -0.02em;
    display: flex; align-items: center; gap: 8px;
  }
  .top-bar h1::before {
    content: ''; width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
  }
  .top-bar .role-badge {
    font-family: var(--font-body);
    font-size: 11px; padding: 4px 10px; border-radius: 999px;
    background: var(--ink); color: var(--cream);
    font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em;
  }
  .top-bar .back-btn {
    background: none; border: none; padding: 8px 12px;
    color: var(--ink-medium); font-size: 15px; font-weight: 500;
    border-radius: var(--r-sm); transition: background 0.15s, color 0.15s;
  }
  .top-bar .back-btn:hover { background: var(--cream-deep); color: var(--ink); }

  /* ---------- Bottom nav (teacher mobile) ---------- */
  .bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 15;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex; justify-content: space-around;
    padding: 10px 4px max(14px, env(safe-area-inset-bottom));
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 8px 12px; font-size: 11px;
    color: var(--ink-muted); min-width: 72px;
    border-radius: var(--r-md);
    transition: color 0.2s, background 0.2s;
    font-weight: 500;
  }
  .bottom-nav a:hover { color: var(--ink); }
  .bottom-nav a.active {
    color: var(--accent);
    background: var(--accent-light);
  }
  .bottom-nav .icon { font-size: 22px; line-height: 1; }

  /* ---------- Admin nav (mobilde gizli — drawer kullanılır) ---------- */
  .admin-shell { display: flex; flex-direction: column; min-height: 100vh; }
  .admin-nav {
    display: none; gap: 4px; padding: 12px 20px; overflow-x: auto;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    scrollbar-width: thin;
  }
  .admin-nav a {
    padding: 10px 16px; border-radius: 999px;
    color: var(--ink-medium); font-size: 14px; font-weight: 500;
    white-space: nowrap; transition: all 0.2s var(--ease);
  }
  .admin-nav a:hover { background: var(--cream-deep); color: var(--ink); }
  .admin-nav a.active {
    background: var(--ink); color: var(--cream);
  }
  .admin-main { flex: 1; padding: 28px 24px 48px; min-width: 0; }

  @media (min-width: 1024px) {
    .admin-shell { display: grid; grid-template-columns: 260px 1fr; }
    .admin-nav {
      display: flex; flex-direction: column; padding: 24px 16px;
      border-bottom: none; border-right: 1px solid var(--border);
      gap: 2px; overflow: visible;
      background: var(--surface-warm);
    }
    .admin-nav a { padding: 11px 16px; border-radius: var(--r-md); }
    .admin-main { padding: 36px 48px 56px; }
  }

  /* ---------- Top bar sağ küme + mobil hamburger/drawer ---------- */
  .top-bar-right { display: flex; align-items: center; gap: 10px; }

  .hamburger {
    display: none; background: none; border: none; cursor: pointer;
    font-size: 22px; line-height: 1; color: var(--ink);
    padding: 6px 9px; border-radius: var(--r-sm); transition: background 0.15s;
  }
  .hamburger:hover { background: var(--cream-deep); }

  .drawer-backdrop {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(26, 22, 20, 0.45);
    opacity: 0; visibility: hidden;
    transition: opacity 0.25s var(--ease-out), visibility 0.25s;
  }
  .drawer-backdrop.open { opacity: 1; visibility: visible; }
  .drawer {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 41;
    width: 80%; max-width: 300px;
    display: flex; flex-direction: column;
    background: var(--surface); border-right: 1px solid var(--border);
    box-shadow: var(--sh-4);
    transform: translateX(-100%);
    transition: transform 0.28s var(--ease-out);
  }
  .drawer.open { transform: translateX(0); }
  .drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px; border-bottom: 1px solid var(--border);
  }
  .drawer-title { font-family: var(--font-display); font-size: 18px; font-weight: 500; }
  .drawer-close {
    background: var(--cream-deep); border: none; cursor: pointer;
    width: 32px; height: 32px; border-radius: 50%; font-size: 20px; color: var(--ink-medium);
    display: flex; align-items: center; justify-content: center;
  }
  .drawer-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px; flex: 1; overflow-y: auto; }
  .drawer-nav a {
    padding: 13px 16px; border-radius: var(--r-md);
    color: var(--ink-medium); font-size: 15px; font-weight: 500;
    transition: background 0.15s, color 0.15s;
  }
  .drawer-nav a:hover { background: var(--cream-deep); color: var(--ink); }
  .drawer-nav a.active { background: var(--ink); color: var(--cream); }
  .drawer-foot {
    padding: 12px 16px max(16px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
  }
  .drawer-foot .btn { width: 100%; justify-content: center; }

  @media (max-width: 1023px) {
    .hamburger { display: inline-flex; align-items: center; justify-content: center; }
    .logout-desktop { display: none; }
    .hide-xs { display: none; }   /* mobil/tablette üst bar sadeleşir: ● Weekend School  YÖNETİCİ  ☰ */
  }
  @media (min-width: 1024px) {
    .drawer, .drawer-backdrop { display: none; }
  }

  /* ---------- Mobile refinements ---------- */
  @media (max-width: 520px) {
    .top-bar { padding: 12px 16px; gap: 10px; }
    .top-bar h1 { font-size: 16px; }
    .admin-main { padding: 20px 16px 40px; }
    .ad2-kpis { gap: 8px; }
    .ad2-kpis .kpi { padding: 12px; }
    .ad2-kpis .kpi .value { font-size: 22px; }
  }

  /* ---------- Teacher shell ---------- */
  .teacher-shell {
    max-width: 540px; margin: 0 auto;
    min-height: 100vh;
    padding-bottom: max(88px, calc(env(safe-area-inset-bottom) + 80px));
  }
  .teacher-content { padding: 20px 18px; }

  /* Kayıt bekleyen veri göstergesi — üç ilerleme editöründe ortak */
  .save-hint {
    display: none; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 700; color: var(--gold);
    animation: hint-pulse 1.4s ease-in-out infinite;
  }
  .save-hint.visible { display: inline-flex; }
  @keyframes hint-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
  }

  /* ---------- Page heading ---------- */
  .page-heading { margin-bottom: 24px; }
  .page-heading h2 {
    font-size: clamp(28px, 5vw, 36px);
    font-weight: 500;
    font-family: var(--font-display);
    letter-spacing: -0.025em;
  }
  .page-heading .sub {
    color: var(--ink-muted); font-size: 15px; margin-top: 6px;
    font-family: var(--font-body);
  }

  /* ---------- Card ---------- */
  .card {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    padding: 20px;
    border: 1px solid var(--border);
    transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.25s;
  }
  .card-clickable { cursor: pointer; }
  .card-clickable:hover {
    box-shadow: var(--sh-3);
    transform: translateY(-2px);
    border-color: var(--border-strong);
  }
  .card-clickable:active { transform: translateY(0); }
  .card .card-title {
    font-family: var(--font-display);
    font-size: 19px; font-weight: 500; letter-spacing: -0.015em;
  }
  .card .card-sub { font-size: 13px; color: var(--ink-muted); margin-top: 4px; }
  .card .card-body { margin-top: 14px; }
  .card-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
  @media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; } }
  @media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } }

  /* ---------- Buttons ---------- */
  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px; border-radius: 999px;
    border: 1px solid transparent;
    font-size: 14px; font-weight: 500;
    font-family: var(--font-body);
    transition: all 0.2s var(--ease);
    background: var(--cream-deep); color: var(--ink);
    cursor: pointer;
  }
  .btn:hover { background: var(--border); transform: translateY(-1px); }
  .btn:active { transform: translateY(0); }
  .btn-primary {
    background: var(--accent); color: white;
    box-shadow: 0 4px 14px var(--accent-glow);
  }
  .btn-primary:hover { background: var(--accent-dark); box-shadow: 0 6px 20px var(--accent-glow); transform: translateY(-1px); }
  .btn-ink { background: var(--ink); color: var(--cream); }
  .btn-ink:hover { background: var(--ink-medium); }
  .btn-success { background: var(--leaf); color: white; }
  .btn-danger { background: var(--rose); color: white; }
  .btn-outline {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--ink);
  }
  .btn-outline:hover { background: var(--surface); border-color: var(--ink); }
  .btn-ghost { background: transparent; color: var(--accent); }
  .btn-ghost:hover { background: var(--accent-light); }
  .btn-block { width: 100%; }
  .btn-lg {
    padding: 15px 24px; font-size: 16px;
    border-radius: var(--r-md);
  }
  .btn-sm { padding: 7px 12px; font-size: 13px; }
  .btn-icon { padding: 9px; min-width: 38px; border-radius: var(--r-sm); }
  .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

  /* ---------- Inputs ---------- */
  .input, .textarea, .select {
    width: 100%; padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface); color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    font-size: 15px;
  }
  .input:hover, .textarea:hover, .select:hover { border-color: var(--border-strong); }
  .input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
    background: var(--surface);
  }
  .textarea { resize: vertical; min-height: 100px; line-height: 1.5; }
  .field { margin-bottom: 18px; }
  .field label {
    display: block;
    font-size: 13px; font-weight: 600;
    color: var(--ink-medium);
    margin-bottom: 6px;
    letter-spacing: -0.005em;
  }
  .field .help { font-size: 12px; color: var(--ink-muted); margin-top: 6px; }
  .field .err { font-size: 12px; color: var(--rose); margin-top: 6px; font-weight: 500; }

  /* ---------- Table ---------- */
  .table {
    width: 100%; border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--r-lg); overflow: hidden;
    box-shadow: var(--sh-1);
    border: 1px solid var(--border);
  }
  .table th, .table td { padding: 14px 16px; text-align: left; font-size: 14px; }
  .table th {
    background: var(--surface-warm);
    color: var(--ink-medium);
    font-weight: 600; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.06em;
  }
  .table tr { border-top: 1px solid var(--border); }
  .table tr:first-child { border-top: none; }
  .table tr.clickable { cursor: pointer; transition: background 0.15s; }
  .table tr.clickable:hover { background: var(--cream); }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r-lg); }

  /* Mobilde tabloyu satır=kart düzenine çevir (yatay taşma yok) */
  @media (max-width: 720px) {
    .table-wrap { overflow: visible; border-radius: 0; }
    .table, .table tbody { display: block; width: 100%; }
    .table thead { display: none; }
    .table tr {
      display: block;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--r-md);
      box-shadow: var(--sh-1);
      margin-bottom: 12px;
    }
    .table tr.clickable:hover { background: var(--surface); }
    .table td {
      display: block; border: none; text-align: left;
      padding: 6px 16px;
    }
    .table td::before {
      content: attr(data-label);
      display: block; margin-bottom: 2px;
      font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em;
      text-transform: uppercase; color: var(--ink-soft);
    }
    .table td:first-child {
      font-family: var(--font-display); font-size: 17px; font-weight: 600;
      color: var(--ink); padding: 13px 16px 6px;
    }
    .table td:first-child::before { display: none; }
    .table td:last-child {
      display: flex; gap: 8px; flex-wrap: wrap;
      padding: 10px 16px 14px; margin-top: 2px;
    }
    .table td:last-child::before { display: none; }
    .table td:last-child .btn { flex: 1 1 auto; min-width: 92px; }
  }

  /* ---------- Badge ---------- */
  .badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
    background: var(--cream-deep); color: var(--ink-medium);
    letter-spacing: -0.005em;
  }
  .badge-success { background: var(--leaf-light); color: var(--leaf); }
  .badge-warning { background: var(--gold-light); color: var(--gold); }
  .badge-danger  { background: var(--rose-light); color: var(--rose); }
  .badge-primary { background: var(--accent-light); color: var(--accent-dark); }
  .badge-teal    { background: var(--teal-light); color: var(--teal); }

  /* ---------- List row (mobile) ---------- */
  .list-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: 12px;
    transition: background 0.15s;
  }
  .list-row:last-child { border-bottom: none; }
  .list-row:hover { background: var(--cream); }
  .list-row .name { font-weight: 500; color: var(--ink); }
  .list-row .actions { display: flex; gap: 6px; }
  .list-group {
    background: var(--surface);
    border-radius: var(--r-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--sh-1);
  }

  /* ---------- Attendance buttons ---------- */
  .att-actions { display: flex; gap: 6px; }
  .att-btn {
    padding: 12px 14px; border-radius: var(--r-md);
    border: 1.5px solid var(--border);
    background: var(--surface);
    font-family: var(--font-body);
    font-size: 13px; font-weight: 600;
    color: var(--ink-medium);
    min-width: 62px;
    transition: all 0.2s var(--ease);
    cursor: pointer;
  }
  .att-btn:hover { border-color: var(--border-strong); transform: translateY(-1px); }
  .att-btn.active.present {
    background: var(--leaf); color: white;
    border-color: var(--leaf);
    box-shadow: 0 4px 12px rgba(91, 140, 90, 0.3);
    transform: translateY(-1px);
  }
  .att-btn.active.late {
    background: var(--gold); color: white;
    border-color: var(--gold);
    box-shadow: 0 4px 12px rgba(201, 155, 69, 0.3);
    transform: translateY(-1px);
  }
  .att-btn.active.absent {
    background: var(--rose); color: white;
    border-color: var(--rose);
    box-shadow: 0 4px 12px rgba(196, 69, 69, 0.3);
    transform: translateY(-1px);
  }

  /* ---------- Sticky bottom bar ---------- */
  .sticky-bottom {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 14px 20px max(16px, env(safe-area-inset-bottom));
    display: flex; gap: 14px; align-items: center;
    box-shadow: 0 -8px 24px rgba(46, 26, 16, 0.06);
    z-index: 14;
  }
  .sticky-bottom .info { flex: 1; font-size: 14px; color: var(--ink-medium); font-weight: 500; }

  /* ---------- Modal ---------- */
  .modal-backdrop {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(26, 22, 20, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: flex-end; justify-content: center;
    animation: bdFadeIn 0.2s var(--ease-out);
  }
  @media (min-width: 640px) { .modal-backdrop { align-items: center; padding: 24px; } }
  .modal {
    background: var(--surface);
    width: 100%; max-width: 520px;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    box-shadow: var(--sh-4);
    max-height: 90vh; overflow-y: auto;
    animation: mdSlideUp 0.3s var(--ease-out);
  }
  @media (min-width: 640px) { .modal { border-radius: var(--r-xl); } }
  .modal-header {
    padding: 22px 26px 16px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 16px;
  }
  .modal-header h3 {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 500; letter-spacing: -0.02em;
  }
  .modal-header .close {
    background: var(--cream-deep); border: none;
    width: 32px; height: 32px; border-radius: 50%;
    font-size: 18px; color: var(--ink-medium); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s;
  }
  .modal-header .close:hover { background: var(--border); color: var(--ink); }
  .modal-body { padding: 22px 26px; }
  .modal-footer {
    padding: 16px 26px 22px; border-top: 1px solid var(--border);
    display: flex; gap: 10px; justify-content: flex-end;
    flex-wrap: wrap;
  }
  @keyframes bdFadeIn { from { opacity: 0; } to { opacity: 1; } }
  @keyframes mdSlideUp {
    from { transform: translateY(24px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }

  /* ---------- Toast ---------- */
  .toast-container {
    position: fixed; top: 24px; right: 20px; left: 20px; z-index: 200;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
  }
  @media (min-width: 640px) { .toast-container { left: auto; max-width: 380px; } }
  .toast {
    background: var(--ink); color: var(--cream);
    padding: 14px 18px; border-radius: var(--r-md);
    font-size: 14px; font-weight: 500;
    box-shadow: var(--sh-4);
    pointer-events: auto;
    animation: toastIn 0.3s var(--ease-out);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
  .toast.success { background: var(--leaf); }
  .toast.error { background: var(--rose); }
  .toast.warning { background: var(--gold); color: #5a3f10; }
  @keyframes toastIn {
    from { transform: translateY(-16px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
  }

  /* ---------- Empty state ---------- */
  .empty {
    text-align: center; padding: 56px 24px;
    color: var(--ink-muted);
  }
  .empty .icon { font-size: 42px; margin-bottom: 12px; opacity: 0.6; }
  .empty .title {
    font-family: var(--font-display);
    font-size: 20px; font-weight: 500;
    color: var(--ink); letter-spacing: -0.015em;
  }
  .empty .sub { font-size: 14px; margin-top: 6px; color: var(--ink-muted); }

  /* ---------- KPI grid (admin) ---------- */
  .kpi-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
  }
  @media (min-width: 768px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; } }
  .kpi {
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: 22px;
    border: 1px solid var(--border);
    box-shadow: var(--sh-1);
    transition: box-shadow 0.25s, transform 0.25s, border-color 0.25s;
    position: relative;
    overflow: hidden;
  }
  .kpi:hover { box-shadow: var(--sh-3); transform: translateY(-2px); border-color: var(--border-strong); }
  .kpi .label {
    font-size: 11px; color: var(--ink-muted);
    text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
  }
  .kpi .value {
    font-family: var(--font-display);
    font-size: clamp(34px, 5vw, 44px);
    font-weight: 500; line-height: 1; margin-top: 8px;
    color: var(--ink); letter-spacing: -0.03em;
  }
  .kpi .sub { font-size: 12px; color: var(--ink-muted); margin-top: 6px; }
  .kpi.kpi-accent { background: var(--accent); color: white; border-color: var(--accent); }
  .kpi.kpi-accent .label, .kpi.kpi-accent .sub { color: rgba(255, 255, 255, 0.85); }
  .kpi.kpi-accent .value { color: white; }
  .kpi.kpi-ink { background: var(--ink); color: var(--cream); border-color: var(--ink); }
  .kpi.kpi-ink .label, .kpi.kpi-ink .sub { color: rgba(253, 248, 243, 0.7); }
  .kpi.kpi-ink .value { color: var(--cream); }

  /* ---------- Greeting (teacher) ---------- */
  .greeting { padding: 24px 4px 8px; }
  .greeting .hi { font-size: 14px; color: var(--ink-muted); font-weight: 500; }
  .greeting .name {
    font-family: var(--font-display);
    font-size: clamp(28px, 7vw, 36px);
    font-weight: 500; letter-spacing: -0.025em;
    margin-top: 2px;
  }
  .greeting .date { font-size: 14px; color: var(--ink-muted); margin-top: 6px; font-weight: 500; }

  /* ---------- Section header ---------- */
  .section-header {
    display: flex; justify-content: space-between; align-items: baseline;
    margin: 28px 0 14px;
  }
  .section-header h3 {
    font-family: var(--font-body);
    font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--ink-muted);
  }
  .section-header .action {
    font-size: 13px; color: var(--accent); font-weight: 500;
  }

  /* ---------- Utility classes ---------- */
  .text-muted { color: var(--ink-muted); }
  .text-sm { font-size: 13px; }
  .text-xs { font-size: 12px; }
  .text-display { font-family: var(--font-display); letter-spacing: -0.02em; }
  .gap-2 { gap: 8px; }
  .gap-3 { gap: 12px; }
  .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; }
  .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 24px; }
  .hidden { display: none !important; }
  .flex { display: flex; }
  .flex-1 { flex: 1; }
  .items-center { align-items: center; }
  .justify-between { justify-content: space-between; }

  /* ---------- Reveal animation ---------- */
  .reveal {
    opacity: 0; transform: translateY(12px);
    animation: revealUp 0.5s var(--ease-out) forwards;
  }
  .reveal:nth-child(1) { animation-delay: 0.05s; }
  .reveal:nth-child(2) { animation-delay: 0.1s; }
  .reveal:nth-child(3) { animation-delay: 0.15s; }
  .reveal:nth-child(4) { animation-delay: 0.2s; }
  .reveal:nth-child(5) { animation-delay: 0.25s; }
  .reveal:nth-child(6) { animation-delay: 0.3s; }
  .reveal:nth-child(7) { animation-delay: 0.35s; }
  @keyframes revealUp {
    to { opacity: 1; transform: translateY(0); }
  }

  /* ---------- Reduced motion ---------- */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }