/* =========================================================================
   Shared design system — used by both the billing page and the admin panel
   ========================================================================= */

:root {
  --color-primary: #2f6f4f;
  --color-primary-dark: #234f38;
  --color-primary-light: #e7f3ec;
  --color-accent: #b9862f;
  --color-accent-light: #fbf1de;

  --color-bg: #f5f7f6;
  --color-surface: #ffffff;
  --color-border: #e2e6e4;
  --color-text: #1c2422;
  --color-text-muted: #667169;
  --color-text-soft: #8a938c;

  --color-success: #1a8a4a;
  --color-success-bg: #e7f8ee;
  --color-warning: #b0790a;
  --color-warning-bg: #fef3dc;
  --color-danger: #c8402f;
  --color-danger-bg: #fdeae7;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(20, 30, 25, 0.06), 0 1px 1px rgba(20, 30, 25, 0.04);
  --shadow-md: 0 6px 16px rgba(20, 30, 25, 0.08), 0 2px 6px rgba(20, 30, 25, 0.05);
  --shadow-lg: 0 16px 40px rgba(20, 30, 25, 0.14), 0 4px 12px rgba(20, 30, 25, 0.08);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;

  --header-height: 68px;
  --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3, h4 { margin: 0 0 0.4em; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 0.75em; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); box-shadow: var(--shadow-md); }

.btn-outline {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-light); }

.btn-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}
.btn-danger:hover:not(:disabled) { background: var(--color-danger); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:hover:not(:disabled) { background: rgba(0,0,0,0.05); color: var(--color-text); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* ---- Forms --------------------------------------------------------------*/
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.field { margin-bottom: 16px; }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14.5px;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
textarea { resize: vertical; min-height: 70px; }

.input-row { display: flex; gap: 12px; }
.input-row > * { flex: 1; min-width: 0; }

/* ---- Cards / surfaces ---------------------------------------------------*/
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* ---- Badges --------------------------------------------------------------*/
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---- Header / nav --------------------------------------------------------*/
.topbar {
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  color: var(--color-primary-dark);
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
}
.brand-mark.has-logo {
  background: #fff;
  border: 1px solid var(--color-border);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.brand-sub { font-size: 11.5px; font-weight: 500; color: var(--color-text-soft); }

.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.nav-links a:hover, .nav-links a.active { background: var(--color-primary-light); color: var(--color-primary-dark); }

/* ---- Toasts ---------------------------------------------------------------*/
#toast-stack {
  position: fixed;
  top: 84px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}
.toast {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 12px 16px;
  font-size: 14px;
  animation: toast-in 200ms ease;
}
.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-danger); }
.toast.info { border-left-color: var(--color-accent); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---- Modal ----------------------------------------------------------------*/
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 26, 22, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  padding: 20px;
  animation: fade-in 150ms ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
  animation: modal-in 180ms cubic-bezier(0.4, 0, 0.2, 1);
}
.modal.modal-wide { max-width: 760px; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--color-text-soft);
  line-height: 1;
  padding: 4px;
}
.modal-close:hover { color: var(--color-text); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.share-action-grid, .invoice-action-bar { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:12px; }
.invoice-action-bar { margin-top:20px; }
.btn-whatsapp { background:oklch(65% 0.19 150); color:oklch(99% 0.005 150); }
.btn-whatsapp:hover:not(:disabled) { background:oklch(59% 0.18 150); }
.btn-whatsapp-outline { background:oklch(98% 0.018 150); color:oklch(40% 0.12 150); border:1px solid oklch(78% 0.09 150); }
.btn-whatsapp-outline:hover:not(:disabled) { background:oklch(95% 0.04 150); }
@media (max-width:640px) { .share-action-grid, .invoice-action-bar { grid-template-columns:1fr; } }


/* ---- Utility ---------------------------------------------------------------*/
.text-muted { color: var(--color-text-muted); }
.text-soft { color: var(--color-text-soft); }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.hidden { display: none !important; }

/* Shared bill/cart totals rows — used on the billing page cart and the
   admin panel's bill-detail modal. */
.totals-row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; color: var(--color-text-muted); }
.totals-row.grand { font-size: 18px; font-weight: 800; color: var(--color-text); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--color-border); }

