/* ═══════════════════════════════════════════════════════════
   BinaNet — Mobile-First CSS
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg-primary:    #0f1117;
  --bg-secondary:  #1a1d27;
  --bg-card:       #1e2132;
  --bg-card2:      #252840;
  --border:        rgba(255,255,255,0.06);
  --border-light:  rgba(255,255,255,0.1);
  --accent:        #6c63ff;
  --accent-light:  #8b83ff;
  --accent-glow:   rgba(108,99,255,0.25);
  --green:         #26de81;
  --green-dim:     rgba(38,222,129,0.15);
  --red:           #ff5e5e;
  --red-dim:       rgba(255,94,94,0.15);
  --orange:        #f5a623;
  --orange-dim:    rgba(245,166,35,0.15);
  --blue:          #45aaf2;
  --blue-dim:      rgba(69,170,242,0.15);
  --yellow:        #ffd32a;
  --text-primary:  #f0f2ff;
  --text-secondary:#9ba3c4;
  --text-muted:    #5c6285;
  --topbar-h:      56px;
  --bottom-nav-h:  64px;
  --radius:        16px;
  --radius-sm:     10px;
  --radius-lg:     24px;
  --shadow:        0 8px 32px rgba(0,0,0,0.35);
  --shadow-sm:     0 2px 12px rgba(0,0,0,0.25);
}

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

html, body {
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { text-decoration: none; color: inherit; }

.hidden { display: none !important; }
.w-full { width: 100%; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-card2); border-radius: 4px; }

/* ═══════════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════════ */
.login-page {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  overflow: hidden;
}

.login-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 20% 20%, rgba(108,99,255,.35) 0%, transparent 55%),
              radial-gradient(ellipse at 80% 80%, rgba(38,222,129,.2) 0%, transparent 55%),
              var(--bg-primary);
}

.login-orb {
  position: absolute; border-radius: 50%;
  filter: blur(60px); pointer-events: none;
  animation: float 6s ease-in-out infinite;
}
.orb1 { width:250px; height:250px; top:-60px; left:-60px; background:rgba(108,99,255,.3); }
.orb2 { width:200px; height:200px; bottom:-40px; right:-40px; background:rgba(38,222,129,.2); animation-delay:2s; }
.orb3 { width:150px; height:150px; top:50%; left:50%; transform:translate(-50%,-50%); background:rgba(69,170,242,.15); animation-delay:4s; }

@keyframes float {
  0%,100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-20px) scale(1.05); }
}

.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 380px;
  background: rgba(30,33,50,0.85);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
}

.login-logo-wrap { text-align: center; margin-bottom: 2rem; }
.login-icon { font-size: 3.5rem; line-height: 1; margin-bottom: .5rem; }
.login-brand { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.5px; }
.login-tagline { color: var(--text-secondary); font-size: .85rem; margin-top: .25rem; }

.login-form { display: flex; flex-direction: column; gap: .75rem; }

.input-field {
  display: flex; align-items: center;
  background: var(--bg-primary);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color .2s;
}
.input-field:focus-within { border-color: var(--accent); }
.input-prefix { padding: 0 .75rem; font-size: 1rem; }
.input-field input {
  flex: 1; padding: .85rem .75rem .85rem 0;
  background: none; border: none; outline: none;
  color: var(--text-primary); font-size: .95rem;
}
.input-field input::placeholder { color: var(--text-muted); }

.login-error {
  background: var(--red-dim); border: 1px solid var(--red);
  color: var(--red); padding: .6rem .9rem;
  border-radius: var(--radius-sm); font-size: .85rem;
}

.btn-login {
  padding: .9rem; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff; font-size: 1rem; font-weight: 700;
  letter-spacing: .3px;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: all .2s;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 8px 28px var(--accent-glow); }
.btn-login:active { transform: translateY(0); }

.login-hint { text-align:center; margin-top:1.25rem; }
.hint-chip {
  display: inline-block;
  background: var(--bg-card2); color: var(--text-secondary);
  font-size: .8rem; padding: .35rem .9rem;
  border-radius: 20px; border: 1px solid var(--border);
  font-family: monospace;
}

/* ═══════════════════════════════════════════════════════════
   MAIN APP SHELL
   ═══════════════════════════════════════════════════════════ */
.main-app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: var(--bg-primary);
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; padding: 0 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 50;
  flex-shrink: 0;
  gap: .75rem;
}

