/* ============================================================
   Family Welfare Management System — Main Stylesheet
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:      #16a34a;
  --green-dark: #15803d;
  --green-pale: #dcfce7;
  --navy:       #0f172a;
  --navy-mid:   #1e293b;
  --navy-light: #334155;
  --slate:      #64748b;
  --slate-light:#94a3b8;
  --border:     #e2e8f0;
  --bg:         #f8fafc;
  --white:      #ffffff;
  --red:        #dc2626;
  --red-pale:   #fee2e2;
  --amber:      #d97706;
  --amber-pale: #fef3c7;
  --blue:       #2563eb;
  --blue-pale:  #dbeafe;
  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  20px;
  --shadow-sm:  0 1px 3px rgba(15,23,42,.08);
  --shadow:     0 4px 16px rgba(15,23,42,.10);
  --shadow-lg:  0 12px 40px rgba(15,23,42,.15);
  --sidebar-w:  260px;
  --font:       system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg); color: var(--navy); line-height: 1.6; }
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }

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

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-logo .logo-mark {
  width: 38px; height: 38px;
  background: var(--green);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo .logo-mark svg { width: 22px; height: 22px; }
.sidebar-logo .logo-text { font-size: .85rem; font-weight: 700; line-height: 1.3; }
.sidebar-logo .logo-sub  { font-size: .7rem; color: var(--slate-light); font-weight: 400; }

.sidebar-user {
  padding: .9rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: .65rem;
}
.sidebar-user .avatar {
  width: 34px; height: 34px;
  background: var(--navy-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: var(--slate-light);
  flex-shrink: 0;
}
.sidebar-user .user-name  { font-size: .82rem; font-weight: 600; }
.sidebar-user .user-role  { font-size: .72rem; color: var(--slate-light); text-transform: capitalize; }

.sidebar-nav { flex: 1; padding: .75rem 0; }
.nav-section-label {
  font-size: .65rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--slate-light);
  padding: 1rem 1rem .35rem;
}
.nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem 1rem;
  color: #94a3b8;
  font-size: .87rem; font-weight: 500;
  border-radius: var(--radius-sm);
  margin: .1rem .5rem;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--navy-mid); color: var(--white); text-decoration: none; }
.nav-link.active { background: var(--green); color: var(--white); }
.nav-link .nav-icon { width: 18px; text-align: center; font-style: normal; opacity: .8; }

.sidebar-footer {
  padding: .75rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer form button {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,.15);
  color: #94a3b8;
  padding: .55rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar-footer form button:hover { background: var(--red); border-color: var(--red); color: var(--white); }

/* ── Main content ─────────────────────────────────────────── */
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: .9rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1.15rem; font-weight: 700; color: var(--navy); }
.topbar-breadcrumb { font-size: .8rem; color: var(--slate); margin-top: .1rem; }

.page-body { padding: 1.5rem; flex: 1; }

/* ── Flash alerts ─────────────────────────────────────────── */
.alert {
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: .9rem;
  display: flex; align-items: flex-start; gap: .5rem;
  border-left: 4px solid transparent;
}
.alert-success { background: var(--green-pale); color: #166534; border-color: var(--green); }
.alert-error   { background: var(--red-pale);   color: #991b1b; border-color: var(--red); }
.alert-info    { background: var(--blue-pale);   color: #1e40af; border-color: var(--blue); }
.alert-warning { background: var(--amber-pale);  color: #92400e; border-color: var(--amber); }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--navy); }
.card + .card { margin-top: 1rem; }

/* ── Stat cards ───────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--green);
  border-radius: 0 0 0 0;
}
.stat-card.red::after   { background: var(--red); }
.stat-card.amber::after { background: var(--amber); }
.stat-card.blue::after  { background: var(--blue); }
.stat-label { font-size: .78rem; color: var(--slate); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .35rem; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat-sub   { font-size: .78rem; color: var(--slate); margin-top: .25rem; }

/* ── Grid layouts ─────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.table th {
  background: var(--bg);
  padding: .7rem 1rem;
  text-align: left;
  font-size: .75rem; font-weight: 700; color: var(--slate);
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
table.table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.table tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: #f9fafb; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .72rem; font-weight: 700;
  white-space: nowrap;
  text-transform: capitalize;
}
.badge-success { background: var(--green-pale); color: #166534; }
.badge-warning { background: var(--amber-pale); color: #92400e; }
.badge-danger  { background: var(--red-pale);   color: #991b1b; }
.badge-info    { background: var(--blue-pale);   color: #1e40af; }
.badge-muted   { background: #f1f5f9;            color: var(--slate); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .6rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  text-decoration: none; line-height: 1.4;
  transition: filter .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(0.92); text-decoration: none; }
.btn-primary  { background: var(--green);  color: var(--white); }
.btn-dark     { background: var(--navy);   color: var(--white); }
.btn-danger   { background: var(--red);    color: var(--white); }
.btn-amber    { background: var(--amber);  color: var(--white); }
.btn-outline  { background: transparent; border-color: var(--border); color: var(--navy); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .8rem 1.5rem; font-size: 1rem; }
button.btn { appearance: none; }

/* ── Forms ────────────────────────────────────────────────── */
.form-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow-sm); max-width: 640px; }
.form-section-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--slate); margin: 1.25rem 0 .75rem; padding-bottom: .35rem; border-bottom: 1px solid var(--border); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .83rem; font-weight: 600; color: var(--navy); margin-bottom: .35rem; }
.form-group label .req { color: var(--red); margin-left: .2rem; }
input, select, textarea {
  width: 100%;
  padding: .6rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem; font-family: var(--font);
  color: var(--navy);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}
