/* ============================================================
   Earling Labs Invoicer - v0.1.4
   Design system: Earling Labs family pattern.
   Family traits (IDENTICAL across all products):
     • Gold accent #F5A02A (buttons, brackets, corner marks)
     • Success green #00EC6E (status OK)
     • Sharp 90° corners, drafting brackets, fonts
   Product-specific (varies per product):
     • Background tone: burgundy here, navy in Estimator, sage in Receipts
     • Secondary accent: dusty rose here (#E5A0B0), cyan in Estimator,
       terracotta in Scheduler — used for // MISSION BRIEF, h3 headers, links
   ============================================================ */

:root {
  /* --- Base palette (Burgundy — Invoicer's product tone) --- */
  --bg:           #3D1A24;
  --bg-deep:      #2A1018;
  --surface:      #4F2330;
  --surface-2:    #5B2B3A;
  --surface-3:    #6B3344;

  /* --- Ink (paper cream — family standard) --- */
  --ink:          #EFE5CC;
  --ink-soft:     #C9B0A0;
  --ink-dim:      #8A7560;
  --ink-deep:     #5E4C42;

  /* --- Rules / borders (family standard, neutral) --- */
  --rule:         rgba(229, 160, 176, 0.12);
  --rule-strong:  rgba(229, 160, 176, 0.25);
  --rule-bright:  rgba(229, 160, 176, 0.40);

  /* --- Accent (Safety Amber — FAMILY STANDARD, identical to Estimator) --- */
  --accent:       #F5A02A;
  --accent-deep:  #C97A0F;
  --accent-soft:  rgba(245, 160, 42, 0.14);
  --accent-glow:  rgba(245, 160, 42, 0.35);

  /* --- Product secondary (dusty rose — pairs with burgundy bg) --- */
  --accent2:        #E5A0B0;
  --accent2-deep:   #C97A8A;

  /* --- Semantic (family standard) --- */
  --success:      #00EC6E;
  --warning:      #F5C242;
  --error:        #E25B43;

  /* --- Type (family standard) --- */
  --font-display: 'Oswald', 'Arial Narrow', sans-serif;
  --font-body:    'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* --- Geometry --- */
  --radius-sm: 2px;
  --radius:    4px;
  --radius-lg: 6px;
}

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

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  background-image:
    linear-gradient(rgba(229, 160, 176, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(229, 160, 176, 0.03) 1px, transparent 1px),
    radial-gradient(ellipse at top, rgba(229, 160, 176, 0.05) 0%, transparent 60%);
  background-size: 24px 24px, 24px 24px, 100% 100%;
  background-attachment: fixed;
}

a { color: var(--accent2); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
}

code {
  font-family: var(--font-mono);
  background: var(--bg-deep);
  color: var(--accent2);
  padding: 2px 5px;
  font-size: 12px;
  border-radius: 2px;
}

/* ============================================================
   AUTH PAGE (login / signup / splash)
   ============================================================ */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-container {
  max-width: 460px;
  width: 100%;
}

.auth-container .brand {
  text-align: center;
  margin-bottom: 36px;
}

.auth-container .brand-svg-wrap {
  margin: 0 auto 14px;
  max-width: 300px;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.35));
}

.auth-container .brand-svg-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.auth-container .brand-product-name {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.44em;
  color: var(--accent2);
  text-transform: uppercase;
  margin-bottom: 6px;
  margin-top: 8px;
}

.auth-container .brand .tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.footer-note {
  margin-top: 26px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.error {
  color: var(--error);
  font-size: 13px;
  margin-top: 10px;
  min-height: 16px;
}

/* ============================================================
   CARDS — gold L-corner brackets
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  padding: 28px;
  position: relative;
  margin-bottom: 20px;
  border-radius: var(--radius);
}

.card::before,
.card::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--accent);
  border-style: solid;
  border-width: 0;
  pointer-events: none;
}
.card::before {
  top: -1px;
  left: -1px;
  border-top-width: 2px;
  border-left-width: 2px;
}
.card::after {
  bottom: -1px;
  right: -1px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.card h3 {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

.card .hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: -8px;
  margin-bottom: 14px;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--rule);
}

.tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  padding: 14px 16px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.tab:hover:not(.active) { color: var(--ink); }

/* ============================================================
   FORMS
   ============================================================ */
.form { display: block; }

.field { margin-bottom: 16px; }

.field-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.field-row .field { flex: 1; min-width: 140px; }

.field label {
  display: block;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  padding: 11px 13px;
  font-family: var(--font-body);
  font-size: 14px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent2);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(229, 160, 176, 0.18);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--ink-deep);
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

.field .hint {
  font-size: 11px;
  color: var(--ink-dim);
  margin-top: 4px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.field .hint a { color: var(--accent); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  background: var(--accent);
  color: #1A0A00;
  border: none;
  padding: 12px 26px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.16em;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s, transform 0.05s, box-shadow 0.2s;
}

.btn-primary:hover {
  background: var(--accent-deep);
  color: #1A0A00;
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  padding: 11px 22px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.16em;
  font-weight: 500;
  text-transform: uppercase;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--accent2);
  color: var(--ink);
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  padding: 11px 22px;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-danger:hover { background: rgba(226, 91, 67, 0.12); }

.btn-sm { padding: 7px 14px; font-size: 11px; }

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 16px;
}

