/* styles.css — Kabin Quote Tool
   Fonts are in fonts.css (do not edit / upload for routine tasks)
   Logo is logo.png in the project root */

:root {
    /* Kabin brand palette */
    --ink: #1a1a18;
    --ink-soft: #4a4a46;
    --ink-faint: #8a8a84;
    --paper: #f5f3ee;
    --paper-warm: #ede9e0;
    --paper-mid: #d8d4c8;
    /* Brand accent — Kabin coral #FFA28C, used for interactive/highlight states */
    --accent: #c8541a;
    --accent-light: #fdf0eb;
    --accent-dark: #a03e10;
    /* Brand confirmation colour — Kabin navy #243646 used for 'done' states */
    --green: #243646;
    --green-light: #dde5eb;
    /* Brand supporting — warm tan #987B5D, grey #9D9988 available as needed */
    --brand-tan: #987B5D;
    --brand-grey: #9D9988;
    --brand-coral: #FFA28C;
    --brand-navy: #243646;
    --border: rgba(26,26,24,0.12);
    --border-strong: rgba(26,26,24,0.25);
    --shadow: 0 2px 12px rgba(26,26,24,0.08);
    --shadow-lg: 0 8px 32px rgba(26,26,24,0.12);
    --r: 3px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    background: #ECE9E1;
    color: var(--ink);
    font-family: 'Haffer', sans-serif;
    font-weight: 400;
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom, 0);
    display: flex;
    flex-direction: column;
}

/* ── HEADER ── */
header {
    background: var(--ink);
    color: var(--paper);
    padding: 0 2.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo {
    font-family: 'Haffer', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -0.01em;
    color: var(--paper);
}
.logo span { color: var(--accent); font-style: italic; }
.header-sub {
    font-family: 'Apercu Mono Pro', 'Courier New', monospace;
    font-size: 0.7rem;
    color: var(--ink-faint);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ── PROGRESS BAR ── */
.progress-strip {
    background: var(--paper-warm);
    border-bottom: 1px solid var(--border);
    padding: 0 2.5rem;
    display: flex;
    align-items: stretch;
    height: 48px;
    gap: 0;
    overflow-x: auto;
}
.step-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1.2rem;
    font-family: 'Apercu Mono Pro', 'Courier New', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
    border-bottom: 2px solid transparent;
    cursor: default;
    white-space: nowrap;
    transition: all 0.2s;
    user-select: none;
}
.step-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(200, 84, 26, 0.04);
}
.step-tab.done { color: var(--green); cursor: pointer; }
.step-tab.done:hover { background: var(--green-light); }
.step-num {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.65rem;
    flex-shrink: 0;
}
.step-tab.done .step-num {
    background: var(--green);
    border-color: var(--green);
    color: white;
}
.step-tab.done .step-num::after { content: '✓'; font-size: 0.6rem; }
.step-tab.done .step-num span { display: none; }

/* ── MAIN LAYOUT ── */
main {
    flex: 1;
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

/* ── PAGE TITLES ── */
.page-header { margin-bottom: 2rem; }
.page-tag {
    font-family: 'Apercu Mono Pro', 'Courier New', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.35rem;
}
h1 {
    font-family: 'Haffer', sans-serif;
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--ink);
}
.page-desc {
    margin-top: 0.5rem;
    color: var(--ink-soft);
    font-size: 0.9rem;
    font-weight: 300;
}

/* ── CARDS / SECTIONS ── */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
}
.card-title {
    font-family: 'Apercu Mono Pro', 'Courier New', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* ── FORM ELEMENTS ── */
.field { margin-bottom: 1.1rem; }
.field:last-child { margin-bottom: 0; }
label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ink-soft);
    margin-bottom: 0.35rem;
    letter-spacing: 0.01em;
}
label .req { color: var(--accent); margin-left: 2px; }
.field-hint { font-size: 0.75rem; color: var(--ink-soft); margin-top: 0.3rem; }
input[type="text"], input[type="number"], select, textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid #b8b5ae;
    border-radius: var(--r);
    font-family: 'Haffer', sans-serif;
    font-size: 0.9rem;
    color: var(--ink);
    background: #F5F3EE;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}
