/* style.css — tema biru & emas */
:root {
  --navy: #0B2A5B;
  --navy-2: #123A7A;
  --blue: #1F5FBF;
  --blue-soft: #E8F0FC;
  --gold: #C9A227;
  --gold-2: #E3C65A;
  --gold-soft: #FBF4DB;
  --bg: #F3F5FA;
  --card: #FFFFFF;
  --text: #1B2433;
  --muted: #6B7690;
  --line: #DDE3EF;
  --red: #C0392B;
  --green: #2E8B57;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(11, 42, 91, .08), 0 4px 14px rgba(11, 42, 91, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
h1 { font-size: 22px; margin: 0; color: var(--navy); }
h2 { color: var(--navy); }
h3 { font-size: 15px; margin: 0; color: var(--navy); }
a { color: var(--blue); text-decoration: none; }
code { background: var(--blue-soft); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.muted { color: var(--muted); }
.sm { font-size: 12px; }
.center { text-align: center; }
.r { text-align: right; }
.red { color: var(--red) !important; }
.blue { color: var(--blue) !important; font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 236px; background: linear-gradient(180deg, var(--navy) 0%, #08204A 100%); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; border-right: 3px solid var(--gold); }
.brand { display: flex; gap: 12px; align-items: center; padding: 22px 18px 18px; }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: var(--navy); font-weight: 800; display: grid; place-items: center; }
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--gold-2); letter-spacing: .5px; }
.nav { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.nav a { color: #C9D6EE; padding: 10px 12px; border-radius: 8px; display: flex; gap: 10px; align-items: center; font-weight: 500; }
.nav a .ico { width: 18px; text-align: center; color: var(--gold-2); }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.active { background: rgba(201, 162, 39, .18); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side-foot { margin-top: auto; padding: 16px 18px; border-top: 1px solid rgba(255, 255, 255, .12); }
.side-date-label { font-size: 11px; color: #9FB3D9; text-transform: uppercase; letter-spacing: .6px; }
.side-date { font-size: 18px; font-weight: 700; color: var(--gold-2); }
.main { flex: 1; min-width: 0; }
.topbar { display: none; background: var(--navy); color: #fff; padding: 12px 16px; align-items: center; gap: 12px; border-bottom: 3px solid var(--gold); position: sticky; top: 0; z-index: 20; }
.burger { background: none; border: 0; color: var(--gold-2); font-size: 22px; cursor: pointer; }
.view { padding: 24px 28px 48px; max-width: 1500px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 small { font-size: 14px; font-weight: 500; }

/* ---------- Komponen ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; border-top: 3px solid var(--gold); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card.empty { text-align: center; padding: 48px 20px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; }
.grid2 > .card { margin-bottom: 0; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-bottom: 18px; }
.grid2 { margin-bottom: 18px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; transition: .15s; }
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn.gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); border-color: var(--gold); color: var(--navy); }
.btn.gold:hover { filter: brightness(1.05); color: var(--navy); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: #fde8e6; color: var(--red); }

input, select, textarea { font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-2); border-color: var(--gold); }
input[type=search] { min-width: 240px; }
.filter { display: flex; align-items: center; gap: 10px; background: var(--card); padding: 8px 12px; border-radius: 10px; box-shadow: var(--shadow); border-left: 4px solid var(--gold); }
.filter label { font-weight: 600; color: var(--navy); }
.filter select { min-width: 280px; max-width: 520px; }
.hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .3px; }
.st-ongoing { background: var(--gold-soft); color: #8A6D0B; border: 1px solid var(--gold-2); }
.st-completed { background: #E3F4EA; color: var(--green); }
.st-on-hold { background: #ECEFF5; color: #5A6580; }
.st-cancelled { background: #FBE6E3; color: var(--red); }
.tag { font-size: 10px; background: var(--blue-soft); color: var(--blue); border-radius: 4px; padding: 1px 6px; font-weight: 600; }
.tag.warn { background: var(--gold-soft); color: #8A6D0B; }

/* ---------- Kad butiran (gaya data.jpg) ---------- */
.info { margin-bottom: 18px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #fff; }
.kvw .kv { grid-template-columns: 180px 1fr; }
.panel { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.kv { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.kv:last-child, .kvw:last-child .kv { border-bottom: 0; }
.kv .k { background: var(--navy); color: #fff; font-weight: 700; font-size: 12px; padding: 10px 14px; letter-spacing: .3px; border-right: 3px solid var(--gold); }
.kv .v { padding: 10px 14px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.kvw .kv .v { text-align: left; }
.panel .kv .v { font-size: 14px; }
.progress-box { padding: 12px 14px; background: var(--gold-soft); }
.pbar { height: 10px; border-radius: 99px; background: #fff; border: 1px solid var(--gold-2); overflow: hidden; }
.pbar span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--gold)); }
.plabel { font-size: 12px; color: var(--navy); margin-top: 6px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-left: 4px solid var(--navy); }
.kpi.red { border-left-color: var(--red); }
.kpi.blue { border-left-color: var(--blue); }
.kpi-l { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.kpi-v { font-size: 22px; font-weight: 700; color: var(--navy); margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi.red .kpi-v { color: var(--red); }
.kpi.blue .kpi-v { color: var(--blue); }
.kpi-s { font-size: 12px; color: var(--muted); }

/* ---------- Jadual ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { background: var(--navy); color: #fff; text-align: left; padding: 9px 10px; font-size: 12px; white-space: nowrap; border-bottom: 3px solid var(--gold); }
.tbl th.r { text-align: right; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:hover { background: var(--blue-soft); }
.tbl tfoot td { background: var(--gold-soft); font-weight: 700; border-top: 2px solid var(--gold); }
.tbl.clickable tbody tr { cursor: pointer; }
.tbl.mini th, .tbl.mini td { text-align: right; white-space: nowrap; }
.tbl.mini th:first-child, .tbl.mini td:first-child, .tbl.mini .rowh { text-align: left; }
.tbl.mini .rowh { background: var(--blue-soft); color: var(--navy); border-bottom: 1px solid var(--line); position: sticky; left: 0; }
.tbl.mini thead .rowh { background: var(--navy); color: #fff; border-bottom: 3px solid var(--gold); }
.tbl.mini .tot { font-weight: 700; background: var(--gold-soft); }
.tbl.mini tr.muted td, .tbl.mini tr.muted th { color: var(--muted); font-style: italic; }
.titlecell { max-width: 340px; font-size: 12px; color: var(--muted); }
.actions { white-space: nowrap; display: flex; gap: 6px; }
.chart-box { position: relative; height: 320px; margin-top: 16px; }
.chart-box.sm { height: 260px; margin-top: 0; }

/* ---------- Penyunting ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 0; flex-wrap: wrap; }
.tabs button { padding: 10px 18px; border: 0; background: #E3E8F3; color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px 10px 0 0; }
.tabs button.on { background: #fff; box-shadow: 0 -3px 0 var(--gold) inset; }
.tabs + .card { border-top-left-radius: 0; border-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.fld { display: flex; flex-direction: column; gap: 4px; }
.fld > span { font-size: 12px; font-weight: 600; color: var(--navy); }
.fld.wide { grid-column: 1 / -1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.seg button { border: 0; padding: 7px 16px; background: #fff; font: inherit; font-weight: 600; color: var(--navy); cursor: pointer; }
.seg button.on { background: var(--navy); color: var(--gold-2); }
.tbl.edit input { width: 130px; padding: 5px 7px; font-size: 12px; }
.tbl.edit input[type=date] { width: 128px; }
.tbl.edit input.amt { width: 92px; text-align: right; }
.tbl.edit td { padding: 4px 6px; }
.tbl.edit tbody tr:hover { background: transparent; }
.tbl.edit + .btn, .table-wrap + .btn { margin-top: 12px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.inline-form input[type=text] { flex: 1; min-width: 140px; }
.inline-form input[type=number] { width: 90px; }

/* ---------- Import ---------- */
.drop { border: 2px dashed var(--gold); border-radius: var(--radius); padding: 36px 20px; text-align: center; background: var(--gold-soft); transition: .15s; }
.drop.over { background: #F6E9B4; border-color: var(--navy); }
.drop-ico { font-size: 36px; color: var(--gold); }

/* ---------- Toast ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; border-left: 4px solid var(--gold); box-shadow: var(--shadow); transition: .4s; }
.toast.err { border-left-color: var(--red); background: #6d1f17; }
.toast.hide { opacity: 0; transform: translateY(8px); }

/* ---------- Responsif ---------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -260px; z-index: 30; transition: .25s; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .topbar { display: flex; }
  .view { padding: 16px 14px 40px; }
  .grid2 { grid-template-columns: 1fr; }
  .filter { width: 100%; }
  .filter select { min-width: 0; flex: 1; }
  .kvw .kv { grid-template-columns: 130px 1fr; }
}
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-shell > .card { width: min(100%, 420px); }
.login-shell h1 { margin: 1rem 0 .5rem; }
.login-form:not([hidden]) { display: grid; gap: 1rem; }
.login-form label { display: grid; gap: .35rem; }
.login-form input { width: 100%; padding: .75rem; border: 1px solid #8a94a6; border-radius: .4rem; }
.login-form [hidden] { display: none; }