/* ============================================================
   APP HEADER (nav bar)
   ============================================================ */
.app-header {
  background: var(--bg-deep);
  border-bottom: 1px solid var(--rule-strong);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-small {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink);
  padding-right: 24px;
  border-right: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-small::before {
  content: '';
  display: block;
  width: 44px;
  height: 55px;
  background-image: url('/static/img/earling_logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

.app-nav {
  display: flex;
  gap: 2px;
  flex: 1;
}

.app-nav a {
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: var(--radius);
  position: relative;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}

.app-nav a:hover { color: var(--ink); }

.app-nav a.active {
  color: var(--ink);
  background: var(--surface);
}

.app-nav a.active::after {
  content: '';
  position: absolute;
  bottom: -15px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--accent);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.user-menu .user-name { color: var(--ink); }
.user-menu .account-name { color: var(--ink-dim); }

/* ============================================================
   APP MAIN
   ============================================================ */
.app-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px;
}

.app-main-narrow {
  max-width: 820px;
}

.hero-row {
  display: flex;
  align-items: center;
  gap: 48px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}

.hero-row .welcome {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.hero-logo {
  width: 220px;
  height: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.5));
}

@media (max-width: 880px) {
  .hero-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }
  .hero-logo { width: 150px; }
}

.welcome {
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}

.welcome::before {
  content: '// MISSION BRIEF';
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--accent2);
  margin-bottom: 8px;
}

.welcome h2 {
  font-family: var(--font-display);
  font-size: 38px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
  line-height: 1.05;
}

.welcome p {
  color: var(--ink-soft);
  font-size: 14px;
  max-width: 760px;
  line-height: 1.6;
}

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

/* Status rows */
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 13px;
}
.status-row:last-child { border-bottom: none; }
.status-row .label {
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}
.status-row .value { color: var(--ink); font-weight: 500; }
.status-row .value.ok { color: var(--success); }
.status-row .value.error { color: var(--error); }
.status-row .value.alarm { color: var(--error); }
.status-row .value.positive { color: var(--success); }

/* ============================================================
   STAT TILES (dashboard hero stats — bracketed)
   ============================================================ */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 18px 22px;
  position: relative;
}

.stat-tile::before,
.stat-tile::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--accent);
  border-style: solid;
  border-width: 0;
  pointer-events: none;
}
.stat-tile::before {
  top: -1px;
  left: -1px;
  border-top-width: 2px;
  border-left-width: 2px;
}
.stat-tile::after {
  bottom: -1px;
  right: -1px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.stat-tile .stat-label {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent2);
  font-weight: 500;
}
.stat-tile .stat-value {
  font-family: var(--font-display);
  font-size: 30px;
  color: var(--ink);
  margin-top: 8px;
  letter-spacing: 0.04em;
}
.stat-tile .stat-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-dim);
  margin-top: 4px;
  letter-spacing: 0.04em;
}
.stat-tile.alarm .stat-value { color: var(--error); }
.stat-tile.positive .stat-value { color: var(--success); }

/* ============================================================
   STATUS BADGES (invoice status — using family color tokens)
   ============================================================ */
.badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 2px;
  border: 1px solid;
  font-weight: 500;
}
.badge.draft   { background: var(--surface-2);                 color: var(--ink-dim); border-color: var(--rule); }
.badge.sent    { background: rgba(229, 160, 176, 0.18);          color: var(--accent2); border-color: var(--accent2); }
.badge.partial { background: rgba(245, 194, 66, 0.12);          color: var(--warning); border-color: var(--warning); }
.badge.paid    { background: rgba(0, 236, 110, 0.12);           color: var(--success); border-color: var(--success); }
.badge.overdue { background: rgba(226, 91, 67, 0.12);           color: var(--error);   border-color: var(--error); }
.badge.void    { background: transparent;                       color: var(--ink-dim); border-color: var(--rule); border-style: dashed; }

/* ============================================================
   TABLES
   ============================================================ */
.tbl {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 14px;
}
.tbl thead { background: var(--bg-deep); }
.tbl th {
  text-align: left;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent2);
  padding: 11px 10px;
  border-bottom: 2px solid var(--rule-strong);
  font-weight: 500;
}
.tbl td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  vertical-align: top;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.clickable { cursor: pointer; transition: background 0.12s; }
.tbl tr.clickable:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-family: var(--font-mono); }
.tbl .muted { color: var(--ink-dim); }

/* ============================================================
   LINE ITEMS TABLE (invoice editor)
   ============================================================ */
