/* ============================================================
   Invoice Reloaded — Design System v4
   Aesthetic: Premium Financial Dashboard
   Refined dark-first, editorial luxury
   Fonts: DM Serif Display + DM Sans + DM Mono
============================================================ */

/* ─── DESIGN TOKENS ─────────────────────────────────────── */
:root {
  --bg:         #08080e;
  --bg2:        #0e0e18;
  --bg3:        #141420;
  --bg4:        #1a1a28;
  --surface:    #1e1e2e;
  --border:     #1f1f30;
  --border2:    #2a2a3e;
  --border3:    #363650;
  --text:       #eaeaf4;
  --text2:      #9090b0;
  --text3:      #4a4a68;
  --text4:      #2d2d48;
  --accent:     #c8a86a;
  --accent2:    #e8ca7e;
  --accent3:    rgba(200,168,106,0.12);
  --success:    #4ecb94;
  --success-bg: rgba(78,203,148,0.08);
  --danger:     #e05c6a;
  --danger-bg:  rgba(224,92,106,0.08);
  --warning:    #e0a040;
  --warning-bg: rgba(224,160,64,0.08);
  --info:       #5b9cf6;
  --info-bg:    rgba(91,156,246,0.08);
  --white:      #ffffff;

  --shadow-xs:  0 1px 4px rgba(0,0,0,0.4);
  --shadow-sm:  0 2px 12px rgba(0,0,0,0.5);
  --shadow:     0 4px 24px rgba(0,0,0,0.6);
  --shadow-lg:  0 8px 48px rgba(0,0,0,0.7);
  --shadow-accent: 0 8px 32px rgba(200,168,106,0.18);

  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;

  --header-h:      62px;
  --mobile-nav-h:  66px;
  --trans:         0.18s ease;
  --trans-slow:    0.35s ease;
}

[data-theme="light"] {
  --bg:      #f0eeea;
  --bg2:     #fafaf8;
  --bg3:     #f4f2ed;
  --bg4:     #ede9e2;
  --surface: #ffffff;
  --border:  #e0ddd6;
  --border2: #d0cdc4;
  --border3: #bab6ae;
  --text:    #16161e;
  --text2:   #5c5a6e;
  --text3:   #9a98a8;
  --text4:   #c0bece;
  --accent:  #9a7840;
  --accent2: #b89050;
  --accent3: rgba(154,120,64,0.1);
  --shadow-xs:  0 1px 4px rgba(0,0,0,0.08);
  --shadow-sm:  0 2px 12px rgba(0,0,0,0.1);
  --shadow:     0 4px 24px rgba(0,0,0,0.12);
  --shadow-lg:  0 8px 48px rgba(0,0,0,0.14);
}

/* ─── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.6;
  height: 100%;
  overflow-x: hidden;
  transition: background var(--trans-slow), color var(--trans-slow);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: #000; }
a { color: var(--accent); text-decoration: none; }
button { font-family: var(--font-body); }
input, textarea, select { font-family: var(--font-body); }

::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border3); }

/* ─── HEADER ─────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(8,8,14,0.92);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}
[data-theme="light"] .site-header {
  background: rgba(250,250,248,0.92);
}
.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 24px;
  gap: 0;
  max-width: 1680px;
  margin: 0 auto;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 32px;
}
.logo-mark {
  height: 46px;
  width: auto;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-mark img {
  height: 46px;
  width: auto;
  display: block;
  object-fit: contain;
}
.logo-text {
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--text);
  letter-spacing: -0.4px;
  line-height: 1;
}
.header-nav {
  display: flex;
  gap: 2px;
  flex: 1;
  align-items: center;
}
.nav-btn {
  background: none;
  border: none;
  color: var(--text3);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--trans);
  letter-spacing: 0.1px;
  position: relative;
}
.nav-btn:hover { color: var(--text); background: var(--bg3); }
.nav-btn.active { color: var(--text); background: var(--bg3); }
.nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 16px; right: 16px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.theme-toggle {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text3);
  width: 34px; height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--trans);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); background: var(--accent3); }

/* ─── LAYOUT ─────────────────────────────────────────────── */
.app-layout {
  margin-top: var(--header-h);
  /* mobile nav padding applied only at mobile breakpoint */
  min-height: calc(100vh - var(--header-h));
}
.view { display: none; }
.view.active { display: block; }

/* ─── BUILDER ────────────────────────────────────────────── */
.builder-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  /* desktop: full remaining viewport, no mobile-nav subtraction */
  height: calc(100vh - var(--header-h));
  overflow: hidden;
  width: 100%;
}
.form-panel {
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg2);
}
.panel-scroll {
  overflow-y: auto;
  padding: 20px 18px 32px;
  flex: 1;
}
.form-section { margin-bottom: 18px; }
.form-section.two-col  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-section.four-col { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }

/* ─── DOC TYPE TABS ──────────────────────────────────────── */
.doc-type-tabs {
  display: flex; gap: 2px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.doc-tab {
  flex: 1; background: none; border: none;
  color: var(--text3);
  font-size: 11.5px; font-weight: 500;
  padding: 7px 6px; border-radius: 6px;
  cursor: pointer; transition: all var(--trans);
  white-space: nowrap; letter-spacing: 0.1px;
}
.doc-tab:hover { color: var(--text2); }
.doc-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* ─── FORM ELEMENTS ──────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-label {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.7px; text-transform: uppercase;
  color: var(--text3);
  display: flex; align-items: center; gap: 4px;
}
.field-input {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 13px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  width: 100%; outline: none;
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
  resize: none;
  appearance: none;
}
.field-input:hover { border-color: var(--border3); }
.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200,168,106,0.12);
  background: var(--bg4);
}
.field-input::placeholder { color: var(--text4); }
textarea.field-input { line-height: 1.55; }
select.field-input {
  cursor: pointer;
  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='%234a4a68' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  padding-right: 32px;
}
.short-input { max-width: 108px; }

/* ─── LOGO UPLOAD ────────────────────────────────────────── */
.logo-upload-wrap { margin-bottom: 7px; }
.logo-preview {
  border: 1px dashed var(--border3);
  border-radius: var(--radius-sm);
  padding: 10px 14px; cursor: pointer;
  min-height: 42px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--trans); background: var(--bg3);
}
.logo-preview:hover { border-color: var(--accent); background: var(--bg4); }
.logo-upload-icon { font-size: 11px; color: var(--text3); font-weight: 500; }

/* ─── CONTACT AUTOFILL ───────────────────────────────────── */
.contact-autofill { position: relative; }
.contacts-dropdown {
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border2);
  border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 50; max-height: 160px; overflow-y: auto;
  display: none; box-shadow: var(--shadow);
}
.dropdown-item {
  padding: 9px 12px; cursor: pointer; font-size: 13px;
  transition: background var(--trans);
  border-bottom: 1px solid var(--border);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--bg4); }
.dropdown-item-name { font-weight: 500; font-size: 13px; }
.dropdown-item-company { font-size: 11px; color: var(--text2); }

/* ─── LINE ITEMS ─────────────────────────────────────────── */
.line-item-header {
  display: grid;
  grid-template-columns: 1fr 76px 88px 88px 28px;
  gap: 5px; padding: 0 0 5px;
  border-bottom: 1px solid var(--border); margin-bottom: 5px;
}
.line-item-row {
  display: grid;
  grid-template-columns: 1fr 76px 88px 88px 28px;
  gap: 5px; margin-bottom: 5px; align-items: center;
  animation: fadeUp 0.2s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.item-label {
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.7px; text-transform: uppercase;
  color: var(--text4); padding: 0 2px;
}
.item-amount {
  font-family: var(--font-mono); font-size: 12px; color: var(--text2);
  padding: 9px 6px; text-align: right;
  display: flex; align-items: center; justify-content: flex-end;
}
.remove-item-btn {
  background: none; border: none; color: var(--text4);
  cursor: pointer; font-size: 15px; border-radius: 4px;
  transition: all var(--trans);
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
}
.remove-item-btn:hover { color: var(--danger); background: var(--danger-bg); }

/* ─── TOTALS ─────────────────────────────────────────────── */
.totals-inputs { display: flex; gap: 10px; flex-wrap: wrap; }
.total-row-input { display: flex; flex-direction: column; gap: 5px; }

/* ─── BUTTONS ────────────────────────────────────────────── */
.ghost-btn {
  background: none;
  border: 1px dashed var(--border3); color: var(--text3);
  font-size: 12px; font-weight: 500;
  padding: 7px 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--trans); letter-spacing: 0.1px;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent3); }
.add-item-btn { margin-top: 4px; }

.cta-row { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }

.btn-primary {
  background: var(--accent); color: #08080e;
  border: none; font-size: 13px; font-weight: 600;
  padding: 10px 20px; border-radius: var(--radius-sm);
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: all var(--trans); letter-spacing: 0.1px;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); box-shadow: var(--shadow-accent); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.small  { padding: 7px 14px; font-size: 12px; }

