@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root{
  --bg:#f8fafc;          /* Slate 50 - cleaner background */
  --card:#ffffff;
  --text:#0f172a;        /* Slate 900 */
  --muted:#64748b;       /* Slate 500 */
  --line:#e2e8f0;        /* Slate 200 */

  --primary:#2563eb;     /* Blue 600 - Trustworthy */     /* Indigo 500 - more modern than basic blue */
  --primary2:#1d4ed8;    /* Blue 700 */    /* Indigo 600 */
  --primarySoft:#eff6ff; /* Blue 50 */ /* Indigo 50 */
  
  --accent: var(--primary);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-soft: 0 4px 14px rgba(15, 23, 42, .04);
  --radius: 12px;        /* 12px is more standard for professional dashboards */
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  overflow: hidden;
}
a{color:inherit;text-decoration:none}

.app{display:flex; height: 100vh; overflow: hidden;}

/* =========================
   SIDEBAR
========================= */
.sidebar{
  width:260px;
  background: #0f172a;    /* Deep Slate - very professional */
  border-right:1px solid rgba(255,255,255,0.05);
  padding:16px 12px;
  display:flex;
  flex-direction:column;
  gap:12px;
  color: #94a3b8;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}
.brand{display:flex;align-items:center;gap:10px;padding:8px; margin-bottom: 8px;}

.logo{
  width:44px;
  height:44px;
  border-radius:14px;
  background:linear-gradient(135deg, rgba(37,99,235,.20), rgba(255,255,255,1));
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.logo-img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}

.brand-title{font-weight:700;font-size:15px;line-height:1.2; color: #fff; letter-spacing: -0.2px;}
.brand-sub{color:#64748b;font-size:12px;margin-top:4px}

.menu-title{
  margin:6px 8px 4px;
  color:var(--muted);
  font-size:11px;
  font-weight:700;
  letter-spacing:.08em;
}

.nav{display:flex;flex-direction:column;gap:6px}
.nav-item{
  display:flex;align-items:center;gap:10px;
  padding:8px 12px;
  border-radius:10px;
  color:#94a3b8;
  transition: all 0.2s;
  font-weight: 500;
  font-size: 13px;
}
.nav-item i{width:16px; color:inherit; font-size: 15px;}
.nav-item:hover{background: rgba(255,255,255,0.05); color: #fff;}
.nav-item.active{
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,0.3);
  font-weight: 600;
}

.sidebar-footer{
  margin-top:auto;
  color:var(--muted);
  font-size:12px;
  padding:8px;
}

/* =========================
   MAIN + TOPBAR
========================= */
.main{
  flex:1;
  display:flex;
  flex-direction:column;
  height: 100vh;
  overflow: hidden;
}

.topbar{
  padding:14px 22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-shrink: 0;
  background: transparent;
}
.search{
  flex:1;
  max-width: fit-content;
  height:40px;            /* Slimmer topbar */
  background:transparent;
  border:none;
  box-shadow: none;
  padding:0;
  display:flex;
  align-items:center;
  gap:12px;
}
.search i{
  color: var(--muted);
  font-size: 15px;
}

.search input{
  border:0;
  outline:0;
  flex:1;
  font-size:14px;
  background:transparent;
}

.top-actions{display:flex;align-items:center;gap:12px}

.icon-btn{
  width:42px;
  height:42px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow:var(--shadow-soft);
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.user-chip{
  display:flex;
  align-items:center;
  gap:12px;
  padding:4px;
  border-radius:100px; 
  background:transparent;
  cursor:pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  box-shadow: none;
}
.user-chip:hover{
  background:#fff;
  border-color:var(--primary);
  box-shadow: 0 4px 12px rgba(99,102,241,0.12);
  transform: translateY(-1px);
}

.avatar{
  width:36px;
  height:36px;
  border-radius:50%; /* Circle avatar */
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:14px;
  font-weight: 800;
  order: 2;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.user-text{
  display:flex;
  flex-direction:column;
  line-height:1.1;
  text-align: right;
}
.user-name{
  font-weight:800;
  font-size:12px; /* Slightly smaller for elegance when caps */
  color:var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.user-role{
  font-size:10px;
  font-weight:700;
  color:var(--muted);
  text-transform:capitalize;
  margin-top: 2px;
}

.dropdown-icon{
  font-size:10px;
  color:var(--muted);
  margin-right: 10px;
  margin-left: 2px;
  transition: transform 0.2s;
}
.user-chip:hover .dropdown-icon {
  color: var(--primary);
}

.btn{
  padding:10px 14px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow:var(--shadow);
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.logout-btn{padding:10px 14px}

.content{
  flex:1;
  padding:0 22px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.content-full {
  padding: 0 !important;
  overflow: hidden !important;
}
.content-full .card {
  border-radius: 0 !important;
  border: none !important;
  border-left: 1px solid var(--line) !important;
  border-top: 1px solid var(--line) !important;
  box-shadow: none !important;
  margin: 0 !important;
}
.content > *:last-child { margin-bottom: 0 !important; }

/* =========================
   GLOBAL CARD + TABLE + FORM
========================= */
.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;         /* Increased padding for professional whitespace */
  position: relative;
}
.card-title{
  font-weight: 700;
  font-size: 1.125rem;   /* 18px */
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 4px;
}

.card-subtitle{
  font-weight: 500;
  color: var(--muted);
  font-size: 0.875rem;    /* 14px */
}

table{
  border-collapse:separate;
  border-spacing:0;
  width:100%;
  background:#fff;
  border:1px solid var(--line);
  border-radius: var(--radius);
  overflow:hidden;
}
th,td{padding: 10px 16px; border-bottom:1px solid var(--line); text-align:left}
th{
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;     /* 12px */
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f8fafc;
}
tr:last-child td{border-bottom:none}

input,select,button{font:inherit}
input,select{
  padding: 10px 14px;
  border-radius: 8px;     /* Smaller radius for inputs is more professional */
  border: 1px solid var(--line);
  background: #fff;
  outline: none;
  font-size: 0.875rem;    /* 14px */
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus{
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primarySoft);
}
button{
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:hover{ background: #f8fafc; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary2);
  border-color: var(--primary2);
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}
.btn-danger:hover {
  background: #fecaca;
  color: #991b1b;
}

table td{
  vertical-align:middle;
}

table td .aksi{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}

table td .btn{
  padding:8px 12px;
  font-size:14px;
}


/* =========================
   PAGE HEADER (dipakai semua menu)
========================= */
.page-head{
  display:flex;
  align-items: center;
  justify-content:space-between;
  margin: 1.5rem 0 1rem;
}
.page-title{
  margin:0;
  font-size: 1.5rem;      /* 24px */
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}
.page-sub{
  margin: 2px 0 0;
  font-size: 0.875rem;    /* 14px */
  color:var(--muted);
  font-weight: 500;
}
.page-date{
  display:flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
  box-shadow:var(--shadow);
  color:var(--muted);
  font-weight:700;
  white-space:nowrap;
}
.muted{color:var(--muted);font-weight:600}

/* =========================
   DASHBOARD STYLE A (stat-cards + dash-grid)
   (kalau kamu pakai style ini, hapus style B di view)
========================= */
.stat-cards{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin:6px 0 10px;
}
.stat-card{
  border-radius:18px;
  border:1px solid var(--line);
  box-shadow:var(--shadow-soft);
  padding:14px;
  background:#fff;
  overflow:hidden;
}
.stat-top{display:flex;align-items:center;gap:10px}
.stat-icon{
  width:36px;height:36px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  border:1px solid rgba(255,255,255,.7);
  background:rgba(255,255,255,.7);
}
.stat-label{
  color:#475569;
  font-weight:800;
  font-size:15px;
}
.stat-value{
  font-size:32px;
  font-weight:900;
  margin:10px 0 2px;
  line-height:1;
}
.stat-sub{
  color:var(--muted);
  font-weight:600;
  font-size:13px;
}

.stat-blue{background:linear-gradient(135deg, rgba(59,130,246,.18), rgba(255,255,255,1))}
.stat-yellow{background:linear-gradient(135deg, rgba(246,200,95,.35), rgba(255,255,255,1))}
.stat-purple{background:linear-gradient(135deg, rgba(168,85,247,.18), rgba(255,255,255,1))}
.stat-green{background:linear-gradient(135deg, rgba(34,197,94,.16), rgba(255,255,255,1))}

/* Pills / Badges */
.pill{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:5px 12px;
  border-radius:999px;
  font-size:13px;
  font-weight:700;
  border:1px solid var(--line);
  background:#f8fafc;
}
.pill-success{background:#f0fdf4;border-color:#86efac;color:#15803d}
.pill-warning{background:#fffbeb;border-color:#fde68a;color:#a16207}
.pill-danger{background:#fef2f2;border-color:#fca5a5;color:#b91c1c}

/* Table row hover */
tbody tr{transition:background .15s ease}
tbody tr:hover{background:#f8fafc}

.dash-grid{
  display:grid;
  grid-template-columns:minmax(0, 2fr) minmax(320px, 1fr);
  gap:16px;
  align-items:stretch;
  margin-top:16px;
}
.dash-grid > .card{min-width:0}

/* chart wrapper */
.chart-box{
  height:220px;
  margin-top:12px;
}
#chartNilai, #chartRingkas{width:100% !important;max-width:100% !important;}

/* quick actions */
.qa-row{
  margin-top:10px;
  display:flex;
  gap:8px;
  flex-wrap:nowrap;
  overflow-x:auto;
  padding-bottom:4px;
}
.qa-btn{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow:var(--shadow);
  font-weight:800;
}
.qa-btn:hover{filter:brightness(.98)}

/* =========================
   DASHBOARD STYLE B (ONE-CARD MOCKUP)
   (pakai salah satu: style A atau B)
========================= */
.dash-one{
  padding:16px;
  background:
    radial-gradient(900px 500px at 15% 15%, rgba(59,130,246,.12), transparent 60%),
    radial-gradient(700px 450px at 60% 35%, rgba(246,200,95,.18), transparent 55%),
    radial-gradient(800px 500px at 92% 20%, rgba(168,85,247,.12), transparent 55%),
    #fff;
}

.dash-top{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
}

.dash-mini{
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow:var(--shadow);
  padding:14px;
  background:#fff;
}
.dash-mini-head{display:flex;align-items:center;gap:10px}
.mini-icon{
  width:36px;height:36px;border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  background:rgba(255,255,255,.7);
  border:1px solid rgba(255,255,255,.8);
}
.mini-title{font-weight:900;color:var(--muted)}
.mini-value{font-size:32px;font-weight:900;margin-top:10px}
.mini-sub{color:var(--muted);font-weight:600;margin-top:4px}

.dash-mini-blue{background:linear-gradient(135deg, rgba(59,130,246,.14), rgba(255,255,255,1))}
.dash-mini-yellow{background:linear-gradient(135deg, rgba(246,200,95,.22), rgba(255,255,255,1))}
.dash-mini-purple{background:linear-gradient(135deg, rgba(168,85,247,.14), rgba(255,255,255,1))}

.dash-mid{
  display:grid;
  grid-template-columns:minmax(0,2fr) minmax(0,1fr);
  gap:14px;
  margin-top:14px;
}
.dash-panel{
  border:1px solid var(--line);
  border-radius:18px;
  background:#fff;
  box-shadow:var(--shadow);
  padding:14px;
  min-width:0;
}
.panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}
.panel-title{font-weight:900;font-size:16px}
.panel-sub{color:var(--muted);font-weight:600;margin-top:4px}
.panel-chart{margin-top:10px;height:160px}
.panel-chart.donut{height:160px}
.panel-empty{margin-top:12px;color:var(--muted);font-weight:700}

.dash-actions{
  margin-top:14px;
  border:1px solid var(--line);
  border-radius:18px;
  background:#fff;
  box-shadow:var(--shadow);
  padding:14px;
}
.actions-title{font-weight:900;font-size:14px}
.actions-row{
  margin-top:10px;
  display:flex;
  gap:10px;
  flex-wrap:nowrap;
  overflow-x:auto;
  padding-bottom:4px;
}
.action-btn{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow:var(--shadow);
  font-weight:800;
}
.action-btn:hover{filter:brightness(.98)}
.action-yellow{background:linear-gradient(135deg, rgba(246,200,95,.35), #fff)}
.action-blue{background:linear-gradient(135deg, rgba(59,130,246,.16), #fff)}
.action-purple{background:linear-gradient(135deg, rgba(168,85,247,.16), #fff)}
.action-green{background:linear-gradient(135deg, rgba(34,197,94,.12), #fff)}

/* =========================
   RESPONSIVE + MOBILE SIDEBAR
========================= */
.hamburger{
  display:none;
  width:40px;
  height:40px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  font-size:18px;
  color:var(--text);
  box-shadow:var(--shadow);
  flex-shrink:0;
}

/* Mobile sidebar overlay (separate element so it doesn't break flex) */
.sidebar-overlay{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.5);
  z-index:9998;
  animation:fadeIn 0.3s;
}
body.sidebar-open .sidebar-overlay{
  display:block;
}
@keyframes fadeIn{
  from{opacity:0}
  to{opacity:1}
}

/* Tablet & Below */
@media (max-width:1100px){
  .sidebar{width:240px}
  .stat-cards{grid-template-columns:repeat(2,minmax(0,1fr)) !important}
  .dash-top{grid-template-columns:repeat(2,minmax(0,1fr)) !important}
  .dash-grid{grid-template-columns:1fr !important}
}

/* Mobile Landscape & Below */
@media (max-width:900px){
  .stat-cards{grid-template-columns:repeat(2,minmax(0,1fr)) !important}
  .dash-mid{grid-template-columns:1fr !important}
  .panel-chart{height:200px}
  
  /* Table responsive - horizontal scroll */
  .card{
    overflow-x:auto;
  }
  
  table{
    min-width:600px;
  }

  /* Form grids: force stack 3-col form layouts */
  #formAssign > div[style*="grid-template-columns"],
  #formSiswaManual form[style*="grid-template-columns"]{
    grid-template-columns:1fr !important;
  }
  /* Force the span-3 button row to span full */
  #formSiswaManual div[style*="grid-column: span 3"]{
    grid-column:span 1 !important;
  }
  /* Form row 2: stack vertically */
  #formAssign > div[style*="display: flex"][style*="align-items: flex-end"]{
    flex-wrap:wrap !important;
  }
  #formAssign > div[style*="display: flex"] label{
    width:100% !important;
    min-width:0 !important;
  }
}

/* Mobile Portrait */
@media (max-width:760px){
  /* Show hamburger menu */
  .hamburger{display:inline-flex}
  
  /* Allow body to scroll on mobile */
  body{
    overflow:auto !important;
    height:auto !important;
  }
  .app{
    height:auto !important;
    overflow:visible !important;
    flex-direction:column;
  }
  .main{
    height:auto !important;
    overflow:visible !important;
    width:100%;
  }
  
  /* Hide desktop elements */
  .logout-btn{display:none}
  .user-text{display:none}
  .search{max-width:none}
  
  /* Sidebar mobile */
  .sidebar{
    position:fixed;
    left:-280px;
    top:0;
    width:280px;
    height:100vh !important;
    z-index:9999;
    transition:left .3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:none;
  }
  
  body.sidebar-open .sidebar{
    left:0;
    box-shadow:4px 0 24px rgba(0,0,0,0.3);
  }
  
  /* Overlay backdrop (uses separate element) */
  body.sidebar-open::before{
    content:"";
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.5);
    z-index:9998;
    animation:fadeIn 0.3s;
  }
  
  .topbar{
    padding:12px 16px;
    gap:10px;
    flex-wrap:wrap;
    height:auto !important;
    min-height:auto !important;
  }
  /* Topbar: hide breadcrumb divider & pill on mobile */
  .topbar .search div[style*="height:16px"][style*="width:1px"]{ display:none; }
  .topbar .search .pill{ display:none; }
  
  .content{
    padding:0 16px 16px;
    overflow-y:visible !important;
  }
  
  /* Cards */
  .card{
    padding:16px;
    border-radius:16px;
  }
  
  /* Page header */
  .page-head{
    flex-direction:column;
    align-items:flex-start;
    gap:12px;
    margin:1rem 0;
  }
  
  .page-title{
    font-size:1.25rem;
  }
  
  /* ====== INLINE GRID OVERRIDES ====== */
  /* Dashboard stat-cards (overrides inline style="grid-template-columns:repeat(3, 1fr)") */
  .stat-cards{
    grid-template-columns:1fr !important;
    gap:12px !important;
  }
  
  .stat-card{
    padding:16px !important;
  }
  
  /* Dashboard grid (overrides inline style="grid-template-columns: 2fr 1fr") */
  .dash-grid{
    grid-template-columns:1fr !important;
    gap:12px !important;
  }
  
  .dash-top{
    grid-template-columns:1fr !important;
    gap:12px !important;
  }
  
  .dash-mid{
    grid-template-columns:1fr !important;
  }
  
  /* ====== FORM GRID OVERRIDES ====== */
  /* Mengajar form: 3-column grid -> 1-column */
  #formAssign > div[style*="grid-template-columns"]{
    grid-template-columns:1fr !important;
    padding:16px !important;
  }
  /* Mengajar form: row 2 flex -> wrap + stack */
  #formAssign > div[style*="display: flex"][style*="align-items: flex-end"]{
    flex-wrap:wrap !important;
    padding:12px 16px 16px !important;
  }
  #formAssign > div[style*="display: flex"] label{
    width:100% !important;
    min-width:0 !important;
  }
  #formAssign > div[style*="display: flex"] div[style*="flex:1"]{
    display:none !important;
  }
  
  /* Siswa form: 3-column grid -> 1-column */
  #formSiswaManual form[style*="grid-template-columns"]{
    grid-template-columns:1fr !important;
    padding:16px !important;
  }
  #formSiswaManual div[style*="grid-column: span 3"]{
    grid-column:span 1 !important;
  }

  /* ====== SISWA PAGE TOOLBAR ====== */
  /* The search + filter toolbar wrapper */
  .content > div[style*="display:flex"][style*="justify-content:space-between"][style*="margin-bottom:20px"]{
    flex-direction:column !important;
    gap:12px !important;
    align-items:stretch !important;
  }
  .content > div[style*="display:flex"][style*="margin-bottom:20px"] > div[style*="position:relative"][style*="max-width:400px"]{
    max-width:100% !important;
  }
  .content > div[style*="display:flex"][style*="margin-bottom:20px"] > div[style*="display:flex"][style*="gap:10px"]{
    flex-wrap:wrap !important;
  }
  
  /* ====== MENGAJAR FILTER BAR ====== */
  .card > div[style*="display:flex"][style*="justify-content:space-between"][style*="flex-wrap:wrap"]{
    flex-direction:column !important;
    gap:12px !important;
    align-items:stretch !important;
  }
  .card > div[style*="display:flex"][style*="justify-content:space-between"] > div[style*="background:#f8fafc"][style*="display:flex"]{
    overflow-x:auto;
  }
  .card > div[style*="display:flex"][style*="justify-content:space-between"] > div[style*="background:#f8fafc"] form{
    flex-wrap:wrap !important;
    gap:10px !important;
  }
  .card > div[style*="display:flex"][style*="justify-content:space-between"] > div[style*="background:#f8fafc"] div[style*="width:1px"]{
    display:none;
  }

  /* ====== NILAI FORM (GURU) ====== */
  /* Header flex: stack on mobile */
  .nilai-card > div[style*="display:flex"][style*="justify-content:space-between"]{
    flex-direction:column !important;
    gap:12px !important;
    padding:16px !important;
  }
  .nilai-card > div[style*="display:flex"][style*="justify-content:space-between"] > div[style*="display:flex"][style*="gap:16px"]{
    flex-wrap:wrap !important;
    gap:10px !important;
    width:100%;
  }
  .nilai-card > div[style*="display:flex"][style*="justify-content:space-between"] #searchSiswa{
    width:100% !important;
  }
  /* The divider next to search */
  .nilai-card > div[style*="display:flex"] > div[style*="display:flex"] > div[style*="width:1px"]{
    display:none;
  }
  /* Table scrolls horizontally */
  .nilai-thead-wrap{
    overflow-x:auto;
  }
  .nilai-table-scroll{
    overflow-x:auto !important;
  }
  .nilai-thead-wrap table,
  .nilai-table-scroll table{
    min-width:750px;
  }
  /* Footer: stack stats and button */
  .nilai-footer{
    flex-direction:column !important;
    gap:16px !important;
    padding:16px !important;
    align-items:stretch !important;
  }
  .nilai-footer > div[style*="display:flex"][style*="gap:24px"]{
    gap:16px !important;
    flex-wrap:wrap !important;
  }
  .nilai-footer > div[style*="display:flex"][style*="gap:20px"]{
    flex-direction:column !important;
    gap:10px !important;
    align-items:stretch !important;
  }
  .nilai-footer button[type="submit"]{
    width:100% !important;
  }

  /* ====== DASHBOARD HEADER ====== */
  /* "Halo, nama" + period pill */
  .content > div > div[style*="display:flex"][style*="justify-content:space-between"][style*="margin-bottom"]{
    flex-direction:column !important;
    gap:8px !important;
    align-items:flex-start !important;
  }

  /* ====== AKSES CEPAT (Quick Action Grid) ====== */
  /* Keep 2-col grid for quick actions */
  
  /* ====== CHART MIN HEIGHT ====== */
  .content div[style*="min-height: 350px"]{
    min-height:250px !important;
  }

  /* Forms */
  input, select, button{
    font-size:16px; /* Prevent zoom on iOS */
  }
  
  /* Tables - better mobile scroll */
  table{
    font-size:13px;
  }
  
  th, td{
    padding:8px 12px;
  }
  
  /* Buttons */
  .btn{
    padding:10px 14px;
    font-size:14px;
  }
  
  /* User dropdown */
  .dropdown-menu{
    right:-8px;
    width:200px;
  }
  
  /* Toast notifications */
  #toast-container{
    bottom:16px;
    right:16px;
    left:16px;
  }
  
  .toast{
    min-width:auto;
    max-width:100%;
  }
  
  /* Chart adjustments */
  .chart-box{
    height:200px;
  }
  
  .panel-chart{
    height:180px;
  }
  
  /* Quick actions scroll */
  .qa-row, .actions-row{
    gap:8px;
  }
  
  .qa-btn, .action-btn{
    padding:10px 14px;
    font-size:13px;
  }

  /* ====== SISWA TABLE: Fixed header + scrollable body ====== */
  /* Override the fixed height calc that doesn't work on mobile */
  .card > div[style*="overflow-y:auto"][style*="height:calc"]{
    height:auto !important;
    max-height:60vh;
  }
  
  /* Siswa table header card: allow horizontal scroll */
  .card[style*="border-radius: var(--radius) var(--radius) 0 0"]{
    overflow-x:auto !important;
  }
  .card[style*="border-radius: 0 0 var(--radius) var(--radius)"]{
    overflow-x:auto !important;
  }

  /* ====== PROFILE PAGE ====== */
  .content form[style*="display:grid"][style*="grid-template-columns"]{
    grid-template-columns:1fr !important;
  }

  /* ====== LAPORAN PAGE ====== */
  .content > div[style*="display:grid"][style*="grid-template-columns"]{
    grid-template-columns:1fr !important;
  }
  .content > div > div[style*="display:grid"][style*="grid-template-columns"]{
    grid-template-columns:1fr !important;
  }

  /* ====== SETTINGS PAGE ====== */
  .content form[style*="grid-template-columns"]{
    grid-template-columns:1fr !important;
  }

  /* ====== GURU DETAIL PAGE ====== */
  .content > div[style*="display:flex"][style*="gap:24px"]{
    flex-direction:column !important;
  }
  .content > div[style*="display:flex"][style*="gap:24px"] > div[style*="width:320px"],
  .content > div[style*="display:flex"][style*="gap:24px"] > div[style*="width: 320px"]{
    width:100% !important;
  }

  /* ====== ABSENSI FORM ====== */
  .content > div > div[style*="display:flex"][style*="justify-content:space-between"]{
    flex-wrap:wrap !important;
    gap:10px !important;
  }

  /* ====== TOPBAR: Non-Dashboard slim topbar override ====== */
  .topbar[style*="height:45px"]{
    height:auto !important;
    min-height:auto !important;
    padding:10px 16px !important;
  }

  /* ====== FIXED HEIGHT OVERRIDES ====== */
  /* Override all calc(100vh - ...) heights on pages like settings, laporan, guru_detail */
  .content > div[style*="height:calc(100vh"],
  .content > div[style*="height: calc(100vh"],
  .card[style*="height:calc(100vh"],
  .card[style*="height: calc(100vh"]{
    height:auto !important;
  }
  /* Laporan & guru_detail scrollable inner containers */
  div[style*="overflow-y:auto"][style*="height:calc(100vh"]{
    height:auto !important;
    max-height:65vh;
  }

  /* ====== GURU DETAIL: Gradient Header ====== */
  /* The purple gradient header bar with name + stats + button */
  div[style*="background: linear-gradient"][style*="display:flex"][style*="justify-content:space-between"]{
    flex-wrap:wrap !important;
    gap:12px !important;
    padding:16px !important;
  }
  /* Guru detail: Stats row within header */
  div[style*="background: linear-gradient"] > div[style*="display:flex"][style*="gap:20px"]{
    gap:12px !important;
  }

  /* ====== LAPORAN: Filter form ====== */
  .card form[style*="display:flex"][style*="justify-content:space-between"][style*="gap:20px"]{
    flex-direction:column !important;
    gap:12px !important;
  }
  .card form[style*="display:flex"][style*="justify-content:space-between"] > div[style*="max-width:400px"]{
    max-width:100% !important;
  }
  .card form[style*="display:flex"] > div[style*="display:flex"][style*="gap:20px"]{
    flex-wrap:wrap !important;
    gap:10px !important;
  }

  /* ====== PROFILE PAGE: Header card ====== */
  .card[style*="display:flex"][style*="align-items:center"][style*="gap:32px"]{
    flex-direction:column !important;
    text-align:center;
    padding:24px !important;
    gap:16px !important;
  }

  /* ====== ABSENSI: Card header ====== */
  .card > div[style*="display:flex"][style*="justify-content:space-between"][style*="position:sticky"]{
    flex-direction:column !important;
    gap:12px !important;
    padding:16px !important;
  }
  .card > div[style*="display:flex"][style*="justify-content:space-between"][style*="position:sticky"] > div[style*="display:flex"][style*="gap:16px"]{
    flex-wrap:wrap !important;
    width:100%;
    gap:10px !important;
  }
  .card > div[style*="display:flex"][style*="justify-content:space-between"][style*="position:sticky"] #searchSiswa{
    width:100% !important;
  }
  .card > div[style*="display:flex"][style*="justify-content:space-between"][style*="position:sticky"] div[style*="width:1px"]{
    display:none;
  }

  /* ====== ABSENSI: Rekap row ====== */
  .card div[style*="display:flex"][style*="justify-content:space-between"][style*="flex-wrap:wrap"]{
    flex-direction:column !important;
    gap:12px !important;
  }
  .card div[style*="display:flex"][style*="justify-content:space-between"][style*="flex-wrap:wrap"] > div[style*="display:flex"][style*="gap:12px"]{
    flex-wrap:wrap !important;
    gap:8px !important;
  }

  /* ====== ABSENSI: Scroll area ====== */
  #scrollArea{
    height:auto !important;
    max-height:55vh;
    padding-bottom:80px !important;
  }

  /* ====== ABSENSI: Footer sticky ====== */
  .card div[style*="position:sticky"][style*="bottom:0"]{
    flex-direction:column !important;
    gap:12px !important;
    padding:16px !important;
  }
  .card div[style*="position:sticky"][style*="bottom:0"] button[type="submit"]{
    width:100% !important;
  }

  /* ====== TABLE CARD HEADERS ====== */
  /* Override table fixed layout on horizontal scroll containers */
  .card > div[style*="background: #f8fafc"][style*="border-bottom"] table,
  .card > div[style*="background:#f8fafc"][style*="border-bottom"] table,
  .card > div[style*="background: #fff"][style*="border-bottom"] table{
    min-width:600px;
  }

  /* ====== EDIT PAGES: Simple form cards ====== */
  .card form[style*="display:grid"]{
    grid-template-columns:1fr !important;
  }

  /* ====== IMPORT FORM (Siswa) ====== */
  #formSiswaImport form[style*="display:flex"]{
    flex-direction:column !important;
    gap:12px !important;
  }

  /* ====== PREMIUM CARD-GRID PAGES (Akun Guru, Notifikasi, Settings, etc.) ====== */

  /* All inline grid-template-columns on dash-grid → single column on mobile */
  .dash-grid[style*="grid-template-columns"]{
    grid-template-columns:1fr !important;
    height:auto !important;
    min-height:0 !important;
  }

  /* Cards inside dash-grid: remove fixed flex height, allow natural flow */
  .dash-grid > .card{
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
  }

  /* Card body scrollable areas: let them flow naturally on mobile */
  .dash-grid > .card > div[style*="overflow-y:auto"][style*="flex:1"]{
    max-height:65vh;
  }

  /* Card headers: allow text to wrap and shrink gaps on mobile */
  .dash-grid > .card > div[style*="border-bottom"][style*="display:flex"]{
    flex-wrap:wrap !important;
    gap:12px !important;
    padding:16px !important;
  }

  /* Pill badges in card headers: shrink on mobile */
  .dash-grid > .card > div[style*="border-bottom"] > .pill,
  .dash-grid > .card > div[style*="border-bottom"] > div > .pill{
    font-size:11px !important;
    padding:6px 10px !important;
  }

  /* Header action groups (e.g. pill + delete all button wrapper) */
  .dash-grid > .card > div[style*="border-bottom"] > div[style*="display:flex"][style*="gap:12px"]{
    flex-wrap:wrap !important;
    gap:8px !important;
  }

  /* Inner form cards (the white boxes inside #f8fafc body) */
  .dash-grid > .card > div[style*="padding:24px"]{
    padding:16px !important;
  }
  .dash-grid > .card form[style*="padding:20px"]{
    padding:16px !important;
  }

  /* Two-column inline grids inside forms → single column */
  .dash-grid form div[style*="grid-template-columns:1fr 1fr"],
  .dash-grid form div[style*="grid-template-columns: 1fr 1fr"]{
    grid-template-columns:1fr !important;
  }

  /* Guru chip selection area: allow wrapping */
  .dash-grid .guru-chip{
    font-size:11px !important;
    padding:5px 10px !important;
  }

  /* Buttons inside forms: full width on mobile */
  .dash-grid form button[type="submit"]{
    width:100% !important;
  }

  /* ====== AKUN GURU TABLE ====== */
  /* The table inside the right card needs horizontal scroll */
  .dash-grid > .card > div[style*="overflow-y:auto"] table{
    min-width:650px;
  }
  .dash-grid > .card > div[style*="overflow-y:auto"]{
    overflow-x:auto !important;
  }

  /* ====== NOTIFIKASI HISTORY ITEMS ====== */
  /* Notification cards: stack icon + content vertically on very small screens */
  .dash-grid > .card > div[style*="overflow-y:auto"] > div[style*="display:flex"][style*="flex-direction:column"] > div[style*="display:flex"][style*="gap:16px"]{
    flex-direction:column !important;
    gap:12px !important;
  }

  /* Notification meta row: wrap pills and labels */
  .dash-grid > .card > div div[style*="justify-content:space-between"][style*="flex-wrap:wrap"]{
    flex-direction:column !important;
    gap:8px !important;
    align-items:flex-start !important;
  }

  /* ====== SETTINGS: Signature canvas ====== */
  .dash-grid canvas[style*="height:200px"]{
    height:150px !important;
  }

  /* Settings: Signature mode switch buttons */
  .dash-grid div[style*="display:flex"][style*="padding:4px"][style*="border-radius:10px"]{
    flex-direction:row;
  }

  /* ====== TAHUN AJARAN: Period cards ====== */
  /* Override any inline min-width on cards inside grids */
  .dash-grid > .card > div > div[style*="min-width"]{
    min-width:0 !important;
  }

  /* ====== SISWA / GURU / KELAS / MAPEL PAGES ====== */
  /* These pages use flex column with calc(100vh-90px) — override for mobile */
  .content > div[style*="height:calc(100vh - 90px)"]{
    height:auto !important;
  }
  .content > div[style*="height:calc(100vh - 90px)"] > .card{
    height:auto !important;
    max-height:none !important;
  }

  /* Table scroll body inside cards */
  .content > div > .card > div[style*="overflow-y:auto"][style*="flex:1"]{
    max-height:60vh;
    overflow-x:auto !important;
  }

  /* Card headers with buttons: wrap gracefully */
  .content > div > .card > div[style*="padding:20px 24px"][style*="display:flex"]{
    flex-wrap:wrap !important;
    gap:12px !important;
    padding:16px !important;
  }

  /* Action button groups in card headers */
  .content > div > .card > div[style*="padding:20px 24px"] > div[style*="display:flex"][style*="gap:12px"]{
    flex-wrap:wrap !important;
    gap:8px !important;
  }
  .content > div > .card > div[style*="padding:20px 24px"] > div[style*="display:flex"][style*="gap:10px"]{
    flex-wrap:wrap !important;
    gap:8px !important;
  }

  /* Search inputs in headers: full width */
  .content > div > .card > div[style*="padding:20px 24px"] input[type="text"][style*="width:240px"],
  .content > div > .card > div[style*="padding:20px 24px"] input[type="text"][style*="width:220px"],
  .content > div > .card > div[style*="padding:20px 24px"] input[type="text"][style*="width:200px"]{
    width:100% !important;
    min-width:0 !important;
  }

  /* ====== HIDDEN FORMS (Kelas, Mapel, Guru, Siswa) ====== */
  /* The popup form cards that appear on "Tambah" click */
  .card[id^="form"] form[style*="display:flex"][style*="gap:16px"]{
    flex-direction:column !important;
    align-items:stretch !important;
  }
  .card[id^="form"] form div[style*="min-width:300px"],
  .card[id^="form"] form div[style*="min-width:250px"],
  .card[id^="form"] form div[style*="min-width:200px"]{
    min-width:0 !important;
    width:100% !important;
  }

  /* ====== MENGAJAR INDEX ====== */
  /* Filter bar on mengajar page */
  .content > .card > div[style*="display:flex"][style*="justify-content:space-between"][style*="padding:20px"]{
    flex-direction:column !important;
    gap:12px !important;
    padding:16px !important;
  }

  /* ====== GURU DETAIL PAGE ====== */
  /* Override fixed widths on sidebar panel */
  .content > div[style*="display:flex"][style*="gap:24px"] > div[style*="width:340px"],
  .content > div[style*="display:flex"][style*="gap:24px"] > div[style*="width: 340px"]{
    width:100% !important;
  }

  /* ====== GENERAL: Inline min-width overrides ====== */
  /* Prevent horizontal overflow from inline min-width */
  .content div[style*="min-width:300px"]{
    min-width:0 !important;
  }
  .content div[style*="min-width:400px"]{
    min-width:0 !important;
  }
  .content div[style*="minmax(400px"]{
    min-width:0 !important;
  }

  /* ====== INPUT NILAI PAGE (GURU) ====== */
  /* Let the page flow naturally on mobile instead of flex-fill */
  .nilai-page-wrap,
  .absensi-page-wrap{
    min-height:0;
    height:auto !important;
  }
  .nilai-card,
  .absensi-card{
    min-height:0;
    height:auto !important;
    border-radius:12px !important;
  }
  .nilai-form,
  .absensi-form{
    overflow:visible !important;
  }

  /* Table needs horizontal scroll */
  .nilai-thead-wrap,
  .nilai-table-scroll{
    overflow-x:auto !important;
  }
  .nilai-thead-wrap table,
  .nilai-table-scroll table{
    min-width:700px;
  }

  /* Absensi table scroll */
  .absensi-table-scroll{
    overflow-x:auto !important;
    max-height:55vh;
  }
  .absensi-table-scroll table{
    min-width:600px;
  }

  /* Nilai footer: stack stats and button */
  .nilai-footer{
    flex-direction:column !important;
    gap:14px !important;
    padding:14px 16px !important;
    align-items:stretch !important;
  }
  .nilai-footer > div[style*="display:flex"][style*="gap:24px"]{
    gap:16px !important;
    flex-wrap:wrap !important;
  }
  .nilai-footer > div[style*="display:flex"][style*="gap:20px"]{
    flex-direction:column !important;
    gap:10px !important;
    align-items:stretch !important;
  }
  .nilai-footer button[type="submit"]{
    width:100% !important;
  }

  /* Absensi header bar: stack date + pills vertically */
  .absensi-card > form > div[style*="padding:20px 24px"][style*="display:flex"][style*="justify-content:space-between"]{
    flex-direction:column !important;
    gap:12px !important;
    padding:14px 16px !important;
  }
  /* Absensi pills row: wrap */
  .absensi-card > form > div > div[style*="display:flex"][style*="gap:12px"]{
    flex-wrap:wrap !important;
    gap:8px !important;
  }
  /* Absensi pill sizes */
  .abs-rekap-pill{
    padding:5px 10px !important;
    font-size:11px !important;
  }
  /* Hide divider between pills and button */
  .absensi-card > form > div > div > div[style*="width:1px"][style*="height:20px"]{
    display:none !important;
  }
  /* Absensi buttons: make H/I/S/A touch-friendly */
  .abs-btn{
    width:40px !important;
    height:36px !important;
    font-size:13px !important;
  }

  /* Absensi footer: stack info and save button */
  .absensi-card > form > div[style*="padding:10px 16px"][style*="display:flex"][style*="justify-content:space-between"]{
    flex-direction:column !important;
    gap:12px !important;
    padding:14px 16px !important;
    align-items:stretch !important;
  }
  .absensi-card > form > div[style*="padding:10px 16px"] button[type="submit"]{
    width:100% !important;
  }

  /* Content-full pages (Nilai & Absensi use this class): allow scroll on mobile */
  .content-full{
    overflow:auto !important;
    padding:0 12px 12px !important;
  }
  .content-full .card{
    border-radius:12px !important;
    border:1px solid var(--line) !important;
    box-shadow:var(--shadow) !important;
  }

  /* Search input in topbar for content-full pages */
  .topbar input#searchSiswa{
    width:140px !important;
  }
  #searchSiswa:focus{
    width:180px !important;
  }
}

