* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, sans-serif;
}

/* ── Keyframe Animations ───────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

/* ─────────────────────────────────────────────────────────────
   LAYOUT
───────────────────────────────────────────────────────────── */
body {
  background: #f6faf7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Subscription Banner ───────────────────────────────────── */
#subscriptionBanner {
  display: none;
  width: 100%;
  background: linear-gradient(135deg, #0f172a, #1e3a5f);
  color: #fff;
  padding: 12px 24px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ── App wrapper ───────────────────────────────────────────── */
.app { display: flex; flex: 1; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #062f23, #0a4d39);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  z-index: 300;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-close {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 22px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.sidebar-close:hover { background: rgba(255,255,255,0.25); }

.logo { margin-bottom: 30px; }
.nav  { list-style: none; }

/* ── Nav items ─────────────────────────────────────────────── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 6px;
  font-size: 14px;
  position: relative;
  overflow: hidden;
  transition: background 0.2s ease, transform 0.18s ease;
}
.nav-item::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: rgba(255,255,255,0.9);
  border-radius: 0 3px 3px 0;
  transform: scaleY(0);
  transition: transform 0.2s ease;
}
.nav-item:hover {
  background: rgba(255,255,255,0.12);
  transform: translateX(4px);
}
.nav-item:hover .nav-icon { opacity: 1; transform: scale(1.12); }
.nav-item.active { background: #1e7f5c; transform: translateX(0); }
.nav-item.active::before { transform: scaleY(1); }
.nav-item.active .nav-icon { opacity: 1; }

/* ── Nav icon — SVG ────────────────────────────────────────── */
.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  opacity: 0.75;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.nav-icon svg { display: block; }
.nav-label { flex: 1; }

/* ── Logout button ─────────────────────────────────────────── */
.logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
  font-size: 14px;
  transition: background 0.2s ease, transform 0.15s ease;
}
.logout:hover { background: rgba(255,255,255,0.2); transform: translateY(-1px); }

/* ── Sidebar overlay ───────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 400;
}
.sidebar-overlay.active { display: block; animation: fadeIn 0.25s ease; }

/* ── Main Content ──────────────────────────────────────────── */
.content { flex: 1; padding: 40px; min-width: 0; overflow-x: hidden; }

/* ── Hamburger ─────────────────────────────────────────────── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1100;
  background: #0a4d39;
  color: #fff;
  border: none;
  border-radius: 10px;
  width: 42px;
  height: 42px;
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: background 0.2s ease, transform 0.15s ease;
}
.sidebar-toggle:hover { background: #1e7f5c; transform: scale(1.05); }

/* ── Pages ─────────────────────────────────────────────────── */
.page        { display: none; }
.page.active { display: block; animation: fadeIn 0.25s ease; }

/* ── Page headers ──────────────────────────────────────────── */
.page-header h1 { font-size: 28px; margin-bottom: 6px; }
.page-header p  { color: #777; margin-bottom: 30px; }
#welcomeMessage { font-size: 15px; color: #1e7f5c; font-weight: 600; margin-bottom: 4px; }

/* ── Stats grid ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.stat-card {
  background: #fff;
  padding: 20px 22px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
  animation: fadeInUp 0.35s ease both;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,0.1); }
.stat-card p  { font-size: 13px; color: #666; margin: 0; }
.stat-card h2 { font-size: 24px; font-weight: 700; color: #0f172a; margin: 0; }

.stat-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.stats-wide {
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.wide-card {
  background: #fff;
  padding: 26px;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06);
  text-align: center;
  animation: fadeInUp 0.35s ease both;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.wide-card:nth-child(1) { animation-delay: 0.1s; }
.wide-card:nth-child(2) { animation-delay: 0.15s; }
.wide-card:nth-child(3) { animation-delay: 0.2s; }
.wide-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,0.1); }
.wide-card h2 { font-size: 22px; margin-bottom: 6px; }
.wide-card p  { font-size: 13px; color: #666; }

/* ── Chart ─────────────────────────────────────────────────── */
.chart-card {
  margin-top: 30px;
  background: #fff;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.06);
  animation: fadeInUp 0.35s ease both;
  animation-delay: 0.25s;
}
.chart-card h3 { margin-bottom: 4px; font-size: 16px; color: #333; }
canvas { width: 100% !important; max-width: 100%; }

/* ── Invoices ──────────────────────────────────────────────── */
.invoices-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.invoice-search { margin-bottom: 24px; }
.invoice-search input {
  width: 100%;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #ddd;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.invoice-search input:focus {
  outline: none;
  border-color: #1e7f5c;
  box-shadow: 0 0 0 3px rgba(30,127,92,0.12);
}
.invoice-card {
  background: #fff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
  overflow: visible;
  position: relative;
}
.invoice-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 0.9fr 0.9fr 0.9fr 0.4fr;
  padding: 14px 10px;
  font-size: 14px;
  align-items: center;
  min-width: 560px;
  transition: background 0.15s ease;
  /* NO animation here — CSS animations create stacking contexts that clip dropdowns */
  position: relative;
  z-index: 0;
}
/* When a row's action menu is open, raise that entire row above its siblings */
.invoice-row:has(.menu-dropdown[style*="block"]) {
  z-index: 100;
}
.invoice-row:not(.invoice-head):hover { background: #f8fffe; border-radius: 8px; }
.invoice-head {
  color: #777;
  border-bottom: 1px solid #e5e5e5;
  font-weight: 500;
}
.invoice-empty {
  text-align: center;
  padding: 40px 10px;
  color: #888;
  display: none;
}
.status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  cursor: pointer;
  display: inline-block;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.status:hover   { transform: scale(1.06); }
.status.paid    { background: #e6f6ef; color: #1e7f5c; }
.status.pending { background: #fff4e5; color: #cc7a00; }
.status.overdue { background: #fee2e2; color: #dc2626; }

.action-menu { position: relative; }
.menu-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
}
.menu-btn:hover { background: #f0f0f0; }
.menu-dropdown {
  position: fixed;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  border: 1px solid rgba(0,0,0,0.06);
  display: none;
  min-width: 185px;
  z-index: 9999;
  overflow: hidden;
}

.action-menu {
  position: relative;
  z-index: 1;
}
.action-menu:has(.menu-dropdown[style*="block"]) {
  z-index: 9998;
}
.menu-item {
  padding: 11px 16px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s ease;
}
.menu-item:hover { background: #f5f5f5; }
.menu-item:last-child { color: #dc2626; }
.menu-item:last-child:hover { background: #fff5f5; }

/* ── Modals ────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  z-index: 700;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.overlay.show { display: block; }

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: calc(100% - 32px);
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 20px;
  padding: 28px;
  transform: translate(-50%, -50%) scale(0.92);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.22s ease;
  z-index: 800;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.04),
    0 8px 24px rgba(0,0,0,0.12),
    0 32px 80px rgba(0,0,0,0.22);
}
.modal.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
.modal .close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: #f4f4f4;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #666;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}
.modal .close:hover { background: #e8e8e8; color: #333; transform: rotate(90deg); }

.invoice-modal { max-width: 700px; width: calc(100% - 32px); }
.invoice-modal h2 { font-size: 22px; margin-bottom: 20px; font-weight: 600; }

.invoice-items {
  margin-top: 24px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 14px;
}
.items-header,
.invoice-item {
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr 1.5fr auto;
  gap: 10px;
  align-items: center;
}
.items-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 10px;
}
.invoice-item {
  background: #fff;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
  animation: fadeInUp 0.2s ease both;
}
.invoice-item input {
  padding: 10px;
  border-radius: 8px;
  background: #f4f4f4;
  border: none;
  font-size: 14px;
  width: 100%;
  transition: background 0.15s ease;
}
.invoice-item input:focus { outline: none; background: #ebebeb; }
.remove-item { background: none; border: none; font-size: 18px; cursor: pointer; color: #bbb; transition: color 0.15s ease; }
.remove-item:hover { color: #dc2626; }
.add-item-btn {
  margin-top: 10px;
  background: none;
  border: 1px dashed #1e7f5c;
  padding: 10px;
  border-radius: 10px;
  color: #1e7f5c;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s ease;
}
.add-item-btn:hover { background: rgba(30,127,92,0.06); }
.invoice-summary-box {
  margin: 20px 0;
  background: #f9fafb;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #555;
}
.summary-total {
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
  margin-top: 4px;
  font-size: 17px;
  color: #0f172a;
  font-weight: 600;
}

.invoice-review-card {
  padding: 28px;
  max-width: 750px;
  width: 100%;
  margin: auto;
  border-radius: 16px;
  overflow-x: hidden;
}
.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 20px;
  flex-wrap: wrap;
}
.biz-info    { max-width: 60%; }
.biz-logo    { width: 60px; height: 60px; object-fit: cover; margin-bottom: 10px; border-radius: 8px; }
.biz-info h1 { font-size: 18px; margin-bottom: 4px; }
.biz-info p  { font-size: 13px; color: #555; }
.invoice-meta    { text-align: right; font-size: 14px; }
.invoice-meta h3 { margin-bottom: 8px; }
.review-items { margin-top: 20px; border-top: 1px solid #eee; }
.review-items .invoice-row { grid-template-columns: 2fr 1fr 1fr 1fr; padding: 10px 0; min-width: unset; }
.review-total { margin-top: 20px; text-align: right; font-size: 18px; border-top: 1px solid #eee; padding-top: 10px; }
.invoice-notes {
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
  padding: 10px;
  border-radius: 8px;
  background: #f8f8f8;
  margin: 12px 0;
}

/* ── Auth form ─────────────────────────────────────────────── */
.auth-form label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; }
.auth-form input,
.auth-form select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 10px;
  border: none;
  background: #f4f4f4;
  margin-bottom: 16px;
  font-size: 14px;
  transition: background 0.15s ease;
}
.auth-form input:focus { outline: none; background: #ebebeb; }

/* ── Buttons ───────────────────────────────────────────────── */
.primary-btn {
  background: #1e7f5c;
  color: #fff;
  border: none;
  padding: 14px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.primary-btn:hover {
  background: #166b4d;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(30,127,92,0.3);
}
.primary-btn:active { transform: translateY(0); box-shadow: none; }
.primary-btn.full  { width: 100%; }

/* ── Customers ─────────────────────────────────────────────── */
.customers-page { padding: 0; }
#customerTable .invoice-row,
.customer-head { grid-template-columns: repeat(5, 1fr); }
.customer-empty,
.invoice-empty { text-align: center; padding: 40px 10px; color: #888; display: none; }
.actions { display: flex; gap: 8px; }

/* ── Settings ──────────────────────────────────────────────── */
.settings-card {
  background: #fff;
  border-radius: 14px;
  padding: 2rem;
  max-width: 700px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s ease;
  animation: fadeInUp 0.3s ease both;
}
.settings-card:hover { box-shadow: 0 14px 32px rgba(0,0,0,0.09); }
.settings-card h2 { margin-bottom: 0.2rem; }
.subtext { color: #6b7280; font-size: 0.9rem; margin-bottom: 1.5rem; }
.form-group { display: flex; flex-direction: column; margin-bottom: 1.3rem; }
.form-group label { font-weight: 500; margin-bottom: 0.4rem; }
.form-group input,
.form-group textarea {
  padding: 0.75rem;
  border-radius: 8px;
  border: none;
  background: #f5f5f5;
  font-size: 0.95rem;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  background: #ebebeb;
  box-shadow: 0 0 0 3px rgba(30,127,92,0.12);
}
.form-group textarea { resize: none; min-height: 90px; }
.logo-upload { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.logo-preview {
  width: 120px; height: 120px; border-radius: 10px;
  background: #f5f5f5; display: flex; align-items: center;
  justify-content: center; overflow: hidden; font-size: 0.8rem; color: #6b7280;
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-btn {
  padding: 0.6rem 1rem; border-radius: 8px; border: none;
  background: #e5e7eb; cursor: pointer;
  transition: background 0.2s ease;
}
.upload-btn:hover { background: #d1d5db; }
.save-btn {
  margin-top: 1rem; padding: 0.8rem 1.4rem; border-radius: 25px;
  border: none; background: #1f8a5c; color: #fff; font-weight: 500; cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.save-btn:hover {
  background: #166b4d;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(30,127,92,0.3);
}
.settings-tabs { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
.tab {
  background: #e5e7eb; border: none; padding: 0.6rem 1.2rem;
  border-radius: 20px; cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.tab:hover { background: #d1d5db; transform: translateY(-1px); }
.tab.active { background: #1f8a5c; color: #fff; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeInUp 0.25s ease; }

/* ══════════════════════════════════════════════════════════
   TABLET / iPAD  769px – 1024px
══════════════════════════════════════════════════════════ */
@media (min-width: 769px) and (max-width: 1024px) {

  /* Sidebar — slide in like mobile */
  .sidebar-toggle { display: flex; }
  .sidebar-close  { display: flex; }

  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    width: 260px;
    z-index: 500;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 16px);
  }
  .sidebar.open { transform: translateX(0); }

  .content { padding: 20px 24px 40px; width: 100%; }

  /* Stats grid — 2 columns on iPad */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .stats-wide { grid-template-columns: 1fr 1fr; gap: 16px; }

  /* Banner */
  #subscriptionBanner { padding: 10px 20px 10px 74px; }

  /* Invoice table — scrollable like mobile */
  .invoice-card { overflow-x: auto; overflow-y: visible; }
  .invoice-head, .customer-head, #expenseHead { font-size: 12px; }

  #invoiceBody .invoice-row {
    font-size: 12px;
    padding: 12px 10px;
    min-width: unset;
  }

  /* Customer table */
  #customerTable .invoice-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr 0.4fr;
    font-size: 13px;
    padding: 13px 10px;
  }

  /* Invoice + customer head hidden on iPad too */
  .invoice-head, .customer-head { display: none; }

  /* Modals — wider on iPad */
  .modal { max-width: 560px; }
  .invoice-modal { max-width: 680px; }

  /* Settings */
  .settings-card { padding: 1.5rem; }
}

/* ══════════════════════════════════════════════════════════
   MOBILE ≤ 768px
══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  .sidebar-toggle { display: flex; }
  .sidebar-close  { display: flex; }

  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    width: 260px;
    z-index: 500;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 16px);
  }
  .sidebar.open { transform: translateX(0); }

  #subscriptionBanner { padding: 10px 16px 10px 62px; }

  .content { padding: 16px 16px 24px; width: 100%; }

  .stats-grid   { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card    { padding: 16px; }
  .stat-card h2 { font-size: 20px; }
  .stats-wide   { grid-template-columns: 1fr; gap: 12px; }
  .page-header h1 { font-size: 22px; }

  .modal {
    width: calc(100% - 20px);
    max-width: 100%;
    max-height: 88vh;
    padding: 20px;
    border-radius: 16px;
  }
  .invoice-modal { width: calc(100% - 20px); max-width: 100%; }

  .settings-card { padding: 1.2rem; }
  .logo-upload   { flex-direction: column; align-items: flex-start; }
  .invoices-header { flex-direction: column; align-items: flex-start; }
  .invoice-search input { max-width: 100%; }

  .invoice-head,
  .customer-head,
  #expenseHead { display: none; }

  .invoice-card { padding: 10px; overflow-x: auto; overflow-y: visible; }
  .invoice-head { display: none; }

  #invoiceBody .invoice-row {
    display: grid;
    grid-template-columns: 1fr 1.2fr 0.8fr 0.8fr 0.8fr 0.4fr;
    padding: 12px 8px;
    font-size: 11px;
    align-items: center;
    min-width: unset;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 0;
  }
  #invoiceBody .invoice-row:hover { background: #f8fffe; border-radius: 0; }
  #invoiceBody .invoice-row > span:nth-child(1) { font-size:10px; color:#1e7f5c; font-weight:600; }
  #invoiceBody .invoice-row > span:nth-child(2) { font-size:11px; font-weight:600; color:#0f172a; }
  #invoiceBody .invoice-row > span:nth-child(3) { font-size:10px; }
  #invoiceBody .invoice-row > span:nth-child(4) { font-size:10px; color:#888; }
  #invoiceBody .invoice-row > span:nth-child(5) { font-size:10px; }
  #invoiceBody .invoice-row .action-menu        { justify-self: end; position: relative; }

  #customerTable .invoice-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 0.4fr;
    padding: 12px 8px;
    font-size: 12px;
    align-items: center;
    min-width: unset;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 0;
    gap: 0;
  }
  #customerTable .invoice-row > span:nth-child(1) { font-size:12px; font-weight:600; color:#0f172a; }
  #customerTable .invoice-row > span:nth-child(2) { font-size:11px; color:#666; }
  #customerTable .invoice-row > span:nth-child(3) { font-size:11px; color:#888; }
  #customerTable .invoice-row > span:nth-child(4) { font-size:11px; color:#aaa; display:none; }
  #customerTable .invoice-row .action-menu        { justify-self: end; position: relative; }

  #expenseBody .invoice-row {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr 0.8fr 0.4fr;
    padding: 12px 8px;
    font-size: 12px;
    align-items: center;
    min-width: unset;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 0;
  }
  #expenseBody .invoice-row > span:nth-child(1) { font-size:12px; font-weight:600; color:#0f172a; }
  #expenseBody .invoice-row > span:nth-child(2) { font-size:11px; }
  #expenseBody .invoice-row > span:nth-child(3) { font-size:11px; font-weight:600; color:#dc2626; }
  #expenseBody .invoice-row > span:nth-child(4) { display:none; }
  #expenseBody .invoice-row .action-menu        { justify-self: end; position: relative; }
}

@media (max-width: 400px) {
  .stats-grid   { grid-template-columns: 1fr; }
  .stat-card h2 { font-size: 18px; }
}

/* ── Invoice review modal — mobile layout ────────────────────── */
@media (max-width: 600px) {
  .invoice-review-card {
    padding: 16px;
  }

  /* Header: biz info left, invoice meta right — side by side */
  .invoice-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
  }

  .biz-info {
    max-width: 100%;
  }

  .biz-logo {
    width: 40px;
    height: 40px;
    margin-bottom: 6px;
  }

  .biz-info h1 { font-size: 14px; margin-bottom: 2px; }
  .biz-info p  { font-size: 11px; }

  /* Invoice meta — right aligned */
  .invoice-meta {
    text-align: right;
    font-size: 12px;
  }
  .invoice-meta p { margin-bottom: 3px; }

  /* Items table — scrollable */
  .review-items {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .review-items .invoice-row {
    min-width: 360px;
    font-size: 12px;
    padding: 8px 4px;
  }

  /* Summary box — tighter on mobile */
  .invoice-summary-box {
    padding: 12px 14px;
    gap: 8px;
  }
  .summary-row { font-size: 13px; }
  .summary-total { font-size: 15px; }
}