/* ═══════════════════════════════════════════════════════
   ADSPEND PRO — Premium Invoice Generator
   style.css
════════════════════════════════════════════════════════ */

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #080d1a;
  color: #e2e8f0;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ════════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES — THEME ENGINE
═══════════════════════════════════════════════════════════ */
:root {
  /* App shell */
  --sidebar-bg: rgba(10, 16, 32, 0.97);
  --sidebar-border: rgba(255,255,255,0.06);
  --canvas-bg: #0d1526;
  --header-bg: rgba(8, 13, 26, 0.98);
  --header-border: rgba(255,255,255,0.07);

  /* Form elements */
  --inp-bg: rgba(255,255,255,0.05);
  --inp-border: rgba(255,255,255,0.1);
  --inp-border-focus: rgba(255,255,255,0.3);
  --inp-text: #e2e8f0;
  --inp-placeholder: rgba(148,163,184,0.6);

  /* Invoice theme variables (overridden per theme) */
  --inv-accent: #3B82F6;
  --inv-accent-dark: #1e3a8a;
  --inv-accent-mid: #2563eb;
  --inv-accent-light: #dbeafe;
  --inv-accent-xlight: #eff6ff;
  --inv-table-hd-bg: #1e293b;
  --inv-table-hd-fg: #ffffff;
  --inv-net-grad: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  --inv-rule-color: #3B82F6;
  --inv-tag-bg: #eff6ff;
  --inv-tag-fg: #1d4ed8;
  --inv-doc-badge-bg: #1e3a8a;
  --inv-doc-badge-fg: #bfdbfe;
}

/* ── Slate Corporate (default) — same as :root above ── */
[data-theme="slate"] {
  --inv-accent: #3B82F6;
  --inv-accent-dark: #1e3a8a;
  --inv-accent-mid: #2563eb;
  --inv-accent-light: #dbeafe;
  --inv-accent-xlight: #eff6ff;
  --inv-table-hd-bg: #1e293b;
  --inv-table-hd-fg: #ffffff;
  --inv-net-grad: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  --inv-rule-color: #3B82F6;
  --inv-tag-bg: #eff6ff;
  --inv-tag-fg: #1d4ed8;
  --inv-doc-badge-bg: #1e3a8a;
  --inv-doc-badge-fg: #bfdbfe;
}