.topbar-back {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1.2rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.topbar-back:hover { background: var(--bg-card2); }

.topbar-title {
  flex: 1; font-size: 1.05rem; font-weight: 700;
  color: var(--text-primary); letter-spacing: -0.3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.topbar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff; font-weight: 800; font-size: .95rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer;
  transition: transform .15s;
}
.topbar-avatar:hover { transform: scale(1.05); }

/* ── Page Container ─────────────────────────────────────── */
.page-container {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding-bottom: calc(var(--bottom-nav-h) + 1rem);
  scroll-behavior: smooth;
}

.page { display: none; padding: 1rem; animation: pageIn .2s ease; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Bottom Nav ─────────────────────────────────────────── */
.bottom-nav {
  height: var(--bottom-nav-h);
  display: flex;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  position: relative; z-index: 50;
  flex-shrink: 0;
}

.bnav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; color: var(--text-muted);
  font-size: .65rem; font-weight: 500;
  transition: color .15s, transform .1s;
  position: relative;
}
.bnav-item:active { transform: scale(0.92); }
.bnav-item.active { color: var(--accent); }
.bnav-item.active::before {
  content: '';
  position: absolute; top: 0; left: 20%; right: 20%; height: 2px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}
.bnav-icon { font-size: 1.3rem; line-height: 1; }
.bnav-label { line-height: 1; }

/* ── FAB ────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 1rem);
  right: 1.25rem;
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff; font-size: 1.5rem; font-weight: 300;
  box-shadow: 0 6px 24px var(--accent-glow);
  z-index: 40;
  transition: transform .2s, box-shadow .2s;
  display: flex; align-items: center; justify-content: center;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 10px 32px var(--accent-glow); }
.fab:active { transform: scale(0.95); }

/* ═══════════════════════════════════════════════════════════
   SECTION CARDS
   ═══════════════════════════════════════════════════════════ */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .875rem;
}
.section-header h2 { font-size: .975rem; font-weight: 700; }

.see-all-btn {
  font-size: .78rem; color: var(--accent); font-weight: 600;
  padding: .25rem .6rem; border-radius: 6px;
  background: var(--accent-glow);
  transition: background .15s;
}
.see-all-btn:hover { background: rgba(108,99,255,.35); }

/* ═══════════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════════ */
.greeting-bar {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1.25rem; padding: .125rem 0;
}
.greeting-hello { font-size: .85rem; color: var(--text-secondary); }
.greeting-name { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.5px; margin-top: 2px; }
.greeting-date { font-size: .75rem; color: var(--text-muted); text-align: right; line-height: 1.5; }

/* Stats row */
.stats-row {
  display: flex; gap: .625rem;
  margin-bottom: 1rem; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.stats-row::-webkit-scrollbar { display: none; }
.stat-pill {
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1rem;
  min-width: 130px;
}
.pill-label { font-size: .7rem; color: var(--text-muted); margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .5px; }
.pill-value { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.5px; }
.pill-bank .pill-value { color: var(--accent-light); }
.pill-income .pill-value { color: var(--green); }
.pill-expense .pill-value { color: var(--red); }

/* Dues progress */
.dues-overview { display: flex; flex-direction: column; gap: .875rem; }
.dues-bar-wrap { display: flex; align-items: center; gap: .75rem; }
.dues-bar-track {
  flex: 1; height: 10px; background: var(--bg-primary);
  border-radius: 10px; overflow: hidden;
}
.dues-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 10px;
  transition: width .5s ease;
}
.dues-bar-pct { font-size: .875rem; font-weight: 700; color: var(--green); min-width: 36px; text-align: right; }
.dues-counts { display: flex; gap: .5rem; }
.dues-count-item {
  flex: 1; background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: .625rem .5rem; text-align: center;
}
.dci-num { font-size: 1.1rem; font-weight: 800; }
.dci-label { font-size: .68rem; color: var(--text-muted); margin-top: 2px; }
.dues-count-item.paid .dci-num { color: var(--green); }
.dues-count-item.pending .dci-num { color: var(--orange); }
.dues-count-item.debt .dci-num { color: var(--red); font-size: .9rem; }

/* Quick grid */
.quick-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: .625rem; margin-bottom: 1rem;
}
.quick-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem .5rem;
  display: flex; flex-direction: column; align-items: center;
  gap: .4rem;
  transition: all .15s;
}
.quick-btn:active { transform: scale(.95); background: var(--bg-card2); }
.qb-icon { font-size: 1.5rem; }
.qb-text { font-size: .68rem; color: var(--text-secondary); font-weight: 500; text-align: center; }

