/* ============================================================
   FinFlow — Screen-specific styles
   ============================================================ */

/* ---------- Page header (lists) ---------- */
.list-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.list-head-actions { display: flex; align-items: center; gap: 10px; flex: none; }

/* ---------- Dashboard: balance hero ---------- */
.hero-card {
  position: relative; min-height: 180px; border-radius: var(--r-card);
  border: 1px solid var(--border); overflow: hidden;
  background: radial-gradient(120% 140% at 50% 35%, #0D1E3A 0%, #0A0F1E 70%);
  padding: 28px 32px; margin-bottom: 16px;
  display: flex; flex-direction: column; justify-content: center;
}
.app[data-glow="off"] .hero-card { background: #0D1424; }
:root[data-theme="light"] .hero-card { background: radial-gradient(120% 140% at 50% 30%, #FFFFFF 0%, #ECE8E0 78%); }
:root[data-theme="light"] .app[data-glow="off"] .hero-card { background: #FFFFFF; }
.hero-sync {
  position: absolute; top: 16px; right: 20px;
  display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3);
}
.hero-balance { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; }
.hero-cur { font-family: var(--font-display); font-weight: 300; font-size: 24px; color: var(--text-2); margin-top: 8px; }
.hero-num { font-weight: 300; font-size: 56px; line-height: 1; letter-spacing: -0.02em; }
.hero-stats { display: flex; align-items: center; gap: 24px; margin-top: 18px; }
.hero-stat-lbl { font-size: 11px; color: var(--text-3); margin-top: 3px; letter-spacing: 0.04em; }
.hero-sep { width: 1px; height: 32px; background: var(--border); }

/* ---------- Quick actions ---------- */
.quick-row { display: flex; gap: 12px; margin-bottom: 16px; }
.quick-btn {
  flex: 1; height: 52px; border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 500; font-size: 14px; transition: all 150ms ease;
}
.quick-btn.income  { background: rgba(0,229,160,0.1); border: 1px solid rgba(0,229,160,0.25); color: var(--mint); }
.quick-btn.income:hover  { background: rgba(0,229,160,0.18); border-color: rgba(0,229,160,0.5); }
.quick-btn.expense { background: rgba(255,71,87,0.1); border: 1px solid rgba(255,71,87,0.25); color: var(--red); }
.quick-btn.expense:hover { background: rgba(255,71,87,0.18); border-color: rgba(255,71,87,0.5); }

/* ---------- Stat grid ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { padding: 18px 20px; }
.stat-val { font-weight: 400; font-size: 24px; margin-top: 10px; letter-spacing: -0.01em; display: flex; align-items: baseline; }

/* ---------- Credits alert strip ---------- */
.credit-strip {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #1A1A0A; border: 1px solid rgba(255,184,0,0.2); border-radius: 10px;
  padding: 14px 18px; margin-bottom: 16px; transition: border-color 150ms ease;
  font-size: 13px; color: var(--text-2);
}
.credit-strip:hover { border-color: rgba(255,184,0,0.4); }
:root[data-theme="light"] .credit-strip { background: #FFFAEF; border-color: rgba(181,126,10,0.28); }
.cs-left { display: flex; align-items: center; gap: 10px; }
.cs-left strong { color: var(--text); font-weight: 600; }
.cs-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.cs-dot.amber { background: var(--amber); box-shadow: 0 0 6px rgba(255,184,0,0.5); }
.cs-dot.red { background: var(--red); box-shadow: 0 0 6px rgba(255,71,87,0.5); }
.cs-overdue { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,0.1); }
.cs-link { display: inline-flex; align-items: center; gap: 6px; color: var(--amber); font-weight: 500; }

/* ---------- Section head ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 8px; }
.view-all { color: var(--accent-ink); font-size: 12px; font-weight: 500; }
.view-all:hover { filter: brightness(1.15); }

/* ---------- Filter / search ---------- */
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.search-wrap { position: relative; margin-bottom: 12px; }
.search-wrap .input { padding-left: 42px; }
.search-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; }

/* ---------- Totals bar ---------- */
.totals-bar { display: flex; align-items: baseline; gap: 8px; }

/* ---------- Modal ---------- */
.modal-top { height: 3px; }
.modal-top.income { background: var(--mint); }
.modal-top.expense { background: var(--red); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 4px; }
.modal-head h2 { font-family: var(--font-display); font-weight: 500; font-size: 20px; }
.modal-close { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-3); transition: all 150ms ease; }
.modal-close:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.modal-body { padding: 16px 24px 24px; }
.amount-input-wrap { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 0 6px; border-bottom: 2px solid var(--border); transition: border-color 150ms ease; }
.amount-input-wrap.focused { border-color: var(--accent); }
.amount-prefix { font-family: var(--font-display); font-weight: 300; font-size: 24px; color: var(--text-3); }
.amount-input { background: transparent; border: none; outline: none; font-family: var(--font-display); font-weight: 300; font-size: 48px; color: var(--text); text-align: center; width: 100%; max-width: 280px; }
.amount-input::placeholder { color: var(--surface-3); }
.amount-hint { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 8px; height: 16px; transition: opacity 150ms; }
.form-field { margin-top: 16px; }
.collapse-link { color: var(--accent-ink); font-size: 13px; font-weight: 500; margin-top: 16px; display: inline-flex; align-items: center; gap: 6px; }
.toggle-field { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding: 12px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }

/* ---------- Custom dropdown ---------- */
.dd-wrap { position: relative; }
.dd-trigger { width: 100%; height: 44px; padding: 0 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text); font-size: 14px; transition: border-color 150ms ease; }
.dd-trigger:hover { border-color: var(--surface-4); }
.dd-trigger.placeholder { color: var(--text-4); }
.dd-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20; max-height: 240px; overflow-y: auto; background: var(--bg-sidebar); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: 0 12px 40px rgba(0,0,0,0.5); animation: ddIn 150ms var(--ease); }
@keyframes ddIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.dd-item { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; border-radius: 8px; font-size: 14px; color: var(--text); cursor: pointer; transition: background 120ms ease; }
.dd-item:hover { background: rgba(255,255,255,0.04); }
.dd-sel-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: auto; }
.dd-add { color: var(--accent-ink); border-top: 1px solid var(--border-soft); margin-top: 4px; }

