/* =============================================
   Creative Cash — Mobile-First Stylesheet
   Dark Premium Theme with Bengali Support
============================================= */

@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-base:       #0b0f1a;
  --bg-surface:    #111827;
  --bg-card:       #1a2235;
  --bg-card-hover: #1f2a40;
  --bg-input:      #0d1525;
  --border:        #1e2d45;
  --border-light:  #243352;

  --accent:        #6C63FF;
  --accent-hover:  #5a52e0;
  --accent-glow:   rgba(108,99,255,.25);

  --green:         #22c55e;
  --green-bg:      rgba(34,197,94,.12);
  --red:           #ef4444;
  --red-bg:        rgba(239,68,68,.12);
  --blue:          #3b82f6;
  --blue-bg:       rgba(59,130,246,.12);
  --orange:        #f97316;
  --orange-bg:     rgba(249,115,22,.12);
  --purple:        #a855f7;
  --purple-bg:     rgba(168,85,247,.12);
  --cyan:          #06b6d4;

  --text-primary:  #e2e8f0;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;

  --sidebar-w:     260px;
  --topbar-h:      56px;
  --bottom-nav-h:  64px;
  --radius:        12px;
  --radius-sm:     8px;

  --shadow:        0 4px 24px rgba(0,0,0,.4);
  --shadow-sm:     0 2px 8px rgba(0,0,0,.3);

  --font-bn: 'Hind Siliguri', 'Noto Sans Bengali', 'Kohinoor Bangla', 'Bangla MN', 'Vrinda', 'SolaimanLipi', sans-serif;
  --font-en: 'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-bn);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ══════════════════════════════════════
   APP LAYOUT — mobile first
══════════════════════════════════════ */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar — hidden drawer on mobile ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 300;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-mark svg { width: 36px; height: 36px; }
.sidebar-brand { display: block; font-size: .95rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.sidebar-tagline { display: block; font-size: .65rem; color: var(--text-muted); }

.sidebar-close {
  display: flex;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: color .2s;
  flex-shrink: 0;
}
.sidebar-close:hover { color: var(--text-primary); }

/* Nav */
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { margin-bottom: 4px; }
.nav-section-label {
  font-size: .62rem;
  font-family: var(--font-en);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  padding: 8px 18px 4px;
  display: block;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: all .2s;
  border-left: 3px solid transparent;
  min-height: 44px;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link:hover { color: var(--text-primary); background: var(--bg-card); }
.nav-link.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-left-color: var(--accent);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: #fff;
}
.user-details { flex: 1; min-width: 0; }
.user-name { display: block; font-size: .85rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: .68rem; color: var(--text-muted); }
.logout-btn { color: var(--text-muted); transition: color .2s; min-width: 36px; min-height: 36px; display: flex; align-items: center; justify-content: center; }
.logout-btn:hover { color: var(--red); }
.logout-btn svg { width: 18px; height: 18px; display: block; }

/* Overlay */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 250;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ── Main Content ── */
.main-content {
  margin-left: 0;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  position: sticky; top: 0; z-index: 200;
}
.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none; border: none; cursor: pointer; padding: 8px 6px;
  min-width: 40px; min-height: 40px;
  align-items: center; justify-content: center;
}
.menu-toggle span { display: block; width: 22px; height: 2px; background: var(--text-secondary); border-radius: 2px; transition: .3s; }
.topbar-title { font-size: .95rem; font-weight: 600; color: var(--text-primary); flex: 1; }
.topbar-date { display: none; font-size: .78rem; color: var(--text-muted); font-family: var(--font-en); }

/* ── Page Content ── */
.page-content {
  padding: 14px;
  flex: 1;
  padding-bottom: calc(var(--bottom-nav-h) + 14px); /* space for bottom nav */
}

/* ── Dashboard Grid ── */
.dashboard-grid { display: flex; flex-direction: column; gap: 14px; }