/* ── Emerald Digital ── */
[data-theme="emerald"] {
  --inv-accent: #10b981;
  --inv-accent-dark: #064e3b;
  --inv-accent-mid: #059669;
  --inv-accent-light: #d1fae5;
  --inv-accent-xlight: #ecfdf5;
  --inv-table-hd-bg: #064e3b;
  --inv-table-hd-fg: #ffffff;
  --inv-net-grad: linear-gradient(135deg, #064e3b 0%, #10b981 100%);
  --inv-rule-color: #10b981;
  --inv-tag-bg: #ecfdf5;
  --inv-tag-fg: #065f46;
  --inv-doc-badge-bg: #064e3b;
  --inv-doc-badge-fg: #a7f3d0;
}

/* ── Indigo Royal ── */
[data-theme="indigo"] {
  --inv-accent: #6366f1;
  --inv-accent-dark: #312e81;
  --inv-accent-mid: #4f46e5;
  --inv-accent-light: #e0e7ff;
  --inv-accent-xlight: #eef2ff;
  --inv-table-hd-bg: #312e81;
  --inv-table-hd-fg: #ffffff;
  --inv-net-grad: linear-gradient(135deg, #312e81 0%, #6366f1 100%);
  --inv-rule-color: #6366f1;
  --inv-tag-bg: #eef2ff;
  --inv-tag-fg: #3730a3;
  --inv-doc-badge-bg: #312e81;
  --inv-doc-badge-fg: #c7d2fe;
}

/* ── Crimson Bold ── */
[data-theme="crimson"] {
  --inv-accent: #ef4444;
  --inv-accent-dark: #7f1d1d;
  --inv-accent-mid: #dc2626;
  --inv-accent-light: #fee2e2;
  --inv-accent-xlight: #fef2f2;
  --inv-table-hd-bg: #7f1d1d;
  --inv-table-hd-fg: #ffffff;
  --inv-net-grad: linear-gradient(135deg, #7f1d1d 0%, #ef4444 100%);
  --inv-rule-color: #ef4444;
  --inv-tag-bg: #fef2f2;
  --inv-tag-fg: #b91c1c;
  --inv-doc-badge-bg: #7f1d1d;
  --inv-doc-badge-fg: #fecaca;
}

/* ════════════════════════════════════════════════════════
   APP HEADER
═══════════════════════════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 58px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 16px;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-glyph {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 16px rgba(99,102,241,0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.3px;
}
.brand-tag {
  font-size: 11px;
  color: #64748b;
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}
.theme-picker-label {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

.header-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hbtn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}
.hbtn-ghost {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
  color: #94a3b8;
}
.hbtn-ghost:hover { background: rgba(255,255,255,0.09); color: #cbd5e1; border-color: rgba(255,255,255,0.18); }

.hbtn-png {
  background: rgba(16,185,129,0.12);
  border-color: rgba(16,185,129,0.25);
  color: #34d399;
}
.hbtn-png:hover { background: rgba(16,185,129,0.22); border-color: rgba(16,185,129,0.4); }

.hbtn-pdf {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.3);
  color: #818cf8;
}
.hbtn-pdf:hover { background: rgba(99,102,241,0.25); border-color: rgba(99,102,241,0.5); }

.hbtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ════════════════════════════════════════════════════════
   APP BODY LAYOUT
═══════════════════════════════════════════════════════════ */
.app-body {
  display: flex;
  height: calc(100vh - 58px);
  overflow: hidden;
}

/* ════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════ */
.sidebar {
  width: 380px;
  min-width: 380px;
  height: 100%;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Vertical Tab Nav ── */
.vnav {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--sidebar-border);
}

.vnav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
  position: relative;
}
.vnav-btn:hover {
  background: rgba(255,255,255,0.05);
  color: #94a3b8;
}
.vnav-btn.active {
  background: rgba(99,102,241,0.12);
  border-color: rgba(99,102,241,0.25);
  color: #a5b4fc;
}
.vnav-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 7px;
  background: rgba(255,255,255,0.04);
  transition: all 0.16s;
}
.vnav-btn.active .vnav-icon {
  background: rgba(99,102,241,0.2);
  color: #818cf8;
}
.vnav-label {
  font-size: 13px;
  font-weight: 500;
  flex: 1;
  font-family: 'Inter', sans-serif;
}
.vnav-num {
  font-size: 10px;
  font-weight: 600;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  color: #475569;
}
.vnav-btn.active .vnav-num {
  background: rgba(99,102,241,0.3);
  color: #a5b4fc;
}

/* ── Panel Area (scrollable) ── */
.panel-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 16px 24px;
}
.panel-area::-webkit-scrollbar { width: 4px; }
.panel-area::-webkit-scrollbar-track { background: transparent; }
.panel-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.panel-area::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ── Panels ── */
.panel { display: none; }
.panel.active { display: block; }

.panel-hd {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--sidebar-border);
}
.panel-hd h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 3px;
}
.panel-hd p {
  font-size: 12px;
  color: #475569;
  font-weight: 400;
}

/* ════════════════════════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════════════════════════ */
.fgrp { margin-bottom: 12px; }
.fgrp:last-child { margin-bottom: 0; }

