/* bill-generator-theme.css — ToolWizHub dark-glass chrome for Bill Generator.
   Linked AFTER each page's own <style>, so these rules win the cascade for the
   editor chrome (.form-container/.form-title/.form-group/.btn/.controls) while
   leaving the document-preview classes untouched. */
:root {
  --bg: #07070d; --bg-2: #0c0d17;
  --text: #eef0f8; --soft: #b6bcd0; --muted: #808799; --faint: #565d73;
  --panel: rgba(255,255,255,.04); --panel-2: rgba(255,255,255,.07);
  --line: rgba(255,255,255,.09); --line-2: rgba(255,255,255,.16);
  --c1: #22d3ee; --c2: #818cf8; --c3: #e879f9;
  --grad: linear-gradient(110deg, #22d3ee, #818cf8 55%, #e879f9);
  --ok: #34d399; --bad: #fb7185;
  --r: 18px; --r-sm: 12px; --r-pill: 999px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--sans);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ── page canvas ── */
html { background: #07070d; }
body {
  background: var(--bg) !important;
  color: var(--text);
  font-family: var(--sans) !important;
  padding: 0 !important;
  height: auto !important;          /* some pages set body{height:100%}, which cut the bg at one screen */
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}
/* animated gradient-mesh blobs (matches dns-health) */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; border-radius: 50%;
  filter: blur(90px); opacity: .5; pointer-events: none;
}
body::before {
  width: 50vw; height: 50vw; top: -14vw; right: -10vw;
  background: radial-gradient(circle, rgba(34,211,238,.5), transparent 70%);
  animation: bkdrift1 18s var(--ease) infinite alternate;
}
body::after {
  width: 46vw; height: 46vw; bottom: -16vw; left: -10vw;
  background: radial-gradient(circle, rgba(232,121,249,.42), transparent 70%);
  animation: bkdrift2 22s var(--ease) infinite alternate;
}
@keyframes bkdrift1 { to { transform: translate(-8vw, 10vw) scale(1.15); } }
@keyframes bkdrift2 { to { transform: translate(8vw, -8vw) scale(1.1); } }
/* full-width layout (ToolWizHub house style — not a narrow centered column) */
.bk-wrap { width: auto; margin: 0 clamp(16px, 3vw, 44px); }
.page-container { max-width: none !important; width: auto !important; margin: 12px clamp(16px, 3vw, 44px) 40px !important; align-items: flex-start; }

/* Previews are light-paper documents. The dark chrome forces body text light,
   which would make preview template text (no explicit color) inherit light and
   vanish on white — so pin the preview roots back to dark ink. Descendants that
   set their own color keep it. */
.receipt-container, .receipt-wrap, .receipt, .preview { color: #1a1a1a !important; }

/* ── app bar ── */
.bk-appbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0 10px; }
.bk-brand { display: inline-flex; align-items: center; gap: 13px; padding: 10px 16px 10px 12px; border-radius: var(--r-pill); text-decoration: none;
  background: var(--panel); border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: border-color .25s, transform .25s var(--ease); }
.bk-brand:hover { transform: translateY(-1px); border-color: var(--line-2); }
.bk-brand img { width: 38px; height: 38px; border-radius: 12px; object-fit: cover; flex: none; box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.bk-brand > span { display: flex; flex-direction: column; gap: 2px; line-height: 1.1; }
.bk-brand b { font-family: var(--display); font-size: 16px; font-weight: 700; color: #fff; letter-spacing: -.2px; line-height: 1.1; }
.bk-brand > span > span { font-size: 9px; letter-spacing: .2em; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.bk-nav { display: flex; align-items: center; gap: 12px; }
.bk-nav__pill { font-size: 12.5px; font-weight: 600; color: var(--ok); padding: 7px 13px; border-radius: var(--r-pill); background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.28); white-space: nowrap; }
.bk-nav a { font-size: 13.5px; color: var(--soft); text-decoration: none; }
.bk-nav a:hover { color: var(--text); }

/* ── editor chrome overrides (form side) ── */
.form-container, .controls {
  background: var(--panel) !important; color: var(--text) !important;
  border: 1px solid var(--line) !important; border-radius: var(--r) !important;
  box-shadow: none !important; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 22px !important;
}
.form-title {
  font-family: var(--display) !important; color: #fff !important; font-size: 20px !important;
  border-bottom: 1px solid var(--line-2) !important; padding-bottom: 12px !important; margin-bottom: 18px !important;
}
.form-group label, .controls label { color: var(--soft) !important; font-weight: 600 !important; }
.form-group input, .form-group select, .form-group textarea,
.controls input, .controls select, .controls textarea {
  background: var(--bg-2) !important; color: var(--text) !important;
  border: 1px solid var(--line-2) !important; border-radius: var(--r-sm) !important;
  font-family: var(--sans) !important; padding: 10px 12px !important;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
.controls input:focus, .controls select:focus, .controls textarea:focus {
  border-color: var(--c2) !important; outline: none !important;
}
.form-group select option, .controls select option { background: #12131f; color: var(--text); }
.bk-note { color: var(--muted); font-size: 12.5px; margin: -8px 0 16px; }
.form-group input::placeholder, .controls input::placeholder, .controls textarea::placeholder { color: var(--faint); }

/* ── buttons (unified across every page's button classes) ── */
.btn, .btn-print, .btn-save, .btn-download, .btn-primary, .btn-secondary, .btn-neutral, .controls button {
  display: inline-flex !important; align-items: center; justify-content: center; gap: 8px;
  background: var(--panel-2) !important; color: var(--text) !important;
  border: 1px solid var(--line-2) !important; border-radius: var(--r-pill) !important;
  font-weight: 600 !important; padding: 10px 18px !important; cursor: pointer;
  transition: transform .15s var(--ease), border-color .15s, box-shadow .2s !important;
}
.btn:hover, .btn-print:hover, .btn-save:hover, .btn-download:hover, .btn-primary:hover,
.btn-secondary:hover, .btn-neutral:hover, .controls button:hover {
  transform: translateY(-1px); border-color: var(--c2) !important;
}
/* Print = gradient primary (.controls-scoped variants out-specify the base .controls button rule) */
.btn-print, .btn-primary, .controls button.primary, .controls .btn-print, .controls .btn-primary {
  background: var(--grad) !important; color: #0a0a12 !important; border: 0 !important;
  box-shadow: 0 8px 24px -6px rgba(129,140,248,.5) !important;
}
/* Clear = dark ghost + red text (Save Image stays the dark ghost base) */
.btn-secondary, .btn-neutral, .controls .btn-secondary, .controls .btn-neutral { color: var(--bad) !important; }
/* handwriting sample = a compact, centered white "paper swatch" chip (not a full-width button) */
.style-preview { margin: 12px auto 0 !important; padding: 9px 18px !important; width: fit-content !important; max-width: 100%;
  background: #fff !important; border: 1px solid var(--line-2) !important; border-radius: 12px !important;
  box-shadow: 0 6px 18px -8px rgba(0,0,0,.6); }
#stylePreview { display: inline !important; background: transparent !important; color: #1a1a1a !important; border: 0 !important; padding: 0 !important; font-size: 15px; line-height: 1.4; }

/* editor's item-builder (NOT the preview's .items-table) */
.items-section { background: var(--bg-2) !important; border: 1px solid var(--line) !important; border-radius: var(--r-sm) !important; padding: 14px !important; }
.items-section h3 { color: var(--soft) !important; font-family: var(--display) !important; }
.item-row input, .item-row select { background: var(--panel-2) !important; color: var(--text) !important; border: 1px solid var(--line-2) !important; border-radius: 8px !important; min-width: 0 !important; }
.items-section { overflow-x: auto; }   /* safety: never spill the delete button onto the preview */
.item-row input:focus, .item-row select:focus { border-color: var(--c2) !important; outline: none !important; }
.remove-item { background: rgba(251,113,133,.14) !important; color: var(--bad) !important; border: 1px solid rgba(251,113,133,.4) !important; border-radius: 8px !important; }
.remove-item:hover { background: rgba(251,113,133,.28) !important; }

/* driver-salary: handwriting-style sub-panel */
.style-selector { background: var(--bg-2) !important; border: 1px solid var(--line) !important; border-radius: var(--r-sm) !important; }
.style-selector label { color: var(--soft) !important; }
.style-selector select { background: var(--panel-2) !important; color: var(--text) !important; border: 1px solid var(--line-2) !important; }
input[type="file"] { color: var(--soft) !important; }
input[type="file"]::file-selector-button { background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-pill); padding: 7px 14px; margin-right: 10px; cursor: pointer; font-weight: 600; }

/* ── splash (shared) ── */
.bk-splash { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: var(--bg); transition: opacity .45s var(--ease); }
.bk-splash.is-hiding { opacity: 0; pointer-events: none; }
.bk-splash__stage { display: grid; place-items: center; gap: 14px; }
.bk-splash__glow { position: absolute; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(129,140,248,.28), transparent 65%); animation: bkpulse 2.2s ease-in-out infinite; }
.bk-splash__logo { width: 140px; height: 140px; object-fit: contain; animation: bkbob 2.4s ease-in-out infinite; }
.bk-splash__word { font-family: var(--display); font-weight: 700; font-size: 24px; letter-spacing: -.5px; color: #fff; }
.bk-splash__bar { width: 150px; height: 4px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.bk-splash__bar span { display: block; height: 100%; width: 40%; border-radius: 99px; background: var(--grad); animation: bkslide 1.1s ease-in-out infinite; }
@keyframes bkpulse { 50% { transform: scale(1.12); opacity: .7; } }
@keyframes bkbob { 50% { transform: translateY(-8px); } }
@keyframes bkslide { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }
.no-splash .bk-splash { display: none; }

/* ── footer ── */
.bk-footer { width: auto; margin: 20px clamp(16px, 3vw, 44px) 22px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 18px; }
.bk-footer a { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; text-decoration: none; }
.bk-footer img { height: 28px; width: auto; }
.bk-footer span { color: var(--faint); font-size: 12.5px; }

/* ── print: only the document, never the chrome ── */
@media print {
  .bk-appbar, .bk-nav, .bk-footer, .bk-splash, .form-container, .controls { display: none !important; }
  body { background: #fff !important; background-image: none !important; }
  .page-container { margin: 0 !important; }
}
