/* ========================================
   Explore Emas — Invoice Generator
   Redesigned: refined gold aesthetic
   ======================================== */

/* --- Design Tokens --- */
:root {
  --gold: #c28f2b;
  --gold-dark: #9a6d15;
  --gold-light: #e8c86a;
  --gold-glow: rgba(194, 143, 43, 0.15);
  --gold-gradient: linear-gradient(135deg, #c28f2b 0%, #a0701a 50%, #8a5e12 100%);
  --gold-gradient-soft: linear-gradient(135deg, #f8e8c8 0%, #fdf3e0 100%);
  --gold-soft: #f5e8d0;

  --gold-shimmer: linear-gradient(
    135deg,
    rgba(194, 143, 43, 0.08) 0%,
    rgba(194, 143, 43, 0.18) 50%,
    rgba(194, 143, 43, 0.08) 100%
  );

  --ink: #1f1a16;
  --ink-secondary: #4a3f37;
  --muted: #8a7e72;
  --line: #e4d6c4;
  --line-gold: #dcc49a;

  --paper: #fffcf7;
  --wash: #f6f1ea;
  --wash-warm: #faf6ef;

  --brown: #6b4426;
  --brown-soft: #8b6b4a;

  --green: #3ba34a;
  --green-soft: #e6f4e6;
  --red: #c93b37;
  --red-soft: #fdeeec;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(103, 70, 32, 0.06);
  --shadow: 0 4px 20px rgba(103, 70, 32, 0.08);
  --shadow-lg: 0 12px 48px rgba(103, 70, 32, 0.12);
  --shadow-glow: 0 4px 20px rgba(194, 143, 43, 0.2);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --transition: 200ms var(--ease-out);
  --transition-slow: 400ms var(--ease-out);
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --gold: #d4a43a;
  --gold-dark: #e8c86a;
  --gold-light: #f0d88a;
  --gold-glow: rgba(212, 164, 58, 0.2);
  --gold-gradient: linear-gradient(135deg, #d4a43a 0%, #b8892e 50%, #a0701a 100%);
  --gold-gradient-soft: linear-gradient(135deg, #2a241d 0%, #332c24 100%);
  --gold-soft: #2a241d;
  --gold-shimmer: linear-gradient(135deg, rgba(212, 164, 58, 0.06) 0%, rgba(212, 164, 58, 0.15) 50%, rgba(212, 164, 58, 0.06) 100%);
  --ink: #f0e8de;
  --ink-secondary: #c4b8a8;
  --muted: #8a7e72;
  --line: #3a332b;
  --line-gold: #5a4a32;
  --paper: #1e1a16;
  --wash: #25201a;
  --wash-warm: #2a241d;
  --brown: #c4a882;
  --brown-soft: #a0805a;
  --green: #4cc85a;
  --green-soft: #1a2e1d;
  --red: #e8605b;
  --red-soft: #2e1a1a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 4px 20px rgba(212, 164, 58, 0.15);
}
[data-theme="dark"] .topbar { background: rgba(30, 26, 22, 0.92); border-bottom-color: var(--line); }
[data-theme="dark"] .login-screen { background: #16130f; }
[data-theme="dark"] .login-card { background: var(--paper); border-color: var(--line); }
[data-theme="dark"] .gold-invoice { background: #16130f; border-color: #5a4a32; }
[data-theme="dark"] .gold-invoice::before { opacity: 0.12; }
[data-theme="dark"] .gold-invoice::after { opacity: 0.05; }
[data-theme="dark"] .gold-invoice .invoice-logo strong { color: #d4a43a; }
[data-theme="dark"] .gold-invoice .invoice-logo .logo-sub { color: #d4a43a; }
[data-theme="dark"] .gold-invoice .invoice-logo em { color: #8a7e72; }
[data-theme="dark"] .gold-invoice .invoice-logo .brand-mark { box-shadow: 0 4px 20px rgba(212, 164, 58, 0.25); }
[data-theme="dark"] .gold-invoice .invoice-meta h2 { color: #d4a43a; }
[data-theme="dark"] .gold-invoice .invoice-number-box { background: rgba(212, 164, 58, 0.08); border-color: #5a4a32; color: #d4a43a; }
[data-theme="dark"] .gold-invoice .meta-line span { color: #8a7e72; }
[data-theme="dark"] .gold-invoice .meta-line strong { color: #f0e8de; }
[data-theme="dark"] .gold-invoice .meta-line b { color: #5a4a32; }
[data-theme="dark"] .gold-invoice .info-line span { color: #8a7e72; }
[data-theme="dark"] .gold-invoice .info-line b { color: #5a4a32; }
[data-theme="dark"] .gold-invoice .info-line span:last-child { color: #f0e8de; }
[data-theme="dark"] .gold-invoice .section-label { color: #d4a43a; }
[data-theme="dark"] .gold-invoice .label-icon { background: linear-gradient(135deg, #8a6a2a 0%, #6d5120 100%); }
[data-theme="dark"] .gold-invoice .client-name { color: #f0e8de; font-weight: 700; }
[data-theme="dark"] .gold-invoice .client-address { color: #c4b8a8; }
[data-theme="dark"] .gold-invoice .muted { color: #8a7e72; }
[data-theme="dark"] .gold-invoice .gold-table { border-color: #3a332b; }
[data-theme="dark"] .gold-invoice .gold-table table { background: rgba(0, 0, 0, 0.2); }
[data-theme="dark"] .gold-invoice .gold-table th { background: linear-gradient(135deg, #6d5120 0%, #5a4420 100%); color: #f0e8de; }
[data-theme="dark"] .gold-invoice .gold-table td { border-bottom-color: #2a241d; color: #e0d8cc; }
[data-theme="dark"] .gold-invoice .gold-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .gold-invoice .gold-table tbody tr:hover { background: rgba(212, 164, 58, 0.06); }
[data-theme="dark"] .gold-invoice .summary-box { background: #1a1612; border-color: #3a332b; }
[data-theme="dark"] .gold-invoice .summary-total { background: linear-gradient(135deg, #6d5120 0%, #5a4420 100%); }
[data-theme="dark"] .gold-invoice .summary-total span { color: #c4b8a8; }
[data-theme="dark"] .gold-invoice .summary-total strong { color: #f0e8de; }
[data-theme="dark"] .gold-invoice .total-line { color: #c4b8a8; }
[data-theme="dark"] .gold-invoice .total-line strong { color: #f0e8de; }
[data-theme="dark"] .gold-invoice .total-line b { color: #3a332b; }
[data-theme="dark"] .gold-invoice .summary-note { color: #8a7e72; }
[data-theme="dark"] .gold-invoice .guarantee { border-color: #2a241d; }
[data-theme="dark"] .gold-invoice .guarantee-text { color: #c4b8a8; }
[data-theme="dark"] .gold-invoice .thanks-text { color: #c4b8a8; }
[data-theme="dark"] .gold-invoice .footer-line { border-top-color: #3a332b; }
[data-theme="dark"] .gold-invoice .footer-item { color: #c4b8a8; }
[data-theme="dark"] .gold-invoice .footer-item span:first-child { color: #d4a43a; }
[data-theme="dark"] .gold-invoice .footer-item + .footer-item { border-left-color: #3a332b; }
[data-theme="dark"] .gold-invoice h2 { color: #f0e8de; }
[data-theme="dark"] .gold-invoice .invoice-top { border-bottom-color: #3a332b; }
[data-theme="dark"] .gold-invoice .invoice-logo { border-right-color: #3a332b; }
[data-theme="dark"] .gold-invoice .invoice-info-grid > div + div { border-left-color: #3a332b; }
[data-theme="dark"] input, [data-theme="dark"] textarea { background: #16130f; border-color: var(--line); }
[data-theme="dark"] .stat-card { background: var(--paper); border-color: var(--line); }
[data-theme="dark"] .table-panel { background: var(--paper); border-color: var(--line); }
[data-theme="dark"] .filter-panel { background: var(--paper); border-color: var(--line); }
[data-theme="dark"] .form-card { background: var(--paper); border-color: var(--line); }
[data-theme="dark"] .item-row { background: var(--wash-warm); border-color: var(--line); }
[data-theme="dark"] .modal-box { background: var(--paper); border-color: var(--line); }
[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, 0.7); }
[data-theme="dark"] .toast { background: #2a241d; border-color: var(--line); box-shadow: var(--shadow-lg); }
[data-theme="dark"] .count-badge { background: var(--wash); }
[data-theme="dark"] .nav-btn { background: #201c17; border-color: #3a332b; color: #c4b8a8; }
[data-theme="dark"] .nav-btn:hover { border-color: #d4a43a; color: #d4a43a; background: rgba(212, 164, 58, 0.08); box-shadow: 0 4px 12px rgba(212, 164, 58, 0.15); }
[data-theme="dark"] .nav-btn:disabled { opacity: 0.25; background: #16130f; border-color: #2a241d; color: #5a524a; }
[data-theme="dark"] .btn-icon-only { background: #201c17; border-color: #3a332b; color: #8a7e72; }
[data-theme="dark"] .btn-icon-only:hover { border-color: #d4a43a; color: #d4a43a; background: rgba(212, 164, 58, 0.08); }
[data-theme="dark"] .btn-icon-only.danger:hover { border-color: #e8605b; color: #e8605b; background: rgba(232, 96, 91, 0.08); }
[data-theme="dark"] .btn-icon-only.wa:hover { border-color: #25D366; color: #25D366; background: rgba(37, 211, 102, 0.08); }
[data-theme="dark"] .btn-toggle { color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
[data-theme="dark"] .btn-toggle.green { background: linear-gradient(135deg, #3ba34a, #2d8a3a); }
[data-theme="dark"] .btn-toggle.red { background: linear-gradient(135deg, #c93b37, #b02e2a); }
[data-theme="dark"] .btn-toggle:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
[data-theme="dark"] .search-input { background: #16130f; }
[data-theme="dark"] .pagination-bar { border-top-color: var(--line); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3a332b; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #4a423a; }
[data-theme="dark"] .primary-button { color: #fff; }
[data-theme="dark"] .ghost-button { border-color: var(--line); color: var(--ink-secondary); }
[data-theme="dark"] .ghost-button:hover { border-color: var(--gold); color: var(--gold); background: rgba(212, 164, 58, 0.06); }
[data-theme="dark"] .outline-button { border-color: var(--line); color: var(--ink-secondary); background: transparent; }
[data-theme="dark"] .outline-button:hover { border-color: var(--gold); color: var(--gold); background: rgba(212, 164, 58, 0.06); }
[data-theme="dark"] .text-button { color: var(--muted); }
[data-theme="dark"] .text-button:hover { color: var(--gold); }
[data-theme="dark"] .back-link { color: var(--muted); }
[data-theme="dark"] .back-link:hover { color: var(--gold); }
[data-theme="dark"] .status-pill { background: #2a241d; color: #e8605b; border-color: rgba(232, 96, 91, 0.2); }
[data-theme="dark"] .status-pill::before { background: #e8605b; }
[data-theme="dark"] .status-pill.paid { background: #1a2e1d; color: #4cc85a; border-color: rgba(76, 200, 90, 0.2); }
[data-theme="dark"] .status-pill.paid::before { background: #4cc85a; }
[data-theme="dark"] .stat-icon.brown { background: #2a241d; color: #d4a43a; }
[data-theme="dark"] table th { color: var(--ink-secondary); border-bottom-color: var(--line); }
[data-theme="dark"] table td { color: var(--ink); border-bottom-color: var(--line); }
[data-theme="dark"] table tbody tr:hover { background: rgba(212, 164, 58, 0.04); }
[data-theme="dark"] .empty-state { color: var(--muted); }
[data-theme="dark"] .empty-state-icon { opacity: 0.2; }
[data-theme="dark"] .page-info { color: var(--muted); }
[data-theme="dark"] .hero-row h1 { color: var(--ink); }
[data-theme="dark"] .hero-row h1 em { color: var(--gold); }
[data-theme="dark"] .hero-row .muted { color: var(--muted); }
[data-theme="dark"] .eyebrow { color: var(--muted); }
[data-theme="dark"] .form-card h2 { color: var(--ink); }
[data-theme="dark"] .form-total { background: var(--wash-warm); border-color: var(--line-gold); }
[data-theme="dark"] .form-total .total-label span:first-child { color: var(--ink-secondary); }
[data-theme="dark"] .form-total .total-value .total-amount { color: var(--gold); }
[data-theme="dark"] .stat-label { color: var(--muted); }
[data-theme="dark"] .stat-value { color: var(--ink); }
[data-theme="dark"] .stat-sub { color: var(--muted); }
[data-theme="dark"] .stat-chart { background: var(--wash); }
[data-theme="dark"] .stat-breakdown { border-top-color: rgba(255,255,255,0.06); }
[data-theme="dark"] select { background: #16130f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a7e72' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center; }
[data-theme="dark"] .toast.error { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.toast-undo-btn {
  background: var(--gold-gradient);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  margin-left: auto;
  min-height: 30px;
  padding: 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: opacity 180ms;
  flex-shrink: 0;
}
.toast-undo-btn:hover {
  opacity: 0.85;
}
[data-theme="dark"] .toast.success { background: var(--green-soft); border-color: var(--green); color: var(--green); }
[data-theme="dark"] .modal-header h2 { color: var(--ink); }
[data-theme="dark"] .modal-body { color: var(--ink-secondary); }
[data-theme="dark"] .share-header { border-bottom-color: var(--line); }
[data-theme="dark"] .invoice-skeleton .skel-line { background: linear-gradient(90deg, #2a241d 25%, #332c24 50%, #2a241d 75%); background-size: 200% 100%; }
[data-theme="dark"] .item-row input[readonly] { background: #16130f; color: var(--muted); }
[data-theme="dark"] .search-clear { color: var(--muted); }
[data-theme="dark"] .password-toggle { color: var(--muted); }
[data-theme="dark"] .password-toggle:hover { color: var(--ink-secondary); }
[data-theme="dark"] #dbGuide { background: var(--wash-warm); border-color: var(--line); }
[data-theme="dark"] .login-error { color: var(--red); }
[data-theme="dark"] select option { background: #1e1a16; color: var(--ink); }
[data-theme="dark"] .btn-icon-only::after { background: #2a241d; color: #f0e8de; border: 1px solid #3a332b; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
[data-theme="dark"] .btn-toggle { box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
[data-theme="dark"] .btn-toggle:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
[data-theme="dark"] .gold-invoice .summary-lines { background: rgba(0,0,0,0.3); }
[data-theme="dark"] .gold-invoice .summary-lines .total-line { border-bottom-color: #2a241d; }
[data-theme="dark"] .gold-invoice .summary-total span { color: #e0d8cc; }
[data-theme="dark"] .gold-invoice .summary-total strong { color: #fff; }
[data-theme="dark"] .gold-invoice .summary-box { box-shadow: 0 0 0 1px #3a332b inset; }
[data-theme="dark"] .gold-invoice .summary-note { border-top-color: #2a241d; }

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

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #d4c8b8;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: #bfb0a0;
}

/* ========================================
   Topbar / Navigation
   ======================================== */
.topbar {
  align-items: center;
  background: rgba(255, 252, 247, 0.88);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 76px;
  padding: 0 clamp(16px, 6vw, 120px);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  transition: opacity var(--transition);
}
.brand:hover {
  opacity: 0.85;
}

.brand-name {
  display: grid;
  line-height: 1;
  gap: 1px;
}

.brand-name strong {
  color: var(--gold-dark);
  font-family: "Cormorant Garamond", serif;
  font-size: 20px;
  letter-spacing: 0.18em;
  font-weight: 700;
}

.brand-name em {
  color: var(--ink-secondary);
  font-size: 9.5px;
  font-style: normal;
  letter-spacing: 0.45em;
  text-transform: uppercase;
}

.brand-mark {
  align-items: center;
  background: var(--gold-gradient);
  border-radius: 10px;
  display: flex;
  height: 34px;
  justify-content: center;
  position: relative;
  width: 34px;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(194, 143, 43, 0.3);
}
.brand:hover .brand-mark {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(194, 143, 43, 0.45);
}
.brand-mark::after {
  content: "E";
  color: #fff;
  font-family: "Cormorant Garamond", serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.top-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ========================================
   Hamburger Menu (Mobile)
   ======================================== */
.hamburger {
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  display: none;
  flex-direction: column;
  gap: 5px;
  height: 44px;
  justify-content: center;
  padding: 0;
  width: 44px;
  z-index: 60;
}
.hamburger-line {
  background: var(--ink-secondary);
  border-radius: 2px;
  display: block;
  height: 2.5px;
  transition: all 260ms var(--ease-out);
  width: 22px;
}
.hamburger.open .hamburger-line:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}
.hamburger.open .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger.open .hamburger-line:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* ========================================
   Sidebar Drawer (Mobile)
   ======================================== */
.sidebar-overlay {
  background: rgba(0, 0, 0, 0.4);
  display: none;
  height: 100%;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 70;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.open {
  display: block;
}

.sidebar {
  background: var(--paper);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 320px;
  position: fixed;
  right: -100%;
  top: 0;
  transition: right 320ms var(--ease-out);
  width: 80vw;
  z-index: 80;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
}
.sidebar.open {
  right: 0;
}

.sidebar-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  padding: 20px 20px 16px;
}
.sidebar-header .brand-mark {
  flex-shrink: 0;
}
.sidebar-title {
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
  flex: 1;
}
.sidebar-close {
  align-items: center;
  background: none;
  border: none;
  color: var(--ink-secondary);
  cursor: pointer;
  display: flex;
  font-size: 28px;
  height: 44px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 44px;
}
.sidebar-close:hover {
  color: var(--ink);
}

.sidebar-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0;
  overflow-y: auto;
  flex: 1;
}
.sidebar-link {
  align-items: center;
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-size: 15px;
  font-weight: 500;
  gap: 12px;
  padding: 14px 20px;
  text-align: left;
  text-decoration: none;
  transition: background 180ms var(--ease-out);
  width: 100%;
}
.sidebar-link i {
  color: var(--gold-dark);
  font-size: 16px;
  width: 20px;
  text-align: center;
}
.sidebar-link:hover {
  background: rgba(194, 143, 43, 0.06);
}
.sidebar-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 8px 20px;
}

[data-theme="dark"] .sidebar { background: #1e1a16; border-left-color: var(--line); }
[data-theme="dark"] .sidebar-close { color: #8a7e72; }
[data-theme="dark"] .sidebar-link:hover { background: rgba(212, 164, 58, 0.06); }
[data-theme="dark"] .sidebar-overlay { background: rgba(0, 0, 0, 0.6); }

/* ========================================
   Buttons
   ======================================== */
.primary-button,
.outline-button,
.ghost-button,
.danger-button,
.success-button,
.text-button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  font-size: 14px;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  transition: transform 180ms var(--ease-out),
              box-shadow 180ms var(--ease-out),
              background 180ms var(--ease-out),
              border-color 180ms var(--ease-out),
              color 180ms var(--ease-out);
  white-space: nowrap;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.primary-button {
  background: var(--gold-gradient);
  color: #fff;
  box-shadow: 0 2px 8px rgba(194, 143, 43, 0.3);
}
.primary-button:hover {
  box-shadow: 0 6px 24px rgba(194, 143, 43, 0.4);
  transform: translateY(-1.5px);
}
.primary-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(194, 143, 43, 0.3);
}

.outline-button {
  background: var(--paper);
  border-color: var(--brown);
  color: var(--brown);
}
.outline-button:hover {
  background: #f8f2ea;
  border-color: var(--gold-dark);
  color: var(--gold-dark);
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-secondary);
}
.ghost-button:hover {
  background: rgba(107, 68, 38, 0.06);
  border-color: var(--muted);
}

.danger-button {
  background: var(--red-soft);
  border-color: #e8b4b2;
  color: var(--red);
}
.danger-button:hover {
  background: #fadcd9;
  border-color: var(--red);
  box-shadow: 0 4px 16px rgba(201, 59, 55, 0.15);
}

.success-button {
  background: var(--green-soft);
  border-color: #a4dbaa;
  color: #2a7a35;
}
.success-button:hover {
  background: #cfeecf;
  border-color: var(--green);
  box-shadow: 0 4px 16px rgba(59, 163, 74, 0.18);
}

.text-button {
  background: transparent;
  border: none;
  color: var(--gold-dark);
  font-weight: 700;
  min-height: auto;
  padding: 4px 8px;
  position: relative;
}
.text-button::after {
  background: var(--gold);
  bottom: 2px;
  content: "";
  height: 2px;
  left: 8px;
  position: absolute;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
  width: calc(100% - 16px);
}
.text-button:hover::after {
  transform: scaleX(1);
}

/* --- Premium Detail Action Buttons --- */
.btn-toggle {
  align-items: center;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  font-size: 14px;
  gap: 8px;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  transition: all 220ms var(--ease-out);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn-toggle .btn-icon {
  align-items: center;
  border-radius: 6px;
  display: flex;
  font-size: 13px;
  height: 24px;
  justify-content: center;
  width: 24px;
  transition: all 220ms var(--ease-out);
}
.btn-toggle.green {
  background: linear-gradient(135deg, #3ba34a 0%, #2d8a3a 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 163, 74, 0.35);
}
.btn-toggle.green .btn-icon {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.btn-toggle.green:hover {
  box-shadow: 0 6px 24px rgba(59, 163, 74, 0.45);
  transform: translateY(-1.5px);
}
.btn-toggle.green:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(59, 163, 74, 0.35);
}
.btn-toggle.red {
  background: linear-gradient(135deg, #c93b37 0%, #b02e2a 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(201, 59, 55, 0.3);
}
.btn-toggle.red .btn-icon {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.btn-toggle.red:hover {
  box-shadow: 0 6px 24px rgba(201, 59, 55, 0.4);
  transform: translateY(-1.5px);
}
.btn-toggle.red:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(201, 59, 55, 0.3);
}

.btn-icon-only {
  align-items: center;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  height: 44px;
  justify-content: center;
  transition: all 220ms var(--ease-out);
  width: 44px;
  position: relative;
}
.btn-icon-only .btn-icon {
  font-size: 18px;
  line-height: 1;
  transition: transform 220ms var(--ease-out);
}
.btn-icon-only:hover {
  border-color: var(--gold);
  background: rgba(194, 143, 43, 0.05);
  box-shadow: 0 4px 16px rgba(194, 143, 43, 0.15);
  transform: translateY(-1px);
}
.btn-icon-only:hover .btn-icon {
  transform: scale(1.1);
}
.btn-icon-only:active {
  transform: scale(0.92) !important;
}
.btn-icon-only.danger:hover {
  border-color: var(--red);
  background: var(--red-soft);
  box-shadow: 0 4px 16px rgba(201, 59, 55, 0.15);
}
.btn-icon-only.danger:hover .btn-icon {
  color: var(--red);
}
.btn-icon-only.wa:hover {
  border-color: #25D366;
  background: rgba(37, 211, 102, 0.06);
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.18);
}
.btn-icon-only.wa:hover .btn-icon {
  color: #25D366;
}

/* Tooltip on hover for icon-only buttons */
.detail-actions {
  position: relative;
  z-index: 5;
}
.btn-icon-only::after {
  background: var(--ink);
  border-radius: 6px;
  color: white;
  content: attr(title);
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  padding: 6px 10px;
  pointer-events: none;
  position: absolute;
  top: calc(100% + 8px);
  transform: translateY(-4px);
  transition: all 180ms var(--ease-out);
  white-space: nowrap;
  z-index: 100;
}
.btn-icon-only:hover::after {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   App Shell
   ======================================== */
.app-shell {
  margin: 0 auto;
  max-width: 1440px;
  padding: 56px clamp(16px, 6vw, 120px) 80px;
  animation: fadeSlideUp 450ms var(--ease-out) both;
}

.page-enter {
  animation: fadeSlideUp 400ms var(--ease-out) both;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   Dashboard — Hero
   ======================================== */
.hero-row {
  align-items: end;
  display: flex;
  gap: 32px;
  justify-content: space-between;
  margin-bottom: 40px;
}

.eyebrow {
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

h1, h2, h3 {
  font-family: "Cormorant Garamond", serif;
  line-height: 1;
  margin: 0;
}

h1 {
  font-size: clamp(36px, 4vw, 54px);
  font-weight: 700;
}

h1 em {
  font-style: italic;
  font-weight: 600;
}

h2 {
  font-size: 26px;
  font-weight: 700;
}

h2 i {
  font-style: italic;
  font-weight: 600;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
  margin: 10px 0 0;
  max-width: 520px;
}

.hero-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ========================================
   Dashboard — Usage / Stats
   ======================================== */
.usage-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  padding: 24px 28px;
  transition: box-shadow var(--transition);
}
.usage-panel:hover {
  box-shadow: var(--shadow-lg);
}

.usage-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}
.usage-title strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-secondary);
}
.usage-title span {
  color: var(--green);
  font-weight: 800;
  font-size: 14px;
}

.usage-track {
  background: #e8e0d6;
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
  position: relative;
}

.usage-track span {
  background: linear-gradient(90deg, var(--gold-light), var(--gold));
  border-radius: inherit;
  display: block;
  height: 100%;
  min-width: 3%;
  transition: width 600ms var(--ease-out);
  position: relative;
}
.usage-track span::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
  border-radius: inherit;
  content: "";
  inset: 0;
  position: absolute;
  width: 50%;
}

/* ========================================
   Dashboard — Stats Cards
   ======================================== */
.stats-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 28px;
}

.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.stat-card.clickable {
  cursor: pointer;
}
.stat-card.clickable:active {
  transform: scale(0.98);
}
.stat-card.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow), var(--shadow);
}

/* Card accent bar */
.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.card-gold::before { background: var(--gold-gradient); }
.stat-card.card-green::before { background: linear-gradient(90deg, #3ba34a, #55ca63); }
.stat-card.card-red::before { background: linear-gradient(90deg, #c93b37, #e8605b); }
.stat-card.card-brown::before { background: linear-gradient(90deg, var(--brown), var(--brown-soft)); }

/* Card header row */
.stat-header {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 0;
  text-transform: uppercase;
}

.stat-icon {
  align-items: center;
  border-radius: 8px;
  display: flex;
  font-size: 16px;
  height: 32px;
  justify-content: center;
  width: 32px;
  flex-shrink: 0;
}
.stat-icon.gold { background: var(--gold-soft); color: var(--gold-dark); }
.stat-icon.green { background: var(--green-soft); color: #2a7a35; }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-icon.brown { background: #efe6dc; color: var(--brown); }

.stat-value {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.stat-value.gold {
  color: var(--gold-dark);
}

/* Mini chart bar inside cards */
.stat-chart {
  height: 6px;
  background: #eee8df;
  border-radius: 99px;
  overflow: hidden;
  display: flex;
}
.stat-chart-bar {
  height: 100%;
  transition: width 500ms var(--ease-out);
}
.stat-chart-bar.green { background: linear-gradient(90deg, #3ba34a, #55ca63); }
.stat-chart-bar.red { background: linear-gradient(90deg, #c93b37, #e8605b); }
.stat-chart-bar:first-child {
  border-radius: 99px 0 0 99px;
}
.stat-chart-bar:last-child {
  border-radius: 0 99px 99px 0;
}

/* Card subtitle */
.stat-sub {
  color: var(--muted);
  font-size: 11px;
  margin: 6px 0 0;
}
.stat-sub.green { color: #2a7a35; }
.stat-sub.red { color: var(--red); }

.stat-breakdown {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.breakdown-line {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.breakdown-line.green { color: #2a7a35; }
.breakdown-line.red { color: var(--red); }

/* ========================================
   Dashboard — Table
   ======================================== */
.table-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.table-panel:hover {
  box-shadow: var(--shadow-lg);
}

.table-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 20px 24px 18px;
}
.table-header h2 {
  font-size: 20px;
}
.table-header .count-badge {
  background: var(--wash);
  border-radius: 99px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
}

.table-header-right {
  align-items: center;
  display: flex;
  gap: 12px;
}
.search-wrap {
  position: relative;
}
.search-icon {
  color: var(--muted);
  font-size: 13px;
  left: 12px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}
.search-input {
  background: var(--wash);
  border: 1.5px solid var(--line);
  border-radius: 99px;
  font-size: 13px;
  min-height: 34px;
  outline: none;
  padding: 0 14px 0 34px;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 200px;
}
.search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.search-input::placeholder {
  color: var(--muted);
}
.search-clear {
  align-items: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: none;
  font-size: 14px;
  height: 100%;
  justify-content: center;
  padding: 0 12px;
  position: absolute;
  right: 0;
  top: 0;
  transition: color var(--transition);
}
.search-clear:hover {
  color: var(--ink-secondary);
}
.search-clear.visible {
  display: flex;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  padding: 18px 24px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  background: var(--wash-warm);
}

td {
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

tbody tr {
  cursor: pointer;
  transition: background 150ms ease;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(194, 143, 43, 0.05);
}

tbody tr:active {
  background: rgba(194, 143, 43, 0.1);
}

/* --- Status Pill --- */
.status-pill {
  align-items: center;
  background: #fdeeec;
  border-radius: 999px;
  color: #c93b37;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 8px;
  min-height: 30px;
  padding: 0 14px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.status-pill::before {
  background: #c93b37;
  border-radius: 50%;
  content: "";
  height: 7px;
  width: 7px;
}

.status-pill.paid {
  background: #dff3df;
  color: #2a7a35;
}

.status-pill.paid::before {
  background: var(--green);
}

/* --- Empty State --- */
.empty-state {
  color: var(--muted);
  padding: 56px 24px;
  text-align: center;
}

.empty-state-icon {
  display: block;
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state strong {
  display: block;
  color: var(--ink-secondary);
  font-size: 16px;
  margin-bottom: 6px;
}

.empty-state span {
  font-size: 14px;
  color: var(--muted);
}

/* ========================================
   Form Pages
   ======================================== */
.narrow-page {
  margin: 0 auto;
  max-width: 820px;
  animation: fadeSlideUp 400ms var(--ease-out) both;
}

.back-link {
  color: var(--muted);
  display: inline-flex;
  font-weight: 700;
  font-size: 13px;
  gap: 8px;
  margin-bottom: 28px;
  transition: color var(--transition);
}
.back-link:hover {
  color: var(--ink-secondary);
}

.back-link::before {
  content: "←";
  font-size: 15px;
}

.page-title {
  margin-bottom: 28px;
}

/* --- Form Layout --- */
.invoice-form {
  display: grid;
  gap: 20px;
}

.form-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px 30px;
  transition: box-shadow var(--transition);
}
.form-card:focus-within {
  box-shadow: var(--shadow);
  border-color: var(--line-gold);
}

.form-card h2 {
  font-size: 20px;
  margin-bottom: 20px;
  color: var(--ink-secondary);
}

.card-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}
.card-heading h2 {
  margin-bottom: 0;
}

/* --- Form Grids --- */
.form-grid {
  display: grid;
  gap: 18px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.span-two {
  grid-column: span 2;
}

/* --- Labels & Inputs --- */
label {
  color: var(--ink-secondary);
  display: grid;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
}

.required {
  color: var(--red);
}

.label-text {
  white-space: nowrap;
}

datalist {
  display: none;
}

input,
textarea,
select {
  background: #fffcf9;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  min-height: 46px;
  outline: none;
  padding: 0 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

textarea {
  min-height: 90px;
  padding: 12px 14px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

input:read-only {
  background: var(--wash);
  color: var(--muted);
  cursor: default;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a7e72' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* --- Items List --- */
.items-list {
  display: grid;
  gap: 12px;
}

.item-row {
  align-items: end;
  background: var(--wash-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(160px, 1.5fr) 80px 100px 130px 130px 40px;
  padding: 16px;
  position: relative;
  transition: border-color var(--transition), box-shadow var(--transition);
  animation: fadeSlideUp 300ms var(--ease-out) both;
}
.item-row:hover {
  border-color: var(--line-gold);
}
.item-row:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.item-row label {
  font-size: 11px;
  gap: 5px;
}

.item-row input {
  min-height: 40px;
  font-size: 13px;
  padding: 0 10px;
}

.item-row input[readonly] {
  background: var(--wash);
  color: var(--ink-secondary);
  cursor: default;
}

.remove-item {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-size: 16px;
  font-weight: 700;
  height: 40px;
  justify-content: center;
  margin-bottom: 0;
  transition: all var(--transition);
  width: 40px;
}
.remove-item:hover {
  background: var(--red-soft);
  border-color: #e8b4b2;
  color: var(--red);
}

.subtotal-field {
  color: var(--gold-dark);
  font-size: 13px;
  font-weight: 800;
  margin-top: 4px;
  min-height: 24px;
  text-align: right;
  grid-column: 1 / -1;
  padding-right: 52px;
}

/* --- Form Total --- */
.input-with-icon {
  position: relative;
}
.input-with-icon .input-icon {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  font-weight: 700;
  height: 100%;
  padding: 0 0 0 14px;
  pointer-events: none;
  position: absolute;
  top: 0;
}
.input-with-icon input {
  padding-left: 36px;
}

.form-total {
  align-items: center;
  background: linear-gradient(135deg, #faf6ef 0%, #fdf8f2 100%);
  border: 1.5px solid var(--line-gold);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding: 16px 22px;
  position: relative;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-total::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: var(--radius);
  background: var(--gold-gradient);
  opacity: 0.08;
  pointer-events: none;
}

.form-total .total-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.form-total .total-label span:first-child {
  color: var(--ink-secondary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.form-total .total-label .item-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.form-total .total-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.form-total .total-value .total-amount {
  font-family: "Cormorant Garamond", serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--gold-dark);
  line-height: 1;
  letter-spacing: 0.01em;
}
.form-total .total-value .total-label-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.form-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* --- Detail Nav Buttons --- */
.detail-nav {
  align-items: center;
  display: flex;
  gap: 6px;
}
.nav-btn {
  align-items: center;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-size: 16px;
  height: 36px;
  justify-content: center;
  transition: all 200ms var(--ease-out);
  width: 36px;
}
.nav-btn:hover:not(:disabled) {
  border-color: var(--gold);
  background: rgba(194, 143, 43, 0.05);
  box-shadow: 0 4px 12px rgba(194, 143, 43, 0.12);
  transform: translateY(-1px);
}
.nav-btn:active:not(:disabled) {
  transform: scale(0.93);
}
.nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ========================================
   Detail Page
   ======================================== */
.detail-page {
  margin: 0 auto;
  max-width: 1140px;
  animation: fadeSlideUp 400ms var(--ease-out) both;
}

.detail-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.detail-title {
  align-items: end;
  display: flex;
  justify-content: space-between;
  gap: 26px;
  margin-bottom: 28px;
}

.detail-title h1 {
  font-size: clamp(28px, 3vw, 40px);
}

.detail-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ========================================
   Invoice Preview (Gold Invoice)
   ======================================== */
.gold-invoice {
  background:
    radial-gradient(circle at 94% 96%, rgba(194, 143, 43, 0.28) 0%, transparent 20%),
    linear-gradient(135deg, #ffffff 0%, #fffcf7 50%, #fff8e8 100%);
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(90, 58, 20, 0.14);
  overflow: hidden;
  padding: clamp(24px, 3.5vw, 48px);
  position: relative;
}

.gold-invoice::before {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 40%, var(--gold) 100%);
  border-radius: 100% 0 0 0;
  bottom: -1px;
  content: "";
  height: 120px;
  position: absolute;
  right: -1px;
  width: 300px;
  z-index: 0;
  opacity: 0.85;
}

.gold-invoice::after {
  background: var(--gold-shimmer);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 0;
}

.invoice-content {
  position: relative;
  z-index: 1;
}

/* --- Invoice Top --- */
.invoice-top {
  align-items: center;
  border-bottom: 2px solid var(--line-gold);
  display: grid;
  gap: 30px;
  grid-template-columns: 1.1fr 0.9fr;
  padding-bottom: 24px;
}

.invoice-logo {
  align-items: center;
  border-right: 2px solid var(--line-gold);
  display: flex;
  gap: 24px;
  min-height: 120px;
}

.invoice-logo .brand-mark {
  height: 72px;
  width: 72px;
  border-radius: 18px;
  box-shadow: 0 4px 20px rgba(194, 143, 43, 0.35);
  flex-shrink: 0;
}
.invoice-logo .brand-mark::after {
  font-size: 42px;
}

.invoice-logo strong {
  color: var(--gold-dark);
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(30px, 4vw, 52px);
  letter-spacing: 0.18em;
  line-height: 0.85;
  text-transform: uppercase;
}

.invoice-logo .logo-sub {
  color: var(--gold-dark);
  display: block;
  font-size: 18px;
  letter-spacing: 0.55em;
  margin: 10px 0;
  text-transform: uppercase;
}

.invoice-logo em {
  font-style: normal;
  letter-spacing: 0.25em;
  font-size: 13px;
  color: var(--muted);
}

/* --- Invoice Meta --- */
.invoice-meta {
  justify-self: end;
  max-width: 360px;
  width: 100%;
}

.invoice-meta h2 {
  color: var(--gold-dark);
  font-size: clamp(48px, 6vw, 76px);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: right;
  line-height: 0.9;
  margin-bottom: 12px;
}

.invoice-number-box {
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  margin: 8px 0 18px;
  padding: 8px 16px;
  text-align: center;
  color: var(--gold-dark);
  background: rgba(248, 234, 200, 0.3);
}

/* --- Meta / Info Lines --- */
.meta-lines {
  display: grid;
  gap: 8px;
}

.meta-line,
.info-line,
.total-line {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  font-size: 14px;
}

.meta-line span,
.info-line span {
  color: var(--muted);
}

.meta-line strong,
.info-line strong {
  color: var(--ink);
}

/* --- Invoice Info Grid --- */
.invoice-info-grid {
  display: block;
  padding: 24px 0;
}

.section-label {
  align-items: center;
  color: var(--gold-dark);
  display: flex;
  font-weight: 800;
  font-size: 12px;
  gap: 10px;
  letter-spacing: 0.06em;
  margin: 0 0 16px;
  text-transform: uppercase;
}

.label-icon {
  align-items: center;
  background: var(--gold-gradient);
  border-radius: 50%;
  color: white;
  display: inline-flex;
  font-size: 12px;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.client-name {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 6px;
}

.client-address {
  line-height: 1.55;
  margin: 0;
  white-space: pre-line;
  color: var(--ink-secondary);
}

/* --- Invoice Body Grid --- */
.invoice-body-grid {
  align-items: start;
  display: grid;
  gap: 30px;
  grid-template-columns: minmax(0, 1fr) 340px;
}

/* --- Gold Table --- */
.gold-table {
  border: 1px solid var(--line-gold);
  border-radius: var(--radius);
  overflow: hidden;
}

.gold-table table {
  background: rgba(255, 255, 255, 0.6);
}

.gold-table th {
  background: var(--gold-gradient);
  color: white;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 14px 16px;
  text-align: center;
}

.gold-table td {
  border-color: var(--line-gold);
  font-weight: 500;
  font-size: 13px;
  padding: 13px 16px;
}

.gold-table td:first-child,
.gold-table td:nth-child(3),
.gold-table td:nth-child(4),
.gold-table td:nth-child(5) {
  text-align: center;
}

/* --- Summary Box --- */
.summary-box {
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  overflow: hidden;
}

.summary-lines {
  background: rgba(255, 255, 255, 0.72);
  padding: 18px 20px;
}

.summary-lines .total-line {
  border-bottom: 1px solid var(--line-gold);
  padding: 12px 0;
  font-size: 13px;
}

.summary-lines .total-line:first-child {
  padding-top: 0;
}

.summary-lines .total-line:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.summary-total {
  align-items: center;
  background: var(--gold-gradient);
  color: white;
  display: flex;
  justify-content: space-between;
  padding: 16px 22px;
}

.summary-total span {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.summary-total strong {
  font-family: "Cormorant Garamond", serif;
  font-size: 28px;
}

.summary-note {
  background: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
  padding: 14px 20px 18px;
  color: var(--muted);
  font-style: italic;
}

/* --- Invoice Bottom (Guarantee & Thanks) --- */
.invoice-bottom {
  align-items: stretch;
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr 1fr;
  margin: 18px 0 22px;
}

.guarantee,
.thanks {
  border: 1px solid var(--line-gold);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.guarantee-text,
.thanks-text {
  line-height: 1.55;
  margin: 0;
  font-size: 13px;
  color: var(--ink-secondary);
}

/* --- Footer --- */
.footer-line {
  border-top: 2px solid var(--line-gold);
  display: flex;
  gap: 0;
  padding-top: 16px;
}

.footer-item + .footer-item {
  border-left: 1.5px solid var(--line-gold);
  padding-left: 18px;
  margin-left: 18px;
}

.footer-item {
  align-items: center;
  color: var(--ink-secondary);
  display: flex;
  gap: 10px;
  font-size: 13px;
  min-width: 0;
}

.footer-item span:first-child {
  color: var(--gold-dark);
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  left: 50%;
  pointer-events: none;
  position: fixed;
  transform: translateX(-50%);
  z-index: 9999;
}

.toast {
  align-items: center;
  background: var(--ink);
  border-radius: var(--radius);
  color: white;
  display: flex;
  font-size: 14px;
  font-weight: 600;
  gap: 10px;
  max-width: 400px;
  min-width: 280px;
  padding: 14px 20px;
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  animation: toastIn 350ms var(--ease-out) both;
}

.toast.toast-out {
  animation: toastOut 300ms var(--ease-in) both;
}

.toast.toast-success {
  background: #2a7a35;
}

.toast.toast-error {
  background: var(--red);
}

.toast-msg {
  flex: 1;
  min-width: 0;
}
.toast-icon {
  flex-shrink: 0;
  font-size: 18px;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
}

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
  align-items: center;
  background: rgba(31, 26, 22, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 0;
  padding: 24px;
  position: fixed;
  transition: opacity 250ms ease;
  z-index: 100;
}
.modal-overlay.open {
  opacity: 1;
}

.modal-box {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(31, 26, 22, 0.25);
  max-width: 420px;
  padding: 32px;
  transform: scale(0.92) translateY(8px);
  transition: transform 300ms var(--ease-out);
  width: 100%;
}
.modal-overlay.open .modal-box {
  transform: scale(1) translateY(0);
}

.modal-icon {
  align-items: center;
  background: var(--red-soft);
  border-radius: 50%;
  color: var(--red);
  display: flex;
  font-size: 24px;
  height: 52px;
  justify-content: center;
  margin-bottom: 18px;
  width: 52px;
}

.modal-box h3 {
  font-family: "Cormorant Garamond", serif;
  font-size: 24px;
  margin: 0 0 8px;
  color: var(--ink);
}

.modal-box p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 24px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-actions .ghost-button,
.modal-actions .danger-button {
  min-height: 42px;
  font-size: 13px;
}

/* ========================================
   Responsive — Tablet
   ======================================== */
@media (max-width: 1024px) {
  .invoice-body-grid {
    grid-template-columns: 1fr;
  }

  .summary-box {
    max-width: 400px;
  }
}

@media (max-width: 900px) {
  .topbar,
  .app-shell {
    padding-left: 20px;
    padding-right: 20px;
  }

  .hero-row,
  .detail-header {
    flex-wrap: wrap;
    gap: 12px;
  }
  .detail-title,
  .invoice-top,
  .invoice-info-grid,
  .invoice-bottom {
    grid-template-columns: 1fr;
  }

  .hero-row,
  .detail-title {
    align-items: start;
    display: grid;
    gap: 20px;
  }

  .invoice-logo,
  .invoice-info-grid {
    padding: 16px 0;
  }

  .invoice-logo {
    border-bottom: 2px solid var(--line-gold);
    padding-bottom: 20px;
  }

  .invoice-meta,
  .invoice-meta h2 {
    justify-self: stretch;
    text-align: left;
  }

  .form-grid.two,
  .form-grid.three {
    grid-template-columns: 1fr;
  }

  .span-two {
    grid-column: auto;
  }

  .subtotal-field {
    text-align: left;
  }

  .item-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .item-row > label:nth-child(1) {
    grid-column: 1 / -1;
  }
  .item-row > .remove-item {
    position: absolute;
    right: 8px;
    top: 8px;
  }
  .subtotal-field {
    grid-column: 1 / -1;
    padding-right: 0;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
   Responsive — Mobile
   ======================================== */
@media (max-width: 640px) {
  .topbar {
    align-items: center;
    flex-direction: row;
    gap: 0;
    padding: 14px 16px;
    min-height: auto;
  }
  .topbar .brand {
    flex: 1;
  }
  .topbar .brand-name em {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .top-actions {
    display: none;
  }

  th, td {
    padding: 14px 16px;
  }

  th {
    font-size: 11px;
  }
  td {
    font-size: 13px;
  }

  .form-card {
    padding: 20px;
  }

  .invoice-logo {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .item-row {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .item-row > label:nth-child(1) {
    grid-column: auto;
  }

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

  .table-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .table-header-right {
    width: 100%;
  }
  .search-wrap {
    flex: 1;
  }
  .search-input {
    width: 100%;
  }

  .modal-box {
    padding: 24px;
  }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
  body {
    background: white;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .topbar,
  .detail-header,
  .detail-title,
  .back-link,
  .detail-actions,
  .toast-container,
  .modal-overlay {
    display: none !important;
  }

  .app-shell {
    max-width: none;
    padding: 0;
  }

  .gold-invoice {
    border: 0;
    box-shadow: none;
    border-radius: 0;
    min-height: 100vh;
    padding: 20px 30px;
  }

  .gold-invoice::before {
    display: none;
  }

  th {
    background: var(--gold-dark) !important;
  }
}

/* Dark mode → force light invoice on print */
[data-theme="dark"] @media print {
  body { background: white; }
  .gold-invoice { background: white !important; border-color: #dcc49a !important; }
  .gold-invoice::before { display: none !important; }
  .gold-invoice::after { display: none !important; }
  .gold-invoice .invoice-logo strong { color: #9a6d15 !important; }
  .gold-invoice .invoice-logo .logo-sub { color: #8a7e72 !important; }
  .gold-invoice .summary-lines { background: #f6f1ea !important; }
  .gold-invoice .summary-lines .total-line { border-bottom-color: #e4d6c4 !important; }
  .gold-invoice .summary-total span { color: #4a3f37 !important; }
  .gold-invoice .summary-total strong { color: #1f1a16 !important; }
  .gold-invoice .summary-box { box-shadow: 0 0 0 1px #e4d6c4 inset !important; }
  .gold-invoice .summary-note { border-top-color: #e4d6c4 !important; }
  .gold-invoice .footer-line { color: #4a3f37 !important; }
  .gold-invoice .footer-line .fa-brands { color: #8a7e72 !important; }
  .gold-invoice .section-divider { background: linear-gradient(90deg, #dcc49a, transparent) !important; }
}

/* ========================================
   New Features — Login, Filter, Share, Settings
   ======================================== */
.login-screen {
  align-items: center;
  background: var(--wash);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 200;
}
.login-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 420px;
  padding: 40px 36px;
  width: 100%;
  animation: fadeSlideUp 500ms var(--ease-out) both;
}
.login-brand {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 28px;
  text-transform: uppercase;
}
.login-brand .brand-mark {
  height: 48px;
  width: 48px;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(194, 143, 43, 0.35);
}
.login-brand .brand-mark::after {
  font-size: 28px;
}
.login-brand .brand-name strong {
  color: var(--gold-dark);
  font-family: "Cormorant Garamond", serif;
  font-size: 28px;
  letter-spacing: 0.12em;
}
.login-brand .brand-name em {
  color: var(--ink-secondary);
  font-size: 11px;
  font-style: normal;
  letter-spacing: 0.55em;
}
.login-card form {
  display: grid;
  gap: 16px;
}
.password-wrapper {
  position: relative;
}
.password-wrapper input {
  padding-right: 44px;
}
.password-toggle {
  align-items: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  height: 100%;
  justify-content: center;
  padding: 0 14px;
  position: absolute;
  right: 0;
  top: 0;
  transition: color var(--transition);
}
.password-toggle:hover {
  color: var(--ink-secondary);
}
.password-toggle i {
  font-size: 18px;
}

.login-error {
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  min-height: 20px;
  text-align: center;
}
/* ========================================
   Overdue Banner
   ======================================== */
.overdue-banner {
  align-items: center;
  background: var(--red-soft);
  border: 1.5px solid var(--red);
  border-radius: var(--radius);
  display: none;
  gap: 10px;
  margin: 20px 0 16px;
  padding: 12px 16px;
  animation: fadeSlideUp 300ms var(--ease-out) both;
}
.overdue-icon {
  align-items: center;
  background: var(--red);
  border-radius: 50%;
  color: #fff;
  display: flex;
  flex-shrink: 0;
  font-size: 14px;
  height: 32px;
  justify-content: center;
  width: 32px;
}
.overdue-text {
  color: var(--ink);
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}
.overdue-text strong {
  color: var(--red);
}
.overdue-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
}
.overdue-close:hover {
  color: var(--ink);
}

/* Overdue table row */
tr.overdue-row td {
  border-left: 3px solid var(--red);
}
tr.overdue-row .status-pill {
  background: var(--red-soft);
  color: var(--red);
  border-color: var(--red);
}

.filter-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  padding: 16px 22px;
}
.filter-row {
  align-items: end;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 12px;
  gap: 6px;
  min-width: 160px;
}
.filter-label input {
  font-size: 13px;
  min-height: 38px;
  padding: 0 10px;
}
.share-link-info {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 0;
  word-break: break-all;
}
.share-link-info a {
  color: var(--gold-dark);
  text-decoration: underline;
}
.share-page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 32px clamp(16px, 6vw, 120px);
  animation: fadeSlideUp 450ms var(--ease-out) both;
}
.share-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 20px;
}
.share-header .brand {
  opacity: 1;
  text-transform: uppercase;
}
.share-footer {
  margin-top: 24px;
  padding-top: 18px;
  text-align: center;
  border-top: 1px solid var(--line);
}
.share-footer p {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}
.share-list-banner {
  margin-bottom: 20px;
}
.share-list-banner-link {
  align-items: center;
  background: linear-gradient(135deg, rgba(194, 143, 43, 0.08) 0%, rgba(194, 143, 43, 0.03) 100%);
  border: 1.5px solid var(--line-gold);
  border-radius: var(--radius);
  color: var(--ink-secondary);
  display: flex;
  gap: 14px;
  padding: 14px 20px;
  text-decoration: none;
  transition: all var(--transition);
}
.share-list-banner-link:hover {
  background: linear-gradient(135deg, rgba(194, 143, 43, 0.14) 0%, rgba(194, 143, 43, 0.06) 100%);
  border-color: var(--gold);
  box-shadow: var(--shadow-glow);
}
.banner-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.banner-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}
.banner-text strong {
  color: var(--gold-dark);
  font-weight: 700;
}
.banner-arrow {
  color: var(--gold-dark);
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  transition: transform var(--transition);
}
.share-list-banner-link:hover .banner-arrow {
  transform: translateX(4px);
}
.share-list-link {
  color: var(--gold-dark);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-gold);
  transition: color var(--transition);
}
.share-list-link:hover {
  color: var(--gold);
}
.share-list-intro {
  margin-bottom: 24px;
}
.share-list-intro h1 {
  font-size: 32px;
  margin: 0 0 6px;
}
.share-list-intro .muted {
  font-size: 14px;
  margin: 0;
}
.share-list-row {
  cursor: pointer;
  transition: background var(--transition);
}
.share-list-row:hover {
  background: rgba(194, 143, 43, 0.06);
}
#dbGuide h2 {
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--ink-secondary);
}
#dbGuide ol {
  margin: 0;
}
#dbGuide ol li {
  margin-bottom: 6px;
}
#logoutButton {
  color: var(--muted);
  border-color: transparent;
  font-size: 18px;
  min-height: 36px;
  min-width: 36px;
  padding: 0;
  line-height: 1;
}
#logoutButton:hover {
  color: var(--red);
  background: var(--red-soft);
  border-color: #e8b4b2;
}
#settingsButton {
  font-size: 13px;
}
.hidden {
  display: none !important;
}
@media (max-width: 640px) {
  .login-card { padding: 28px 24px; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-label { min-width: auto; }
  .footer-line { flex-wrap: wrap; }
  .footer-item + .footer-item {
    border-left: 0;
    padding-left: 0;
    margin-left: 0;
    padding-top: 8px;
  }
  .share-page { padding: 20px 16px; }
}

/* --- Pagination --- */
.pagination-bar {
  align-items: center;
  border-top: 1px solid var(--line);
  display: none;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
}
.load-more-sentinel {
  display: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  text-align: center;
  transition: color 200ms;
}
.load-more-sentinel:hover {
  color: var(--gold-dark);
}

.pagination-bar .ghost-button {
  font-size: 13px;
  min-height: 36px;
  padding: 0 14px;
}
.client-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.client-name-cell {
  align-items: center;
  display: flex;
  font-weight: 600;
  gap: 6px;
  line-height: 1;
}
.client-name-cell i {
  color: var(--gold-dark);
  font-size: 12px;
  opacity: 0.7;
}
.client-phone-cell {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
}
.client-phone-cell i {
  font-size: 12px;
  color: var(--gold-dark);
  opacity: 0.7;
}

.pagination-bar .ghost-button:disabled {
  cursor: not-allowed;
}
.page-info {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  min-width: 120px;
  text-align: center;
}

/* ========================================
   Dashboard Skeleton
   ======================================== */
.skel-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.skel-stat-title {
  width: 80px;
  height: 12px;
}
.skel-stat-value {
  width: 60px;
  height: 32px;
  border-radius: 8px;
}
.skel-stat-bar {
  width: 80%;
  height: 10px;
}

/* Dashboard skeleton rows — use table-row, not grid */
#invoiceRows > tr.skel-tr {
  display: table-row;
}
#invoiceRows > tr.skel-tr td {
  padding: 12px 16px;
}

/* Staggered entry animation for stats and rows */
#statsGrid > .stat-card,
#invoiceRows > tr:not(.skel-tr) {
  animation: fadeSlideUp 400ms var(--ease-out) both;
}
#statsGrid > .stat-card:nth-child(1) { animation-delay: 0ms; }
#statsGrid > .stat-card:nth-child(2) { animation-delay: 60ms; }
#statsGrid > .stat-card:nth-child(3) { animation-delay: 120ms; }
#statsGrid > .stat-card:nth-child(4) { animation-delay: 180ms; }
#invoiceRows > tr:nth-child(1) { animation-delay: 40ms; }
#invoiceRows > tr:nth-child(2) { animation-delay: 80ms; }
#invoiceRows > tr:nth-child(3) { animation-delay: 120ms; }
#invoiceRows > tr:nth-child(4) { animation-delay: 160ms; }
#invoiceRows > tr:nth-child(5) { animation-delay: 200ms; }

/* Smooth page transition with different timing per section */
.hero-row { animation: fadeSlideUp 350ms var(--ease-out) both; }
.filter-panel { animation: fadeSlideUp 400ms var(--ease-out) both; animation-delay: 50ms; }
.table-panel { animation: fadeSlideUp 450ms var(--ease-out) both; animation-delay: 100ms; }
.pagination-bar { animation: fadeSlideUp 350ms var(--ease-out) both; animation-delay: 250ms; }

/* ========================================
   Skeleton Loading
   ======================================== */
.invoice-skeleton {
  padding: 28px 32px;
}
.skel-top {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--line-gold);
}
.skel-row {
  display: flex;
  gap: 24px;
  align-items: center;
}
.skel-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.skel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  padding: 24px 0;
}
.skel-divider {
  height: 2px;
  background: var(--line-gold);
}
.skel-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 0;
}
.skel-th {
  display: grid;
  grid-template-columns: 30px 1.5fr 80px 100px 100px 100px;
  gap: 12px;
  padding: 10px 16px;
  background: var(--wash);
  border-radius: var(--radius);
}
.skel-tr {
  display: grid;
  grid-template-columns: 30px 1.5fr 80px 100px 100px 100px;
  gap: 12px;
  padding: 12px 16px;
}
.skel-bottom {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding-top: 20px;
  border-top: 2px solid var(--line-gold);
}
.skel-box {
  background: linear-gradient(90deg, #e8ddd0 25%, #f0e8de 50%, #e8ddd0 75%);
  background-size: 200% 100%;
  animation: skelShimmer 1.6s ease-in-out infinite;
}
.skel-line {
  height: 14px;
  border-radius: 99px;
  background: linear-gradient(90deg, #e8ddd0 25%, #f0e8de 50%, #e8ddd0 75%);
  background-size: 200% 100%;
  animation: skelShimmer 1.6s ease-in-out infinite;
}
.skel-th .skel-line {
  height: 12px;
}
.skel-tr .skel-line {
  height: 12px;
}
@keyframes skelShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========================================
   Dark Mode Float Button
   ======================================== */
.theme-float {
  align-items: center;
  background: var(--paper);
  border: 1.5px solid var(--line-gold);
  border-radius: 50%;
  bottom: 24px;
  box-shadow: var(--shadow);
  color: var(--gold-dark);
  cursor: pointer;
  display: flex;
  height: 44px;
  justify-content: center;
  position: fixed;
  right: 24px;
  transition: background var(--transition), box-shadow var(--transition), color var(--transition), transform var(--transition);
  width: 44px;
  z-index: 999;
}
.theme-float:hover {
  box-shadow: var(--shadow-glow);
  color: var(--gold);
  transform: scale(1.08);
}
.theme-float i {
  font-size: 20px;
  pointer-events: none;
}
