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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange:        #E8790E;
  --orange-hover:  #D06A08;
  --orange-light:  #FFF4E8;
  --orange-mid:    #FDE8C8;
  --sidebar-bg:    #0D1117;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active:rgba(232,121,14,0.14);
  --bg:            #F4F6FA;
  --surface:       #FFFFFF;
  --border:        #E4E7EC;
  --border-strong: #CBD5E1;
  --text:          #101828;
  --text-2:        #344054;
  --text-muted:    #667085;
  --text-light:    #98A2B3;
  --red:           #D92D20;
  --red-light:     #FEF3F2;
  --green:         #067647;
  --green-light:   #ECFDF3;
  --blue:          #1570EF;
  --blue-light:    #EFF8FF;
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     14px;
  --shadow-xs:     0 1px 2px rgba(16,24,40,0.05);
  --shadow-sm:     0 1px 3px rgba(16,24,40,0.10), 0 1px 2px rgba(16,24,40,0.06);
  --shadow-md:     0 4px 8px -2px rgba(16,24,40,0.10), 0 2px 4px -2px rgba(16,24,40,0.06);
  --shadow-lg:     0 12px 32px -4px rgba(16,24,40,0.12), 0 4px 8px -2px rgba(16,24,40,0.08);
  --shadow-xl:     0 24px 48px -12px rgba(16,24,40,0.18);
  --sidebar-w:     256px;
  --topbar-h:      64px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ─── SIDEBAR ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.25s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.s-logo-img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--orange);
  flex-shrink: 0;
}

.s-logo-text { line-height: 1.1; }
.s-logo-name {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.8px;
}
.s-logo-sub {
  display: block;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--orange);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 1px;
}

.s-nav { padding: 12px 10px; flex: 1; }

.s-section-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.28);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 14px 10px 6px;
}

.s-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 1px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.s-nav-item svg { flex-shrink: 0; opacity: 0.7; transition: opacity 0.15s; }

.s-nav-item:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,0.9);
}
.s-nav-item:hover svg { opacity: 1; }

.s-nav-item.active {
  background: var(--sidebar-active);
  color: var(--orange);
}
.s-nav-item.active svg { opacity: 1; color: var(--orange); }

.s-new-invoice {
  margin: 4px 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--orange);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.15s;
  justify-content: center;
}
.s-new-invoice:hover { background: var(--orange-hover); color: #fff; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-footer .biz-name {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}
.sidebar-footer .biz-info {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  line-height: 1.6;
}

/* ─── MAIN WRAP ────────────────────────────────────── */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ─── TOPBAR ───────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 40;
  gap: 16px;
}

.topbar-left { display: flex; flex-direction: column; gap: 1px; }

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.topbar-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ─── PAGE BODY ────────────────────────────────────── */
.page-body { padding: 28px; flex: 1; }

/* ─── BUTTONS ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s;
  line-height: 1;
}
.btn svg { flex-shrink: 0; }

.btn-primary {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 1px 2px rgba(232,121,14,0.2);
}
.btn-primary:hover { background: var(--orange-hover); box-shadow: 0 4px 8px rgba(232,121,14,0.3); }

.btn-secondary {
  background: #fff;
  color: var(--text-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: #F9FAFB; border-color: var(--border-strong); }

.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover { background: #B42318; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: #F9FAFB; color: var(--text-2); border-color: var(--border); }

.btn-dark { background: var(--sidebar-bg); color: #fff; }
.btn-dark:hover { background: #1a2030; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* ─── CARDS ────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.card-body { padding: 20px; }
.card-body-flush { padding: 0; }

/* ─── STAT CARDS ───────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.stat-card-icon.orange { background: var(--orange-light); color: var(--orange); }
.stat-card-icon.green  { background: var(--green-light); color: var(--green); }
.stat-card-icon.blue   { background: var(--blue-light); color: var(--blue); }
.stat-card-icon.purple { background: #F4F3FF; color: #6938EF; }

.stat-card .val {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.5px;
}

.stat-card .lbl {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

/* ─── HERO BANNER ──────────────────────────────────── */
.hero-banner {
  background:
    linear-gradient(to right, #0D1117 25%, rgba(13,17,23,0.88) 50%, rgba(13,17,23,0.4) 100%),
    url('https://images.unsplash.com/photo-1492144534655-ae79c964c9d7?auto=format&fit=crop&w=1600&q=80') center/cover no-repeat;
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  border: 1px solid rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(232,121,14,0.15) 0%, transparent 65%);
  pointer-events: none;
}

/* ─── FEATURE CARD ─────────────────────────────────── */
.feature-card {
  display: flex;
  align-items: stretch;
  background: #0D1117;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid rgba(255,255,255,0.06);
  height: 180px;
}

