/* ==========================================================================
   NOORI PRESCHOOL JUANDA — Portal Guru & Kepala Sekolah
   Design system: friendly-professional, blue + gold, rounded, modern
   ========================================================================== */

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

:root{
  --blue-900:#04234f; /* sampled directly from the Noori Preschool logo background */
  --blue-800:#0c2f60;
  --blue-700:#163f7a;
  --blue-600:#1b4d9e;
  --blue-500:#2159b8;
  --blue-100:#e7edf9;
  --blue-50:#f2f6fc;

  --gold-600:#e8a800;
  --gold-500:#ffc629;
  --gold-100:#fff3d1;
  --gold-50:#fffaeb;

  --ink-900:#131b2c;
  --ink-700:#2b3550;
  --ink-500:#5b6480;
  --ink-300:#95a0bd;
  --ink-100:#e4e8f2;
  --ink-50:#f6f8fc;
  --white:#ffffff;

  --green-600:#1c8a51;
  --green-100:#e2f6ea;
  --red-600:#c8372f;
  --red-100:#fbe6e4;
  --amber-600:#b6790a;
  --amber-100:#fdf0d6;
  --violet-600:#6a45c2;
  --violet-100:#ece5fb;

  --radius-sm:8px;
  --radius-md:14px;
  --radius-lg:20px;
  --radius-pill:999px;

  --shadow-sm:0 1px 2px rgba(19,27,44,.06), 0 1px 1px rgba(19,27,44,.04);
  --shadow-md:0 6px 20px rgba(19,27,44,.08);
  --shadow-lg:0 16px 40px rgba(19,27,44,.14);

  --sidebar-w:264px;
  --header-h:64px;
}

