/* ==========================================================================
   Energy Billing — Design System
   Diturunkan dari mockup di template-ref/. Satu tampilan tetap (light),
   bukan multi-theme seperti aplikasi sebelumnya.
   ========================================================================== */

:root {
  /* Permukaan */
  --bg-page: #f4f7fb;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --border: #e6ebf2;
  --border-soft: #f1f5f9;
  --border-muted: #eef2f7;

  /* Teks */
  --text: #0f172a;
  --text-body: #475569;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  /* Aksen */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;

  /* Sidebar gelap */
  --sidebar-from: #0d1b2e;
  --sidebar-mid: #0b1626;
  --sidebar-to: #0a1422;
  --sidebar-text: #94a3b8;
  --sidebar-text-dim: #8798ad;
  --sidebar-text-active: #ffffff;
  --sidebar-width: 262px;

  /* Semantik tarif — hijau selalu LWBP, kuning selalu WBP */
  --lwbp: #4ade80;
  --lwbp-bg: #dcfce7;
  --lwbp-fg: #15803d;
  --wbp: #f59e0b;
  --wbp-bg: #fef3c7;
  --wbp-fg: #b45309;

  /* Status */
  --success: #16a34a;
  --success-bg: #dcfce7;
  --success-fg: #15803d;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-fg: #b91c1c;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --warning-fg: #b45309;
  --neutral-bg: #e2e8f0;
  --neutral-fg: #475569;
  --info-bg: #eef2ff;
  --info-fg: #4338ca;

  --radius: 12px;
  --radius-lg: 14px;
  --radius-sm: 9px;

  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* Dipakai untuk SEMUA angka (kWh, rupiah, stand meter, jam) supaya digit
     sejajar rata dan mudah dibandingkan antar baris tabel. */
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 14px 30px rgba(15, 23, 42, .08);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, .3);
}

/* ── Base ─────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }

@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes growBar { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes softPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(1.35); } }
@keyframes slideDown { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 520px; } }

/* ── Shell ────────────────────────────────────────────────────────────── */

.shell { display: flex; min-height: 100vh; align-items: stretch; }

.main {
  flex: 1;
  min-width: 0;
  padding: 26px 32px 48px;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: linear-gradient(180deg, var(--sidebar-from) 0%, var(--sidebar-mid) 60%, var(--sidebar-to) 100%);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, .06);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.sidebar-brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-from);
  box-shadow: 0 6px 18px rgba(245, 158, 11, .32);
  overflow: hidden;
}
.sidebar-brand-mark img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-brand-name {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .14em;
  color: #fff;
  text-transform: uppercase;
}
.sidebar-brand-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: .06em;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-group-toggle,
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--sidebar-text);
  background: transparent;
  border: 0;
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .01em;
  text-align: left;
  transition: background .18s ease, color .18s ease;
}
.sidebar-group-toggle:hover,
.sidebar-link:hover { background: rgba(255, 255, 255, .06); color: #e2e8f0; }

.sidebar-link.active,
.sidebar-group-toggle.has-active { color: var(--sidebar-text-active); font-weight: 700; }
.sidebar-link.active { background: rgba(37, 99, 235, .2); }
.sidebar-group-toggle.has-active { background: rgba(255, 255, 255, .05); }

.sidebar-group-toggle .label { flex: 1; }
.sidebar-icon { width: 17px; height: 17px; flex: 0 0 17px; opacity: .95; }

.sidebar-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  background: rgba(59, 130, 246, .16);
  border-radius: 20px;
  padding: 2px 7px;
}

.sidebar-chevron {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  opacity: .6;
  transition: transform .22s ease;
}
.sidebar-group[open] .sidebar-chevron { transform: rotate(0deg); }
.sidebar-group:not([open]) .sidebar-chevron { transform: rotate(-90deg); }

.sidebar-sub {
  margin: 3px 0 6px 21px;
  padding-left: 13px;
  border-left: 1px solid rgba(255, 255, 255, .09);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  animation: slideDown .24s ease;
}

