/* 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 { border: 1px solid var(--line); border-radius: 12px; background: #f2f4f7; }
  .segmented button { border-radius: 9px; font-weight: 700; }
  .segmented 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; }
  }
}

/* ---------- Halaman utama (log masuk Google) dan /daftar ---------- */
@media screen {
  .entry-page { min-height: 100vh; margin: 0; background:
      radial-gradient(900px 520px at 0% -10%, #d3f0e8 0%, transparent 60%),
      radial-gradient(760px 460px at 110% 0%, #e0e7ff 0%, transparent 55%), var(--canvas); }
  .entry-wrap { min-height: 100vh; display: grid; align-content: center; justify-items: center; gap: 18px; padding: 32px 16px; box-sizing: border-box; }
  .entry-card { width: 100%; max-width: 420px; min-height: 0; margin: 0; padding: 34px 28px 28px; box-sizing: border-box;
    border: 1px solid var(--line); border-radius: 24px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow-md); text-align: center; }
  .entry-logo { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 22px; color: var(--ink); font-size: 22px; font-weight: 800; letter-spacing: .02em; }
  .entry-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #fff; font-size: 21px;
    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); }
  .entry-card h1 { margin: 0 0 8px; font-size: 24px; }
  .entry-lead { margin: 0 0 24px; font-size: 14px; }
  .entry-step { margin: 0 0 20px; font-size: 13px; }
  .entry-google { display: flex; justify-content: center; min-height: 44px; margin-bottom: 8px; }
  .entry-status:empty { display: none; }
  .entry-msg { margin: 14px 0 0; padding: 11px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; text-align: left; }
  .entry-msg.info { color: #175cd3; background: #eff8ff; border: 1px solid #b2ddff; }
  .entry-msg.error { color: #b42318; background: #fef3f2; border: 1px solid #fecdca; }
  .entry-msg.warn { color: #93370d; background: #fffaeb; border: 1px solid #fedf89; }
  .entry-portal { margin: 0 0 14px; }
  .entry-divider { display: flex; align-items: center; gap: 12px; margin: 26px 0 14px; color: #98a2b3; font-size: 12px; font-weight: 600; }
  .entry-divider::before, .entry-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
  .entry-register { display: block; box-sizing: border-box; text-align: center; text-decoration: none; }
  .entry-schools { display: grid; gap: 8px; margin-top: 10px; }
  .entry-school { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; cursor: pointer; font: inherit; }
  .entry-school:hover { border-color: var(--brand-600); background: var(--brand-50); }
  .entry-school strong { color: var(--ink); font-size: 14px; }
  .entry-school small { color: var(--muted); font-size: 12px; }
  .entry-form { display: grid; gap: 14px; text-align: left; }
  .entry-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
  .entry-form input { text-transform: none; }
  .entry-form #regCode { text-transform: uppercase; }
  .entry-who { margin: 0; padding: 10px 12px; border-radius: 12px; color: #067647; background: #ecfdf3; border: 1px solid #abefc6; font-size: 13px; font-weight: 600; }
  .entry-back { display: inline-block; margin-top: 18px; color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; }
  .entry-done { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; color: #079455; background: #dcfae6; font-size: 26px; font-weight: 800; }
  .entry-foot { margin: 0; color: #98a2b3; font-size: 12px; }
}
.entry-foot a { color: var(--muted); font-weight: 600; }

/* ---------- Dialog import senarai guru ---------- */
.import-dialog { display: grid; gap: 12px; padding: 22px; }
.import-dialog > p { margin: 0; font-size: 13px; }
.import-option { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line, #eaecf0); border-radius: 14px; background: #fcfcfd; }
.import-option h3 { margin: 0; font-size: 14px; }
.import-option p { margin: 0; font-size: 12px; }
.import-option label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; }
.import-option textarea { width: 100%; box-sizing: border-box; padding: 9px 11px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.import-option .button { justify-self: start; }
.link-button { padding: 0; border: 0; background: none; color: var(--brand-600, #0d8a76); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
#teacherImportStatus:empty { display: none; }

/* Tab Guru: butang tidak berbalut, nota kecil. */
.section-head .button-row { flex-wrap: wrap; justify-content: flex-end; }
.section-head .button-row .button { white-space: nowrap; }
.teacher-transfer-hint { margin: 4px 0 14px; font-size: 13px; }
.teacher-restore-notice p { margin: 0; }

/* ===== Pembina jadual: ciri berbayar (pelan Pro) ===== */
@media screen {
  .schedule-pane.is-locked > :not(#builderLocked) { display: none !important; }
  .builder-locked { max-width: 560px; margin: 24px auto; padding: 28px 24px; text-align: center; background: var(--surface, #fff); border: 1px solid var(--line, #e2e8f0); border-radius: 20px; box-shadow: 0 10px 30px rgba(15, 23, 42, .06); }
  .builder-locked h2 { margin: 10px 0 8px; }
  .builder-locked p { margin: 0 0 12px; line-height: 1.55; font-size: 15px; }
  .builder-locked .button { margin-top: 6px; text-decoration: none; display: inline-flex; }
  .pro-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #ede9fe; color: #5b21b6; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
  .pro-locked::after { content: "PRO"; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #ede9fe; color: #5b21b6; font-size: 10px; font-weight: 800; letter-spacing: .06em; vertical-align: middle; }
}

/* ===== Wizard persediaan kali pertama ===== */
@media screen {
  /* Semasa persediaan, menu utama disembunyikan: hanya Panduan dan Log keluar kekal. */
  body.setup-mode .nav-item[data-view] { display: none !important; }
  .visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .setup-wizard { max-width: 860px; margin: 0 auto; display: grid; gap: 16px; }
  .setup-head h2 { margin: 4px 0 6px; font-size: 24px; }
  .setup-head p { margin: 0; }
  .setup-review { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
  .setup-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .setup-steps button { width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line, #eaecf0); background: var(--surface, #fff); color: inherit; font: inherit; cursor: pointer; }
  .setup-steps button:disabled { cursor: default; }
  .setup-steps li:not(.current):not(.done) button:disabled { opacity: .55; }
  .setup-steps .current button { border-color: var(--brand-600, #0d8a76); box-shadow: 0 0 0 3px rgba(13, 138, 118, .15); }
  .setup-num { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; background: #f2f4f7; font-weight: 800; font-size: 13px; }
  .setup-steps .current .setup-num { background: var(--brand-600, #0d8a76); color: #fff; }
  .setup-steps .done .setup-num { background: #dcfce7; color: #166534; }
  .setup-step-text { display: grid; min-width: 0; }
  .setup-step-text strong { font-size: 14px; }
  .setup-step-text small { color: var(--ink-3, #667085); font-size: 12px; line-height: 1.3; }
  .setup-body { display: grid; gap: 12px; outline: none; }
  .setup-body h3 { margin: 0; font-size: 18px; }
  .setup-body p { margin: 0; line-height: 1.55; }
  .setup-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .setup-file { cursor: pointer; }
  .setup-result { padding: 12px 14px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--line, #eaecf0); display: grid; gap: 6px; }
  .setup-result.ok { background: #f0fdf4; border-color: #bbf7d0; }
  .setup-result.warn { background: #fffbeb; border-color: #fde68a; }
  .setup-names { color: var(--ink-2, #344054); font-size: 13px; }
  .setup-note { font-size: 14px; }
  .setup-match { display: grid; gap: 8px; }
  .setup-match-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }
  .setup-date { max-width: 320px; }
  .setup-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .setup-chips .chip { border: 1px solid #fcd34d; background: #fff; border-radius: 999px; padding: 5px 10px; font: inherit; font-size: 13px; cursor: pointer; }
  .setup-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .setup-nav-right { display: flex; align-items: center; gap: 10px; text-align: right; }
  .setup-nav-why { font-size: 13px; color: var(--ink-3, #667085); }
  .setup-wizard .button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
  .setup-body p, .setup-body label { font-size: 14px; }
  .setup-finish { justify-self: start; }
  @media (max-width: 720px) {
    .setup-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
    .setup-steps button { flex-direction: column; align-items: center; text-align: center; padding: 8px 4px; gap: 4px; }
    .setup-step-text small { display: none; }
    .setup-step-text strong { font-size: 11px; }
    .setup-match-row { grid-template-columns: 1fr; }
    .setup-head h2 { font-size: 20px; }
  }
}

/* ===== Pengumuman dan mod penyelenggaraan (MABX) ===== */
@media screen {
  .portal-banner { display: grid; gap: 8px; margin: 14px 0 0; }
  .portal-banner-item { margin: 0; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
  .portal-banner-item.info { color: #175cd3; background: #eff8ff; border: 1px solid #b2ddff; }
  .portal-banner-item.warn { color: #93370d; background: #fffaeb; border: 1px solid #fedf89; }
}
@media print { .portal-banner { display: none !important; } }

/* ===== Tetapan: zon bahaya tertutup secara lalai; maklumat akaun di bawah menu ===== */
@media screen {
  .danger-zone > summary { cursor: pointer; font-weight: 700; color: #b42318; list-style: none; display: flex; align-items: center; gap: 8px; }
  .danger-zone > summary::-webkit-details-marker { display: none; }
  .danger-zone > summary::before { content: "▸"; transition: transform .15s ease; }
  .danger-zone[open] > summary::before { transform: rotate(90deg); }
  .danger-zone[open] > summary { margin-bottom: 10px; }
  .danger-zone:not([open]) { padding-top: 14px; padding-bottom: 14px; }
  .sidebar-meta { margin: 8px 4px 0; display: grid; gap: 2px; font-size: 11px; color: var(--ink-3, #667085); overflow-wrap: anywhere; }
}
@media screen { .settings-grid { grid-template-columns: minmax(0, 1fr) !important; } }

/* ===== Logo JARI (huruf "j" dengan titik emas) ===== */
a.entry-logo { text-decoration: none; color: inherit; }

/* Wordmark: "j" logo dalam perkataan JARI */
.j-glyph { display: inline-block; height: 1.058em; width: auto; vertical-align: -.03em; margin-right: .02em; overflow: visible; }
.j-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== Logo 3D JARI di menu sisi dan kad log masuk ===== */
.brand { flex-direction: column; align-items: flex-start !important; gap: 4px !important; }
.brand-logo { display: block; height: 46px; width: auto; }
.entry-logo img { display: block; height: 58px; width: auto; }

/* Status sambungan disembunyikan apabila semuanya normal: maklumat akaun turun ke bawah menu sisi. */
.sidebar-foot.hidden + .sidebar-meta { margin-top: auto; }

/* Skrin Utama: kad ringkasan ialah butang yang membuka skrin Relief. */
button.metric { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
button.metric:hover { border-color: var(--green-800); box-shadow: var(--shadow-sm); }
button.metric:focus-visible { outline: 2px solid var(--green-800); outline-offset: 2px; }
.summary-hint { margin: 0; font-size: 12px; }

/* Paparan Jadual relief: petak draf boleh ditekan untuk menukar guru ganti. */
.relief-preview .relief-print-table td.relief-cell-edit { cursor: pointer; background: #eaf7f1; }
.relief-preview .relief-print-table td.relief-cell-edit:hover { background: #cfeee0; }
/* Slot tanpa guru ganti: merah sehingga diisi, kemudian hijau seperti petak lain. */
.relief-preview .relief-print-table td.relief-cell-missing { color: #9b1c27; background: #fde8ea; }
.relief-preview .relief-print-table td.relief-cell-missing:hover { background: #f9d0d5; }
/* Kumpulan jadual anjal dibezakan dengan warna biru muda. */
.relief-preview .relief-print-flex th, .relief-preview .relief-print-flex td { background: #eef4fb; }
.relief-preview .relief-print-flex .relief-print-name-caption { color: #1d4f8a; }
.relief-preview .relief-print-table td.relief-cell-edit:focus-visible { outline: 2px solid var(--green-800); outline-offset: -2px; }
#reliefPickBody label { display: grid; gap: 6px; margin-bottom: 12px; font-weight: 600; }
/* Relief diterbitkan: butang Tukar di sebelah nama guru ganti. */
.relief-edit-button { margin-left: 10px; padding: 5px 12px; font-size: 12px; }
/* Selaras dengan PDF: header MASA berlatar kelabu, sempadan tebal antara guru. */
.relief-preview .relief-print-table thead th { background: #eef0f3; border-bottom: 2px solid #475467; }
.relief-preview .relief-print-group + .relief-print-group { border-top: 2px solid #475467; }
.class-pdf-status { margin: -4px 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface); font-size: 13px; }

/* Jadual Aktif: status import, guru lapang dan sejarah versi. */
.import-status { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: -4px 0 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 13px; }
.import-item b { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 4px; border-radius: 50%; font-size: 11px; color: #fff; }
.import-item.ok b { background: #12805c; }
.import-item.missing b { background: #b54708; }
.import-item.missing { color: #b54708; }
.free-view > p { margin: 0 0 10px; font-size: 12px; }
.free-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.free-table th, .free-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.free-table thead th { font-size: 12px; color: var(--muted); background: #f2f4f7; }
.free-table tbody th { width: 92px; white-space: nowrap; }
.free-table tbody th b { display: block; font-size: 15px; }
.free-table tbody th small { color: var(--muted); font-weight: 600; font-size: 11px; }
.free-table .free-count { width: 56px; font-weight: 800; color: #12805c; }
.free-chip { display: inline-block; margin: 2px 4px 2px 0; padding: 3px 9px; border: 1px solid #b7e4cf; border-radius: 999px; background: #eaf7f1; font-size: 12px; font-weight: 600; }
.free-chip.not-eligible { border-color: var(--line); background: #f2f4f7; color: #98a2b3; }
.version-history { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.version-history summary { cursor: pointer; font-weight: 700; }
.version-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13px; }
.version-table th, .version-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.version-table th { color: var(--muted); font-size: 12px; }
.version-table tr.is-active td { font-weight: 700; color: #12805c; }
.free-table tbody td:last-child { white-space: normal; min-width: 0; }
.free-view .table-wrap { overflow-x: visible; }

/* Import jadual guru / kelas sebagai kad popup. */
.dialog-pad { padding: 25px; }
.import-popup { width: min(560px, calc(100% - 28px)); max-height: calc(100vh - 40px); overflow: auto; }
#scheduleImportDialog:has(#importReview:not(.hidden)) { width: min(860px, calc(100% - 28px)); }
.import-popup .import-steps { display: grid; gap: 18px; }
/* Grid tidak boleh melebar mengikut jadual semakan yang panjang: jadual itu diskrol dalam popup. */
.import-popup .import-step, .import-popup .import-steps { min-width: 0; }
.import-popup .table-wrap { max-width: 100%; }
.import-popup .mini-stats { grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); }
.import-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.import-bulk .button { min-height: 38px; }
.import-popup .import-step > p:first-child { margin-top: 0; }
.import-popup .dropzone { margin: 14px 0; }
.import-popup .class-pdf-status { margin: 14px 0 0; padding: 12px 14px; border: 1px solid var(--line); background: #f9fafb; }
/* Kad Jadual aktif: tajuk dan status import di kiri, butang import di kanan. */
.active-head { align-items: flex-start; }
.active-head-copy { min-width: 0; }
.active-head .import-status { flex-direction: column; gap: 5px; margin: 8px 0 0; padding: 0; border: 0; background: none; }

/* Relief: had harian tarikh ini, gabung kelas dan jadual anjal. */
.relief-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
#dayLimitButton.is-custom { color: #85560e; border-color: #e7c27a; background: #fff8e8; }
.link-button { padding: 0; border: 0; color: var(--brand, #0f6b58); background: none; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.candidate .badge.warn { margin: 6px 6px 0 0; }
.day-limit-number { margin: 0 0 8px; }
.day-limit-number input { max-width: 120px; font-size: 18px; font-weight: 700; }
.day-limit-hint { margin: 0; font-size: 13px; }
.flex-dialog { width: min(680px, calc(100% - 28px)); }
.flex-dialog .dialog-pad { padding: 25px; }
.flex-step { margin: 18px 0 8px; font-size: 14px; }
.flex-checks { display: grid; gap: 8px; }
.flex-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-button { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; color: #42534f; background: #fff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.flex-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
.flex-check input { width: 17px; height: 17px; min-height: auto; }
/* Kumpulan tahun ringkas: butang "Tahun 2 · 2/2"; yang dibuka mengambil satu baris penuh. */
.flex-years { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.flex-year { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.flex-year[open] { grid-column: 1 / -1; }
.flex-year summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; font-weight: 700; cursor: pointer; list-style: none; }
.flex-year summary::-webkit-details-marker { display: none; }
.flex-year summary::after { content: "▾"; color: var(--muted); font-size: 11px; }
.flex-year[open] summary::after { content: "▴"; }
.flex-year-count { margin-left: auto; padding: 1px 8px; border-radius: 999px; font-size: 11px; color: #4b5b57; background: #eef2f1; }
.flex-year.all .flex-year-count { color: #0f6b58; background: #dcf3ea; }
.flex-year.some .flex-year-count { color: #85560e; background: #fff0cf; }
.flex-year-body { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 4px 12px 12px; border-top: 1px solid var(--line); }
.flex-year-all { flex-basis: 100%; padding-top: 6px; color: #0f6b58; }
.flex-teacher-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; max-height: 220px; overflow: auto; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; }
#flexAllocate { margin-top: 16px; }
.flex-assign-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 12px; }
.flex-assign { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; margin: 0; }
.flex-assign span { overflow-wrap: anywhere; }
.flex-warning { margin: 8px 0; padding: 9px 12px; border-radius: 10px; color: #85560e; background: #fff4dc; font-size: 12px; font-weight: 700; }
.flex-extra { margin-top: 12px; font-size: 12px; line-height: 1.5; }
.danger-text { color: #b83d45; margin-right: auto; }
.flex-summary { margin: 0 0 14px; padding: 14px 16px; border: 1px solid #cfe3dc; border-radius: 14px; background: #f3faf7; }
.flex-summary-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.flex-summary-head small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.flex-summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-top: 10px; }
.flex-summary-grid div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 9px; border-radius: 9px; background: #fff; font-size: 12px; }
.flex-summary-grid span { color: var(--muted); }
.flex-summary-grid small.flex-combined { display: block; color: var(--accent, #0f766e); font-weight: 600; }
@media (max-width: 760px) {
  .relief-tools { justify-content: stretch; }
  .relief-tools .button { flex: 1 1 auto; }
  .flex-dialog .dialog-pad { padding: 18px; }
  .flex-dialog .dialog-actions { flex-wrap: wrap; }
  .flex-dialog .dialog-actions .button { flex: 1 1 auto; }
}


/* Jadual anjal bersesi. */
.chip-button.active { color: #fff; border-color: var(--brand, #0f6b58); background: var(--brand, #0f6b58); }
.flex-shift-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.flex-shift-chip { padding: 5px 10px; border-radius: 9px; background: #f3faf7; font-size: 12px; font-weight: 700; }
.flex-shift { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; }
.flex-shift > span { font-size: 12px; font-weight: 800; }
.flex-shift label { display: flex; align-items: center; gap: 5px; margin: 0; font-weight: 600; }
.flex-shift input { width: 58px; min-height: 34px; padding: 4px 6px; }
.flex-assign { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; margin: 0; }
.flex-assign-shifts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
.flex-assign-shifts label { margin: 0; gap: 2px; }
.flex-assign-shifts small { color: var(--muted); font-size: 10px; font-weight: 700; }
.flex-assign-list.multi { grid-template-columns: 1fr; }
.flex-assign-list.multi .flex-assign { padding: 8px 0; border-bottom: 1px solid var(--line); }
.flex-summary-grid.multi { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.flex-summary-grid strong small { color: var(--muted); font-weight: 600; }
.flex-summary-grid.multi strong { text-align: right; }
@media (max-width: 760px) {
  .flex-assign { grid-template-columns: 1fr; }
}

/* Tetapan jadual guru prasekolah: Subjek atau Aktiviti, dan aktiviti sekolah yang dikesan. */
.preschool-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.preschool-choices .button { flex: 1 1 110px; }
.setting-activity { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 6px 0 0; padding: 10px 12px; border-radius: 10px; background: #eef4fb; font-size: 12px; }
.setting-activity p { margin: 0; }

/* Menu Utama: teks tarikh ringkasan itu sendiri boleh ditekan untuk memilih tarikh (sama dengan tarikh
   skrin Relief). Kotak tarikh sebenar tidak kelihatan dan menutupi teks supaya kalendar telefon terbuka. */
.summary-date-pick { position: relative; display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 0; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; }
.summary-date-pick svg { color: #0f6b58; }
.summary-date-pick span { border-bottom: 1px dashed currentColor; }
.summary-date-pick input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }

/* Demo (/demo): jalur makluman di atas, dan bahagian yang memerlukan server disembunyikan. */
.demo-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 0 14px; padding: 12px 16px; border: 1px solid #f3d38b; border-radius: 14px; background: #fff8e8; color: #6b4a0b; font-size: 13px; line-height: 1.5; }
.demo-banner p { margin: 0; flex: 1 1 320px; }
.demo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-actions .button { min-height: 38px; padding: 8px 14px; font-size: 13px; text-decoration: none; }
body.demo-mode #membersPanel, body.demo-mode .danger-zone, body.demo-mode .sidebar-foot { display: none !important; }
@media (max-width: 760px) {
  .demo-actions { width: 100%; }
  .demo-actions .button { flex: 1 1 auto; }
}

/* Bantuan "?": penerangan tersembunyi, dibuka dengan butang kecil di sebelah tajuk. */
.help-text { display: none !important; }
.help-text.open { display: block !important; margin: 8px 0 12px; padding: 10px 12px; border-radius: 12px; background: #ecfdf7; border: 1px solid #c7efe3; color: #344054; font-size: 14px; line-height: 1.5; font-weight: 400; letter-spacing: 0; text-transform: none; }
.help-btn { display: inline-grid; place-items: center; width: 22px; height: 22px; min-height: 0; padding: 0; margin-left: 4px; border: 1px solid #b7e4d6; border-radius: 50%; background: #fff; color: #0d8a76; font-family: inherit; font-size: 13px; font-weight: 700; line-height: 1; letter-spacing: 0; vertical-align: middle; cursor: pointer; box-shadow: none; flex: 0 0 auto; }
.help-btn:hover, .help-btn[aria-expanded="true"] { background: #0d8a76; border-color: #0d8a76; color: #fff; }
.help-btn:focus-visible { outline: none; box-shadow: var(--ring); }

/* Tetapan → Pengguna: senarai ringkas dan butang tambah; borang dalam popup. */
.member-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.member-head h2 { margin: 0; }
.member-head .member-seats { margin: 4px 0 0; color: var(--muted); font-weight: 600; }
.member-dialog .member-form { gap: 12px; }
.member-dialog .member-form small { color: var(--muted); }
@media (max-width: 560px) { .member-head > .button { width: 100%; } }
.member-head > .button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