/* ---------- Submit ---------- */
.submit-btn { width: 100%; height: 52px; border-radius: 10px; font-weight: 600; font-size: 15px; margin-top: 24px; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 150ms ease; }
.submit-btn.income { background: var(--mint); color: #0A0F1E; }
.submit-btn.expense { background: var(--red); color: #fff; }
.submit-btn:hover { filter: brightness(1.1); }
.submit-btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }
.submit-btn.done { background: var(--mint) !important; color: #0A0F1E; }

/* ---------- Credits ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; position: relative; }
.tab { height: 44px; padding: 0 18px; font-size: 14px; color: var(--text-3); font-weight: 400; position: relative; transition: color 150ms ease; }
.tab.active { color: var(--text); font-weight: 500; }
.tab-underline { position: absolute; bottom: -1px; height: 2px; background: var(--accent); transition: all 250ms var(--ease); border-radius: 2px; }
.credit-summary { display: flex; gap: 12px; margin-bottom: 20px; }
.cred-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
.credit-card { display: flex; flex-direction: column; gap: 12px; }
.cc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cc-name { font-weight: 600; font-size: 15px; color: var(--text); }
.cc-reason { font-size: 12px; color: var(--text-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-due { font-size: 11px; margin-top: 6px; }
.cc-amt { font-family: var(--font-mono); font-weight: 500; font-size: 18px; text-align: right; white-space: nowrap; }
.cc-settle { width: 100%; height: 36px; border-radius: 8px; background: transparent; border: 1.5px solid currentColor; font-weight: 500; font-size: 13px; transition: background 150ms ease; }
.cc-settle:hover { background: rgba(255,255,255,0.06); }
.cc-confirm { display: flex; gap: 8px; }
.cc-confirm button { flex: 1; height: 36px; border-radius: 8px; font-weight: 500; font-size: 13px; }

/* ---------- Reports ---------- */
.report-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 20px 0; }
.report-nav button { width: 36px; height: 36px; border-radius: 8px; background: var(--surface-1); border: 1px solid var(--border); color: var(--text-2); display: flex; align-items: center; justify-content: center; transition: all 150ms ease; }
.report-nav button:hover { color: var(--text); border-color: var(--surface-4); }
.report-period { font-family: var(--font-display); font-size: 18px; color: var(--text); min-width: 200px; text-align: center; }
.report-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 110px; align-items: center; gap: 14px; padding: 8px 0; }
.bar-label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.bar-track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; width: 0; transition: width 600ms var(--ease); }
.bar-amt { font-family: var(--font-mono); font-size: 13px; text-align: right; color: var(--text); }