input[type="date"], input[type="datetime-local"] { padding: .55rem .85rem; }
textarea { resize: vertical; min-height: 90px; }
.form-help { font-size: .78rem; color: var(--slate); margin-top: .25rem; }
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.input-static { padding: .6rem .85rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .9rem; color: var(--navy); }

/* ── Page actions bar ─────────────────────────────────────── */
.page-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: .5rem; }
.page-actions-left { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Fund balance bars ────────────────────────────────────── */
.fund-bar-wrap { display: flex; flex-direction: column; gap: .65rem; }
.fund-row { display: flex; align-items: center; gap: .75rem; }
.fund-label { font-size: .82rem; font-weight: 600; color: var(--navy); width: 100px; flex-shrink: 0; text-transform: capitalize; }
.fund-bar-bg { flex: 1; height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.fund-bar-fill { height: 100%; background: var(--green); border-radius: 999px; transition: width .4s; }
.fund-amount { font-size: .82rem; color: var(--slate); width: 110px; text-align: right; flex-shrink: 0; }

/* ── Auth pages ───────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--navy) 0%, #064e3b 100%);
  padding: 1rem;
}
.auth-card {
  width: min(460px, 100%);
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.auth-card-header {
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  padding: 2rem 2rem 1.5rem;
  text-align: center;
}
.auth-logo-wrap {
  width: 60px; height: 60px;
  background: var(--green);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto .75rem;
}
.auth-logo-wrap svg { width: 34px; height: 34px; }
.auth-card-header h1 { font-size: 1.2rem; font-weight: 800; color: var(--white); margin-bottom: .2rem; }
.auth-card-header p  { font-size: .82rem; color: var(--slate-light); }
.auth-card-body { padding: 1.75rem 2rem 2rem; }
.auth-card-body .form-group { margin-bottom: 1.1rem; }
.auth-card-body input { padding: .7rem 1rem; }
.auth-submit { width: 100%; padding: .75rem; font-size: .95rem; }
.auth-footer { text-align: center; margin-top: 1.25rem; font-size: .83rem; color: var(--slate); }
.auth-footer a { color: var(--green-dark); font-weight: 600; }
.otp-input { letter-spacing: .5rem; font-size: 1.4rem; text-align: center; font-weight: 700; }
.email-chip { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .4rem .85rem; font-size: .85rem; color: var(--navy); display: inline-block; margin-bottom: .75rem; }

/* ── Bar charts ───────────────────────────────────────────── */
.bar-chart-wrap {
  display: flex; align-items: flex-end; gap: .35rem;
  height: 180px; padding: 0 .25rem .5rem; overflow-x: auto;
}
.bar-chart-col { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 36px; }
.bar-chart-val  { font-size: .62rem; font-weight: 700; color: var(--navy); margin-bottom: .2rem; white-space: nowrap; }
.bar-chart-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar-chart-bar  {
  width: 100%; min-height: 4px; border-radius: 5px 5px 0 0;
  background: var(--green); transition: height .3s;
  cursor: pointer;
}
.bar-chart-bar:hover { filter: brightness(.85); }
.bar-chart-label { font-size: .65rem; color: var(--slate); margin-top: .3rem; white-space: nowrap; }
.bar-chart-count { font-size: .6rem; color: var(--slate-light); }

/* ── Contribution calendar grid ────────────────────────────── */
.contrib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  gap: .45rem; padding: .25rem 0;
}
.contrib-cell {
  border-radius: var(--radius-sm); padding: .45rem .25rem;
  text-align: center; cursor: default;
}

/* ── Landing page ─────────────────────────────────────────── */
.landing-page { min-height: 100vh; background: var(--white); }
.landing-hero {
  background: linear-gradient(135deg, var(--navy) 0%, #064e3b 60%);
  color: var(--white); padding: 5rem 1.5rem 4rem; text-align: center;
}
.landing-hero-logo {
  width: 80px; height: 80px; background: var(--green);
  border-radius: 22px; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
}
.landing-hero-logo svg { width: 48px; height: 48px; }
.landing-hero h1 { font-size: 2.5rem; font-weight: 900; margin-bottom: .75rem; }
.landing-hero p  { font-size: 1.1rem; color: rgba(255,255,255,.75); max-width: 520px; margin: 0 auto 2rem; }
.landing-hero .btn-lg { padding: .9rem 2.5rem; font-size: 1rem; }
.landing-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; padding: 3.5rem 1.5rem; max-width: 1000px; margin: 0 auto; }
.feature-item { text-align: center; }
.feature-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.feature-item h3 { font-size: 1rem; font-weight: 700; margin-bottom: .4rem; }
.feature-item p  { font-size: .88rem; color: var(--slate); }

/* ── Receipt / Print ──────────────────────────────────────── */
.receipt-page { max-width: 680px; margin: 2rem auto; }
.receipt-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.receipt-header { background: var(--navy); color: var(--white); padding: 1.5rem 2rem; display: flex; align-items: center; justify-content: space-between; }
.receipt-header .org-name { font-size: 1.1rem; font-weight: 800; }
.receipt-header .receipt-no { font-size: .85rem; color: var(--slate-light); }
.receipt-body { padding: 1.75rem 2rem; }
.receipt-row { display: flex; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.receipt-row:last-child { border-bottom: 0; }
.receipt-row .label { color: var(--slate); font-weight: 600; }
.receipt-row .value { font-weight: 700; color: var(--navy); }
.receipt-amount { font-size: 1.4rem; font-weight: 900; color: var(--green-dark); }
.receipt-footer { padding: 1rem 2rem; background: var(--bg); border-top: 1px solid var(--border); display: flex; gap: .75rem; }
.receipt-stamp { display: inline-block; border: 3px solid var(--green); border-radius: 50%; padding: .3rem .8rem; color: var(--green); font-weight: 800; font-size: .85rem; transform: rotate(-15deg); }

/* ── Error pages ──────────────────────────────────────────── */
.error-page { min-height: 100vh; display: grid; place-items: center; background: var(--bg); text-align: center; padding: 2rem; }
.error-code { font-size: 7rem; font-weight: 900; color: var(--border); line-height: 1; }
.error-msg  { font-size: 1.3rem; font-weight: 700; color: var(--navy); margin: .5rem 0; }
.error-sub  { font-size: .9rem; color: var(--slate); margin-bottom: 1.5rem; }

/* ── Misc helpers ─────────────────────────────────────────── */
.text-muted  { color: var(--slate); }
.text-green  { color: var(--green-dark); }
.text-red    { color: var(--red); }
.text-amber  { color: var(--amber); }
.fw-bold     { font-weight: 700; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.w-full { width: 100%; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--slate); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: .75rem; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.pill-list { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ── Mobile hamburger button ──────────────────────────────── */
.nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: .4rem .5rem;
  color: var(--navy);
  line-height: 1;
  flex-shrink: 0;
  transition: background .15s;
}
.nav-hamburger:hover { background: var(--bg); }
.nav-hamburger svg { display: block; }

/* ── Sidebar overlay (mobile backdrop) ─────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 998;
  -webkit-backdrop-filter: blur(1px);
  backdrop-filter: blur(1px);
}
.sidebar-overlay.active { display: block; }

/* ── Sidebar close button (mobile only) ─────────────────────── */
.sidebar-close-row {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem .5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-close-row .close-label {
  font-size: .78rem;
  font-weight: 700;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.sidebar-close-btn {
  background: none;
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.75);
  border-radius: var(--radius-sm);
  padding: .25rem .6rem;
  font-size: .9rem;
  cursor: pointer;
  line-height: 1.4;
  transition: background .15s, color .15s;
}
.sidebar-close-btn:hover { background: rgba(255,255,255,.1); color: white; }

/* ── Responsive — mobile drawer ──────────────────────────────── */
@media (max-width: 820px) {

  /* Show hamburger */
  .nav-hamburger { display: flex; }

  /* Sidebar becomes a fixed off-canvas drawer — hidden via transform */
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;                                        /* anchor at left edge  */
    transform: translateX(-100%);                   /* slide fully off screen */
    width: 270px !important;
    max-width: 85vw !important;                     /* never wider than 85% viewport */
    height: 100vh !important;
    z-index: 999;
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
    will-change: transform;
    overflow-y: auto;
    overflow-x: hidden;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }

  /* Show close row inside the drawer */
  .sidebar-close-row { display: flex; }

  /* Restore sidebar internals (undo old horizontal-nav styles) */
  .sidebar-logo { display: flex !important; }
  .sidebar-user { display: flex !important; }
  .sidebar-nav {
    display: block !important;
    flex-wrap: unset !important;
    padding: .75rem 0 !important;
    width: auto !important;
    flex: 1;
  }
  .nav-section-label { display: block !important; }
  .nav-link {
    display: flex !important;
    padding: .6rem 1rem !important;
    margin: .1rem .5rem !important;
    font-size: .87rem !important;
  }
  .sidebar-footer { padding: .75rem !important; }
  .sidebar-footer form button { width: 100% !important; padding: .55rem !important; }

  /* Prevent body scroll when drawer is open */
  body.sidebar-open { overflow: hidden; }

  /* Main content stretches to full width (sidebar is out of flow) */
  .topbar {
    padding: .65rem 1rem;
    gap: .5rem;
  }
  .topbar-title { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-body { padding: .85rem; }

  /* Grid stacking */
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* Forms */
  .form-row   { grid-template-columns: 1fr; }
  .form-card  { max-width: 100% !important; }
  .form-actions { flex-wrap: wrap; }

  /* Page actions */
  .page-actions { flex-wrap: wrap; gap: .5rem; }
  .page-actions-left { flex-wrap: wrap; }

  /* Fund rows */
  .fund-label { width: 80px; font-size: .78rem; }
  .fund-amount { width: 90px; font-size: .78rem; }

  /* Contribution calendar grid */
  .contrib-grid { grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); }

  /* Landing page */
  .landing-features { padding: 2rem 1rem; }
}

@media (max-width: 540px) {
  /* Single-column stats */
  .stats-grid { grid-template-columns: 1fr; }

  /* Topbar */
  .topbar { flex-wrap: nowrap; }

  /* Auth pages */
  .auth-card-body { padding: 1.25rem; }
  .auth-card-header { padding: 1.5rem 1.25rem 1.25rem; }

  /* Landing */
  .landing-hero { padding: 3rem 1rem 2.5rem; }
  .landing-hero h1 { font-size: 1.65rem; }
  .landing-hero p { font-size: .9rem; }
  .landing-features { grid-template-columns: 1fr; }

  /* Table cells smaller */
  table.table th, table.table td { padding: .6rem .75rem; font-size: .82rem; }

  /* Button stacking */
  .form-actions .btn { width: 100%; justify-content: center; text-align: center; }
  .btn-lg { font-size: .92rem; padding: .7rem 1.2rem; }

  /* Stat cards */
  .stat-card .stat-value { font-size: 1.5rem; }

  /* Page body extra tight */
  .page-body { padding: .75rem; }

  /* Receipt page */
  .receipt-body { padding: 1.25rem; }
  .receipt-header { padding: 1.1rem 1.25rem; }
  .receipt-footer { padding: .75rem 1.25rem; flex-wrap: wrap; }
}

/* ── Print (receipts) ─────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .page-actions, .receipt-footer .btn, .no-print { display: none !important; }
  body, .main-content, .page-body { background: white !important; padding: 0 !important; }
  .receipt-card { border: 1px solid #000; border-radius: 0; box-shadow: none; }
  .receipt-header { background: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