/* Extra Small Mobile */
@media (max-width:480px){
  .topbar{
    padding:10px 12px;
  }
  
  .content{
    padding:0 12px 12px;
  }
  
  .card{
    padding:14px;
  }
  
  .page-title{
    font-size:1.125rem;
  }
  
  .stat-value{
    font-size:28px;
  }
  
  .mini-value{
    font-size:28px;
  }
  
  /* Stat cards: 2-column on wider phones, 1 on small */
  .stat-cards{
    grid-template-columns:1fr !important;
  }
  
  /* Smaller buttons on tiny screens */
  .btn{
    padding:8px 12px;
    font-size:13px;
  }
  
  /* Table even more compact */
  table{
    font-size:12px;
  }
  
  th, td{
    padding:6px 10px;
  }
  
  /* User chip smaller */
  .user-chip{
    padding:2px;
  }
  
  .avatar{
    width:32px;
    height:32px;
    font-size:13px;
  }
  
  .dropdown-icon{
    margin-right:6px;
  }
  
  /* Auth page: slightly less padding */
  .auth-body{
    padding:16px;
  }
  .auth-card{
    padding:18px;
  }

  /* ====== INPUT NILAI & PRESENSI: Extra small ====== */
  .content-full{
    padding:0 8px 8px !important;
  }
  .absensi-table-scroll{
    max-height:50vh;
  }
  /* Topbar: hide search on very small screens, show hamburger only */
  .topbar input#searchSiswa{
    width:100px !important;
    font-size:11px !important;
  }
  /* Nilai stats */
  .nilai-footer > div > div > span[style*="font-size:18px"]{
    font-size:16px !important;
  }
}

