/* ═══════════════════════════════════════════════
   TABUNG FAMILY DAY — CSS Design System
   Dark theme · Gold accents · Glassmorphism
═══════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --bg:        #0b0b12;
  --surface:   #13131f;
  --card:      #1a1a2e;
  --card2:     #20203a;
  --border:    rgba(255,255,255,0.07);
  --gold:      #f5a623;
  --gold-dark: #d4891a;
  --gold-glow: rgba(245,166,35,0.18);
  --green:     #34d399;
  --red:       #f87171;
  --blue:      #60a5fa;
  --text:      #e2e8f0;
  --muted:     #6b7280;
  --muted2:    #9ca3af;
  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --sb-width:  230px;
  --bn-height: 64px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; font-size: 0.9rem; }
button { cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }

/* ── Setup Overlay ── */
#setup-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.setup-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  width: 100%; max-width: 520px;
  box-shadow: var(--shadow);
  text-align: center;
}
.setup-logo { font-size: 3rem; margin-bottom: 0.75rem; }
.setup-title { font-size: 1.6rem; font-weight: 700; color: var(--gold); }
.setup-sub { color: var(--muted2); margin: 0.3rem 0 1.5rem; }

.setup-screen { text-align: left; }
.screen-label { text-align: center; color: var(--muted2); margin-bottom: 1rem; }

.guide-steps { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.25rem; }
.guide-item { display: flex; gap: 0.9rem; align-items: flex-start; }
.guide-num {
  min-width: 28px; height: 28px;
  background: var(--gold); color: #000;
  border-radius: 50%; font-weight: 700; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}
.guide-item b { font-size: 0.88rem; display: block; margin-bottom: 0.2rem; }
.guide-item p, .guide-item a { font-size: 0.8rem; color: var(--muted2); line-height: 1.45; }
.guide-item a { color: var(--gold); }

.setup-input, .setup-textarea {
  width: 100%; padding: 0.7rem 0.9rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  outline: none; transition: border-color .2s;
  margin-bottom: 0.8rem;
}
.setup-input:focus, .setup-textarea:focus { border-color: var(--gold); }
.setup-textarea { height: 160px; resize: vertical; font-size: 0.8rem; }

.err-msg { color: var(--red); font-size: 0.8rem; margin-bottom: 0.6rem; }

/* ── Main App Layout ── */
#app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sb-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 1.25rem 0;
  z-index: 100;
}
.sb-brand {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.sb-icon { font-size: 1.6rem; }
.sb-brand-text { display: flex; flex-direction: column; }
.sb-title { font-weight: 700; font-size: 0.95rem; color: var(--gold); line-height: 1.2; }
.sb-sub { font-size: 0.72rem; color: var(--muted); }

.sb-nav { display: flex; flex-direction: column; gap: 2px; padding: 1rem 0.75rem; flex: 1; }
.nav-lnk {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--muted2); font-size: 0.875rem; font-weight: 500;
  transition: all .2s;
}
.nav-lnk:hover { background: var(--card); color: var(--text); }
.nav-lnk.active { background: var(--gold-glow); color: var(--gold); font-weight: 600; }
.nav-lnk span { font-size: 1.1rem; }

.sb-logout { margin: 0 1.25rem 0.5rem; color: var(--muted); font-size: 0.8rem; align-self: flex-start; }
.sb-logout:hover { color: var(--red); }

/* ── Main Content ── */
#main {
  margin-left: var(--sb-width);
  flex: 1; padding: 2rem;
  max-width: 1100px;
  min-height: 100vh;
}

