/* FinBoard — Modal, toast, pengingat, proyeksi, sinkronisasi, kunci, dan responsif */
/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 12, 24, .55);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 18px;
}
/* Blur di lapisan terpisah. Kalau menempel di overlay, Chrome tidak menampilkan popup select. */
.modal-overlay::before {
  content: "";
  position: absolute; inset: 0;
  backdrop-filter: blur(3px);
  z-index: 0;
  pointer-events: none;
}
.modal-overlay.show { display: flex; }
.modal {
  position: relative; z-index: 1;
  background: var(--card); border-radius: 18px; width: 100%; max-width: 480px;
  padding: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.3);
  max-height: 92vh; overflow-y: auto; animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; } to { opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { font-size: 17px; font-weight: 800; }
.close-x {
  width: 32px; height: 32px; border-radius: 9px; border: none;
  background: var(--hover); color: var(--muted); font-size: 14px;
}
.close-x:hover { color: var(--text); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); grid-column: span 1; }
.form-grid input, .form-grid select {
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; outline: none; width: 100%;
}
.form-grid input:focus, .form-grid select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* Daftar pilihan sendiri — popup <select> Windows/Chrome sering kosong di dalam modal. */
.cselect { position: relative; min-width: 0; max-width: 100%; }
.form-grid .cselect,
.filter-bar .cselect { display: block; width: 100%; }
.filter-bar .cselect { flex: 1; min-width: 140px; }
.cselect-auto { width: auto; display: inline-block; }
.cselect-native {
  position: absolute; width: 1px; height: 1px; margin: 0; padding: 0;
  opacity: 0; pointer-events: none; overflow: hidden;
}
.cselect-btn {
  display: flex; align-items: center; width: 100%;
  text-align: left; cursor: pointer;
  background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 36px 10px 12px; font-size: 14px; font-family: inherit; font-weight: 600;
  line-height: 1.3; position: relative;
}
.cselect-auto .cselect-btn { width: auto; }
.cselect.is-month .cselect-btn {
  background: var(--card); font-size: 13.5px; padding: 9px 36px 9px 12px;
}
.cselect-btn::after {
  content: ""; position: absolute; right: 14px; top: 50%;
  width: 7px; height: 7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
}
.cselect-btn:focus,
.cselect-btn[aria-expanded="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); outline: none; }
.cselect-menu {
  position: fixed; z-index: 400; display: none;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 240px; overflow: auto;
  padding: 4px;
}
.cselect-menu.open { display: block; }
.cselect-menu button {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent; color: var(--text);
  border-radius: 8px; padding: 9px 10px; font-size: 14px; font-weight: 600; font-family: inherit;
}
.cselect-menu button:hover,
.cselect-menu button.active { background: var(--primary-soft); color: var(--primary); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

.seg { display: flex; background: var(--hover); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button {
  flex: 1; border: none; background: transparent; color: var(--muted);
  padding: 9px; border-radius: 9px; font-size: 13px; font-weight: 700; transition: all .15s;
}
.seg button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.quick-amounts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.quick-amounts button {
  border: 1px dashed var(--border); background: transparent; color: var(--muted);
  border-radius: 9px; padding: 7px 12px; font-size: 12.5px; font-weight: 700;
}
.quick-amounts button:hover { border-color: var(--primary); color: var(--primary); }

/* ===== Toast ===== */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px; padding: 13px 18px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow); animation: slideIn .25s ease; max-width: 320px;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.undo { border-left-color: var(--primary); display: flex; align-items: center; gap: 14px; justify-content: space-between; }
.toast.undo button {
  border: none; background: var(--primary); color: #fff;
  border-radius: 8px; padding: 6px 12px; font-size: 12.5px; font-weight: 800; white-space: nowrap;
}
.toast.undo button:hover { filter: brightness(1.1); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ===== Pengingat tagihan ===== */
.bill-remind {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 330px; max-width: calc(100vw - 32px);
  animation: slideIn .3s ease;
}
.bill-remind-card {
  background: var(--card); border: 1px solid var(--border);
  border-left: 4px solid var(--amber);
  border-radius: 16px; padding: 16px; box-shadow: var(--shadow);
}
.br-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.br-title { font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.br-title .br-count {
  background: var(--amber-soft); color: var(--amber);
  border-radius: 20px; font-size: 11px; font-weight: 800; padding: 2px 8px;
}
.br-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.br-info { flex: 1; min-width: 0; }
.br-info strong { font-size: 13px; display: block; }
.br-info span { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.br-info span.urgent { color: var(--red); }
.br-amt { font-size: 13px; font-weight: 800; white-space: nowrap; }
.br-foot { font-size: 11px; color: var(--muted); margin-top: 8px; }
@media (max-width: 820px) {
  .bill-remind { right: 12px; left: 12px; bottom: 12px; width: auto; }
}

/* ===== Proyeksi & hutang ===== */
.proj-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.proj-item h3 { font-size: 19px; font-weight: 800; letter-spacing: -.3px; margin: 2px 0; }
@media (max-width: 820px) { .proj-grid { grid-template-columns: 1fr; gap: 10px; } }
.stat-debt .stat-ic { background: var(--amber-soft); color: var(--amber); }

/* ===== Sinkronisasi ===== */
.sync-pill { font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 20px; background: var(--hover); color: var(--muted); white-space: nowrap; }
.sync-pill.ok { background: var(--green-soft); color: var(--green); }
.sync-pill.err { background: var(--red-soft); color: var(--red); }
.sync-pill.busy { background: var(--primary-soft); color: var(--primary); }
.sync-steps { margin: 12px 0 0 18px; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; line-height: 1.5; }
.conflict-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.conflict-opt { border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.conflict-opt .btn { margin-top: 4px; }
@media (max-width: 820px) { .sync-pill { display: none; } .conflict-grid { grid-template-columns: 1fr; } }

/* ===== Lock screen ===== */
.lock-screen {
  position: fixed; inset: 0; z-index: 300;
  background: linear-gradient(160deg, var(--bg) 0%, var(--primary-soft) 100%);
  display: none; align-items: center; justify-content: center; padding: 18px;
}
.lock-screen.show { display: flex; }
.lock-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 22px;
  padding: 28px 24px; width: 100%; max-width: 340px; box-shadow: var(--shadow); text-align: center;
}
.lock-card.shake { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:none} 20%{transform:translateX(-10px)} 40%{transform:translateX(10px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }
.lock-logo {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
  font-size: 24px; font-weight: 800; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(99, 102, 241, .4);
}
.lock-card h2 { font-size: 18px; font-weight: 800; }
.lock-card p { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 4px 0 14px; }
.lock-dots { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; }
.lock-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); transition: all .15s; }
.lock-dots i.on { background: var(--primary); border-color: var(--primary); }
.lock-error { min-height: 18px; font-size: 12px; color: var(--red); font-weight: 700; margin-bottom: 8px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button {
  height: 56px; border: 1px solid var(--border); background: var(--input-bg);
  color: var(--text); border-radius: 14px; font-size: 20px; font-weight: 700; transition: all .12s;
}
.keypad button:hover { background: var(--hover); }
.keypad button:active { transform: scale(.95); background: var(--primary-soft); border-color: var(--primary); }
.keypad button.key-fn { font-size: 16px; color: var(--muted); }
.keypad button:disabled { opacity: .4; cursor: default; }

/* ===== Overlay & responsive ===== */
.overlay-dim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 45; }
.overlay-dim.show { display: block; }

@media (max-width: 1000px) {
  .grid-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 16px 16px 50px; }
  .hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--card);
    color: var(--text); font-size: 17px;
  }
  .topbar { flex-wrap: wrap; }
  .topbar-actions { width: 100%; margin-left: 0; }
  .topbar-actions .btn { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-card h3 { font-size: 18px; }
}
