/* =========================================================
   Theme — Deposito Online (fintech modern, biru korporat)
   ========================================================= */

:root {
  --primary: #003D7A;
  --primary-2: #0B5FA5;
  --primary-3: #2E86D8;
  --primary-light: #EAF3FC;
  --accent: #00A8E8;
  --success: #16A34A;
  --success-light: #DCFCE7;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --warning: #D97706;
  --warning-light: #FEF3C7;
  --bg: #F4F8FC;
  --card: #FFFFFF;
  --text: #1B2430;
  --muted: #64748B;
  --border: #E2E8F0;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(15, 42, 77, .07);
  --shadow-sm: 0 1px 4px rgba(15, 42, 77, .06);
}

* { box-sizing: border-box; }

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', Roboto, Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  line-height: 1.5;
}

a { color: var(--primary-2); }

/* ---------- Layout ---------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px;
}

.container-narrow {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* ---------- Topbar (admin) ---------- */
.topbar {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fff;
  padding: 16px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
}
.topbar strong { font-size: 15px; letter-spacing: .2px; }
.topbar nav a {
  color: #D6E9FB;
  text-decoration: none;
  font-size: 13px;
  margin-left: 18px;
  transition: color .15s;
}
.topbar nav a:hover { color: #fff; }

/* ---------- Hero (publik) ---------- */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-3) 100%);
  color: #fff;
  padding: 56px 24px;
  text-align: center;
}
.hero h1 { margin: 0 0 8px; font-size: 26px; font-weight: 700; }
.hero p { margin: 0; opacity: .9; font-size: 14px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.card h3 {
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.cards { display: flex; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.stat-card {
  --stat-color: var(--primary-2);
  --stat-color-2: var(--accent);
  --stat-tint: var(--primary-light);
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border-radius: 16px;
  padding: 20px 22px;
  flex: 1;
  min-width: 190px;
  box-shadow: 0 2px 10px rgba(15, 42, 77, .05);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, var(--stat-color) 0%, transparent 55%);
  opacity: .16;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.stat-card::after {
  content: "";
  position: absolute;
  top: -36px; right: -36px;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--stat-color-2), transparent 70%);
  opacity: .10;
  pointer-events: none;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(15, 42, 77, .10);
  border-color: color-mix(in srgb, var(--stat-color) 35%, var(--border));
}
.stat-card-icon {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: linear-gradient(135deg, var(--stat-tint) 0%, color-mix(in srgb, var(--stat-tint) 40%, white) 100%);
  color: var(--stat-color);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stat-color) 18%, transparent);
  position: relative;
  z-index: 1;
}
.stat-card-body { position: relative; z-index: 1; min-width: 0; }
.stat-card .num { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.15; letter-spacing: -.02em; }
.stat-card .label { font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stat-card.success { --stat-color: var(--success); --stat-color-2: var(--success); --stat-tint: var(--success-light); }
.stat-card.danger  { --stat-color: var(--danger);  --stat-color-2: var(--danger);  --stat-tint: var(--danger-light); }
.stat-card.warning { --stat-color: var(--warning); --stat-color-2: var(--warning); --stat-tint: var(--warning-light); }
.stat-card.success .num { color: var(--success); }
.stat-card.danger .num { color: var(--danger); }
.stat-card.warning .num { color: var(--warning); }

/* ---------- Menu tiles (beranda publik) ---------- */
.menu-tiles {
  display: flex; gap: 18px; flex-wrap: wrap; justify-content: center;
  max-width: 820px; margin: -30px auto 0; padding: 0 24px 40px;
  position: relative;
}
.menu-tiles a {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px 22px;
  text-decoration: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow);
  flex: 1;
  min-width: 200px;
  text-align: center;
  border: 1px solid var(--border);
  transition: transform .15s, box-shadow .15s;
}
.menu-tiles a:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(15,42,77,.12); }
.menu-tiles .icon { font-size: 26px; display: block; margin-bottom: 10px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; margin: 10px 0 5px; color: var(--muted); font-weight: 500; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-3);
  box-shadow: 0 0 0 3px rgba(46, 134, 216, .15);
}
textarea { min-height: 60px; resize: vertical; }

fieldset { border: 1px solid var(--border); border-radius: var(--radius); margin: 18px 0; padding: 16px; }
legend { font-size: 13px; font-weight: 700; color: var(--primary); padding: 0 8px; }

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