/* Announcements mini */
#dashAnnouncements { display: flex; flex-direction: column; gap: .5rem; }
.ann-mini {
  display: flex; gap: .625rem; align-items: flex-start;
  background: var(--bg-primary); border-radius: var(--radius-sm);
  padding: .625rem .75rem;
  border-left: 3px solid var(--text-muted);
}
.ann-mini.urgent { border-color: var(--red); }
.ann-mini.high { border-color: var(--orange); }
.ann-mini.normal { border-color: var(--blue); }
.ann-mini.low { border-color: var(--text-muted); }
.ann-mini-title { font-size: .85rem; font-weight: 600; }
.ann-mini-date { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }

/* Mini chart */
.mini-chart {
  display: flex; align-items: flex-end; justify-content: space-between;
  height: 80px; gap: 3px; padding: 0 0 4px;
}
.chart-pair { flex: 1; display: flex; gap: 2px; align-items: flex-end; }
.ch-bar {
  flex: 1; border-radius: 3px 3px 0 0;
  min-height: 4px; transition: height .4s ease;
}
.ch-bar.income { background: var(--accent); }
.ch-bar.expense { background: var(--red); opacity: .7; }
.chart-legend { display: flex; gap: 1rem; margin-top: .5rem; font-size: .75rem; color: var(--text-secondary); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.legend-dot.income { background: var(--accent); }
.legend-dot.expense { background: var(--red); }

/* ═══════════════════════════════════════════════════════════
   APARTMENTS PAGE
   ═══════════════════════════════════════════════════════════ */
.page-search-bar { margin-bottom: .75rem; }
.search-input {
  width: 100%; padding: .75rem 1rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: .9rem; outline: none;
  transition: border-color .2s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

/* Debt summary bar */
.debt-summary-bar {
  display: flex; gap: .5rem; margin-bottom: 1rem;
}
.dsb-item {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .625rem .5rem; text-align: center;
}
.dsb-val { font-size: 1rem; font-weight: 800; letter-spacing: -0.5px; color: var(--text-primary); }
.dsb-val.green { color: var(--green); }
.dsb-val.red { color: var(--red); }
.dsb-lbl { font-size: .67rem; color: var(--text-muted); margin-top: 2px; }

/* Apartment grid */
.apartment-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}

.apt-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .875rem;
  cursor: pointer; transition: all .15s;
  position: relative; overflow: hidden;
}
.apt-card:active { transform: scale(.97); }
.apt-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.apt-card.no-debt::before { background: var(--green); }
.apt-card.has-debt::before { background: var(--red); }
.apt-card.partial-debt::before { background: var(--orange); }
.apt-card.no-data::before { background: var(--text-muted); }

.apt-card-num { font-size: .78rem; font-weight: 700; color: var(--text-secondary); margin-bottom: .2rem; }
.apt-card-owner { font-size: .875rem; font-weight: 600; margin-bottom: .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apt-card-debt {
  font-size: .8rem; font-weight: 700;
  padding: .2rem .5rem; border-radius: 6px;
  display: inline-block;
}
.apt-card.no-debt .apt-card-debt { color: var(--green); background: var(--green-dim); }
.apt-card.has-debt .apt-card-debt { color: var(--red); background: var(--red-dim); }
.apt-card.partial-debt .apt-card-debt { color: var(--orange); background: var(--orange-dim); }
.apt-card.no-data .apt-card-debt { color: var(--text-muted); background: rgba(255,255,255,.05); }
.apt-card-floor { font-size: .7rem; color: var(--text-muted); margin-top: .35rem; }

/* ═══════════════════════════════════════════════════════════
   APARTMENT DETAIL
   ═══════════════════════════════════════════════════════════ */
.apt-detail-hero {
  background: linear-gradient(135deg, var(--accent) 0%, #3d35c0 100%);
  border-radius: var(--radius); padding: 1.25rem;
  margin-bottom: 1rem; text-align: center;
}
.adh-apt-name { font-size: 1.5rem; font-weight: 800; margin-bottom: .25rem; }
.adh-owner { font-size: .95rem; opacity: .85; }
.adh-floor { font-size: .8rem; opacity: .65; margin-top: .25rem; }

.debt-cards-row { display: flex; gap: .625rem; margin-bottom: 1rem; }
.debt-card {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .75rem .5rem; text-align: center;
}
.dc-label { font-size: .67rem; color: var(--text-muted); margin-bottom: .3rem; text-transform: uppercase; }
.dc-value { font-size: .95rem; font-weight: 800; }
.debt-card.total .dc-value { color: var(--blue); }
.debt-card.paid .dc-value { color: var(--green); }
.debt-card.debt .dc-value { color: var(--red); }

/* Unpaid months */
.unpaid-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--red-dim); border: 1px solid rgba(255,94,94,.2);
  border-radius: var(--radius-sm); padding: .75rem;
  margin-bottom: .5rem;
}
.ui-month { font-size: .875rem; font-weight: 600; }
.ui-remaining { font-size: .875rem; font-weight: 700; color: var(--red); }
.ui-pay-btn {
  background: var(--accent); color: #fff;
  padding: .35rem .75rem; border-radius: 8px;
  font-size: .8rem; font-weight: 700;
  transition: background .15s;
}
.ui-pay-btn:active { background: var(--accent-light); }

