:root {
  --bg: #121212;
  --panel: #1a1a1a;
  --panel-alt: #161616;
  --border: #2a2a2a;
  --border-soft: #232323;
  --text: #e5e5e5;
  --text-muted: #a3a3a3;
  --text-dim: #737373;
  --text-faint: #525252;
  --accent: #dc2626;
  --accent-soft: #7f1d1d;
  --good: #4ade80;
  --bad: #f87171;
  --warn: #facc15;
  --orange: #fb923c;
  --sidebar-bg: #0d0d0d;
  --nav-hover-bg: #232323;
  --nav-active-bg: #2a2a2a;
  --toast-bg: #1a1a1a;
  --dropzone-hover-bg: #200f0f;
  --login-gradient-1: #121212;
  --login-gradient-2: #0a0a0a;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px -8px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.04);
  --shadow-card-hover: 0 2px 4px rgba(0,0,0,0.5), 0 16px 40px -12px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.06);
  --shadow-glow-good: 0 0 0 1px rgba(74,222,128,0.15), 0 8px 24px -8px rgba(74,222,128,0.12);
  --shadow-glow-bad: 0 0 0 1px rgba(248,113,113,0.15), 0 8px 24px -8px rgba(248,113,113,0.12);
  --shadow-glow-warn: 0 0 0 1px rgba(250,204,21,0.15), 0 8px 24px -8px rgba(250,204,21,0.12);
  --shadow-glow-neutral: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 24px -8px rgba(0,0,0,0.4);
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="light"] {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-alt: #f5f5f5;
  --border: #e0e0e0;
  --border-soft: #ececec;
  --text: #121212;
  --text-muted: #404040;
  --text-dim: #6b6b6b;
  --text-faint: #9a9a9a;
  --accent: #dc2626;
  --accent-soft: #fecaca;
  --good: #16a34a;
  --bad: #dc2626;
  --warn: #b45309;
  --orange: #ea580c;
  --sidebar-bg: #ffffff;
  --nav-hover-bg: #f2f2f2;
  --nav-active-bg: #ececec;
  --toast-bg: #ffffff;
  --dropzone-hover-bg: #fef2f2;
  --login-gradient-1: #ffffff;
  --login-gradient-2: #f2f2f2;
  --shadow-card: 0 1px 2px rgba(15,23,42,0.04), 0 8px 24px -8px rgba(15,23,42,0.10), inset 0 1px 0 rgba(255,255,255,0.6);
  --shadow-card-hover: 0 2px 4px rgba(15,23,42,0.06), 0 16px 40px -12px rgba(15,23,42,0.16), inset 0 1px 0 rgba(255,255,255,0.7);
  --shadow-glow-good: 0 0 0 1px rgba(22,163,74,0.12), 0 8px 24px -8px rgba(22,163,74,0.10);
  --shadow-glow-bad: 0 0 0 1px rgba(220,38,38,0.12), 0 8px 24px -8px rgba(220,38,38,0.10);
  --shadow-glow-warn: 0 0 0 1px rgba(180,83,9,0.12), 0 8px 24px -8px rgba(180,83,9,0.10);
  --shadow-glow-neutral: 0 0 0 1px rgba(15,23,42,0.05), 0 8px 24px -8px rgba(15,23,42,0.08);
}

[data-theme="light"] .btn-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
[data-theme="light"] .nav-item.active { color: var(--text); }
[data-theme="light"] .toast-item,
[data-theme="light"] .modal-box,
[data-theme="light"] .card {
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}

/* Sembunyikan scrollbar visual di seluruh halaman — scroll tetap berfungsi normal */
* {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge lama */
}
*::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge baru */
}

button, select, input {
  font-family: inherit;
}

/* Seragamkan panah dropdown di seluruh select — ganti default browser
   (yang sering terlalu mepet/tumpang tindih dengan border) dengan SVG custom
   yang posisinya konsisten di semua browser dan resolusi layar. */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%238892a4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding-right: 36px !important;
}

.hidden { display: none !important; }

/* Inbox WhatsApp — layout responsif. Desktop: dua kolom berdampingan.
   Mobile: satu kolom, geser antara daftar percakapan dan isi chat. */