.feature-card-body {
  flex: 1;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.feature-card-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--orange);
}

.feature-card-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
}

.feature-card-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.42);
  max-width: 340px;
  line-height: 1.6;
}

.feature-card-photo {
  width: 44%;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.feature-card-photo::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, #0D1117 0%, transparent 45%);
  z-index: 1;
}

.feature-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ─── PAGE IMAGE BANNER ────────────────────────────── */
.page-img-banner {
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  height: 110px;
  position: relative;
  display: flex;
  align-items: flex-end;
  background-size: cover;
  background-position: center 40%;
  background-repeat: no-repeat;
}

.page-img-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(13,17,23,0.92) 0%, rgba(13,17,23,0.6) 60%, rgba(13,17,23,0.2) 100%);
}

.page-img-banner-text {
  position: relative;
  z-index: 1;
  padding: 20px 24px;
  color: #fff;
}

.page-img-banner-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.page-img-banner-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.hero-logo {
  width: 76px;
  height: 76px;
  border-radius: 16px;
  object-fit: cover;
  border: 2.5px solid var(--orange);
  flex-shrink: 0;
  box-shadow: 0 0 0 6px rgba(232,121,14,0.12);
}

.hero-text { flex: 1; }
.hero-title {
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 1.5px;
  line-height: 1;
}
.hero-tagline {
  font-size: 11px;
  font-weight: 600;
  color: var(--orange);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-top: 5px;
}
.hero-address {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  margin-top: 10px;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  gap: 28px;
  flex-shrink: 0;
}

.hero-stat { text-align: center; }
.hero-stat .hval {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}
.hero-stat .hlbl {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 2px;
}

/* ─── QUICK ACTIONS ────────────────────────────────── */
.qa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.qa-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px 18px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.18s ease;
}

.qa-card:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: var(--text);
}

.qa-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--orange-light);
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s;
}
.qa-card:hover .qa-icon { background: var(--orange); color: #fff; }

.qa-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.qa-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: -8px;
}

/* ─── BACKUP STRIP ─────────────────────────────────── */
.backup-strip {
  background: linear-gradient(135deg, #FFF9F0, #FFFCF8);
  border: 1px solid #FDD6A3;
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.backup-strip .bs-title { font-size: 13px; font-weight: 700; color: var(--text-2); }
.backup-strip .bs-desc  { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* ─── TABLES ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead { background: #F8F9FB; border-bottom: 2px solid var(--border); }

th {
  text-align: left;
  padding: 12px 20px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-light);
  white-space: nowrap;
}

td {
  padding: 15px 20px;
  border-bottom: 1px solid #F0F2F5;
  color: var(--text-2);
  vertical-align: middle;
  font-size: 13.5px;
  line-height: 1.5;
}

tbody tr { transition: background 0.12s ease; }
tbody tr:hover td { background: #F8F9FB; }
tbody tr:last-child td { border-bottom: none; }

.td-primary { font-weight: 600; color: var(--text); font-size: 14px; }

/* ─── SEARCH / FILTER BAR ──────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-input-wrap svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

.search-input {
  padding: 8px 12px 8px 35px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,121,14,0.10);
}

/* ─── FORMS ────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.form-group { display: flex; flex-direction: column; gap: 7px; }

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.1px;
}

.form-label .req { color: var(--orange); margin-left: 2px; }

input, select, textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.18s, box-shadow 0.18s;
  appearance: none;
  line-height: 1.5;
}

input::placeholder, textarea::placeholder {
  color: var(--text-light);
  font-size: 13px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(232,121,14,0.10);
  background: #FFFDF9;
}

input[readonly], input[disabled] {
  background: #F9FAFB;
  color: var(--text-muted);
  cursor: default;
}

textarea { resize: vertical; min-height: 86px; line-height: 1.6; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

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

/* ─── MODAL ────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.1px; }

.modal-close {
  width: 30px; height: 30px;
  background: #F2F4F7;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  line-height: 1;
}
.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body { padding: 28px; }

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 18px 28px;
  border-top: 1px solid var(--border);
  background: #FAFAFA;
}

/* ─── BADGES ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  display: inline-block;
}

.badge-green  { background: var(--green-light); color: var(--green); }
.badge-green::before { background: var(--green); }
.badge-orange { background: var(--orange-light); color: var(--orange-hover); }
.badge-orange::before { background: var(--orange); }
.badge-red    { background: var(--red-light); color: var(--red); }
.badge-red::before { background: var(--red); }

/* ─── CODE ─────────────────────────────────────────── */
code {
  background: #F2F4F7;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  color: var(--orange-hover);
  border: 1px solid #E4E7EC;
  font-weight: 500;
}

/* ─── LINKS ────────────────────────────────────────── */
a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--orange-hover); }

td a { color: var(--text-2); font-weight: 600; }
td a:hover { color: var(--orange); }

/* ─── TOAST ────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--sidebar-bg);
  color: #fff;
  padding: 13px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 340px;
  border-left: 3px solid var(--orange);
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-left-color: #17B26A; }
.toast-error   { border-left-color: var(--red); }

/* ─── INVOICE ITEMS TABLE ──────────────────────────── */
.items-table th,
.items-table td { padding: 8px 10px; }

.items-table input,
.items-table select { padding: 7px 9px; font-size: 13px; }

.remove-row {
  width: 28px; height: 28px;
  background: #FEF3F2;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  color: var(--red);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.remove-row:hover { background: var(--red); color: #fff; }

.grand-total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--sidebar-bg);
  border-radius: var(--radius);
  margin-top: 16px;
}

.grand-total-bar .label {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
}

.grand-total-bar .amount {
  font-size: 22px;
  font-weight: 800;
  color: var(--orange);
  letter-spacing: -0.5px;
}

/* ─── EMPTY STATE ──────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 52px 20px;
  color: var(--text-muted);
}
.empty-state svg { opacity: 0.25; margin-bottom: 12px; }
.empty-state p { font-size: 14px; font-weight: 500; }
.empty-state small { font-size: 12.5px; display: block; margin-top: 4px; }

/* ─── AUTOCOMPLETE ─────────────────────────────────── */
.autocomplete-box {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  overflow: hidden;
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  border-bottom: 1px solid #F2F4F7;
  transition: background 0.1s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--orange-light); color: var(--orange-hover); }