.flbl {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.finp, .ftxt, .fsel {
  width: 100%;
  background: var(--inp-bg);
  border: 1px solid var(--inp-border);
  color: var(--inp-text);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  outline: none;
}
.finp:focus, .ftxt:focus, .fsel:focus {
  border-color: var(--inp-border-focus);
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.finp::placeholder, .ftxt::placeholder { color: var(--inp-placeholder); }
.ftxt { resize: vertical; line-height: 1.5; }

/* Select styling + macOS bugfix */
.fsel {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 32px;
  cursor: pointer;
}
.fsel option {
  background: #0f172a;
  color: #ffffff;
  font-size: 13px;
}

/* Select wrapper with custom chevron */
.select-wrapper {
  position: relative;
}
.select-wrapper::after {
  content: '';
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 4.5px solid transparent;
  border-right: 4.5px solid transparent;
  border-top: 5px solid rgba(148,163,184,0.6);
  pointer-events: none;
}
.select-wrapper.select-sm .fsel,
.select-wrapper.select-sm select {
  font-size: 12px;
  padding: 6px 28px 6px 10px;
  border-radius: 7px;
  min-width: 140px;
}

/* Header-level select */
.select-wrapper.header-select select {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #cbd5e1;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 28px;
}
.select-wrapper.header-select select option {
  background: #0f172a;
  color: #ffffff;
}
.select-wrapper.header-select::after {
  border-top-color: rgba(148,163,184,0.5);
}

/* Input with right badge */
.input-addon {
  position: relative;
  display: flex;
}
.input-addon .finp {
  flex: 1;
  border-radius: 8px 0 0 8px;
  border-right: none;
}
.addon-badge {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 11px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--inp-border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.input-addon .finp:focus { border-right: none; }

/* Two-column form row */
.frow2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* OR separator */
.or-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: #334155;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.or-sep::before, .or-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--sidebar-border);
}
.or-sep span { color: #475569; }

/* Section label inside panel */
.sec-label {
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin: 18px 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.sec-label::before {
  content: '';
  width: 2px;
  height: 12px;
  background: rgba(99,102,241,0.5);
  border-radius: 1px;
  display: inline-block;
}

/* ════════════════════════════════════════════════════════
   LOGO UPLOAD ZONE
═══════════════════════════════════════════════════════════ */
.logo-zone {
  border: 1.5px dashed rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 20px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  background: rgba(255,255,255,0.02);
}
.logo-zone:hover {
  border-color: rgba(99,102,241,0.4);
  background: rgba(99,102,241,0.06);
}

.logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
}
.logo-placeholder span {
  font-size: 12.5px;
  color: #475569;
  font-weight: 500;
}
.logo-placeholder small {
  font-size: 11px;
  color: #334155;
}

.logo-preview {
  max-height: 70px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 6px;
}

/* ════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 9px;
  border: none;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 2px 8px rgba(79,70,229,0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca, #6d28d9);
  box-shadow: 0 4px 16px rgba(79,70,229,0.5);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.1);
  color: #f87171;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.16s;
}
.btn-danger:hover { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.5); }
.btn-danger.btn-icon-sq { padding: 10px 13px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: #64748b;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  padding: 7px 11px;
  font-family: 'Inter', sans-serif;
}
.btn-ghost:hover { background: rgba(255,255,255,0.07); color: #94a3b8; border-color: rgba(255,255,255,0.18); }

.btn-sm { padding: 5px 10px; font-size: 11.5px; }

.btn-regen {
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 1px;
}

.btn-add-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 10px;
  border-radius: 9px;
  border: 1.5px dashed rgba(99,102,241,0.35);
  background: rgba(99,102,241,0.06);
  color: #818cf8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s;
  margin-top: 10px;
  font-family: 'Inter', sans-serif;
}
.btn-add-item:hover {
  background: rgba(99,102,241,0.12);
  border-color: rgba(99,102,241,0.55);
  color: #a5b4fc;
}

/* ── Additional Services separator in sidebar ── */
.svc-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 14px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.svc-sep::before, .svc-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(16,185,129,0.12), rgba(16,185,129,0.25), rgba(16,185,129,0.12));
}
.svc-sep-icon {
  display: flex;
  align-items: center;
  color: #34d399;
  flex-shrink: 0;
}

.svc-items-label { color: #34d399 !important; }
.svc-items-badge {
  background: rgba(16,185,129,0.15) !important;
  color: #34d399 !important;
}

.svc-helper-text {
  font-size: 11.5px;
  color: #334155;
  margin-bottom: 10px;
  margin-top: -6px;
  line-height: 1.4;
  font-style: italic;
}

/* ── Service item card (green tint) ── */
.svc-item-card {
  background: rgba(16,185,129,0.04);
  border: 1px solid rgba(16,185,129,0.14);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}
.svc-item-card:hover { border-color: rgba(16,185,129,0.28); }
.svc-item-card .lic-num::before { background: rgba(16,185,129,0.7); }

/* ── Add Service button ── */
.btn-add-svc {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 10px;
  border-radius: 9px;
  border: 1.5px dashed rgba(16,185,129,0.35);
  background: rgba(16,185,129,0.06);
  color: #34d399;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s;
  margin-top: 10px;
  font-family: 'Inter', sans-serif;
}
.btn-add-svc:hover {
  background: rgba(16,185,129,0.13);
  border-color: rgba(16,185,129,0.55);
  color: #6ee7b7;
}

/* ── Invoice: Additional Services table ── */
.inv-svc-wrap {
  margin-top: 10px;
}
.inv-svc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1.5px dashed #e2e8f0;
}
.inv-svc-header-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #10b981;
}
.inv-svc-header-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(16,185,129,0.4), transparent);
}
.inv-svc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}
.inv-svc-table thead tr { background: #064e3b; }
.inv-svc-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #a7f3d0;
  white-space: nowrap;
}
.inv-svc-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
}
.inv-svc-table tbody tr:last-child { border-bottom: none; }
.inv-svc-table tbody tr:nth-child(even) { background: #f0fdf9; }
.inv-svc-table tbody tr:nth-child(odd)  { background: #ffffff; }
.inv-svc-table tbody tr:hover { background: #ecfdf5; }
.inv-svc-table td {
  padding: 11px 14px;
  vertical-align: middle;
  color: #334155;
}
.inv-svc-table td.sc-no   { text-align: center; font-weight: 600; color: #94a3b8; font-size: 12px; width: 40px; }
.inv-svc-table td.sc-type { width: 155px; }
.inv-svc-table td.sc-desc { color: #475569; line-height: 1.4; }
.inv-svc-table td.sc-bdt  { text-align: right; font-weight: 700; color: #065f46; font-family: 'Outfit', monospace; width: 120px; }

/* Service type badge */
.svc-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* Invoice summary: services row */
.fin-svc-bdt {
  font-size: 13px;
  font-weight: 700;
  color: #065f46;
  min-width: 100px;
  text-align: right;
  font-family: 'Outfit', monospace;
}

/* Button utility combos */
.btn-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.flex-grow { flex: 1; }
.w-full { width: 100%; }
.mt-2 { margin-top: 8px; }

/* ════════════════════════════════════════════════════════
   INLINE FORM UTILITIES
═══════════════════════════════════════════════════════════ */
.finline-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 12px;
}
.finline-row .fgrp { margin-bottom: 0; }

.date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}
.date-range .finp { flex: 1; font-size: 12px; }
.date-sep {
  color: #475569;
  font-size: 13px;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════
   LINE ITEMS (Sidebar)
═══════════════════════════════════════════════════════════ */
.items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 10px;
}
.items-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.items-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(99,102,241,0.15);
  color: #818cf8;
}

.line-item-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}
.line-item-card:hover { border-color: rgba(255,255,255,0.12); }

.lic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.lic-num {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.lic-num::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(99,102,241,0.6);
}
.lic-delete {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  border: 1px solid rgba(239,68,68,0.2);
  background: rgba(239,68,68,0.08);
  color: #f87171;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  line-height: 1;
}
.lic-delete:hover { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.4); }

/* Smaller form elements inside line item cards */
.flbl-sm {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.finp-sm, .fsel-sm {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: #cbd5e1;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.14s, background 0.14s;
}
.finp-sm:focus, .fsel-sm:focus {
  border-color: rgba(99,102,241,0.4);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.1);
}
.finp-sm::placeholder { color: rgba(100,116,139,0.7); }
.fsel-sm {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 26px;
  cursor: pointer;
}
.fsel-sm option {
  background: #0f172a;
  color: #ffffff;
}
.select-sm-wrap {
  position: relative;
}
.select-sm-wrap::after {
  content: '';
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4.5px solid rgba(100,116,139,0.5);
  pointer-events: none;
}

.lic-mb { margin-bottom: 8px; }

.input-addon-sm {
  display: flex;
}
.input-addon-sm .finp-sm {
  flex: 1;
  border-radius: 7px 0 0 7px;
  border-right: none;
}
.addon-sm {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 9px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-left: none;
  border-radius: 0 7px 7px 0;
  font-size: 10.5px;
  font-weight: 600;
  color: #475569;
  letter-spacing: 0.3px;
}

.lic-bdt-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 7px;
  gap: 5px;
}
.lic-bdt-label {
  font-size: 10.5px;
  color: #475569;
}
.lic-bdt-val {
  font-size: 12px;
  font-weight: 700;
  color: #34d399;
  font-family: 'Outfit', sans-serif;
}

