/* JARI — lapisan reka bentuk (dimuat terakhir). Gaya papan pemuka sekolah moden: latar lembut,
   kad putih bersudut bulat dengan bayang halus, menu aktif berbentuk pil, ikon dalam bulatan berwarna,
   fon Plus Jakarta Sans (dihoskan sendiri, lesen SIL OFL). Hanya untuk skrin: gaya cetakan kekal. */

@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("./fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2-variations"),
       url("./fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
}

@media screen {
  :root {
    --brand-600: #0d8a76;
    --brand-700: #0b7463;
    --brand-800: #095f52;
    --brand-50: #ecf8f5;
    --brand-100: #d3f0e8;
    --green-800: var(--brand-600);
    --green-700: var(--brand-700);
    --green-100: var(--brand-100);
    --green-50: var(--brand-50);
    --canvas: #f4f6fb;
    --surface: #ffffff;
    --ink: #101828;
    --ink-2: #344054;
    --muted: #667085;
    --line: #eaecf0;
    --line-strong: #d0d5dd;
    --radius: 18px;
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md: 0 12px 24px -8px rgba(16, 24, 40, .10), 0 4px 8px -4px rgba(16, 24, 40, .04);
    --ring: 0 0 0 4px rgba(13, 138, 118, .16);
    font-family: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  }

  body { background: var(--canvas); color: var(--ink); -webkit-font-smoothing: antialiased; }
  h1, h2, h3 { color: var(--ink); }
  h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
  h2 { font-size: 18px; font-weight: 750; letter-spacing: -.01em; }
  p { color: var(--muted); }
  .eyebrow { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
  .step { color: var(--brand-600); font-size: 11px; font-weight: 800; letter-spacing: .1em; }

  /* ---------- Bar sisi ---------- */
  .sidebar { width: 248px; padding: 24px 16px 18px; background: var(--surface); border-right: 1px solid var(--line); box-shadow: none; }
  main { margin-left: 248px; padding: 0 36px 48px; }
  .brand { padding: 4px 8px 26px; gap: 12px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 13px; color: #fff; font-size: 21px; font-weight: 800;
    background: linear-gradient(140deg, #19b39a 0%, var(--brand-600) 55%, var(--brand-800) 100%);
    box-shadow: 0 6px 14px -4px rgba(13, 138, 118, .55), inset 0 1px 0 rgba(255,255,255,.25); }
  .brand strong { color: var(--ink); font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
  .brand small { color: var(--muted); font-size: 12px; font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-list { gap: 4px; }
  .nav-list::before { content: "MENU"; display: block; padding: 0 12px 8px; color: #98a2b3; font-size: 11px; font-weight: 700; letter-spacing: .1em; }
  .nav-item { gap: 12px; padding: 11px 14px; border-radius: 12px; color: var(--ink-2); font-size: 14px; font-weight: 600; box-shadow: none; transition: background .15s ease, color .15s ease; }
  .nav-item .nav-ico { display: grid; place-items: center; width: 20px; height: 20px; font-size: 0; color: #667085; }
  .nav-item:hover { color: var(--ink); background: #f2f4f7; }
  .nav-item.active { color: #fff; background: var(--brand-600); box-shadow: 0 8px 18px -8px rgba(13, 138, 118, .7); }
  .nav-item.active .nav-ico { color: #fff; }
  .sidebar-foot { margin: auto 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #f9fafb; color: var(--muted); font-size: 12px; font-weight: 500; }

  /* ---------- Bar atas ---------- */
  .topbar { padding: 22px 0 18px; gap: 16px; background: rgba(244, 246, 251, .88); backdrop-filter: saturate(160%) blur(14px); }
  .topbar-title { min-width: 0; }
  .top-actions { gap: 10px; }
  .account-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-xs); }
  .public-mode .account-chip { display: none; }
  .account-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; font-size: 13px; font-weight: 800;
    background: linear-gradient(140deg, #6172f3, #444ce7); }
  .account-name { color: var(--ink-2); font-size: 12px; font-weight: 700; }
  .system-notice:not(:empty) { margin: 14px 0 0; padding: 10px 14px; border: 1px solid #fedf89; border-radius: 12px; color: #93370d; background: #fffaeb; font-size: 12px; font-weight: 600; }

  /* ---------- Butang ---------- */
  .button { padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 700; letter-spacing: 0; box-shadow: var(--shadow-xs); }
  .button:hover, .icon-button:hover { transform: none; }
  .button.primary { color: #fff; background: var(--brand-600); border-color: var(--brand-600); box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 6px 14px -6px rgba(13,138,118,.6); }
  .button.primary:hover { background: var(--brand-700); border-color: var(--brand-700); }
  .button.ghost { color: var(--ink-2); background: var(--surface); border-color: var(--line-strong); }
  .button.ghost:hover { background: #f9fafb; }
  .button.danger { color: #b42318; background: #fef3f2; border-color: #fecdca; }
  .button:focus-visible, .icon-button:focus-visible, .nav-item:focus-visible { outline: none; box-shadow: var(--ring); }
  .icon-button { width: 42px; height: 42px; border-color: var(--line-strong); color: var(--ink-2); box-shadow: var(--shadow-xs); }
  .mini-button { border-radius: 10px; }

  /* ---------- Kad statistik ---------- */
  .summary-grid { gap: 16px; margin-bottom: 26px; }
  .metric { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: 14px; align-content: start;
    min-height: 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
  .metric::after { display: none; }
  .metric .metric-ico { grid-row: 1 / 4; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; font-style: normal; }
  .metric .metric-ico svg { width: 22px; height: 22px; }
  .metric span { align-self: end; color: var(--muted); font-size: 12px; font-weight: 600; }
  .metric strong { margin: 4px 0 2px; color: var(--ink); font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
  .metric small { color: #98a2b3; font-size: 11px; font-weight: 600; }
  .metric.accent { color: var(--ink); background: var(--surface); border-color: var(--line); }
  .metric.accent span { color: var(--muted); }
  .metric.accent small { color: #98a2b3; }
  .tone-rose .metric-ico { color: #e31b54; background: #fff1f3; }
  .tone-amber .metric-ico { color: #dc6803; background: #fffaeb; }
  .tone-indigo .metric-ico { color: #444ce7; background: #eef4ff; }
  .tone-emerald .metric-ico { color: #079455; background: #ecfdf3; }

  /* ---------- Panel dan kad ---------- */
  .panel, .absence-card, .teacher-card, .relief-card, .module-head, .quick-card, .filters {
    border-color: var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
  .panel { padding: 24px; }
  .section-head h2 { font-size: 18px; }
  .absence-card { padding: 16px 18px; }
  .absence-card h3, .teacher-card h3 { font-size: 14px; font-weight: 700; }
  .relief-card { padding: 16px 18px; }
  .teacher-card.relief-eligible { border-color: var(--line); background: var(--surface); box-shadow: inset 4px 0 0 #12b76a, var(--shadow-sm); }
  .teacher-card.relief-excluded { border-color: var(--line); background: #fffbfa; box-shadow: inset 4px 0 0 #f04438, var(--shadow-sm); }
  .avatar { border-radius: 12px; font-weight: 800; }
  .teacher-card.relief-eligible .avatar { color: #067647; background: #dcfae6; }
  .teacher-card.relief-excluded .avatar { color: #b42318; background: #fee4e2; }
  .badge { padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .01em; }
  .badge.good { color: #067647; background: #ecfdf3; box-shadow: inset 0 0 0 1px #abefc6; }
  .badge.warn { color: #b54708; background: #fffaeb; box-shadow: inset 0 0 0 1px #fedf89; }
  .badge.neutral { color: #344054; background: #f2f4f7; box-shadow: inset 0 0 0 1px #eaecf0; }
  .alert { border-radius: 14px; }
  .empty-state { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: #fcfcfd; }
  .danger-panel { border-color: #fecdca; }

  /* ---------- Tab dan suis ---------- */
  .relief-tabs { gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #f2f4f7; width: fit-content; max-width: 100%; }
  .relief-toolbar .relief-tabs { border-bottom: 1px solid var(--line); }
  .relief-tab { margin: 0; padding: 9px 18px; border: 0; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 700; }
  .relief-tab.active { color: var(--ink); background: var(--surface); border-bottom-color: transparent; box-shadow: var(--shadow-sm); }
  .segmented, .schedule-switch { border: 1px solid var(--line); border-radius: 12px; background: #f2f4f7; }
  .segmented button, .schedule-switch button { border-radius: 9px; font-weight: 700; }
  .segmented button.active, .schedule-switch button.active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-sm); }

  /* ---------- Borang ---------- */
  input, select, textarea { border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }
  input:focus, select:focus, textarea:focus { border-color: var(--brand-600); box-shadow: var(--ring); }
  input[type="checkbox"], input[type="radio"] { box-shadow: none; accent-color: var(--brand-600); }
  label { color: var(--ink-2); }

  /* ---------- Dialog dan toast ---------- */
  dialog { border-radius: 20px; box-shadow: 0 24px 48px -12px rgba(16, 24, 40, .25); }
  dialog::backdrop { background: rgba(16, 24, 40, .45); backdrop-filter: blur(3px); }
  .dialog-head .close { border-radius: 10px; }
  .toast { border-radius: 12px; background: #101828; box-shadow: 0 20px 24px -4px rgba(16,24,40,.18); font-size: 13px; font-weight: 600; }

  /* ---------- Menu ahli ---------- */
  .member-list li { border-color: var(--line); border-radius: 14px; background: #fcfcfd; }

  /* ---------- Halaman utama (pilih sekolah) ---------- */
  .landing-page { background:
      radial-gradient(900px 480px at 10% -10%, #d3f0e8 0%, transparent 60%),
      radial-gradient(700px 420px at 110% 10%, #e0e7ff 0%, transparent 55%), var(--canvas); }
  .landing { min-height: 0; margin: 0 auto; padding: 36px 28px 30px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.92); box-shadow: var(--shadow-md); }
  .landing h1 { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--ink); font-size: 34px; letter-spacing: .02em; }
  .landing h1::before { content: "J"; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: #fff; font-size: 24px; letter-spacing: 0;
    background: linear-gradient(140deg, #19b39a 0%, var(--brand-600) 55%, var(--brand-800) 100%); box-shadow: 0 8px 18px -6px rgba(13,138,118,.6); }
  .landing-form input { border-color: var(--line-strong); border-radius: 12px; }
  .landing-form .button { border-radius: 12px; padding: 0 22px; }

  .sidebar-actions { display: none; }

  /* ---------- Telefon ---------- */
  @media (max-width: 760px) {
    .topbar { flex-wrap: nowrap; gap: 12px; }
    .top-actions { flex-shrink: 0; }
    .top-actions #logoutButton, .top-actions #helpButton { display: none !important; }
    .sidebar-actions { display: grid; gap: 4px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
    .public-mode .sidebar-actions { display: none; }
    .sidebar-foot { margin-top: 14px; }
    .topbar-title .eyebrow { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    main { margin-left: 0; padding: 0 16px 24px; }
    .sidebar { width: min(288px, 86vw); padding-top: 20px; }
    .topbar { padding: 14px 0 12px; }
    h1 { font-size: 22px; }
    .menu-button { border-color: var(--line); border-radius: 12px; box-shadow: var(--shadow-xs); }
    .account-name { display: none; }
    .account-chip { padding: 3px; }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    /* Paparan awam: 3 kad padat sebaris. */
    .public-mode .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .public-mode .metric { padding: 12px 10px; }
    .public-mode .metric .metric-ico { width: 32px; height: 32px; border-radius: 10px; margin-bottom: 8px; }
    .public-mode .metric .metric-ico svg { width: 16px; height: 16px; }
    .public-mode .metric span { font-size: 11px; }
    .public-mode .metric strong { font-size: 22px; }
    .public-mode .metric small { font-size: 10px; }
    .metric { grid-template-columns: 1fr; padding: 14px; }
    .metric .metric-ico { grid-row: auto; width: 38px; height: 38px; border-radius: 12px; margin-bottom: 10px; }
    .metric .metric-ico svg { width: 19px; height: 19px; }
    .metric strong { font-size: 24px; }
    .panel { padding: 18px; }
    .relief-tabs { width: 100%; }
    .relief-tab { flex: 1; }
  }
}
