/* BBB Sales Toolkit styles. Brand colours come from Settings via --accent and --dark. */
:root {
  --accent: #ff6b1a;
  --dark: #22252a;
  --bg: #f4f4f2;
  --surface: #ffffff;
  --text: #1d1f23;
  --muted: #5f646d;
  --line: #dcdcd8;
  --good: #1f7a4d;
  --bad: #b3261e;
  --warn-bg: #fff4e5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.05);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  line-height: 1.45;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.8em; }
code { background: #ececea; padding: 0 4px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
[hidden] { display: none !important; }

/* Header */
.site-header {
  background: var(--dark); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  background: var(--accent); color: #fff; font-weight: 800; letter-spacing: 0.5px;
  border-radius: 8px; padding: 8px 10px; font-size: 0.95rem;
}
.brand-name { font-weight: 700; font-size: 1.1rem; }
.brand-sub { font-size: 0.8rem; opacity: 0.75; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.site-header .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.site-header .btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

/* Prospect bar */
.prospect-bar {
  display: grid; grid-template-columns: 1.2fr 1.3fr 2fr 1fr; gap: 12px;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.prospect-bar .field { margin-bottom: 0; }
.field label, legend { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); font-size: 0.78rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type="text"], input[type="number"], input[type="email"], input[type="tel"], input[type="time"], select, textarea {
  font: inherit; font-size: 0.95rem; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); width: 100%;
}
input[type="color"] { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; }
input:focus, select:focus, textarea:focus, [contenteditable="true"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 4px; margin: 0 0 12px; }
details { margin-bottom: 12px; }
summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; margin: 4px 0 8px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Buttons */
.btn {
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { border-color: var(--dark); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(0.95); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-small { padding: 6px 10px; font-size: 0.82rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; align-items: center; }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  font: inherit; font-weight: 600; font-size: 0.95rem; background: none; border: 0; cursor: pointer;
  padding: 14px 16px; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab-num {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--line); color: var(--text); font-size: 0.78rem; margin-right: 4px;
}
.tabs button[aria-selected="true"] .tab-num { background: var(--accent); color: #fff; }

main { padding: 24px; max-width: 1360px; margin: 0 auto; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.warn { background: var(--warn-bg); border-left: 4px solid var(--accent); padding: 8px 12px; border-radius: 6px; font-size: 0.88rem; }

/* Demo */
.demo-layout { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 24px; align-items: start; }
.demo-stage { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.steps-list { list-style: none; padding: 0; margin: 12px 0 0; font-size: 0.88rem; }
.steps-list li { padding: 6px 8px; border-radius: 6px; color: var(--muted); }
.steps-list li.done { color: var(--text); }
.steps-list li.next { background: var(--warn-bg); color: var(--text); font-weight: 600; }
.step-time { font-variant-numeric: tabular-nums; color: var(--muted); margin-right: 6px; }

.phone {
  width: 380px; max-width: 100%; background: #111; border-radius: 34px; padding: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.phone-top { background: #f7f7f7; border-radius: 24px 24px 0 0; padding: 12px 16px 10px; text-align: center; }
.phone-contact { font-weight: 700; }
.phone-sub { font-size: 0.78rem; color: var(--muted); }
.phone-screen {
  background: #fff; height: 520px; overflow-y: auto; padding: 14px 12px;
  border-radius: 0 0 24px 24px; display: flex; flex-direction: column; gap: 10px;
}
.phone-empty { margin: auto; text-align: center; color: var(--muted); padding: 20px; }
.sim-badge {
  display: inline-block; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.8px;
  background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 999px;
}
.phone-top .sim-badge { margin-bottom: 6px; }
.sim-badge-dark { background: var(--dark); }
.sim-tag {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
  border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; opacity: 0.8;
}
.event { font-size: 0.8rem; text-align: center; color: var(--muted); background: #f3f3f1; border-radius: 10px; padding: 8px 10px; }
.event-call { border: 1px dashed var(--bad); color: var(--bad); background: #fdf0ef; }
.bubble { max-width: 84%; }
.is-new { animation: pop 0.25s ease-out; }
.bubble-text { padding: 9px 12px; border-radius: 16px; font-size: 0.92rem; white-space: pre-wrap; word-wrap: break-word; }
.bubble-outbound { align-self: flex-end; }
.bubble-outbound .bubble-text { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.bubble-inbound { align-self: flex-start; }
.bubble-inbound .bubble-text { background: #e9e9eb; color: var(--text); border-bottom-left-radius: 4px; }
.bubble-meta { font-size: 0.7rem; color: var(--muted); margin-top: 3px; padding: 0 4px; }
.bubble-outbound .bubble-meta { text-align: right; }
[contenteditable="true"].bubble-text, .event [contenteditable="true"], .notify-body [contenteditable="true"] { outline: 2px dashed rgba(0, 0, 0, 0.25); outline-offset: 2px; cursor: text; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .is-new { animation: none; } }

.notify-card { width: 380px; max-width: 100%; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border-left: 4px solid var(--dark); padding: 12px 16px; }
.notify-head { font-size: 0.8rem; font-weight: 700; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.notify-body { font-size: 0.9rem; }

/* Calculator */
.calc-layout { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 24px; align-items: start; }
.estimate-banner { background: var(--warn-bg); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 0.9rem; }
.empty-state { text-align: center; padding: 40px 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stat-label { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.7rem; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.stat-accent { background: var(--dark); color: #fff; }
.stat-accent .stat-label, .stat-accent .stat-note { color: rgba(255, 255, 255, 0.75); }
.stat-accent .stat-value { color: var(--accent); }
.stat-negative .stat-value { color: #ff8a80; }
.calc-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.calc-table th, .calc-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.calc-table th:first-child, .calc-table tbody th { text-align: left; font-weight: 600; }
.calc-table thead th { font-size: 0.78rem; color: var(--muted); }
.row-total th, .row-total td { font-weight: 800; border-bottom: 0; }
.breakeven p { margin: 0; }

/* Proposal */
.proposal-layout { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 24px; align-items: start; }
.proposal-stage { overflow-x: auto; }
.proposal-page {
  width: 210mm; min-height: 297mm; margin: 0 auto; background: #fff; box-shadow: var(--shadow);
  padding: 14mm 15mm 12mm; font-size: 10pt; line-height: 1.4; color: #1d1f23; display: flex; flex-direction: column;
}
.proposal-page:focus { outline: none; }
.pp-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 0.23em solid var(--accent); padding-bottom: 0.75em; margin-bottom: 1.05em; }
.pp-brand { display: flex; align-items: center; gap: 0.75em; }
.pp-mark { background: var(--dark); color: var(--accent); font-weight: 800; border-radius: 0.45em; padding: 0.45em 0.6em; font-size: 1.1em; }
.pp-brand-name { font-weight: 800; font-size: 1.3em; }
.pp-tagline { font-size: 0.85em; color: var(--muted); }
.pp-meta { text-align: right; font-size: 0.85em; color: var(--muted); }
.pp-meta div:first-child { font-weight: 800; color: var(--dark); text-transform: uppercase; letter-spacing: 0.08em; }
.pp-title { font-size: 1.7em; margin: 0 0 0.15em; color: var(--dark); }
.pp-for { color: var(--muted); margin-bottom: 0.75em; }
.pp-section { margin-bottom: 0.75em; }
.pp-section h2 { font-size: 1.05em; text-transform: uppercase; letter-spacing: 0.8px; color: var(--accent); margin-bottom: 0.3em; }
.pp-section h3 { font-size: 1.05em; margin: 0 0 0.15em; }
.pp-section ul, .pp-section ol { margin: 0.3em 0 0; padding-left: 1.35em; }
.pp-section li { margin-bottom: 0.08em; }
.pp-service { margin-bottom: 0.6em; }
.pp-service p { margin-bottom: 0.15em; }
.pp-offer-grid { display: grid; gap: 1em; }
.pp-offer-grid-2 { grid-template-columns: 1fr 1fr; }
.pp-offer-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.pp-columns { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.05em; }
.pp-price { background: #f6f6f4; border-radius: 0.6em; padding: 0.75em 0.9em; border-top: 0.23em solid var(--dark); }
.pp-price-main { font-size: 1.7em; font-weight: 800; color: var(--dark); }
.pp-price-sub { font-weight: 600; }
.pp-price-first { margin-top: 0.3em; font-weight: 700; color: var(--accent); }
.pp-price-list { font-size: 0.85em; }
.pp-terms { margin-top: 0.45em; font-size: 0.9em; color: var(--muted); }
.pp-estimate { border: 0.08em dashed var(--line); border-radius: 0.6em; padding: 0.6em 0.9em; }
.pp-next { background: var(--dark); color: #fff; border-radius: 0.6em; padding: 0.75em 1.05em; }
.pp-next h2 { color: var(--accent); }
.pp-next .pp-small { color: rgba(255, 255, 255, 0.75); }
.pp-small { font-size: 0.85em; color: var(--muted); margin: 0; }
.pp-foot { margin-top: auto; padding-top: 0.75em; border-top: 0.08em solid var(--line); font-size: 0.85em; color: var(--muted); text-align: center; }

/* Used while measuring the proposal so narrow screens measure true A4 width */
.proposal-page.measure-a4 { width: 210mm !important; min-height: 0 !important; padding: 14mm 15mm 12mm !important; }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.service-price { border-bottom: 1px solid var(--line); padding: 8px 0 4px; margin-bottom: 8px; }
.service-price-name { font-weight: 700; margin-bottom: 6px; }

.site-footer { text-align: center; font-size: 0.8rem; color: var(--muted); padding: 16px 24px 32px; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff;
  padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); font-size: 0.9rem; z-index: 10; max-width: calc(100% - 32px);
}

/* Responsive */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .prospect-bar { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .demo-layout, .calc-layout, .proposal-layout, .settings-layout { grid-template-columns: 1fr; }
  .demo-stage { order: -1; }
  main { padding: 16px; }
  .site-header, .prospect-bar, .tabs { padding-left: 16px; padding-right: 16px; }
  .proposal-page { transform-origin: top left; }
}
@media (max-width: 560px) {
  .prospect-bar { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.3rem; }
  .phone { border-radius: 26px; padding: 8px; }
  .phone-screen { height: 440px; }
  .calc-table { font-size: 0.8rem; }
  .calc-table th, .calc-table td { padding: 6px 4px; }
  .site-header { flex-direction: column; align-items: flex-start; }
}
@media screen and (max-width: 560px) {
  .proposal-page { width: 100%; min-height: 0; padding: 18px; }
  .pp-columns, .pp-offer-grid-2, .pp-offer-grid-3 { grid-template-columns: 1fr; }
  .measure-a4 .pp-columns { grid-template-columns: 1.4fr 1fr; }
  .measure-a4 .pp-offer-grid-2 { grid-template-columns: 1fr 1fr; }
  .measure-a4 .pp-offer-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* Print: only the proposal, on one A4 page */
@page { size: A4; margin: 0; }
@media print {
  html, body { background: #fff; }
  .no-print, .tabs, .site-header, .prospect-bar, .site-footer, .toast, .panel { display: none !important; }
  #panel-proposal, #panel-proposal[hidden] { display: block !important; }
  main { padding: 0; max-width: none; }
  .proposal-layout { display: block; }
  .proposal-stage { overflow: visible; }
  .proposal-page {
    box-shadow: none; margin: 0; width: 210mm; height: 297mm; min-height: 0; overflow: hidden;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}