/* ── Page ── */
.page { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.page-hdr {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.75rem; gap: 1rem; flex-wrap: wrap;
}
.page-hdr h1 { font-size: 1.6rem; font-weight: 700; }
.muted { color: var(--muted2); font-size: 0.85rem; margin-top: 0.2rem; }

/* ── Stat Cards ── */
.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 1.25rem; }
.stats-3 { grid-template-columns: repeat(3,1fr); }
.scard {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem 1rem;
  display: flex; align-items: center; gap: 0.9rem;
  transition: transform .2s, box-shadow .2s;
}
.scard:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.scard.gold { border-color: var(--gold-dark); background: var(--gold-glow); }
.scard.success-bg { border-color: rgba(52,211,153,0.3); background: rgba(52,211,153,0.06); }
.scard.danger-bg { border-color: rgba(248,113,113,0.3); background: rgba(248,113,113,0.06); }
.scard-icon { font-size: 1.6rem; }
.scard-lbl { font-size: 0.75rem; color: var(--muted2); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.scard-val { font-size: 1.35rem; font-weight: 700; margin-top: 0.1rem; }
.scard-val.green { color: var(--green); }
.scard-val.red { color: var(--red); }

/* ── Card ── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem 1.5rem;
  margin-bottom: 1.25rem;
}
.card-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: .5rem; }
.card-hdr h2 { font-size: 1rem; font-weight: 600; }
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 1.2rem; color: var(--gold); }

/* ── Progress ── */
.prog-track { height: 10px; background: var(--surface); border-radius: 99px; overflow: hidden; margin-bottom: 0.6rem; }
.prog-fill { height: 100%; background: linear-gradient(90deg, var(--gold-dark), var(--gold)); border-radius: 99px; transition: width 1s ease; }
.prog-lbl { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted2); }

.badge { background: var(--gold-glow); color: var(--gold); border: 1px solid var(--gold-dark); border-radius: 99px; padding: 0.2rem 0.7rem; font-size: 0.75rem; font-weight: 600; }

/* ── Payment Status Grid ── */
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.7rem; }
.status-cell {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.7rem 0.9rem;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.status-cell.paid { border-color: rgba(52,211,153,0.4); background: rgba(52,211,153,0.06); }
.status-cell.partial { border-color: rgba(245,166,35,0.4); background: rgba(245,166,35,0.06); }
.status-cell.pending { border-color: rgba(248,113,113,0.3); background: rgba(248,113,113,0.04); }
.status-cell .sc-name { font-size: 0.82rem; font-weight: 600; }
.status-cell .sc-amt { font-size: 0.75rem; color: var(--muted2); }
.status-cell .sc-badge { font-size: 0.68rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 99px; align-self: flex-start; margin-top: 0.25rem; }
.sc-badge.paid { background: rgba(52,211,153,0.2); color: var(--green); }
.sc-badge.partial { background: rgba(245,166,35,0.2); color: var(--gold); }
.sc-badge.pending { background: rgba(248,113,113,0.15); color: var(--red); }

/* ── Chart ── */
.chart-wrap { position: relative; height: 220px; }

/* ── Recent Activity ── */
.act-item {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.7rem 0; border-bottom: 1px solid var(--border);
}
.act-item:last-child { border-bottom: none; }
.act-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.act-dot.in { background: var(--green); }
.act-dot.out { background: var(--red); }
.act-body { flex: 1; }
.act-desc { font-size: 0.85rem; }
.act-time { font-size: 0.75rem; color: var(--muted); }
.act-amt { font-size: 0.9rem; font-weight: 600; }
.act-amt.in { color: var(--green); }
.act-amt.out { color: var(--red); }

/* ── Members Grid ── */
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.m-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem;
  transition: transform .2s, box-shadow .2s;
}
.m-card:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(0,0,0,.35); }
.m-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--gold-glow); border: 2px solid var(--gold-dark); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: 0.8rem; }
.m-name { font-weight: 700; font-size: 0.95rem; }
.m-role { font-size: 0.75rem; color: var(--gold); margin-bottom: 0.5rem; }
.m-phone { font-size: 0.78rem; color: var(--muted2); margin-bottom: 0.5rem; }
.m-amount { font-size: 1.05rem; font-weight: 700; color: var(--gold); }
.m-amount-lbl { font-size: 0.7rem; color: var(--muted); }
.m-actions { display: flex; gap: 0.5rem; margin-top: 0.9rem; }