/* Landscape orientation fixes */
@media (max-height:500px) and (orientation:landscape){
  .sidebar{
    overflow-y:auto;
  }
  
  .content{
    height:calc(100vh - 60px);
  }
}

/* =========================
   AUTH / LOGIN PAGE
========================= */
.auth-body{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(246,200,95,.35), transparent 60%),
    radial-gradient(900px 500px at 100% 30%, rgba(99,102,241,.18), transparent 55%),
    var(--bg);
}

.auth-wrap{ width:100%; display:flex; justify-content:center; }

.auth-card{
  width:min(440px, 100%);
  background:var(--card);
  border:1px solid var(--line);
  border-radius:22px;
  box-shadow:var(--shadow);
  padding:22px;
}

.auth-brand{
  display:flex;
  gap:14px;
  align-items:center;
  margin-bottom:18px;
}

.auth-logo{
  width:52px;height:52px;
  border-radius:16px;
  display:flex;align-items:center;justify-content:center;
  border:1px solid var(--line);
  background:#fff;
  font-size:22px;
}

.auth-title{ font-weight:800; letter-spacing:.2px; }
.auth-subtitle{ color:var(--muted); font-size:13px; margin-top:2px; }

.auth-alert{
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(239,68,68,.25);
  background:rgba(239,68,68,.08);
  color:#b91c1c;
  margin:10px 0 14px;
  font-size:13px;
}