.line-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
}
.line-items-table thead { background: var(--bg-deep); }
.line-items-table th {
  text-align: left;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent2);
  padding: 10px 8px;
  border-bottom: 2px solid var(--rule-strong);
  font-weight: 500;
}
.line-items-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
}
.line-items-table input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);
  padding: 6px 8px;
  font-family: var(--font-body);
  font-size: 14px;
  width: 100%;
  border-radius: 2px;
}
.line-items-table input:focus {
  border-color: var(--accent2);
  outline: none;
  background: var(--bg-deep);
}
.line-items-table .col-desc { width: 50%; }
.line-items-table .col-qty  { width: 14%; }
.line-items-table .col-rate { width: 16%; }
.line-items-table .col-amt  { width: 16%; }
.line-items-table .col-del  { width: 4%; text-align: center; }
.line-items-table .num { text-align: right; font-family: var(--font-mono); }
.line-items-table .btn-row-del {
  background: transparent;
  border: none;
  color: var(--error);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}
.line-items-table .btn-row-del:hover { color: var(--ink); background: var(--error); border-radius: 2px; }

.line-totals {
  margin-top: 20px;
  margin-left: auto;
  max-width: 340px;
}
.line-totals .row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-soft);
}
.line-totals .row.grand {
  border-top: 2px solid var(--accent);
  margin-top: 10px;
  padding-top: 12px;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--accent);
  letter-spacing: 0.04em;
}

/* ============================================================
   FILTERS / SEARCH ROWS
   ============================================================ */
.filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}
.filter-row select,
.filter-row input[type="text"] {
  background: var(--bg-deep);
  border: 1px solid var(--rule-strong);
  color: var(--ink);
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  border-radius: var(--radius);
}
.filter-row select { min-width: 160px; }
.filter-row input[type="text"] { flex: 1; min-width: 200px; max-width: 380px; }
.filter-row input[type="text"]:focus,
.filter-row select:focus { border-color: var(--accent2); outline: none; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 200;
  padding: 60px 20px;
  overflow-y: auto;
}
.modal {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  padding: 26px;
  position: relative;
}
.modal::before,
.modal::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--accent);
  border-style: solid;
  border-width: 0;
  pointer-events: none;
}
.modal::before {
  top: -1px;
  left: -1px;
  border-top-width: 2px;
  border-left-width: 2px;
}
.modal::after {
  bottom: -1px;
  right: -1px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}
.modal-wide { max-width: 780px; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent2);
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--error); }

/* ============================================================
   TOASTS
   ============================================================ */
.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-deep);
  border: 1px solid var(--accent-soft);
  color: var(--ink);
  padding: 11px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-body);
  pointer-events: auto;
  min-width: 260px;
  max-width: 400px;
}
.toast.error { border-color: var(--error); }
.toast.success { border-color: var(--success); }

/* ============================================================
   REMINDER DRAFT CARD
   ============================================================ */
.reminder-draft {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  margin-bottom: 12px;
  border-radius: var(--radius);
}
.reminder-draft .head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 8px;
}
.reminder-draft .subj {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
  font-size: 15px;
}
.reminder-draft pre.body {
  white-space: pre-wrap;
  font-family: var(--font-body);
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* ============================================================
   HELP / FORM-HELP CALLOUTS
   ============================================================ */
.form-help {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--ink);
  margin: 14px 0;
  border-radius: var(--radius);
}

/* ============================================================
   PUBLIC INVOICE (customer-facing /i/<slug>) — paper look
   ============================================================ */
.public-invoice {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}
.public-invoice .invoice-header {
  background: var(--bg-deep);
  color: var(--ink);
  padding: 26px 32px;
  border-bottom: 4px solid var(--accent);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.public-invoice .invoice-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.public-invoice .invoice-header .biz-name {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 4px;
}
.public-invoice .invoice-header .right {
  text-align: right;
  font-size: 13px;
  font-family: var(--font-mono);
}
.public-invoice .invoice-header .right .num {
  font-size: 20px;
  margin-bottom: 4px;
  color: var(--accent);
}
.public-invoice .invoice-body {
  background: #EFE5CC;
  color: #2A1018;
  padding: 30px 32px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.public-invoice .invoice-body h3 {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent2-deep);
  margin-bottom: 8px;
}
.public-invoice .invoice-body .tbl { color: #2A1018; }
.public-invoice .invoice-body .tbl th {
  color: var(--accent2-deep);
  border-bottom-color: rgba(42, 16, 24, 0.2);
}
.public-invoice .invoice-body .tbl td { border-bottom-color: rgba(42, 16, 24, 0.1); }
.public-invoice .grand-band {
  background: var(--bg-deep);
  color: var(--ink);
  padding: 18px 32px;
  margin: -30px -32px 24px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 2px solid var(--accent);
}
.public-invoice .grand-band .lbl {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}
.public-invoice .grand-band .amt {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 0.04em;
}
.public-invoice .line-totals { color: #2A1018; }
.public-invoice .line-totals .row { color: #2A1018; }
.public-invoice .line-totals .row.grand { color: var(--accent2-deep); border-top-color: var(--accent2-deep); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  .field-row { flex-direction: column; }
  .app-header { flex-wrap: wrap; padding: 12px 16px; gap: 14px; }
  .app-nav { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .app-main { padding: 20px 16px; }
  .welcome h2 { font-size: 28px; }
  .public-invoice .invoice-header { flex-direction: column; }
  .user-menu { font-size: 11px; flex-wrap: wrap; }
}
