/* ============================================================
   FINANCEFLOW - CSS STYLES
   ============================================================ */

:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #DBEAFE;
  --secondary: #0F172A;
  --accent: #06B6D4;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #6366F1;

  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface2: #F1F5F9;
  --border: #E2E8F0;
  --text: #0F172A;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  --sidebar-w: 240px;
  --topbar-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.12);
  --font: 'Plus Jakarta Sans', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --transition: .2s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; overflow-x: hidden; }

/* ── Screens ─────────────────────────────────────────────── */
.screen { min-height: 100vh; display: none; }
.screen.hidden { display: none !important; }
.screen.active { display: block; }

/* ── LOGIN ───────────────────────────────────────────────── */
#login-screen.active { display: flex !important; }
#login-screen { display: flex; align-items: center; justify-content: center; background: #0A0F1E; position: relative; overflow: hidden; }

.login-bg { position: absolute; inset: 0; pointer-events: none; }
.login-orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .45; }
.orb1 { width: 450px; height: 450px; background: #1a56db; top: -120px; left: -120px; }
.orb2 { width: 350px; height: 350px; background: #06b6a2; bottom: -100px; right: -100px; }
.orb3 { width: 250px; height: 250px; background: #0ea5e9; top: 50%; left: 50%; transform: translate(-50%,-50%); }

.login-card {
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
}

.login-brand { text-align: center; margin-bottom: 32px; }
.brand-icon { margin-bottom: 12px; display:flex; align-items:center; justify-content:center; }
.login-brand h1 { color: #fff; font-size: 30px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; }
.login-brand p { color: rgba(255,255,255,.55); font-size: 13px; margin-top: 2px; font-style: italic; letter-spacing: .3px; }

.login-form .form-group { margin-bottom: 16px; }
.login-form label { display: block; color: rgba(255,255,255,1); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.login-form input {
  width: 100%; padding: 12px 16px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px; color: #fff; font-size: 14px; font-family: var(--font);
  transition: var(--transition); outline: none;
}
.login-form input:focus { border-color: var(--accent); background: rgba(255,255,255,.12); }
.login-form input::placeholder { color: rgba(255,255,255,.3); }
.input-pw { position: relative; }
.input-pw input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; opacity: .6; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border: none; border-radius: 10px;
  padding: 12px 24px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  font-family: var(--font);
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(37,99,235,.4); }
.btn-primary:active { transform: translateY(0); }
.btn-full { width: 100%; }

.login-hint { text-align: center; color: rgba(255,255,255,.3); font-size: 12px; margin-top: 16px; }
.login-hint code { color: rgba(255,255,255,.6); font-family: var(--mono); }

/* ── SIDEBAR ─────────────────────────────────────────────── */
#main-app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  height: 100vh;           /* tetap 100vh, bukan min-height */
  background: var(--secondary); color: #fff;
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; z-index: 200;
  transition: transform var(--transition);
  overflow: hidden;        /* clip konten, scroll diatur per-bagian */
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.brand-icon-sm { font-size: 24px; }
.sidebar-brand span { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: rgba(255,255,255,.4); }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.3); }
.nav-section { padding: 8px 20px 4px; font-size: 10px; font-weight: 700; color: rgba(255,255,255,.25); text-transform: uppercase; letter-spacing: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: rgba(255,255,255,.6); cursor: pointer; transition: var(--transition); font-size: 13px; font-weight: 500; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; margin: 0 8px; border-radius: 8px; padding: 10px 12px; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-logout { padding: 14px 20px; border: none; background: none; color: rgba(255,255,255,.4); cursor: pointer; font-family: var(--font); font-size: 13px; text-align: left; display: flex; align-items: center; gap: 8px; transition: var(--transition); border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.sidebar-logout:hover { color: var(--danger); }

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; overflow-x: hidden; }

.topbar {
  height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
}
.hamburger { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text); }
.topbar-title { font-size: 16px; font-weight: 700; flex: 1; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.notif-btn { position: relative; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 14px; }
.notif-badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.notif-badge.hidden { display: none; }
.btn-logout-top { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 14px; color: var(--text-muted); transition: var(--transition); }
.btn-logout-top:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.notif-panel {
  position: fixed; top: calc(var(--topbar-h) + 8px); right: 16px; z-index: 220;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 320px; max-height: 400px; overflow-y: auto;
}
.notif-panel.hidden { display: none !important; pointer-events: none !important; }
.notif-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 12px; font-family: var(--font); }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: var(--transition); }
.notif-item:hover { background: var(--surface2); }
.notif-item.unread { background: var(--primary-light); }
.notif-item-title { font-weight: 600; font-size: 13px; }
.notif-item-msg { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.notif-item-time { font-size: 11px; color: var(--text-light); margin-top: 4px; }

.page-content { padding: 24px; flex: 1; }

/* ── CARDS ───────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.stat-icon.blue { background: #DBEAFE; }
.stat-icon.green { background: #D1FAE5; }
.stat-icon.orange { background: #FEF3C7; }
.stat-icon.red { background: #FEE2E2; }
.stat-icon.purple { background: #EDE9FE; }
.stat-value { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── TABLE ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

/* ── BADGES ──────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-draft { background: #F1F5F9; color: #64748B; }
.badge-submitted { background: #DBEAFE; color: #1D4ED8; }
.badge-manager_approved { background: #D1FAE5; color: #065F46; }
.badge-manager_rejected { background: #FEE2E2; color: #991B1B; }
.badge-gm_approved { background: #EDE9FE; color: #5B21B6; }
.badge-finance_approved { background: #ECFDF5; color: #059669; }
.badge-finance_rejected { background: #FEF2F2; color: #DC2626; }
.badge-paid, .badge-disbursed, .badge-settled { background: #D1FAE5; color: #047857; }
.badge-overdue { background: #FEF2F2; color: #DC2626; }
.badge-settlement_submitted { background: #FEF3C7; color: #92400E; }

/* ── FORM ────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--font); color: var(--text);
  background: var(--surface); transition: var(--transition); outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11px; color: var(--text-muted); }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--transition); border: none; font-family: var(--font); white-space: nowrap; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #D97706; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(4px); }
.modal-overlay.hidden { display: none; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--border); }

/* ── ALERTS / MISC ───────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }

.error-msg { padding: 10px 14px; background: #FEE2E2; color: #991B1B; border-radius: 8px; font-size: 13px; }
.hidden { display: none !important; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: gap; gap: 12px; }
.page-header h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar select, .filter-bar input { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font); font-size: 13px; outline: none; }
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--primary); }

.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; font-weight: 500; }
.empty-state small { font-size: 13px; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 2px; }
.detail-item span { font-size: 14px; font-weight: 500; }
.detail-item.full { grid-column: 1 / -1; }
.separator { height: 1px; background: var(--border); margin: 16px 0; grid-column: 1 / -1; }

.currency { font-family: var(--mono); font-size: 13px; }
.amount-big { font-size: 28px; font-weight: 800; font-family: var(--mono); color: var(--primary); letter-spacing: -1px; }

/* ── PAGINATION ──────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 0; }
.page-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-info { font-size: 13px; color: var(--text-muted); }

/* ── OVERLAY ─────────────────────────────────────────────── */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 150; }

/* ── TABS ────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 20px; border: none; background: none; font-family: var(--font); font-size: 14px; font-weight: 500; cursor: pointer; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
/* ============================================================
   RESPONSIVE — MOBILE FIRST
   Breakpoints: 480px (xs), 640px (sm), 768px (md), 1024px (lg)
   ============================================================ */

/* ── Hamburger: tersembunyi di desktop ───────────────────── */
.hamburger { display: none; }

/* ── Overlay sidebar (mobile) ────────────────────────────── */
.overlay {
  display: none;
  position: fixed; inset: 0; z-index: 199;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
  pointer-events: none;
  touch-action: none;
}
.overlay.show {
  display: block;
  pointer-events: auto;
  touch-action: auto;
}

/* ══════════════════════════════════════════════════════════
   TABLET & MOBILE  ≤ 768px
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Sidebar: slide dari kiri */
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
    box-shadow: none;
    transition: transform .28s cubic-bezier(.4,0,.2,1),
                box-shadow .28s ease;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0,0,0,.25);
  }
  /* overlay: diatur oleh .overlay dan .overlay.show di atas */

  /* Konten utama: penuh tanpa margin sidebar */
  .main-content { margin-left: 0; }

  /* Hamburger tampil */
  .hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; font-size: 18px; cursor: pointer;
    flex-shrink: 0;
  }

  /* Topbar lebih kompak */
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar-title { font-size: 14px; }

  /* Page content padding lebih kecil */
  .page-content { padding: 12px; overflow-x: hidden; }

  /* Form: 1 kolom */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .detail-grid { grid-template-columns: 1fr; }

  /* Stats: 2 kolom */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-icon { width: 40px; height: 40px; font-size: 18px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 11px; }

  /* Cards */
  .card { padding: 14px; border-radius: 12px; }
  .card-header { flex-wrap: wrap; gap: 8px; }
  .card-title { font-size: 14px; }

  /* Modal: full lebar, dari bawah */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    animation: slideUp .3s cubic-bezier(.4,0,.2,1);
  }
  .modal-header { padding: 16px 18px; }
  .modal-body   { padding: 16px 18px; }
  .modal-footer { padding: 12px 18px; gap: 8px; flex-direction: column; }
  .modal-footer .btn { width: 100%; justify-content: center; }

  /* Tabel: scroll horizontal + font kecil */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
  .table-wrap table { font-size: 12px; min-width: 480px; }
  table { font-size: 12px; max-width: 100%; }
  th, td { padding: 10px 10px; }
  /* Sembunyikan kolom yang kurang penting di mobile */
  .col-hide-mobile { display: none; }

  /* Tombol di tabel: ikon saja */
  .btn-sm { padding: 5px 8px; font-size: 11px; }

  /* Notif panel: full lebar */
  .notif-panel {
    right: 0; left: 0;
    width: 100% !important;
    border-radius: 0 0 16px 16px;
    /* Batasi tinggi agar tidak sampai bottom-nav */
    max-height: calc(100vh - var(--topbar-h) - 70px);
    top: calc(var(--topbar-h));
    z-index: 205; /* di bawah bottom-nav (210) */
  }

  /* Page header */
  .page-header { flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
  .page-header h2 { font-size: 18px; }

  /* Upload area: lebih kecil */
  .upload-area { padding: 16px; }
  .upload-icon { font-size: 24px; }
  .upload-text { font-size: 13px; }

  /* Tabs */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; padding: 8px 14px; font-size: 13px; flex-shrink: 0; }

  /* Alert */
  .alert { font-size: 13px; padding: 10px 12px; }

  /* Login card: padding lebih kecil */
  .login-card { padding: 28px 20px; }
  .login-title { font-size: 22px; }

  /* Approval timeline */
  .timeline-step { padding: 10px; gap: 8px; font-size: 12px; }

  /* Flow mini */
  .flow-mini { gap: 3px; }
  .flow-node { font-size: 9px; padding: 3px 6px; }

  /* Badge */
  .badge-project { max-width: 100px; font-size: 10px; }
}