.inbox-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 520px;
}
.inbox-list-panel-wrapper {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  max-height: 640px;
  min-height: 0;
  overflow-x: hidden;
}
.inbox-list-panel {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.inbox-thread-panel {
  display: flex;
  flex-direction: column;
  max-height: 640px;
}
.inbox-back-btn { display: none; }

@media (max-width: 768px) {
  .inbox-layout {
    grid-template-columns: 1fr;
    position: relative;
    overflow: hidden;
  }
  .inbox-list-panel-wrapper,
  .inbox-thread-panel {
    max-height: none;
    height: 70vh;
  }
  .inbox-thread-panel {
    display: none;
  }
  .inbox-layout.inbox-show-thread .inbox-list-panel-wrapper {
    display: none;
  }
  .inbox-layout.inbox-show-thread .inbox-thread-panel {
    display: flex;
  }
  .inbox-back-btn { display: inline-flex; }
}

/* Rapikan posisi ikon jam bawaan browser pada input[type=time] — di Android
   Chrome/WebView, ikon ini sering terlalu mepet ke tepi kanan sehingga
   tumpang tindih dengan border kotak input. */
input[type="time"] {
  padding-right: 8px;
}
input[type="time"]::-webkit-calendar-picker-indicator {
  margin-left: 8px;
  padding: 4px;
  cursor: pointer;
  filter: invert(0.6);
}

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, var(--login-gradient-1) 0%, var(--login-gradient-2) 60%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 36px 32px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.login-brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.login-brand span {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--text);
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 18px 0 4px;
  color: var(--text);
}

.login-card p.subtitle {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 24px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field input, .field select, .field textarea {
  width: 100%;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent-soft);
}

.input-plain {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.input-plain:focus { border-color: var(--accent-soft); }
.input-plain::placeholder { color: var(--text-faint); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter 0.15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}
.toast-item {
  background: var(--toast-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--good);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: toastIn 0.25s ease;
}
.toast-item .dot { margin-top: 4px; flex-shrink: 0; }
.toast-hide { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateX(20px); } }

@media (max-width: 800px) {
  #toast-container { left: 14px; right: 14px; bottom: 14px; max-width: none; }
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 80%, black));
  color: #fecaca;
  border-color: #991b1b;
  padding: 10px 16px;
  font-size: 14px;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
  padding: 8px 14px;
  font-size: 13px;
}

.btn-secondary {
  background: var(--panel-alt);
  color: var(--text-muted);
  border-color: var(--border);
  padding: 8px 14px;
  font-size: 13px;
}

.error-banner {
  background: #3f1212;
  color: #fca5a5;
  border: 1px solid #7f1d1d;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.login-footer {
  margin-top: 22px;
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
}

/* ---------- App shell ---------- */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 224px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

/* Grup tombol aksi (search, notifikasi, tutup) — dikelompokkan rapat dan
   didorong ke ujung kanan lewat margin-left:auto, supaya tidak tersebar
   dengan jarak tidak beraturan seperti saat masih pakai justify-content:
   space-between pada elemen induknya. */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.notification-bell-btn {
  position: relative;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.notification-bell-btn:hover { background: var(--nav-hover-bg); color: var(--text); }
.notification-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
}
#notification-bell-btn-desktop { display: none; }
@media (min-width: 801px) {
  #notification-bell-btn-mobile { display: none; }
  #notification-bell-btn-desktop { display: flex; }
}

.notification-panel {
  position: fixed;
  top: 60px;
  right: 16px;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-card-hover);
  z-index: 300;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.notification-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text);
  flex-shrink: 0;
}
.notification-panel-header button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}
.notification-panel-list { overflow-y: auto; flex: 1; }
.notification-item {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease;
}
.notification-item:hover { background: var(--panel-alt); }
.notification-item.unread { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.notification-item-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--panel-alt);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notification-item-body { flex: 1; min-width: 0; }
.notification-item-title { font-size: 12.5px; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.notification-item-text { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notification-item-time { font-size: 10px; color: var(--text-faint); }
.notification-item-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 4px;
}

@media (max-width: 800px) {
  .notification-panel {
    top: 56px;
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
  }
}

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; min-height: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: var(--nav-hover-bg); color: var(--text-muted); }
.nav-item.active {
  color: #f1f5f9;
  background: var(--nav-active-bg);
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  line-height: 1.4;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.sidebar-footer .user-name { color: var(--text-muted); font-weight: 500; }
.sidebar-footer button {
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.main {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0;
  color: var(--text);
}
.section-header p {
  font-size: 13px;
  color: var(--text-dim);
  margin: 4px 0 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card table { min-width: 100%; }



.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.card.padded { padding: 20px; }

.stat-card {
  position: relative;
  overflow: hidden;
  cursor: default;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--stat-tone-color, var(--accent)), transparent 130%);
  opacity: 0.9;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover), var(--stat-tone-glow, var(--shadow-glow-neutral));
}
.stat-card .stat-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.stat-card .stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  padding-top: 6px;
}
.stat-card .stat-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--stat-tone-bg, var(--panel-alt));
  color: var(--stat-tone-color, var(--text-dim));
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 2px 6px rgba(0,0,0,0.15);
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.stat-card.small .stat-value { font-size: 18px; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 16px;
  font-size: 13px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}
