:root {
  --navy: #0a1f5c;
  --blue: #1257d6;
  --sky: #2f8cff;
  --gold: #e8b21e;
  --gold-light: #ffe38a;
  --green: #1fa855;
  --purple: #8b3fd9;
  --pink: #e8336d;
  --orange: #f5701f;
  --teal: #0f9d9a;
  --bg: #f2f5fc;
  --line: #e3e9f6;
  --text: #17213f;
  --muted: #6b7694;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { font-family: Poppins, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- Sidebar ---------- */
#sidebar { position: fixed; inset: 0 auto 0 0; width: 240px; background: linear-gradient(180deg, #0b2370, #061442); color: #fff; display: flex; flex-direction: column; overflow-y: auto; z-index: 30; }
.brand { display: flex; gap: 10px; align-items: center; padding: 16px 14px; border-bottom: 2px solid var(--gold); }
.brand-logo { width: 48px; height: 48px; flex: none; border-radius: 50%; background: #fff; border: 2px solid var(--gold); display: grid; place-items: center; font-size: 26px; overflow: hidden; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-name { font-weight: 700; font-size: 13px; line-height: 1.3; color: var(--gold-light); }
#nav { padding: 10px; }
#nav a { display: flex; gap: 11px; align-items: center; padding: 9px 12px; border-radius: 10px; color: #e6ecff; text-decoration: none; font-size: 13px; margin-bottom: 2px; }
#nav a i { font-size: 17px; }
#nav a:hover { background: rgba(255,255,255,.1); }
#nav a.active { background: linear-gradient(90deg, var(--gold-light), var(--gold)); color: var(--navy); font-weight: 600; }
#nav hr { border: 0; border-top: 1px solid rgba(255,255,255,.15); margin: 8px 4px; }
.side-art { margin-top: auto; min-height: 110px; flex: none; display: grid; place-items: end center; padding-bottom: 12px; font-size: 54px; background: linear-gradient(160deg, transparent 45%, rgba(232,178,30,.5) 47%, transparent 52%), linear-gradient(0deg, #1c7a3a 0, #1c7a3a 30%, transparent 70%); }

/* ---------- Layout ---------- */
#main { margin-left: 240px; min-height: 100vh; }
#topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 22px; background: #fff; border-bottom: 3px solid var(--gold); }
#topbar .title { flex: 1; }
#topbar h1 { font-size: 19px; color: var(--navy); }
#topbar small { color: var(--muted); }
.year-pick { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--navy); }
.year-pick select { padding: 7px 12px; border-radius: 10px; border: 2px solid var(--gold); background: #fffaf0; font-weight: 700; }
#content { padding: 20px 22px 40px; }
#menuBtn { display: none; }
#backdrop { display: none; }

/* ---------- Komponen ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: 0 4px 16px rgba(20,45,110,.06); min-width: 0; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card h3 { font-size: 14px; color: var(--navy); margin-bottom: 12px; display: flex; gap: 8px; align-items: center; }
.card h3 i { color: var(--blue); font-size: 18px; }
.card h3 a { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--blue); text-decoration: none; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px,1fr)); gap: 14px; margin-bottom: 16px; }
.stat { border-radius: 16px; padding: 14px; color: #fff; display: flex; gap: 12px; align-items: center; box-shadow: 0 6px 16px rgba(20,45,110,.18); }
.stat > i { font-size: 32px; }
.stat span { font-size: 11px; display: block; line-height: 1.3; }
.stat b { font-size: 24px; line-height: 1.3; }
.stat em { font-style: normal; font-size: 11px; background: rgba(255,255,255,.25); border-radius: 20px; padding: 2px 8px; margin-left: 6px; white-space: nowrap; }
.c-blue { background: linear-gradient(135deg, #2f8cff, #0b46c4); }
.c-gold { background: linear-gradient(135deg, #f3c437, #c58d00); }
.c-green { background: linear-gradient(135deg, #2cc168, #12803c); }
.c-purple { background: linear-gradient(135deg, #a65cf0, #6a22bd); }
.c-pink { background: linear-gradient(135deg, #ff5c8f, #cc1f57); }
.c-orange { background: linear-gradient(135deg, #ff9442, #e05600); }
.c-teal { background: linear-gradient(135deg, #1fc1bd, #0b7673); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 10px; padding: 9px 15px; cursor: pointer; background: var(--blue); color: #fff; font-weight: 500; font-size: 13px; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.green { background: var(--green); }
.btn.red { background: var(--pink); }
.btn.light { background: #eaf0fc; color: var(--navy); }
.icon-btn { border: 0; background: #eaf0fc; color: var(--blue); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 15px; }
.icon-btn.red { color: var(--pink); background: #fdeaf1; }
.icon-btn.green { color: var(--green); background: #e6f7ed; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; align-items: center; }
.toolbar .spacer { flex: 1; }
input, select, textarea { padding: 9px 12px; border: 1px solid #cdd7ee; border-radius: 10px; background: #fff; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(18,87,214,.12); }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--blue); box-shadow: none; }
.toolbar input[type=search] { min-width: 230px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { background: var(--navy); color: #fff; text-align: left; padding: 10px; font-weight: 500; white-space: nowrap; }
td { padding: 9px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:nth-child(even) { background: #f8faff; }
tbody tr:hover { background: #fff8e0; }
tfoot td { background: var(--gold-light); font-weight: 700; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; color: var(--muted); font-size: 12px; flex-wrap: wrap; gap: 8px; }
.pager div { display: flex; gap: 6px; align-items: center; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; background: #eceff6; color: #55607d; }
.badge.ok { background: #ddf5e6; color: #11713a; }
.badge.warn { background: #fff1c9; color: #8a6100; }
.badge.bad { background: #fde1ea; color: #b5164b; }
.badge.info { background: #e0ecff; color: #0d47b8; }
.group { color: #fff; min-width: 46px; text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty i { display: block; font-size: 32px; color: var(--gold); margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 10px; }
.warnbox { background: #fff6da; border-left: 4px solid var(--gold); border-radius: 8px; padding: 10px 14px; font-size: 12.5px; margin-bottom: 14px; }

/* ---------- Dashboard ---------- */
.chart-box { position: relative; height: 200px; }
.donut-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.donut { position: relative; width: 150px; height: 150px; flex: none; }
.donut .mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-size: 10px; color: var(--muted); pointer-events: none; }
.donut .mid b { font-size: 20px; color: var(--navy); display: block; }
.legend { flex: 1; min-width: 140px; font-size: 12px; }
.legend div { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.legend s { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; text-align: right; }
.sched { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-left: 5px solid var(--blue); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; font-size: 12px; }
.sched .day { background: #eef3ff; border-radius: 8px; padding: 4px 8px; text-align: center; font-weight: 600; min-width: 62px; }
.sched small { display: block; color: var(--muted); }
.bar-row { display: grid; grid-template-columns: 140px 1fr 44px; gap: 10px; align-items: center; margin-bottom: 11px; font-size: 12px; }
.bar { height: 9px; background: #e9edf7; border-radius: 9px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 9px; }
.match { background: linear-gradient(135deg, #0b2370, #17803f); color: #fff; border-radius: 12px; padding: 14px; text-align: center; }
.match .tag { background: var(--gold); color: var(--navy); border-radius: 20px; padding: 3px 14px; font-size: 11px; font-weight: 700; display: inline-block; }
.match .vs { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 12px 0; font-weight: 600; }
.match .vs b { color: var(--gold-light); font-size: 20px; }
.quick { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; height: 100%; }
.quick a { border-radius: 14px; color: #fff; text-decoration: none; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; font-size: 12px; font-weight: 600; padding: 14px 6px; min-height: 110px; }
.quick i { font-size: 28px; }

/* ---------- Modal & toast ---------- */
#modal { position: fixed; inset: 0; background: rgba(6,18,55,.6); z-index: 50; display: grid; place-items: center; padding: 16px; }
.dialog { background: #fff; border-radius: 18px; width: min(620px, 100%); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.dialog.wide { width: min(1000px, 100%); }
.dialog header { background: linear-gradient(90deg, var(--navy), var(--blue)); color: #fff; padding: 13px 18px; border-bottom: 3px solid var(--gold); display: flex; justify-content: space-between; align-items: center; }
.dialog header h2 { font-size: 15px; }
.dialog header button { background: none; border: 0; color: #fff; font-size: 20px; cursor: pointer; }
.dialog .body { padding: 18px; overflow-y: auto; }
.dialog footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form label, .field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--navy); }
.form label.full { grid-column: 1 / -1; }
.form input, .form select, .form textarea, .field input, .field select { font-weight: 400; width: 100%; }
.radio { display: flex; gap: 9px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--green); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 340px; }
.toast.error { background: var(--pink); }
.logo-preview { width: 90px; height: 90px; border: 2px dashed var(--gold); border-radius: 14px; display: grid; place-items: center; font-size: 40px; overflow: hidden; flex: none; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.report-btn { border: 0; cursor: pointer; border-radius: 14px; color: #fff; padding: 18px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 600; }
.report-btn i { font-size: 28px; }
.report-btn.selected { outline: 4px solid var(--gold); outline-offset: 2px; }
.paper { background: #fff; color: #000; }
.paper-head { display: flex; align-items: center; gap: 14px; border-bottom: 3px solid var(--navy); padding-bottom: 10px; margin-bottom: 12px; }
.paper-head img { width: 64px; height: 64px; object-fit: contain; }
.paper-head h2 { color: var(--navy); font-size: 18px; }
.paper-head p { font-size: 12px; }
#printArea { display: none; }

/* ---------- Responsif ---------- */
@media (max-width: 1200px) { .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 900px) {
  #sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.menu-open #sidebar { transform: none; }
  body.menu-open #backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 25; }
  #main { margin-left: 0; }
  #menuBtn { display: block; }
  .g2, .g3 { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 560px) {
  #content { padding: 14px 10px 30px; }
  #topbar { padding: 10px; gap: 8px; }
  #topbar small { display: none; }
  .form { grid-template-columns: 1fr; }
  .quick { grid-template-columns: repeat(2,1fr); }
  .bar-row { grid-template-columns: 105px 1fr 40px; }
}

/* ---------- Cetakan ---------- */
@page { size: A4 landscape; margin: 12mm; }
@media print {
  body { background: #fff; }
  #sidebar, #main, #modal, #toasts, #backdrop { display: none !important; }
  #printArea { display: block; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table-wrap { overflow: visible; border: 0; }
  table { font-size: 10px; }
  th, td { border: 1px solid #aab4cc; padding: 5px 6px; }
  tr { break-inside: avoid; }
}