.autocomplete-item strong { color: var(--text); }

/* ─── INVOICE SECTION HEADER ───────────────────────── */
.section-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 16px 20px 10px;
  border-bottom: 1px solid var(--border);
  background: #FAFAFA;
}

/* ─── SKELETON SHIMMER ─────────────────────────────── */
@keyframes shimmerSlide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

.sk-line {
  display: block;
  border-radius: 6px;
  background: #E4E7EC;
  position: relative;
  overflow: hidden;
}

.sk-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.72) 50%,
    transparent 100%
  );
  animation: shimmerSlide 1.4s ease-in-out infinite;
}

.sk-tr td {
  padding: 16px 20px;
  border-bottom: 1px solid #F0F2F5;
  vertical-align: middle;
}

/* ─── PRINT INVOICE ────────────────────────────────── */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}

.print-invoice {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 8mm;
  background: #fff;
  font-family: 'Times New Roman', serif;
}

.inv-header {
  text-align: center;
  border: 2px solid #000;
  border-bottom: none;
  padding: 6px 10px 4px;
}
.inv-header h1 { font-size: 28px; font-weight: 900; letter-spacing: 1px; line-height: 1.1; }
.inv-header .addr { font-size: 12px; margin-top: 2px; }

.inv-fields { border: 2px solid #000; border-bottom: none; padding: 6px 10px; }

.inv-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 6px;
  font-size: 13px;
}
.inv-row .lbl { white-space: nowrap; font-weight: 600; min-width: 130px; }
.inv-row .val { flex: 1; border-bottom: 1px solid #000; padding-bottom: 1px; min-width: 80px; }
.inv-row .sep { white-space: nowrap; padding: 0 8px; font-weight: 600; }

.inv-table-wrap { border: 2px solid #000; }
.inv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.inv-table th { border: 1px solid #000; padding: 5px 8px; text-align: center; font-weight: 700; }
.inv-table td { border: 1px solid #000; padding: 5px 8px; height: 22px; }
.inv-table td.center { text-align: center; }
.inv-table td.right  { text-align: right; }
.inv-total-row td { font-weight: 700; border-top: 2px solid #000; }
.inv-sign {
  border: 2px solid #000;
  border-top: none;
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
}

/* ─── MOBILE TOPBAR TOGGLE ─────────────────────────── */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-2);
  border-radius: var(--radius-sm);
}
.sidebar-toggle:hover { background: #F2F4F7; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 49;
}
.sidebar-backdrop.open { display: block; }

/* ─── RESPONSIVE ───────────────────────────────────── */

/* Prevent ALL horizontal overflow */
html, body { overflow-x: hidden; max-width: 100vw; }
.main-wrap  { overflow-x: hidden; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); z-index: 60; }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .hero-stats { display: none; }
  .hero-banner { padding: 20px; gap: 14px; }
  .hero-logo { width: 56px; height: 56px; }
  .hero-title { font-size: 18px; }
  .feature-card-photo { display: none; }
  .feature-card-body { padding: 20px; }
  .feature-card-title { font-size: 18px; }
  .page-img-banner { height: 80px; }
}

@media (max-width: 600px) {
  /* ── Topbar ────────────────────────────────────────── */
  .topbar {
    height: auto;
    min-height: 54px;
    padding: 8px 14px;
    gap: 8px;
    flex-wrap: nowrap;
  }
  /* Left side: shrinks, never pushes buttons off screen */
  .topbar > div:first-child {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .topbar-title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Hide subtitle on mobile — it wraps and overlaps buttons */
  .topbar-sub { display: none; }
  .topbar-actions { flex-shrink: 0; gap: 6px; }

  /* Hide secondary button labels on mobile, keep icons */
  .topbar-actions .btn-secondary .btn-label { display: none; }

  /* Buttons */
  .btn    { padding: 7px 11px; font-size: 12.5px; gap: 5px; }
  .btn-sm { padding: 5px 9px;  font-size: 11.5px; }

  /* ── Page layout ───────────────────────────────────── */
  .page-body  { padding: 12px; }
  .filter-bar { padding: 10px 14px; }

  /* ── Cards — NO overflow:hidden (breaks table scroll) ─ */
  .card        { border-radius: 10px; }
  .card-header { padding: 14px 16px; }

  /* ── Tables → Elite Cards on mobile ───────────────── */
  /* Invoice items-table stays scrollable (it has form inputs) */
  .table-wrap .items-table { min-width: 620px; }

  /* Convert display tables to card layout */
  .table-wrap table:not(.items-table),
  .table-wrap table:not(.items-table) thead,
  .table-wrap table:not(.items-table) tbody,
  .table-wrap table:not(.items-table) tr,
  .table-wrap table:not(.items-table) td { display: block; width: 100%; }

  .table-wrap table:not(.items-table) { border: none; min-width: unset; }
  .table-wrap table:not(.items-table) thead { display: none; }

  .table-wrap table:not(.items-table) tbody tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--orange);
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  }

  .table-wrap table:not(.items-table) tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 16px;
    border: none;
    border-bottom: 1px solid #F0F3F6;
    font-size: 13px;
    min-height: 38px;
    gap: 12px;
    color: var(--text-2);
    white-space: normal;
    overflow: visible;
    max-width: none;
    text-overflow: unset;
  }

  .table-wrap table:not(.items-table) tbody td:last-child { border-bottom: none; }

  .table-wrap table:not(.items-table) tbody td::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-light);
    flex-shrink: 0;
    min-width: 64px;
  }

  /* Primary td — card header */
  .table-wrap table:not(.items-table) tbody td.td-primary {
    padding: 14px 16px;
    background: linear-gradient(to right, #F8F9FB, #fff);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    justify-content: flex-start;
  }
  .table-wrap table:not(.items-table) tbody td.td-primary::before { display: none; }
  .table-wrap table:not(.items-table) tbody td.td-primary a {
    color: var(--text);
    font-weight: 700;
    font-size: 15px;
  }

  /* Actions td — card footer */
  .table-wrap table:not(.items-table) tbody td.td-actions {
    padding: 10px 16px;
    justify-content: flex-end;
    background: #FAFBFD;
  }
  .table-wrap table:not(.items-table) tbody td.td-actions::before { display: none; }

  /* Hide cells with empty data-label (like the # column) */
  .table-wrap table:not(.items-table) tbody td[data-label=""] { display: none; }

  /* ── Forms ─────────────────────────────────────────── */
  .form-grid  { grid-template-columns: 1fr; gap: 14px; }
  .form-label { font-size: 12.5px; }
  input, select, textarea { padding: 9px 12px; font-size: 13.5px; }

  /* ── Modal — slides up from bottom on mobile ───────── */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; max-width: 100%; }
  .modal-header   { padding: 16px 18px; }
  .modal-header h2 { font-size: 15px; }
  .modal-body     { padding: 16px 18px; }
  .modal-footer   { padding: 12px 18px; }

  /* ── Dashboard ─────────────────────────────────────── */
  .stats-grid  { grid-template-columns: 1fr 1fr; gap: 10px; }
  .qa-grid     { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card   { padding: 14px; }
  .hero-banner { padding: 16px; gap: 10px; border-radius: 10px; }
  .hero-address { display: none; }
  .feature-card { height: 140px; }
  .feature-card-body { padding: 16px; gap: 6px; }
  .feature-card-title { font-size: 16px; }
  .page-img-banner { height: 72px; border-radius: 10px; }
  .backup-strip { flex-direction: column; gap: 12px; align-items: flex-start; }

  /* ── Invoice new page ──────────────────────────────── */
  .section-heading { padding: 14px 16px !important; font-size: 12px; }
  .card-body { padding: 14px 16px !important; }
  .grand-total-bar { border-radius: 8px; }
}