/* ── Filter Bar ── */
.filter-bar { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter-bar select { flex: 1; min-width: 130px; }

/* ── Payments List ── */
.pay-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr auto auto;
  gap: 0.75rem; align-items: center;
  padding: 0.85rem 0; border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.pay-row:last-child { border-bottom: none; }
.pay-member { font-weight: 600; }
.pay-period { color: var(--muted2); font-size: 0.8rem; }
.pay-amount { font-weight: 700; }
.pay-proof-btn { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.3rem 0.65rem; font-size: 0.75rem; color: var(--gold); cursor: pointer; }
.pay-proof-btn:hover { background: var(--gold-glow); }

/* ── Status Badges ── */
.status-pill { padding: 0.2rem 0.65rem; border-radius: 99px; font-size: 0.72rem; font-weight: 600; }
.status-pill.paid { background: rgba(52,211,153,0.15); color: var(--green); }
.status-pill.partial { background: rgba(245,166,35,0.15); color: var(--gold); }
.status-pill.pending { background: rgba(248,113,113,0.12); color: var(--red); }

/* ── Ledger Table ── */
.ledger-tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 0.75rem; }
.ltab { padding: 0.4rem 1rem; border-radius: 99px; font-size: 0.82rem; font-weight: 600; color: var(--muted2); transition: all .2s; }
.ltab:hover { color: var(--text); background: var(--surface); }
.ltab.active { background: var(--gold-glow); color: var(--gold); }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.tbl th { text-align: left; padding: 0.6rem 0.75rem; color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 0.8rem 0.75rem; border-bottom: 1px solid var(--border); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,255,255,0.02); }
.type-in { color: var(--green); font-weight: 600; }
.type-out { color: var(--red); font-weight: 600; }

/* ── Settings ── */
.settings-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1.25rem; }

