/* ============================================================
   DailyCost — Classic theme
   Timeless serif headings, navy + warm-neutral palette,
   bordered cards, fully mobile responsive.
   ============================================================ */

:root {
  --ink: #1c2536;          /* deep navy ink */
  --ink-soft: #45506b;
  --muted: #7a8299;
  --line: #d9d3c7;         /* warm hairline */
  --line-strong: #c3bba9;
  --paper: #fbf9f4;        /* cream paper */
  --surface: #ffffff;
  --brand: #1f3a5f;        /* classic navy */
  --brand-dark: #16293f;
  --gold: #b08947;         /* muted gold accent */
  --gold-soft: #f3ead6;
  --income: #2f6b4f;
  --income-soft: #e7f0ea;
  --expense: #9e3b32;
  --expense-soft: #f6e7e5;
  --shadow: 0 1px 2px rgba(28, 37, 54, 0.06), 0 10px 30px rgba(28, 37, 54, 0.08);
  --serif: Georgia, "Times New Roman", "Iowan Old Style", "Palatino Linotype", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3, .serif { font-family: var(--serif); letter-spacing: 0.2px; }

a { color: var(--brand); }

/* ---------- Brand mark ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 0 2px var(--brand);
}
.brand-name { font-size: 22px; }
.brand-name small {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 20px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { filter: brightness(0.95); }
.btn-outline {
  background: transparent;
  color: var(--brand);
  border-color: var(--line-strong);
}
.btn-outline:hover { background: var(--gold-soft); border-color: var(--gold); }
.btn-block { width: 100%; }

/* ============================================================
   LOGIN
   ============================================================ */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

/* Left decorative panel */
.auth-aside {
  position: relative;
  background:
    linear-gradient(180deg, rgba(22, 41, 63, 0.92), rgba(31, 58, 95, 0.92)),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 2px, transparent 2px 14px);
  color: #f4efe4;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.auth-aside .brand { color: #fff; }
.auth-aside .brand-name { color: #fff; }
.auth-aside .brand-mark { background: #fff; color: var(--brand); }
.aside-pitch h2 {
  font-size: 34px;
  line-height: 1.2;
  margin: 0 0 16px;
  color: #fff;
}
.aside-pitch p {
  color: #d7d0c0;
  font-size: 16px;
  max-width: 34ch;
}
.aside-rule {
  width: 56px;
  height: 3px;
  background: var(--gold);
  margin: 24px 0;
  border: 0;
}
.aside-foot { font-size: 13px; color: #b7b09e; }

/* Right form panel */
.auth-main {
  display: grid;
  place-items: center;
  padding: 40px 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
}
.auth-card .brand { display: none; }   /* shown only on mobile */
.auth-head { margin-bottom: 28px; }
.auth-head h1 { font-size: 28px; margin: 0 0 6px; }
.auth-head p { color: var(--muted); margin: 0; }

.tabs {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 24px;
}
.tab {
  flex: 1;
  border: 0;
  background: var(--surface);
  padding: 11px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.tab + .tab { border-left: 1px solid var(--line-strong); }
.tab.active { background: var(--brand); color: #fff; }

.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.field input {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 15px;
  font-family: var(--sans);
  background: var(--surface);
  color: var(--ink);
}
.field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.14);
}
.field.hidden { display: none; }

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.form-row label { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.form-row a { text-decoration: none; font-weight: 600; }

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.auth-alt { text-align: center; margin-top: 20px; color: var(--muted); font-size: 14px; }
.auth-alt a { font-weight: 600; text-decoration: none; }

/* Inline banner (login feedback) */
.banner {
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.banner.success { background: var(--income-soft); color: var(--income); border-color: #bcd8c8; }
.banner.error { background: var(--expense-soft); color: var(--expense); border-color: #e6c2bd; }
.banner.info { background: var(--gold-soft); color: var(--brand); border-color: var(--line-strong); }

/* ============================================================
   HOME / DASHBOARD
   ============================================================ */
.topbar {
  background: var(--surface);
  border-bottom: 2px solid var(--brand);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.topbar .brand-name { font-size: 20px; }
.topbar-nav {
  display: flex;
  gap: 4px;
  margin-left: 24px;
}
.topbar-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 6px;
}
.topbar-nav a:hover { background: var(--gold-soft); color: var(--brand); }
.topbar-nav a.active { color: var(--brand); background: var(--gold-soft); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--serif);
  font-weight: 700;
  border: 2px solid var(--gold);
}
.user-name { font-size: 14px; font-weight: 600; }
.user-name small { display: block; color: var(--muted); font-weight: 400; }

/* Hamburger (mobile only) */
.nav-toggle {
  display: none;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--brand);
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.page-head h1 { font-size: 30px; margin: 0 0 4px; }
.page-head .sub { color: var(--muted); margin: 0; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Empty states */
.empty {
  padding: 26px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 37, 54, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(28, 37, 54, 0.3);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.modal-head h3 { margin: 0; font-size: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}
.icon-btn:hover { background: var(--gold-soft); color: var(--brand); }
.icon-btn.danger:hover { background: var(--expense-soft); color: var(--expense); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.modal-note {
  background: var(--gold-soft);
  border: 1px solid var(--line-strong);
  color: var(--brand);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin: 0 0 16px;
}
.muted { color: var(--muted); }

/* ---------- Buckets (dashboard) ---------- */
.buckets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.bucket {
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 10px;
  padding: 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bucket.is-empty { border-left-color: var(--line-strong); opacity: 0.8; }
.bucket-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.bucket-cat { font-family: var(--serif); font-weight: 700; font-size: 17px; }
.bucket-remaining { text-align: right; flex-shrink: 0; }
.bucket-remaining .label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}
.bucket-remaining .value { font-family: var(--serif); font-size: 18px; font-weight: 700; color: var(--income); }
.is-empty .bucket-remaining .value { color: var(--muted); }
.bucket-meta { font-size: 12px; color: var(--muted); }
.bucket-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.bucket-actions { display: flex; align-items: center; gap: 2px; }
.bucket-done {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
}

/* ---------- Bucket-wise history ---------- */
.bucket-hist .bar { margin: 0 22px; }
.bucket-hist-head { align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.bucket-hist-head h2 { margin: 0 0 2px; }
.bucket-hist-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.bucket-hist-stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); justify-content: flex-end; }
.bucket-hist-stats strong { margin-left: 4px; color: var(--ink); font-family: var(--serif); }
.bucket-hist-stats .in { color: var(--income); }
.bucket-hist-stats .out { color: var(--expense); }
.tx-none { color: var(--muted); font-size: 14px; padding: 12px 0; }

/* Row actions in transaction lists */
.tx .row-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

/* ---------- Search / inline form ---------- */
.search {
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 15px;
  font-family: var(--sans);
  background: var(--surface);
  color: var(--ink);
  min-width: 240px;
}
.search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.14); }
.filter-select {
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 15px;
  font-family: var(--sans);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.14); }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.inline-form input {
  flex: 1;
  min-width: 160px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 15px;
  font-family: var(--sans);
  background: var(--surface);
  color: var(--ink);
}
.inline-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.14); }

/* Form select (modal) */
.field select {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 15px;
  font-family: var(--sans);
  background: var(--surface);
  color: var(--ink);
}
.field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.14); }

/* ---------- Category chips ---------- */
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
}
.chip-custom { background: var(--gold-soft); border-color: var(--gold); }
.chip-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
  background: #ece7db;
  padding: 2px 7px;
  border-radius: 999px;
}
.chip-x {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}
.chip-x:hover { color: var(--expense); }

