* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:root {
  --navy: #1F3864; --navy-2: #2c4b7d; --teal: #12A4B4;
  --bg: #f4f7fc; --card: #fff; --line: #dde5f2; --muted: #66768f;
  --ok: #17864a; --warn: #b8860b; --bad: #c0392b;
}
html, body { margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; background: var(--bg); color: #1b2230; font-size: 14px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
a { color: var(--navy); }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #cfe0ff; border-color: var(--navy-2); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 8px 6px; border-bottom: 2px solid var(--line); }
td { padding: 8px 6px; border-bottom: 1px solid #eef2f9; vertical-align: top; }
.num { text-align: right; white-space: nowrap; }
.c { text-align: center; }
.kecil { font-size: 11px; color: var(--muted); }
.nowrap { white-space: nowrap; }

/* ---------- LOGIN ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, #1F3864 0%, #12A4B4 130%); }
.login-card { background: #fff; border-radius: 16px; padding: 26px 22px; width: 100%; max-width: 380px; box-shadow: 0 18px 50px rgba(10,20,40,.28); }
.login-card img { width: 230px; display: block; margin: 0 auto 14px; }
.login-card h1 { font-size: 17px; color: var(--navy); text-align: center; margin: 0 0 4px; }
.login-card p { text-align: center; color: var(--muted); font-size: 12px; margin: 0 0 18px; }
.login-card label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.login-card label span { display: block; margin-bottom: 4px; }
.btn { background: var(--navy); color: #fff; border: 0; padding: 11px 16px; border-radius: 9px; font-weight: 600; }
.btn.full { width: 100%; }
.btn.teal { background: var(--teal); }
.btn.abu { background: #e8eef8; color: var(--navy); }
.btn.merah { background: #fbeceb; color: var(--bad); }
.btn.bulat { border-radius: 50%; width: 34px; height: 34px; padding: 0; }
.btn:disabled { opacity: .55; }

/* ---------- KERANGKA ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { display: none; }
.main { flex: 1; padding: 12px 14px 84px; max-width: 1200px; margin: 0 auto; width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.topbar h1 { font-size: 18px; margin: 0; color: var(--navy); }
.topbar .user { font-size: 12px; color: var(--muted); text-align: right; }
.bawahnav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line);
  display: flex; overflow-x: auto; padding: 6px 4px; gap: 2px; z-index: 40; }
.bawahnav a { flex: 0 0 auto; text-decoration: none; color: var(--muted); font-size: 10px; text-align: center; padding: 6px 10px; border-radius: 10px; min-width: 62px; }
.bawahnav a.aktif { color: var(--navy); background: #eef3fb; font-weight: 700; }
.bawahnav a i { display: block; font-size: 17px; font-style: normal; margin-bottom: 2px; }

@media (min-width: 900px) {
  .sidebar { display: flex; flex-direction: column; width: 238px; background: var(--navy); color: #fff; padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
  .sidebar img { width: 158px; margin: 0 auto 16px; display: block; background: #fff; border-radius: 8px; padding: 6px; }
  .sidebar a { color: #dfe8f7; text-decoration: none; padding: 9px 11px; border-radius: 8px; font-size: 13px; display: flex; align-items: center; gap: 9px; }
  .sidebar a:hover { background: rgba(255,255,255,.12); }
  .sidebar a.aktif { background: #fff; color: var(--navy); font-weight: 700; }
  .sidebar .kecil { color: #9fb3d4; margin-top: auto; padding: 10px 6px 0; }
  .bawahnav { display: none; }
  .main { padding: 22px 26px; }
}

/* ---------- KARTU & KOMPONEN ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.card h2 { margin: 0 0 10px; font-size: 15px; color: var(--navy); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat .nilai { font-size: 19px; font-weight: 700; color: var(--navy); margin-top: 4px; }
.stat .sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
.baris { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.baris > * { flex: 1 1 155px; }
.baris > .kecil2 { flex: 0 0 auto; }
.pil { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 10.5px; font-weight: 700; }
.pil.ok { background: #e6f6ec; color: var(--ok); }
.pil.warn { background: #fdf5e2; color: var(--warn); }
.pil.bad { background: #fbeceb; color: var(--bad); }
.pil.info { background: #eaf1fb; color: var(--navy); }
.tabel-wrap { overflow-x: auto; }
.tabel-wrap table { min-width: 620px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 92px; background: #1b2230; color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 90; max-width: 90vw; }
.toast.tampil { opacity: .96; }
.toast.merah { background: var(--bad); }
.modal-back { position: fixed; inset: 0; background: rgba(12,20,35,.45); display: flex; align-items: center; justify-content: center; padding: 14px; z-index: 80; }
.modal { background: #fff; border-radius: 14px; padding: 18px; width: 100%; max-width: 720px; max-height: 92vh; overflow-y: auto; }
.modal h3 { margin: 0 0 12px; color: var(--navy); font-size: 16px; }
.tabel-barang { min-width: 720px; }
.tabel-barang input { padding: 6px 7px; }
.tabel-barang td { padding: 4px 3px; }
.total-box { background: #f7fafd; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 10px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.total-box b { color: var(--navy); }
.aksi-baris { display: flex; gap: 6px; flex-wrap: wrap; }
.cari-hasil { position: absolute; z-index: 6; background: #fff; box-shadow: 0 10px 24px rgba(12,20,35,.16);
  border: 1px solid var(--line); border-radius: 9px; max-height: 240px; overflow-y: auto; margin-top: 4px; width: 100%; }
.cari-hasil[hidden] { display: none !important; }
.cari-hasil div { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid #f0f4fa; font-size: 13px; }
.cari-hasil div:hover { background: #eef3fb; }
.badge-auth { font-size: 11px; background: #eef3fb; color: var(--navy); padding: 3px 9px; border-radius: 20px; }
@media print { .sidebar, .bawahnav, .topbar { display: none !important; } }