.no-items-msg {
  text-align: center;
  padding: 20px 0 10px;
  font-size: 12.5px;
  color: #334155;
  font-style: italic;
}

/* ════════════════════════════════════════════════════════
   CANVAS AREA
═══════════════════════════════════════════════════════════ */
.canvas-area {
  flex: 1;
  overflow: auto;
  background: var(--canvas-bg);
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(99,102,241,0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(16,185,129,0.03) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 32px 60px;
}
.canvas-area::-webkit-scrollbar { width: 6px; }
.canvas-area::-webkit-scrollbar-track { background: transparent; }
.canvas-area::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
.canvas-area::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* Canvas top bar */
.canvas-bar {
  width: 800px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 12px;
  flex-shrink: 0;
}
.canvas-bar-left {
  display: flex;
  align-items: center;
  gap: 7px;
}
.canvas-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }
.canvas-title {
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  margin-left: 4px;
}
.canvas-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.canvas-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(234,179,8,0.15);
  color: #fbbf24;
  border: 1px solid rgba(234,179,8,0.2);
}
.canvas-size {
  font-size: 11px;
  color: #334155;
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════
   INVOICE PAPER
═══════════════════════════════════════════════════════════ */
#invoice-paper {
  background: #ffffff;
  width: 800px;
  min-height: 1130px;
  border-radius: 12px;
  padding: 52px 56px 48px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.06),
    0 4px 16px rgba(0,0,0,0.15),
    0 20px 60px rgba(0,0,0,0.35),
    0 40px 100px rgba(0,0,0,0.2);
  font-family: 'Inter', sans-serif;
  color: #1e293b;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
}