*,*::before,*::after{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  background:var(--ink-50);
  color:var(--ink-900);
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4{ margin:0 0 4px; font-weight:700; letter-spacing:-.01em; }
p{ margin:0 0 8px; color:var(--ink-500); }
a{ color:var(--blue-600); text-decoration:none; }
a:hover{ text-decoration:underline; }
button{ font-family:inherit; }
::selection{ background:var(--gold-100); }

/* ---------------- Layout shell ---------------- */
#app-shell{ display:flex; min-height:100vh; }

.sidebar{
  width:var(--sidebar-w);
  flex-shrink:0;
  background:linear-gradient(180deg,var(--blue-800),var(--blue-900));
  color:var(--white);
  padding:20px 14px 20px;
  position:fixed; top:0; left:0; bottom:0;
  overflow-y:auto;
  z-index:40;
  transition:transform .2s ease;
}
.sidebar-brand{
  display:flex; align-items:center; gap:10px;
  padding:6px 10px 22px;
  border-bottom:1px solid rgba(255,255,255,.12);
  margin-bottom:14px;
}
.sidebar-brand img{ width:38px; height:38px; border-radius:10px; background:#fff; object-fit:contain; padding:3px; }
.sidebar-brand .name{ font-weight:800; font-size:15px; line-height:1.2; }
.sidebar-brand .sub{ font-size:11px; color:var(--gold-500); font-weight:600; letter-spacing:.03em; text-transform:uppercase; }

.nav-group{ margin-bottom:6px; }
.nav-group-label{
  font-size:10.5px; font-weight:700; letter-spacing:.08em; text-transform:uppercase;
  color:rgba(255,255,255,.45); padding:14px 12px 6px;
}
.nav-link{
  display:flex; align-items:center; gap:10px;
  padding:9px 12px; border-radius:var(--radius-sm);
  color:rgba(255,255,255,.82); font-size:13.5px; font-weight:500;
  cursor:pointer; margin-bottom:2px;
}
.nav-link .ic{ font-size:16px; width:18px; text-align:center; }
.nav-link:hover{ background:rgba(255,255,255,.08); text-decoration:none; color:#fff; }
.nav-link.active{ background:var(--gold-500); color:var(--blue-900); font-weight:700; }
.nav-badge{
  margin-left:auto; background:var(--red-600); color:#fff; font-size:10.5px; font-weight:700;
  padding:1px 6px; border-radius:var(--radius-pill); min-width:16px; text-align:center;
}

.main{
  margin-left:var(--sidebar-w);
  flex:1;
  min-width:0;
  display:flex; flex-direction:column;
}

.topbar{
  height:var(--header-h);
  background:var(--white);
  border-bottom:1px solid var(--ink-100);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 24px;
  position:sticky; top:0; z-index:30;
}
.topbar-title{ font-size:17px; font-weight:700; }
.topbar-title .crumb{ font-weight:500; color:var(--ink-500); font-size:13px; display:block; margin-top:-2px; }
.topbar-right{ display:flex; align-items:center; gap:14px; }
.menu-toggle{ display:none; background:none; border:none; font-size:20px; cursor:pointer; color:var(--ink-700); }

.user-chip{ display:flex; align-items:center; gap:9px; padding:5px 10px 5px 5px; border-radius:var(--radius-pill); background:var(--ink-50); cursor:pointer; border:1px solid var(--ink-100);}
.user-chip .avatar{ width:30px; height:30px; border-radius:50%; background:var(--blue-600); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12.5px; }
.user-chip .meta{ line-height:1.15; }
.user-chip .meta .n{ font-size:12.5px; font-weight:700; }
.user-chip .meta .r{ font-size:10.5px; color:var(--ink-500); }

.content{ padding:24px; max-width:1280px; width:100%; margin:0 auto; }

@media (max-width:960px){
  .sidebar{ transform:translateX(-100%); box-shadow:var(--shadow-lg); }
  .sidebar.open{ transform:translateX(0); }
  .main{ margin-left:0; }
  .menu-toggle{ display:block; }
  .content{ padding:16px; }
}

/* ---------------- Page header / toolbar ---------------- */
.page-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin-bottom:18px; flex-wrap:wrap; }
.page-head h1{ font-size:22px; }
.page-head p{ margin:0; font-size:13.5px; }
.toolbar{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }

/* ---------------- Buttons ---------------- */
.btn{
  display:inline-flex; align-items:center; gap:7px;
  padding:9px 16px; border-radius:var(--radius-sm);
  font-size:13.5px; font-weight:600; cursor:pointer;
  border:1px solid transparent; background:var(--white); color:var(--ink-700);
  transition:filter .12s ease, transform .05s ease;
}
.btn:hover{ filter:brightness(.97); }
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:var(--blue-600); color:#fff; }
.btn-primary:hover{ background:var(--blue-700); }
.btn-gold{ background:var(--gold-500); color:var(--blue-900); }
.btn-gold:hover{ background:var(--gold-600); }
.btn-outline{ background:#fff; border-color:var(--ink-100); color:var(--ink-700); }
.btn-ghost{ background:transparent; color:var(--ink-500); }
.btn-ghost:hover{ background:var(--ink-50); }
.btn-danger{ background:var(--red-600); color:#fff; }
.btn-sm{ padding:6px 11px; font-size:12.5px; border-radius:7px; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.btn-icon{ padding:8px; border-radius:var(--radius-sm); }

/* ---------------- Cards ---------------- */
.card{ background:var(--white); border:1px solid var(--ink-100); border-radius:var(--radius-md); box-shadow:var(--shadow-sm); }
.card-pad{ padding:20px; }
.card-head{ display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--ink-100); }
.card-head h3{ font-size:14.5px; }

.stat-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:14px; margin-bottom:20px; }
.stat-card{ background:var(--white); border:1px solid var(--ink-100); border-radius:var(--radius-md); padding:16px 18px; box-shadow:var(--shadow-sm); }
.stat-card .ic{ width:34px; height:34px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:16px; margin-bottom:10px; }
.stat-card .val{ font-size:24px; font-weight:800; line-height:1.1; }
.stat-card .lbl{ font-size:12px; color:var(--ink-500); margin-top:2px; }
.ic-blue{ background:var(--blue-100); color:var(--blue-600); }
.ic-gold{ background:var(--gold-100); color:var(--gold-600); }
.ic-green{ background:var(--green-100); color:var(--green-600); }
.ic-red{ background:var(--red-100); color:var(--red-600); }
.ic-violet{ background:var(--violet-100); color:var(--violet-600); }

/* ---------------- Tables ---------------- */
.table-wrap{ overflow-x:auto; border-radius:var(--radius-md); }
table.data{ width:100%; border-collapse:collapse; background:var(--white); font-size:13.5px; }
table.data th{
  text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.04em;
  color:var(--ink-500); font-weight:700; padding:11px 14px; background:var(--ink-50);
  border-bottom:1px solid var(--ink-100); white-space:nowrap;
}
table.data td{ padding:11px 14px; border-bottom:1px solid var(--ink-100); color:var(--ink-700); vertical-align:middle; }
table.data tr:last-child td{ border-bottom:none; }
table.data tbody tr:hover{ background:var(--blue-50); }
.row-actions{ display:flex; gap:6px; justify-content:flex-end; }
.empty-state{ text-align:center; padding:48px 20px; color:var(--ink-500); }
.empty-state .ic{ font-size:34px; margin-bottom:8px; }

/* ---------------- Badges ---------------- */
.badge{ display:inline-flex; align-items:center; gap:5px; padding:3px 10px; border-radius:var(--radius-pill); font-size:11.5px; font-weight:700; white-space:nowrap; }
.badge-blue{ background:var(--blue-100); color:var(--blue-700); }
.badge-gold{ background:var(--gold-100); color:var(--gold-600); }
.badge-green{ background:var(--green-100); color:var(--green-600); }
.badge-red{ background:var(--red-100); color:var(--red-600); }
.badge-amber{ background:var(--amber-100); color:var(--amber-600); }
.badge-gray{ background:var(--ink-100); color:var(--ink-500); }
.badge-violet{ background:var(--violet-100); color:var(--violet-600); }
.dot{ width:6px; height:6px; border-radius:50%; background:currentColor; }

/* ---------------- Forms ---------------- */
.form-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
.form-grid.cols-1{ grid-template-columns:1fr; }
.form-grid.cols-3{ grid-template-columns:repeat(3,1fr); }
@media (max-width:640px){ .form-grid{ grid-template-columns:1fr !important; } }
.field{ display:flex; flex-direction:column; gap:6px; }
.field.span-2{ grid-column:span 2; }
.field label{ font-size:12.5px; font-weight:600; color:var(--ink-700); }
.field .hint{ font-size:11.5px; color:var(--ink-300); }
input[type=text],input[type=email],input[type=password],input[type=number],
input[type=date],input[type=time],input[type=url],input[type=tel],
select,textarea{
  width:100%; padding:9px 12px; border-radius:var(--radius-sm);
  border:1px solid var(--ink-100); background:var(--white); font-size:13.5px;
  color:var(--ink-900); font-family:inherit;
}
textarea{ resize:vertical; min-height:80px; }
input:focus,select:focus,textarea:focus{ outline:none; border-color:var(--blue-600); box-shadow:0 0 0 3px var(--blue-100); }
.checkbox-row{ display:flex; align-items:center; gap:8px; font-size:13px; color:var(--ink-700); }

.rubric-select{ display:flex; gap:6px; flex-wrap:wrap; }
.rubric-opt{ padding:6px 10px; border-radius:var(--radius-pill); border:1px solid var(--ink-100); font-size:12px; font-weight:600; cursor:pointer; color:var(--ink-500); }
.rubric-opt[data-v=excellent].active{ background:var(--green-100); color:var(--green-600); border-color:var(--green-600); }
.rubric-opt[data-v=good].active{ background:var(--blue-100); color:var(--blue-700); border-color:var(--blue-600); }
.rubric-opt[data-v=satisfactory].active{ background:var(--amber-100); color:var(--amber-600); border-color:var(--amber-600); }
.rubric-opt[data-v=needs_improvement].active{ background:var(--red-100); color:var(--red-600); border-color:var(--red-600); }

/* ---------------- Modal ---------------- */
.modal-backdrop{
  position:fixed; inset:0; background:rgba(13,44,92,.45); backdrop-filter:blur(2px);
  display:flex; align-items:flex-start; justify-content:center; padding:5vh 16px;
  z-index:100; overflow-y:auto;
}
.modal{
  background:var(--white); border-radius:var(--radius-lg); width:100%; max-width:640px;
  box-shadow:var(--shadow-lg); overflow:hidden;
}
.modal.modal-lg{ max-width:860px; }
.modal-head{ display:flex; align-items:center; justify-content:space-between; padding:18px 22px; border-bottom:1px solid var(--ink-100); }
.modal-head h3{ font-size:16px; }
.modal-body{ padding:22px; max-height:68vh; overflow-y:auto; }
.modal-foot{ padding:16px 22px; border-top:1px solid var(--ink-100); display:flex; justify-content:flex-end; gap:10px; }
.modal-close{ background:none; border:none; font-size:18px; cursor:pointer; color:var(--ink-500); }

/* ---------------- Toast ---------------- */
#toast-host{ position:fixed; bottom:20px; right:20px; z-index:200; display:flex; flex-direction:column; gap:10px; }
.toast{ background:var(--ink-900); color:#fff; padding:12px 18px; border-radius:var(--radius-sm); font-size:13px; box-shadow:var(--shadow-lg); display:flex; align-items:center; gap:10px; animation:toast-in .18s ease; }
.toast.success{ background:var(--green-600); }
.toast.error{ background:var(--red-600); }
@keyframes toast-in{ from{ opacity:0; transform:translateY(8px);} to{opacity:1; transform:translateY(0);} }

/* ---------------- Tabs ---------------- */
.tabs{ display:flex; gap:4px; border-bottom:1px solid var(--ink-100); margin-bottom:18px; flex-wrap:wrap; }
.tab{ padding:9px 14px; font-size:13px; font-weight:600; color:var(--ink-500); cursor:pointer; border-bottom:2px solid transparent; }
.tab.active{ color:var(--blue-600); border-color:var(--blue-600); }

/* ---------------- Calendar ---------------- */
.cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.cal-dow{ font-size:11px; font-weight:700; color:var(--ink-500); text-align:center; padding:4px 0; text-transform:uppercase; }
.cal-cell{ background:var(--white); border:1px solid var(--ink-100); border-radius:10px; min-height:86px; padding:6px; font-size:11px; }
.cal-cell.muted{ background:var(--ink-50); color:var(--ink-300); }
.cal-cell .d{ font-weight:700; font-size:12px; margin-bottom:4px; }
.cal-evt{ background:var(--blue-100); color:var(--blue-700); border-radius:6px; padding:2px 5px; margin-bottom:2px; font-weight:600; font-size:10.5px; display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ---------------- Misc ---------------- */
.divider{ height:1px; background:var(--ink-100); margin:16px 0; }
.helper-note{ background:var(--blue-50); border:1px solid var(--blue-100); color:var(--blue-700); border-radius:var(--radius-sm); padding:10px 14px; font-size:12.5px; }
.kepsek-lock-note{ background:var(--gold-50); border:1px solid var(--gold-100); color:var(--gold-600); border-radius:var(--radius-sm); padding:10px 14px; font-size:12.5px; font-weight:600; }
.spinner{ width:20px; height:20px; border:3px solid var(--ink-100); border-top-color:var(--blue-600); border-radius:50%; animation:spin .7s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg); } }
.loading-screen{ min-height:100vh; display:flex; align-items:center; justify-content:center; flex-direction:column; gap:14px; color:var(--ink-500); font-size:13px; }
.avatar-lg{ width:56px; height:56px; border-radius:50%; background:var(--blue-600); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:20px; }
.pill-tab{ padding:5px 12px; border-radius:var(--radius-pill); background:var(--ink-50); border:1px solid var(--ink-100); font-size:12px; font-weight:600; cursor:pointer; color:var(--ink-500); }
.pill-tab.active{ background:var(--blue-600); color:#fff; border-color:var(--blue-600); }

/* ---------------- Auth screen ---------------- */
.auth-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(160deg,var(--blue-900),var(--blue-600) 60%, var(--gold-500)); padding:20px; }
.auth-card{ background:var(--white); border-radius:var(--radius-lg); box-shadow:var(--shadow-lg); width:100%; max-width:380px; padding:32px 28px; }
.auth-card .logo-row{ display:flex; flex-direction:column; align-items:center; gap:10px; margin-bottom:20px; }
.auth-card .logo-row img{ width:64px; }
.auth-card h1{ font-size:18px; text-align:center; }
.auth-card p.sub{ text-align:center; font-size:12.5px; margin-bottom:20px; }
.auth-error{ background:var(--red-100); color:var(--red-600); border-radius:var(--radius-sm); padding:9px 12px; font-size:12.5px; margin-bottom:14px; display:none; }

/* ---------------- Print (weekly bulletin) ---------------- */
@media print{
  .sidebar,.topbar,.toolbar,.no-print{ display:none !important; }
  .main{ margin-left:0 !important; }
  body{ background:#fff; }
  .content{ padding:0; max-width:none; }
}
