/* BONDA AI: tema navy/arang dengan aksen emas. Tiada sumber luar (fon sistem). */
:root {
  --bg: #0b1220;
  --bg-2: #0f1830;
  --panel: rgba(255, 255, 255, .045);
  --panel-solid: #121c33;
  --line: rgba(255, 255, 255, .09);
  --ink: #e8ecf5;
  --muted: #94a0b8;
  --gold: #d8a935;
  --gold-2: #f0c75e;
  --ok: #3ccf91;
  --bad: #ff6b6b;
  --warn: #f0b429;
  --radius: 16px;
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, .7);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 85% -10%, rgba(216, 169, 53, .10), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(60, 100, 200, .12), transparent 60%), var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  min-height: 100vh;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: .85rem; }

/* Reka letak */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: linear-gradient(180deg, #0d1527, #0a101e); border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.brand .mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #231a00; font-weight: 800; display: grid; place-items: center; box-shadow: 0 8px 20px -8px rgba(216, 169, 53, .6); }
.brand b { display: block; font-size: 1.05rem; letter-spacing: .04em; }
.brand span { font-size: .72rem; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; color: var(--muted); font-weight: 600; text-decoration: none; }
.nav a:hover { background: var(--panel); color: var(--ink); text-decoration: none; }
.nav a.on { background: rgba(216, 169, 53, .13); color: var(--gold-2); box-shadow: inset 0 0 0 1px rgba(216, 169, 53, .35); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); font-size: .85rem; }
.main { padding: 26px clamp(16px, 3vw, 36px) 60px; min-width: 0; }
.topbar { display: none; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.burger { background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: 12px; padding: 8px 12px; font-size: 1rem; }

/* Komponen */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.kpi .n { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--gold-2); }
.kpi .l { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; border: 1px solid var(--line); }
.badge.ok { color: var(--ok); background: rgba(60, 207, 145, .1); border-color: rgba(60, 207, 145, .35); }
.badge.gagal, .badge.ditolak { color: var(--bad); background: rgba(255, 107, 107, .1); border-color: rgba(255, 107, 107, .35); }
.badge.warn { color: var(--warn); background: rgba(240, 180, 41, .1); border-color: rgba(240, 180, 41, .35); }
.badge.gold { color: var(--gold-2); background: rgba(216, 169, 53, .12); border-color: rgba(216, 169, 53, .35); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 8px 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }

/* Borang & butang */
label { display: block; font-weight: 600; margin: 0 0 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; background: rgba(0, 0, 0, .25); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(216, 169, 53, .55); outline-offset: 1px; }
.field { margin-bottom: 14px; }
.err { color: var(--bad); font-size: .85rem; margin-top: 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 10px 18px; font: inherit; font-weight: 700; cursor: pointer; background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #231a00; box-shadow: 0 10px 22px -12px rgba(216, 169, 53, .8); text-decoration: none; }
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn.ghost { background: var(--panel); color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.btn.sm { padding: 6px 12px; font-size: .85rem; border-radius: 10px; }

/* Jadual */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
tr:hover td { background: rgba(255, 255, 255, .02); }

/* Notis */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid var(--line); }
.flash.success { background: rgba(60, 207, 145, .1); border-color: rgba(60, 207, 145, .35); color: #b9f3d9; }
.flash.error { background: rgba(255, 107, 107, .1); border-color: rgba(255, 107, 107, .4); color: #ffd0d0; }
.flash.info { background: rgba(216, 169, 53, .1); border-color: rgba(216, 169, 53, .35); color: #f6e2a6; }

/* Log masuk */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(420px, 100%); padding: 28px; }
.auth .brand { justify-content: center; padding-bottom: 8px; }

.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.pager a, .pager span { padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); font-size: .85rem; }
.pager .cur { background: rgba(216, 169, 53, .15); border-color: rgba(216, 169, 53, .4); color: var(--gold-2); }
.pager .dis { color: var(--muted); opacity: .5; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; width: 260px; transform: translateX(-102%); transition: transform .2s; }
  body.menu-open .side { transform: none; }
  body.menu-open::after { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 30; }
  .topbar { display: flex; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

textarea { resize: vertical; min-height: 60px; }
input[readonly], textarea[readonly] { opacity: .7; }
input[type=checkbox] { width: auto; accent-color: var(--gold); margin-right: 6px; }

/* Hierarki */
.chief { border-color: rgba(216, 169, 53, .45); background: linear-gradient(180deg, rgba(216, 169, 53, .10), var(--panel)); }
.chief-name { font-size: 1.35rem; font-weight: 800; color: var(--gold-2); }
.dept-card summary { cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: center; list-style: none; }
.dept-card summary::-webkit-details-marker { display: none; }
.dept-card summary::after { content: '▾'; color: var(--muted); margin-left: 6px; }
.dept-card[open] summary::after { content: '▴'; }
ul.tree { list-style: none; margin: 6px 0 0 14px; padding: 0 0 0 14px; border-left: 1px dashed var(--line); }
ul.tree.root { margin-left: 0; padding-left: 0; border-left: 0; }
ul.tree li { margin: 6px 0; position: relative; }
ul.tree ul.tree li::before { content: ''; position: absolute; left: -14px; top: 14px; width: 12px; border-top: 1px dashed var(--line); }
.node { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.node.off { opacity: .6; }
