/* Manrope (OFL-1.1, fon/LICENSE-OFL.txt), disimpan dalam laman supaya boleh guna luar talian */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url(../fon/manrope.woff2) format("woff2"); }

/* Gaya kongsi laman ETAP: rel ikon gelap, kad pastel, butang pil */
:root {
  --bg: #f3f4f1;
  --canvas: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f6;
  --text: #121214;
  --muted: #74747c;
  --line: #ececef;
  --ink: #141416;          /* rel, pil aktif, kad gelap */
  --ink-text: #ffffff;
  --lav: #eceefe; --lav-2: #aab4f7; --lav-3: #5865d8;   /* pasif */
  --sky: #e7f0f5; --sky-2: #b9cdd9; --sky-3: #4f7387;
  --pink: #fdebf1; --pink-2: #f7bfd2; --pink-3: #c23c6c; /* aktif */
  --mint: #e5f4ea; --mint-3: #2f7d4f;
  --amber: #fdf3dc; --amber-3: #9a6a00;
  --hatch: repeating-linear-gradient(135deg, #ececf0 0 2px, transparent 2px 7px);
  --radius: 20px;
  --rail: 76px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0e; --canvas: #141417; --surface: #1b1b1f; --surface-2: #232328; --text: #f2f2f4; --muted: #9a9aa3;
    --line: #2a2a30; --ink: #f2f2f4; --ink-text: #141416;
    --lav: #22243d; --lav-2: #5c66b8; --lav-3: #aab4f7;
    --sky: #1c2a31; --sky-2: #4c6a7a; --sky-3: #a9c6d6;
    --pink: #3a1d28; --pink-2: #a8506f; --pink-3: #f7a8c4;
    --mint: #17301f; --mint-3: #7fd3a0; --amber: #33280e; --amber-3: #f2c55c;
    --hatch: repeating-linear-gradient(135deg, #26262c 0 2px, transparent 2px 7px);
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0e; --canvas: #141417; --surface: #1b1b1f; --surface-2: #232328; --text: #f2f2f4; --muted: #9a9aa3;
  --line: #2a2a30; --ink: #f2f2f4; --ink-text: #141416;
  --lav: #22243d; --lav-2: #5c66b8; --lav-3: #aab4f7;
  --sky: #1c2a31; --sky-2: #4c6a7a; --sky-3: #a9c6d6;
  --pink: #3a1d28; --pink-2: #a8506f; --pink-3: #f7a8c4;
  --mint: #17301f; --mint-3: #7fd3a0; --amber: #33280e; --amber-3: #f2c55c;
  --hatch: repeating-linear-gradient(135deg, #26262c 0 2px, transparent 2px 7px);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: inherit; }
svg.i { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Susun atur ---------- */
.app { display: flex; min-height: 100vh; width: 100%; }
.rail {
  width: var(--rail); flex: none; background: #141416; color: #9b9ba3;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 0;
  position: sticky; top: 0; height: 100vh;
}
.rail .logo { width: 40px; height: 40px; border-radius: 12px; background: #fff; color: #141416; font-weight: 800; display: grid; place-items: center; margin-bottom: 18px; font-size: 13px; }
.rail .logo img { display: block; width: 34px; height: 34px; }
.rail a.logo:hover { background: #fff; }
.rail a.bhs { font-size: 12px; font-weight: 800; letter-spacing: .04em; color: #b9b9c0; }
.rail a { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; text-decoration: none; position: relative; }
.rail a:hover { background: #26262b; color: #fff; }
.rail a.on { background: #34343a; color: #fff; }
.rail a .tip {
  position: absolute; left: 54px; background: #141416; color: #fff; font-size: 12px; padding: 5px 10px; border-radius: 99px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.rail a:hover .tip { opacity: 1; }
.rail .spacer { flex: 1; }
.rail .avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--pink-2), var(--lav-2)); color: #141416; display: grid; place-items: center; font-weight: 700; font-size: 13px; }

.main {
  flex: 1; min-width: 0; background: var(--canvas);
  background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 18px 18px; background-position: 0 0;
  padding: 28px 32px 48px;
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar h1 { font-size: 30px; margin: 0; font-weight: 400; letter-spacing: -.02em; }
.topbar h1 b { font-weight: 800; }
.crumb { color: var(--muted); font-size: 13px; }
.ucapan { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

/* Tab pil */
.pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; scrollbar-width: none; }
.pill { padding: 8px 18px; border-radius: 99px; background: var(--surface-2); font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--muted); text-decoration: none; cursor: pointer; border: 0; font-family: inherit; }
.pill.on { background: var(--ink); color: var(--ink-text); }

/* Telefon: bar pil gelap terapung */
.bottomnav { display: none; }
@media (max-width: 820px) {
  .rail { display: none; }
  .main { padding: 18px 16px 104px; }
  .topbar h1 { font-size: 24px; }
  .bottomnav {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 10;
    background: #141416; border-radius: 99px; padding: 6px; justify-content: space-between; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: #9b9ba3; text-decoration: none; padding: 7px 0; border-radius: 99px; }
  .bottomnav a.on { background: #fff; color: #141416; font-weight: 700; }
}

/* ---------- Komponen ---------- */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); }
.grid > *, .field > * { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; overflow-x: auto; min-width: 0; }
.card.lav { background: var(--lav); border-color: transparent; }
.card.sky { background: var(--sky); border-color: transparent; }
.card.pink { background: var(--pink); border-color: transparent; }
.card.dark { background: #141416; color: #fff; border-color: transparent; }
.card h2 { font-size: 16px; margin: 0 0 12px; font-weight: 700; }
.card h3 { font-size: 12px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head .t { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.ico { width: 34px; height: 34px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; }
.ico svg.i { width: 17px; height: 17px; }
.badge { background: var(--ink); color: var(--ink-text); font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.big { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.big small { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.sub { color: var(--muted); font-size: 12px; }
.card.dark .sub { color: #a1a1aa; }

.stat .lbl { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat .val { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.stat .sub { margin-top: 2px; }
:root { --aktif: var(--pink-2); --pasif: var(--lav-2); --cuti: var(--sky-3); --cuti-soft: var(--sky); }

/* Blok segmen (cth 6 daripada 7 malam) */
.segs { display: flex; gap: 6px; margin-top: 14px; }
.segs i { flex: 1; height: 30px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--surface); }
.card.lav .segs i { border-color: var(--lav-2); background: transparent; }
.card.lav .segs i.f { background: var(--lav-2); }
.card.sky .segs i { border-color: var(--sky-2); background: transparent; }
.card.sky .segs i.f { background: var(--sky-2); }
.card.pink .segs i { border-color: var(--pink-2); background: transparent; }
.card.pink .segs i.f { background: var(--pink-2); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn.pri { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.btn.soft { background: var(--pink); border-color: transparent; color: var(--pink-3); }
.btn.white { background: #fff; color: #141416; border-color: #fff; width: 100%; justify-content: center; }
.btn.danger { color: #c0262d; border-color: #f3c6c8; }
.btn svg.i { width: 16px; height: 16px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip.aktif { background: var(--pink); color: var(--pink-3); }
.chip.pasif { background: var(--lav); color: var(--lav-3); }
.chip.cuti { background: var(--sky); color: var(--sky-3); }
.chip.warn { background: var(--amber); color: var(--amber-3); }
.chip.ok { background: var(--mint); color: var(--mint-3); }
.chip.grey { background: var(--surface-2); color: var(--muted); }
.note { background: var(--amber); color: var(--text); border-radius: 14px; padding: 12px 16px; font-size: 14px; }
.ph { color: var(--muted); font-weight: 400; border-bottom: 1.5px dashed var(--muted); }
.mock-banner { background: #141416; color: #fff; font-size: 11px; text-align: center; padding: 4px; letter-spacing: .08em; }

/* Borang */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--ink); background: var(--surface); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 99px; padding: 4px; flex-wrap: wrap; }
.seg span { padding: 7px 16px; cursor: pointer; border-radius: 99px; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg span.on { background: var(--ink); color: var(--ink-text); }

/* Jadual */
.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.tblwrap th, .tblwrap td { white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
@media (max-width: 820px) { .card th, .card td { padding: 9px 6px; } }

/* Carta bar (Utama) */
.chart { display: flex; align-items: flex-end; gap: 12px; height: 220px; padding-top: 10px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 5px; border-radius: 14px; background: var(--hatch); position: relative; min-width: 0; }
.bar i { display: block; border-radius: 12px; position: relative; }
.bar i.a { background: var(--pink-2); }
.bar i.p { background: var(--sky-2); }
.bar .lbl { position: absolute; bottom: -24px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); }
.bar .tipv { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: #141416; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* Jubin pintasan */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--surface-2); border-radius: 16px; padding: 18px 10px; text-align: center; text-decoration: none; font-size: 13px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tile:hover { background: var(--line); }
.tile .ico { width: 38px; height: 38px; }

/* Kalendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal .dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; text-transform: uppercase; letter-spacing: .06em; }
.day {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; min-height: 96px; padding: 8px;
  display: flex; flex-direction: column; gap: 5px; cursor: pointer; min-width: 0; overflow: hidden;
}
.day:hover { border-color: var(--ink); }
.day.off { background: var(--hatch), var(--surface); }
.day.blank { background: transparent; border: 0; cursor: default; }
.day.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
.day .n { font-weight: 800; font-size: 14px; display: flex; justify-content: space-between; gap: 4px; }
.day .n em { font-style: normal; font-size: 10px; color: var(--sky-3); font-weight: 700; background: var(--sky); padding: 0 6px; border-radius: 99px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 11px; font-weight: 700; border-radius: 10px; padding: 4px 7px; line-height: 1.25; min-width: 0; overflow: hidden; }
.tag.aktif { background: var(--pink-2); color: #4a1022; }
.tag.pasif { background: var(--lav-2); color: #161c55; }
.tag small { display: block; font-weight: 600; opacity: .8; }
@media (max-width: 820px) {
  .cal { gap: 4px; }
  .day { min-height: 60px; padding: 5px; border-radius: 12px; }
  .day .n em { display: none; }
  .tag { font-size: 9px; padding: 2px 4px; border-radius: 6px; }
  .tag small { display: none; }
}

.sheet-opt { display: grid; gap: 8px; }
.opt { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; cursor: pointer; background: var(--surface); }
.opt.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.opt b { display: block; }
.opt span { font-size: 12px; color: var(--muted); }

.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px 16px; text-align: center; color: var(--muted); background: var(--surface); }
.drop b { color: var(--text); display: block; font-size: 16px; margin-bottom: 4px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt { margin-top: 14px; }
.small { font-size: 13px; color: var(--muted); }

/* ---------- Tambahan laman sebenar ---------- */
[hidden] { display: none !important; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.kecil { padding: 6px 12px; font-size: 13px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #141416; color: #fff;
  padding: 10px 18px; border-radius: 99px; font-size: 14px; font-weight: 600; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
@media (max-width: 820px) { .toast { bottom: 96px; } }
.note.ralat { background: #fde2e2; }
.note.info { background: var(--sky); }
.kosong { text-align: center; color: var(--muted); padding: 30px 10px; }
.cek { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.cek input { width: 18px; height: 18px; accent-color: var(--ink); }
.field input[type="time"] { min-height: 44px; }
.huruf-besar { text-transform: uppercase; }
.pills .pill { flex: none; }
.day:focus-visible, .opt:focus-visible, .pill:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.dot-hari { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); display: inline-block; }