/* ══════════════════════════════════════════════════════════
   PONSEL KECIL  ≤ 480px
   ══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  /* Stats: 1 kolom */
  .stats-grid { grid-template-columns: 1fr; }

  /* Sidebar lebih lebar agar teks tidak terpotong */
  .sidebar { width: min(280px, 85vw); }

  /* Topbar: sembunyikan label teks notif */
  .notif-btn .notif-label { display: none; }

  /* Modal: hampir full-screen */
  .modal { max-height: 96vh; }

  /* Tombol kecil: susun vertikal di beberapa section */
  .btn-group-mobile { flex-direction: column !important; }
  .btn-group-mobile .btn { width: 100%; justify-content: center; }

  /* Page header: tumpuk vertikal */
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header .btn { width: 100%; justify-content: center; }
  .page-header h2 { font-size: 16px; }

  /* Tabel: lebih compact */
  table { font-size: 11px; }
  th, td { padding: 8px 8px; }

  /* Card padding */
  .card { padding: 12px; }
  .page-content { padding: 10px; }

  /* stat card: horizontal layout */
  .stat-card { flex-direction: row; padding: 12px; }
  .stat-icon { width: 36px; height: 36px; font-size: 16px; flex-shrink: 0; }
  .stat-value { font-size: 20px; }

  /* Form input lebih tinggi agar mudah di-tap */
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px !important; /* cegah zoom iOS */
    padding: 11px 12px;
    min-height: 44px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }
  .form-group label { font-size: 12px; }

  /* Tombol minimum touch target 44px */
  .btn { min-height: 40px; touch-action: manipulation; }
  .btn-sm { min-height: 34px; touch-action: manipulation; }
  .bottom-nav-item { touch-action: manipulation; }
  .bottom-nav-item.bn-center { touch-action: manipulation; }

  /* Login */
  .login-card { padding: 24px 16px; border-radius: 16px; }
  .login-title { font-size: 20px; }
  .login-subtitle { font-size: 13px; }
  .brand-icon { font-size: 36px; }

  /* Upload area: sangat compact */
  .upload-area { padding: 14px 12px; }

  /* Modal body: tidak terlalu padat */
  .modal-header { padding: 14px 16px; }
  .modal-body   { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; }

  /* Diff/status box di settlement */
  #settle-diff-box,
  #settle-overspend-section,
  #settle-return-proof-section {
    font-size: 12px;
    padding: 10px 12px;
  }

  /* Timeline */
  .approval-timeline { gap: 8px; }
  .timeline-step { font-size: 11px; }

  /* Notif panel */
  .notif-panel { font-size: 13px; }
  .notif-item { padding: 10px 12px; }
}