/* ── Stats Row — 1 col mobile ── */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; align-items: center; gap: 12px;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:active { transform: scale(.98); }
.stat-icon {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-green .stat-icon { background: var(--green-bg); color: var(--green); }
.stat-red   .stat-icon { background: var(--red-bg);   color: var(--red); }
.stat-blue  .stat-icon { background: var(--blue-bg);  color: var(--blue); }
.stat-orange .stat-icon { background: var(--orange-bg); color: var(--orange); }
.stat-purple .stat-icon { background: var(--purple-bg); color: var(--purple); }
.stat-body { flex: 1; min-width: 0; }
.stat-label { font-size: .72rem; color: var(--text-muted); margin-bottom: 2px; }
.stat-value { font-size: 1.05rem; font-weight: 700; font-family: var(--font-en); color: var(--text-primary); line-height: 1.2; }
.stat-sub { font-size: .68rem; color: var(--text-muted); margin-top: 2px; }

/* ── Chart Row — stacked on mobile ── */
.chart-row { display: grid; grid-template-columns: 1fr; gap: 14px; }
.chart-card, .breakdown-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.chart-card canvas { display: block; width: 100% !important; }
.card-title { font-size: .9rem; font-weight: 600; color: var(--text-primary); margin-bottom: 14px; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.view-all-link { font-size: .8rem; color: var(--accent); text-decoration: none; transition: color .2s; }
.view-all-link:hover { color: var(--accent-hover); }

/* Breakdown */
.breakdown-list { display: flex; flex-direction: column; gap: 10px; }
.breakdown-item { display: flex; align-items: center; gap: 8px; }
.breakdown-label { font-size: .75rem; color: var(--text-secondary); width: 90px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breakdown-bar-wrap { flex: 1; height: 5px; background: var(--bg-input); border-radius: 99px; overflow: hidden; }
.breakdown-bar { height: 100%; background: linear-gradient(90deg, var(--green), var(--cyan)); border-radius: 99px; transition: width .6s ease; }
.breakdown-bar-red { background: linear-gradient(90deg, var(--red), var(--orange)); }
.breakdown-amount { font-size: .72rem; color: var(--text-secondary); font-family: var(--font-en); width: 85px; text-align: right; flex-shrink: 0; }

/* ── Recent Card ── */
.recent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* ── Mobile Transaction Cards ── */
.txn-cards { display: flex; flex-direction: column; gap: 8px; }
.txn-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background .2s;
}
.txn-card:active { background: var(--bg-card-hover); }
.txn-card-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.txn-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.txn-icon svg { width: 16px; height: 16px; }
.txn-icon-in  { background: var(--green-bg); color: var(--green); }
.txn-icon-out { background: var(--red-bg);   color: var(--red); }
.txn-desc { font-size: .85rem; color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-meta { font-size: .7rem; color: var(--text-muted); margin-top: 1px; }
.txn-amount { font-size: .9rem; font-weight: 700; font-family: var(--font-en); flex-shrink: 0; text-align: right; }
.txn-amount.in  { color: var(--green); }
.txn-amount.out { color: var(--red); }

/* desktop table hidden on mobile, cards shown */
.d-desktop { display: none; }
.d-mobile  { display: block; }

/* ── Bottom Nav (mobile only) ── */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-link {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .65rem;
  font-weight: 500;
  transition: color .2s;
  min-height: 44px;
  padding: 6px 4px;
}
.bottom-nav-link svg { width: 20px; height: 20px; }
.bottom-nav-link.active { color: var(--accent); }
.bottom-nav-link:active { color: var(--accent); }

/* ── Page Section ── */
.page-section { max-width: 1400px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 10px; flex-wrap: wrap;
}
.section-title { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.mt-20 { margin-top: 16px; }

/* ── Filter Bar ── */
.filter-bar {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 14px;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.filter-label { font-size: .72rem; color: var(--text-muted); }
.filter-search { width: 100%; }
.filter-search .form-control { width: 100%; }

/* ── Summary Pill ── */
.summary-pill {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: .8rem; color: var(--text-secondary);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.summary-pill .divider { color: var(--border-light); }

/* ── Table ── */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}
.table-responsive::-webkit-scrollbar { height: 4px; }
.table-responsive::-webkit-scrollbar-track { background: transparent; }
.table-responsive::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: .85rem;
}
.data-table th {
  background: var(--bg-input);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}
.data-table tbody tr:hover td { background: var(--bg-card-hover); }
.data-table tfoot td {
  padding: 12px;
  background: var(--bg-input);
  border-top: 2px solid var(--border-light);
  font-weight: 600;
  color: var(--text-primary);
}
.desc-cell { max-width: 200px; }
.empty-cell { text-align: center; color: var(--text-muted); padding: 40px !important; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 99px;
  font-size: .68rem; font-weight: 600; white-space: nowrap;
}
.badge-in  { background: var(--green-bg); color: var(--green); }
.badge-out { background: var(--red-bg);   color: var(--red); }
.badge-cat { background: rgba(108,99,255,.12); color: var(--accent); }
.badge-cat-out { background: var(--orange-bg); color: var(--orange); }
.badge-admin   { background: var(--purple-bg); color: var(--purple); }
.badge-cashier { background: var(--blue-bg);   color: var(--blue); }
.badge-viewer  { background: var(--orange-bg); color: var(--orange); }

/* ── Pagination ── */
.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.page-link {
  display: flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); text-decoration: none;
  font-size: .82rem; font-family: var(--font-en);
  transition: all .2s; padding: 0 8px;
}
.page-link:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.page-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600; font-family: var(--font-bn);
  border: none; cursor: pointer; text-decoration: none;
  transition: all .2s; white-space: nowrap;
  min-height: 40px;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); }
.btn-secondary:hover { color: var(--text-primary); border-color: var(--border-light); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text-primary); }
.btn-sm { padding: 7px 12px; font-size: .8rem; min-height: 34px; }