/* Due history items */
.due-history-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 0; border-bottom: 1px solid var(--border);
}
.due-history-item:last-child { border-bottom: none; }
.dhi-left { display: flex; align-items: center; gap: .625rem; }
.dhi-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.dhi-dot.paid { background: var(--green); }
.dhi-dot.partial { background: var(--orange); }
.dhi-dot.unpaid { background: var(--red); }
.dhi-month { font-size: .875rem; font-weight: 500; }
.dhi-right { text-align: right; }
.dhi-amount { font-size: .85rem; font-weight: 700; }
.dhi-status { font-size: .7rem; color: var(--text-muted); margin-top: 1px; }

/* Payment items */
.payment-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .6rem 0; border-bottom: 1px solid var(--border);
}
.payment-item:last-child { border-bottom: none; }
.pi-desc { font-size: .85rem; font-weight: 500; }
.pi-method { font-size: .72rem; color: var(--text-muted); }
.pi-amount { font-size: .9rem; font-weight: 700; color: var(--green); }
.pi-date { font-size: .7rem; color: var(--text-muted); }
.pi-del {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--red-dim); color: var(--red);
  font-size: .8rem; display: flex; align-items: center; justify-content: center;
  margin-left: .5rem;
  transition: background .15s;
}
.pi-del:active { background: var(--red); color: #fff; }

/* Apt edit form */
.apt-edit-form { display: flex; flex-direction: column; gap: .75rem; }

/* ═══════════════════════════════════════════════════════════
   DUES PAGE
   ═══════════════════════════════════════════════════════════ */
.filter-bar {
  display: flex; gap: .5rem; margin-bottom: .875rem; align-items: center;
}
.filter-select {
  flex: 1; padding: .65rem .75rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: .875rem; outline: none;
}
.btn-filter {
  padding: .65rem 1rem; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff;
  font-size: .85rem; font-weight: 600; flex-shrink: 0;
  transition: background .15s;
}
.btn-filter:active { background: var(--accent-light); }

.dues-summary-strip {
  display: flex; gap: .5rem; overflow-x: auto;
  margin-bottom: .875rem;
}
.dues-summary-strip::-webkit-scrollbar { display: none; }
.dss-pill {
  flex-shrink: 0; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 20px;
  padding: .4rem .9rem; text-align: center;
}
.dss-val { font-size: .9rem; font-weight: 700; }
.dss-lbl { font-size: .68rem; color: var(--text-muted); }

.action-strip {
  display: flex; gap: .5rem; margin-bottom: .875rem; justify-content: flex-end;
}
.btn-accent-sm {
  padding: .55rem .9rem; border-radius: var(--radius-sm);
  background: var(--orange-dim); color: var(--orange);
  font-size: .82rem; font-weight: 700; border: 1px solid var(--orange);
  transition: all .15s;
}
.btn-primary-sm {
  padding: .55rem .9rem; border-radius: var(--radius-sm);
  background: var(--accent-glow); color: var(--accent-light);
  font-size: .82rem; font-weight: 700; border: 1px solid var(--accent);
  transition: all .15s;
}
.btn-accent-sm:active, .btn-primary-sm:active { transform: scale(.96); }

/* Dues list */
.due-row {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .875rem;
  margin-bottom: .5rem; display: flex;
  align-items: center; gap: .75rem;
}
.dr-status {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.dr-status.paid { background: var(--green-dim); }
.dr-status.partial { background: var(--orange-dim); }
.dr-status.unpaid { background: var(--red-dim); }
.dr-info { flex: 1; min-width: 0; }
.dr-apt { font-size: .875rem; font-weight: 700; }
.dr-owner { font-size: .75rem; color: var(--text-secondary); }
.dr-month { font-size: .72rem; color: var(--text-muted); }
.dr-right { text-align: right; flex-shrink: 0; }
.dr-amount { font-size: .9rem; font-weight: 800; }
.dr-paid-info { font-size: .7rem; color: var(--text-muted); margin-top: 2px; }
.dr-actions { display: flex; gap: .35rem; margin-top: .35rem; justify-content: flex-end; }
.dr-pay-btn {
  padding: .3rem .65rem; border-radius: 6px;
  background: var(--accent); color: #fff;
  font-size: .75rem; font-weight: 600;
  transition: background .15s;
}
.dr-del-btn {
  padding: .3rem .5rem; border-radius: 6px;
  background: var(--red-dim); color: var(--red);
  font-size: .75rem; border: 1px solid rgba(255,94,94,.2);
}

/* ═══════════════════════════════════════════════════════════
   INCOME / EXPENSES
   ═══════════════════════════════════════════════════════════ */
.income-summary, .expense-summary {
  display: flex; gap: .5rem; overflow-x: auto;
  margin-bottom: .875rem;
}
.income-summary::-webkit-scrollbar, .expense-summary::-webkit-scrollbar { display: none; }
.summary-chip {
  flex-shrink: 0; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .6rem .85rem;
}
.sc-val { font-size: 1rem; font-weight: 800; }
.sc-lbl { font-size: .68rem; color: var(--text-muted); margin-top: 2px; }

.list-row {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .75rem;
  margin-bottom: .4rem;
}
.lr-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .35rem; }
.lr-badge {
  font-size: .72rem; font-weight: 600; padding: .2rem .6rem;
  border-radius: 20px;
}
.lr-amount-pos { font-size: .9rem; font-weight: 800; color: var(--green); }
.lr-amount-neg { font-size: .9rem; font-weight: 800; color: var(--red); }
.lr-desc { font-size: .82rem; color: var(--text-secondary); }
.lr-meta { font-size: .72rem; color: var(--text-muted); margin-top: .35rem; display: flex; gap: .75rem; }
.lr-del {
  background: none; color: var(--red); font-size: .95rem;
  padding: .2rem; border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════
   ANNOUNCEMENTS
   ═══════════════════════════════════════════════════════════ */
.ann-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 4px solid var(--text-muted);
  border-radius: var(--radius-sm); padding: 1rem;
  margin-bottom: .625rem;
}
.ann-card.urgent { border-left-color: var(--red); }
.ann-card.high { border-left-color: var(--orange); }
.ann-card.normal { border-left-color: var(--blue); }
.ann-card.low { border-left-color: var(--text-muted); }
.ann-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .5rem; }
.ann-title { font-size: .9rem; font-weight: 700; flex: 1; margin-right: .5rem; }
.ann-priority-badge {
  font-size: .7rem; padding: .2rem .55rem; border-radius: 20px;
  flex-shrink: 0;
}
.ann-priority-badge.urgent { background: var(--red-dim); color: var(--red); }
.ann-priority-badge.high { background: var(--orange-dim); color: var(--orange); }
.ann-priority-badge.normal { background: var(--blue-dim); color: var(--blue); }
.ann-priority-badge.low { background: rgba(255,255,255,.06); color: var(--text-muted); }
.ann-content { font-size: .82rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: .625rem; }
.ann-footer { display: flex; justify-content: space-between; align-items: center; }
.ann-author { font-size: .72rem; color: var(--text-muted); }
.ann-del {
  background: var(--red-dim); color: var(--red);
  padding: .3rem .6rem; border-radius: 6px; font-size: .78rem;
}