/* ══════════════════════════════════════════════════════════
   PONSEL SANGAT KECIL  ≤ 360px
   ══════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
  .topbar-title { font-size: 13px; }
  .page-header h2 { font-size: 15px; }
  .stat-value { font-size: 18px; }
  table { font-size: 10px; }
  th, td { padding: 7px 6px; }
}

/* ══════════════════════════════════════════════════════════
   ANIMASI
   ══════════════════════════════════════════════════════════ */
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}


/* ============================================================
   FINANCE APP v7 – ADDITIONAL STYLES
   ============================================================ */

/* ── Upload area ─────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--surface);
}
.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}
.upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-text { font-weight: 600; font-size: 14px; color: var(--text); }
.upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Approval timeline ───────────────────────────────────── */
.approval-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.timeline-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface2);
  border-left: 4px solid var(--border);
  font-size: 13px;
}
.timeline-step.done {
  border-left-color: var(--success);
  background: color-mix(in srgb, var(--success) 6%, var(--surface2));
}
.timeline-step.rejected {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 6%, var(--surface2));
}
.timeline-step.current {
  border-left-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 6%, var(--surface2));
}
.timeline-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.timeline-step.done .timeline-icon {
  background: var(--success);
  color: #fff;
}
.timeline-step.rejected .timeline-icon {
  background: var(--danger);
  color: #fff;
}
.timeline-step.current .timeline-icon {
  background: var(--warning);
  color: #fff;
}