.btn-icon {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: none; cursor: pointer;
  transition: all .2s;
}
.btn-icon svg { width: 15px; height: 15px; }
.btn-icon-red { background: var(--red-bg); color: var(--red); }
.btn-icon-red:hover { background: var(--red); color: #fff; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--text-secondary); }
.form-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-bn);
  font-size: .9rem;
  padding: 10px 12px;
  width: 100%;
  transition: border-color .2s;
  outline: none;
  min-height: 42px;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control option { background: var(--bg-surface); }
textarea.form-control { resize: vertical; min-height: 72px; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.7);
  align-items: flex-end; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; animation: fadeIn .2s; }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 100%;
  box-shadow: var(--shadow);
  animation: slideUp .25s cubic-bezier(.4,0,.2,1);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-surface); z-index: 1;
}
.modal-header h3 { font-size: .95rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; line-height: 1; transition: color .2s; min-width: 36px; min-height: 36px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { color: var(--text-primary); }
.modal-form { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ── Report ── */
.report-section { margin-top: 20px; }

/* ── Alerts ── */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: .85rem; margin-bottom: 14px;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert-error   { background: var(--red-bg);   color: var(--red);   border: 1px solid rgba(239,68,68,.3); }
.alert-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(34,197,94,.3); }

/* ── Text Utilities ── */
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-green   { color: var(--green); }
.text-red     { color: var(--red); }
.text-muted   { color: var(--text-muted); }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.small-text   { font-size: .75rem; }

/* ── Login Page ── */
.login-page { background: var(--bg-base); }
.login-bg {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 20%, rgba(108,99,255,.15) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(6,182,212,.1) 0%, transparent 60%),
              var(--bg-base);
  padding: 20px;
}
.login-container { width: 100%; max-width: 400px; }
.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 28px 22px;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.logo-icon { margin: 0 auto 10px; width: 56px; height: 56px; }
.logo-icon svg { width: 56px; height: 56px; }
.logo-title { font-size: 1.4rem; font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.2; }
.logo-subtitle { font-size: .82rem; color: var(--text-muted); margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.input-icon-wrap { position: relative; }
.input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
.input-icon-wrap .form-control { padding-left: 40px; padding-right: 40px; }
.toggle-pw { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; min-width: 36px; min-height: 36px; display: flex; align-items: center; justify-content: center; }
.toggle-pw svg { width: 18px; height: 18px; display: block; }
.btn-login {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px; border-radius: var(--radius-sm); border: none;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  color: #fff; font-size: .95rem; font-weight: 700;
  font-family: var(--font-bn); cursor: pointer;
  transition: opacity .2s, transform .2s;
  width: 100%; min-height: 48px;
}
.btn-login:hover { opacity: .92; transform: translateY(-1px); }
.btn-login svg { width: 18px; height: 18px; }
.login-footer { text-align: center; font-size: .72rem; color: var(--text-muted); margin-top: 20px; }

/* ── Report Tabs ── */
.report-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-top: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px;
}
.report-tab {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none;
  font-size: .82rem; font-weight: 500;
  transition: all .2s; white-space: nowrap;
  min-height: 38px;
}
.report-tab svg { flex-shrink: 0; }
.report-tab:hover { color: var(--text-primary); background: var(--bg-input); }
.report-tab.active { background: var(--accent); color: #fff; }

/* ── Report Cards ── */
.report-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.report-two-col { display: grid; grid-template-columns: 1fr; gap: 14px; }
.mt-16 { margin-top: 16px; }

/* ── Donut / Category ── */
.donut-row { display: flex; gap: 12px; justify-content: space-around; flex-wrap: wrap; }
.donut-row > div { text-align: center; flex: 1; min-width: 120px; }
.donut-label { font-size: .75rem; font-weight: 600; margin-bottom: 6px; }

.cat-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.cat-legend-col { display: flex; flex-direction: column; gap: 6px; }
.cat-legend-row { display: flex; align-items: center; gap: 6px; }
.cat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cat-name { font-size: .75rem; color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-amt { font-size: .72rem; font-family: var(--font-en); flex-shrink: 0; }

/* ── Cash Calc Rows ── */
.cash-calc-row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.cash-calc-label { font-size:.85rem; color:var(--text-secondary); }
.cash-calc-val { font-size:.9rem; font-family:var(--font-en); font-weight:600; color:var(--text-primary); }

/* ── Year / Month link ── */
.year-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.year-link:hover { text-decoration: underline; }

/* ── Chart Type Toggle ── */
.chart-type-toggle {
  display: flex; gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.chart-toggle-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border: none; border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}
.chart-toggle-btn:hover { color: var(--text-primary); background: var(--bg-card); }
.chart-toggle-btn.active { background: var(--accent); color: #fff; }

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ══════════════════════════════════════
   TABLET  ≥ 600px
══════════════════════════════════════ */
@media (min-width: 600px) {
  .topbar-date { display: block; }
  .page-content { padding: 18px; padding-bottom: calc(var(--bottom-nav-h) + 18px); }
  .stat-value { font-size: 1.15rem; }
  .stat-icon { width: 46px; height: 46px; }
  .stat-icon svg { width: 22px; height: 22px; }
  .stat-card { padding: 16px; gap: 14px; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .filter-bar { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
  .filter-group { width: auto; flex: 1; min-width: 160px; }
  .login-card { padding: 36px 32px; }
  .modal { border-radius: var(--radius); max-width: 520px; align-self: center; }
  .modal-overlay { align-items: center; }
}

/* ══════════════════════════════════════
   DESKTOP  ≥ 960px  — sidebar always visible
══════════════════════════════════════ */
@media (min-width: 960px) {
  .sidebar { transform: translateX(0) !important; }
  .sidebar-close { display: none; }
  .sidebar-overlay { display: none !important; }
  .main-content { margin-left: var(--sidebar-w); }
  .menu-toggle { display: none; }

  .topbar { padding: 0 24px; }
  .topbar-title { font-size: 1rem; }

  .page-content {
    padding: 24px;
    padding-bottom: 24px; /* no bottom nav on desktop */
  }

  .dashboard-grid { gap: 20px; }

  .stats-row { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .stat-card { padding: 20px; gap: 16px; }
  .stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
  .stat-icon { width: 48px; height: 48px; }
  .stat-icon svg { width: 24px; height: 24px; }
  .stat-value { font-size: 1.25rem; }

  .chart-row { grid-template-columns: 1fr 360px; gap: 16px; }
  .chart-card, .breakdown-card { padding: 20px; }
  .card-title { font-size: .95rem; }

  .recent-card { padding: 20px; }

  .report-two-col { grid-template-columns: 1fr 1fr; gap: 16px; }
  .report-card { padding: 20px; }

  /* show table, hide cards on desktop */
  .d-desktop { display: block; }
  .d-mobile  { display: none; }

  /* hide bottom nav */
  .bottom-nav { display: none; }

  .breakdown-label { width: 110px; }
  .breakdown-amount { width: 95px; }

  .desc-cell { max-width: 280px; }
  .data-table th { font-size: .72rem; padding: 10px 14px; }
  .data-table td { padding: 11px 14px; }
}

/* ══════════════════════════════════════
   LARGE  ≥ 1280px
══════════════════════════════════════ */
@media (min-width: 1280px) {
  .chart-row { grid-template-columns: 1fr 380px; }
  .dashboard-grid { max-width: 1400px; }
}

/* ══════════════════════════════════════
   SMALL MOBILE  ≤ 430px
══════════════════════════════════════ */
@media (max-width: 430px) {
  /* Prevent iOS auto-zoom on input focus (needs 16px min) */
  input.form-control,
  select.form-control,
  textarea.form-control,
  input[type="date"] { font-size: 1rem !important; }

  /* Force filter bar to column */
  .filter-bar { flex-direction: column !important; }
  .filter-group { width: 100% !important; min-width: unset !important; }

  /* Tighter table text */
  .data-table { font-size: .78rem; }
  .data-table th { font-size: .62rem; padding: 8px; }
  .data-table td { padding: 9px 8px; }

  /* Report tabs compact */
  .report-tab { padding: 7px 10px; font-size: .78rem; }

  /* Section title */
  .section-title { font-size: 1rem; }

  /* Summary pill wrap */
  .summary-pill { flex-direction: column; align-items: flex-start; gap: 4px; }
  .summary-pill .divider { display: none; }
}

/* ══════════════════════════════════════
   TINY MOBILE  ≤ 360px
══════════════════════════════════════ */
@media (max-width: 360px) {
  /* Stats: 1 column on narrowest screens */
  .stats-row { grid-template-columns: 1fr; }

  /* Stack modal actions */
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; justify-content: center; }

  /* Compact page padding */
  .page-content { padding: 10px; padding-bottom: calc(var(--bottom-nav-h) + 10px); }

  /* Compact stat cards */
  .stat-card { padding: 11px 10px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; }
  .stat-value { font-size: .95rem; }
  .stat-label { font-size: .68rem; }

  /* Login card */
  .login-card { padding: 20px 14px; }

  /* Bottom nav labels */
  .bottom-nav-link { font-size: .6rem; gap: 2px; }
}

/* ══════════════════════════════════════
   LANDSCAPE / SHORT SCREENS  ≤ 600px height
══════════════════════════════════════ */
@media (max-height: 600px) and (max-width: 960px) {
  .modal { max-height: 95vh; }
  .page-content { padding-top: 10px; }
  .modal-form { gap: 10px; }
}

/* ── Hide on mobile (below desktop breakpoint) ── */
@media (max-width: 959px) {
  .d-mob-none { display: none !important; }

  /* Compact table for mobile — same look, smaller size */
  .data-table { font-size: .8rem; }
  .data-table th {
    font-size: .66rem;
    padding: 8px 6px;
    letter-spacing: .03em;
  }
  .data-table td { padding: 9px 6px; }
  .data-table .desc-cell { max-width: 120px; }

  /* Compact date column */
  .data-table .td-date { white-space: nowrap; }

  /* Compact badges */
  .data-table .badge { font-size: .62rem; padding: 2px 6px; }

  /* Compact action buttons */
  .data-table .btn-icon { width: 30px !important; height: 30px !important; }
  .data-table .btn-icon svg { width: 13px !important; height: 13px !important; }
}

/* ── Hide on phone only (< 600px) ── */
@media (max-width: 599px) {
  .d-sm-none { display: none !important; }
}

/* ── Print ── */
@media print {
  .sidebar, .topbar, .filter-bar, .section-header .btn,
  .btn, .btn-icon, .pagination, .sidebar-overlay, .bottom-nav { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding-bottom: 0 !important; }
  body { background: #fff; color: #000; }
  .data-table th, .data-table tfoot td { background: #f0f0f0 !important; }
  .stat-card, .chart-card, .breakdown-card, .recent-card, .report-section { border: 1px solid #ddd !important; }
  .d-desktop { display: block !important; }
  .d-mobile  { display: none !important; }
}

/* ══════════════════════════════════════
   PENDING / APPROVAL STYLES
══════════════════════════════════════ */

/* Status badges */
.badge-pending  { background: rgba(249,115,22,.15); color: #fb923c; border: 1px solid rgba(249,115,22,.3); }
.badge-approved { background: rgba(34,197,94,.15);  color: #4ade80; border: 1px solid rgba(34,197,94,.3); }
.badge-rejected { background: rgba(239,68,68,.15);  color: #f87171; border: 1px solid rgba(239,68,68,.3); }

/* Nav badge (red dot with count) */
.nav-badge {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  background: var(--red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ── Mobile 2-line Table (cash_in / cash_out) ── */
.mt-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.mobile-table {
  width: 100%;
  border-collapse: collapse;
}
.mobile-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.mobile-table tbody tr:last-child { border-bottom: none; }
.mobile-table tbody tr:active { background: var(--bg-card-hover); }

/* Left cell: title + badge + date */
.mt-info {
  padding: 10px 6px 10px 12px;
  vertical-align: top;
}
.mt-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 5px;
  word-break: break-word;
}
.mt-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.mt-date { font-size: .72rem; color: var(--text-muted); }
.mt-remarks { font-size: .7rem; color: var(--text-muted); margin-top: 3px; font-style: italic; }

/* Right cell: amount + buttons */
.mt-side {
  padding: 10px 12px 10px 6px;
  vertical-align: top;
  text-align: right;
  width: 1%;          /* shrink to content */
  white-space: nowrap;
}
.mt-amount {
  font-size: .92rem;
  font-weight: 700;
  font-family: var(--font-en);
  margin-bottom: 6px;
  display: block;
}
.mt-btns {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}
.mt-btns form { display: contents; }
.mt-btns .btn-icon { width: 32px; height: 32px; flex-shrink: 0; }
.mt-btns .btn-icon svg { width: 13px; height: 13px; }

/* Footer total row */
.mobile-table tfoot tr { border-top: 2px solid var(--border-light); }
.mobile-table tfoot td {
  padding: 10px 12px;
  background: var(--bg-input);
  font-size: .85rem;
  font-weight: 700;
}
.mobile-table tfoot .mt-total-label { color: var(--text-muted); font-weight: 500; }
.mobile-table tfoot .mt-total-val { text-align: right; white-space: nowrap; }

/* Edit icon button */
.btn-icon-edit {
  background: rgba(59,130,246,.12);
  color: var(--blue);
  border: 1px solid rgba(59,130,246,.25);
}
.btn-icon-edit:hover {
  background: rgba(59,130,246,.25);
  border-color: var(--blue);
}