/* ═══════════════════════════════════════════════════════════
   BANK PAGE
   ═══════════════════════════════════════════════════════════ */
.bank-hero-card {
  background: linear-gradient(135deg, #1a2a8f 0%, #0f1852 100%);
  border-radius: var(--radius-lg); padding: 2rem 1.5rem;
  text-align: center; margin-bottom: 1rem;
  border: 1px solid rgba(255,255,255,.1);
}
.bhc-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.bhc-name { font-size: 1.1rem; font-weight: 700; }
.bhc-account { font-size: .78rem; color: rgba(255,255,255,.5); margin: .25rem 0; font-family: monospace; }
.bhc-balance { font-size: 2.2rem; font-weight: 900; color: var(--green); margin: .75rem 0 .25rem; letter-spacing: -1px; }
.bhc-label { font-size: .75rem; color: rgba(255,255,255,.45); }

.bank-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .625rem; }
.bank-stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .875rem;
  text-align: center;
}
.bsc-icon { font-size: 1.5rem; margin-bottom: .35rem; }
.bsc-label { font-size: .72rem; color: var(--text-muted); margin-bottom: .3rem; }
.bsc-value { font-size: 1rem; font-weight: 800; }
.bsc-value.green { color: var(--green); }
.bsc-value.red { color: var(--red); }