.checkbox { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; }
.checkbox input { width: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: filter .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-3) 100%); color: #fff; width: 100%; padding: 13px; font-size: 14.5px; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-sm:hover { background: var(--primary-light); }

/* ---------- Alerts / Messages ---------- */
.msg { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-top: 14px; display: none; }
.msg.ok { background: var(--success-light); color: #166534; display: block; }
.msg.err { background: var(--danger-light); color: #991b1b; display: block; }
.alert-err { background: var(--danger-light); color: #991b1b; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.alert-ok { background: #ECFDF5; color: #065F46; padding: 10px 14px; border: 1px solid #A7F3D0; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 12px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border); }
.table th { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.table tr:hover td { background: #FAFCFE; }

/* ---------- Badges ---------- */
.badge { padding: 4px 11px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .2px; }
.badge.submitted { background: var(--warning-light); color: #92400e; }
.badge.active { background: var(--success-light); color: #166534; }
.badge.rejected { background: var(--danger-light); color: #991b1b; }

/* =========================================================
   Sidebar (dashboard internal — Direksi/Ops/Finance/PIC/Agen/Admin)
   ========================================================= */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 250px;
  background: linear-gradient(180deg, #001F3F 0%, #003D7A 55%, #0B5FA5 100%);
  color: #E8F1FB;
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0, 20, 45, .18);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand img { height: 34px; max-width: 40px; border-radius: 6px; background: #fff; padding: 3px; object-fit: contain; }
.sidebar-brand-fallback { font-size: 22px; }
.sidebar-brand-name { font-size: 13.5px; font-weight: 800; letter-spacing: -.1px; color: #fff; line-height: 1.25; }
.sidebar-brand-role { font-size: 10.5px; color: #9FC5EA; margin-top: 2px; letter-spacing: .3px; text-transform: uppercase; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  margin-bottom: 3px;
  border-radius: 10px;
  color: #C7DEF5;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar-nav a .ic { font-size: 15px; width: 18px; text-align: center; opacity: .9; }
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }

.sidebar-divider { height: 1px; background: rgba(255,255,255,.12); margin: 12px 6px; }

.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid rgba(255,255,255,.12);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sidebar-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #00223F;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.sidebar-user-name { font-size: 12.5px; color: #fff; font-weight: 600; line-height: 1.3; }
.sidebar-logout {
  display: block; text-align: center;
  background: rgba(255,255,255,.1);
  color: #fff; text-decoration: none;
  padding: 8px; border-radius: 8px; font-size: 12.5px;
  transition: background .15s;
}
.sidebar-logout:hover { background: rgba(255,255,255,.2); }

.sidebar-toggle {
  display: none;
  position: fixed; top: 14px; left: 14px; z-index: 110;
  background: var(--primary); color: #fff; border: 0;
  width: 40px; height: 40px; border-radius: 10px; font-size: 18px;
  box-shadow: var(--shadow);
}

/* Konten dashboard bergeser ke kanan sidebar */
.dash-content { max-width: 1180px; margin: 0 0 0 250px; padding: 30px 32px; }
.dash-content-narrow { max-width: 620px; margin: 0 0 0 250px; padding: 30px 32px; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: block; }
  .dash-content, .dash-content-narrow { margin-left: 0; padding: 70px 16px 30px; }
}

/* =========================================================
   Responsive mobile — berlaku juga untuk halaman publik (form/simulasi)
   ========================================================= */
@media (max-width: 640px) {
  .container, .container-narrow { padding: 18px 14px; }
  .row2, .grid-form, .grid-2col { grid-template-columns: 1fr; }
  .cards { flex-direction: column; }
  .stat-card { min-width: 0; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 560px; }
  .tabs { gap: 5px; }
  .tabs a { font-size: 11.5px; padding: 6px 10px; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions form { flex-direction: column; align-items: stretch; }
  fieldset { padding: 12px; }
  .camera-live video { max-width: 100%; }
}

/* =========================================================
   Trust Header — banner resmi di atas Formulir & Simulasi Bunga
   (supaya halaman publik tidak terlihat polos/mencurigakan)
   ========================================================= */
.trust-header {
  display: flex;
  align-items: center;
  gap: 18px;
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
}
.trust-header-logo {
  height: 54px;
  max-width: 100px;
  object-fit: contain;
  flex-shrink: 0;
}
.trust-header-logo-fallback {
  height: 54px; width: 54px;
  border-radius: 10px;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.trust-header-text { min-width: 0; }
.trust-header-name { font-size: 17px; font-weight: 800; letter-spacing: -.2px; color: var(--primary); line-height: 1.3; }
.trust-header-tagline { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-top: 3px; letter-spacing: .1px; }
.trust-header-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.trust-badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .3px;
  background: var(--success-light); color: #166534;
  padding: 4px 11px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .trust-header { flex-direction: column; text-align: center; padding: 16px; gap: 10px; }
  .trust-header-badges { justify-content: center; }
}
.card { transition: box-shadow .15s; }
.card:hover { box-shadow: 0 6px 24px rgba(15, 42, 77, .1); }
.stat-card {
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute; top: -30%; right: -20%;
  width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(46,134,216,.10) 0%, transparent 70%);
}
.btn-primary { box-shadow: 0 4px 14px rgba(0, 61, 122, .25); }
.btn-primary:hover { box-shadow: 0 6px 18px rgba(0, 61, 122, .35); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-3) 100%); }
.login-box { background: #fff; padding: 36px 32px; border-radius: var(--radius); box-shadow: 0 20px 50px rgba(0,0,0,.2); width: 340px; }
.login-box h1 { font-size: 18px; margin: 0 0 22px; color: var(--primary); text-align: center; }

/* ---------- Result panel (status/simulasi) ---------- */
.result-panel { margin-top: 20px; padding: 18px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.result-panel p { margin: 6px 0; font-size: 13.5px; }

/* ---------- Signature pad ---------- */
#sigPad { border: 2px dashed var(--border); border-radius: var(--radius-sm); width: 100%; height: 150px; touch-action: none; background: #fff; }

/* ---------- Photos ---------- */
.photos { display: flex; gap: 12px; flex-wrap: wrap; }
.photos img { width: 160px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* ---------- Misc ---------- */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; font-size: 13.5px; }
.grid-2col .lbl { color: var(--muted); }
.log-item { font-size: 12px; color: var(--muted); border-bottom: 1px solid #F1F5F9; padding: 7px 0; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
code { background: var(--primary-light); color: var(--primary); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* Grafik kinerja responsif tanpa dependensi eksternal */
.performance-card{overflow:hidden}
.performance-legend{display:flex;gap:18px;flex-wrap:wrap;margin:8px 0 14px;font-size:12px;color:var(--muted)}
.performance-legend span{display:flex;align-items:center;gap:6px}
.performance-legend i{display:inline-block;width:12px;height:12px;border-radius:3px}
.legend-personal,.bar-personal{background:#2563eb}
.legend-business,.bar-business{background:#7c3aed}
.performance-scroll{overflow-x:auto;padding:10px 4px 2px;-webkit-overflow-scrolling:touch}
.performance-plot{height:260px;min-width:max(620px,calc(var(--chart-count) * 82px));display:flex;align-items:flex-end;gap:12px;border-bottom:1px solid var(--border);padding:0 10px 0}
.performance-group{width:70px;flex:0 0 70px;text-align:center}
.performance-bars{height:190px;display:flex;align-items:flex-end;justify-content:center;gap:5px}
.performance-bar{width:22px;min-height:2px;border-radius:5px 5px 0 0;position:relative;transition:height .25s ease}
.performance-bar span{position:absolute;top:-18px;left:50%;transform:translateX(-50%);font-size:10px;font-weight:700;color:var(--text)}
.performance-label{font-size:10px;line-height:1.2;margin-top:7px;min-height:25px;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.performance-nominal{font-size:9px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media(max-width:640px){.performance-plot{min-width:max(620px,calc(var(--chart-count) * 72px));gap:7px}.performance-group{width:64px;flex-basis:64px}.performance-bar{width:19px}}

/* ===== Timeout sesi 15 menit ===== */
.session-timeout-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .62);
  backdrop-filter: blur(2px);
}
.session-timeout-overlay[hidden] { display: none !important; }
.session-timeout-box {
  width: min(430px, 100%);
  padding: 24px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .32);
  text-align: center;
}
.session-timeout-box h3 {
  margin: 0 0 10px;
  color: #0f172a;
}
.session-timeout-box p {
  margin: 0 0 18px;
  color: #475569;
  line-height: 1.55;
}
