/* =====================================================================
   Portal Pengakap Melaka — v1.0
   Bahasa reka bentuk diambil daripada KePin PPMNM: latar kelabu cerah,
   kad putih bersempadan nipis, tab bergaris emas, Poppins + Oswald,
   kad kategori berpita. Templat dokumen (.doc) sama seperti KePin.
   ===================================================================== */

:root {
  /* Jenama (KePin) */
  --navy: #1a1478;
  --navy-2: #2b2394;
  --navy-50: #eef0f8;
  --navy-100: #e8e7fb;
  --navy-200: #d6d3f6;
  --navy-300: #8f88e0;
  --red: #d61f2c;
  --red-50: #fdecee;
  --gold: #e2a40c;
  --gold-50: #fff4d9;
  --gold-200: #f0d48a;
  --gold-800: #7a5200;
  --blue: #2b6cb0;
  --violet: #7c3aed;
  --slate: #64748b;
  --label: #1e3a8a;

  /* Asas */
  --bg: #f4f5fa;
  --card: #fff;
  --line: #e2e4ef;
  --txt: #171a2e;
  --mut: #5d6178;

  /* Status */
  --ok: #1d7a46;
  --ok-50: #e3f4ea;
  --warn: #a86b00;
  --warn-50: #fff4d9;
  --bad: #b3261e;
  --bad-50: #fdecee;

  /* Bahagian (carta) — palet disahkan CVD */
  --sec-kanak: #3B8FD9;
  --sec-muda: #1F7A55;
  --sec-remaja: #E3A33A;
  --sec-kelana: #7B4FC0;

  --r: 16px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 60, .04);
  --shadow-lg: 0 6px 18px rgba(20, 20, 60, .08);
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-cond: 'Oswald', 'Arial Narrow', sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  /* Lebar penuh di laptop/desktop; had 2000px hanya untuk skrin ultra-lebar */
  --wrap: 2000px;
  --gut: clamp(14px, 2.6vw, 44px);
  --mb: 0px;
}

