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

:root {
  --blue:       #185FA5;
  --blue-dark:  #0C447C;
  --blue-bg:    #E6F1FB;
  --green:      #3B6D11;
  --green-bg:   #EAF3DE;
  --green-bdr:  #9FE1CB;
  --amber:      #854F0B;
  --amber-bg:   #FAEEDA;
  --red:        #A32D2D;
  --red-bg:     #FCEBEB;
  --border:     rgba(0,0,0,0.11);
  --border-md:  rgba(0,0,0,0.20);
  --text:       #1a1a1a;
  --muted:      #5F5E5A;
  --light:      #888780;
  --surface:    #F8F7F3;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; color: var(--text);
  background: var(--surface); min-height: 100vh;
}

/* ===== PAGE SHELL ===== */
.page { display: none; max-width: 700px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.page.active { display: block; }

/* ===== TOPBAR ===== */
.topbar {
  background: white; border-bottom: 0.5px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.topbar-inner {
  max-width: 700px; margin: 0 auto;
  padding: 0 1.25rem; height: 52px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-logo {
  width: 32px; height: 32px; border-radius: var(--r-md);
  background: var(--blue-bg);
  display: flex; align-items: center; justify-content: center;
}
.topbar-title { font-size: 14px; font-weight: 600; }
.topbar-school { font-size: 11px; color: var(--muted); }
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav button {
  background: none; border: none; cursor: pointer;
  padding: 6px 12px; border-radius: var(--r-md);
  font-size: 13px; color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.topbar-nav button:hover,
.topbar-nav button.active { background: var(--blue-bg); color: var(--blue); font-weight: 500; }

/* ===== NAV BACK ===== */
.nav-back { display: flex; align-items: center; gap: 10px; margin-bottom: 1.75rem; }
.btn-back {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: 0.5px solid var(--border-md);
  border-radius: var(--r-md); padding: 6px 12px;
  font-size: 13px; color: var(--muted); cursor: pointer;
  transition: background 0.15s;
}
.btn-back:hover { background: white; color: var(--text); }
.nav-crumb { font-size: 13px; color: var(--light); }

/* ===== HERO ===== */
.hero { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; padding-top: 0.25rem; }
.hero-icon {
  width: 54px; height: 54px; border-radius: var(--r-lg);
  background: var(--blue-bg);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.school-label { font-size: 11px; color: var(--light); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 3px; }
.hero-title { font-size: 22px; font-weight: 700; }
.hero-desc { font-size: 14px; color: var(--muted); line-height: 1.65; margin-bottom: 1.75rem; max-width: 520px; }

/* ===== STATS ===== */
.grid-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 1rem; }
.stat-card {
  background: white; border: 0.5px solid var(--border);
  border-radius: var(--r-md); padding: 1rem; text-align: center;
}
.stat-num { font-size: 28px; font-weight: 700; }
.stat-num.green { color: var(--green); }
.stat-num.amber { color: var(--amber); }
.stat-lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ===== PROGRESS ===== */
.progress-wrap { margin-bottom: 1.75rem; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.progress-bar { height: 6px; background: #D3D1C7; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 99px; transition: width 0.5s ease; }

/* ===== BUTTONS ===== */
.action-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; cursor: pointer;
  border: 0.5px solid transparent; transition: all 0.15s; text-decoration: none;
}
.btn-primary { background: var(--blue); color: white; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-secondary { background: white; color: var(--text); border-color: var(--border-md); }
.btn-secondary:hover { background: var(--surface); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.full-width { width: 100%; justify-content: center; }

/* ===== PAGE TITLE ===== */
.page-title { font-size: 18px; font-weight: 600; margin-bottom: 1.5rem; }

/* ===== FORM ===== */
.form-wrap { max-width: 480px; display: flex; flex-direction: column; gap: 1.1rem; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 13px; font-weight: 500; color: var(--muted); }
select {
  width: 100%; padding: 10px 36px 10px 12px;
  border: 0.5px solid var(--border-md); border-radius: var(--r-md);
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--text); font-size: 14px; appearance: none; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(24,95,165,0.12); }

/* ===== WALI CARD ===== */
.wali-card {
  display: flex; align-items: center; gap: 12px;
  background: white; border: 0.5px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px;
}
.wali-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--blue-bg); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--blue); flex-shrink: 0;
}
.wali-name { font-size: 14px; font-weight: 600; }
.wali-nip  { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ===== UPLOAD ZONE ===== */
.upload-zone {
  border: 1.5px dashed var(--border-md); border-radius: var(--r-md);
  padding: 2rem; text-align: center; cursor: pointer;
  background: white; transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover { border-color: var(--blue); background: var(--blue-bg); }
.upload-zone.has-file { border-color: var(--green-bdr); background: var(--green-bg); border-style: solid; }
.upload-icon { color: var(--light); margin-bottom: 8px; display: block; margin-left: auto; margin-right: auto; }
.upload-zone.has-file .upload-icon { color: var(--green); }
.upload-text { font-size: 14px; color: var(--muted); }
.upload-zone.has-file .upload-text { color: var(--green); font-weight: 600; }
.upload-hint { font-size: 12px; color: var(--light); margin-top: 4px; }

/* ===== ALERT ===== */
.alert { padding: 10px 14px; border-radius: var(--r-md); font-size: 13px; margin-bottom: 1rem; display: none; }
.alert-error   { background: var(--red-bg);   color: var(--red);   border: 0.5px solid #F7C1C1; }
.alert-success { background: var(--green-bg); color: var(--green); border: 0.5px solid var(--green-bdr); }

/* ===== STATUS PAGE ===== */
.status-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.search-input {
  border: 0.5px solid var(--border-md); border-radius: var(--r-md);
  padding: 8px 12px; font-size: 13px; width: 210px;
  background: white; transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(24,95,165,0.12); }

.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; }
.tab {
  padding: 8px 16px; font-size: 13px; cursor: pointer;
  border: none; border-bottom: 2px solid transparent;
  background: none; color: var(--muted); transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

.kelas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.kelas-card {
  background: white; border: 0.5px solid var(--border);
  border-radius: var(--r-md); padding: 12px;
}
.kelas-card.uploaded { border-color: var(--green-bdr); background: var(--green-bg); }
.kls-name  { font-size: 14px; font-weight: 600; }
.kls-wali  { font-size: 11px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kls-time  { font-size: 11px; color: var(--green); margin-top: 8px; display: flex; align-items: center; gap: 3px; }
.kls-wait  { font-size: 11px; color: var(--light); margin-top: 8px; display: flex; align-items: center; gap: 3px; }
.kls-file  { font-size: 10px; color: var(--light); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty-msg { text-align: center; padding: 3rem 0; color: var(--muted); font-size: 14px; }
.loading   { text-align: center; padding: 2rem 0; color: var(--light); font-size: 13px; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #1a1a1a; color: white;
  padding: 12px 18px; border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none; z-index: 999;
  max-width: 300px; box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ===== SPINNER ===== */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: white;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .page { padding: 1.5rem 1rem 3rem; }
  .grid-stats { gap: 8px; }
  .stat-num { font-size: 22px; }
  .action-row { flex-direction: column; }
  .btn { justify-content: center; }
  .status-header { flex-direction: column; align-items: flex-start; }
  .search-input { width: 100%; }
  .topbar-nav button span { display: none; }
}