/* ---- Invoice / letterhead sheet — shared so it renders identically
   whether built by the billing page (screen preview + PDF) or generated
   on-the-fly by the admin panel (WhatsApp image sharing). --------------*/
#invoice-render {
  position: fixed;
  left: -9999px;
  top: 0;
}
.invoice-sheet {
  width: 760px;
  background: #fff;
  color: #1c2422;
  padding: 46px 50px;
  font-family: var(--font-serif);
}
.invoice-letterhead {
  text-align: center;
  border-bottom: 3px double #234f38;
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.invoice-logo {
  max-height: 64px;
  max-width: 220px;
  object-fit: contain;
  margin: 0 auto 10px;
}
.invoice-shop-name { font-size: 28px; font-weight: 800; letter-spacing: 0.02em; color: #234f38; }
.invoice-shop-owner { font-size: 13.5px; color: #444; margin-top: 2px; }
.invoice-shop-line { font-size: 12.5px; color: #555; margin-top: 2px; }
.invoice-meta-row { display: flex; justify-content: space-between; margin: 18px 0; font-size: 13px; }
.invoice-meta-col b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #8a938c; margin-bottom: 3px; }
.invoice-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13.5px; }
.invoice-table th {
  text-align: left;
  background: #f1f6f3;
  padding: 9px 10px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #234f38;
  border-bottom: 2px solid #234f38;
}
.invoice-table td { padding: 9px 10px; border-bottom: 1px solid #e2e6e4; }
.invoice-table td.num, .invoice-table th.num { text-align: right; }
.invoice-totals { margin-top: 14px; margin-left: auto; width: 260px; font-size: 13.5px; }
.invoice-totals .row { display: flex; justify-content: space-between; padding: 5px 0; }
.invoice-totals .row.grand { font-weight: 800; font-size: 16px; border-top: 2px solid #234f38; margin-top: 6px; padding-top: 10px; }
.invoice-footer { margin-top: 30px; text-align: center; font-size: 12px; color: #667169; border-top: 1px dashed #d3d9d5; padding-top: 14px; }
.invoice-channel { margin-top: 8px; text-align: center; font-size: 11px; font-weight: 800; color: var(--invoice-primary, #2f6f4f); letter-spacing: .04em; text-transform: uppercase; }
.invoice-qr { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 14px; color: #7b847f; font-size: 9px; }
.invoice-qr img { width: 86px; height: 86px; object-fit: contain; }
.invoice-generated-note { margin-top: 8px; text-align: center; font-size: 10.5px; color: #a3aba5; letter-spacing: 0.03em; }

@media (max-width: 640px) {
  .invoice-sheet { width: 100%; padding: 28px 20px; }
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-soft);
}
.empty-state .icon { font-size: 40px; margin-bottom: 10px; }

.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner.dark { border-color: rgba(0,0,0,0.15); border-top-color: var(--color-primary); }
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d3d9d5; border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 640px) {
  .container { padding: 0 14px; }
  .modal { padding: 20px; }
}


/* Product polish layer: deliberate contrast, clearer states, calmer density. */
:root {
  --color-primary: oklch(46% .105 151);
  --color-primary-dark: oklch(36% .09 151);
  --color-primary-light: oklch(94% .035 151);
  --color-accent: oklch(61% .13 75);
  --color-bg: oklch(97% .012 151);
  --color-surface: oklch(99% .006 151);
  --color-border: oklch(89% .018 151);
  --color-text: oklch(23% .03 151);
  --color-text-muted: oklch(48% .035 151);
  --color-text-soft: oklch(61% .025 151);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px oklch(25% .03 151 / .06), 0 6px 18px oklch(25% .03 151 / .035);
  --shadow-md: 0 12px 28px oklch(25% .03 151 / .10), 0 2px 7px oklch(25% .03 151 / .05);
  --transition: 180ms cubic-bezier(.16,1,.3,1);
}
body { background: oklch(97% .012 151); }
.topbar { background: oklch(99% .006 151 / .94); backdrop-filter: blur(12px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid oklch(72% .13 75); outline-offset: 3px; }
.btn-primary { box-shadow: 0 5px 12px oklch(46% .105 151 / .20); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); }


/* Color refresh: warm citrus accents with botanical green, not another flat SaaS screen. */
:root {
  --color-primary: oklch(48% .13 154);
  --color-primary-dark: oklch(35% .105 154);
  --color-primary-light: oklch(93% .055 154);
  --color-accent: oklch(69% .16 74);
  --color-accent-light: oklch(95% .055 82);
  --color-bg: oklch(96% .018 88);
  --color-surface: oklch(99% .008 90);
  --color-border: oklch(87% .035 100);
  --color-text: oklch(24% .035 150);
  --color-text-muted: oklch(46% .04 150);
  --color-text-soft: oklch(60% .035 100);
}
body { background: radial-gradient(circle at 12% 0%, oklch(98% .035 80), transparent 28rem), var(--color-bg); }
.topbar { background: oklch(99% .01 90 / .92); border-bottom-color: oklch(83% .05 100); }
.brand-mark { background: linear-gradient(135deg, oklch(58% .17 74), oklch(45% .13 154)); box-shadow: 0 6px 14px oklch(48% .13 154 / .18); }
.nav-links a:hover, .nav-links a.active { background: var(--color-accent-light); color: oklch(39% .10 72); }
.btn-primary { background: linear-gradient(135deg, oklch(53% .15 154), oklch(43% .12 154)); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, oklch(58% .16 154), oklch(48% .13 154)); }
.btn-outline:hover:not(:disabled), .btn-ghost:hover:not(:disabled) { background: var(--color-accent-light); }


/* Branded invoice system */
.invoice-sheet { --invoice-primary: #2f6f4f; --invoice-accent: #d99b38; --invoice-ink: #1c2422; border-top: 12px solid var(--invoice-primary); }
.invoice-letterhead { border-bottom-color: var(--invoice-primary); }
.invoice-shop-name { color: var(--invoice-primary); }
.invoice-table th { background: color-mix(in srgb, var(--invoice-primary) 10%, #fff); color: var(--invoice-primary); border-bottom-color: var(--invoice-primary); }
.invoice-totals .row.grand { border-top-color: var(--invoice-primary); color: var(--invoice-primary); }
.invoice-sheet[data-template="modern"] { border-top: 0; padding-top: 0; }
.invoice-sheet[data-template="modern"] .invoice-letterhead { background: var(--invoice-primary); color: #fff; margin: 0 -50px 22px; padding: 32px 50px 24px; border-bottom: 7px solid var(--invoice-accent); }
.invoice-sheet[data-template="modern"] .invoice-shop-name, .invoice-sheet[data-template="modern"] .invoice-shop-owner, .invoice-sheet[data-template="modern"] .invoice-shop-line { color: #fff; }
.invoice-sheet[data-template="modern"] .invoice-table th { background: var(--invoice-accent); color: #2b2416; border-bottom: 0; }
.invoice-sheet[data-template="modern"] .invoice-totals .row.grand { background: color-mix(in srgb, var(--invoice-primary) 10%, #fff); padding: 10px; border-top: 0; }
.invoice-sheet[data-template="compact"] { padding: 28px 34px; border-top-width: 7px; }
.invoice-sheet[data-template="compact"] .invoice-letterhead { margin-bottom: 12px; padding-bottom: 10px; }
.invoice-sheet[data-template="compact"] .invoice-shop-name { font-size: 22px; }
.invoice-sheet[data-template="compact"] .invoice-meta-row { margin: 12px 0; }
.invoice-sheet[data-template="compact"] .invoice-table td { padding: 6px 8px; }
.invoice-sheet[data-layout="airy"] { padding-top: 58px; padding-bottom: 58px; }
.invoice-sheet[data-layout="compact"] { padding-top: 24px; padding-bottom: 24px; }
.invoice-sheet[data-layout="compact"] .invoice-footer { margin-top: 18px; }
.invoice-branding-block { margin: 24px 0; padding: 18px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: linear-gradient(145deg, oklch(98% .025 80), oklch(97% .035 150)); }
.branding-heading { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.branding-heading strong { font-size:16px; }
.branding-spark { display:grid; place-items:center; width:34px; height:34px; border-radius:50%; background:var(--color-accent-light); color:var(--color-accent); font-size:20px; }
.color-control { display:flex; align-items:center; gap:10px; }
.color-control input[type=color] { width:44px; height:38px; padding:3px; cursor:pointer; }
.color-control span { font:600 12px ui-monospace, SFMono-Regular, monospace; color:var(--color-text-muted); }
.invoice-mini-preview { --invoice-primary:#2f6f4f; --invoice-accent:#d99b38; width:100%; max-width:330px; margin:6px auto 0; padding:16px 18px; border-radius:10px; background:#fff; border-top:7px solid var(--invoice-primary); box-shadow:0 9px 20px oklch(25% .03 151 / .09); color:var(--color-text); display:flex; flex-direction:column; gap:5px; }
.invoice-mini-preview .mini-top { height:7px; background:var(--invoice-accent); margin:-16px -18px 8px; opacity:.9; }
.invoice-mini-preview span { font-size:10px; color:var(--color-text-soft); }
.invoice-mini-preview .mini-lines { display:grid; gap:4px; margin:10px 0; }
.invoice-mini-preview .mini-lines i { height:4px; border-radius:99px; background:var(--color-border); }
.invoice-mini-preview b { color:var(--invoice-primary); font-size:13px; }
.invoice-mini-preview[data-template="modern"] { border-top:0; background:var(--invoice-primary); color:#fff; }
.invoice-mini-preview[data-template="modern"] span, .invoice-mini-preview[data-template="modern"] b { color:#fff; }
.invoice-mini-preview[data-template="modern"] .mini-lines i { background:color-mix(in srgb, #fff 45%, var(--invoice-primary)); }
.invoice-mini-preview[data-template="compact"] { padding:11px 14px; border-top-width:4px; }
.invoice-mini-preview[data-template="compact"] .mini-top { margin:-11px -14px 6px; height:4px; }


/* Full live sample invoice preview */
.invoice-preview-stage { margin-top: 14px; }
.invoice-preview-label { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--color-text-soft); }
.preview-live-dot { text-transform:none; letter-spacing:0; font-weight:600; color:var(--color-success); }
.invoice-mini-preview { max-width:420px; padding:20px 22px 16px; gap:0; border-radius:12px; }
.invoice-mini-preview .mini-top { margin:-20px -22px 16px; height:8px; }
.mini-letterhead { display:flex; align-items:center; gap:10px; padding-bottom:14px; border-bottom:1px solid var(--color-border); }
.mini-letterhead strong { display:block; color:var(--invoice-primary); font-size:17px; line-height:1.1; }
.mini-letterhead span { display:block; margin-top:4px; color:var(--color-text-soft); font-size:9px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:270px; }
.mini-logo { display:grid; place-items:center; width:34px; height:34px; flex:0 0 34px; border-radius:10px; background:var(--invoice-primary); color:#fff; font-weight:800; font-size:15px; overflow:hidden; }
.mini-logo.has-logo { background:var(--color-surface); border:1px solid var(--color-border); }
.mini-logo img { width:100%; height:100%; object-fit:contain; }
.mini-invoice-meta { display:flex; justify-content:space-between; padding:14px 0 12px; }
.mini-invoice-meta span { display:grid; gap:2px; }
.mini-invoice-meta span:last-child { text-align:right; }
.mini-invoice-meta b, .mini-customer span { font-size:8px; letter-spacing:.1em; color:var(--color-text-soft); }
.mini-invoice-meta em { font-style:normal; font-size:10px; font-weight:700; color:var(--color-text-muted); }
.mini-customer { display:grid; gap:2px; padding:9px 10px; background:color-mix(in srgb, var(--invoice-primary) 8%, #fff); border-radius:7px; margin-bottom:13px; }
.mini-customer strong { font-size:11px; }
.mini-customer small { font-size:9px; color:var(--color-text-soft); }
.mini-item { display:flex; justify-content:space-between; gap:10px; padding:9px 0; border-bottom:1px solid var(--color-border); font-size:10px; }
.mini-item small { color:var(--color-text-soft); margin-left:4px; }
.mini-item b { color:var(--color-text-muted); }
.mini-total-row { display:flex; justify-content:space-between; align-items:center; padding:14px 0 11px; font-size:12px; font-weight:800; color:var(--invoice-primary); }
.mini-total-row b { font-size:17px; }
.invoice-mini-preview footer { padding-top:10px; border-top:1px dashed var(--color-border); text-align:center; color:var(--color-text-soft); font-size:9px; }
.invoice-mini-preview[data-template="modern"] .mini-letterhead { border-bottom-color:color-mix(in srgb, #fff 35%, var(--invoice-primary)); }
.invoice-mini-preview[data-template="modern"] .mini-customer { background:color-mix(in srgb, #fff 16%, var(--invoice-primary)); }
.invoice-mini-preview[data-template="modern"] .mini-item, .invoice-mini-preview[data-template="modern"] footer { border-color:color-mix(in srgb, #fff 28%, var(--invoice-primary)); }
.invoice-mini-preview[data-template="modern"] .mini-letterhead strong, .invoice-mini-preview[data-template="modern"] .mini-total-row, .invoice-mini-preview[data-template="modern"] footer, .invoice-mini-preview[data-template="modern"] .mini-invoice-meta em, .invoice-mini-preview[data-template="modern"] .mini-item b { color:#fff; }
.invoice-mini-preview[data-template="modern"] .mini-letterhead span, .invoice-mini-preview[data-template="modern"] .mini-invoice-meta b, .invoice-mini-preview[data-template="modern"] .mini-customer span, .invoice-mini-preview[data-template="modern"] .mini-customer small, .invoice-mini-preview[data-template="modern"] .mini-item small { color:color-mix(in srgb, #fff 70%, var(--invoice-primary)); }
.invoice-mini-preview[data-template="modern"] .mini-logo { background:var(--invoice-accent); color:#2b2416; }
.invoice-mini-preview[data-layout="compact"] { padding-top:14px; padding-bottom:12px; }
.invoice-mini-preview[data-layout="compact"] .mini-top { margin-top:-14px; margin-bottom:10px; }
.invoice-mini-preview[data-layout="airy"] { padding-top:26px; padding-bottom:22px; }
.invoice-mini-preview[data-layout="airy"] .mini-top { margin-top:-26px; margin-bottom:20px; }
@media (max-width:640px) { .invoice-preview-label { align-items:flex-start; gap:6px; flex-direction:column; } .invoice-mini-preview { max-width:none; } }

.mini-channel { margin-top: 5px; text-align: center; color: var(--invoice-primary); font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.history-channel { display:block; margin-top:2px; color:var(--color-text-soft); font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; }


/* Invoice watermark stays behind content and never interferes with scanning or selection. */
.invoice-sheet { position: relative; isolation: isolate; }
.invoice-sheet > *:not(.invoice-watermark) { position: relative; z-index: 1; }
.invoice-watermark { position: absolute; z-index: 0; inset: 16%; display: grid; place-items: center; overflow: hidden; pointer-events: none; color: var(--invoice-primary, #2f6f4f); font-size: 78px; font-weight: 800; line-height: 1; text-align: center; transform: rotate(-32deg); text-transform: uppercase; background-position: center; background-repeat: no-repeat; background-size: contain; }
.invoice-watermark.image { transform: none; }
.watermark-controls { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--color-border); }
.watermark-opacity-label { margin-top: 4px; font-size: 11px; }
.watermark-upload-preview { width: 84px; height: 64px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); }
.watermark-upload-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.invoice-mini-preview { position: relative; isolation: isolate; overflow: hidden; }
.invoice-mini-preview > *:not(.mini-watermark) { position: relative; z-index: 1; }
.mini-watermark { position: absolute; z-index: 0; inset: 24%; display: grid; place-items: center; color: var(--invoice-primary); font-size: 30px; font-weight: 800; line-height: 1; text-align: center; transform: rotate(-30deg); text-transform: uppercase; background-position: center; background-repeat: no-repeat; background-size: contain; pointer-events: none; }
.mini-watermark.image { transform: none; }

.amount-in-words { margin-top: 18px; font-size: 12px; font-weight: 700; color: var(--invoice-ink, #1c2422); }
.invoice-meta-col > span { display: block; }
.invoice-contact-line { margin-top: 3px; color: #59625d; }
.invoice-declaration { margin-top: 14px; font-size: 11px; color: #59625d; }
.invoice-declaration b { display: block; margin-bottom: 3px; font-size: 10px; color: #7a847e; letter-spacing: .05em; }
.mini-declaration { margin-top: 6px; font-size: 8px; color: var(--color-text-soft); text-align: center; }
