/* ============================================================
   Monthwise Expense Tracker - custom design tokens
   ============================================================ */
:root {
  --ink:        #16213E;   /* headings, sidebar bg */
  --ink-2:      #1F2E52;   /* sidebar hover */
  --accent:     #2F6F5E;   /* primary brand accent (ledger green) */
  --accent-2:   #E8B84B;   /* highlight / warning gold */
  --income:     #1E8E5A;
  --expense:    #C0392B;
  --bg:         #F5F6F8;
  --card-bg:    #FFFFFF;
  --border:     #E4E7EC;
  --text:       #1F2530;
  --text-muted: #667085;

  --sidebar-w: 250px;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
}

a { text-decoration: none; }

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

.app-sidebar {
  width: var(--sidebar-w);
  background: var(--ink);
  color: #fff;
  flex-shrink: 0;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 1040;
}
.app-sidebar .brand {
  padding: 1.15rem 1.25rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .02em;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .6rem;
}
.app-sidebar .brand .logo-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent-2);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: .95rem;
}
.app-sidebar .nav-section-label {
  text-transform: uppercase;
  font-size: .68rem;
  letter-spacing: .08em;
  color: rgba(255,255,255,.45);
  padding: 1rem 1.25rem .35rem;
}
.app-sidebar .nav-link {
  color: rgba(255,255,255,.82);
  padding: .6rem 1.25rem;
  font-size: .92rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  border-left: 3px solid transparent;
}
.app-sidebar .nav-link:hover { background: var(--ink-2); color: #fff; }
.app-sidebar .nav-link.active {
  background: var(--ink-2);
  color: #fff;
  border-left-color: var(--accent-2);
  font-weight: 600;
}
.app-sidebar .nav-link i { width: 18px; text-align: center; }

.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
}

.app-topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.app-topbar .page-title { font-weight: 700; font-size: 1.15rem; color: var(--ink); margin: 0; }

.app-content { padding: 1.5rem; }

.user-chip {
  display: flex; align-items: center; gap: .6rem;
  font-size: .88rem;
}
.user-chip .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}

/* ---------- Cards / stat tiles ---------- */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  height: 100%;
}
.stat-card .stat-label {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 600;
}
.stat-card .stat-value {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: .15rem;
}
.stat-card .stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
}
.icon-income { background: rgba(30,142,90,.12); color: var(--income); }
.icon-expense { background: rgba(192,57,43,.12); color: var(--expense); }
.icon-cash { background: rgba(232,184,75,.18); color: #8a6a10; }
.icon-bank { background: rgba(47,111,94,.12); color: var(--accent); }

.text-income { color: var(--income); }
.text-expense { color: var(--expense); }

.card { border: 1px solid var(--border); border-radius: 12px; }
.card-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: var(--ink);
}

.table thead th {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-bottom-width: 1px;
  white-space: nowrap;
}
.table td { vertical-align: middle; }

.badge-mode-cash { background: rgba(232,184,75,.18); color: #8a6a10; }
.badge-mode-bank { background: rgba(47,111,94,.12); color: var(--accent); }

.btn-brand {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-brand:hover { background: #245A4C; border-color: #245A4C; color: #fff; }

/* ---------- Login page ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--ink) 0%, #223762 100%);
  padding: 1rem;
}
.auth-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  max-width: 900px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.auth-side {
  background: var(--ink);
  color: #fff;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .75rem;
}
.auth-side .logo-mark {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: var(--accent-2);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  margin-bottom: .5rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .app-sidebar.show { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.4);
    z-index: 1030; display: none;
  }
  .sidebar-backdrop.show { display: block; }
}

/* ---------- Print (used for the PDF export view) ---------- */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .app-content { padding: 0; }
}