/* ── Badge for finance_manager statuses ─────────────────── */
.badge-finance_manager_approved {
  background: color-mix(in srgb, #8b5cf6 15%, transparent);
  color: #7c3aed;
}
.badge-finance_manager_rejected {
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  color: var(--danger);
}

/* ── Settings / Flow preview ─────────────────────────────── */
.flow-mini {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.flow-node {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  color: var(--text-muted);
}
.flow-node.active {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border-color: var(--primary);
  color: var(--primary);
}
.flow-node.skip {
  opacity: 0.4;
  text-decoration: line-through;
  font-size: 9px;
}
.flow-arrow {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── PWA Install Banner ───────────────────────────────────── */
.pwa-install-banner {
  position: fixed;
  bottom: -120px;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0,0,0,.18);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  transition: bottom .35s cubic-bezier(.34,1.56,.64,1);
}
.pwa-install-banner.show { bottom: 0; }
.pwa-install-content {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.pwa-install-text { flex: 1; min-width: 0; }
.pwa-install-text strong { display: block; font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pwa-install-text small  { font-size: 11px; color: var(--text-muted); }
.pwa-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}
.pwa-dismiss:hover { background: var(--hover); }

/* ── Push notification toggle button ─────────────────────── */
#push-toggle-btn {
  width: 100%;
  margin-top: 8px;
  font-size: 14px;
}

/* ── Toggle Switch (email aktif) ─────────────────────────── */
.toggle-switch { position:relative;display:inline-block;width:44px;height:24px;flex-shrink:0 }
.toggle-switch input { opacity:0;width:0;height:0 }
.toggle-slider {
  position:absolute;cursor:pointer;inset:0;background:var(--border);
  border-radius:24px;transition:.3s;
}
.toggle-slider:before {
  content:"";position:absolute;height:18px;width:18px;left:3px;bottom:3px;
  background:#fff;border-radius:50%;transition:.3s;
}
.toggle-switch input:checked + .toggle-slider { background:var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform:translateX(20px); }

/* ── Badge Proyek ──────────────────────────────────────────── */
.badge-project {
  display: inline-block;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   BOTTOM NAVIGATION BAR (mobile only)
   ============================================================ */
.bottom-nav {
  display: none; /* tersembunyi di desktop */
}

@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 210;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom, 0px);
    height: calc(60px + var(--safe-bottom, 0px));
    box-shadow: 0 -4px 20px rgba(0,0,0,.08);
  }

  /* Geser konten utama agar tidak tertutup bottom nav */
  .main-content { padding-bottom: calc(60px + var(--safe-bottom, 0px)); }
  .page-content  { padding-bottom: calc(80px + var(--safe-bottom, 0px)); }

  .bottom-nav-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    background: none; border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font);
    transition: color .2s, background .2s;
    padding: 6px 2px 0;
    -webkit-tap-highlight-color: transparent;
    position: relative;
  }
  .bottom-nav-item:active { background: var(--hover); }
  .bottom-nav-item.active { color: var(--primary); }
  .bottom-nav-item.active .bn-icon { position: relative; }
  .bottom-nav-item.active .bn-icon::after {
    content: '';
    position: absolute;
    bottom: -4px; left: 50%;
    transform: translateX(-50%);
    width: 20px; height: 3px;
    background: var(--primary);
    border-radius: 2px;
  }

  .bn-icon  { font-size: 20px; line-height: 1; position: relative; }
  .bn-label { font-size: 10px; font-weight: 600; line-height: 1; }

  /* Tombol tengah (aksi baru) */
  .bn-center {
    flex: 0 0 64px;
    position: relative;
    top: -14px;
  }
  .bn-icon-center {
    display: flex; align-items: center; justify-content: center;
    width: 52px; height: 52px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-size: 28px; font-weight: 300;
    box-shadow: 0 4px 16px rgba(37,99,235,.45);
    line-height: 1;
  }

  /* Badge notif di bottom nav */
  .bn-badge {
    position: absolute;
    top: -4px; right: -6px;
    background: var(--danger);
    color: #fff;
    font-size: 9px; font-weight: 700;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--surface);
  }
  .bn-badge.hidden { display: none; }
}

/* ── Approval Card Layout (mobile-friendly) ─────────────── */
.approval-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0;
}

.approval-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.approval-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.approval-card-ref {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: monospace;
  letter-spacing: .3px;
}

.approval-card-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.approval-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.approval-card-dept {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}

.approval-card-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.approval-card-row:last-of-type {
  border-bottom: none;
}

.approval-card-label {
  min-width: 80px;
  color: var(--text-muted);
  font-size: 12px;
  padding-top: 1px;
  flex-shrink: 0;
}

.approval-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.approval-card-actions .btn {
  flex: 1;
  min-width: 80px;
  justify-content: center;
}

/* ── Report Tabs ─────────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.tab-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.tab-btn:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}