/* ── Invoice Header ── */
.ih-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}

.ih-agency {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1;
}

.ih-logo-wrap { flex-shrink: 0; }
.ih-logo-img {
  max-height: 64px;
  max-width: 160px;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

.ih-agency-info { flex: 1; }
.ih-agency-name {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
  line-height: 1.2;
}
.ih-contacts {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ih-contacts span {
  font-size: 12px;
  color: #64748b;
  font-weight: 400;
}
.ih-addr {
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
  margin-top: 4px;
  white-space: pre-line;
}

.ih-invoice-meta {
  text-align: right;
  flex-shrink: 0;
  min-width: 220px;
}
.ih-doc-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 5px;
  background: var(--inv-doc-badge-bg);
  color: var(--inv-doc-badge-fg);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.ih-inv-num {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}
.ih-meta-table { text-align: left; }
.ih-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.ih-meta-k {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
  min-width: 80px;
  flex-shrink: 0;
}
.ih-meta-v {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}
.ih-status-chip {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
}
.ih-status-chip.status-paid {
  background: #dcfce7;
  color: #16a34a;
  border-color: #bbf7d0;
}
.ih-status-chip.status-sent {
  background: #dbeafe;
  color: #2563eb;
  border-color: #bfdbfe;
}
.ih-status-chip.status-overdue {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fecaca;
}

/* ── Accent Rule ── */
.ih-rule {
  height: 3px;
  background: linear-gradient(90deg, var(--inv-rule-color) 0%, var(--inv-accent-light) 100%);
  border-radius: 2px;
  margin-bottom: 28px;
}

/* ── Bill To + Rate Row ── */
.bill-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 32px;
}

.bill-to-block { flex: 1; }
.inv-sec-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--inv-accent);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.inv-sec-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--inv-accent-light);
  max-width: 60px;
}
.bill-name {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
}
.bill-company {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
}
.bill-addr {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.6;
  white-space: pre-line;
}