.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-text-dim);
  transition: background .16s ease, color .16s ease;
}
.sidebar-sublink:hover { background: rgba(255, 255, 255, .05); color: #e2e8f0; }
.sidebar-sublink.active {
  background: rgba(37, 99, 235, .22);
  color: var(--sidebar-text-active);
  font-weight: 700;
}

.sidebar-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: rgba(148, 163, 184, .5);
}
.sidebar-sublink.active .sidebar-dot { background: #3b82f6; }

/* Kartu status gateway di kaki sidebar */
.sidebar-status {
  margin: 0 12px 12px;
  padding: 13px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-status-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--sidebar-text);
  letter-spacing: .06em;
}
.sidebar-status-body { font-size: 12px; color: #cbd5e1; margin-top: 7px; line-height: 1.5; }
.sidebar-status-body span { color: var(--text-muted); }

.sidebar-user {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  color: #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12.5px;
}
.sidebar-user-name { color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-user-role { color: var(--text-muted); font-size: 11px; }
.sidebar-logout {
  background: none;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
}
.sidebar-logout:hover { color: #e2e8f0; }

/* ── Page header ──────────────────────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.page-sub { font-size: 14px; color: var(--text-muted); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  box-shadow: var(--shadow-sm);
}
.chip.mono { font-family: var(--font-mono); font-weight: 400; color: var(--text-body); }

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: softPulse 2s ease-in-out infinite;
}
.pulse-dot.offline { background: var(--danger); animation: none; }

/* ── Buttons ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  padding: 11px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .26);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(37, 99, 235, .34); color: #fff; }

.btn-outline { background: var(--bg-card); border-color: #dbe3ee; color: #334155; }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-faint); }
.btn-ghost:hover:not(:disabled) { color: var(--text-body); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-body);
  cursor: pointer;
  transition: color .18s ease, transform .18s ease;
}
.btn-icon:hover { color: var(--primary); }

.btn-sm { padding: 7px 12px; font-size: 12px; }

.link-action {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.link-action.muted { color: var(--text-faint); }
.link-action.danger { color: var(--danger); }

/* ── Cards ────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-lg { border-radius: var(--radius-lg); }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}
.card-title { font-size: 15px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--text-faint); margin-top: 4px; }

/* ── Stat cards ───────────────────────────────────────────────────────── */

.stat-grid { display: grid; gap: 16px; margin-bottom: 18px; }
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-grid-3 { grid-template-columns: repeat(3, 1fr); }

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  animation: riseIn .4s ease both;
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text-faint);
  text-transform: uppercase;
}
.stat-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon.blue { background: var(--primary-soft); color: var(--primary); }
.stat-icon.green { background: #f0fdf4; color: var(--success); }
.stat-icon.red { background: #fef2f2; color: var(--danger); }
.stat-icon.amber { background: #fffbeb; color: var(--warning); }

.stat-value { font-size: 28px; font-weight: 800; font-family: var(--font-mono); }
.stat-value small { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.stat-value.sm { font-size: 22px; }

.stat-foot {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  margin-top: 8px;
  font-weight: 600;
  color: var(--text-muted);
}
.stat-foot.up { color: var(--success); }
.stat-foot.down { color: var(--danger); }

/* ── Tables ───────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: .06em;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  white-space: nowrap;
}
.table td {
  padding: 13px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: var(--bg-subtle); }
.table th.num, .table td.num { text-align: right; font-family: var(--font-mono); }
.table td.strong { font-weight: 600; }
.table .sub { font-size: 11px; color: var(--text-faint); font-weight: 500; }

.table-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

/* ── Badges ───────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success-fg); }
.badge-warning { background: var(--warning-bg); color: var(--warning-fg); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-fg); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral-fg); }
.badge-info    { background: var(--info-bg);    color: var(--info-fg); }
.badge-lwbp    { background: var(--lwbp-bg);    color: var(--lwbp-fg); }
.badge-wbp     { background: var(--wbp-bg);     color: var(--wbp-fg); }
.badge-square  { border-radius: 6px; }

/* ── Charts (bar sederhana berbasis CSS) ──────────────────────────────── */

.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend-swatch.lwbp { background: var(--lwbp); }
.legend-swatch.wbp { background: var(--wbp); }

.bar-chart { display: flex; align-items: flex-end; gap: 5px; height: 190px; }
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  height: 100%;
  min-width: 0;
}
.bar {
  width: 100%;
  border-radius: 5px 5px 0 0;
  transform-origin: bottom;
  animation: growBar .6s cubic-bezier(.2, .8, .2, 1) both;
  transition: height .5s ease, filter .18s ease;
}
.bar:hover { filter: brightness(.92); }
.bar.lwbp { background: var(--lwbp); }
.bar.wbp { background: var(--wbp); }
.bar.primary { background: linear-gradient(180deg, #3b82f6, #2563eb); }
.bar-label { font-size: 9px; color: var(--text-faint); font-family: var(--font-mono); }

/* Batang bertumpuk WBP di atas LWBP */
.bar-stack { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; width: 100%; }
.bar-stack .bar { border-radius: 0; }
.bar-stack .bar:first-child { border-radius: 4px 4px 0 0; }

/* Pita 24 jam pada halaman jadwal WBP/LWBP */
.ribbon {
  display: flex;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.ribbon-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border-right: 1px solid rgba(255, 255, 255, .6);
}
.ribbon-seg:last-child { border-right: 0; }
.ribbon-seg.lwbp { background: #86efac; color: #14532d; }
.ribbon-seg.wbp { background: #fcd34d; color: #78350f; }
.ribbon-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* ── Metric tiles (kartu real-time meter) ─────────────────────────────── */

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metric {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.metric-label { font-size: 10px; font-weight: 700; color: var(--text-faint); letter-spacing: .06em; }
.metric-value { font-size: 20px; font-weight: 800; font-family: var(--font-mono); }
.metric-value small { font-size: 12px; color: var(--text-muted); font-weight: 600; }

/* Baris label/nilai untuk panel ringkasan & setting */
.kv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}
.kv-row + .kv-row { margin-top: 10px; }
.kv-label { font-size: 13px; color: var(--text-body); }
.kv-value { font-size: 14px; font-weight: 700; font-family: var(--font-mono); }

/* ── Forms ────────────────────────────────────────────────────────────── */

.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }

.field { display: block; }
.field + .field { margin-top: 14px; }
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: .06em;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.input, .select, .textarea {
  width: 100%;
  border: 1px solid #dbe3ee;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.input.mono { font-family: var(--font-mono); }
.textarea { min-height: 90px; resize: vertical; }

.field-error { color: var(--danger); font-size: 12px; margin-top: 6px; }
.input.is-invalid { border-color: var(--danger); }

/* ── Select dengan pencarian (komponen x-select-search) ───────────────── */

/* x-cloak menyembunyikan menu sampai Alpine siap, mencegah dropdown
   berkedip terbuka pada frame pertama. */
[x-cloak] { display: none !important; }

.select-search { position: relative; }

.select-search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid #dbe3ee;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  background: var(--bg-card);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.select-search-trigger:hover { border-color: #c7d2e2; }
.select-search-trigger.is-open,
.select-search-trigger:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.select-search-trigger.is-invalid { border-color: var(--danger); }
.select-search-trigger.is-placeholder .select-search-label { color: var(--text-faint); }

.select-search-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.select-search-caret { width: 15px; height: 15px; flex: 0 0 15px; color: var(--text-faint); }

.select-search-menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(15, 23, 42, .14);
  overflow: hidden;
}

.select-search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.select-search-icon { width: 15px; height: 15px; flex: 0 0 15px; color: var(--text-faint); }
.select-search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: transparent;
}

.select-search-list { max-height: 260px; overflow-y: auto; padding: 6px; }

.select-search-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.select-search-option.is-highlighted { background: var(--bg-subtle); }
.select-search-option.is-selected { background: var(--primary-soft); }
.select-search-option > div { flex: 1; min-width: 0; }
.select-search-option-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-search-option.is-selected .select-search-option-label { font-weight: 600; color: var(--primary-dark); }
.select-search-option-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.select-search-check { width: 15px; height: 15px; flex: 0 0 15px; color: var(--primary); }

.select-search-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-faint);
}

.filter-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.filter-bar .field { min-width: 180px; }
.filter-bar .spacer { margin-left: auto; }

.upload-box {
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 22px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  cursor: pointer;
}
.upload-box:hover { border-color: var(--primary); color: var(--primary); }

/* ── Alerts ───────────────────────────────────────────────────────────── */

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.6;
  color: #334155;
}
.alert-info { background: #f0f7ff; }
.alert-success { background: var(--success-bg); color: var(--success-fg); }
.alert-danger { background: var(--danger-bg); color: var(--danger-fg); }
.alert-warning { background: var(--warning-bg); color: var(--warning-fg); }

/* ── Modal ────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 27, 46, .55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 24px;
  overflow-y: auto;
  z-index: 40;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 760px;
  max-width: 100%;
  padding: 34px 38px;
  box-shadow: var(--shadow-lg);
}
.modal-sm { width: 480px; padding: 28px 30px; }

/* ── Invoice ──────────────────────────────────────────────────────────── */

.invoice-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 2px solid var(--sidebar-from);
}
.invoice-kicker { font-size: 12px; font-weight: 800; letter-spacing: .14em; color: var(--text-faint); }
.invoice-no { font-size: 24px; font-weight: 800; font-family: var(--font-mono); margin-top: 6px; }
.invoice-issuer { text-align: right; font-size: 12px; color: var(--text-muted); line-height: 1.7; }
.invoice-issuer strong { font-size: 14px; font-weight: 800; color: var(--text); display: block; }

.invoice-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 22px 0; }
.invoice-meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.invoice-table thead tr { background: var(--bg-subtle); }
.invoice-table th { border-bottom: 0; color: var(--text-muted); padding: 11px 12px; }

.invoice-totals { display: flex; justify-content: flex-end; }
.invoice-totals-inner { width: 320px; display: flex; flex-direction: column; gap: 9px; }
.invoice-total-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-body); }
.invoice-total-row .value { font-family: var(--font-mono); font-weight: 600; color: var(--text); }
.invoice-grand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 2px solid var(--sidebar-from);
}
.invoice-grand .label { font-size: 14px; font-weight: 800; }
.invoice-grand .value { font-size: 20px; font-weight: 800; font-family: var(--font-mono); }