.auth-form{ margin-top:8px; }

.auth-label{
  display:block;
  font-size:13px;
  color:var(--muted);
  margin:12px 0 6px;
}

.auth-input{
  display:flex;
  align-items:center;
  gap:10px;
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px 12px;
  background:#fff;
}
.auth-input > i{
  color:var(--muted);
  width:18px;
  text-align:center;
}
.auth-input input{
  border:0;
  outline:0;
  width:100%;
  font-size:14px;
  background:transparent;
}
.pw-toggle{
  border:0;
  background:transparent;
  box-shadow:none;
  padding:6px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
}

.pw-toggle:hover{
  background:transparent;
  filter:none;
  color:#334155;
}

.pw-toggle i{
  width:auto;
}
.auth-input:focus-within{
  box-shadow:0 0 0 4px rgba(246,200,95,.35);
  border-color:rgba(246,200,95,.65);
}

.auth-btn{
  width:100%;
  margin-top:16px;
  padding:12px 14px;
  border:0;
  border-radius:14px;
  background:var(--accent);
  font-weight:700;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}
.auth-btn:hover{ filter:brightness(.98); }

.auth-foot{
  text-align:center;
  margin-top:14px;
  color:var(--muted);
  font-size:12px;
}

/* =========================
   GURU DASHBOARD OVERRIDES
========================= */
.guru-dash .stat-cards{
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width:1100px){
  .guru-dash .stat-cards{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width:650px){
  .guru-dash .stat-cards{ grid-template-columns: 1fr; }
}

/* Progress (donut kanan) */
.guru-dash .progress-wrap{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-top:12px;
  flex-wrap:wrap;
}
.guru-dash .progress-info{ min-width:200px; }
.guru-dash .progress-big{ font-size:34px; font-weight:900; line-height:1; }
.guru-dash .progress-pills{ display:flex; gap:10px; flex-wrap:wrap; }

.guru-dash .progress-donut{
  width:170px;
  height:170px;
}
.guru-dash .progress-donut canvas{
  width:100% !important;
  height:100% !important;
}
.hidden{
  display:none !important;
}
#formAssign{
  margin-bottom:16px;
}
.alert{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow:var(--shadow);
  margin-bottom:12px;
  font-weight:700;
}
.alert-success{ border-color:#86efac; background:#f0fdf4; }
.alert-danger{ border-color:#fca5a5; background:#fef2f2; }

/* ===== USER DROPDOWN (RAPI) ===== */
.user-dropdown {
  position: relative;
}

.user-chip {
  cursor: pointer;
  user-select: none;
}

.dropdown-icon{
  margin-left: 8px;
  font-size: 12px;
  opacity: .65;
}

/* ===== USER DROPDOWN (PREMIUM) ===== */
.user-dropdown {
  position: relative;
}

/* kotak dropdown */
.dropdown-menu{
  position:absolute;
  right:0;
  top:calc(100% + 14px);
  width:210px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow:0 12px 34px rgba(15,23,42,.12);
  padding:8px;
  display:none;
  z-index:9999;
  animation: slideUp 0.2s ease-out;
  transform-origin: top right;
}

/* Panah (Arrow) Dropdown */
.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 24px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* item dropdown */
.dropdown-item{
  width:100%;
  display:flex;
  align-items:center;
  gap:12px;
  padding:11px 14px;
  border-radius:12px;
  text-decoration:none;
  color:var(--text);
  font-weight:700;
  font-size:13px;
  background:transparent;
  border:0;
  box-shadow:none;
  transition: all 0.2s;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  outline: none;
}

.dropdown-item i{
  width: 20px;
  font-size: 14px;
  opacity: .75;
  display: flex;
  justify-content: center;
  color: var(--muted);
}

.dropdown-item:hover{
  background:var(--primarySoft);
  color: var(--primary);
}

.dropdown-item:hover i {
  color: var(--primary);
}

.dropdown-divider{
  height: 1px;
  background: var(--line);
  margin: 4px 8px;
  opacity: 0.6;
}

.logout-item{
  color:#dc2626 !important;
}

.logout-item i {
  color: #dc2626 !important;
  opacity: 0.8;
}

.logout-item:hover{
  background:#fef2f2;
}
/* =========================
   THEME: BLUE PROFESSIONAL (OVERRIDE)
========================= */

.sidebar{
  background: linear-gradient(180deg, #0b1220 0%, #0d2557 48%, #123a84 100%);
  border-right: 1px solid rgba(255,255,255,.08);
}

.brand-title{ color:#ffffff; }
.brand-sub{ color: rgba(255,255,255,.70); }
.menu-title{ color: rgba(255,255,255,.65); }

.logo{
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 14px 34px rgba(0,0,0,.18);
}

.nav-item{
  color:rgba(255,255,255,.84);
  border:1px solid transparent;
  padding:13px 14px;
  border-radius:16px;
  transition:.18s ease;
}

.nav-item i{ color: rgba(255,255,255,.82); }

.nav-item:hover{
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.10);
}

.nav-item.active{
  background:linear-gradient(135deg, rgba(255,255,255,.18), rgba(255,255,255,.08));
  border:1px solid rgba(255,255,255,.16);
  box-shadow:0 10px 24px rgba(0,0,0,.16);
  color:#fff;
  font-weight:800;
}
.sidebar-footer{
  color: rgba(255,255,255,.65);
}

/* =========================
   KELAS CARDS – COLOR SYSTEM
   7 = Emerald, 8 = Sapphire Blue, 9 = Violet, default = Slate
========================= */

/* Base card */
.kelas-card-base {
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.kelas-card-base:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(0,0,0,0.10);
}

/* Kelas 7 – Emerald Green */
.kelas-card-7 {
  border-color: #a7f3d0;
  background: linear-gradient(160deg, #f0fdf4 0%, #fff 60%) !important;
}
.kelas-card-7:hover {
  border-color: #6ee7b7;
  box-shadow: 0 16px 32px rgba(16,185,129,0.12) !important;
}
.kelas-card-7 .kelas-icon-box {
  background: linear-gradient(135deg, #10b981, #34d399);
  box-shadow: 0 6px 20px rgba(16,185,129,0.35);
}
.kelas-card-7 .kelas-footer {
  padding-top: 14px;
  border-top: 1px dashed #a7f3d0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #047857;
}
.kelas-card-7 .kelas-badge {
  background: #d1fae5;
  color: #047857;
  font-weight: 800;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #a7f3d0;
}

/* Kelas 8 – Sapphire Blue */
.kelas-card-8 {
  border-color: #bfdbfe;
  background: linear-gradient(160deg, #eff6ff 0%, #fff 60%) !important;
}
.kelas-card-8:hover {
  border-color: #93c5fd;
  box-shadow: 0 16px 32px rgba(59,130,246,0.12) !important;
}
.kelas-card-8 .kelas-icon-box {
  background: linear-gradient(135deg, #3b82f6, #60a5fa);
  box-shadow: 0 6px 20px rgba(59,130,246,0.35);
}
.kelas-card-8 .kelas-footer {
  padding-top: 14px;
  border-top: 1px dashed #bfdbfe;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #1d4ed8;
}
.kelas-card-8 .kelas-badge {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 800;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
}

/* Kelas 9 – Violet */
.kelas-card-9 {
  border-color: #ddd6fe;
  background: linear-gradient(160deg, #f5f3ff 0%, #fff 60%) !important;
}
.kelas-card-9:hover {
  border-color: #c4b5fd;
  box-shadow: 0 16px 32px rgba(139,92,246,0.12) !important;
}
.kelas-card-9 .kelas-icon-box {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  box-shadow: 0 6px 20px rgba(139,92,246,0.35);
}
.kelas-card-9 .kelas-footer {
  padding-top: 14px;
  border-top: 1px dashed #ddd6fe;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #6d28d9;
}
.kelas-card-9 .kelas-badge {
  background: #ede9fe;
  color: #6d28d9;
  font-weight: 800;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #ddd6fe;
}

/* Default / fallback */
.kelas-card-default {
  border-color: var(--line);
}
.kelas-card-default .kelas-icon-box {
  background: linear-gradient(135deg, #64748b, #94a3b8);
  box-shadow: 0 6px 20px rgba(100,116,139,0.25);
}
.kelas-card-default .kelas-footer {
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
}
.kelas-card-default .kelas-badge {
  background: #f1f5f9;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* Shared icon box shape */
.kelas-icon-box {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

/* ============================================
   EXTRACTED COMPONENT CLASSES
============================================ */

/* Gradient Headers for Cards */
.card-header-rainbow {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to right, oklch(98% 0.01 260), oklch(100% 0 0));
  flex-wrap: wrap;
  gap: 20px;
}

/* Gradient Empty States */
.empty-state-rainbow {
  text-align: center;
  padding: 80px 24px;
  color: var(--muted);
  font-weight: 700;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, oklch(99% 0.01 260), oklch(97% 0.02 260));
  border-radius: 24px;
  border: 1px dashed #cbd5e1;
  margin: 24px;
}

/* Table Headers */
.table-header-rainbow {
  background: linear-gradient(to right, oklch(99% 0.01 260), oklch(100% 0 0));
  border-bottom: 1px solid var(--line);
}

/* Table Row Hover */
.table-row-hover {
  border-bottom: 1px solid var(--line);
  transition: all 0.2s;
}
.table-row-hover:hover {
  background: #f4f7fa;
}



/* Reusable Focus Input (replaces long inline onfocus handlers) */
.form-input-rainbow {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: all 0.2s;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.form-input-rainbow:focus {
  border-color: var(--primary) !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 3px var(--primarySoft) !important;
}

/* Guru Pages Extracted Styles */
.header {
      text-align: center;
      margin-bottom: 20px;
    }
    
    .header h1 {
      font-size: 16pt;
      font-weight: bold;
      margin-bottom: 4px;
      text-transform: uppercase;
    }
    
    .header h2 {
      font-size: 10pt;
      font-weight: normal;
      margin-bottom: 2px;
    }
    
    .header p {
      font-size: 9pt;
      margin-bottom: 2px;
    }
    
    .info-section {
      margin-bottom: 15px;
      font-size: 10pt;
    }
    
    .info-section table {
      width: 100%;
      border: none;
    }
    
    .info-section td {
      padding: 2px 0;
      border: none;
    }
    
    .info-label {
      width: 100px;
      font-weight: bold;
    }
    
    table.main-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 10pt;
    }
    
    table.main-table thead th {
      background-color: #f0f0f0;
      border: 1px solid #000;
      padding: 6px 4px;
      font-weight: bold;
      text-align: center;
      font-size: 10pt;
    }
    
    table.main-table tbody td {
      border: 1px solid #000;
      padding: 4px;
      text-align: center;
    }
    
    table.main-table tbody td:first-child {
      text-align: center;
      width: 30px;
    }
    
    table.main-table tbody td:nth-child(2) {
      text-align: center;
      width: 80px;
      font-family: monospace;
    }
    
    table.main-table tbody td:nth-child(3) {
      text-align: center;
      width: 30px;
    }
    
    table.main-table tbody td:nth-child(4) {
      text-align: left;
      padding-left: 6px;
    }
    
    .student-name {
      font-weight: bold;
    }
    
    .student-note {
      font-size: 8pt;
      font-weight: normal;
      display: block;
      color: #555;
    }
    
    .summary-section {
      margin-top: 15px;
      font-size: 10pt;
      page-break-inside: avoid;
    }
    
    .summary-section table {
      width: 100%;
      border-collapse: collapse;
    }
    
    .summary-section td {
      padding: 3px 5px;
      border: 1px solid #000;
    }
    
    .footer {
      margin-top: 20px;
      display: flex;
      justify-content: space-between;
      page-break-inside: avoid;
    }
    
    .footer-left, .footer-right {
      text-align: center;
      width: 45%;
    }
    
    .footer p {
      margin: 3px 0;
      font-size: 10pt;
    }
    
    .signature-space {
      height: 60px;
    }
    
    .signature-space {
      height: 60px;
    }
    
    /* === PRINT WRAPPER: ensures everything fits in one page === */
    #print-area {
      width: 180mm;  /* A4 portrait - 2*15mm margin */
      min-height: 0;
      padding: 0;
      transform-origin: top left;
    }
    
    @media print {
      body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        margin: 0;
        padding: 0;
      }
      
      html, body {
        width: 180mm;
        height: 267mm;
        overflow: hidden; /* Force single page */
      }
      
      .no-print {
        display: none;
      }
    }

.jadwal-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
  }
  .jadwal-card:hover .card-accent {
    height: 6px !important;
  }
  .jadwal-card:hover .btn-input {
    background: #0ea5e9 !important;
    color: #fff !important;
    border-color: #0ea5e9 !important;
  }

.nilai-page-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .nilai-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .nilai-form {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .nilai-table-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .input-grade {
    width: 100%;
    padding: 4px 4px;
    border: 1px solid transparent;
    border-radius: 4px;
    text-align: center;
    font-weight: 700;
    font-size: 12px;
    color: var(--text);
    transition: all 0.2s;
    background: transparent;
  }

  .input-grade:hover {
    background: #f1f5f9;
    border-color: var(--line);
  }

  .input-grade:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primarySoft);
    background: #fff;
    z-index: 10;
    position: relative;
  }

  .grade-row.active-row {
    background: #f0f7ff !important;
  }

  .col-header.active-col {
    background: var(--primary) !important;
    color: #fff !important;
  }

  .grade-bold {
    border-bottom-style: dashed;
  }

  .input-low {
    color: #ef4444 !important;
  }

  .input-perfect {
    color: #10b981 !important;
  }

  #searchSiswa:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primarySoft);
    width: 280px;
  }

  /* Animasi simpan status */
  @keyframes pulse {
    0% {
      opacity: 0.5;
    }

    50% {
      opacity: 1;
    }

    100% {
      opacity: 0.5;
    }
  }

  .need-save {
    opacity: 1 !important;
    animation: pulse 2s infinite;
    color: #f59e0b !important;
  }

.jadwal-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
  }
  .jadwal-card:hover .card-accent {
    height: 6px !important;
  }
  .jadwal-card:hover .btn-input {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
  }

.rekap-row:hover { background: #fcfdfe; }
  .rekap-row td {
    border-bottom: 1px solid var(--line);
    height: 40px;
    vertical-align: middle;
    padding-top: 0;
    padding-bottom: 0;
  }
  .student-name {
    font-weight: 700;
    color: var(--text);
    font-size: 12px;
    line-height: 1.4;
  }

.absensi-page-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .absensi-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  .absensi-form {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .absensi-table-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .abs-rekap-pill {
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    border: 1px solid rgba(0, 0, 0, 0.05);
  }

  .abs-btn {
    width: 36px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-weight: 900;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
  }

  .abs-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--text);
  }

  /* Active States */
  .abs-btn.active[data-val="H"] {
    background: #10b981;
    color: #fff;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
  }

  .abs-btn.active[data-val="I"] {
    background: #f59e0b;
    color: #fff;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
  }

  .abs-btn.active[data-val="S"] {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
  }

  .abs-btn.active[data-val="A"] {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
  }

  .abs-row:hover,
  .abs-row.active-row {
    background: #f0f7ff !important;
  }

  .abs-row td {
    border-bottom: 1px solid var(--line);
    height: 40px;
    vertical-align: middle;
    padding-top: 0;
    padding-bottom: 0;
    transition: background 0.2s;
  }

  .student-name {
    font-weight: 700;
    color: var(--text);
    font-size: 12px;
    line-height: 1.4;
  }

  #searchSiswa:focus {
    width: 250px;
    border-color: var(--primary);
  }

.jadwal-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
  }
  .jadwal-card:hover .card-accent {
    height: 6px !important;
  }
  .jadwal-card:hover .btn-print {
    background: var(--primary) !important;
    color: #fff !important;
    border-color: var(--primary) !important;
  }

/* Quick Access Dashboard Buttons */
.quick-access-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: #f8fafc;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s;
}
.quick-access-btn:hover {
  background: #fff;
  box-shadow: var(--shadow-soft);
}

