/* PT. DEBE GARDA PERKASA — Invoice & Payment App
   Palet sama dengan situs profil: navy + steel + gold */

:root {
  --navy-950: #0a1220;
  --navy-900: #0d1b2e;
  --navy-800: #13253d;
  --navy-700: #1b3452;
  --navy-600: #2c4a6e;
  --steel-400: #7d8ba1;
  --steel-200: #c7cfdb;
  --gold-500: #c9a34e;
  --gold-400: #ddb865;
  --gold-100: #f5e9cf;
  --white: #ffffff;
  --off-white: #f6f7f9;
  --ink: #1a2230;
  --muted: #5b6472;
  --line: #e5e8ee;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --success: #1e7a45;
  --success-bg: #e4f5ea;
  --warning: #8a5b00;
  --warning-bg: #fbf0d9;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(10, 18, 32, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--off-white);
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4 { font-family: "Georgia", "Times New Roman", serif; margin: 0 0 8px; color: var(--navy-950); line-height: 1.25; }
p { margin: 0 0 14px; color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 4px; font-weight: 600; font-size: 0.9rem;
  border: 1px solid transparent; cursor: pointer; transition: all 0.2s ease;
}
.btn--gold { background: var(--gold-500); color: var(--navy-950); }
.btn--gold:hover { background: var(--gold-400); }
.btn--navy { background: var(--navy-900); color: var(--white); }
.btn--navy:hover { background: var(--navy-800); }
.btn--outline { background: transparent; border: 1px solid var(--line); color: var(--navy-900); }
.btn--outline:hover { background: var(--line); }
.btn--danger { background: var(--danger); color: var(--white); }
.btn--danger:hover { background: #93201a; }
.btn--sm { padding: 7px 14px; font-size: 0.82rem; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px 32px; width: 100%; max-width: 380px; }
.login-card .brand-mark { width: 52px; margin: 0 auto 14px; border-radius: 6px; }
.login-card h1 { font-size: 1.3rem; text-align: center; }
.login-card p.sub { text-align: center; font-size: 0.86rem; margin-bottom: 24px; }
.login-hint { margin-top: 18px; font-size: 0.78rem; color: var(--muted); background: var(--off-white); border-radius: 6px; padding: 10px 12px; }

/* Field */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--navy-900); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 0.92rem; font-family: inherit; background: var(--white);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--gold-500); }
.field textarea { resize: vertical; min-height: 80px; }
.field .help { font-size: 0.76rem; color: var(--muted); margin-top: 4px; }
.field .errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--danger); font-size: 0.8rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.form-grid .field.full { grid-column: 1 / -1; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--navy-950); color: var(--steel-200);
  padding: 22px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; color: var(--white); }
.sidebar .brand img { width: 34px; border-radius: 6px; }
.sidebar .brand strong { display: block; font-size: 0.88rem; }
.sidebar .brand span { display: block; font-size: 0.7rem; color: var(--steel-400); }
.nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 7px;
  color: var(--steel-200); font-size: 0.88rem; font-weight: 500; margin-bottom: 2px;
}
.nav-btn:hover { background: rgba(255,255,255,0.06); }
.nav-btn.active { background: var(--gold-500); color: var(--navy-950); font-weight: 700; }
.nav-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-footer .user { font-size: 0.8rem; color: var(--steel-400); margin-bottom: 8px; }
.logout-btn { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--steel-400); font-size: 0.85rem; cursor: pointer; padding: 6px 4px; }
.logout-btn:hover { color: var(--white); }

.main { flex: 1; padding: 30px 36px; min-width: 0; }
.main-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.main-head h2 { margin-bottom: 2px; }
.main-head .sub { color: var(--muted); font-size: 0.9rem; margin: 0; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.card h3 { font-size: 1rem; margin-bottom: 14px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat-card .lbl { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 8px; }
.stat-card .num { font-size: 1.5rem; font-weight: 700; color: var(--navy-950); font-family: Georgia, serif; }
.stat-card.accent .num { color: var(--gold-500); }

/* Table */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th { text-align: left; color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--off-white); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.badge-draft { background: var(--line); color: var(--muted); }
.badge-belum_bayar { background: var(--warning-bg); color: var(--warning); }
.badge-sebagian { background: var(--gold-100); color: #7a5c1e; }
.badge-lunas { background: var(--success-bg); color: var(--success); }
.badge-jatuh_tempo { background: var(--danger-bg); color: var(--danger); }

.row-actions { display: flex; gap: 6px; }
.icon-link { color: var(--navy-700); font-size: 0.82rem; font-weight: 600; }
.icon-link:hover { color: var(--gold-500); }
.icon-link.danger { color: var(--danger); }

.empty-state { text-align: center; padding: 36px; color: var(--muted); font-size: 0.9rem; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters select, .filters input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 0.85rem; }

.messages { list-style: none; margin: 0 0 18px; padding: 0; }
.messages li { padding: 11px 16px; border-radius: 7px; margin-bottom: 8px; font-size: 0.88rem; }
.messages .success { background: var(--success-bg); color: var(--success); }
.messages .error { background: var(--danger-bg); color: var(--danger); }
.messages .info, .messages .warning { background: var(--gold-100); color: #7a5c1e; }

/* Invoice item formset table */
table.items-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
table.items-table th { text-align: left; font-size: 0.74rem; text-transform: uppercase; color: var(--muted); padding: 6px 8px; }
table.items-table td { padding: 6px 8px; vertical-align: top; }
table.items-table input, table.items-table select { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 5px; font-size: 0.86rem; }
table.items-table .subtotal-cell { white-space: nowrap; font-weight: 600; padding-top: 14px; }
.remove-row { color: var(--danger); background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 6px; }
input[name$="-DELETE"] { display: none; }
tr.item-row.marked-delete { display: none; }
.totals-box { max-width: 340px; margin-left: auto; }
.totals-box .row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 0.92rem; border-bottom: 1px solid var(--line); }
.totals-box .row.grand { font-weight: 700; font-size: 1.05rem; color: var(--navy-950); border-bottom: none; padding-top: 12px; }

/* Invoice detail (print-friendly) */
.invoice-paper { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px; }
.invoice-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 26px; padding-bottom: 22px; border-bottom: 2px solid var(--navy-950); }
.invoice-head .company { display: flex; gap: 12px; align-items: center; }
.invoice-head .company img { width: 48px; border-radius: 6px; }
.invoice-head .company strong { display: block; font-size: 1.05rem; color: var(--navy-950); }
.invoice-head .company span { font-size: 0.78rem; color: var(--muted); }
.invoice-head .meta { text-align: right; }
.invoice-head .meta h2 { margin-bottom: 4px; }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 26px; }
.invoice-parties .lbl { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 6px; }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar .brand { padding: 4px 8px 14px; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 6px; }
  .nav-btn { padding: 8px 12px; margin-bottom: 0; }
  .sidebar-footer { margin-top: 14px; padding-top: 14px; }
  .main { padding: 20px 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-grid, .invoice-parties { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .main-head .btn, .toolbar, .no-print { display: none !important; }
  .shell, .main { display: block; padding: 0; }
  .invoice-paper { border: none; padding: 0; }
}