/* ═══════════════════════════════════════════════════════════
   REPORTS
   ═══════════════════════════════════════════════════════════ */
.report-tabs {
  display: flex; gap: .375rem; margin-bottom: 1rem;
  background: var(--bg-card); border-radius: var(--radius-sm);
  padding: .35rem; border: 1px solid var(--border);
}
.rtab {
  flex: 1; padding: .55rem; border-radius: 8px;
  font-size: .8rem; font-weight: 600; color: var(--text-muted);
  transition: all .15s;
}
.rtab.active { background: var(--accent); color: #fff; }

.report-tab-content { display: block; }
.report-summary-strip {
  display: flex; gap: .5rem; overflow-x: auto;
  margin-bottom: .875rem;
}
.report-summary-strip::-webkit-scrollbar { display: none; }

.report-row {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .75rem;
  margin-bottom: .4rem; display: flex;
  align-items: center; justify-content: space-between;
}
.rr-month { font-size: .875rem; font-weight: 600; }
.rr-vals { display: flex; gap: 1rem; }
.rr-inc { font-size: .82rem; color: var(--green); font-weight: 600; }
.rr-exp { font-size: .82rem; color: var(--red); font-weight: 600; }
.rr-net { font-size: .82rem; font-weight: 700; }

/* Debt report */
.debt-report-row {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .875rem;
  margin-bottom: .5rem; display: flex;
  align-items: center; justify-content: space-between; cursor: pointer;
  transition: background .15s;
}
.debt-report-row:active { background: var(--bg-card2); }
.drr-apt { font-size: .875rem; font-weight: 700; }
.drr-owner { font-size: .75rem; color: var(--text-secondary); }
.drr-debt {
  font-size: .95rem; font-weight: 800;
  padding: .25rem .65rem; border-radius: 8px;
}
.drr-debt.clean { color: var(--green); background: var(--green-dim); }
.drr-debt.owed { color: var(--red); background: var(--red-dim); }

/* ═══════════════════════════════════════════════════════════
   SETTINGS PAGE
   ═══════════════════════════════════════════════════════════ */
.settings-profile-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  text-align: center; margin-bottom: 1rem;
}
.spc-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff; font-size: 1.8rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto .75rem;
}
.spc-name { font-size: 1.2rem; font-weight: 800; }
.spc-role { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

.settings-section {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.settings-item {
  display: flex; align-items: center; gap: .875rem;
  padding: 1rem; font-size: .9rem; cursor: pointer;
  transition: background .15s; border-bottom: 1px solid var(--border);
}
.settings-item:last-child { border-bottom: none; }
.settings-item:active { background: var(--bg-card2); }
.settings-item.danger { color: var(--red); }
.settings-item .arrow { margin-left: auto; color: var(--text-muted); font-size: 1.2rem; }

/* ═══════════════════════════════════════════════════════════
   MODAL SHEETS
   ═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}

.modal-sheet {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border: 1px solid var(--border-light); border-bottom: none;
  padding: 1rem 1.25rem 2rem;
  width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto;
  position: absolute; bottom: 0; left: 0; right: 0;
  animation: slideUp .25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 40px; height: 4px;
  background: var(--border-light); border-radius: 4px;
  margin: 0 auto .875rem;
}
.modal-title {
  font-size: 1.05rem; font-weight: 800;
  margin-bottom: 1rem; color: var(--text-primary);
}
.modal-info { font-size: .82rem; color: var(--text-secondary); margin-bottom: .875rem; }
.modal-actions {
  display: flex; gap: .625rem; margin-top: 1.25rem;
}
.modal-actions button { flex: 1; }

/* ═══════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════ */
.form-field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .75rem; }
.form-field label { font-size: .8rem; font-weight: 600; color: var(--text-secondary); }
.form-input {
  background: var(--bg-primary); border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text-primary);
  padding: .75rem .9rem; font-size: .9rem; outline: none;
  transition: border-color .2s; width: 100%;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-muted); }