/* ── Login ────────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, var(--sidebar-from) 0%, var(--sidebar-mid) 60%, var(--sidebar-to) 100%);
}
.login-card {
  width: 420px;
  max-width: 100%;
  background: var(--bg-card);
  border-radius: 18px;
  padding: 38px 36px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .35);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-title { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.login-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 20px; }
.login-foot { margin-top: 22px; text-align: center; font-size: 12px; color: var(--text-faint); }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13px; color: var(--text-body); }
.checkbox-row input { width: 15px; height: 15px; accent-color: var(--primary); }

/* ── Layout helpers ───────────────────────────────────────────────────── */

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-1-1 { grid-template-columns: repeat(3, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.mb-18 { margin-bottom: 18px; }

/* ── Responsive ───────────────────────────────────────────────────────── */

.sidebar-backdrop { display: none; }

@media (max-width: 1200px) {
  .stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2-1, .grid-1-1-1 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .24s ease;
  }
  .sidebar.open { transform: none; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(13, 27, 46, .55);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s ease;
  }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

  .main { padding: 20px 18px 40px; }
  .stat-grid-4, .stat-grid-3, .grid-2, .form-grid-2,
  .invoice-meta, .metric-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 22px; }
  .modal { padding: 24px 20px; }
}

/* Tombol buka sidebar — hanya tampil di layar sempit */
.sidebar-toggle { display: none; }
@media (max-width: 900px) {
  .sidebar-toggle { display: inline-flex; }
}