.btn-secondary {
  background: var(--bg4); border: 1px solid var(--border2); color: var(--text);
  font-size: 13px; font-weight: 500;
  padding: 10px 18px; border-radius: var(--radius-sm);
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: all var(--trans); white-space: nowrap;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent3); }

.btn-ghost {
  background: none; border: 1px solid var(--border); color: var(--text3);
  font-size: 13px; font-weight: 500;
  padding: 10px 18px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--trans);
}
.btn-ghost:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }

.btn-share {
  background: linear-gradient(135deg, #25D366, #1aad52);
  color: #fff; border: none;
  font-size: 13px; font-weight: 600;
  padding: 10px 18px; border-radius: var(--radius-sm);
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: all var(--trans);
}
.btn-share:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,211,102,0.3); }

/* ─── PREVIEW PANEL ──────────────────────────────────────── */
.preview-panel {
  background: var(--bg); display: flex; flex-direction: column; overflow: hidden;
}
.preview-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 48px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.preview-label {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: var(--text3);
}
.preview-actions { display: flex; gap: 6px; }
.toolbar-btn {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); font-size: 11px; font-weight: 500;
  padding: 5px 12px; border-radius: 6px; cursor: pointer;
  transition: all var(--trans); letter-spacing: 0.2px;
}
.toolbar-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent3); }
[data-theme="light"] .toolbar-btn { color: var(--text); border-color: var(--border2); }
.preview-scroll {
  flex: 1; overflow-y: auto; padding: 28px 24px;
  display: flex; align-items: flex-start; justify-content: center;
}

/* ─── INVOICE PAPER ──────────────────────────────────────── */
.invoice-paper {
  background: #fff; color: #111;
  width: 100%; max-width: 720px; min-height: 900px;
  border-radius: 3px; padding: 52px 56px;
  box-shadow: 0 12px 60px rgba(0,0,0,0.35);
  font-family: 'DM Sans', sans-serif; font-size: 13px;
  line-height: 1.6; position: relative; transition: all var(--trans-slow);
}
/* Modern/dark invoice style */
.invoice-paper.style-modern {
  background: #0c0c18; color: #e0e0f0;
  box-shadow: 0 12px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
}

