  :root{
    --ink:#1A2332;
    --ink-soft:#3A4457;
    --paper:#F7F5F0;
    --surface:#FFFFFF;
    --line:#DEDACD;
    --line-strong:#C7C1AF;
    --gold:#A9761E;
    --gold-soft:#F1E4C9;
    --green:#3F6B4A;
    --green-soft:#E4EFE6;
    --red:#A33B3B;
    --red-soft:#F5E4E1;
    --muted:#6B7280;
    --font-serif:'Source Serif 4', Georgia, serif;
    --font-sans:'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  }
  :root:not([data-theme="light"]){
    /* leave light as default; app is intentionally paper-toned regardless of system scheme */
  }
  *{ box-sizing:border-box; }
  html,body{ height:100%; }
  body{
    margin:0;
    font-family:var(--font-sans);
    background:var(--paper);
    color:var(--ink);
    -webkit-font-smoothing:antialiased;
  }
  button{ font-family:inherit; cursor:pointer; }
  input, select{ font-family:inherit; }

  /* ---------- Login ---------- */
  #login-screen{
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:24px;
  }
  .login-card{
    width:100%;
    max-width:380px;
    background:var(--surface);
    border:1px solid var(--line);
    padding:40px 36px 32px;
  }
  .login-mark{
    font-family:var(--font-serif);
    font-size:15px;
    letter-spacing:.02em;
    color:var(--muted);
    margin:0 0 4px;
  }
  .login-card h1{
    font-family:var(--font-serif);
    font-weight:600;
    font-size:28px;
    margin:0 0 28px;
    line-height:1.2;
  }
  .field{ margin-bottom:18px; }
  .field label{
    display:block;
    font-size:12.5px;
    color:var(--muted);
    margin-bottom:6px;
  }
  .field input, .field select{
    width:100%;
    padding:10px 12px;
    border:1px solid var(--line-strong);
    background:var(--surface);
    font-size:14.5px;
    color:var(--ink);
    border-radius:2px;
  }
  .field input:focus, .field select:focus{
    outline:2px solid var(--ink);
    outline-offset:1px;
    border-color:var(--ink);
  }
  .btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    padding:10px 18px;
    border:1px solid var(--ink);
    background:var(--ink);
    color:var(--paper);
    font-size:14px;
    font-weight:600;
    border-radius:2px;
    transition:background .15s ease;
  }
  .btn:hover{ background:var(--ink-soft); }
  .btn-full{ width:100%; }
  .btn-outline{
    background:transparent;
    color:var(--ink);
  }
  .btn-outline:hover{ background:var(--gold-soft); }
  .login-error{
    color:var(--red);
    font-size:13px;
    margin:0 0 14px;
    display:none;
  }
  .login-hint{
    margin-top:20px;
    font-size:12px;
    color:var(--muted);
    border-top:1px solid var(--line);
    padding-top:14px;
    line-height:1.5;
  }

  /* ---------- App shell ---------- */
  #app{ display:none; min-height:100vh; }
  .shell{ display:flex; min-height:100vh; }

  .sidebar{
    width:230px;
    flex:none;
    background:var(--ink);
    color:var(--paper);
    display:flex;
    flex-direction:column;
    padding:28px 0;
  }
  .brand{
    font-family:var(--font-serif);
    font-size:19px;
    font-weight:600;
    padding:0 24px 26px;
    border-bottom:1px solid rgba(247,245,240,.14);
    margin-bottom:18px;
  }
  .brand span{ display:block; font-family:var(--font-sans); font-size:11px; font-weight:400; color:rgba(247,245,240,.55); margin-top:3px; }
  .nav-item{
    display:flex;
    align-items:center;
    gap:10px;
    padding:11px 24px;
    font-size:14px;
    color:rgba(247,245,240,.72);
    border-left:3px solid transparent;
    background:none;
    border-top:none; border-right:none; border-bottom:none;
    text-align:left;
    width:100%;
  }
  .nav-item:hover{ color:var(--paper); background:rgba(247,245,240,.05); }
  .nav-item.active{
    color:var(--paper);
    border-left-color:var(--gold);
    background:rgba(247,245,240,.07);
    font-weight:600;
  }
  .nav-spacer{ flex:1; }
  .nav-footer{ padding:16px 24px 0; border-top:1px solid rgba(247,245,240,.14); margin-top:10px; }
  .nav-user{ font-size:12.5px; color:rgba(247,245,240,.6); margin-bottom:10px; }
  .logout-btn{
    font-size:13px; color:rgba(247,245,240,.8); background:none; border:1px solid rgba(247,245,240,.3);
    padding:7px 12px; border-radius:2px; width:100%;
  }
  .logout-btn:hover{ background:rgba(247,245,240,.08); }

  .main{ flex:1; min-width:0; display:flex; flex-direction:column; }

  .topbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:22px 36px;
    border-bottom:1px solid var(--line);
    background:var(--surface);
    flex-wrap:wrap;
    gap:16px;
  }
  .topbar h2{
    font-family:var(--font-serif);
    font-size:22px;
    font-weight:600;
    margin:0;
  }
  .balance-pill{
    display:flex;
    align-items:baseline;
    gap:8px;
    background:var(--paper);
    border:1px solid var(--line);
    padding:9px 18px;
  }
  .balance-pill .lbl{ font-size:11.5px; color:var(--muted); }
  .balance-pill .val{ font-family:var(--font-serif); font-size:20px; font-weight:600; color:var(--gold); }

  .content{ padding:32px 36px 60px; overflow-x:auto; }

  /* sub tabs */
  .subtabs{ display:flex; gap:4px; margin-bottom:24px; border-bottom:1px solid var(--line); }
  .subtab{
    padding:9px 4px;
    margin-right:22px;
    font-size:14px;
    color:var(--muted);
    background:none; border:none; border-bottom:2px solid transparent;
  }
  .subtab.active{ color:var(--ink); border-bottom-color:var(--gold); font-weight:600; }

  /* dashboard cards */
  .grid-3{ display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:1px; background:var(--line); border:1px solid var(--line); margin-bottom:32px; }
  .stat{ background:var(--surface); padding:22px 24px; }
  .stat .lbl{ font-size:12px; color:var(--muted); margin-bottom:8px; }
  .stat .num{ font-family:var(--font-serif); font-size:26px; font-weight:600; }
  .stat .num.green{ color:var(--green); }
  .stat .num.red{ color:var(--red); }

  .section-title{ font-family:var(--font-serif); font-size:17px; font-weight:600; margin:0 0 14px; }

  /* table */
  table{ width:100%; border-collapse:collapse; background:var(--surface); font-size:13.5px; min-width:640px; }
  thead th{
    text-align:left; font-size:11.5px; color:var(--muted); font-weight:600;
    padding:10px 14px; border-bottom:1px solid var(--line-strong); white-space:nowrap;
  }
  tbody td{ padding:12px 14px; border-bottom:1px solid var(--line); vertical-align:middle; white-space:nowrap; }
  tbody tr:last-child td{ border-bottom:none; }
  .empty-row td{ text-align:center; color:var(--muted); padding:34px 14px; white-space:normal; }

  .badge{ display:inline-block; padding:3px 10px; font-size:11.5px; font-weight:600; border-radius:20px; }
  .badge-pending{ background:var(--gold-soft); color:var(--gold); }
  .badge-approved{ background:var(--green-soft); color:var(--green); }
  .badge-rejected{ background:var(--red-soft); color:var(--red); }

  .decision-btns{ display:flex; gap:6px; }
  .dbtn{
    padding:6px 12px; font-size:12.5px; font-weight:600; border-radius:2px;
    border:1px solid var(--line-strong); background:var(--surface); color:var(--ink-soft);
  }
  .dbtn.approve.on{ background:var(--green); border-color:var(--green); color:#fff; }
  .dbtn.reject.on{ background:var(--red); border-color:var(--red); color:#fff; }
  .dbtn:not(.on):hover{ background:var(--paper); }
  .decided-label{ font-size:12.5px; color:var(--muted); }

  /* pencatatan layout */
  .pencatatan-grid{ display:grid; grid-template-columns:340px 1fr; gap:28px; align-items:start; }
  @media (max-width:880px){ .pencatatan-grid{ grid-template-columns:1fr; } }
  .form-card{ background:var(--surface); border:1px solid var(--line); padding:22px 22px 24px; }
  .form-card .balance-line{
    display:flex; justify-content:space-between; align-items:baseline;
    padding-bottom:16px; margin-bottom:18px; border-bottom:1px solid var(--line);
  }
  .form-card .balance-line .lbl{ font-size:12px; color:var(--muted); }
  .form-card .balance-line .val{ font-family:var(--font-serif); font-size:19px; font-weight:600; }
  .form-note{ font-size:12px; color:var(--muted); margin-top:4px; }
  .side-list-card{ background:var(--surface); border:1px solid var(--line); padding:22px; }

  /* bank rekening */
  .bank-add-form{
    display:grid; grid-template-columns:repeat(3,1fr) auto; gap:12px; align-items:end;
    background:var(--surface); border:1px solid var(--line); padding:20px 22px; margin-bottom:22px;
  }
  @media (max-width:760px){ .bank-add-form{ grid-template-columns:1fr; } }
  .bank-list{ background:var(--surface); border:1px solid var(--line); }
  .bank-row{ display:flex; align-items:center; justify-content:space-between; padding:14px 20px; border-bottom:1px solid var(--line); gap:16px; flex-wrap:wrap; }
  .bank-row:last-child{ border-bottom:none; }
  .bank-info .name{ font-weight:600; font-size:14.5px; }
  .bank-info .meta{ font-size:12.5px; color:var(--muted); margin-top:2px; }
  .toggle{
    position:relative; width:42px; height:23px; border-radius:20px; background:var(--line-strong);
    border:none; flex:none;
  }
  .toggle.on{ background:var(--green); }
  .toggle::after{
    content:''; position:absolute; top:2px; left:2px; width:19px; height:19px; border-radius:50%;
    background:#fff; transition:left .15s ease;
  }
  .toggle.on::after{ left:21px; }
  .toggle-wrap{ display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); }

  .empty-state{ text-align:center; padding:40px 20px; color:var(--muted); font-size:13.5px; background:var(--surface); border:1px solid var(--line); }

  ::selection{ background:var(--gold-soft); }

  @media (max-width:760px){
    .sidebar{ width:76px; }
    .brand{ padding:0 12px 20px; font-size:0; }
    .brand::before{ content:'BK'; font-size:16px; }
    .nav-item span.label{ display:none; }
    .nav-item{ justify-content:center; padding:12px; }
    .nav-footer{ padding:16px 8px 0; }
    .nav-user{ display:none; }
    .content{ padding:24px 16px 48px; }
    .topbar{ padding:18px 16px; }
  }

/* ---------- Tambahan untuk versi PHP ---------- */
.flash{
  padding:11px 14px;
  border:1px solid var(--line-strong);
  border-radius:2px;
  font-size:13.5px;
  margin-bottom:18px;
}
.flash-ok{ background:var(--green-soft); border-color:#BFD8C5; color:var(--green); }
.flash-err{ background:var(--red-soft); border-color:#E3C3BE; color:var(--red); }
.flash-info{ background:var(--gold-soft); border-color:#E0CDA4; color:var(--gold); }

.role-tag{
  display:inline-block;
  font-size:11px;
  font-weight:600;
  padding:2px 7px;
  border-radius:2px;
  background:var(--gold-soft);
  color:var(--gold);
  margin-left:6px;
}
.role-tag.staff{ background:#EAEAF2; color:var(--ink-soft); }

.dbtn.danger{ border-color:var(--red); color:var(--red); background:transparent; }
.dbtn.danger:hover{ background:var(--red-soft); }

.inline-form{ display:inline; }

.decided-note{
  display:block;
  font-size:11.5px;
  color:var(--muted);
  margin-top:3px;
}

.filter-bar{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:flex-end;
  background:var(--surface);
  border:1px solid var(--line);
  padding:14px 16px;
  margin-bottom:18px;
}
.filter-bar .field{ margin:0; }
.filter-bar .field input, .filter-bar .field select{ min-width:150px; }

.pager{
  display:flex;
  gap:8px;
  align-items:center;
  margin-top:16px;
  font-size:13px;
  color:var(--muted);
}
.pager a{
  color:var(--ink);
  text-decoration:none;
  border:1px solid var(--line-strong);
  padding:5px 11px;
  border-radius:2px;
}
.pager a:hover{ background:var(--gold-soft); }

.setup-wrap{
  max-width:620px;
  margin:48px auto;
  background:var(--surface);
  border:1px solid var(--line);
  padding:36px 34px;
}
.setup-wrap h1{
  font-family:var(--font-serif);
  font-weight:600;
  font-size:26px;
  margin:0 0 6px;
}
.setup-wrap p{ font-size:14px; color:var(--ink-soft); line-height:1.6; }
.setup-wrap code{
  background:var(--paper);
  border:1px solid var(--line);
  padding:1px 5px;
  font-size:13px;
}
.setup-step{ border-left:2px solid var(--gold); padding-left:14px; margin:20px 0; }

.user-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:14px;
  background:var(--surface);
  border:1px solid var(--line);
  padding:14px 16px;
  margin-bottom:-1px;
}
.user-row .name{ font-weight:600; font-size:14.5px; }
.user-row .meta{ font-size:12.5px; color:var(--muted); margin-top:2px; }
.user-actions{ display:flex; gap:8px; }

a.nav-item{ text-decoration:none; }

/* Subtab dulunya <button>, sekarang <a> supaya bisa di-bookmark */
a.subtab{
  display:inline-block;
  text-decoration:none;
  padding:9px 4px;
  margin-right:22px;
  font-size:14px;
  color:var(--muted);
  border-bottom:2px solid transparent;
}
a.subtab.active{ color:var(--ink); border-bottom-color:var(--gold); font-weight:600; }
a.subtab:hover{ color:var(--ink); }

a.btn{ text-decoration:none; }

/* Fokus keyboard tetap terlihat di semua tombol */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible{
  outline:2px solid var(--gold);
  outline-offset:2px;
}

.field input:disabled{
  background:var(--paper);
  color:var(--muted);
  cursor:not-allowed;
}

@media (prefers-reduced-motion: reduce){
  *{ transition:none !important; animation:none !important; }
}

/* ---------- Navigasi multi-project ---------- */
.topbar-sub{
  font-size:12.5px;
  color:var(--muted);
  margin-top:3px;
}

/* ---------- Kartu project ---------- */
.project-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
  gap:16px;
  margin-bottom:8px;
}
.project-card{
  display:block;
  text-decoration:none;
  color:inherit;
  background:var(--surface);
  border:1px solid var(--line);
  padding:20px 22px;
  transition:border-color .15s ease;
}
.project-card:hover{ border-color:var(--gold); }
.project-card .pname{
  font-family:var(--font-serif);
  font-size:19px;
  font-weight:600;
  margin-bottom:4px;
}
.project-card .pdesc{
  font-size:12.5px;
  color:var(--muted);
  margin-bottom:14px;
  min-height:16px;
}
.project-card .pbal{
  font-size:20px;
  font-weight:600;
}
.project-card .pmeta{
  font-size:12px;
  color:var(--muted);
  margin-top:6px;
}
.project-card.nonaktif{ opacity:.55; }

.badge-off{
  display:inline-block;
  font-size:11px;
  padding:2px 7px;
  border-radius:2px;
  background:var(--line);
  color:var(--ink-soft);
  margin-left:6px;
}

.akses-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(110px,1fr));
  gap:8px;
  margin:10px 0 14px;
}
.akses-item{
  display:flex;
  align-items:center;
  gap:7px;
  font-size:13.5px;
  background:var(--paper);
  border:1px solid var(--line);
  padding:8px 10px;
}
.akses-item input{ width:auto; }