/* Stat cards */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 32px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand);
  border-radius: 10px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.stat.income { border-top-color: var(--income); }
.stat.expense { border-top-color: var(--expense); }
.stat .label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
}
.stat .value {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  margin-top: 8px;
}
.stat.income .value { color: var(--income); }
.stat.expense .value { color: var(--expense); }
.stat .trend { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* Panel */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 18px; margin: 0; }
.panel-head a { font-size: 14px; font-weight: 600; text-decoration: none; }
.panel-body { padding: 8px 22px 12px; }

/* Transaction list */
.tx { list-style: none; margin: 0; padding: 0; }
.tx li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.tx li:first-child { border-top: 0; }
.tx-badge {
  width: 40px; height: 40px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 700;
  flex-shrink: 0;
}
.tx-badge.in { background: var(--income-soft); color: var(--income); }
.tx-badge.out { background: var(--expense-soft); color: var(--expense); }
.tx-main { flex: 1; min-width: 0; }
.tx-title { font-weight: 600; }
.tx-meta { font-size: 13px; color: var(--muted); }
.tx-amt { font-family: var(--serif); font-weight: 700; white-space: nowrap; }
.tx-amt.in { color: var(--income); }
.tx-amt.out { color: var(--expense); }

/* Two column layout */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* Category rows */
.cat { list-style: none; margin: 0; padding: 0; }
.cat li { padding: 14px 0; border-top: 1px solid var(--line); }
.cat li:first-child { border-top: 0; }
.cat-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.cat-top strong { font-weight: 600; }
.bar { height: 8px; background: var(--gold-soft); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 24px;
  border-top: 1px solid var(--line);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 820px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-card .brand { display: inline-flex; margin-bottom: 28px; }

  .stats { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }

  .topbar-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border-bottom: 2px solid var(--brand);
    padding: 8px 16px 16px;
    margin: 0;
  }
  .topbar-nav.open { display: flex; }
  .topbar-nav a { padding: 12px 14px; border-radius: 8px; }
  .nav-toggle { display: block; }
  .topbar-right { display: none; }
  .topbar-inner { position: relative; }
}

@media (max-width: 480px) {
  .page { padding: 22px 16px 40px; }
  .page-head h1 { font-size: 25px; }
  .stat .value { font-size: 26px; }
  .auth-main { padding: 28px 18px; }
}