select {
    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='%234a4a46' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.2rem;
    cursor: pointer;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200, 84, 26, 0.1);
}
input:disabled, select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--paper-warm);
}
textarea { resize: vertical; min-height: 80px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

/* ── COMPUTED DISPLAY ── */
.computed-field {
    background: var(--paper-warm);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 0.6rem 0.85rem;
    font-family: 'Apercu Mono Pro', 'Courier New', monospace;
    font-size: 0.88rem;
    color: var(--ink-soft);
    min-height: 2.4rem;
    display: flex;
    align-items: center;
}
.computed-field.has-value { color: var(--ink); font-weight: 500; }
.computed-highlight {
    background: var(--accent-light);
    border-color: rgba(200,84,26,0.25);
    color: var(--accent-dark);
    font-weight: 500;
}

/* ── LINE ITEMS TABLE ── */
.line-items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.line-items-list { display: flex; flex-direction: column; gap: 0.75rem; }
.line-item {
    background: var(--paper-warm);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 0.9rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.line-item-num {
    font-family: 'Apercu Mono Pro', 'Courier New', monospace;
    font-size: 0.65rem;
    color: var(--ink-faint);
    width: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}
.line-item-info { flex: 1; }
.line-item-name { font-weight: 500; font-size: 0.88rem; }
.line-item-detail { font-size: 0.78rem; color: var(--ink-soft); margin-top: 2px; }
.line-item-price {
    font-family: 'Apercu Mono Pro', 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    text-align: right;
}
.line-item-remove {
    background: none; border: none; cursor: pointer;
    color: var(--ink-faint); font-size: 1rem; padding: 2px 4px;
    border-radius: 2px; line-height: 1;
    transition: color 0.15s, background 0.15s;
}
.line-item-remove:hover { color: var(--accent); background: var(--accent-light); }
.line-item-edit {
    background: none; border: none; cursor: pointer;
    color: var(--ink-faint); font-size: 1rem; padding: 2px 4px;
    border-radius: 2px; line-height: 1;
    transition: color 0.15s, background 0.15s;
    margin-right: 2px;
}
.line-item-edit:hover { color: var(--green); background: rgba(74,163,98,0.08); }

/* ── BUTTONS ── */
.btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    border-radius: var(--r);
    font-family: 'Haffer', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid #b8b5ae;
    text-decoration: none;
}
.btn-primary {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}
.btn-primary:hover { background: #2e2e2a; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-accent {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-dark); }
.btn-outline {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--border-strong);
}
.btn-outline:hover { background: var(--paper-warm); }
.btn-ghost {
    background: transparent;
    color: var(--ink-soft);
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
}
.btn-ghost:hover { color: var(--ink); background: var(--paper-warm); }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-green {
    background: var(--green);
    color: white;
    border-color: var(--green);
}
.btn-green:hover { background: #235240; }

/* ── NAVIGATION FOOTER ── */
.nav-footer {
    background: white;
    border-top: 1px solid var(--border);
    padding: 1rem 2.5rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    bottom: 0;
    z-index: 50;
}
.nav-hint {
    font-size: 0.78rem;
    color: var(--ink-faint);
    font-style: italic;
}

 /* ─────────────────────────────────────────────────────────────
   QUOTE SUMMARY — replacement CSS
   Targets: #printableQuote, #printableQuoteEndUser
   Replaces: .summary-table, .totals-block, .totals-row
   Leaves untouched: #markupTotalsPreview (page 5 preview)
───────────────────────────────────────────────────────────── */

/* ── Document label (DEALER COPY / CUSTOMER COPY) ─────────── */
.q-doc-label {
  font-family: 'Haffer', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-faint);           /* grey, matching PDF */
  text-transform: uppercase;
  margin: 0 0 0.6rem;
  line-height: 1;
}
.q-doc-rule {
  border: none;
  border-top: 1.5px solid var(--ink);
  margin: 0 0 1.4rem;
}

/* ── Address header — 3-column grid ───────────────────────── */
.q-address-header {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0 2rem;
  margin-bottom: 1.4rem;
  align-items: start;
}
.q-address-col-label {
  font-family: 'Apercu Mono Pro', 'Courier New', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.3rem;
}
.q-address-col strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
}
.q-address-col {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink);
}
.q-quotation-col {
  text-align: right;
  font-size: 0.85rem;
  line-height: 1.45;
}
.q-quotation-col .q-ref {
  font-family: 'Apercu Mono Pro', 'Courier New', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  display: block;
}
.q-quotation-col .q-date {
  font-weight: 600;
  color: var(--ink);
}
.q-region {
  color: var(--ink-faint);
  font-style: normal;
}

/* ── Section labels ───────────────────────────────────────── */
.q-section-label {
  font-family: 'Apercu Mono Pro', 'Courier New', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.45rem;
}

/* ── Discounts block ──────────────────────────────────────── */
.q-discounts-block {
  margin-bottom: 1.4rem;
}
.q-discount-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.08rem 0;
  color: var(--ink);
}
.q-discount-row .mono {
  font-family: 'Apercu Mono Pro', 'Courier New', monospace;
  font-size: 0.82rem;
}