/* Invoice internals */
.inv-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; }
.inv-logo-wrap { max-width: 160px; max-height: 80px; overflow: hidden; }
.inv-logo-wrap img { max-width: 100%; max-height: 80px; object-fit: contain; }
.inv-title-block { text-align: right; }
.inv-doc-type { font-family: 'DM Serif Display', serif; font-size: 30px; letter-spacing: -0.5px; line-height: 1.05; }
.inv-doc-num { font-size: 11.5px; color: #999; margin-top: 5px; font-family: 'DM Mono', monospace; letter-spacing: 0.5px; }
.inv-accent-bar { height: 2px; background: linear-gradient(90deg, #c9a96e 0%, #e8c87a 60%, transparent 100%); margin-bottom: 28px; }

.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 24px; }
.inv-party-label { font-size: 8.5px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; color: #bbb; margin-bottom: 6px; }
.inv-party-value { font-size: 12.5px; white-space: pre-line; line-height: 1.65; }

.inv-meta {
  display: grid; gap: 0; margin-bottom: 24px;
  background: #f7f6f2; border-radius: 6px; overflow: hidden;
}
.inv-meta-item { padding: 11px 16px; border-right: 1px solid #eee; }
.inv-meta-item:last-child { border-right: none; }
.inv-meta-label { font-size: 8px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: #bbb; margin-bottom: 4px; }
.inv-meta-value { font-size: 12.5px; font-family: 'DM Mono', monospace; font-weight: 600; color: #222; }

.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.inv-table th {
  background: #f4f2ec; font-size: 8.5px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: #999;
  padding: 10px 12px; text-align: left;
  border-bottom: 2px solid #e8e6de;
}
.inv-table th:last-child, .inv-table td:last-child { text-align: right; }
.inv-table td {
  padding: 11px 12px; border-bottom: 1px solid #f0eee8;
  font-size: 13px; vertical-align: top;
}
.inv-table td:nth-child(2), .inv-table td:nth-child(3), .inv-table td:nth-child(4) {
  font-family: 'DM Mono', monospace; font-size: 12px; white-space: nowrap; color: #444;
}
.inv-table tbody tr:last-child td { border-bottom: none; }

.inv-totals { display: flex; justify-content: flex-end; margin-bottom: 20px; }
.inv-totals-table { width: 270px; }
.inv-totals-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 13px; }
.inv-totals-row.final {
  background: #f4f2ec; padding: 10px 14px; border-radius: 6px;
  font-weight: 700; font-size: 15px; margin: 6px 0;
}
.inv-totals-label { color: #777; font-size: 12px; }
.inv-totals-value { font-family: 'DM Mono', monospace; font-weight: 600; }
.inv-totals-divider { height: 1px; background: #e8e6de; margin: 6px 0; }
.inv-due-row { font-weight: 700; font-size: 14px; }

.inv-pay-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 9.5px; font-weight: 800; letter-spacing: 1.2px;
  padding: 5px 13px; border-radius: 4px; margin-bottom: 18px;
  text-transform: uppercase;
}
.inv-pay-badge--paid    { background: rgba(78,203,148,0.12); color: #1a8a5c; border: 1px solid rgba(78,203,148,0.35); }
.inv-pay-badge--partial { background: rgba(224,160,64,0.12);  color: #a06820; border: 1px solid rgba(224,160,64,0.35); }
.inv-pay-badge--unpaid  { background: rgba(224,92,106,0.08);  color: #b84050; border: 1px solid rgba(224,92,106,0.3); }

.inv-notes {
  background: #f7f6f2; padding: 14px 16px; border-radius: 6px;
  font-size: 11.5px; color: #666; line-height: 1.75;
  margin-top: 8px; white-space: pre-line;
}
.inv-notes-label { font-size: 8px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: #bbb; margin-bottom: 6px; }
.inv-footer {
  margin-top: 36px; padding-top: 14px; border-top: 1px solid #ece9e0;
  text-align: center; font-size: 9.5px; color: #ccc; font-family: 'DM Mono', monospace;
}

/* Modern/dark overrides */
.invoice-paper.style-modern .inv-meta       { background: #13131f; border: 1px solid #1e1e30; }
.invoice-paper.style-modern .inv-meta-item  { border-right-color: #1e1e30; }
.invoice-paper.style-modern .inv-meta-label { color: #4a4a70; }
.invoice-paper.style-modern .inv-meta-value { color: #d0d0e8; }
.invoice-paper.style-modern .inv-table th   { background: #13131f; color: #4a4a70; border-bottom-color: #1e1e30; }
.invoice-paper.style-modern .inv-table td   { border-bottom-color: #191929; color: #c0c0d8; }
.invoice-paper.style-modern .inv-table td:nth-child(2),
.invoice-paper.style-modern .inv-table td:nth-child(3),
.invoice-paper.style-modern .inv-table td:nth-child(4) { color: #9090b0; }
.invoice-paper.style-modern .inv-totals-row    { color: #c0c0d8; }
.invoice-paper.style-modern .inv-totals-label  { color: #606080; }
.invoice-paper.style-modern .inv-totals-row.final { background: #13131f; color: #e0e0f0; }
.invoice-paper.style-modern .inv-totals-divider { background: #1e1e30; }
.invoice-paper.style-modern .inv-notes      { background: #13131f; color: #707090; }
.invoice-paper.style-modern .inv-footer     { border-top-color: #1e1e30; color: #3a3a58; }
.invoice-paper.style-modern .inv-party-label { color: #4a4a70; }
.invoice-paper.style-modern .inv-doc-num    { color: #505070; }
.invoice-paper.style-modern .inv-pay-badge--paid    { color: #4ecb94; background: rgba(78,203,148,0.1); }
.invoice-paper.style-modern .inv-pay-badge--partial { color: #e0a040; background: rgba(224,160,64,0.1); }
.invoice-paper.style-modern .inv-pay-badge--unpaid  { color: #e05c6a; background: rgba(224,92,106,0.1); }

/* ─── SECTION HEADER ─────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }

/* ─── META CORE ROW ──────────────────────────────────────── */
.meta-core-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }

/* ─── OPTIONAL FIELDS ────────────────────────────────────── */
.optional-fields-bar {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--bg3);
  border: 1px dashed var(--border2); border-radius: var(--radius-sm);
  margin-bottom: 4px;
}
.opt-label { font-size: 9.5px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: var(--text4); }
.opt-toggle-btn {
  background: none; border: 1px solid var(--border2); color: var(--text3);
  font-size: 11px; font-weight: 500; padding: 3px 10px; border-radius: 20px;
  cursor: pointer; transition: all var(--trans);
}
.opt-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.opt-toggle-btn.active { background: var(--accent3); border-color: var(--accent); color: var(--accent); }
.opt-field-wrap { margin-top: 9px; animation: fadeUp 0.18s ease; }
.opt-remove-btn {
  background: none; border: none; color: var(--text4); cursor: pointer;
  font-size: 10px; margin-left: 5px; padding: 0 2px;
  border-radius: 3px; transition: color var(--trans); vertical-align: middle;
}
.opt-remove-btn:hover { color: var(--danger); }
.field-hint { font-size: 9.5px; color: var(--text4); font-weight: 400; margin-left: 5px; letter-spacing: 0; text-transform: none; }

/* ─── BILL-TO HEADER ─────────────────────────────────────── */
.bill-to-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.pick-contact-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg3); border: 1px solid var(--border2); color: var(--accent);
  font-size: 10.5px; font-weight: 600; padding: 4px 10px;
  border-radius: 20px; cursor: pointer; transition: all var(--trans);
}
.pick-contact-btn:hover { background: var(--accent3); border-color: var(--accent); }

/* ─── INV NUM BADGE ──────────────────────────────────────── */
.inv-num-badge {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-size: 8.5px; font-weight: 700; letter-spacing: 0.8px; color: var(--accent);
  background: var(--accent3); padding: 2px 6px; border-radius: 4px; pointer-events: none;
}

/* ─── PAGE CONTAINER ─────────────────────────────────────── */
.page-container { max-width: 1080px; margin: 0 auto; padding: 32px 28px; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-family: var(--font-display); font-size: 26px; letter-spacing: -0.4px; line-height: 1.1; }

/* ─── FILTER CHIPS ───────────────────────────────────────── */
.filter-row { display: flex; gap: 5px; flex-wrap: wrap; }
.filter-chip {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text3); font-size: 11.5px; font-weight: 500;
  padding: 5px 14px; border-radius: 20px; cursor: pointer; transition: all var(--trans);
}
.filter-chip:hover { background: var(--bg4); color: var(--text2); border-color: var(--border2); }
.filter-chip.active { background: var(--accent); color: #08080e; border-color: var(--accent); font-weight: 700; }

/* ─── HISTORY / AUDIT DASHBOARD ──────────────────────────── */

/* Top header bar of history view */
.history-topbar {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  margin-bottom: 28px;
}
.history-topbar-left { display: flex; flex-direction: column; gap: 10px; }
.history-topbar-right {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* Currency picker inside history */
.hist-currency-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: var(--radius-sm);
}
.hist-currency-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: var(--text3); }
.hist-currency-select {
  background: none; border: none; color: var(--accent);
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  cursor: pointer; outline: none; padding: 0 4px 0 0;
  appearance: none;
}
.hist-currency-select option { background: var(--bg2); color: var(--text); }

/* Audit summary cards */
.audit-banner {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 14px; margin-bottom: 32px;
}
.audit-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 22px 18px;
  display: flex; flex-direction: column; gap: 3px;
  transition: all var(--trans); position: relative; overflow: hidden;
}
.audit-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--border2);
}
.audit-card--green::before { background: linear-gradient(90deg, var(--success), transparent); }
.audit-card--red::before   { background: linear-gradient(90deg, var(--danger), transparent); }
.audit-card--main::before  { background: linear-gradient(90deg, var(--accent), transparent); }
.audit-card:hover { border-color: var(--border3); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.audit-icon { font-size: 15px; margin-bottom: 10px; line-height: 1; }
.audit-card-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.9px;
  text-transform: uppercase; color: var(--text3);
}
.audit-card-amount {
  font-family: var(--font-mono); font-size: 26px; font-weight: 700;
  color: var(--text); letter-spacing: -1px; line-height: 1.1; margin: 4px 0;
}
.audit-card--green .audit-card-amount { color: var(--success); }
.audit-card--red   .audit-card-amount { color: var(--danger); }
.audit-card--main  .audit-card-amount { color: var(--accent); }
.audit-card-sub { font-size: 11px; color: var(--text3); }
.audit-card-trend {
  font-size: 11px; font-weight: 600; margin-top: 4px;
  display: flex; align-items: center; gap: 4px;
}
.trend-up   { color: var(--success); }
.trend-down { color: var(--danger); }

/* Month groups */
.month-group { margin-bottom: 32px; }
.month-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 14px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.month-title {
  font-family: var(--font-display); font-size: 18px;
  color: var(--text); letter-spacing: -0.3px;
}
.month-totals { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.month-pill {
  font-size: 11px; font-weight: 600;
  padding: 4px 12px; border-radius: 20px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text3); white-space: nowrap;
  display: flex; align-items: center; gap: 5px;
}
.month-pill strong { color: var(--text2); font-weight: 700; }
.month-pill.pill-green { background: var(--success-bg); border-color: rgba(78,203,148,0.25); }
.month-pill.pill-green strong { color: var(--success); }
.month-pill.pill-red   { background: var(--danger-bg);  border-color: rgba(224,92,106,0.25); }
.month-pill.pill-red   strong { color: var(--danger); }
.month-rows { display: flex; flex-direction: column; gap: 8px; }

/* History card — v3 mature design */
.history-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: all var(--trans);
  animation: fadeUp 0.22s ease;
}
.history-card:hover {
  border-color: var(--border3);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

/* Left accent line by status */
.history-card[data-status="paid"]    { border-left: 3px solid var(--success); }
.history-card[data-status="partial"] { border-left: 3px solid var(--warning); }
.history-card[data-status="unpaid"]  { border-left: 3px solid var(--border2); }
.history-card[data-status="overdue"] { border-left: 3px solid var(--danger); }

.hcard-main {
  display: flex; align-items: center;
  gap: 12px; padding: 14px 18px;
  flex-wrap: wrap;
}
.history-card-num {
  font-family: var(--font-mono); font-size: 11.5px;
  color: var(--accent); font-weight: 600; min-width: 80px;
  letter-spacing: 0.3px;
}
.history-card-client {
  flex: 1; font-weight: 600; font-size: 14px; min-width: 100px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-card-date { font-size: 11.5px; color: var(--text3); white-space: nowrap; }

/* Money row inside history card */
.hcard-money {
  display: grid; grid-template-columns: 1fr 1fr 1fr auto;
  gap: 0; border-top: 1px solid var(--border);
  background: var(--bg3);
}
.hcard-money-col {
  padding: 10px 16px; display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--border);
}
.hcard-money-col:last-child { border-right: none; }
.hcard-actions-col {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 14px; justify-content: flex-end;
}
.hcard-money-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.9px;
  text-transform: uppercase; color: var(--text4);
}
.hcard-money-val {
  font-family: var(--font-mono); font-size: 13.5px; font-weight: 700;
  color: var(--text2);
}
.val-green { color: var(--success) !important; }
.val-red   { color: var(--danger)  !important; }
.val-muted { color: var(--text4)   !important; }

/* Status badges */
.status-badge {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.7px;
  text-transform: uppercase; padding: 3px 9px; border-radius: 20px;
  white-space: nowrap;
}
.status-paid    { background: var(--success-bg); color: var(--success); }
.status-unpaid  { background: var(--warning-bg); color: var(--warning); }
.status-overdue { background: var(--danger-bg);  color: var(--danger);  }
.status-partial { background: rgba(200,168,106,0.12); color: var(--accent); }

/* Action buttons in card */
.hist-action-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text3); font-size: 10.5px; font-family: var(--font-body); font-weight: 500;
  padding: 4px 10px; border-radius: 6px; cursor: pointer; transition: all var(--trans);
  white-space: nowrap;
}
.hist-action-btn:hover       { border-color: var(--accent); color: var(--accent); background: var(--accent3); }
.hist-action-btn.pay-btn:hover { border-color: var(--success); color: var(--success); background: var(--success-bg); }
.hist-action-btn.del:hover   { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }

/* ─── EMPTY STATE ────────────────────────────────────────── */
.empty-state { text-align: center; padding: 72px 20px; color: var(--text3); }
.empty-state-icon { font-size: 36px; margin-bottom: 14px; opacity: 0.25; }
.empty-state p { font-size: 13.5px; max-width: 340px; margin: 0 auto; line-height: 1.7; }

/* ─── CONTACTS ───────────────────────────────────────────── */
.contacts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 12px; }
.contact-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  transition: all var(--trans); animation: fadeUp 0.2s ease;
}
.contact-card:hover { border-color: var(--border2); box-shadow: var(--shadow-sm); }
.contact-card-avatar {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 17px; color: #08080e;
  margin-bottom: 12px; font-weight: 700; flex-shrink: 0;
}
.contact-card-name    { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.contact-card-company { font-size: 12px; color: var(--text2); margin-bottom: 8px; }
.contact-card-email   { font-size: 11.5px; color: var(--text3); font-family: var(--font-mono); }
.contact-card-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.contact-use-btn {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); font-size: 11px; font-weight: 500;
  padding: 5px 12px; border-radius: 6px; cursor: pointer; transition: all var(--trans);
}
.contact-use-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent3); }
.contact-del-btn {
  background: none; border: 1px solid var(--border); color: var(--text4);
  font-size: 11px; padding: 5px 9px; border-radius: 6px;
  cursor: pointer; transition: all var(--trans);
}
.contact-del-btn:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200; display: none; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(6px);
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg); animation: modalIn 0.24s ease;
  max-height: 90vh; overflow-y: auto;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--bg2); z-index: 1; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header h3 { font-family: var(--font-display); font-size: 19px; }
.modal-close {
  background: none; border: none; color: var(--text3); font-size: 18px;
  cursor: pointer; padding: 4px; border-radius: 5px; transition: color var(--trans);
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--danger); background: var(--danger-bg); }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 24px 20px; border-top: 1px solid var(--border);
}

/* ─── SHARE MODAL ────────────────────────────────────────── */
.modal-box--share  { max-width: 460px; }
.modal-box--picker { max-width: 420px; }
.share-body { padding: 20px 24px 24px; }
.share-hint { font-size: 12px; color: var(--text2); margin-bottom: 16px; }
.share-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 12px; }
.share-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 8px 14px;
  cursor: pointer; display: flex; flex-direction: column; align-items: center;
  gap: 8px; transition: all var(--trans); text-align: center;
}
.share-card:hover { border-color: var(--accent); background: var(--bg4); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.share-card-icon { line-height: 1; }
.share-card-label { font-size: 12.5px; font-weight: 600; color: var(--text); }
.share-card-sub   { font-size: 9.5px; color: var(--text3); line-height: 1.45; }
.share-footnote {
  font-size: 11px; color: var(--text3); background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; line-height: 1.6; margin-top: 4px;
}

/* ─── CONTACT PICKER ─────────────────────────────────────── */
.picker-list { max-height: 320px; overflow-y: auto; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.picker-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 22px; cursor: pointer; transition: background var(--trans);
  border-bottom: 1px solid var(--border);
}
.picker-item:last-child { border-bottom: none; }
.picker-item:hover { background: var(--bg3); }
.picker-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 15px; color: #08080e;
  font-weight: 700; flex-shrink: 0;
}
.picker-info { flex: 1; min-width: 0; }
.picker-name    { font-size: 13.5px; font-weight: 600; }
.picker-company { font-size: 11px; color: var(--text2); }
.picker-email   { font-size: 11px; color: var(--text3); font-family: var(--font-mono); }
.picker-arrow { color: var(--text4); font-size: 14px; flex-shrink: 0; transition: color var(--trans); }
.picker-item:hover .picker-arrow { color: var(--accent); transform: translateX(2px); }
.picker-empty { text-align: center; padding: 32px 20px; color: var(--text3); font-size: 13px; }

/* ─── TEMPLATES MODAL ────────────────────────────────────── */
.modal-box--templates { max-width: 820px; max-height: 85vh; overflow: hidden; display: flex; flex-direction: column; }
.templates-search-bar { padding: 14px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.templates-grid-wrap { flex: 1; overflow-y: auto; padding: 20px 22px 24px; }
.tpl-category { margin-bottom: 24px; }
.tpl-cat-label {
  font-size: 9.5px; font-weight: 800; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--text4); margin-bottom: 10px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.tpl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 8px; }
.tpl-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 12px 12px;
  cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 5px;
  transition: all var(--trans); position: relative;
}
.tpl-card:hover {
  border-color: var(--border3); background: var(--bg4);
  transform: translateY(-2px); box-shadow: var(--shadow-sm);
}
.tpl-card-icon {
  font-size: 20px; line-height: 1; margin-bottom: 3px;
  display: block;
}
.tpl-card-name { font-size: 12.5px; font-weight: 700; color: var(--text); line-height: 1.2; }
.tpl-card-desc { font-size: 10.5px; color: var(--text3); line-height: 1.4; }
.tpl-card-currency {
  position: absolute; top: 8px; right: 9px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  color: var(--accent); background: var(--accent3);
  padding: 1px 6px; border-radius: 3px;
}
.tpl-card:hover .tpl-card-name { color: var(--accent); }

/* Template button in toolbar */
.btn-templates {
  background: var(--bg4); border: 1px solid var(--border2); color: var(--text2);
  font-size: 11px; font-weight: 600; padding: 5px 12px; border-radius: 6px;
  cursor: pointer; transition: all var(--trans);
  display: flex; align-items: center; gap: 5px; letter-spacing: 0.2px;
  white-space: nowrap;
}
.btn-templates:hover { border-color: var(--accent); color: var(--accent); background: var(--accent3); }
.btn-templates-panel {
  background: none; border: 1px dashed var(--border2); color: var(--text2);
  font-size: 12px; font-weight: 500; padding: 8px 16px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--trans); width: 100%; text-align: left;
  display: flex; align-items: center; gap: 8px;
}
.btn-templates-panel:hover { border-color: var(--accent); color: var(--accent); background: var(--accent3); }

/* ─── TOAST ──────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg2); border: 1px solid var(--border2);
  color: var(--text); font-size: 12.5px; font-weight: 600;
  padding: 10px 22px; border-radius: 40px;
  box-shadow: var(--shadow); opacity: 0;
  transition: all 0.3s ease; z-index: 400;
  pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger);  }

/* ─── MOBILE NAV ─────────────────────────────────────────── */
.mobile-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--mobile-nav-h); background: var(--bg2);
  border-top: 1px solid var(--border); z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.mob-nav-btn {
  flex: 1; background: none; border: none; color: var(--text4);
  font-family: var(--font-body); font-size: 9.5px; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 8px 0; cursor: pointer; transition: color var(--trans);
  letter-spacing: 0.4px; text-transform: uppercase;
}
.mob-nav-btn.active, .mob-nav-btn:hover { color: var(--accent); }
.mob-icon { font-size: 20px; line-height: 1; }

/* ─── SMALL BTN ──────────────────────────────────────────── */
.small-btn { padding: 7px 14px !important; font-size: 12px !important; }

/* ─── DIVIDERS ───────────────────────────────────────────── */
.section-divider {
  height: 1px; background: var(--border);
  margin: 20px 0; border: none;
}

/* ═══════════════════════════════════════════════════════════
   INVOICE DESIGN STYLES — 4 Premium Templates
   style-navy  | style-corporate | style-emerald | style-midnight
═══════════════════════════════════════════════════════════ */

/* ── STYLE: NAVY BOLD (Image 1 inspired) ────────────────────
   Dark navy header band, gold accent divider, light body,
   geometric decorative circles, social footer strip        */

.invoice-paper.style-navy {
  background: #f0f4ff;
  color: #1a1a2e;
  padding: 0;
  overflow: hidden;
}

/* Navy header band */
.invoice-paper.style-navy .inv-navy-header {
  background: #1a2447;
  padding: 28px 44px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
}
.invoice-paper.style-navy .inv-navy-header::before {
  content: '';
  position: absolute;
  top: -30px; right: 90px;
  width: 90px; height: 90px;
  border-radius: 50%;
  border: 18px solid rgba(255,255,255,0.08);
}
.invoice-paper.style-navy .inv-navy-header::after {
  content: '';
  position: absolute;
  top: 10px; right: 20px;
  width: 65px; height: 65px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
}

.invoice-paper.style-navy .inv-navy-brand { color: #fff; }
.invoice-paper.style-navy .inv-navy-brand-name {
  font-family: 'DM Serif Display', serif;
  font-size: 22px; font-weight: 700; color: #fff;
  letter-spacing: -0.3px; line-height: 1;
}
.invoice-paper.style-navy .inv-navy-brand-sub {
  font-size: 10px; color: rgba(255,255,255,0.45);
  letter-spacing: 1.2px; text-transform: uppercase;
  margin-top: 4px;
}
.invoice-paper.style-navy .inv-navy-logo-wrap img {
  max-height: 52px; max-width: 130px;
  object-fit: contain; filter: brightness(0) invert(1);
}

.invoice-paper.style-navy .inv-navy-right { text-align: right; }
.invoice-paper.style-navy .inv-navy-doc-label {
  font-size: 36px; font-weight: 900;
  color: #fff; letter-spacing: -1px; line-height: 1;
  text-transform: uppercase;
}
.invoice-paper.style-navy .inv-navy-bill-to-label {
  font-size: 9px; color: rgba(255,255,255,0.5);
  letter-spacing: 1.2px; text-transform: uppercase; margin-top: 12px; margin-bottom: 4px;
}
.invoice-paper.style-navy .inv-navy-bill-to-val {
  font-size: 12px; color: rgba(255,255,255,0.85);
  line-height: 1.55;
}

/* Gold accent stripe */
.invoice-paper.style-navy .inv-navy-stripe {
  height: 5px;
  background: linear-gradient(90deg, #e8c555, #f5a623, #e8c555);
}

/* Body content area */
.invoice-paper.style-navy .inv-navy-body {
  padding: 24px 44px 0;
  background: #f0f4ff;
}

/* Payment info + date row */
.invoice-paper.style-navy .inv-navy-info-row {
  display: grid; grid-template-columns: 1fr auto;
  gap: 24px; margin-bottom: 20px;
  padding: 16px 20px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #dde4f0;
}
.invoice-paper.style-navy .inv-navy-info-label {
  font-size: 8px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: #8890aa; margin-bottom: 5px;
}
.invoice-paper.style-navy .inv-navy-info-val {
  font-size: 12px; color: #1a2447; line-height: 1.6;
}
.invoice-paper.style-navy .inv-navy-info-date {
  text-align: right;
}
.invoice-paper.style-navy .inv-navy-date-val {
  font-size: 13px; font-weight: 700; color: #1a2447;
  font-family: 'DM Mono', monospace;
}

/* Table */
.invoice-paper.style-navy .inv-navy-table {
  width: 100%; border-collapse: collapse; margin-bottom: 0;
}
.invoice-paper.style-navy .inv-navy-table th {
  background: #1a2447;
  color: #fff; font-size: 8.5px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 10px 14px; text-align: left;
}
.invoice-paper.style-navy .inv-navy-table th:last-child { text-align: right; }
.invoice-paper.style-navy .inv-navy-table td {
  padding: 10px 14px; font-size: 12.5px;
  border-bottom: 1px solid #e0e8f5;
  color: #2a3050; vertical-align: top;
}
.invoice-paper.style-navy .inv-navy-table td:nth-child(2),
.invoice-paper.style-navy .inv-navy-table td:nth-child(3),
.invoice-paper.style-navy .inv-navy-table td:nth-child(4) {
  font-family: 'DM Mono', monospace; font-size: 12px;
  color: #556080; text-align: right;
}
.invoice-paper.style-navy .inv-navy-table td:nth-child(1) { font-weight: 500; }
.invoice-paper.style-navy .inv-navy-table tbody tr:last-child td { border-bottom: none; }
.invoice-paper.style-navy .inv-navy-table tbody tr:nth-child(even) td { background: #f7faff; }

/* Totals + notes row */
.invoice-paper.style-navy .inv-navy-bottom {
  display: grid; grid-template-columns: 1fr 240px;
  gap: 20px; padding: 20px 0;
  border-top: 2px solid #1a2447;
  margin-top: 0;
}
.invoice-paper.style-navy .inv-navy-notes-label {
  font-size: 8.5px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: #8890aa; margin-bottom: 6px;
}
.invoice-paper.style-navy .inv-navy-notes-val {
  font-size: 11px; color: #556080; line-height: 1.7;
}
.invoice-paper.style-navy .inv-navy-totals-row {
  display: flex; justify-content: space-between;
  padding: 4px 0; font-size: 12px; color: #2a3050;
}
.invoice-paper.style-navy .inv-navy-totals-row.final {
  background: #1a2447; color: #fff;
  padding: 9px 14px; border-radius: 5px;
  font-weight: 700; font-size: 14px; margin-top: 8px;
}
.invoice-paper.style-navy .inv-navy-totals-row.due {
  background: #fff8e0;
  padding: 7px 14px; border-radius: 5px;
  font-weight: 700; font-size: 13px; margin-top: 4px;
  border: 1px solid #e8c555;
  color: #7a5800;
}
.invoice-paper.style-navy .inv-navy-discount {
  color: #c04040;
}

/* Footer navy band */
.invoice-paper.style-navy .inv-navy-footer {
  background: #1a2447; padding: 14px 44px;
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 0;
}
.invoice-paper.style-navy .inv-navy-footer-url {
  font-size: 11px; color: rgba(255,255,255,0.55);
  font-family: 'DM Mono', monospace;
}
.invoice-paper.style-navy .inv-navy-footer-dots {
  display: flex; gap: 6px; align-items: center;
}
.invoice-paper.style-navy .inv-navy-footer-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.2);
}
.invoice-paper.style-navy .inv-navy-footer-dot:first-child { background: #e8c555; }
.invoice-paper.style-navy .inv-navy-footer-dot:nth-child(2) { background: rgba(255,255,255,0.4); }
.invoice-paper.style-navy .inv-navy-bars {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-end;
}
.invoice-paper.style-navy .inv-navy-bar {
  height: 4px; border-radius: 2px; background: #e8c555;
}

/* ── STYLE: CORPORATE SLASH (Image 2 inspired) ──────────────
   White base, dramatic diagonal corner slashes,
   clean table with colored header, accent color theme     */

.invoice-paper.style-corporate {
  background: #fff;
  color: #1a1a2a;
  padding: 0;
  overflow: hidden;
  position: relative;
}

/* Top-right slash decoration */
.invoice-paper.style-corporate .inv-corp-slash-tr {
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 110px 110px 0;
  border-color: transparent #1a1a2a transparent transparent;
  z-index: 1;
}
.invoice-paper.style-corporate .inv-corp-slash-tr-accent {
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 80px 80px 0;
  border-color: transparent var(--corp-accent, #e8a020) transparent transparent;
  z-index: 2;
}

/* Bottom-left slash */
.invoice-paper.style-corporate .inv-corp-slash-bl {
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 80px 0 0 80px;
  border-color: transparent transparent transparent #1a1a2a;
  z-index: 1;
}
.invoice-paper.style-corporate .inv-corp-slash-bl-accent {
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 55px 0 0 55px;
  border-color: transparent transparent transparent var(--corp-accent, #e8a020);
  z-index: 2;
}

.invoice-paper.style-corporate .inv-corp-body {
  padding: 44px 52px 52px;
  position: relative; z-index: 3;
}

/* Header */
.invoice-paper.style-corporate .inv-corp-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 32px;
}
.invoice-paper.style-corporate .inv-corp-logo-wrap img {
  max-height: 48px; max-width: 130px; object-fit: contain;
}
.invoice-paper.style-corporate .inv-corp-brand-name {
  font-size: 16px; font-weight: 700; color: #1a1a2a; letter-spacing: -0.2px;
}
.invoice-paper.style-corporate .inv-corp-brand-sub {
  font-size: 9px; color: #aaa; letter-spacing: 0.8px; text-transform: uppercase;
}

.invoice-paper.style-corporate .inv-corp-header-right { text-align: right; }
.invoice-paper.style-corporate .inv-corp-doc-label {
  font-size: 34px; font-weight: 900; letter-spacing: -1px;
  color: var(--corp-accent, #e8a020);
  text-transform: uppercase; line-height: 1;
}
.invoice-paper.style-corporate .inv-corp-balance-due {
  font-size: 11px; color: #999; margin-top: 2px;
}
.invoice-paper.style-corporate .inv-corp-balance-amount {
  font-family: 'DM Mono', monospace;
  font-size: 16px; font-weight: 700; color: #1a1a2a; letter-spacing: -0.5px;
}
.invoice-paper.style-corporate .inv-corp-day {
  font-size: 10px; color: #aaa; text-transform: uppercase; letter-spacing: 0.5px;
}

/* Bill to */
.invoice-paper.style-corporate .inv-corp-parties {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 24px; margin-bottom: 22px;
}
.invoice-paper.style-corporate .inv-corp-party-label {
  font-size: 8.5px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; margin-bottom: 5px;
  color: var(--corp-accent, #e8a020);
}
.invoice-paper.style-corporate .inv-corp-party-val {
  font-size: 12px; line-height: 1.6; color: #2a2a3a;
}

/* Table */
.invoice-paper.style-corporate .inv-corp-table {
  width: 100%; border-collapse: collapse; margin-bottom: 20px;
}
.invoice-paper.style-corporate .inv-corp-table th {
  background: #1a1a2a;
  color: var(--corp-accent, #e8a020);
  font-size: 8.5px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 10px 14px; text-align: left;
}
.invoice-paper.style-corporate .inv-corp-table th:last-child { text-align: right; }
.invoice-paper.style-corporate .inv-corp-table td {
  padding: 11px 14px; font-size: 12.5px;
  border-bottom: 1px solid #f0f0f8; color: #2a2a3a; vertical-align: top;
}
.invoice-paper.style-corporate .inv-corp-table td:nth-child(1) {
  font-weight: 500;
}
.invoice-paper.style-corporate .inv-corp-table td:nth-child(2),
.invoice-paper.style-corporate .inv-corp-table td:nth-child(3),
.invoice-paper.style-corporate .inv-corp-table td:nth-child(4) {
  font-family: 'DM Mono', monospace; font-size: 12px;
  color: #555; text-align: right;
}
.invoice-paper.style-corporate .inv-corp-table tbody tr:last-child td { border-bottom: none; }

/* Totals */
.invoice-paper.style-corporate .inv-corp-bottom {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 24px;
}
.invoice-paper.style-corporate .inv-corp-payment {
  flex: 1;
}
.invoice-paper.style-corporate .inv-corp-payment-label {
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: #999; margin-bottom: 8px;
}
.invoice-paper.style-corporate .inv-corp-payment-val {
  font-size: 12px; color: #444; line-height: 1.7;
}
.invoice-paper.style-corporate .inv-corp-totals { min-width: 240px; }
.invoice-paper.style-corporate .inv-corp-totals-row {
  display: flex; justify-content: space-between;
  padding: 4px 0; font-size: 12.5px; color: #333;
  border-bottom: 1px solid #f0f0f0;
}
.invoice-paper.style-corporate .inv-corp-totals-row:last-child { border-bottom: none; }
.invoice-paper.style-corporate .inv-corp-totals-row.final {
  border-bottom: none; border-top: 2px solid #1a1a2a;
  padding-top: 10px; margin-top: 4px;
  font-weight: 700; font-size: 15px; color: var(--corp-accent, #e8a020);
}
.invoice-paper.style-corporate .inv-corp-totals-row.due {
  font-weight: 700; font-size: 13px; color: #c04040;
  border-top: 1px solid #eee; padding-top: 6px; margin-top: 2px;
}

/* Signature */
.invoice-paper.style-corporate .inv-corp-sig {
  text-align: right; margin-top: 32px; padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}
.invoice-paper.style-corporate .inv-corp-sig-line {
  font-family: 'DM Serif Display', serif;
  font-size: 20px; color: #1a1a2a; font-style: italic;
  margin-bottom: 4px;
}
.invoice-paper.style-corporate .inv-corp-sig-label {
  font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: #aaa;
}

/* Footer info */
.invoice-paper.style-corporate .inv-corp-footer {
  display: flex; gap: 20px; flex-wrap: wrap;
  margin-top: 20px; padding-top: 14px;
  border-top: 1px solid #eee;
}
.invoice-paper.style-corporate .inv-corp-footer-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; color: #888;
}
.invoice-paper.style-corporate .inv-corp-footer-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--corp-accent, #e8a020);
  flex-shrink: 0;
}

/* ── STYLE: EMERALD SIDEBAR ─────────────────────────────────
   Rich green left sidebar with white main content area,
   elegant two-column layout with invoice stamp watermark  */

.invoice-paper.style-emerald {
  background: #fff;
  color: #1a2a22;
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 210px 1fr;
  grid-template-rows: 1fr;
  align-items: stretch;
  min-height: 1123px; /* A4 at 96dpi — ensures sidebar & main always fill full page */
}

.invoice-paper.style-emerald .inv-em-sidebar {
  background: linear-gradient(170deg, #1a4a32 0%, #0e2e1e 100%);
  padding: 44px 24px;
  display: flex; flex-direction: column;
  gap: 28px; position: relative; overflow: hidden;
}
.invoice-paper.style-emerald .inv-em-sidebar::before {
  content: '';
  position: absolute;
  bottom: -60px; right: -60px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.invoice-paper.style-emerald .inv-em-sidebar::after {
  content: '';
  position: absolute;
  top: -40px; left: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
}

.invoice-paper.style-emerald .inv-em-logo-wrap img {
  max-height: 48px; max-width: 140px;
  object-fit: contain; filter: brightness(0) invert(1);
}
.invoice-paper.style-emerald .inv-em-brand-name {
  font-family: 'DM Serif Display', serif;
  font-size: 18px; color: #fff; letter-spacing: -0.2px; line-height: 1.1;
}
.invoice-paper.style-emerald .inv-em-brand-sub {
  font-size: 9px; color: rgba(255,255,255,0.4);
  letter-spacing: 1.2px; text-transform: uppercase; margin-top: 3px;
}

.invoice-paper.style-emerald .inv-em-sidebar-section {}
.invoice-paper.style-emerald .inv-em-sidebar-label {
  font-size: 7.5px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: #4ecb94;
  margin-bottom: 7px;
}
.invoice-paper.style-emerald .inv-em-sidebar-val {
  font-size: 11px; color: rgba(255,255,255,0.8);
  white-space: pre-line; line-height: 1.6;
}
.invoice-paper.style-emerald .inv-em-sidebar-val.mono {
  font-family: 'DM Mono', monospace; font-size: 12px;
  color: #fff; font-weight: 600;
}

.invoice-paper.style-emerald .inv-em-divider {
  height: 1px; background: rgba(255,255,255,0.1); margin: 4px 0;
}

/* Main content */
.invoice-paper.style-emerald .inv-em-main {
  padding: 44px 40px;
  display: flex; flex-direction: column;
}

.invoice-paper.style-emerald .inv-em-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 28px;
}
.invoice-paper.style-emerald .inv-em-doc-type {
  font-family: 'DM Serif Display', serif;
  font-size: 38px; letter-spacing: -1px; line-height: 1;
  color: #0e2e1e;
}
.invoice-paper.style-emerald .inv-em-stamp {
  width: 72px; height: 72px;
  border: 3px solid #4ecb9433;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 1px;
}
.invoice-paper.style-emerald .inv-em-stamp-text {
  font-size: 7px; font-weight: 800;
  letter-spacing: 1.5px; text-transform: uppercase; color: #1a4a32;
  text-align: center; line-height: 1.2;
}

/* Bill to */
.invoice-paper.style-emerald .inv-em-bill-to-label {
  font-size: 8px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: #1a4a32; margin-bottom: 5px;
}
.invoice-paper.style-emerald .inv-em-bill-to-val {
  font-size: 12.5px; color: #1a2a22; line-height: 1.65;
  margin-bottom: 24px;
}

/* Table */
.invoice-paper.style-emerald .inv-em-table {
  width: 100%; border-collapse: collapse; margin-bottom: 16px; flex: 1;
}
.invoice-paper.style-emerald .inv-em-table th {
  background: #0e2e1e;
  color: #4ecb94; font-size: 8px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  padding: 9px 12px; text-align: left;
}
.invoice-paper.style-emerald .inv-em-table th:last-child { text-align: right; }
.invoice-paper.style-emerald .inv-em-table td {
  padding: 10px 12px; font-size: 12.5px;
  border-bottom: 1px solid #e8f5ee; color: #1a2a22; vertical-align: top;
}
.invoice-paper.style-emerald .inv-em-table td:nth-child(2),
.invoice-paper.style-emerald .inv-em-table td:nth-child(3),
.invoice-paper.style-emerald .inv-em-table td:nth-child(4) {
  font-family: 'DM Mono', monospace; font-size: 12px;
  color: #446; text-align: right;
}
.invoice-paper.style-emerald .inv-em-table tbody tr:nth-child(even) td {
  background: #f2fbf6;
}
.invoice-paper.style-emerald .inv-em-table tbody tr:last-child td { border-bottom: none; }

/* Totals */
.invoice-paper.style-emerald .inv-em-totals {
  display: flex; justify-content: flex-end; margin-bottom: 16px;
}
.invoice-paper.style-emerald .inv-em-totals-table { min-width: 240px; }
.invoice-paper.style-emerald .inv-em-totals-row {
  display: flex; justify-content: space-between;
  padding: 4px 0; font-size: 12.5px; color: #2a3a2a;
}
.invoice-paper.style-emerald .inv-em-totals-row.final {
  background: #0e2e1e; color: #fff;
  padding: 9px 14px; border-radius: 5px;
  font-weight: 700; font-size: 14px; margin-top: 8px;
}
.invoice-paper.style-emerald .inv-em-totals-row.due {
  background: #e8f5ee;
  padding: 7px 14px; border-radius: 5px;
  font-weight: 700; font-size: 13px; margin-top: 4px;
  border: 1px solid #4ecb9433;
  color: #1a4a32;
}
.invoice-paper.style-emerald .inv-em-totals-label { color: #778877; font-size: 12px; }
.invoice-paper.style-emerald .inv-em-totals-val { font-family: 'DM Mono', monospace; font-weight: 600; }

.invoice-paper.style-emerald .inv-em-notes {
  background: #f2fbf6; border-left: 3px solid #4ecb94;
  padding: 11px 14px; border-radius: 0 5px 5px 0;
  font-size: 11px; color: #446644; line-height: 1.7;
  margin-top: 8px;
}
.invoice-paper.style-emerald .inv-em-footer {
  margin-top: auto; padding-top: 16px;
  border-top: 1px solid #e8f5ee;
  font-size: 9px; color: #aac4aa;
  font-family: 'DM Mono', monospace; text-align: right;
}

/* ── STYLE: MIDNIGHT ROSE ───────────────────────────────────
   Ultra-modern deep black with hot pink/magenta accents,
   bold typography, glowing highlights, gradient totals     */

.invoice-paper.style-midnight {
  background: #0a0a0f;
  color: #e8e8f8;
  padding: 0;
  overflow: hidden;
}

.invoice-paper.style-midnight .inv-mid-header {
  background: linear-gradient(135deg, #140a1e 0%, #0a0a0f 100%);
  padding: 36px 50px 28px;
  border-bottom: 1px solid #1e1e2e;
  display: flex; justify-content: space-between; align-items: flex-start;
  position: relative; overflow: hidden;
}
/* Glowing blob */
.invoice-paper.style-midnight .inv-mid-header::before {
  content: '';
  position: absolute;
  top: -60px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,20,147,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.invoice-paper.style-midnight .inv-mid-logo-wrap img {
  max-height: 48px; max-width: 140px;
  object-fit: contain; filter: brightness(0) invert(1);
}
.invoice-paper.style-midnight .inv-mid-brand-name {
  font-family: 'DM Serif Display', serif;
  font-size: 20px; color: #fff; letter-spacing: -0.3px; line-height: 1;
}
.invoice-paper.style-midnight .inv-mid-brand-sub {
  font-size: 9px; color: rgba(255,255,255,0.3);
  letter-spacing: 1.2px; text-transform: uppercase; margin-top: 3px;
}

.invoice-paper.style-midnight .inv-mid-header-right { text-align: right; }
.invoice-paper.style-midnight .inv-mid-doc-label {
  font-size: 40px; font-weight: 900; letter-spacing: -2px;
  background: linear-gradient(135deg, #ff1493, #ff69b4, #e040fb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-transform: uppercase; line-height: 1;
}
.invoice-paper.style-midnight .inv-mid-doc-num {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: rgba(255,255,255,0.35); margin-top: 4px;
}

/* Neon accent bar */
.invoice-paper.style-midnight .inv-mid-neon-bar {
  height: 2px;
  background: linear-gradient(90deg, transparent, #ff1493, #e040fb, transparent);
  box-shadow: 0 0 12px rgba(255,20,147,0.6);
}

/* Body */
.invoice-paper.style-midnight .inv-mid-body {
  padding: 28px 50px 0;
}

.invoice-paper.style-midnight .inv-mid-parties {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 24px; margin-bottom: 20px;
}
.invoice-paper.style-midnight .inv-mid-party-label {
  font-size: 8px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: #ff1493; margin-bottom: 6px;
}
.invoice-paper.style-midnight .inv-mid-party-val {
  font-size: 12px; color: rgba(255,255,255,0.75);
  white-space: pre-line; line-height: 1.65;
}

/* Meta */
.invoice-paper.style-midnight .inv-mid-meta {
  display: flex; gap: 0;
  background: #111120; border: 1px solid #1e1e30;
  border-radius: 6px; overflow: hidden; margin-bottom: 24px;
}
.invoice-paper.style-midnight .inv-mid-meta-item {
  flex: 1; padding: 12px 18px;
  border-right: 1px solid #1e1e30;
}
.invoice-paper.style-midnight .inv-mid-meta-item:last-child { border-right: none; }
.invoice-paper.style-midnight .inv-mid-meta-label {
  font-size: 8px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: #4a4a70; margin-bottom: 4px;
}
.invoice-paper.style-midnight .inv-mid-meta-val {
  font-family: 'DM Mono', monospace;
  font-size: 12.5px; font-weight: 600; color: #e8e8f8;
}

/* Table */
.invoice-paper.style-midnight .inv-mid-table {
  width: 100%; border-collapse: collapse; margin-bottom: 16px;
}
.invoice-paper.style-midnight .inv-mid-table th {
  background: #111120;
  color: #ff1493; font-size: 8.5px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid #ff149330;
}
.invoice-paper.style-midnight .inv-mid-table th:last-child { text-align: right; }
.invoice-paper.style-midnight .inv-mid-table td {
  padding: 11px 14px; font-size: 12.5px;
  border-bottom: 1px solid #1a1a28;
  color: #c0c0d8; vertical-align: top;
}
.invoice-paper.style-midnight .inv-mid-table td:nth-child(2),
.invoice-paper.style-midnight .inv-mid-table td:nth-child(3),
.invoice-paper.style-midnight .inv-mid-table td:nth-child(4) {
  font-family: 'DM Mono', monospace; font-size: 12px;
  color: #9090b0; text-align: right;
}
.invoice-paper.style-midnight .inv-mid-table tbody tr:last-child td { border-bottom: none; }

/* Totals */
.invoice-paper.style-midnight .inv-mid-totals {
  display: flex; justify-content: flex-end;
  padding: 0 0 24px;
}
.invoice-paper.style-midnight .inv-mid-totals-table { min-width: 260px; }
.invoice-paper.style-midnight .inv-mid-totals-row {
  display: flex; justify-content: space-between;
  padding: 5px 0; font-size: 12.5px; color: #9090b0;
}
.invoice-paper.style-midnight .inv-mid-totals-row.final {
  background: linear-gradient(135deg, #1e0a2a, #140a1e);
  border: 1px solid #ff149340;
  padding: 11px 16px; border-radius: 6px;
  font-weight: 700; font-size: 15px; margin-top: 8px;
  color: #fff;
}
.invoice-paper.style-midnight .inv-mid-totals-row.due {
  background: linear-gradient(135deg, #2a0a1a, #1e0a14);
  border: 1px solid #ff149360;
  padding: 9px 16px; border-radius: 6px;
  font-weight: 700; font-size: 13px; margin-top: 4px;
  color: #ff69b4;
  box-shadow: 0 0 14px rgba(255,20,147,0.2);
}

/* Notes */
.invoice-paper.style-midnight .inv-mid-notes {
  background: #111120; border: 1px solid #1e1e30;
  border-left: 3px solid #ff1493;
  padding: 12px 16px; border-radius: 0 5px 5px 0;
  font-size: 11px; color: #707090; line-height: 1.75;
  margin: 0 0 20px;
}
.invoice-paper.style-midnight .inv-mid-notes-label {
  font-size: 7.5px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: #ff149380; margin-bottom: 6px;
}

/* Footer */
.invoice-paper.style-midnight .inv-mid-footer {
  padding: 16px 50px;
  border-top: 1px solid #1e1e30;
  display: flex; align-items: center; justify-content: space-between;
  background: #080810;
}
.invoice-paper.style-midnight .inv-mid-footer-text {
  font-size: 9px; color: #3a3a58;
  font-family: 'DM Mono', monospace;
}
.invoice-paper.style-midnight .inv-mid-footer-glow {
  width: 8px; height: 8px; border-radius: 50%;
  background: #ff1493;
  box-shadow: 0 0 10px #ff1493, 0 0 20px rgba(255,20,147,0.5);
}

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .builder-grid { grid-template-columns: 380px 1fr; }
}
@media (max-width: 900px) {
  /* mobile: grid collapses, form fills full height minus both navs */
  .app-layout { padding-bottom: var(--mobile-nav-h); }
  .builder-grid {
    grid-template-columns: 1fr;
    height: calc(100vh - var(--header-h) - var(--mobile-nav-h));
  }
  .preview-panel { display: none; }
  .form-section.four-col { grid-template-columns: repeat(2,1fr); }
  .header-nav { display: none; }
  .mobile-nav { display: flex; }
  .panel-scroll { padding: 14px 14px 28px; }
  .audit-banner { grid-template-columns: repeat(2,1fr); }
}

/* ════════════════════════════════════════════════
   MOBILE PREVIEW TOGGLE — FAB + SLIDE-IN OVERLAY
   ════════════════════════════════════════════════ */

/* FAB button — only visible on mobile */
.mobile-preview-fab {
  display: none;
  position: fixed;
  bottom: 88px; /* above mobile nav */
  right: 18px;
  z-index: 200;
  background: var(--gold);
  color: #08080e;
  border: none;
  border-radius: 50px;
  padding: 11px 18px 11px 14px;
  font-family: var(--ff-ui, 'Syne', sans-serif);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(200,168,106,0.45), 0 2px 8px rgba(0,0,0,0.4);
  align-items: center;
  gap: 7px;
  transition: all 0.2s ease;
  letter-spacing: 0.2px;
}
.mobile-preview-fab:hover,
.mobile-preview-fab:active {
  background: #e8c87a;
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(200,168,106,0.55);
}
.mobile-preview-fab.preview-open {
  background: var(--bg3, #111122);
  color: var(--text, #f0f0fa);
  border: 1px solid var(--border2, #2a2a48);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.fab-icon { font-size: 15px; line-height: 1; }
.fab-label { font-size: 12.5px; font-weight: 700; }

/* Mobile preview overlay panel */
.mobile-preview-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--bg, #070710);
  flex-direction: column;
  overflow: hidden;
  /* slide up animation */
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}
.mobile-preview-overlay.active {
  transform: translateY(0);
}

.mob-prev-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg2, #0c0c1a);
  border-bottom: 1px solid var(--border, #1e1e38);
  flex-shrink: 0;
}
.mob-prev-title {
  font-family: var(--ff-ui, 'Syne', sans-serif);
  font-size: 13px;
  font-weight: 700;
  color: var(--text2, #8888aa);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.mob-prev-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mob-prev-btn {
  background: var(--bg3, #111122);
  border: 1px solid var(--border, #1e1e38);
  color: var(--text2, #8888aa);
  font-family: var(--ff-ui, 'Syne', sans-serif);
  font-size: 11.5px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.mob-prev-btn:hover { border-color: var(--border2); color: var(--text); }
.mob-prev-btn.gold { background: var(--gold, #c8a86a); color: #08080e; border-color: transparent; }
.mob-prev-btn.gold:hover { background: #e8c87a; }
.mob-prev-btn--share { background: rgba(78,203,148,0.12); border-color: rgba(78,203,148,0.25); color: #4ecb94; }
.mob-prev-btn--share:hover { background: rgba(78,203,148,0.22); border-color: rgba(78,203,148,0.45); color: #6edba8; }
.mob-prev-close {
  background: none;
  border: 1px solid var(--border2, #2a2a48);
  color: var(--text2, #8888aa);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
  flex-shrink: 0;
}
.mob-prev-close:hover { color: var(--text); border-color: var(--text3); }

.mob-prev-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px 32px;
  background: #f0ede8;
  -webkit-overflow-scrolling: touch;
}
/* The actual invoice paper inside mobile preview */
.mob-prev-scroll .invoice-paper {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  min-height: 500px;
  overflow: hidden;
}

/* Style indicator pill in mobile overlay header */
.mob-style-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--goldf, rgba(200,168,106,0.1));
  border: 1px solid rgba(200,168,106,0.25);
  color: var(--gold, #c8a86a);
  font-family: var(--ff-mono, 'DM Mono', monospace);
  font-size: 10px; font-weight: 500;
  padding: 3px 10px; border-radius: 20px;
  letter-spacing: 0.5px;
}

@media (max-width: 900px) {
  /* Show FAB */
  .mobile-preview-fab { display: flex; }
  /* Show overlay when toggled */
  .mobile-preview-overlay { display: flex; }
}
@media (max-width: 400px) {
  /* Very small phones: hide style pill so 3 buttons + close fit comfortably */
  .mob-style-pill { display: none; }
}
@media (max-width: 640px) {
  .audit-banner { grid-template-columns: 1fr; }
  .audit-card-amount { font-size: 22px; }
  .hcard-money { grid-template-columns: repeat(3,1fr); }
  .hcard-actions-col { grid-column: 1/-1; border-top: 1px solid var(--border); padding: 8px 14px; justify-content: flex-end; }
  .month-header { flex-direction: column; align-items: flex-start; }
  .history-topbar { flex-direction: column; }
  .tpl-cards { grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); }
  .page-container { padding: 16px; }
}
@media (max-width: 520px) {
  .form-section.two-col { grid-template-columns: 1fr; }
  .line-item-header { display: none; }
  .line-item-row { grid-template-columns: 1fr 70px 80px 28px; }
  .line-item-row .item-desc { grid-column: 1/-1; }
}

/* ================================================================
   USER AVATAR + PROFILE PANEL
   ================================================================ */

/* Header avatar */
.user-avatar-wrap {
  cursor: pointer; position: relative;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--gold); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ff-ui); font-size: 13px; font-weight: 700;
  overflow: hidden; border: 2px solid transparent;
  transition: border-color .2s, transform .2s;
  cursor: pointer;
}
.user-avatar:hover { border-color: var(--gold); transform: scale(1.05); }
[data-theme="dark"] .user-avatar { color: #08080e; }

/* Profile overlay */
.profile-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35);
  z-index: 900; opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
  backdrop-filter: blur(4px);
}
.profile-overlay.open { opacity: 1; pointer-events: all; }

/* Profile panel (right slide-in) */
.profile-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 360px; max-width: 100vw;
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 901; overflow-y: auto;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.profile-panel.open { transform: translateX(0); }

/* Panel header */
.pp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.pp-title {
  font-family: var(--ff-ui); font-size: 16px; font-weight: 700; color: var(--text);
}
.pp-close {
  width: 30px; height: 30px; background: none; border: 1px solid var(--border2);
  border-radius: 7px; cursor: pointer; color: var(--text3); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.pp-close:hover { background: var(--bg3); color: var(--text); }

/* Avatar section */
.pp-avatar-section {
  display: flex; flex-direction: column; align-items: center;
  padding: 28px 24px 20px; border-bottom: 1px solid var(--border);
}
.pp-avatar-ring {
  width: 80px; height: 80px; border-radius: 50%; overflow: hidden;
  background: var(--gold); position: relative; cursor: pointer;
  border: 3px solid var(--border); transition: border-color .2s;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.pp-avatar-ring:hover { border-color: var(--gold); }
.pp-avatar-ring:hover .pp-avatar-edit { opacity: 1; }
.pp-avatar-initials {
  font-family: var(--ff-ui); font-size: 28px; font-weight: 700;
  color: #fff; pointer-events: none;
}
[data-theme="dark"] .pp-avatar-initials { color: #08080e; }
.pp-avatar-edit {
  position: absolute; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; opacity: 0; transition: opacity .2s; border-radius: 50%;
}
.pp-avatar-name {
  font-family: var(--ff-ui); font-size: 15px; font-weight: 700;
  color: var(--text); margin-bottom: 3px;
}
.pp-avatar-email {
  font-size: 12px; color: var(--text3); margin-bottom: 8px;
}
.pp-plan-badge {
  font-family: var(--ff-ui); font-size: 10px; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase;
  background: var(--goldf); color: var(--gold);
  border: 1px solid rgba(154,120,64,.25); border-radius: 20px;
  padding: 3px 10px;
}
[data-theme="dark"] .pp-plan-badge { border-color: rgba(200,168,106,.25); }

/* Account type tabs */
.pp-type-tabs {
  display: flex; gap: 8px; padding: 16px 24px; border-bottom: 1px solid var(--border);
}
.pp-type-tab {
  flex: 1; height: 36px; background: none; border: 1px solid var(--border2);
  border-radius: 8px; color: var(--text2); font-family: var(--ff-ui);
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.pp-type-tab.active {
  background: var(--goldf); border-color: var(--gold); color: var(--gold);
}
.pp-type-tab:hover:not(.active) { background: var(--bg3); }

/* Form fields */
.pp-form { padding: 20px 24px; flex: 1; }
.pp-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pp-field { margin-bottom: 14px; }
.pp-label {
  display: block; font-family: var(--ff-ui); font-size: 10.5px; font-weight: 700;
  letter-spacing: .7px; text-transform: uppercase; color: var(--text3); margin-bottom: 5px;
}
.pp-input {
  width: 100%; height: 40px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-family: var(--ff-body); font-size: 13px;
  padding: 0 12px; outline: none; transition: all .15s;
}
.pp-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(154,120,64,.1); }
.pp-input::placeholder { color: var(--text3); }

.pp-save-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 8px 0 16px; gap: 12px;
}
.pp-save-status { font-size: 12px; color: var(--green); flex: 1; }
.pp-save-btn {
  height: 38px; padding: 0 20px;
  background: var(--gold); color: #fff; border: none; border-radius: 8px;
  font-family: var(--ff-ui); font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all .18s; flex-shrink: 0;
}
[data-theme="dark"] .pp-save-btn { color: #08080e; }
.pp-save-btn:hover { background: var(--gold2); transform: translateY(-1px); }
.pp-save-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.pp-divider { height: 1px; background: var(--border); margin: 20px 0; }
.pp-section-label {
  font-family: var(--ff-ui); font-size: 10.5px; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase; color: var(--text3);
  margin-bottom: 12px;
}
.pp-pwd-btn {
  width: 100%; height: 38px; background: none; border: 1px solid var(--border2);
  border-radius: 8px; color: var(--text2); font-family: var(--ff-ui);
  font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .15s;
  margin-bottom: 4px;
}
.pp-pwd-btn:hover { border-color: var(--gold); color: var(--gold); }

.pp-logout-btn {
  width: 100%; height: 42px; background: none;
  border: 1px solid var(--border2); border-radius: 8px;
  color: var(--text2); font-family: var(--ff-ui); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; display: flex; align-items: center;
  justify-content: center; gap: 8px; margin-bottom: 10px;
}
.pp-logout-btn:hover { border-color: var(--danger); color: var(--danger); }
.pp-delete-btn {
  width: 100%; height: 36px; background: none; border: none;
  color: var(--text3); font-family: var(--ff-ui); font-size: 11.5px;
  cursor: pointer; transition: color .15s;
  text-decoration: underline;
}

/* ─── FX / Currency Converter UI ──────────────────────────── */
.fx-status {
  margin-top: 6px;
  font-family: var(--font-ui, 'Syne', sans-serif);
  font-size: 11px;
  border-radius: 6px;
  padding: 5px 10px;
  animation: fxFadeIn .2s ease;
}
.fx-status--loading {
  background: var(--surface2, #f3f1ec);
  color: var(--text2);
}
.fx-status--loading::before { content: '⟳ '; }
.fx-status--ok {
  background: rgba(42,158,106,.08);
  border: 1px solid rgba(42,158,106,.25);
  color: #2a9e6a;
}
.fx-status--ok::before { content: '✓ '; }
.fx-status--warn {
  background: rgba(208,64,80,.07);
  border: 1px solid rgba(208,64,80,.2);
  color: #d04050;
}
.fx-status--warn::before { content: '⚠ '; }
[data-theme="dark"] .fx-status--ok   { background: rgba(78,203,148,.1); color: #4ecb94; border-color: rgba(78,203,148,.25); }
[data-theme="dark"] .fx-status--warn { background: rgba(224,92,106,.1); color: #e87e8a; border-color: rgba(224,92,106,.25); }
[data-theme="dark"] .fx-status--loading { background: var(--surface); color: var(--text3); }

.fx-hist-loading {
  text-align: center;
  padding: 12px;
  font-size: 12px;
  color: var(--text3);
  font-family: var(--font-ui, 'Syne', sans-serif);
  animation: fxFadeIn .2s ease;
}

.fx-stale-badge {
  display: inline-block;
  font-size: 9px;
  font-family: var(--font-ui, 'Syne', sans-serif);
  background: rgba(154,120,64,.1);
  color: var(--gold, #9a7840);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 4px;
  cursor: help;
}

@keyframes fxFadeIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.pp-delete-btn:hover { color: var(--danger); }