/* ═══════════════════════════════════════════════════
   ANIMATIONS — Product Launch Style
   ═══════════════════════════════════════════════════ */

/* Page entrance */
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.main-wrap { animation: pageEnter 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* Hero content sequence */
@keyframes slideUpIn {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}
@keyframes logoPulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(232,121,14,0.12); }
  50%       { box-shadow: 0 0 0 14px rgba(232,121,14,0.22), 0 0 48px rgba(232,121,14,0.12); }
}
.hero-logo  { animation: slideUpIn 0.7s cubic-bezier(0.22,1,0.36,1) 0.15s both,
                          logoPulse 3.5s ease-in-out 1.2s infinite; }
.hero-text  { animation: slideUpIn 0.7s cubic-bezier(0.22,1,0.36,1) 0.30s both; }
.hero-stats { animation: slideUpIn 0.7s cubic-bezier(0.22,1,0.36,1) 0.46s both; }

/* Hero glow pulse */
@keyframes glowPulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.25); }
}
.hero-banner::before { animation: glowPulse 5s ease-in-out infinite; }

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.72s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.72s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.in { opacity: 1; transform: none; }

/* Stat cards — CSS keyframes, no IO needed (above the fold) */
@keyframes cardPop {
  from { opacity: 0; transform: translateY(22px) scale(0.95); }
  to   { opacity: 1; transform: none; }
}
.stats-grid .stat-card {
  animation: cardPop 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.stats-grid .stat-card:nth-child(1) { animation-delay: 0.05s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.13s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.21s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.29s; }
.stats-grid .stat-card:nth-child(5) { animation-delay: 0.37s; }

/* QA cards — CSS keyframes, staggered */
.qa-grid .qa-card {
  animation: cardPop 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.qa-grid .qa-card:nth-child(1) { animation-delay: 0.22s; }
.qa-grid .qa-card:nth-child(2) { animation-delay: 0.32s; }
.qa-grid .qa-card:nth-child(3) { animation-delay: 0.42s; }
.qa-grid .qa-card:nth-child(4) { animation-delay: 0.52s; }

/* Stat card hover (3D tilt handled by JS) */
.stat-card {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
  cursor: default;
  will-change: transform;
}
.stat-card:hover { box-shadow: 0 18px 48px rgba(232,121,14,0.14), var(--shadow-md); }

/* QA card hover */
.qa-card {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease !important;
  will-change: transform;
}
.qa-card:hover {
  transform: translateY(-8px) scale(1.015) !important;
  box-shadow: 0 24px 56px rgba(0,0,0,0.10) !important;
}

/* Feature card hover — image slow zoom */
.feature-card { transition: box-shadow 0.4s ease; }
.feature-card:hover { box-shadow: 0 24px 64px rgba(0,0,0,0.18); }
.feature-card-photo img {
  transition: transform 7s cubic-bezier(0.22, 1, 0.36, 1) !important;
}
.feature-card:hover .feature-card-photo img { transform: scale(1.07) !important; }

/* Shimmer on feature card tag */
@keyframes shimmerText {
  from { background-position: 0% center; }
  to   { background-position: 200% center; }
}
.feature-card-tag {
  background: linear-gradient(90deg, var(--orange) 0%, #f8b042 50%, var(--orange) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmerText 2.8s linear 0.8s infinite;
}

/* Table row entrance — applied per-row via JS animateTableRows() */
@keyframes rowSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* Button press */
.btn { transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.18s ease !important; }
.btn:active { transform: scale(0.965) !important; }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(232,121,14,0.38) !important; }

/* Modal entrance — deeper, more cinematic */
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.93) translateY(18px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Nav active glow */
@keyframes navItemGlow {
  0%, 100% { background: var(--sidebar-active); }
  50%       { background: rgba(232,121,14,0.22); }
}
.s-nav-item.active { animation: navItemGlow 3s ease-in-out infinite; }

/* Page image banner reveal */
.page-img-banner { transition: opacity 0.8s ease; }

/* Sidebar logo float */
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-3px); }
}
.s-logo-img { animation: logoFloat 4s ease-in-out infinite; }

@media (max-width: 600px) {
  .page-body { padding: 16px; }
  .topbar { padding: 0 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .qa-grid { grid-template-columns: 1fr 1fr; }
}
