:root {
  --navy-deep: #0a1f4d;
  --navy: #16357a;
  --navy-light: #2a4d9e;
  --paper: #f3f5fb;
  --ink: #1a2036;
  --muted: #62698a;
  --line: #dfe3f0;
  --green: #16a34a;
  --amber: #d9740a;
  --red: #b3261e;
  --card-radius: 14px;
  font-family: 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 30% 20%, var(--navy-light), var(--navy-deep) 60%); }
.login-box { background: #fff; border-radius: 18px; padding: 40px 36px; width: 100%; max-width: 340px; box-shadow: 0 24px 60px rgba(10,31,77,.35); display: flex; flex-direction: column; gap: 14px; }
.login-logo { width: 52px; height: 52px; border-radius: 12px; background: linear-gradient(135deg, var(--navy), var(--navy-deep)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; margin-bottom: 6px; }
.login-box h1 { margin: 0; font-size: 20px; color: var(--navy-deep); }
.login-sub { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); }
.login-box label { display: flex; flex-direction: column; font-size: 12.5px; font-weight: 600; color: var(--muted); gap: 5px; }
.login-box input { padding: 10px 12px; border-radius: 9px; border: 1px solid var(--line); font-size: 14px; }
.login-error { color: var(--red); font-size: 12.5px; margin: 0; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: linear-gradient(180deg, var(--navy-deep), #071539); color: #fff; display: flex; flex-direction: column; padding: 22px 16px; gap: 20px; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.brand-name { font-size: 14px; line-height: 1.25; font-weight: 700; }
.brand-name em { font-style: normal; opacity: .7; font-weight: 400; }
.toko-picker-label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: rgba(255,255,255,.6); }
.toko-picker { padding: 9px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; font-size: 13.5px; font-weight: 700; }
.toko-picker option { color: var(--ink); }
.menu { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.menu-item { color: rgba(255,255,255,.75); text-decoration: none; padding: 10px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 600; }
.menu-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.menu-item.active { background: rgba(255,255,255,.14); color: #fff; }
.logout { background: rgba(255,255,255,.08); color: #fff; border: none; padding: 10px; border-radius: 9px; cursor: pointer; font-weight: 600; }
.logout:hover { background: rgba(255,255,255,.16); }

.content { flex: 1; padding: 28px 34px; overflow-y: auto; }
.page { display: none; }
.page.active { display: block; }

.content-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; }
.date-day { margin: 0; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
.date-full { margin: 2px 0 0; font-size: 24px; color: var(--navy-deep); }
.page-title { margin-bottom: 18px; }
.page-title h1 { margin: 0; font-size: 22px; color: var(--navy-deep); }
.page-title span { color: var(--muted); font-size: 13px; }

.balance-card { background: linear-gradient(135deg, var(--navy), var(--navy-deep)); color: #fff; border-radius: var(--card-radius); padding: 20px 24px; display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.balance-icon { width: 46px; height: 46px; border-radius: 12px; background: rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.balance-text p { margin: 0; opacity: .8; font-size: 12.5px; }
.balance-text h2 { margin: 2px 0 0; font-size: 26px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-grid-2 { grid-template-columns: repeat(2, 1fr); max-width: 500px; margin: 16px 0; }
.stat-grid-3 { grid-template-columns: repeat(3, 1fr); margin: 16px 0; }
.stat-card { background: #fff; border-radius: var(--card-radius); padding: 16px 18px; border: 1px solid var(--line); }
.stat-card b { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-card hr { border: none; border-top: 1px solid var(--line); margin: 8px 0; }
.stat-card strong { font-size: 19px; color: var(--navy-deep); }

.entry-form { background: #fff; border: 1px solid var(--line); border-radius: var(--card-radius); padding: 18px 20px; margin-bottom: 18px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; align-items: end; }
.entry-form label { display: flex; flex-direction: column; font-size: 12px; font-weight: 600; color: var(--muted); gap: 5px; }
.entry-form input, .entry-form select { padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); font-size: 13.5px; }
.form-actions { display: flex; align-items: flex-end; }
button.primary, button.secondary { cursor: pointer; border-radius: 9px; font-weight: 700; font-size: 13.5px; padding: 10px 16px; border: none; }
button.primary { background: var(--navy-deep); color: #fff; }
button.primary:hover { background: var(--navy); }
button.secondary { background: #fff; border: 1px solid var(--line); color: var(--navy-deep); }
button.secondary:hover { background: var(--paper); }

.filter-bar { display: flex; gap: 12px; align-items: end; margin-bottom: 14px; flex-wrap: wrap; }
.filter-bar label { display: flex; flex-direction: column; font-size: 12px; font-weight: 600; color: var(--muted); gap: 4px; }
.filter-bar input, .filter-bar select { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); }

.table-card { background: #fff; border: 1px solid var(--line); border-radius: var(--card-radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--paper); text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td { padding: 9px 12px; border-top: 1px solid var(--line); }
tr:hover td { background: #fafbff; }
.action-link { color: var(--red); cursor: pointer; font-weight: 600; font-size: 12.5px; text-decoration: none; }
.badge { padding: 3px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; }
.badge-lunas { background: #dcfce7; color: #137333; }
.badge-dp { background: #fff1d6; color: #a04401; }
.badge-belum { background: #fde2e1; color: var(--red); }
.hint-text { color: var(--muted); font-size: 13px; }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
  .menu { flex-direction: row; }
  .content { padding: 18px; }
  .stat-grid, .stat-grid-2, .stat-grid-3 { grid-template-columns: 1fr 1fr; }
}