.rate-chip {
  background: var(--inv-accent-xlight);
  border: 1px solid var(--inv-accent-light);
  border-radius: 10px;
  padding: 12px 16px;
  text-align: center;
  flex-shrink: 0;
  min-width: 160px;
}
.rate-chip-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--inv-accent);
  margin-bottom: 4px;
}
.rate-chip-val {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--inv-accent-dark);
}
.rate-chip-sub {
  font-size: 10px;
  color: var(--inv-accent);
  margin-top: 2px;
  opacity: 0.7;
}

/* ── Line Items Table ── */
.inv-table-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  margin-bottom: 0;
}
.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.inv-table thead tr {
  background: var(--inv-table-hd-bg);
}
.inv-table thead th {
  padding: 11px 14px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--inv-table-hd-fg);
  white-space: nowrap;
}
.inv-table thead th:first-child { border-radius: 0; }

.tc-no   { width: 40px; text-align: center; }
.tc-plat { width: 120px; }
.tc-desc { }
.tc-usd  { width: 105px; text-align: right; }
.tc-bdt  { width: 115px; text-align: right; }

.inv-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s;
}
.inv-table tbody tr:last-child { border-bottom: none; }
.inv-table tbody tr.inv-row-even { background: #ffffff; }
.inv-table tbody tr.inv-row-odd  { background: #f8fafc; }
.inv-table tbody tr:hover { background: var(--inv-accent-xlight); }

.inv-table td {
  padding: 12px 14px;
  vertical-align: middle;
  color: #334155;
}
.inv-table td.tc-no  { text-align: center; font-weight: 600; color: #94a3b8; font-size: 12px; }
.inv-table td.tc-usd { text-align: right; font-weight: 500; color: #64748b; font-family: 'Outfit', monospace; }
.inv-table td.tc-bdt { text-align: right; font-weight: 700; color: #0f172a; font-family: 'Outfit', monospace; }
.inv-table td.tc-desc { color: #475569; line-height: 1.4; }

.inv-empty-row td {
  text-align: center;
  padding: 32px 16px;
  color: #94a3b8;
  font-size: 13px;
  font-style: italic;
  background: #fafafa;
}

/* Platform badge */
.plat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.plat-badge .plat-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Financial Summary ── */
.inv-fin-wrap {
  display: flex;
  margin-top: 24px;
  margin-bottom: 28px;
}
.inv-fin-spacer { flex: 1; }
.inv-fin-box {
  width: 340px;
  flex-shrink: 0;
}

.fin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
}
.fin-k {
  font-size: 12.5px;
  color: #64748b;
  font-weight: 500;
}
.fin-vals {
  display: flex;
  align-items: center;
  gap: 16px;
}
.fin-usd {
  font-size: 12px;
  color: #94a3b8;
  min-width: 80px;
  text-align: right;
  font-family: 'Outfit', monospace;
}
.fin-bdt {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  min-width: 100px;
  text-align: right;
  font-family: 'Outfit', monospace;
}
.fin-advance {
  color: #dc2626;
}
.fin-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 6px 0;
}
.fin-grand-row .fin-k {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}
.fin-grand-bdt {
  font-size: 15px !important;
  color: var(--inv-accent-dark) !important;
}

/* Net Due Badge */
.net-due-badge {
  margin-top: 14px;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--inv-net-grad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.net-due-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
}
.net-due-amount {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.5px;
}

/* ── Payment Instructions Section ── */
.inv-pay-section-wrap {
  margin-top: 28px;
}
.inv-pay-section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--inv-accent);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--inv-accent-light);
  display: flex;
  align-items: center;
  gap: 8px;
}
.inv-pay-section-title::before {
  content: '';
  width: 3px;
  height: 14px;
  background: var(--inv-accent);
  border-radius: 2px;
}

.inv-pay-cards {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 12px;
}

/* Bank card stretches to fill remaining space */
.inv-pay-card {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 13px 15px;
  background: #f8fafc;
}

/* bKash & Nagad are compact fixed-width — they only have 2 rows */
.inv-pay-card.card-bkash,
.inv-pay-card.card-nagad {
  flex: 0 0 158px;
  min-width: 158px;
  padding: 11px 13px;
}

.inv-pay-card-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}
.inv-pay-icon {
  font-size: 15px;
  line-height: 1;
}
.inv-pay-method {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  font-family: 'Outfit', sans-serif;
}
.inv-pay-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 5px;
  gap: 8px;
  flex-wrap: nowrap;
}
.inv-pay-detail-row:last-child { margin-bottom: 0; }
.inv-pay-dk {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  flex-shrink: 0;
}
.inv-pay-dv {
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
  text-align: right;
  white-space: nowrap;      /* keep value on a single line */
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-pay-card.card-bkash { border-color: #fbcfe8; background: #fdf2f8; }
.inv-pay-card.card-bkash .inv-pay-card-hd { border-color: #fbcfe8; }
.inv-pay-card.card-nagad  { border-color: #fed7aa; background: #fff7ed; }
.inv-pay-card.card-nagad  .inv-pay-card-hd { border-color: #fed7aa; }

/* ── Notes ── */
.inv-notes-wrap {
  margin-top: 24px;
  padding: 16px 20px;
  background: var(--inv-accent-xlight);
  border: 1px solid var(--inv-accent-light);
  border-left: 3px solid var(--inv-accent);
  border-radius: 8px;
}
.inv-notes-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--inv-accent);
  margin-bottom: 6px;
}
.inv-notes-body {
  font-size: 12.5px;
  color: #475569;
  line-height: 1.7;
}

/* ── Footer ── */
.inv-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid #f1f5f9;
}
.inv-footer-l {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
}
.inv-footer-r {
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
}

/* ════════════════════════════════════════════════════════
   TOAST NOTIFICATION
═══════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  color: #ffffff;
  max-width: 320px;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
}
.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.toast-success {
  background: rgba(5, 150, 105, 0.95);
  border: 1px solid rgba(52,211,153,0.4);
}
.toast-error {
  background: rgba(185, 28, 28, 0.95);
  border: 1px solid rgba(248,113,113,0.4);
}
.toast-info {
  background: rgba(37, 99, 235, 0.95);
  border: 1px solid rgba(147,197,253,0.4);
}
.toast-warn {
  background: rgba(180, 83, 9, 0.95);
  border: 1px solid rgba(252,211,77,0.4);
}

/* ════════════════════════════════════════════════════════
   EXPORT LOADING OVERLAY
═══════════════════════════════════════════════════════════ */
.export-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.export-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
.export-spinner-box {
  background: rgba(15,23,42,0.97);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 28px 36px;
  text-align: center;
  min-width: 200px;
}
.export-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: #818cf8;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.export-spinner-label {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}