/* ---------- Asas ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--txt); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
ul { margin: 0; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.lucide { width: 16px; height: 16px; flex: none; stroke-width: 2; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--mut); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sp { flex: 1; }
.center { text-align: center; }

/* ---------- Kepala (gaya KePin) ---------- */
.top { background: #fff; }
.top__in { max-width: var(--wrap); margin: 0 auto; padding: 20px var(--gut) 0; }
.brand { display: flex; align-items: center; gap: 18px; }
.brand__home { flex: none; }
.brand__logo { height: 58px; width: auto; }
.brand__mark { display: none; height: 42px; width: auto; }
.brand__t { flex: 1; min-width: 0; border-left: 2px solid var(--line); padding-left: 18px; }
.brand h1 { font-size: 26px; font-weight: 800; font-style: italic; color: var(--navy); letter-spacing: .2px; line-height: 1.1; }
.brand h1 small { display: block; font-family: var(--font-cond); font-style: normal; font-weight: 600; font-size: 21px; color: var(--red); letter-spacing: .6px; text-transform: uppercase; margin-top: 3px; }
.brand__110 { height: 62px; width: auto; flex: none; }
.intro { margin: 12px 0 0; color: var(--mut); font-size: 13.5px; max-width: 680px; }

.user { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--txt); background: #fff; flex: none; }
.user:hover { border-color: var(--navy-300); }
.user b { display: block; font-size: 12.5px; line-height: 1.25; }
.user small { display: block; font-size: 11px; color: var(--mut); line-height: 1.25; }

.tabbar { position: sticky; top: var(--mb); z-index: 30; background: #fff; border-bottom: 1px solid var(--line); }
.tabbar__in { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gut); display: flex; align-items: center; gap: 12px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; border-bottom: 3px solid transparent; color: var(--mut); padding: 12px 14px 11px; font-weight: 600; white-space: nowrap; font-size: 13.5px; text-decoration: none; }
.tabs a:hover { color: var(--navy); }
.tabs a.is-on { color: var(--navy); border-bottom-color: var(--gold); }
.tabs .cnt { background: var(--red); color: #fff; border-radius: 10px; font-size: 10.5px; padding: 0 6px; line-height: 17px; }
/* Laptop: semua tab mesti kelihatan (tiada bar skrol pada tetikus) — rapatkan, dan turun ke baris kedua jika masih tidak muat */
@media (min-width: 901px) { .tabs { flex-wrap: wrap; overflow-x: visible; } }
@media (min-width: 901px) and (max-width: 1600px) { .tabs a { padding: 12px 9px 11px; gap: 5px; font-size: 13px; } }
@media (min-width: 901px) and (max-width: 1440px) { .tabs { gap: 0; } .tabs a { padding: 12px 7px 11px; gap: 4px; } }
@media (min-width: 901px) and (max-width: 1366px) { .tabs a { font-size: 12.5px; padding: 12px 6px 11px; } .tabs a svg { width: 15px; height: 15px; } }

/* ---------- Kandungan ---------- */
.main { max-width: var(--wrap); margin: 0 auto; padding: 22px var(--gut) 60px; }
.page-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ptitle { color: var(--navy); font-size: 21px; font-weight: 700; }
.psub { color: var(--mut); font-size: 13px; margin-top: 2px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 14px; font-size: 17px; font-weight: 700; color: var(--txt); }
.card h2 small { font-weight: 500; color: var(--mut); font-size: 12.5px; }
.card__h { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card__h h2 { margin: 0; }

.grid { display: grid; gap: 14px; margin-bottom: 16px; }
.grid > .card, .grid > section.card { margin-bottom: 0; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g12 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.span-all { grid-column: 1 / -1; }

.eyebrow { display: inline-block; font-size: 11px; font-weight: 700; color: var(--label); text-transform: uppercase; letter-spacing: .9px; }
.display, .card .display { font-size: 34px; font-weight: 800; color: var(--navy); line-height: 1.15; margin: 8px 0 10px; letter-spacing: -.2px; }
.display em { font-style: italic; color: var(--red); }
.display.sm, .card .display.sm { font-size: 26px; }
.lead { color: var(--mut); font-size: 15px; max-width: 60ch; }
.detect { margin-top: 8px; font-size: 12px; color: var(--mut); }

/* ---------- Borang ---------- */
label, .lbl { display: block; font-size: 11.5px; font-weight: 700; color: var(--label); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .8px; }
label small, .lbl small { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--mut); }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; color: var(--txt);
}
textarea { min-height: 90px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c9c6f2; border-color: var(--navy-300); }
input:disabled { background: var(--navy-50); color: var(--mut); }
.check { display: flex; align-items: flex-start; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; color: var(--txt); cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--navy); width: 16px; height: 16px; flex: none; }

/* ---------- Butang ---------- */
.btn { border: 0; border-radius: var(--r-sm); padding: 10px 16px; min-height: 40px; font-weight: 600; cursor: pointer; background: var(--navy); color: #fff; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: 14px; white-space: nowrap; }
.btn:hover { background: var(--navy-2); }
.btn.gold { background: var(--gold-50); color: var(--gold-800); box-shadow: inset 0 0 0 1px var(--gold-200); }
.btn.gold:hover { background: #ffecbd; }
.btn.lite { background: var(--navy-50); color: var(--navy); }
.btn.lite:hover { background: var(--navy-100); }
.btn.red { background: var(--red-50); color: var(--bad); }
.btn.ok { background: var(--ok-50); color: var(--ok); }
.btn.ok:hover { background: #d3eddd; }
.btn.sm { padding: 6px 11px; min-height: 34px; font-size: 12.5px; }
.btn.lg { padding: 12px 20px; min-height: 48px; font-size: 15px; }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- Statistik (kad KPI KePin) ---------- */
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; border-top: 4px solid var(--navy); }
.grid > .stat:nth-child(5n+2) { border-top-color: var(--red); }
.grid > .stat:nth-child(5n+3) { border-top-color: var(--gold); }
.grid > .stat:nth-child(5n+4) { border-top-color: var(--navy-2); }
.grid > .stat:nth-child(5n+5) { border-top-color: var(--red); }
.stat > span { font-size: 11px; color: var(--label); font-weight: 700; text-transform: uppercase; letter-spacing: .8px; }
.stat > b { display: block; font-size: 28px; font-weight: 700; color: var(--navy); margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat > small { display: block; color: var(--mut); font-weight: 500; margin-top: 2px; font-size: 12px; }
.up { color: var(--ok); font-weight: 700; }

/* ---------- Carta bar (gaya KePin) ---------- */
.bar { display: flex; align-items: center; gap: 8px; margin: 7px 0; font-size: 12.5px; }
.bar .l { width: 170px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .l i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 7px; vertical-align: -1px; }
.bar .t { flex: 1; background: var(--navy-50); border-radius: 6px; height: 14px; overflow: hidden; }
.bar .f { display: block; height: 100%; width: 0; background: var(--c, linear-gradient(90deg, var(--navy), #6b63d8)); border-radius: 6px; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar .n { width: 58px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar .n small { display: block; font-weight: 500; color: var(--mut); font-size: 11px; line-height: 1.1; }
.bar.pick { cursor: pointer; border-radius: 8px; padding: 3px 6px; margin: 4px -6px; }
.bar.pick:hover { background: var(--navy-50); }
.bar.is-dim { opacity: .45; }
.bar.is-sel .l { font-weight: 700; color: var(--navy); }

/* Carta garis SVG */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line); }
.chart .axis-label { fill: var(--mut); font-size: 11px; font-family: var(--font); }
.chart .series { fill: none; stroke: var(--navy); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--navy); stroke: #fff; stroke-width: 2; }
.chart .end-label { fill: var(--txt); font-size: 12px; font-weight: 700; font-family: var(--font); }
.chart .xhair { stroke: var(--navy-300); stroke-dasharray: 3 3; opacity: 0; }
.chart .hover-dot { fill: var(--navy); stroke: #fff; stroke-width: 2; opacity: 0; pointer-events: none; }
.chart .hit { cursor: crosshair; }

.tt { position: fixed; z-index: 80; pointer-events: none; background: #171a2e; color: #fff; padding: 7px 10px; border-radius: 8px; font-size: 12.5px; line-height: 1.4; opacity: 0; transition: opacity .12s; max-width: 240px; }
.tt.is-on { opacity: 1; }

/* ---------- Jadual, lencana teks, senarai ---------- */
.dt-wrap { overflow-x: auto; margin: 0 -4px; }
table.dt { width: 100%; border-collapse: collapse; font-size: 13px; }
table.dt th { background: #f0f1f8; text-align: left; padding: 9px 8px; font-size: 11.5px; color: var(--navy); font-weight: 700; white-space: nowrap; }
table.dt th:first-child { border-radius: 8px 0 0 8px; }
table.dt th:last-child { border-radius: 0 8px 8px 0; }
table.dt td { border-top: 1px solid var(--line); padding: 9px 8px; vertical-align: middle; }
table.dt tr:first-child td { border-top: 0; }
table.dt .r, table.dt .num { text-align: right; }
table.dt tr.tot td { background: #f7f8fc; font-weight: 700; }
table.dt.mini td { padding: 5px 6px; }
table.dt.mini input, table.dt.mini select { min-height: 34px; padding: 6px 8px; font-size: 13px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; line-height: 1.6; }
.b0 { background: var(--bad-50); color: var(--bad); }
.b1 { background: var(--warn-50); color: var(--warn); }
.b2 { background: var(--ok-50); color: var(--ok); }
.b3 { background: var(--navy-100); color: var(--navy); }
.b4 { background: #eef0f4; color: var(--mut); }
.badge.sec { background: #fff; color: var(--txt); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.badge.sec::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

.list > .li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); transition: opacity .3s, transform .3s; }
.list > .li:first-child { border-top: 0; padding-top: 2px; }
.li__ic { width: 38px; height: 38px; border-radius: 10px; background: var(--navy-50); color: var(--navy); display: grid; place-items: center; flex: none; }
.li__ic.r { background: var(--red-50); color: var(--red); }
.li__ic.g { background: var(--gold-50); color: var(--gold-800); }
.li__ic.o { background: var(--ok-50); color: var(--ok); }
.li__ic.b { background: #e6eef8; color: var(--blue); }
.li__main { flex: 1; min-width: 0; }
.li__main b { display: block; font-size: 13.5px; font-weight: 600; }
.li__main small { display: block; color: var(--mut); font-size: 12px; }
.li__act { display: flex; gap: 6px; flex: none; }
.li.is-gone { opacity: 0; transform: translateX(14px); }

.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person b { display: block; font-size: 13.5px; font-weight: 600; }
.person small { display: block; color: var(--mut); font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }

.progress { height: 8px; background: var(--navy-50); border-radius: 6px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--navy), #6b63d8); border-radius: 6px; }

.ring { --p: 50; width: 110px; aspect-ratio: 1; border-radius: 50%; background: conic-gradient(var(--navy) calc(var(--p) * 1%), var(--navy-50) 0); display: grid; place-items: center; flex: none; }
.ring::before { content: ''; grid-area: 1 / 1; width: 76%; aspect-ratio: 1; border-radius: 50%; background: #fff; }
.ring > span { grid-area: 1 / 1; position: relative; font-weight: 700; font-size: 22px; color: var(--navy); }

.kv > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.kv > div:first-child { border-top: 0; padding-top: 0; }
.kv > div > b { min-width: 0; max-width: 60%; text-align: right; overflow-wrap: anywhere; }
.kv .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 8px; }

/* ---------- Nota (KePin) ---------- */
.note { background: #fff8e6; border: 1px solid #f1dfa8; border-radius: 12px; padding: 10px 13px; font-size: 12.5px; color: #7a5a00; }
.note.ok { background: #e9f6ee; border-color: #bfe3cc; color: #1d6b3e; }
.note.info { background: #eef0fb; border-color: #d3d6f3; color: var(--navy); }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 14px; font-size: 13px; }
.banner b { display: block; font-size: 14px; }

/* ---------- Pil, cip, kad program ---------- */
.subs { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 7px 13px; min-height: 36px; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--txt); }
.pill:hover { border-color: var(--navy-300); }
.pill.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.chip { background: var(--navy-100); color: var(--navy); border-radius: 16px; padding: 3px 4px 3px 10px; font-size: 12px; font-weight: 600; display: inline-flex; gap: 5px; align-items: center; }
.chip.plain { padding: 4px 10px; }
.chip.warn { background: var(--warn-50); color: var(--warn); box-shadow: inset 0 0 0 1px var(--gold-200); }
.chip button { cursor: pointer; width: 20px; height: 20px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--navy-200); color: var(--navy); font-weight: 700; font-size: 12px; line-height: 1; padding: 0; }
.chip.warn button { background: var(--gold-200); color: var(--gold-800); }
.chips select { width: auto; max-width: 230px; min-height: 30px; padding: 4px 6px; font-size: 12px; }

.pcard { border: 1px solid var(--line); border-radius: var(--r); padding: 18px; background: #fff; display: flex; flex-direction: column; gap: 4px; }
.pcard h4 { margin: 8px 0 2px; font-size: 15.5px; font-weight: 700; color: var(--txt); line-height: 1.35; }
.pcard .meta { font-size: 12px; color: var(--mut); margin-bottom: 10px; }
.pcard .row:last-child { margin-top: auto; }
.due { font-size: 12px; color: var(--mut); }
.due b { color: var(--red); font-size: 15px; }

/* ---------- Kad kategori berpita (KePin) ---------- */
.kat { position: relative; display: block; width: 100%; text-align: left; font: inherit; color: inherit; text-decoration: none; border: 1.5px solid var(--line); border-radius: 18px; padding: 22px 22px 18px; cursor: pointer; background: #fff; transition: box-shadow .2s, border-color .2s; }
.kat:hover { box-shadow: var(--shadow-lg); }
.kat.on { border-color: var(--navy-300); box-shadow: 0 0 0 3px var(--navy-100); }
.kat::after { content: ''; position: absolute; top: -1px; right: 26px; width: 52px; height: 58px; background: var(--kc); clip-path: polygon(0 0, 100% 0, 100% 72%, 50% 100%, 0 72%); }
.kat .lb { display: block; font-size: 11px; font-weight: 700; color: var(--label); letter-spacing: .9px; text-transform: uppercase; padding-right: 70px; }
.kat h3 { margin: 8px 0 6px; color: var(--txt); font-size: 18.5px; font-weight: 700; line-height: 1.25; padding-right: 60px; }
.kat p { margin: 0 0 8px; font-size: 13px; color: var(--mut); }
.kat ul { margin: 0 0 12px; padding-left: 18px; font-size: 12.5px; color: var(--mut); }
.kat .go { font-weight: 700; color: var(--navy); font-size: 14px; }
.katg { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.katg.sm { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.katg.sm .kat { padding: 20px 18px 16px; }
.katg.sm .kat h3 { font-size: 17px; }

/* Jalur tiga warna (biru · merah · emas) */
.tri { height: 4px; background: linear-gradient(90deg, var(--navy) 0 33.3%, var(--red) 33.3% 66.6%, var(--gold) 66.6%); }

/* ---------- Laman awam ---------- */
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; align-items: center; padding: 34px 36px; }
.hero > .tri { position: absolute; top: 0; left: 0; right: 0; }
.hero__art { display: grid; place-items: center; }
.disc { width: min(100%, 260px); aspect-ratio: 1; border-radius: 50%; background: var(--navy-50); display: grid; place-items: center; box-shadow: inset 0 0 0 12px #fff, 0 0 0 1px var(--line); }
.disc img { width: 60%; }

.anniv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 28px; align-items: center; }
.anniv__art { background: var(--navy-50); border-radius: 14px; padding: 28px; display: grid; place-items: center; }
.anniv__art img { width: min(100%, 320px); }
.anniv .grid { margin: 16px 0; }

.verify { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.search-row { display: flex; gap: 8px; margin-top: 12px; }
.search-row input { flex: 1; }
.results { margin-top: 12px; display: grid; gap: 8px; }
.results__empty { padding: 16px; border: 1px dashed var(--line); border-radius: 12px; color: var(--mut); font-size: 13px; text-align: center; }
.result { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfe; }
.result b { display: block; font-size: 13.5px; }
.result small { color: var(--mut); font-size: 12px; }

.cert-stage { background: var(--navy-50); border-radius: 14px; padding: 22px; }
.cert { position: relative; aspect-ratio: 1.414; background: #fff; box-shadow: 0 10px 30px -12px rgba(20, 20, 60, .3); padding: 5% 7%; display: flex; flex-direction: column; align-items: center; text-align: center; outline: 2px solid var(--navy); outline-offset: -9px; }
.cert__mark { width: 11%; }
.cert__kicker { font-size: 9px; letter-spacing: .8px; text-transform: uppercase; color: var(--label); font-weight: 700; margin-top: 6px; }
.cert__title { font-family: var(--font-cond); font-weight: 600; font-size: 21px; color: var(--red); text-transform: uppercase; letter-spacing: 1px; }
.cert__name { font-size: 17px; font-weight: 800; font-style: italic; color: var(--navy); margin-top: 5%; }
.cert__line { width: 60%; height: 1px; background: var(--line); margin: 6px 0; }
.cert__prog { font-size: 10px; color: var(--mut); max-width: 82%; }
.cert__foot { margin-top: auto; width: 100%; display: flex; justify-content: space-between; align-items: flex-end; }
.cert__serial { font-size: 8.5px; text-align: left; color: var(--mut); line-height: 1.4; }
.cert__serial b { display: block; font-family: var(--mono); color: var(--txt); font-size: 9px; }
.cert__qr { width: 15%; }
.tpl-stage { background: var(--navy-50); border-radius: 12px; padding: 18px; }
.tpl-field { position: absolute; border: 1.5px dashed var(--navy-300); background: rgba(143, 136, 224, .08); border-radius: 6px; display: grid; place-items: center; font-family: var(--mono); font-size: 10.5px; color: var(--navy); }

.exp { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; align-items: center; }
.exp__stats { display: grid; gap: 12px; }

.faq details { border-top: 1px solid var(--line); }
.faq details:first-child { border-top: 0; }
.faq summary { cursor: pointer; font-weight: 600; padding: 11px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--navy); font-weight: 700; font-size: 18px; line-height: 1.2; }
.faq details[open] summary::after { content: '–'; }
.faq p { color: var(--mut); padding: 0 0 12px; max-width: 75ch; }

.pubfoot { background: #fff; border-top: 1px solid var(--line); }
.pubfoot__in { max-width: var(--wrap); margin: 0 auto; padding: 28px var(--gut); display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 24px; }
.pubfoot__brand img { height: 50px; width: auto; }
.pubfoot__brand p { color: var(--mut); font-size: 13px; margin-top: 10px; }
.pubfoot h4 { font-size: 11px; letter-spacing: .9px; text-transform: uppercase; color: var(--label); margin-bottom: 10px; }
.pubfoot ul { list-style: none; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.pubfoot a { color: var(--txt); text-decoration: none; }
.pubfoot a:hover { color: var(--navy); text-decoration: underline; }
.foot { text-align: center; font-size: 11px; color: var(--mut); padding: 14px; border-top: 1px solid var(--line); }

/* ---------- Log masuk ---------- */
.login { min-height: calc(100vh - var(--mb)); display: grid; place-items: center; align-content: center; gap: 14px; padding: 28px 14px; }
.login__box { width: min(100%, 440px); display: grid; gap: 14px; padding: 28px; margin: 0; position: relative; overflow: hidden; }
.login__box > .tri { position: absolute; top: 0; left: 0; right: 0; }
.login__brand { display: flex; align-items: center; gap: 14px; }
.login__brand img { height: 46px; width: auto; }
.login__brand .brand__t { padding-left: 14px; }
.login__brand h1 { font-size: 22px; }
.login__brand h1 small { font-size: 16px; }
.fld-link { display: inline-block; margin-top: 6px; font-size: 12.5px; font-weight: 600; text-decoration: none; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--mut); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.role-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.role-pick a { display: flex; align-items: center; gap: 9px; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--txt); font-weight: 600; font-size: 13px; }
.role-pick a::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--kc); flex: none; }
.role-pick a:hover { border-color: var(--navy-300); box-shadow: 0 0 0 3px var(--navy-100); }
.back { font-size: 13px; font-weight: 600; text-decoration: none; }

/* ---------- Portal: kehadiran, lencana, kad ahli ---------- */
.att__row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.att__row:first-child { border-top: 0; padding-top: 0; }
.att-toggle { margin-left: auto; display: flex; gap: 3px; background: var(--navy-50); padding: 3px; border-radius: 10px; flex: none; }
.att-toggle button { width: 40px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--mut); display: grid; place-items: center; cursor: pointer; }
.att-toggle button.is-on[data-v=hadir] { background: var(--ok); color: #fff; }
.att-toggle button.is-on[data-v=tidak] { background: var(--bad); color: #fff; }
.att-toggle button.is-on[data-v=cuti] { background: var(--gold); color: #171a2e; }

.medal { --m: var(--navy); width: 64px; aspect-ratio: 1; border-radius: 50%; background: var(--m); color: #fff; display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .3), 0 0 0 3px #fff, 0 0 0 4px var(--line); }
.medal img { width: 52%; height: auto; }
.medal .lucide { width: 42%; height: 42%; }
.medal--gold { --m: var(--gold); }
.medal--silver { --m: #8d96a8; }
.medal--bronze { --m: #b0703a; }
.medal--red { --m: var(--red); }
.medal--blue { --m: var(--blue); }
.medal--locked { --m: #dfe1ea; color: #9aa0b4; }
.medal--locked img { opacity: .6; }

.journey { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.journey__step { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 14px 6px; border-radius: 14px; }
.journey__step .medal { width: 66px; }
.journey__step b { font-size: 13px; }
.journey__step small { color: var(--mut); font-size: 11.5px; }
.journey__step.is-now { background: var(--navy-50); }
.journey__step:not(.is-done):not(.is-now) b { color: var(--mut); }

.req__item { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.req__item:first-child { border-top: 0; padding-top: 0; }
.req__check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; flex: none; }
.req__check .lucide { width: 13px; height: 13px; stroke-width: 3; }
.req__item.is-done .req__check { background: var(--ok); border-color: var(--ok); color: #fff; }
.req__item.is-done > span:last-child { color: var(--mut); }

.idcard-stage { perspective: 1000px; }
.idcard { position: relative; aspect-ratio: 1.586; max-width: 440px; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.2, .8, .2, 1); cursor: pointer; border-radius: 16px; }
.idcard.is-flipped { transform: rotateY(180deg); }
.idcard__face { position: absolute; inset: 0; border-radius: 16px; padding: 18px 20px 22px; backface-visibility: hidden; background: var(--navy); color: #fff; display: flex; flex-direction: column; overflow: hidden; }
.idcard__face > .tri { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; }
.idcard__top { display: flex; align-items: center; gap: 10px; }
.idcard__top img { height: 40px; width: auto; }
.idcard__top b { font-size: 13px; display: block; line-height: 1.2; }
.idcard__top small { font-family: var(--font-cond); font-size: 12px; letter-spacing: .6px; text-transform: uppercase; color: var(--gold); }
.idcard__name { margin-top: auto; font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.idcard__id { font-family: var(--mono); font-size: 13px; opacity: .8; }
.idcard__meta { display: flex; gap: 18px; margin-top: 10px; font-size: 12px; font-weight: 600; }
.idcard__meta small { display: block; font-size: 10px; font-weight: 500; opacity: .65; text-transform: uppercase; letter-spacing: .5px; }
.idcard__back { transform: rotateY(180deg); background: #fff; color: var(--txt); border: 1px solid var(--line); align-items: center; justify-content: center; gap: 8px; }
.idcard__qr { width: 42%; }
.hint { display: inline-flex; align-items: center; gap: 6px; color: var(--mut); font-size: 12.5px; }

/* ---------- Bina Kertas Kerja (KePin) ---------- */
.steps { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.steps button { flex: 1; min-width: 118px; padding: 10px; border: 0; border-radius: 12px; background: #e9eaf3; color: var(--mut); font-weight: 600; font-size: 12px; cursor: pointer; }
.steps button.on { background: var(--navy); color: #fff; }
.steps button.done { background: var(--ok-50); color: var(--ok); }
.wstep { display: none; }
.wstep.on { display: block; }
.navbtns { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }

.kk-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.kk-side { position: sticky; top: calc(var(--mb) + 62px); }
.kk-side .card { margin-bottom: 0; }
.fgrid { display: grid; gap: 14px; }
.listrow { display: grid; grid-template-columns: 34px minmax(0, 1fr) 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.listrow .no { font-weight: 700; color: var(--navy); }
.icon-x { width: 36px; height: 36px; border: 0; border-radius: 9px; background: var(--red-50); color: var(--bad); display: grid; place-items: center; cursor: pointer; }

.jkrow { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.jkrow:first-child { border-top: 0; padding-top: 0; }

table.dt.bj td { vertical-align: middle; }
table.dt.bj tr.grp td { background: #f7f8fc; }
.hl { background: #ffff00; font-weight: 700; padding: 0 3px; font-size: 12px; }
.sumrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--navy-50); margin-top: 12px; font-weight: 600; }
.sumrow b { font-size: 18px; color: var(--navy); font-variant-numeric: tabular-nums; }

.logos { display: flex; flex-wrap: wrap; gap: 10px; }
.lgo { border: 1.5px solid var(--line); border-radius: 14px; padding: 10px; width: 150px; background: #fff; cursor: pointer; text-align: center; position: relative; font: inherit; color: inherit; }
.lgo.on { border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-100); }
.lgo img { height: 60px; max-width: 100%; object-fit: contain; margin: 0 auto 6px; }
.lgo span { font-size: 11.5px; font-weight: 600; display: block; line-height: 1.3; }
.lgo .o { position: absolute; top: 6px; left: 8px; background: var(--navy); color: #fff; border-radius: 50%; width: 20px; height: 20px; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.lgo.add { display: grid; place-items: center; color: var(--navy); font-weight: 700; border-style: dashed; min-height: 100px; }

/* Pratonton mini: dokumen sebenar dikecilkan */
.mini { height: 540px; overflow: auto; background: #5b5f73; border-radius: 12px; padding: 12px; }
.mini__sz { overflow: hidden; margin: 0 auto; }
.mini__in { width: 210mm; transform-origin: top left; }
.mini .doc .sheet { margin-bottom: 14px; }

/* Lapisan pratonton penuh (KePin) */
#ov { position: fixed; inset: 0; background: rgba(15, 15, 40, .78); z-index: 60; display: none; flex-direction: column; }
#ov.on { display: flex; }
#ovbar { background: var(--navy); color: #fff; padding: 10px 14px; display: flex; gap: 8px; align-items: center; }
#ovbar b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ovbody { flex: 1; overflow: auto; padding: 20px 10px; background: #5b5f73; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); background: #171a2e; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 90; font-weight: 600; max-width: 90%; display: flex; align-items: center; gap: 8px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* =====================================================================
   TEMPLAT DOKUMEN — disalin daripada KePin PPMNM (format seragam
   PPM Negeri Melaka). Jangan ubah tanpa persetujuan pemilik templat.
   ===================================================================== */
.doc { font-family: Arial, Helvetica, sans-serif; font-size: 11pt; line-height: 1.5; color: #000; text-align: justify; }
.doc .sheet { background: #fff; width: 210mm; max-width: 100%; min-height: 297mm; padding: 20mm 20mm 20mm 25mm; margin: 0 auto 16px; box-shadow: 0 4px 18px rgba(0, 0, 0, .35); }
.mini .doc .sheet { max-width: none; }
.doc .cover { display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: space-between; }
.doc .cover .lgs { display: flex; justify-content: center; align-items: center; gap: 8mm; flex-wrap: wrap; min-height: 26mm; }
.doc .cover .lgs img { max-height: 26mm; max-width: 70mm; object-fit: contain; }
.doc .cover .lgs.many img { max-height: 20mm; max-width: 42mm; }
.doc .cover .k1 { font-size: 20pt; font-weight: bold; letter-spacing: 2px; margin-top: 6mm; }
.doc .cover .k2 { font-size: 15.5pt; font-weight: bold; margin: 8pt 0 0; line-height: 1.4; text-transform: uppercase; }
.doc .cover .k3 { font-size: 11.5pt; font-weight: bold; margin-top: 14pt; }
.doc .cover .k4 { font-size: 12.5pt; font-weight: bold; line-height: 1.45; text-transform: uppercase; }
.doc .cover .l110 { height: 30mm; width: auto; }
.doc p { margin: 0 0 8pt; }
.doc .sec h3 { font-size: 11pt; font-weight: bold; text-transform: uppercase; margin: 14pt 0 6pt; display: block; break-after: avoid; page-break-after: avoid; }
.doc .sheet .sec:first-child h3 { margin-top: 0; }
.doc .sec.pb { break-before: page; }
.doc .in { margin-left: 10mm; }
.doc .li { display: flex; margin-bottom: 3pt; }
.doc .li span { width: 9mm; flex: none; }
.doc .li div { flex: 1; }
.doc .bl { padding-left: 2mm; }
.doc table { border-collapse: collapse; width: 100%; font-size: 10.5pt; line-height: 1.35; text-align: left; }
.doc table.b td, .doc table.b th { border: 1px solid #000; padding: 4pt 5pt; vertical-align: top; }
.doc table.b th { font-weight: bold; text-align: center; vertical-align: middle; }
.doc table.n td { padding: 1.5pt 4pt; vertical-align: top; }
.doc table.n, .doc table.ten { break-inside: avoid; }
.doc table.jk td { padding: 2pt 3pt 5pt; vertical-align: top; }
.doc tr { break-inside: avoid; }
.doc .c { text-align: center; }
.doc .r { text-align: right; }
.doc .keep { break-inside: avoid; }
.doc table.bj { font-size: inherit; }
.doc table.bj td, .doc table.bj th { padding: 2pt 4pt; }
.doc table.bj tr.g td, .doc table.bj tr.g th { background: #d9d9d9; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc table.bj tr.gap td { border-left: 0; border-right: 0; height: 6pt; padding: 0; }
.doc .hl { background: #ffff00; font-weight: bold; padding: 0 2pt; font-size: inherit; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc table.sgt { width: 100%; border-collapse: collapse; font-size: 9.5pt; text-align: center; table-layout: fixed; }
.doc table.sgt th, .doc table.sgt td { border: 1px solid #000; padding: 3pt 4pt; vertical-align: middle; text-align: center; height: 20mm; }
.doc table.sgt th { height: auto; font-weight: normal; background: #d9d9d9; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc table.sgt tr.sp td { height: 22mm; }

#printArea { display: none; }
@media print {
  @page { size: A4; margin: 20mm 20mm 20mm 25mm; }
  body { background: #fff; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block; }
  .doc .sheet { box-shadow: none; margin: 0; padding: 0; width: auto; min-height: 0; }
  .doc .sheet + .sheet { break-before: page; }
  .doc .cover { height: 254mm; }
}

/* ---------- Responsif ---------- */
@media (max-width: 1100px) {
  .kk-layout { grid-template-columns: minmax(0, 1fr); }
  .kk-side { position: static; }
  .mini { height: 460px; }
}
@media (max-width: 900px) {
  .brand__110 { display: none; }
  .g21, .g12 { grid-template-columns: minmax(0, 1fr); }
  .hero, .anniv, .verify, .exp { grid-template-columns: minmax(0, 1fr); }
  .hero__art { display: none; }
  .journey { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pubfoot__in { grid-template-columns: 1fr 1fr; }
  .pubfoot__brand { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .top__in { padding: 14px 14px 0; }
  .brand { gap: 12px; }
  .brand__logo { height: 40px; }
  .brand__t { padding-left: 12px; }
  .brand h1 { font-size: 19px; }
  .brand h1 small { font-size: 14px; }
  .intro { font-size: 13px; }
  .intro.hide-sm { display: none; }
  .top__in:has(.intro.hide-sm) { padding-bottom: 12px; }
  .tabbar__in { padding: 0 8px 0 0; }
  .tabs { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .tabs a { padding: 12px 11px 11px; }
  .main { padding: 16px 12px 48px; }
  .card { padding: 16px; }
  .hero { padding: 26px 18px 22px; }
  .display, .card .display { font-size: 26px; }
  .display.sm, .card .display.sm { font-size: 22px; }
  .stat > b { font-size: 24px; }
  .bar .l { width: 100px; }
  .att-toggle button { width: 38px; }
  .jkrow { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea { font-size: 16px; }
  .chart .axis-label { font-size: 20px; }
  .chart .end-label { font-size: 21px; }
  .login__box { padding: 24px 18px; }
}
@media (max-width: 480px) {
  /* Portal: lambang bulat menggantikan logo penuh supaya tajuk & pengguna muat */
  .brand--portal .brand__logo { display: none; }
  .brand--portal .brand__mark { display: block; }
  .user { padding: 3px; }
  .user > span:last-child { display: none; }
  .search-row { flex-wrap: wrap; }
  .search-row .btn { flex: 1; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
