  :root {
    --navy: #0a1628;
    --deep: #0e1f3d;
    --blue: #1a3a6e;
    --accent: #e8a020;
    --gold: #f0b429;
    --light: #f4f6fb;
    --white: #ffffff;
    --text: #1e2a3a;
    --muted: #6b7a8d;
    --border: #dde3ee;
    --success: #22c55e;
    --danger: #ef4444;
    --info: #3b82f6;
    --card: #ffffff;
    --sidebar-w: 260px;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }
  body { font-family: 'DM Sans', sans-serif; background: var(--light); color: var(--text); min-height: 100vh; }

  /* SPLASH */
  #app-splash {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 60%, #1e4fa0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
  }
  .splash-content { text-align: center; padding: 24px; }
  .splash-logo {
    width: 76px; height: 76px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    font-size: 34px;
    box-shadow: 0 18px 50px rgba(0,0,0,0.35);
  }
  .splash-school-name {
    color: white;
    font-size: 24px;
    font-weight: 800;
    margin: 16px 0 8px;
    letter-spacing: 0.2px;
  }
  .splash-subtitle {
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    letter-spacing: 2px;
    text-transform: uppercase;
  }
  .splash-loader { margin-top: 18px; display: flex; justify-content: center; }
  .splash-spinner {
    width: 40px; height: 40px;
    border: 4px solid rgba(240,180,41,0.28);
    border-top: 4px solid var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

  /* LOGIN */
  #loginScreen {
    position: fixed; inset: 0; z-index: 1000;
    background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 60%, #1e4fa0 100%);
    display: none; align-items: center; justify-content: center;
  }
  .login-pattern {
    position: absolute; inset: 0; opacity: 0.05;
    background-image: repeating-linear-gradient(45deg, #fff 0, #fff 1px, transparent 0, transparent 50%);
    background-size: 20px 20px;
  }
  .login-card {
    background: rgba(255,255,255,0.97); border-radius: 20px;
    padding: 44px 40px; width: 420px; max-width: 95vw;
    box-shadow: 0 40px 80px rgba(0,0,0,0.4); position: relative;
    animation: slideUp 0.5s ease;
  }
  @keyframes slideUp { from { opacity:0; transform:translateY(30px); } to { opacity:1; transform:translateY(0); } }
  .school-logo { text-align: center; margin-bottom: 22px; }
  .logo-icon {
    width: 70px; height: 70px;
    background: linear-gradient(135deg, var(--navy), var(--blue));
    border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-size: 30px; margin-bottom: 12px; box-shadow: 0 8px 20px rgba(10,22,40,0.3);
  }
  .school-name { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 700; color: var(--navy); line-height: 1.2; }
  .school-sub { font-size: 11px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; margin-top: 4px; }
  .login-title { font-size: 14px; font-weight: 600; color: var(--muted); text-align: center; margin-bottom: 18px; }
  .role-tabs { display: flex; gap: 4px; background: var(--light); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
  .role-tab { flex: 1; padding: 9px; border: none; border-radius: 8px; background: none; font-family: 'DM Sans'; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; transition: all 0.2s; }
  .role-tab.active { background: var(--white); color: var(--navy); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
  .login-step { display: none; }
  .login-step.active { display: block; animation: fadeStepIn 0.3s ease; }
  @keyframes fadeStepIn { from { opacity:0; transform:translateX(12px); } to { opacity:1; transform:translateX(0); } }
  @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
  .step-indicator { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 20px; }
  .step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: all 0.3s; }
  .step-dot.active { background: var(--blue); width: 22px; border-radius: 4px; }
  .step-dot.done { background: var(--success); }
  .otp-inputs { display: flex; gap: 8px; justify-content: center; margin: 18px 0; }
  .otp-digit {
    width: 46px; height: 54px; border: 2px solid var(--border); border-radius: 12px;
    font-size: 22px; font-weight: 700; text-align: center; font-family: 'DM Sans';
    color: var(--navy); outline: none; transition: all 0.2s;
  }
  .otp-digit:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,58,110,0.12); }
  .otp-digit.filled { border-color: var(--blue); background: #f0f4ff; }
  .login-error {
    background: #fef2f2; border: 1px solid #fecaca; color: var(--danger);
    border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 500;
    margin-bottom: 12px; display: none; text-align: center;
  }
  .login-error.show { display: block; animation: fadeStepIn 0.2s ease; }
  .login-success-msg {
    background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d;
    border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 500;
    margin-bottom: 12px; display: none; text-align: center;
  }
  .login-success-msg.show { display: block; }
  .email-hint { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 8px; line-height: 1.5; }
  .email-hint strong { color: var(--navy); }
  .resend-row { text-align: center; margin-top: 10px; font-size: 13px; color: var(--muted); }
  .resend-btn { color: var(--blue); font-weight: 600; cursor: pointer; border: none; background: none; font-family: 'DM Sans'; font-size: 13px; padding: 0; }
  .resend-btn:disabled { color: var(--muted); cursor: default; }
  .login-back-link { text-align: center; margin-top: 12px; font-size: 12px; color: var(--muted); cursor: pointer; }
  .btn-loading { opacity: 0.7; pointer-events: none; }
  .form-group { margin-bottom: 16px; }
  .form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px; }
  .form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 12px 16px;
    border: 2px solid var(--border); border-radius: 10px;
    font-family: 'DM Sans'; font-size: 14px; color: var(--text);
    background: var(--white); outline: none; transition: border-color 0.2s;
  }
  .form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--blue); }
  .btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 24px; border-radius: 10px; border: none;
    font-family: 'DM Sans'; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
  }
  .btn-primary { background: linear-gradient(135deg, var(--navy), var(--blue)); color: white; }
  .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(10,22,40,0.3); }
  .btn-accent { background: linear-gradient(135deg, var(--accent), var(--gold)); color: var(--navy); }
  .btn-accent:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(232,160,32,0.4); }
  .btn-danger { background: var(--danger); color: white; }
  .btn-success { background: var(--success); color: white; }
  .btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
  .btn-outline:hover { border-color: var(--blue); color: var(--blue); }
  .btn-sm { padding: 7px 14px; font-size: 12px; }
  .btn-full { width: 100%; justify-content: center; }

  /* LAYOUT */
  #appScreen { display: none; min-height: 100vh; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--navy);
    display: flex; flex-direction: column;
    z-index: 100; transition: transform 0.3s;
    overflow-y: auto;
  }
  .sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; gap: 12px;
  }
  .sidebar-logo-icon { width: 40px; height: 40px; background: linear-gradient(135deg, var(--accent), var(--gold)); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
  .sidebar-school { font-family: 'Playfair Display', serif; font-size: 13px; color: white; line-height: 1.3; }
  .sidebar-school small { font-family: 'DM Sans'; font-size: 10px; color: rgba(255,255,255,0.4); font-weight: 400; display: block; }
  .sidebar-role { margin: 16px 20px 8px; }
  .role-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.5px; }
  .role-superadmin { background: rgba(168,85,247,0.25); color: #c084fc; }
  .role-admin { background: rgba(232,160,32,0.2); color: var(--gold); }
  .role-teacher { background: rgba(59,130,246,0.2); color: #60a5fa; }
  .role-student { background: rgba(34,197,94,0.2); color: #4ade80; }
  .sidebar-nav { flex: 1; padding: 8px 12px; }
  .nav-section { font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.3); letter-spacing: 1.5px; text-transform: uppercase; padding: 16px 8px 6px; }
  .nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    color: rgba(255,255,255,0.6); font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all 0.2s; margin-bottom: 2px;
  }
  .nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
  .nav-item.active { background: linear-gradient(135deg, rgba(232,160,32,0.2), rgba(240,180,41,0.1)); color: var(--gold); }
  .nav-item .icon { font-size: 16px; width: 20px; text-align: center; }
  .sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
  .user-info { display: flex; align-items: center; gap: 10px; }
  .user-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--accent)); display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 14px; flex-shrink: 0; }
  .user-name { font-size: 13px; font-weight: 600; color: white; }
  .user-id { font-size: 11px; color: rgba(255,255,255,0.4); }
  .logout-btn { margin-left: auto; background: none; border: none; color: rgba(255,255,255,0.4); cursor: pointer; font-size: 16px; transition: color 0.2s; }
  .logout-btn:hover { color: var(--danger); }

  /* MAIN */
  .main { margin-left: var(--sidebar-w); padding: 0; min-height: 100vh; }
  .topbar {
    background: white; border-bottom: 1px solid var(--border);
    padding: 0 32px; height: 64px;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
  }
  .page-title { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; color: var(--navy); }
  .topbar-right { display: flex; align-items: center; gap: 12px; }
  .notif-btn { position: relative; background: var(--light); border: none; width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; }
  .notif-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; border: 2px solid white; }
  .content { padding: 28px 32px; }

  /* PANELS */
  .panel { display: none; }
  .panel.active { display: block; animation: fadeIn 0.3s ease; }
  @keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

  /* STATS */
  .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 28px; }
  .stat-card {
    background: white; border-radius: 16px; padding: 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    display: flex; align-items: center; gap: 16px;
    border-left: 4px solid transparent;
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
  .stat-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
  .stat-num { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 700; color: var(--navy); line-height: 1; }
  .stat-label { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
  .stat-card.blue { border-left-color: var(--info); } .stat-card.blue .stat-icon { background: #eff6ff; }
  .stat-card.gold { border-left-color: var(--gold); } .stat-card.gold .stat-icon { background: #fffbeb; }
  .stat-card.green { border-left-color: var(--success); } .stat-card.green .stat-icon { background: #f0fdf4; }
  .stat-card.purple { border-left-color: #a855f7; } .stat-card.purple .stat-icon { background: #faf5ff; }

  /* CARDS */
  .card { background: white; border-radius: 16px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); overflow: hidden; margin-bottom: 24px; }
  .card-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .card-title { font-weight: 700; font-size: 15px; color: var(--navy); }
  .card-body { padding: 24px; }

  /* TABLE */
  .table-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; }
  thead tr { background: var(--light); }
  th { padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; }
  td { padding: 14px 16px; font-size: 13px; border-bottom: 1px solid var(--border); }
  tr:last-child td { border-bottom: none; }
  tr:hover td { background: var(--light); }
  .badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
  .badge-blue { background: #eff6ff; color: #1d4ed8; }
  .badge-green { background: #f0fdf4; color: #15803d; }
  .badge-gold { background: #fffbeb; color: #92400e; }
  .badge-red { background: #fef2f2; color: #991b1b; }
  .badge-purple { background: #faf5ff; color: #6b21a8; }

  /* MODAL */
  .modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 500; display: none; align-items: center; justify-content: center;
    padding: 20px;
  }
  .modal-overlay.show { display: flex; }
  .modal {
    background: white; border-radius: 20px;
    width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 40px 80px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
  }
  .modal-header { padding: 22px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .modal-title { font-weight: 700; font-size: 16px; color: var(--navy); }
  .modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }
  .modal-body { padding: 24px; }
  .modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

  /* GRID */
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }

  /* FILE CARDS */
  .file-card {
    background: white; border-radius: 14px; border: 2px solid var(--border);
    padding: 18px; display: flex; align-items: center; gap: 14px;
    transition: all 0.2s; cursor: pointer;
  }
  .file-card:hover { border-color: var(--blue); box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
  .file-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
  .file-pdf { background: #fef2f2; } .file-doc { background: #eff6ff; } .file-img { background: #f0fdf4; } .file-zip { background: #fffbeb; }
  .file-name { font-weight: 600; font-size: 13px; color: var(--navy); }
  .file-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
  .file-actions { margin-left: auto; display: flex; gap: 6px; }

  /* MESSAGE PANEL */
  .msg-compose { background: linear-gradient(135deg, var(--navy), var(--blue)); border-radius: 16px; padding: 28px; color: white; margin-bottom: 24px; }
  .msg-compose h3 { font-family: 'Playfair Display', serif; font-size: 20px; margin-bottom: 6px; }
  .msg-compose p { font-size: 13px; opacity: 0.7; margin-bottom: 20px; }
  .msg-input { width: 100%; padding: 14px 16px; border-radius: 10px; border: none; font-family: 'DM Sans'; font-size: 14px; resize: vertical; min-height: 100px; outline: none; }

  /* UPLOAD AREA */
  .upload-area {
    border: 2px dashed var(--border); border-radius: 14px;
    padding: 36px; text-align: center; cursor: pointer;
    transition: all 0.2s; background: var(--light);
  }
  .upload-area:hover { border-color: var(--blue); background: #eff6ff; }
  .upload-icon { font-size: 40px; margin-bottom: 10px; }
  .upload-text { font-weight: 600; color: var(--navy); margin-bottom: 4px; }
  .upload-sub { font-size: 12px; color: var(--muted); }

  /* TOAST */
  #toast {
    position: fixed; bottom: 24px; right: 24px;
    background: var(--navy); color: white;
    padding: 14px 20px; border-radius: 12px;
    font-size: 14px; font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 9999; transform: translateY(100px); opacity: 0;
    transition: all 0.3s; display: flex; align-items: center; gap: 10px;
  }
  #toast.show { transform: translateY(0); opacity: 1; }
  #toast.success { border-left: 4px solid var(--success); }
  #toast.error { border-left: 4px solid var(--danger); }

  /* SEARCH BAR */
  .search-bar { position: relative; }
  .search-bar input { padding-left: 40px; }
  .search-bar .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; }

  /* NOTICE BOARD */
  .notice-item { padding: 16px 0; border-bottom: 1px solid var(--border); display: flex; gap: 14px; }
  .notice-item:last-child { border-bottom: none; }
  .notice-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
  .notice-urgent { background: var(--danger); }
  .notice-info { background: var(--info); }
  .notice-normal { background: var(--success); }
  .notice-title { font-weight: 600; font-size: 14px; color: var(--navy); }
  .notice-body { font-size: 13px; color: var(--muted); margin-top: 3px; }
  .notice-time { font-size: 11px; color: var(--muted); margin-top: 4px; }

  /* PERMISSIONS */
  .perm-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .perm-row:last-child { border-bottom: none; }
  .permx-presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
  .permx-summary { margin: 6px 0 10px; }
  .permx-summary-text { font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
  .permx-progress { width: 100%; height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
  .permx-progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--accent)); transition: width .25s ease; }
  .permx-wrap { display: flex; flex-direction: column; gap: 10px; }
  .permx-group {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fafcff;
    overflow: hidden;
  }
  .permx-group > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    font-weight: 700;
    color: var(--navy);
    background: #f2f4f8;
    border-bottom: 1px solid var(--border);
  }
  .permx-group > summary::-webkit-details-marker { display: none; }
  .permx-left { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
  .permx-icon { width: 18px; text-align: center; font-size: 16px; line-height: 1; color: var(--blue); }
  .permx-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .permx-count { border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 800; border: 1px solid var(--border); background: #f8fafc; color: var(--muted); }
  .permx-count.all { color: #166534; background: #ecfdf3; border-color: #86efac; }
  .permx-count.none { color: #6b7280; background: #f3f4f6; border-color: #d1d5db; }
  .permx-count.partial { color: #92400e; background: #fffbeb; border-color: #fcd34d; }
  .permx-actions { display: none; gap: 6px; flex-wrap: wrap; }
  .permx-group.is-open > summary .permx-actions { display: inline-flex; }
  .permx-body { padding: 0 12px 8px; background: #fff; max-height: 0; opacity: 0; overflow: hidden; transition: max-height .25s ease, opacity .2s ease; }
  .permx-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf1f7; }
  .permx-row:last-child { border-bottom: none; }
  .toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
  .toggle input { opacity: 0; width: 0; height: 0; }
  .toggle-slider { position: absolute; inset: 0; background: var(--border); border-radius: 24px; cursor: pointer; transition: 0.3s; }
  .toggle-slider:before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
  .toggle input:checked + .toggle-slider { background: var(--blue); }
  .toggle input:checked + .toggle-slider:before { transform: translateX(20px); }
  .au-role-block {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-top: 10px;
    background: #fbfcff;
  }
  .au-role-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--navy);
    margin-bottom: 8px;
  }
  .au-teacher-class-wrap { margin-bottom: 10px; }
  .au-tclass-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 8px;
  }

  /* ATTENDANCE MARKING */
  .att-hero {
    background: linear-gradient(135deg, rgba(240,180,41,0.12), rgba(232,160,32,0.08));
    border: 1px solid rgba(240,180,41,0.35);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 20px;
  }
  .att-hero h2 { font-size: 18px; color: var(--navy); margin-bottom: 4px; }
  .att-hero p { font-size: 13px; color: var(--muted); }
  .att-hero kbd {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--light);
    border: 1px solid var(--border);
    font-family: ui-monospace, monospace;
  }
  .att-step-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    align-items: end;
  }
  .att-tabs {
    display: flex;
    gap: 8px;
    margin: 12px 0 14px;
    flex-wrap: wrap;
  }
  .att-tab {
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    color: var(--muted);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }
  .att-tab.is-active {
    border-color: rgba(240,180,41,0.8);
    background: linear-gradient(135deg, rgba(232,160,32,0.18), rgba(240,180,41,0.12));
    color: var(--navy);
  }
  .att-banner {
    margin: 10px 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(240,180,41,0.55);
    background: rgba(240,180,41,0.12);
    color: var(--navy);
    font-weight: 700;
    font-size: 13px;
  }
  .att-history-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    align-items: end;
  }
  .att-h-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
  .att-h-sub { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: auto; }
  .att-hint { font-size: 13px; color: var(--muted); padding: 10px 2px; }
  .att-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }
  .att-summary-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    padding: 10px 10px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
  }
  .att-summary-table td {
    border-bottom: 1px solid var(--border);
    padding: 10px 10px;
  }
  .att-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    border: 1px solid var(--border);
    background: var(--white);
    display: inline-block;
  }
  .att-pct-good { color: var(--success); }
  .att-pct-avg { color: #f59e0b; }
  .att-pct-poor { color: var(--danger); }
  .att-badge.att-pct-good { border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.08); }
  .att-badge.att-pct-avg { border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.08); }
  .att-badge.att-pct-poor { border-color: rgba(239,68,68,0.35); background: rgba(239,68,68,0.08); }

  .att-grid-scroll {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    max-height: 52vh;
    background: var(--white);
    -webkit-overflow-scrolling: touch;
  }
  .att-grid-table { border-collapse: collapse; min-width: 900px; width: max-content; font-size: 12px; }
  .att-grid-table th, .att-grid-table td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: center; white-space: nowrap; }
  .att-grid-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--navy);
    color: #fff;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--gold);
  }
  .att-grid-table .att-sticky-col {
    position: sticky;
    left: 0;
    z-index: 4;
    background: #fff;
    text-align: left;
    min-width: 220px;
  }
  .att-grid-table .att-sticky-col2 {
    position: sticky;
    left: 220px;
    z-index: 4;
    background: #fff;
    min-width: 60px;
    text-align: left;
  }
  .att-grid-table thead .att-sticky-col,
  .att-grid-table thead .att-sticky-col2 { background: var(--navy); color: #fff; z-index: 6; }
  .att-cell { cursor: default; font-weight: 800; border-radius: 6px; }
  .att-cell[data-editable=\"1\"] { cursor: pointer; }
  .att-cell.is-p { color: #15803d; background: rgba(34,197,94,0.10); }
  .att-cell.is-a { color: #b91c1c; background: rgba(239,68,68,0.10); }
  .att-cell.is-l { color: #a16207; background: rgba(234,179,8,0.12); }
  .att-cell.is-n { color: var(--muted); background: transparent; }
  .att-cell-edit { width: 100%; font-size: 12px; padding: 2px 4px; }
  .att-mini {
    display: inline-flex;
    width: 28px;
    height: 22px;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 11px;
    border: 1px solid var(--border);
    background: var(--white);
  }
  .att-mini.is-p { border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.10); color: #15803d; }
  .att-mini.is-a { border-color: rgba(239,68,68,0.35); background: rgba(239,68,68,0.10); color: #b91c1c; }
  .att-mini.is-l { border-color: rgba(234,179,8,0.45); background: rgba(234,179,8,0.14); color: #a16207; }
  .att-mini.is-n { color: var(--muted); }
  .att-step2-card .card-body.att-step2-body { padding-top: 0; }
  .att-bulk-sticky {
    position: sticky;
    top: 0;
    z-index: 8;
    background: linear-gradient(180deg, var(--card) 70%, rgba(255,255,255,0.92) 100%);
    padding: 12px 0 10px;
    margin: 0 -4px 8px;
    border-bottom: 1px solid var(--border);
  }
  .att-bulk-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
  }
  .att-counts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
  }
  .att-counts b { color: var(--navy); font-size: 13px; }
  .att-counts .tag-p { color: var(--success); }
  .att-counts .tag-a { color: var(--danger); }
  .att-counts .tag-l { color: #ca8a04; }
  .att-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .att-quick-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    margin-left: 4px;
  }
  .att-quick-toggle input { accent-color: var(--accent); }
  .att-search-wrap { flex: 1 1 200px; min-width: 160px; }
  .att-search-wrap input {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
  }
  .att-table-scroll {
    max-height: min(58vh, 520px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    -webkit-overflow-scrolling: touch;
  }
  .att-compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
  }
  .att-compact-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--navy);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 2px solid var(--gold);
    box-shadow: 0 2px 0 rgba(0,0,0,0.06);
  }
  .att-compact-table .att-col-num { width: 36px; text-align: center; }
  .att-compact-table .att-col-roll { width: 72px; }
  .att-compact-table .att-col-act { width: 44px; text-align: center; }
  .att-compact-table tbody tr.att-data-row {
    max-height: 45px;
    height: 44px;
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
  }
  .att-compact-table tbody tr.att-data-row:nth-child(even) { background: #f8fafc; }
  .att-compact-table tbody tr.att-data-row:nth-child(odd) { background: #fff; }
  .att-compact-table tbody tr.att-data-row:hover { background: #eef2ff; }
  .att-compact-table tbody tr.att-row-selected {
    outline: 2px solid var(--blue);
    outline-offset: -2px;
    background: #eff6ff !important;
  }
  .att-compact-table td {
    padding: 4px 8px;
    vertical-align: middle;
    line-height: 1.2;
  }
  .att-stu-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }
  .att-avatar-sm {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    color: var(--navy);
    font-weight: 800;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
  }
  .att-avatar-sm img { width: 100%; height: 100%; object-fit: cover; }
  .att-name-cell {
    font-weight: 600;
    font-size: 13px;
    color: var(--navy);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
  }
  .att-name-cell.att-name-quick-on { text-decoration: underline dotted; }
  .att-col-roll code { font-size: 11px; color: var(--muted); }
  .att-tog {
    width: 32px;
    height: 28px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
  }
  .att-tog:hover { border-color: var(--blue); color: var(--navy); }
  .att-tog.att-tog-p.is-on {
    border-color: var(--success);
    background: #22c55e;
    color: #fff;
    box-shadow: 0 0 0 1px rgba(34,197,94,0.35);
  }
  .att-tog.att-tog-a.is-on {
    border-color: var(--danger);
    background: #ef4444;
    color: #fff;
    box-shadow: 0 0 0 1px rgba(239,68,68,0.35);
  }
  .att-tog.att-tog-l.is-on {
    border-color: #ca8a04;
    background: #eab308;
    color: #422006;
    box-shadow: 0 0 0 1px rgba(234,179,8,0.45);
  }
  .att-footer-sticky {
    position: sticky;
    bottom: 0;
    z-index: 7;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 0 4px;
    margin-top: 8px;
    background: linear-gradient(0deg, var(--card) 85%, rgba(255,255,255,0));
    border-top: 1px solid var(--border);
  }
  .att-footer-btns { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
  .att-save-primary {
    min-width: 160px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(232,160,32,0.35);
  }
  .att-unsaved-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(239,68,68,0.25);
    animation: att-pulse 1.2s ease-in-out infinite;
  }
  @keyframes att-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.75; transform: scale(0.92); }
  }
  .att-msg { display: none; margin-top: 16px; padding: 14px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; }
  .att-msg.show { display: block; }
  .att-msg.ok { background: #ecfdf3; border: 1px solid #bbf7d0; color: #15803d; }
  .att-panel-hidden { display: none !important; }
  .au-plan-quota {
    margin-top: 10px;
    background: #eef6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
  }
  .au-plan-quota.danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
  }
  .plan-widget .plan-usage-row { margin-bottom: 10px; font-size: 13px; color: var(--text); }
  .plan-widget .plan-bar { margin-top: 4px; height: 8px; border-radius: 999px; background: #e5e7eb; overflow: hidden; }
  .plan-widget .plan-bar span { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #f59e0b, #ef4444); }
  .plan-widget .plan-exp { margin-top: 8px; font-size: 12px; color: var(--muted); }
  .plan-warning { margin-top: 8px; color: #b45309; font-size: 12px; font-weight: 700; }
  .plan-expired { margin-bottom: 10px; color: #b91c1c; font-weight: 700; font-size: 12px; }
  .plan-revenue-card .plan-rev-row {
    display: grid; grid-template-columns: 1fr auto auto; gap: 12px;
    padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px;
  }
  .plan-revenue-card .plan-rev-total { padding-top: 10px; font-size: 14px; }
  .mu-filter-bar { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr) auto; gap: 10px; align-items: end; margin-bottom: 12px; }
  .mu-stats { margin-bottom: 12px; font-size: 13px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
  .mu-table .mu-avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 11px; }
  .mu-role-badge { font-size: 11px; padding: 3px 8px; border-radius: 999px; font-weight: 700; display: inline-block; }
  .mu-role-teacher { background: #eff6ff; color: #1d4ed8; }
  .mu-role-student { background: #f0fdf4; color: #15803d; }
  .mu-role-parent { background: #faf5ff; color: #6b21a8; }
  .mu-role-accountant { background: #fff7ed; color: #c2410c; }
  .mu-role-librarian { background: #f0fdfa; color: #0f766e; }
  .mu-role-principal { background: #e0e7ff; color: #1e3a8a; }
  .mu-role-staff { background: #f3f4f6; color: #374151; }
  .mu-pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; flex-wrap: wrap; }
  .mu-status-toggle { cursor: pointer; }
  .mu-actions { display: flex; gap: 6px; }
  @media (max-width: 768px) {
    .mu-filter-bar { grid-template-columns: 1fr; }
  }

  /* RESPONSIVE */
  @media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar { transform: translateX(-260px); }
    .sidebar.open { transform: translateX(0); width: 260px; }
    .main { margin-left: 0; }
    .content { padding: 16px; }
    .grid-2 { grid-template-columns: 1fr; }
    .topbar { padding: 0 12px; gap: 10px; height: auto; min-height: 64px; flex-wrap: wrap; }
    #menuBtn { display: inline-block !important; }
    .page-title { font-size: 18px; }
    .topbar-right { margin-left: auto; }
    .content { overflow-x: hidden; padding-bottom: 88px; }
    .card-body { overflow-x: auto; }
    .table-wrap { -webkit-overflow-scrolling: touch; }
    .modal { max-width: 100vw; width: calc(100vw - 16px); border-radius: 14px; max-height: 94vh; }
    .modal-body, .modal-header, .modal-footer { padding-left: 14px; padding-right: 14px; }
    #fabWrap { right: 12px !important; bottom: 12px !important; }
    #fabMenu { right: 0; max-width: min(90vw, 260px); }
    .att-bulk-inner { flex-direction: column; align-items: stretch; }
    .att-search-wrap { flex: 1 1 auto; width: 100%; }
    .att-table-scroll { max-height: 50vh; }
    .att-name-cell { max-width: 140px; }
    .att-compact-table .att-col-roll { width: 56px; }
  }