td.strong { color: var(--text); }
td.mono { font-family: var(--font-mono); color: var(--text-dim); }
td[data-label="Nominal"] { white-space: nowrap; }
.empty-row td { text-align: center; color: var(--text-faint); padding: 28px; }

.dot {
  display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  margin-right: 6px;
}
.dot.good { background: var(--good); box-shadow: 0 0 6px var(--good); }
.dot.warn { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.dot.bad { background: var(--bad); box-shadow: 0 0 6px var(--bad); }
.dot.neutral { background: var(--text-dim); }
.dot.orange { background: var(--orange); box-shadow: 0 0 6px var(--orange); }

select.inline-select {
  background-color: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 6px;
  padding-right: 24px !important;
  background-position: right 6px center;
  background-size: 11px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
}
.icon-btn:hover { color: var(--bad); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-box {
  width: 100%; max-width: 420px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

/* Inbox WhatsApp — chip jasa yang bisa diklik (pengganti checkbox native
   yang polos) dan segmented control status pembayaran, dipakai di modal
   "Label Jasa & Status Pembayaran". */
.inbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.inbox-chip:hover { border-color: var(--accent-soft); color: var(--text); }
.inbox-chip .inbox-chip-check { display: none; color: #fff; }
.inbox-chip.active {
  background: linear-gradient(180deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 80%, black));
  border-color: var(--accent-soft);
  color: #fff;
  font-weight: 500;
}
.inbox-chip.active .inbox-chip-check { display: inline-flex; }

.inbox-payment-segmented {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  flex-wrap: wrap;
}
.inbox-payment-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.inbox-payment-option:hover { border-color: var(--accent-soft); }
.inbox-payment-option.lunas.active {
  background: rgba(34,197,94,0.15);
  border-color: #22c55e;
  color: #22c55e;
  font-weight: 600;
}
.inbox-payment-option.belum-lunas.active {
  background: rgba(239,68,68,0.15);
  border-color: #ef4444;
  color: #ef4444;
  font-weight: 600;
}
.inbox-payment-option[data-status=""].active {
  background: var(--panel-alt);
  border-color: var(--text-dim);
  color: var(--text);
  font-weight: 600;
}

/* Bubble/dot warna kecil di samping nomor telepon Inbox — indikator cepat
   status pembayaran, gayanya seperti label warna di WhatsApp Business app. */
.inbox-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.inbox-status-dot.lunas { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,0.25); }
.inbox-status-dot.belum-lunas { background: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,0.25); }

.modal-head h3 { margin: 0; font-size: 15px; color: var(--text); }
.modal-head button { background: none; border: none; color: var(--text-dim); cursor: pointer; }
.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.top-actions { display: flex; gap: 8px; }

/* Dropzone lampiran */
.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
  background: var(--panel-alt);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-soft);
  background: var(--dropzone-hover-bg);
}
.dropzone p {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}
.dropzone .dz-icon { color: var(--text-faint); margin-bottom: 6px; }

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}
.attachment-item a {
  color: var(--text-muted);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.attachment-item a:hover { color: var(--text); }
.attachment-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-dim);
}