/* ---------- Settings ---------- */
.settings-section { margin-bottom: 24px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.settings-row:last-child { border-bottom: none; }
.sr-label { font-size: 14px; color: var(--text); font-weight: 500; }
.sr-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.cat-pill { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; color: var(--text); }
.cat-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cur-opt { padding: 10px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-2); font-size: 14px; transition: all 150ms ease; }
.cur-opt.active { border-color: var(--accent); background: rgba(0,212,255,0.08); color: var(--text); }

/* ---------- Responsive screens ---------- */
@media (max-width: 767px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .report-cards { grid-template-columns: 1fr; }
  .cred-grid { grid-template-columns: 1fr; }
  .hero-num { font-size: 40px; }
  .quick-btn { font-size: 13px; }
  .bar-row { grid-template-columns: 90px 1fr 90px; gap: 8px; }
  .bar-label { font-size: 12px; }
  .bar-label .bl-icon { display: none; }
}
@media (max-width: 920px) and (min-width: 768px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Density tweak ---------- */
.app[data-density="compact"] .page { padding-top: 20px; }
.app[data-density="compact"] .card { padding: 14px; }
.app[data-density="compact"] .txn-row { height: 48px; }
.app[data-density="compact"] .hero-card { min-height: 150px; padding: 20px 24px; }
.app[data-density="comfy"] .card { padding: 26px; }
.app[data-density="comfy"] .txn-row { height: 64px; }
.app[data-density="comfy"] .hero-card { min-height: 210px; }
.app[data-density="comfy"] .quick-row, .app[data-density="comfy"] .stat-grid,
.app[data-density="comfy"] .credit-strip { margin-bottom: 22px; }

/* ============================================================
   LOGIN / REGISTER SCREEN
   ============================================================ */

.lp-root {
  min-height: 100vh; width: 100%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.lp-loading { flex-direction: column; gap: 24px; }

/* Logo */
.lp-logo {
  font-family: var(--font-display); font-weight: 300;
  font-size: 28px; letter-spacing: 0.18em; text-transform: uppercase;
  margin-bottom: 8px; text-align: center;
}

/* Spinner */
.lp-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* User selection view */
.lp-select {
  width: 100%; max-width: 420px;
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
.lp-welcome {
  font-family: var(--font-display); font-weight: 300; font-size: 32px;
  color: var(--text); text-align: center; margin-top: 32px;
}
.lp-welcome-sub {
  font-size: 14px; color: var(--text-3); text-align: center; margin-top: 6px; margin-bottom: 32px;
}
.lp-user-list { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.lp-user-card {
  width: 100%; display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 20px;
  transition: border-color 150ms ease, background 150ms ease;
  text-align: left;
}
.lp-user-card:hover { border-color: rgba(0,212,255,0.3); background: var(--surface-2); }
.lp-user-info { flex: 1; min-width: 0; }
.lp-user-name { font-size: 15px; font-weight: 500; color: var(--text); }
.lp-user-biz  { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.lp-new-account {
  margin-top: 24px; display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent-ink); font-size: 14px; font-weight: 500;
  padding: 10px 20px; border-radius: 8px;
  border: 1px dashed rgba(0,212,255,0.3);
  transition: border-color 150ms, background 150ms;
}
.lp-new-account:hover { border-color: var(--accent); background: rgba(0,212,255,0.05); }

/* Avatar */
.lp-avatar {
  border-radius: 50%; background: var(--surface-2);
  border: 2px solid rgba(0,212,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 400;
  color: var(--accent-ink); flex-shrink: 0;
}

/* PIN entry screen */
.lp-pin-screen {
  width: 100%; max-width: 360px;
  display: flex; flex-direction: column; align-items: center;
  position: relative; padding-top: 48px;
}
.lp-back-btn {
  position: absolute; top: 0; left: 0;
  display: flex; align-items: center; gap: 6px;
  color: var(--text-3); font-size: 13px;
  padding: 8px 4px; border-radius: 6px;
  transition: color 150ms;
}
.lp-back-btn:hover { color: var(--text); }
.lp-pin-name  { font-size: 20px; font-weight: 500; color: var(--text); margin-top: 16px; }
.lp-pin-label { font-size: 13px; color: var(--text-3); margin-top: 6px; margin-bottom: 28px; }

/* PIN dots */
.lp-dots { display: flex; gap: 14px; margin-bottom: 12px; }
.lp-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border); background: transparent;
  transition: all 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lp-dot.filled { background: var(--accent); border-color: var(--accent); transform: scale(1.1); }
.lp-dots-error .lp-dot { animation: shake 400ms ease; }
.lp-dot.err.filled { background: var(--red); border-color: var(--red); }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

.lp-error { font-size: 13px; color: var(--red); margin-bottom: 8px; text-align: center; }

/* Numpad */
.lp-numpad {
  display: grid; grid-template-columns: repeat(3, 80px);
  gap: 12px; margin-top: 24px;
}
.lp-numpad-spacer { width: 80px; height: 80px; }
.lp-key {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  font-family: var(--font-display); font-size: 24px; font-weight: 300; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: background 100ms, transform 80ms, border-color 100ms;
  user-select: none;
}
.lp-key:hover  { background: var(--surface-2); border-color: rgba(0,212,255,0.2); }
.lp-key:active { transform: scale(0.92); background: var(--surface-2); }
.lp-key:disabled { opacity: 0.4; pointer-events: none; }
.lp-back { background: transparent; border-color: transparent; color: var(--text-3); font-size: 16px; }
.lp-back:hover { background: var(--surface); color: var(--text); }
.lp-switch-link {
  font-size: 13px; color: var(--text-3);
  padding: 8px 16px; border-radius: 6px;
  transition: color 150ms, background 150ms;
}
.lp-switch-link:hover { color: var(--text-2); background: var(--surface); }

/* Register screen */
.lp-register {
  width: 100%; max-width: 420px;
  position: relative; padding-top: 48px;
}
.lp-reg-title {
  font-family: var(--font-display); font-weight: 300;
  font-size: 30px; color: var(--text); margin-top: 32px; margin-bottom: 6px;
}
.lp-reg-sub { font-size: 14px; color: var(--text-3); margin-bottom: 32px; }
.lp-form { display: flex; flex-direction: column; gap: 16px; }
.lp-field { display: flex; flex-direction: column; gap: 6px; }
.lp-label { font-size: 11px; font-weight: 500; color: var(--text-3); letter-spacing: 0.08em; text-transform: uppercase; }
.lp-input { width: 100%; }
.lp-continue {
  width: 100%; height: 52px; border-radius: 10px; margin-top: 8px;
  background: var(--accent); color: #0A0F1E;
  font-size: 15px; font-weight: 600;
  transition: filter 150ms;
}
.lp-continue:hover:not(:disabled) { filter: brightness(1.1); }
.lp-continue:disabled { opacity: 0.5; }

@media (max-width: 767px) {
  .lp-key { width: 72px; height: 72px; font-size: 22px; }
  .lp-numpad { grid-template-columns: repeat(3, 72px); gap: 10px; }
  .lp-numpad-spacer { width: 72px; height: 72px; }
}