/* ── Forms ── */
.fg { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; }
.fg label { font-size: 0.8rem; font-weight: 600; color: var(--muted2); }
.fg small { font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; }
input[type="text"], input[type="number"], input[type="date"], input[type="password"], select, textarea {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.65rem 0.9rem;
  color: var(--text); outline: none; transition: border-color .2s; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
select option { background: var(--surface); }

/* ── Upload Zone ── */
.upload-zone {
  position: relative; border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 1rem; text-align: center; cursor: pointer; color: var(--muted2); font-size: 0.82rem;
  transition: border-color .2s, background .2s;
}
.upload-zone:hover { border-color: var(--gold); background: var(--gold-glow); color: var(--gold); }
.file-inp { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.proof-preview { margin-top: 0.5rem; }
.proof-preview img { max-height: 120px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.proof-preview p { font-size: 0.78rem; color: var(--muted2); padding: 0.5rem; background: var(--surface); border-radius: var(--radius-sm); }

.upload-prog { margin-top: 0.5rem; }
.upload-prog-bar { height: 6px; background: var(--surface); border-radius: 99px; overflow: hidden; }
.upload-prog-fill { height: 100%; background: var(--gold); border-radius: 99px; width: 0%; transition: width .3s; }

/* ── Proof Viewer ── */
.proof-viewer { text-align: center; padding: 1rem 0; }
.proof-viewer img { max-width: 100%; max-height: 70vh; border-radius: var(--radius-sm); }
.proof-viewer iframe { width: 100%; height: 65vh; border: none; border-radius: var(--radius-sm); }

/* ── Modals ── */
.modal-bd { position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 200; backdrop-filter: blur(4px); }
.modal { position: fixed; inset: 0; z-index: 201; display: flex; align-items: center; justify-content: center; padding: 1rem; pointer-events: none; }
.modal:not(.hidden) { pointer-events: all; }
.modal-box {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.75rem;
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  animation: slideUp .25s ease;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.modal-lg { max-width: 700px; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.modal-hdr h2 { font-size: 1.05rem; font-weight: 700; }
.modal-close { font-size: 1.1rem; color: var(--muted2); transition: color .2s; }
.modal-close:hover { color: var(--red); }
.modal-ftr { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.2rem; }

/* ── Buttons ── */
.btn-gold { background: var(--gold); color: #000; font-weight: 700; border-radius: var(--radius-sm); padding: 0.65rem 1.3rem; transition: background .2s, transform .15s; font-size: 0.875rem; }
.btn-gold:hover { background: var(--gold-dark); transform: translateY(-1px); }
.btn-gold:active { transform: translateY(0); }
.btn-red { background: rgba(248,113,113,0.15); color: var(--red); border: 1px solid rgba(248,113,113,0.3); font-weight: 700; border-radius: var(--radius-sm); padding: 0.65rem 1.3rem; transition: all .2s; font-size: 0.875rem; }
.btn-red:hover { background: rgba(248,113,113,0.25); }
.btn-ghost-sm { background: var(--surface); color: var(--muted2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.55rem 1rem; font-size: 0.82rem; font-weight: 500; transition: all .2s; }
.btn-ghost-sm:hover { color: var(--text); border-color: var(--muted2); }
.btn-icon { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.35rem 0.6rem; font-size: 0.8rem; color: var(--muted2); transition: all .2s; }
.btn-icon:hover { color: var(--text); }
.btn-icon.del:hover { color: var(--red); border-color: rgba(248,113,113,0.4); }
.w-full { width: 100%; }
.mt-1 { margin-top: 0.75rem; }

/* ── Misc ── */
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.row-gap { display: flex; gap: 0.5rem; }
.sel-sm { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.35rem 0.6rem; color: var(--text); font-size: 0.8rem; }
.cfg-pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.9rem; font-size: 0.72rem; color: var(--muted2); white-space: pre-wrap; word-break: break-all; margin-top: 0.5rem; max-height: 180px; overflow-y: auto; }
.empty { color: var(--muted); font-size: 0.85rem; padding: 1.5rem 0; text-align: center; }

/* ── Toast ── */
#toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.75rem 1.1rem;
  font-size: 0.85rem; font-weight: 500; box-shadow: var(--shadow);
  animation: toastIn .3s ease; max-width: 300px;
}
.toast.success { border-color: rgba(52,211,153,0.4); color: var(--green); }
.toast.error { border-color: rgba(248,113,113,0.4); color: var(--red); }
.toast.info { border-color: rgba(96,165,250,0.4); color: var(--blue); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

/* ── Bottom Nav (mobile) ── */
#bottom-nav { display: none; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2,1fr); }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  #sidebar { display: none; }
  #main { margin-left: 0; padding: 1rem 1rem calc(var(--bn-height) + 1rem); }
  #bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--bn-height); background: var(--surface);
    border-top: 1px solid var(--border); z-index: 100;
  }
  .bnav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 2px; color: var(--muted2); font-size: 0.65rem;
    transition: color .2s;
  }
  .bnav-item span { font-size: 1.3rem; }
  .bnav-item.active { color: var(--gold); }
  .stats-row { grid-template-columns: repeat(2,1fr); }
  .pay-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .m-grid { grid-template-columns: 1fr 1fr; }
  .page-hdr { flex-direction: column; }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Import CSV ── */
.import-how { display: flex; flex-direction: column; gap: .6rem; }
.import-step { display: flex; align-items: flex-start; gap: .75rem; font-size: .82rem; color: var(--muted2); }
.import-step b { color: var(--text); }

.import-tabs { display: flex; gap: .4rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: .75rem; }
.itab { padding: .4rem 1rem; border-radius: 99px; font-size: .82rem; font-weight: 600; color: var(--muted2); transition: all .2s; }
.itab:hover { color: var(--text); background: var(--surface); }
.itab.active { background: var(--gold-glow); color: var(--gold); }
.itab-panel { animation: fadeIn .2s ease; }

.col-map-grid { display: flex; flex-direction: column; gap: .5rem; margin: 1rem 0; }
.col-map-row { display: grid; grid-template-columns: 1.2fr 1.5fr 1fr; gap: .75rem; align-items: center; padding: .5rem .6rem; border-radius: var(--radius-sm); }
.col-map-row.header-row { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: var(--surface); }
.col-map-row:not(.header-row) { background: rgba(255,255,255,0.02); border: 1px solid var(--border); }
.map-label { font-size: .83rem; font-weight: 500; }
.map-label .req { color: var(--gold); }
.map-sel { font-size: .8rem; padding: .4rem .6rem; }
.map-example { font-size: .75rem; color: var(--muted2); font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.import-options { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem 1rem; margin: .75rem 0; }
.import-preview-info { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.import-preview-wrap { margin-top: .75rem; max-height: 180px; overflow-y: auto; }