/* ── Products table ───────────────────────────────────────── */
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 0;
}
.summary-table th {
  font-family: 'Apercu Mono Pro', 'Courier New', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: left;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  white-space: nowrap;
}
.summary-table td {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.summary-table tr:last-child td { border-bottom: none; }
.summary-table .mono {
  font-family: 'Apercu Mono Pro', 'Courier New', monospace;
  font-size: 0.82rem;
}
.summary-table .right { text-align: right; }

/* Row sub-elements */
.q-num { color: var(--ink-faint); }
.q-product-cell { min-width: 10rem; }
.q-colour-desc {
  color: var(--ink-faint);
  font-size: 0.78em;
}
.q-com-badge {
  font-size: 0.68em;
  background: var(--paper-warm);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0 3px;
  color: var(--ink-faint);
  margin-left: 3px;
}
.q-com-note {
  display: block;
  font-size: 0.72rem;
  color: var(--accent);
  margin-top: 0.1rem;
}
.q-discount-cell { color: var(--ink-soft); }

/* tfoot — Sell Price / Sub-Total row */
.summary-table tfoot td {
  padding: 0.55rem 0.5rem;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  font-weight: 700;
  font-size: 0.92rem;
  background: transparent;
}

#summaryTotals,
#euSummaryTotals {
  margin-top: 0.6rem;
  padding: 0;
  border: none;
  background: transparent;
}

.q-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.18rem 0;
  font-size: 0.85rem;
  color: var(--ink);
}
.q-cost-row .mono {
  font-family: 'Apercu Mono Pro', 'Courier New', monospace;
  font-size: 0.82rem;
}
.q-total-row {
  border-top: 1.5px solid var(--ink);
  margin-top: 0.3rem;
  padding-top: 0.45rem;
  font-family: 'Haffer', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}
.q-total-row .mono {
  font-family: 'Haffer', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}

/* ── Print footer — 3-column strip ───────────────────────── */
.print-footer {
  margin-top: 2rem;
}
.q-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0 2rem;
  border-top: 1px solid var(--border);
  padding-top: 0.65rem;
}
.q-footer-col-label {
  font-family: 'Apercu Mono Pro', 'Courier New', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.3rem;
}
.q-footer-col {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink);
}

/* ── Quote document header ────────────────────────────────── */
.q-brand-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0;
}
.q-brand-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.q-brand-contact {
  text-align: right;
  font-family: 'Haffer', sans-serif;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.q-brand-contact strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
}
/* EU-only spacing between address block and products table */
.q-eu-product-spacer {
  height: 85px;
}



/* ── ALERT / INFO ── */
.info-box {
    background: var(--accent-light);
    border: 1px solid rgba(200,84,26,0.2);
    border-radius: var(--r);
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    color: var(--accent-dark);
    margin-bottom: 1rem;
}
.info-box.green {
    background: var(--green-light);
    border-color: rgba(36,54,70,0.2);
    color: var(--green);
}

/* ── QUOTE META ── */
.quote-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.meta-item .meta-label {
    font-family: 'Apercu Mono Pro', 'Courier New', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 0.2rem;
}
.meta-item .meta-val {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Print */
@media print {
    header, .progress-strip, .nav-footer { display: none; }
    main { padding: 0; max-width: 100%; }
    .card { box-shadow: none; break-inside: avoid; }
    .btn { display: none; }
    .no-print { display: none; }
    /* Force background colours to print — prevents black box disappearing */
    * {
      -webkit-print-color-adjust: exact !important;
      print-color-adjust: exact !important;
      color-adjust: exact !important;
    }
}

/* Transitions */
.page { display: none; }
.page.active { display: block; }

/* Add product form within page 2 */
.product-form-area {
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
    margin-top: 1rem;
}
.add-product-btn-wrap { margin-top: 1rem; display: flex; gap: 0.75rem; align-items: center; }

/* Discount rate display */
.rate-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--green-light);
    color: var(--green);
    border-radius: 2px;
    padding: 0.15rem 0.5rem;
    font-family: 'Apercu Mono Pro', 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: 500;
}


/* ── Page 5: markup totals preview ───────────────────────── */
.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  line-height: 9px;
  margin-bottom: 9px;
  font-weight: 400;
  color: var(--ink);
}
.totals-row .label {
  text-align: left;
  font-weight: 400;
  color: var(--ink);
}
.totals-row span:last-child {
  text-align: right;
  font-family: 'Apercu Mono Pro', 'Courier New', monospace;
  font-weight: 400;
  color: var(--ink);
}
.totals-row.total-line {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--border-strong);
  font-weight: 700;
  font-size: 1.1em;
}
.totals-row.total-line .label {
  font-weight: 700;
}
.totals-row.total-line span:last-child {
  font-weight: 700;
  font-size: 1.0em;
}
/* ── Page 5: job summary section titles ───────────────────── */
.margin-section-title {
  font-family: 'Apercu Mono Pro', 'Courier New', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}
/* Margin highlight row — gross margin % */
.totals-row.margin-highlight {
  color: var(--ink);
  font-weight: 700;
}
.totals-row.margin-highlight span:last-child {
  font-weight: 700;
  font-size: 1.1em;
}
/* Dealer quote: gross margin rows below Total */
.q-margin-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  border-top: 1px dashed var(--border);
}
.q-margin-row:first-of-type {
  margin-top: 0.5rem;
}
.q-margin-pct {
  font-weight: 700;
  color: var(--ink);
  font-size: 0.88rem;
}