select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; }

.form-row { display: flex; gap: .625rem; }
.form-row .form-field { flex: 1; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn-primary {
  padding: .8rem 1.25rem; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff; font-size: .9rem; font-weight: 700;
  box-shadow: 0 4px 16px var(--accent-glow);
  transition: all .15s; text-align: center;
}
.btn-primary:active { transform: scale(.97); }

.btn-ghost {
  padding: .8rem 1.25rem; border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text-secondary);
  font-size: .9rem; font-weight: 600; border: 1px solid var(--border);
  transition: all .15s; text-align: center;
}
.btn-ghost:active { background: var(--bg-card2); }

.btn-accent {
  padding: .8rem 1.25rem; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--orange), #e8920f);
  color: #fff; font-size: .9rem; font-weight: 700;
  transition: all .15s; text-align: center;
}
.btn-accent:active { transform: scale(.97); }

.btn-danger {
  padding: .8rem 1.25rem; border-radius: var(--radius-sm);
  background: var(--red); color: #fff;
  font-size: .9rem; font-weight: 700;
  transition: all .15s; text-align: center;
}
.btn-danger:active { transform: scale(.97); }

/* ═══════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════ */
.toast-holder {
  position: fixed; bottom: calc(var(--bottom-nav-h) + 1rem);
  left: 1rem; right: 1rem;
  z-index: 200; display: flex; flex-direction: column;
  gap: .5rem; pointer-events: none;
}
.toast {
  padding: .875rem 1rem; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600;
  display: flex; align-items: center; gap: .625rem;
  animation: toastIn .25s ease;
  pointer-events: all; cursor: pointer;
  box-shadow: var(--shadow);
}
@keyframes toastIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.toast.success { background: var(--green); color: #fff; }
.toast.error   { background: var(--red); color: #fff; }
.toast.info    { background: var(--accent); color: #fff; }
.toast.warning { background: var(--orange); color: #fff; }

/* ═══════════════════════════════════════════════════════════
   LOGOUT CONFIRM
   ═══════════════════════════════════════════════════════════ */
.logout-confirm {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.75); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.logout-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2rem 1.5rem;
  text-align: center; width: 100%; max-width: 300px;
}
.logout-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.logout-msg { font-size: .95rem; font-weight: 600; color: var(--text-primary); margin-bottom: 1.25rem; }
.logout-btns { display: flex; gap: .625rem; }
.logout-btns button { flex: 1; }

/* ═══════════════════════════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════════════════════════ */
.empty-state {
  text-align: center; color: var(--text-muted);
  padding: 2.5rem 1rem; font-size: .875rem;
}
.empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }

/* ═══════════════════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════════════════ */
.green { color: var(--green); }
.red   { color: var(--red); }
.orange { color: var(--orange); }
.text-muted { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   ROLE BASED VISIBILITY
   ═══════════════════════════════════════════════════════════ */
/* General rule: hide elements requiring specific roles */
.admin-only, .manager-only, .staff-only { display: none !important; }

/* If admin, show everything */
body.role-admin .admin-only, 
body.role-admin .manager-only { display: flex !important; }
body.role-admin button.admin-only,
body.role-admin button.manager-only { display: block !important; }

/* If manager, show manager-only items but NOT admin-only */
body.role-manager .manager-only { display: flex !important; }
body.role-manager button.manager-only { display: block !important; }

/* Residents see NOTHING categorized as admin/manager only */
body.role-resident .fab, 
body.role-resident .dr-actions,
body.role-resident .action-strip,
body.role-resident .apt-detail-actions,
body.role-resident .bhc-edit-btn { display: none !important; }

/* ═══════════════════════════════════════════════════════════
   MOBILE — Sidebar gizle (< 1024px)
   ═══════════════════════════════════════════════════════════ */
.sidebar { display: none; }
.app-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Tablet
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 600px) and (max-width: 1023px) {
  .apartment-grid { grid-template-columns: repeat(3, 1fr); }
  .modal-sheet { left: 50%; right: auto; transform: translateX(-50%); width: 460px; border-radius: var(--radius-lg); border: 1px solid var(--border-light); }
  .main-app { max-width: 520px; margin: 0 auto; box-shadow: 0 0 80px rgba(0,0,0,.5); }
  body { background: #080a0f; }
}

/* ═══════════════════════════════════════════════════════════
   DESKTOP — Sidebar Layout (1024px+)
   ═══════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  :root {
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --bottom-nav-h: 0px;
  }

  body { background: #080a0f; overflow: hidden; }

  /* Login still centered */
  .login-page { background: radial-gradient(ellipse at 20% 20%, rgba(108,99,255,.35) 0%, transparent 55%),
                             radial-gradient(ellipse at 80% 80%, rgba(38,222,129,.2) 0%, transparent 55%),
                             #080a0f; }

  /* Main app shell — full screen with sidebar */
  .main-app {
    position: fixed; inset: 0;
    display: flex; flex-direction: row;
    max-width: 100%; margin: 0;
    background: #080a0f;
  }

  /* Sidebar */
  .sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    z-index: 60;
  }

  .sidebar-logo {
    display: flex; align-items: center; gap: .75rem;
    padding: 1.5rem 1.25rem 1.25rem;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-logo-icon { font-size: 1.75rem; }
  .sidebar-logo-text { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.4px; }
  .sidebar-logo-sub  { font-size: .7rem; color: var(--text-muted); }

  .sidebar-nav {
    flex: 1; padding: .75rem 0;
    overflow-y: auto;
  }

  .snav-item {
    display: flex; align-items: center; gap: .875rem;
    padding: .75rem 1.25rem;
    font-size: .9rem; font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .15s;
    border-left: 3px solid transparent;
    margin: 1px 0;
  }
  .snav-item:hover { background: rgba(255,255,255,.04); color: var(--text-primary); }
  .snav-item.active {
    color: var(--accent-light);
    background: rgba(108,99,255,.1);
    border-left-color: var(--accent);
    font-weight: 600;
  }
  .snav-icon { font-size: 1.15rem; flex-shrink: 0; width: 24px; text-align: center; }
  .snav-label { flex: 1; }

  .sidebar-divider {
    height: 1px; background: var(--border);
    margin: .5rem 1.25rem;
  }

  .sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
  }

  .sidebar-user {
    display: flex; align-items: center; gap: .75rem;
    padding: .625rem .75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s;
  }
  .sidebar-user:hover { background: rgba(255,255,255,.05); }
  .sidebar-user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff; font-weight: 800; font-size: .9rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }
  .sidebar-user-name { font-size: .85rem; font-weight: 600; color: var(--text-primary); }
  .sidebar-user-role { font-size: .72rem; color: var(--text-muted); }

  /* Right content area */
  .app-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
  }

  /* Topbar inside content area */
  .topbar {
    border-radius: 0;
    padding: 0 1.5rem;
    height: var(--topbar-h);
    background: rgba(15,17,23,.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }

  /* Hide mobile topbar back button & avatar (they're in sidebar) */
  .topbar-avatar { display: none; }

  /* Page container fills rght area */
  .page-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 2rem;
  }

  .page { padding: 1.5rem 2rem; }
  .page.active { max-width: 1200px; }

  /* Hide bottom nav */
  .bottom-nav { display: none; }

  /* FAB stays but repositioned */
  .fab {
    bottom: 2rem; right: 2rem;
    width: 56px; height: 56px;
  }

  /* Modal centered on desktop */
  .modal-overlay { align-items: center; }
  .modal-sheet {
    position: relative;
    border-radius: var(--radius-lg);
    width: 480px;
    max-height: 85vh;
    animation: modalPop .2s ease;
    border: 1px solid var(--border-light);
  }
  @keyframes modalPop {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
  }
  .modal-handle { display: none; }

  /* Apartments grid wider */
  .apartment-grid { grid-template-columns: repeat(5, 1fr); }

  /* Stats row — no horizontal scroll on desktop */
  .stats-row { overflow-x: visible; flex-wrap: wrap; }
  .stat-pill { min-width: 200px; flex: 1; }

  /* Toast repositioned */
  .toast-holder {
    bottom: 2rem;
    left: calc(var(--sidebar-w) + 1.5rem);
    right: 2rem;
  }
}