/* Kalender Terintegrasi */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-nav h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font-display);
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.calendar-weekday {
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  padding-bottom: 6px;
}
.calendar-day {
  min-height: 90px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  overflow: hidden;
}
.calendar-day.empty { background: transparent; border-color: transparent; }
.calendar-day.today {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.06);
}
.calendar-day.today .day-number {
  color: #60a5fa;
  font-weight: 600;
}
.calendar-day .day-number { font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.calendar-event {
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 3px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}
.calendar-event.campaign { background: rgba(220,38,38,0.15); color: #f87171; }
.calendar-event.invoice { background: rgba(250,204,21,0.15); color: #facc15; }
.calendar-event.content { background: rgba(74,222,128,0.15); color: #4ade80; }
.calendar-legend {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-dim);
}
.calendar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.calendar-legend .dot-legend { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- Elemen khusus mobile (topbar, drawer overlay) — default tersembunyi ---------- */
.mobile-topbar { display: none; }
.sidebar-overlay { display: none; }
.sidebar-close-btn { display: none; }

@media (max-width: 800px) {
  #cc-two-col, #cc-top-row, #cc-top-row-2, #cc-section-grid { grid-template-columns: 1fr !important; }

  /* ---- Topbar mobile dengan hamburger ---- */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding: 0 16px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-soft);
    z-index: 40;
  }
  .mobile-menu-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
  }
  .mobile-menu-btn span {
    display: block;
    width: 16px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
  }

  .app-shell { padding-top: 56px; }

  /* ---- Sidebar jadi drawer off-canvas ---- */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    max-width: 82vw;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
  }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }

  .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 20px;
  }
  .sidebar-close-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
  }

  .nav-item { padding: 13px 16px; }
  .nav-item .label, .nav-badge { display: inline-flex; }

  .sidebar-footer {
    padding: 14px 20px;
    display: block;
  }
  .sidebar-footer .user-name,
  .sidebar-footer #current-user-role { display: block; }
  .sidebar-footer button {
    width: auto;
    height: auto;
    border: none;
    border-radius: 0;
    font-size: 12px;
    background: none;
  }
  .sidebar-footer button::before { display: none; }

  /* ---- Overlay gelap di belakang drawer ---- */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 50;
  }
  .app-shell.sidebar-open .sidebar-overlay { display: block; }

  .main { padding: 18px 14px; }

  .two-col { grid-template-columns: 1fr !important; }

  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .section-header h2 { font-size: 16px; }
  .section-header p { font-size: 12px; }

  .top-actions {
    flex-direction: column;
    width: 100%;
  }
  .top-actions .btn,
  .top-actions select,
  .section-header > .btn {
    width: 100% !important;
    white-space: nowrap;
  }

  /* Stat card: layout landscape (label kiri, nilai kanan) dalam satu baris */
  .stat-grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }
  .form-grid-2col {
    grid-template-columns: 1fr !important;
  }
  .stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px !important;
  }
  .stat-card .stat-top {
    margin-bottom: 0;
    gap: 8px;
  }
  .stat-card .stat-icon-badge {
    width: 26px;
    height: 26px;
    border-radius: 8px;
  }
  .stat-card .stat-icon-badge svg { width: 13px; height: 13px; }
  .stat-card .stat-label {
    font-size: 11px;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }
  .stat-card .stat-value {
    font-size: 17px;
    white-space: nowrap;
  }

  /* Tabel jadi kartu bertumpuk agar nominal langsung terlihat tanpa geser */
  .card table thead { display: none; }
  .card table, .card table tbody, .card table tr, .card table td {
    display: block;
    width: 100%;
  }
  .card { overflow-x: visible; }
  .card table { min-width: 0; }
  .card table tr {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
  }
  .card table tr:last-child { margin-bottom: 0; }
  .card table tr.empty-row {
    border: none;
    padding: 0;
  }
  .card table tr.empty-row td {
    display: block;
    text-align: center;
    padding: 24px 0;
  }
  .card table td {
    border-top: none;
    padding: 5px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    white-space: normal;
    font-size: 13px;
  }
  .card table td[data-label="Nominal"] {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .card table td[data-label="Nominal"]::before {
    flex-shrink: 0;
  }
  .card table td[data-label]::before {
    content: attr(data-label);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    flex-shrink: 0;
  }
  .card table td:not([data-label]) {
    justify-content: flex-end;
  }

  /* Kalender di mobile: scroll horizontal agar 7 kolom tetap terbaca */
  .calendar-grid {
    grid-template-columns: repeat(7, 84px);
    overflow-x: auto;
  }
  .calendar-day { min-height: 70px; }
  .calendar-legend { flex-wrap: wrap; gap: 10px; }
}

@media (min-width: 801px) {
  .mobile-topbar { display: none; }
  .sidebar-overlay { display: none !important; }
  .sidebar-close-btn { display: none; }
}

@media (max-width: 420px) {
  .login-card { padding: 28px 20px; }
}
