/* ============================================================
   FinManage — professional financial dashboard styling
   Palette: deep navy sidebar, slate background, teal (income)
   and coral-red (expense) accents — calm, bank-app feel.
============================================================ */

:root {
  --navy: #0F2540;
  --navy-light: #16324F;
  --slate-bg: #F4F6F9;
  --card-bg: #FFFFFF;
  --border: #E4E8EF;
  --text: #1F2937;
  --muted: #6B7280;
  --teal: #1ABC9C;
  --teal-dark: #12876F;
  --red: #E74C3C;
  --blue: #2980B9;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 37, 64, 0.06), 0 1px 2px rgba(15, 37, 64, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--slate-bg);
  color: var(--text);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
  width: 240px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  flex-shrink: 0;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; }
.brand.center { justify-content: center; margin-bottom: 4px; }
.brand-mark { font-size: 26px; }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  color: #C9D6E3;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.nav-link:hover { background: rgba(255,255,255,0.08); text-decoration: none; color: #fff; }
.nav-link.active { background: var(--teal); color: #fff; }

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

.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-title { margin: 0; font-size: 20px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-chip { color: var(--muted); font-size: 14px; }

.content { padding: 24px 28px 60px; }

/* ---------- Cards / grids ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.cards-grid.three { grid-template-columns: repeat(3, 1fr); }

.stat-card, .mini-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-label { color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--navy); }
.stat-card.credit .stat-value { color: var(--teal-dark); }
.stat-card.debit .stat-value { color: var(--red); }

.mini-card h4 { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.mini-card p { margin: 0; font-weight: 600; }

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }

.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.panel h3 { margin: 0 0 12px; font-size: 16px; }
.panel h4 { margin: 16px 0 8px; font-size: 14px; color: var(--muted); }
.panel-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left; padding: 10px 8px; color: var(--muted);
  font-weight: 600; border-bottom: 2px solid var(--border); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.data-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); }
.data-table.small td, .data-table.small th { padding: 6px 8px; }
.data-table .right { text-align: right; }
.data-table tfoot td { border-top: 2px solid var(--border); border-bottom: none; }
.text-credit { color: var(--teal-dark); font-weight: 600; }
.text-debit { color: var(--red); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 24px; }
.row-actions { white-space: nowrap; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; background: #EEF2F7; color: var(--muted);
}
.badge-recurring { background: #FFF3E0; color: #E67E22; }

.upcoming-list { list-style: none; padding: 0; margin: 0; }
.upcoming-list li {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid var(--border); font-size: 14px;
}
.upcoming-list li:last-child { border-bottom: none; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(26,188,156,0.15); }

.stacked-form label:first-child { margin-top: 0; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-bar select, .filter-bar input { width: auto; }

.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.inline-form input, .inline-form select { width: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px; font-weight: 600;
  font-size: 14px; border: none; cursor: pointer; text-align: center;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); text-decoration: none; }
.btn-secondary { background: var(--navy); color: #fff; }
.btn-secondary:hover { background: var(--navy-light); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--border); }
.btn-ghost:hover { background: #EEF2F7; text-decoration: none; }
.btn-block { width: 100%; margin-top: 18px; }

.link-btn { background: none; border: none; color: var(--blue); cursor: pointer; font-size: 13px; padding: 0; }
.link-btn.danger { color: var(--red); }
.link-btn:hover { text-decoration: underline; }

/* ---------- Auth pages ---------- */
.auth-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #1D4E6B 100%);
  font-family: 'Inter', sans-serif;
}
.auth-card {
  background: #fff; border-radius: 16px; padding: 40px; width: 360px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.auth-subtitle { text-align: center; color: var(--muted); font-size: 14px; margin-top: 6px; }
.auth-footer { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #FDECEA; color: #C0392B; }
.alert-info { background: #E8F8F5; color: #12876F; }

/* ---------- Modal ---------- */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15,37,64,0.5);
  align-items: center; justify-content: center; z-index: 100;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); padding: 26px 28px;
  width: 420px; max-height: 88vh; overflow-y: auto;
}
.modal h3 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); font-size: 13px; }
.tips-list { font-size: 14px; line-height: 1.8; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.chip { padding: 4px 12px; border-radius: 20px; font-size: 13px; font-weight: 600; }

.account-card { position: relative; }
.account-type-tag { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }

.progress-bar { background: #EEF2F7; border-radius: 20px; height: 8px; width: 140px; overflow: hidden; margin-bottom: 4px; }
.progress-fill { background: var(--teal); height: 100%; }

@media print {
  .sidebar, .topbar, .filter-bar, .btn { display: none !important; }
  .app-main { margin: 0; }
}

@media (max-width: 900px) {
  .cards-grid, .cards-grid.three, .panel-grid, .grid-2 { grid-template-columns: 1fr; }
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
}