/* --- OVERRIDE HEADER COLORS FOR VIBRANT BLUE THEME --- */
.table-header-vibrant { 
  background: #eff6ff !important; 
  border-bottom: 2px solid #bfdbfe !important; 
}
.table-header-vibrant th, .table-header-vibrant td { 
  color: #1e40af !important; 
  font-weight: 800; 
}

.card-header-tinted { 
  background: linear-gradient(135deg, #eff6ff, #ffffff) !important; 
  border-bottom: 1px solid #bfdbfe !important; 
}
.card-header-tinted, .card-header-tinted * { 
  color: #1e40af !important; 
}

.bg-gradient-header { 
  background: linear-gradient(to right, #eff6ff, #ffffff) !important; 
  border-bottom: 1px solid #bfdbfe !important; 
}

.bg-gradient-success { 
  background: linear-gradient(to right, #f0fdf4, #ffffff) !important; 
  border-bottom: 1px solid #bbf7d0 !important; 
}

/* ============================================
   PREMIUM FORM CARD
============================================ */
.premium-form-card {
  max-width: 650px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.02);
  border: 1px solid var(--line);
  overflow: hidden;
}

.premium-form-header {
  padding: 24px;
  background: linear-gradient(to right, oklch(98% 0.01 260), oklch(100% 0 0));
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.premium-form-body {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.premium-form-footer {
  padding: 20px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  font-weight: 800;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-label .required {
  color: #ef4444;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  transition: all 0.2s;
  outline: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--primarySoft);
}

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
  padding-right: 40px;
}

.btn-premium-submit {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
  transition: all 0.2s;
}
.btn-premium-submit:hover {
  background: var(--primary2);
  transform: translateY(-1px);
}

.btn-premium-cancel {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-premium-cancel:hover {
  background: #f1f5f9;
}
