/* ==========================================================================
   Viral Height 608 — Expense Manager
   Design language: bound-ledger meets modern dashboard.
   Palette:  ink navy / cool paper / brass / ledger red / ledger green
   Type:     Fraunces (display+numerals) · Inter (UI) · IBM Plex Mono (figures)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root{
  --ink:        #0E1A2E;
  --ink-2:      #16233C;
  --ink-soft:   #29344A;
  --paper:      #F1F2EE;
  --paper-2:    #E8E9E3;
  --card:       #FFFFFF;
  --line:       #E1E1DA;
  --brass:      #B08A4E;
  --brass-light:#D9BC8B;
  --brass-dark: #8C6B37;
  --red:        #A6402F;
  --red-soft:   #F4E4E0;
  --green:      #3E6B52;
  --green-soft: #E3EEE7;
  --text:       #1B2433;
  --muted:      #6B7280;
  --muted-2:    #94989F;
  --radius:     14px;
  --radius-sm:  9px;
  --shadow-card: 0 1px 2px rgba(14,26,46,.04), 0 8px 24px -12px rgba(14,26,46,.12);
  --shadow-pop:  0 20px 50px -20px rgba(14,26,46,.35);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:var(--paper);
  color:var(--text);
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  -webkit-font-smoothing:antialiased;
  font-size:15px;
  line-height:1.5;
}
h1,h2,h3,.display{
  font-family:'Fraunces','Georgia',serif;
  font-weight:600;
  letter-spacing:-.01em;
  color:var(--ink);
  margin:0;
}
.mono, .amount, table td.amount, .stat-value{
  font-family:'IBM Plex Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}
a{ color:inherit; text-decoration:none; }
button{ font-family:inherit; }
::selection{ background:var(--brass-light); color:var(--ink); }

/* Scrollbar */
::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-thumb{ background:#cfd0c8; border-radius:10px; }
::-webkit-scrollbar-track{ background:transparent; }

/* ---------------------------------------------------------------- */
/* Auth pages (login / register)                                     */
/* ---------------------------------------------------------------- */
.auth-wrap{
  min-height:100vh;
  display:grid;
  grid-template-columns: 1.1fr 1fr;
}

.auth-side{
  background:
    radial-gradient(circle at 15% 20%, rgba(176,138,78,.18), transparent 45%),
    linear-gradient(160deg, var(--ink) 0%, #0A1424 100%);
  color:#EDEFEA;
  padding:64px 56px;
  position:relative;
  display:flex; flex-direction:column; justify-content:space-between;
  overflow:hidden;
}
.auth-side::before{
  content:"";
  position:absolute; inset:0;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 28px);
  pointer-events:none;
}
.seal{
  width:56px; height:56px; border-radius:50%;
  border:1.5px solid var(--brass-light);
  display:flex; align-items:center; justify-content:center;
  font-family:'Fraunces',serif; font-weight:600; font-size:13px;
  letter-spacing:.02em; color:var(--brass-light);
  position:relative; z-index:1;
}
.auth-side .brand-line{ position:relative; z-index:1; }
.auth-side .brand-line .eyebrow{
  text-transform:uppercase; letter-spacing:.18em; font-size:11px; color:var(--brass-light);
  margin-top:28px; margin-bottom:10px; font-weight:600;
}
.auth-side h1{ color:#F6F3EA; font-size:40px; line-height:1.15; max-width:9.5em; }
.auth-side p.sub{ color:#B9BFCB; max-width:30em; margin-top:16px; font-size:15px; }
.auth-side .quote{
  position:relative; z-index:1; border-top:1px solid rgba(255,255,255,.12); padding-top:20px;
  font-family:'Fraunces',serif; font-style:italic; color:#CBB88E; font-size:15px; max-width:26em;
}

@media (max-width:900px){ .auth-wrap{ grid-template-columns:1fr; } .auth-side{ display:none; } }

.auth-main{ display:flex; align-items:center; justify-content:center; padding:32px; }
.auth-card{ width:100%; max-width:400px; }
.auth-card .kicker{ text-transform:uppercase; letter-spacing:.16em; font-size:11px; color:var(--brass-dark); font-weight:600; margin-bottom:8px; }
.auth-card h2{ font-size:28px; margin-bottom:6px; }
.auth-card p.lead{ color:var(--muted); font-size:14px; margin-bottom:32px; }

.field{ margin-bottom:18px; }
.field label{ display:block; font-size:12.5px; font-weight:600; color:var(--ink-2); margin-bottom:6px; letter-spacing:.01em; }
.field input, .field select{
  width:100%; padding:12px 14px; border:1.5px solid var(--line); border-radius:var(--radius-sm);
  background:#fff; font-size:14.5px; color:var(--text); transition:border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus{
  outline:none; border-color:var(--brass); box-shadow:0 0 0 3px rgba(176,138,78,.15);
}

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:12px 20px; border-radius:var(--radius-sm); border:none; cursor:pointer;
  font-weight:600; font-size:14.5px; transition:transform .12s, box-shadow .12s, background .15s;
}
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:var(--ink); color:#F3EFE4; width:100%; }
.btn-primary:hover{ background:var(--ink-2); box-shadow:var(--shadow-pop); }
.btn-brass{ background:var(--brass); color:#fff; }
.btn-brass:hover{ background:var(--brass-dark); }
.btn-ghost{ background:transparent; color:var(--ink-2); border:1.5px solid var(--line); }
.btn-ghost:hover{ border-color:var(--brass); color:var(--brass-dark); }
.btn-sm{ padding:8px 14px; font-size:13px; }
.btn-danger-ghost{ background:transparent; border:1.5px solid var(--red-soft); color:var(--red); }
.btn-danger-ghost:hover{ background:var(--red-soft); }

.auth-foot{ margin-top:22px; text-align:center; font-size:13.5px; color:var(--muted); }
.auth-foot a{ color:var(--brass-dark); font-weight:600; }

.alert{
  padding:11px 14px; border-radius:var(--radius-sm); font-size:13.5px; margin-bottom:18px;
  border:1px solid transparent;
}
.alert-error{ background:var(--red-soft); color:var(--red); border-color:#e6c6bd; }
.alert-success{ background:var(--green-soft); color:var(--green); border-color:#c7dccf; }

/* ---------------------------------------------------------------- */
/* App shell                                                          */
/* ---------------------------------------------------------------- */
.shell{ display:grid; grid-template-columns:248px 1fr; min-height:100vh; min-width:0; }

.sidebar{
  background:linear-gradient(180deg, var(--ink) 0%, #0B1526 100%);
  color:#E7E9E3; padding:26px 18px; position:sticky; top:0; height:100vh;
  display:flex; flex-direction:column; gap:6px;
}
.sidebar .brand{ display:flex; align-items:center; gap:10px; padding:6px 8px 22px; }
.sidebar .brand .seal{ width:38px; height:38px; font-size:10px; }
.sidebar .brand .txt{ line-height:1.25; }
.sidebar .brand .txt b{ font-family:'Fraunces',serif; font-size:15.5px; color:#F3EFE4; display:block; }
.sidebar .brand .txt span{ font-size:10.5px; letter-spacing:.1em; text-transform:uppercase; color:var(--brass-light); }

@media (max-width:900px){ .shell{ grid-template-columns:1fr; } .sidebar{ display:none; } }

.nav-link{
  display:flex; align-items:center; gap:11px; padding:11px 12px; border-radius:10px;
  color:#C7CBD6; font-size:14px; font-weight:500; transition:background .15s, color .15s;
}
.nav-link svg{ width:17px; height:17px; flex-shrink:0; opacity:.85; }
.nav-link:hover{ background:rgba(255,255,255,.06); color:#fff; }
.nav-link.active{ background:rgba(176,138,78,.16); color:#F3EFE4; }
.nav-link.active svg{ opacity:1; }
.nav-section-title{ font-size:10.5px; text-transform:uppercase; letter-spacing:.14em; color:#6F7688; margin:18px 12px 6px; font-weight:600; }

.sidebar-foot{ margin-top:auto; padding-top:14px; border-top:1px solid rgba(255,255,255,.08); }
.mini-profile{ display:flex; align-items:center; gap:10px; padding:8px; border-radius:10px; }
.avatar{
  width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  font-size:12.5px; font-weight:700; color:#fff; flex-shrink:0; font-family:'Fraunces',serif;
}
.mini-profile .who b{ display:block; font-size:13px; color:#EDEFEA; }
.mini-profile .who span{ font-size:11px; color:#8890A0; text-transform:capitalize; }
.logout-link{ display:flex; align-items:center; gap:8px; font-size:12.5px; color:#98A0B2; margin-top:10px; padding:8px; }
.logout-link:hover{ color:var(--red); }

/* topbar for mobile */
.topbar{ display:none; background:var(--ink); color:#fff; padding:14px 18px; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:45; }
@media (max-width:900px){ .topbar{ display:flex; } }

.hamburger-btn{
  display:none; background:transparent; border:none; color:#EDEFEA; padding:4px; margin-right:2px; cursor:pointer;
}
@media (max-width:900px){ .hamburger-btn{ display:flex; align-items:center; justify-content:center; } }

.mobile-nav-overlay{
  display:none; position:fixed; inset:0; background:rgba(8,13,23,.55); z-index:70;
}
.mobile-nav-overlay.open{ display:block; }

.mobile-nav-drawer{
  position:fixed; top:0; left:0; bottom:0; width:80%; max-width:300px;
  background:linear-gradient(180deg, var(--ink) 0%, #0B1526 100%); color:#E7E9E3;
  z-index:71; padding:24px 16px; overflow-y:auto;
  transform:translateX(-105%); transition:transform .28s ease;
  display:flex; flex-direction:column; gap:6px;
}
.mobile-nav-drawer.open{ transform:translateX(0); }
.mobile-nav-drawer .brand{ display:flex; align-items:center; gap:10px; padding:6px 8px 22px; }
.mobile-nav-drawer .brand .seal{ width:38px; height:38px; font-size:10px; }
.mobile-nav-drawer .brand .txt b{ font-family:'Fraunces',serif; font-size:15.5px; color:#F3EFE4; display:block; }
.mobile-nav-drawer .brand .txt span{ font-size:10.5px; letter-spacing:.1em; text-transform:uppercase; color:var(--brass-light); }
.mobile-nav-drawer .nav-link{ font-size:15px; padding:13px 12px; }

.main{ padding:34px 44px 60px; width:100%; max-width:none; min-width:0; }
@media (max-width:700px){ .main{ padding:22px 16px 50px; } }

.page-head{ display:flex; align-items:flex-end; justify-content:space-between; flex-wrap:wrap; gap:16px; margin-bottom:28px; }
.page-head .eyebrow{ text-transform:uppercase; font-size:11px; letter-spacing:.16em; color:var(--brass-dark); font-weight:700; margin-bottom:6px; }
.page-head h1{ font-size:30px; }
.page-head p{ color:var(--muted); font-size:14px; margin-top:6px; }

/* ---------------------------------------------------------------- */
/* Cards / stats                                                      */
/* ---------------------------------------------------------------- */
.card{
  background:var(--card); border-radius:var(--radius); box-shadow:var(--shadow-card);
  border:1px solid var(--line); padding:22px;
  position:relative;
}
.card.ledger::before{
  content:""; position:absolute; left:0; top:14px; bottom:14px; width:3px;
  background:linear-gradient(180deg, var(--brass), var(--brass-light));
  border-radius:0 3px 3px 0;
}
.card.ledger{ padding-left:26px; }

.stat-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:16px; margin-bottom:28px; }
@media (max-width:980px){ .stat-grid{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:520px){ .stat-grid{ grid-template-columns:1fr; } }

.stat-card{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:20px 20px 18px; box-shadow:var(--shadow-card); }
.stat-card .lbl{ font-size:12px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted-2); font-weight:600; margin-bottom:10px; display:flex; align-items:center; justify-content:space-between; }
.stat-card .stat-value{ font-size:26px; font-weight:600; color:var(--ink); }
.stat-card .delta{ font-size:12.5px; margin-top:8px; display:inline-flex; align-items:center; gap:4px; font-weight:600; }
.delta.up{ color:var(--red); }
.delta.down{ color:var(--green); }
.delta.flat{ color:var(--muted); }

.section-title{ display:flex; align-items:center; justify-content:space-between; margin:34px 0 14px; }
.section-title h2{ font-size:18px; }
.section-title .hint{ font-size:12.5px; color:var(--muted); }

/* ---------------------------------------------------------------- */
/* Tabs / filters                                                      */
/* ---------------------------------------------------------------- */
.tabs{ display:inline-flex; background:var(--paper-2); padding:4px; border-radius:11px; gap:2px; max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
.tab{ padding:8px 16px; font-size:13.5px; font-weight:600; color:var(--muted); border-radius:8px; cursor:pointer; user-select:none; transition:.15s; border:none; background:transparent; white-space:nowrap; flex-shrink:0; }
.tab.active{ background:var(--ink); color:#F3EFE4; }
.tab:not(.active):hover{ color:var(--ink); }

.toolbar{ display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; margin-bottom:18px; }

/* ---------------------------------------------------------------- */
/* Tables — ledger style                                              */
/* ---------------------------------------------------------------- */
.table-wrap{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius); overflow-x:auto; -webkit-overflow-scrolling:touch; box-shadow:var(--shadow-card); }
@media (max-width:700px){ .table-wrap table{ min-width:640px; } }
table{ width:100%; border-collapse:collapse; }
thead th{
  text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted-2);
  font-weight:700; padding:14px 18px; border-bottom:1px solid var(--line); background:var(--paper);
}
tbody td{ padding:14px 18px; border-bottom:1px solid var(--line); font-size:14px; vertical-align:middle; }
tbody tr:last-child td{ border-bottom:none; }
tbody tr:hover{ background:#FAFAF7; }
td.amount, th.amount{ text-align:right; font-weight:600; }
td.amount{ color:var(--red); }
.row-person{ display:flex; align-items:center; gap:9px; }
.tag{ display:inline-block; padding:3px 10px; border-radius:20px; font-size:11.5px; font-weight:600; background:var(--paper-2); color:var(--ink-2); }
.empty-row td{ text-align:center; padding:48px 18px; color:var(--muted); font-size:14px; }

/* ---------------------------------------------------------------- */
/* Forms in cards (modals / inline)                                   */
/* ---------------------------------------------------------------- */
.grid-2{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.grid-3{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; }
@media (max-width:640px){ .grid-2, .grid-3{ grid-template-columns:1fr; } }

.modal-backdrop{
  position:fixed; inset:0; background:rgba(10,16,28,.55); backdrop-filter:blur(2px);
  display:none; align-items:center; justify-content:center; z-index:50; padding:20px;
}
.modal-backdrop.open{ display:flex; }
.modal{
  background:#fff; border-radius:18px; width:100%; max-width:480px; padding:28px;
  box-shadow:var(--shadow-pop); max-height:90vh; overflow:auto;
}
.modal-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.modal-head h3{ font-size:19px; }
.modal-head .x{ cursor:pointer; color:var(--muted); font-size:20px; line-height:1; padding:4px; }
.modal p.sub{ font-size:13px; color:var(--muted); margin-bottom:22px; }

/* Tea/Coffee specific */
.chip-select{ display:flex; gap:10px; }
.chip{
  flex:1; text-align:center; padding:14px 10px; border-radius:12px; border:1.5px solid var(--line);
  cursor:pointer; font-weight:600; font-size:14px; color:var(--muted); transition:.15s; background:#fff;
}
.chip.selected{ border-color:var(--brass); background:#FBF6EC; color:var(--brass-dark); }
.qty-stepper{ display:flex; align-items:center; gap:14px; justify-content:center; margin-top:6px; }
.qty-stepper button{
  width:38px; height:38px; border-radius:50%; border:1.5px solid var(--line); background:#fff;
  font-size:18px; cursor:pointer; color:var(--ink); font-weight:700;
}
.qty-stepper button:hover{ border-color:var(--brass); color:var(--brass-dark); }
.qty-stepper .qty-val{ font-family:'IBM Plex Mono',monospace; font-size:22px; font-weight:600; min-width:30px; text-align:center; }

.tc-summary-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-bottom:26px; }
@media (max-width:640px){ .tc-summary-grid{ grid-template-columns:1fr; } }
.tc-card{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:20px; text-align:center; }
.tc-card .icon{ width:44px; height:44px; border-radius:50%; margin:0 auto 10px; display:flex; align-items:center; justify-content:center; font-size:20px; }
.tc-card .n{ font-family:'Fraunces',serif; font-size:30px; font-weight:600; color:var(--ink); }
.tc-card .l{ font-size:12.5px; color:var(--muted); margin-top:2px; }

.daily-list{ display:flex; flex-direction:column; gap:10px; }
.daily-row{ display:flex; align-items:center; justify-content:space-between; padding:14px 18px; background:var(--card); border:1px solid var(--line); border-radius:12px; }
.daily-row .date{ font-weight:600; font-family:'Fraunces',serif; color:var(--ink); font-size:15px; min-width:130px; }
.daily-row .breakdown{ display:flex; gap:18px; font-size:13.5px; color:var(--muted); flex:1; }
.daily-row .pill{ display:inline-flex; align-items:center; gap:6px; }
.dot{ width:8px; height:8px; border-radius:50%; display:inline-block; }
.dot.tea{ background:#C97B3E; }
.dot.coffee{ background:#5B3A29; }

.fab{
  position:fixed; right:32px; bottom:32px; width:56px; height:56px; border-radius:50%;
  background:var(--ink); color:#F3EFE4; display:none; align-items:center; justify-content:center;
  font-size:26px; box-shadow:var(--shadow-pop); cursor:pointer; z-index:40;
}
@media (max-width:900px){ .fab{ display:flex; } }

.helper-text{ font-size:12px; color:var(--muted-2); margin-top:4px; }

/* Utility */
.flex-between{ display:flex; align-items:center; justify-content:space-between; }
.gap-8{ gap:8px; } .gap-12{ gap:12px; }
.mt-24{ margin-top:24px; } .mb-0{ margin-bottom:0; }
.text-muted{ color:var(--muted); }

/* ==========================================================================
   Mobile refinements — applies across dashboard, expenses, tea-coffee, users
   ========================================================================== */
@media (max-width:900px){
  .toolbar-right{ flex-wrap:wrap; width:100%; }
  .toolbar-right .card{ flex:1; min-width:150px; }
}

@media (max-width:700px){
  .page-head h1{ font-size:24px; }
  .page-head p{ font-size:13px; }
  .page-head{ margin-bottom:20px; }

  .card{ padding:18px; }
  .card.ledger{ padding-left:22px; }

  .modal{ padding:22px; border-radius:14px; }
  .modal-head h3{ font-size:17px; }

  .toolbar{ gap:10px; }
  .tabs{ width:100%; }
  .tab{ padding:8px 13px; font-size:13px; }

  .daily-row{ flex-direction:column; align-items:flex-start; gap:8px; padding:14px 16px; }
  .daily-row .date{ min-width:0; }
  .daily-row .breakdown{ width:100%; justify-content:space-between; }

  .tc-summary-grid{ gap:10px; }
  .tc-card{ padding:16px; }
  .tc-card .n{ font-size:24px; }

  .stat-card{ padding:16px; }
  .stat-card .stat-value{ font-size:22px; }

  .section-title{ flex-direction:column; align-items:flex-start; gap:4px; margin:26px 0 12px; }

  .chip-select{ flex-direction:column; }

  .balance-grid{ grid-template-columns:1fr !important; }

  .sidebar-foot .mini-profile .who b{ font-size:12.5px; }
}

@media (max-width:420px){
  .main{ padding:18px 12px 46px; }
  .stat-card .stat-value{ font-size:19px; }
  .page-head h1{ font-size:21px; }
  .btn{ padding:11px 16px; font-size:13.5px; }
}