/* DENNIS GLOBAL — industrial metals palette (light canvas) */
:root {
  --header-bg: #111827;
  --header-bg-2: #1f2937;
  --header-border: #374151;
  --header-text: #f9fafb;
  --header-muted: #d1d5db;

  --copper: #b45309;
  --copper-hover: #92400e;
  --copper-soft: #fef3c7;

  --canvas: #f3f4f6;
  --canvas-alt: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --input-border: #cbd5e1;

  --ink: #0f172a;
  --ink-label: #475569;
  --ink-helper: #64748b;

  --wa: #15803d;
  --wa-bright: #16a34a;
  --wa-hover: #166534;

  --pending-bg: #eff6ff;
  --pending-fg: #1d4ed8;
  --counter-bg: #fef3c7;
  --counter-fg: #b45309;
  --agreed-bg: #ecfdf5;
  --agreed-fg: #15803d;
  --rejected-bg: #fef2f2;
  --rejected-fg: #dc2626;
  --caution-bg: #fffbeb;
  --caution-border: #d97706;
  --burn-bg: #fef2f2;
  --burn-fg: #dc2626;

  --focus-ring: 0 0 0 3px rgba(180, 83, 9, 0.18);
  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-2: 0 4px 14px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-3: 0 12px 28px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);

  --radius: 6px;
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
  --max: 1100px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  position: relative;
  overflow-x: hidden;
  max-width: 100%;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 0% 0%, rgba(180, 83, 9, 0.08), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 10%, rgba(21, 128, 61, 0.06), transparent 50%),
    linear-gradient(180deg, var(--canvas-alt) 0%, var(--canvas) 48%, #eef1f4 100%);
  pointer-events: none;
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background-image: repeating-linear-gradient(
    -18deg,
    transparent,
    transparent 12px,
    rgba(15, 23, 42, 0.45) 12px,
    rgba(15, 23, 42, 0.45) 13px
  );
}

a {
  color: var(--copper);
  font-weight: 600;
}

a:hover {
  color: var(--copper-hover);
}

em {
  color: var(--copper);
  font-style: normal;
  font-weight: 700;
}

/* ---------- Header (gunmetal) ---------- */
.site-header {
  margin: 0;
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 1.15rem;
  background: linear-gradient(135deg, var(--header-bg) 0%, var(--header-bg-2) 100%);
  border-bottom: 1px solid var(--header-border);
  color: var(--header-text);
  box-shadow: var(--shadow-2);
}

.header-inner {
  width: min(var(--max), 100%);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: space-between;
  align-items: flex-end;
}

.brand-block {
  flex: 1 1 280px;
  min-width: 0;
  max-width: 100%;
}

/* Install CTA: between brand-sub and WhatsApp. Visible by default — never waits on BIP.
   Desktop (>768) hides the slot; mobile must NEVER use display:none / width:0 / visibility:hidden. */
.install-header-slot {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  box-sizing: border-box;
  overflow: visible;
  visibility: visible;
}

@media (min-width: 769px) {
  .install-header-slot {
    display: none;
  }
}

@media (display-mode: standalone) {
  .install-header-slot {
    display: none !important;
  }
}

.install-header-slot[hidden] {
  display: none !important;
}

.install-header-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  min-width: 7.5rem;
  max-width: 100%;
  min-height: 36px;
  margin: 0 auto;
  padding: 8px 14px;
  border: 1px solid #92400e;
  border-radius: 8px;
  background: #b45309;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.03em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  box-sizing: border-box;
  visibility: visible;
  overflow: visible;
}

.install-header-btn:hover,
.install-header-btn:focus-visible {
  background: #92400e;
  color: #fff;
  outline: none;
  box-shadow: var(--focus-ring);
}

.install-header-dismiss {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--header-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  min-height: 32px;
  padding: 0.15rem 0.5rem;
}

.app-version {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--header-muted, #94a3b8);
  opacity: 0.85;
}

.site-footer .app-version {
  color: #94a3b8;
}

.footer-inner {
  width: min(var(--max), 100%);
  margin: 0 auto;
}

.brand-mark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 8vw, 4rem);
  letter-spacing: 0.04em;
  line-height: 0.92;
  color: var(--header-text);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.brand-title {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.35rem, 4vw, 2rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fef3c7;
  font-variant-numeric: tabular-nums;
}

.brand-sub {
  margin: 0.4rem 0 0;
  color: var(--header-muted);
  font-size: 0.95rem;
}

.contact-block {
  text-align: right;
}

.wa-primary {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  padding: 0.55rem 0.95rem;
  background: var(--wa);
  color: #ffffff;
  border: 1px solid var(--wa-bright);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.wa-primary:hover {
  background: var(--wa-hover);
  color: #ffffff;
  border-color: var(--wa-hover);
}

.wa-alt {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--header-muted);
}

.wa-alt a {
  color: #fde68a;
  font-weight: 600;
}

.wa-alt a:hover {
  color: #fff7ed;
}

/* ---------- View toggle ---------- */
.view-toggle {
  max-width: var(--max);
  margin: 1.25rem auto 0;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.view-btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.85rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink-label);
  cursor: pointer;
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.view-btn.is-active {
  background: var(--copper-soft);
  color: var(--copper-hover);
  border-color: var(--copper);
  box-shadow: inset 0 -3px 0 var(--copper), var(--shadow-1);
}

.view-btn:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--copper);
  box-shadow: var(--focus-ring);
}

/* ---------- Panels / cards ---------- */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.panel[hidden] {
  display: none !important;
}

.panel-intro h2,
.buyer-lock h2,
.desk-toolbar h2,
.modal-sheet h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.85rem;
  letter-spacing: 0.03em;
  margin: 0 0 0.4rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.panel-intro p,
.buyer-lock > p {
  margin: 0 0 1.25rem;
  color: var(--ink-label);
}

fieldset.card-free {
  margin: 0 0 1.35rem;
  padding: 1.15rem 1.05rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-2);
}

legend {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 0 0.35rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1rem;
}

.span-2 {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.92rem;
  color: var(--ink-helper);
}

label > span:first-child {
  font-weight: 600;
  color: var(--ink-label);
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="file"],
select,
textarea,
button {
  max-width: 100%;
  box-sizing: border-box;
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="file"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  padding: 0.55rem 0.65rem;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="file"] {
  padding: 0.45rem;
  background: var(--canvas-alt);
  border-style: dashed;
}

textarea {
  resize: vertical;
  min-height: 4rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--copper);
  box-shadow: var(--focus-ring);
  outline: none;
}

input.is-invalid,
select.is-invalid,
textarea.is-invalid {
  border-color: var(--rejected-fg);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.hint,
.file-meta {
  font-size: 0.82rem;
  color: var(--ink-helper);
}

.field-error,
.form-error {
  color: var(--rejected-fg);
  font-size: 0.92rem;
  margin: 0.5rem 0 0;
  font-weight: 600;
}

.extracted {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: var(--agreed-bg);
  border-left: 3px solid var(--wa);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  color: var(--ink);
}

.extracted p {
  margin: 0;
}

.extracted strong {
  color: var(--ink-label);
}

/* Segmented ID toggle */
.id-toggle {
  display: inline-flex;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.seg-btn {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--input-border);
  background: #ffffff;
  color: var(--ink-label);
  cursor: pointer;
  border-radius: var(--radius);
}

.seg-btn.is-active {
  background: var(--copper);
  color: #ffffff;
  border-color: var(--copper-hover);
}

.seg-btn.is-active:hover {
  background: var(--copper-hover);
}

/* ---------- Metal lines ---------- */
.metal-lines {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.metal-line {
  padding: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--canvas-alt);
  box-shadow: var(--shadow-1);
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

.metal-line-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
}

.metal-line-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.btn-remove {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border: 1px solid #fecaca;
  background: var(--rejected-bg);
  color: var(--rejected-fg);
  cursor: pointer;
  border-radius: var(--radius);
}

.btn-remove:hover {
  background: #fee2e2;
}

.line-subtotal {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.25rem;
  padding: 0.55rem 0.65rem;
  background: var(--copper-soft);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  color: var(--ink-label);
}

.line-subtotal strong,
.totals-bar strong,
.counter-summary strong {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--copper);
  font-variant-numeric: tabular-nums;
}

.burn-warning {
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.7rem;
  background: var(--burn-bg);
  border: 1px solid #fecaca;
  border-left: 4px solid var(--burn-fg);
  color: var(--burn-fg);
  font-weight: 700;
  font-size: 0.9rem;
}

.photo-thumb {
  margin-top: 0.4rem;
  max-width: 120px;
  max-height: 90px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}

.totals-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  background: linear-gradient(90deg, var(--copper-soft), #fff7ed);
  border: 1px solid var(--copper);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.totals-bar strong {
  color: var(--copper-hover);
  font-size: 1.5rem;
}

.pickup-block {
  margin-top: 0.5rem;
}

.declarations .check-row {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  color: var(--ink);
}

.declarations .check-row input {
  width: auto;
  margin-top: 0.25rem;
  flex-shrink: 0;
  accent-color: var(--copper);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 1rem;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--copper);
  color: #ffffff;
  border-color: var(--copper-hover);
  box-shadow: var(--shadow-1);
}

.btn-primary:hover {
  background: var(--copper-hover);
}

.btn-secondary {
  background: #ffffff;
  color: var(--wa);
  border-color: var(--wa-bright);
}

.btn-secondary:hover {
  background: var(--agreed-bg);
  border-color: var(--wa-hover);
  color: var(--wa-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-label);
  border-color: var(--input-border);
}

.btn-ghost:hover {
  background: var(--canvas);
  color: var(--ink);
}

/* Add Metal Line — dashed copper */
#addMetalLine {
  width: 100%;
  background: #ffffff;
  color: var(--copper);
  border: 2px dashed var(--copper);
  box-shadow: none;
}

#addMetalLine:hover {
  background: var(--caution-bg);
  color: var(--copper-hover);
  border-color: var(--copper-hover);
}

/* ---------- Buyer ---------- */
.buyer-lock {
  max-width: 420px;
  padding: 1.25rem;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}

.buyer-lock label {
  margin-bottom: 0.75rem;
}

.desk-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.offer-cards {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.offer-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 1rem;
  box-shadow: var(--shadow-2);
}

.offer-card header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.offer-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.status-pill {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.status-pending {
  color: var(--pending-fg);
  background: var(--pending-bg);
  border-color: #bfdbfe;
}

.status-counter {
  color: var(--counter-fg);
  background: var(--counter-bg);
  border-color: #fde68a;
}

.status-agreed {
  color: var(--agreed-fg);
  background: var(--agreed-bg);
  border-color: #86efac;
}

.status-rejected {
  color: var(--rejected-fg);
  background: var(--rejected-bg);
  border-color: #fecaca;
}

.offer-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.45rem 1rem;
  font-size: 0.92rem;
  color: var(--ink-helper);
  margin-bottom: 0.85rem;
}

.offer-meta strong {
  color: var(--ink-label);
  font-weight: 600;
}

.offer-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.offer-lines th,
.offer-lines td {
  text-align: left;
  padding: 0.4rem 0.35rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--ink);
}

.offer-lines th {
  color: var(--ink-label);
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.offer-lines input[type="number"] {
  max-width: 7rem;
}

.thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.5rem 0 0.75rem;
}

.thumb-row img {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.counter-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.5rem 0 0.85rem;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  color: var(--ink-label);
  font-variant-numeric: tabular-nums;
}

.margin-pos {
  color: var(--wa);
}

.margin-neg {
  color: var(--rejected-fg);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-actions [data-action="send-wa"],
.card-actions [data-action="seller-accept"] {
  background: var(--wa);
  color: #ffffff;
  border-color: var(--wa-hover);
}

.card-actions [data-action="send-wa"]:hover,
.card-actions [data-action="seller-accept"]:hover {
  background: var(--wa-hover);
  color: #ffffff;
}

.card-actions [data-action="reject"] {
  color: var(--rejected-fg);
  border-color: #fecaca;
  background: var(--rejected-bg);
}

/* Act 6 caution strip (declarations / burned helper) */
.declarations {
  border-left: 4px solid var(--caution-border);
  background: linear-gradient(90deg, var(--caution-bg), #ffffff 40%);
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(17, 24, 39, 0.55);
  box-sizing: border-box;
}

.modal[hidden] {
  display: none !important;
}

.modal-sheet {
  width: min(560px, 100%);
  max-width: 100%;
  max-height: min(90vh, 100%);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--copper);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: var(--shadow-3);
  color: var(--ink);
  box-sizing: border-box;
}

.install-help-modal {
  place-items: end center;
  align-content: end;
  padding: 0;
}

.slip {
  margin: 0.85rem 0;
  padding: 0.75rem;
  background: var(--canvas-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: pre-wrap;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.85rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- Footer ---------- */
.site-footer {
  max-width: none;
  margin: 0;
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 2.5rem;
  border-top: 1px solid var(--header-border);
  background: linear-gradient(135deg, var(--header-bg) 0%, var(--header-bg-2) 100%);
  color: var(--header-muted);
  font-size: 0.92rem;
}

.site-footer p {
  margin: 0 0 0.4rem;
}

.site-footer strong {
  color: var(--header-text);
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}

.site-footer a {
  color: #fde68a;
}

.site-footer a:hover {
  color: #fff7ed;
}

.footer-note {
  font-size: 0.82rem;
}

code {
  font-family: ui-monospace, Consolas, monospace;
  background: #e2e8f0;
  color: var(--ink);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .contact-block {
    text-align: left;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .view-toggle {
    grid-template-columns: 1fr;
  }

  .offer-lines {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .totals-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .card-actions .btn-primary,
  .card-actions .btn-secondary,
  .card-actions .btn-ghost,
  #addMetalLine,
  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}

@media print {
  .atmosphere,
  .view-toggle,
  .site-header .contact-block,
  .form-actions,
  .desk-toolbar,
  .card-actions,
  nav {
    display: none !important;
  }

  body {
    background: #fff;
    color: #111;
  }

  .site-header,
  .site-footer {
    background: #fff;
    color: #111;
    box-shadow: none;
  }

  .modal {
    position: static;
    background: none;
    display: block !important;
  }

  .modal-sheet {
    box-shadow: none;
    border: none;
    max-height: none;
  }
}

/* ---- Feature enhancements: compression badge, PIN modal, weighbridge print ---- */
.compress-badge {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--copper-hover);
  background: var(--copper-soft);
  border: 1px solid #fde68a;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  width: fit-content;
}

.wb-printable {
  margin-top: 0.75rem;
}

.wb-print-header {
  text-align: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 2px solid var(--copper);
}

.wb-brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.75rem;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.wb-sub,
.wb-contact {
  margin: 0.2rem 0 0;
  color: var(--ink-label);
  font-size: 0.9rem;
}

.wb-slip-title {
  margin: 0.5rem 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--copper);
}

.wb-signatures {
  margin-top: 1rem;
  color: var(--ink);
  font-size: 0.95rem;
}

.wb-signatures p {
  margin: 0.75rem 0 0;
}

.toolbar-actions {
  max-width: 100%;
}

@media print {
  body * {
    visibility: hidden;
  }

  #weighbridgeModal,
  #weighbridgeModal * {
    visibility: visible;
  }

  #weighbridgeModal {
    position: static !important;
    inset: auto !important;
    background: none !important;
    display: block !important;
    padding: 0 !important;
  }

  .weighbridge-sheet {
    box-shadow: none !important;
    border: none !important;
    max-height: none !important;
    width: 100% !important;
    padding: 0 !important;
  }

  .no-print {
    display: none !important;
  }

  .wb-printable {
    color: #000;
  }

  .slip {
    background: #fff;
    border-color: #ccc;
    color: #000;
  }
}

/* ---- Backend / commercial tools UI ---- */
.quote-confirmation {
  margin-top: 1.5rem;
  padding: 1.25rem 1.1rem;
  border: 1px solid #86efac;
  border-left: 4px solid var(--wa);
  background: linear-gradient(135deg, var(--agreed-bg), #ffffff);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}

.quote-confirmation h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  color: var(--wa);
}

.confirm-ref,
.confirm-total {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.confirm-metals {
  margin: 0.75rem 0;
  padding-left: 1.15rem;
  color: var(--ink-label);
}

.btn-whatsapp {
  display: inline-block;
  margin: 0.5rem 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.7rem 1.1rem;
  background: var(--wa);
  color: #ffffff !important;
  border: 1px solid var(--wa-hover);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.btn-whatsapp:hover {
  background: var(--wa-hover);
  color: #ffffff !important;
}

.price-sheet-panel {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-1);
}

.price-sheet-panel > summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--copper);
  list-style: none;
}

.price-sheet-panel > summary::-webkit-details-marker {
  display: none;
}

.price-sheet-panel[open] > summary {
  margin-bottom: 0.65rem;
}

.price-sheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem 0.85rem;
  margin: 0.75rem 0;
}

.target-flag {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

.target-within {
  color: var(--wa);
  background: var(--agreed-bg);
  border: 1px solid #86efac;
}

.target-over {
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fbbf24;
}

.target-over-hard {
  color: var(--rejected-fg);
  background: var(--rejected-bg);
  border: 1px solid #fecaca;
}

.api-mode-hint {
  font-size: 0.8rem;
  color: var(--ink-helper);
  margin: 0 0 0.75rem;
}

/* ---- 63 grades + margin price sheet ---- */
.act6-banner {
  margin: 0 0 0.9rem;
  padding: 0.65rem 0.75rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #dc2626;
  color: #991b1b;
  font-size: 0.92rem;
  font-weight: 600;
}

.grade-note {
  display: block;
  margin-top: 0.35rem;
  padding: 0.35rem 0.55rem;
  background: #fffbeb;
  border-left: 3px solid #d97706;
  color: #92400e;
  font-size: 0.85rem;
  font-weight: 700;
}

.price-sheet-controls {
  margin: 0.75rem 0;
}

.price-sheet-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.5rem 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.price-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.price-sheet-table th,
.price-sheet-table td {
  padding: 0.4rem 0.45rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.price-sheet-table th {
  position: sticky;
  top: 0;
  background: #1f2937;
  color: #f9fafb;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.75rem;
  z-index: 1;
}

.price-sheet-table .cat-row td {
  background: #fef3c7;
  color: #92400e;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.price-sheet-table input[type="number"] {
  max-width: 6.5rem;
  padding: 0.35rem 0.4rem;
}

.price-sheet-table .placeholder-cell {
  color: #94a3b8;
  font-style: italic;
}

.target-buy-cell {
  font-weight: 700;
  color: var(--copper);
}

.profit-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  margin: 0.35rem 0 0.85rem;
  padding: 0.55rem 0.7rem;
  background: #ecfdf5;
  border: 1px solid #86efac;
  border-radius: var(--radius);
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.profit-summary .profit-neg {
  color: #dc2626;
}

/* ---- PWA / mobile-first ---- */
body {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

.install-help-sheet {
  border-radius: 16px 16px 0 0;
  margin: 0;
  width: 100%;
  max-width: 100%;
  padding-bottom: calc(1.15rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 769px) {
  .install-help-modal {
    place-items: center;
    align-content: center;
    padding: 1rem;
  }

  .install-help-sheet {
    border-radius: var(--radius);
    width: min(480px, 100%);
    padding-bottom: 1.15rem;
  }
}

.install-help-body {
  margin: 0.75rem 0 1rem;
}

.install-steps {
  margin: 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.install-steps li {
  line-height: 1.45;
}

.install-inapp-note {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.75rem;
  background: #fff7ed;
  border-left: 3px solid var(--copper);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}

.install-chrome-card {
  margin: 0.85rem 0 0;
  display: flex;
  justify-content: center;
}

.install-chrome-link {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.15rem;
  text-decoration: none;
  text-align: center;
  width: 100%;
  max-width: 22rem;
  box-sizing: border-box;
}

.view-btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.seg-btn,
#addMetalLine,
.bottom-nav-btn,
.wa-primary {
  min-height: 48px;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .site-header {
    padding: 1rem 0.85rem 0.9rem;
    overflow: visible;
  }

  .header-inner {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.65rem;
    overflow: visible;
  }

  .brand-block {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    overflow: visible;
  }

  .brand-mark {
    font-size: clamp(1.85rem, 9vw, 2.75rem);
    word-break: break-word;
  }

  .brand-title {
    font-size: clamp(1.05rem, 4.5vw, 1.45rem);
  }

  .brand-sub {
    margin: 0.35rem 0 0;
    font-size: 0.85rem;
    overflow-wrap: anywhere;
  }

  /* Own row between tagline and WhatsApp — never clipped / never display:none here */
  .install-header-slot {
    display: flex;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    visibility: visible;
  }

  .install-header-btn {
    display: inline-flex !important;
    background: #b45309;
    color: #fff;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 8px;
    visibility: visible;
  }

  .contact-block {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    text-align: left;
    margin: 0;
    overflow: visible;
  }

  .wa-primary {
    display: block;
    width: 100%;
    max-width: 100%;
    text-align: center;
    font-size: 1rem;
    padding: 0.65rem 0.75rem;
  }

  .wa-alt {
    margin-top: 0.35rem;
  }

  .view-toggle {
    padding: 0 0.85rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  main {
    padding: 1.1rem 0.85rem 3rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  fieldset.card-free {
    padding: 0.95rem 0.75rem 1.05rem;
    max-width: 100%;
    overflow: visible;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .id-toggle {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
  }

  .id-toggle .seg-btn {
    flex: 1 1 auto;
  }

  .panel-intro h2,
  .buyer-lock h2,
  .desk-toolbar h2,
  .modal-sheet h3 {
    font-size: clamp(1.35rem, 6vw, 1.75rem);
    overflow-wrap: anywhere;
  }

  .offer-meta {
    grid-template-columns: 1fr;
  }
}

/* Clean 2-row wrap under 640px — Install App on its own full-width row */
@media (max-width: 640px) {
  .site-header {
    padding: 0.85rem 0.75rem 0.8rem;
    overflow: visible;
  }

  .header-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow: visible;
  }

  .brand-block {
    flex: 1 1 100%;
  }

  .install-header-slot {
    display: flex;
    flex: 1 1 100%;
    width: 100%;
    overflow: visible;
    visibility: visible;
  }

  .install-header-btn {
    display: inline-flex !important;
    background: #b45309;
    color: #fff;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 8px;
  }

  .contact-block {
    flex: 1 1 100%;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding: 0.85rem 0.7rem 0.75rem;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 8px;
  }

  .install-header-slot {
    display: flex;
    flex: 1 1 100%;
  }

  .install-header-btn {
    display: inline-flex !important;
    background: #b45309;
    color: #fff;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 8px;
  }

  main,
  .view-toggle {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }

  .bottom-nav-btn {
    font-size: 0.68rem;
    padding: 0.4rem 0.2rem;
  }

  .bottom-nav-label {
    max-width: 100%;
  }

  .metal-line {
    padding: 0.75rem;
  }

  .install-help-sheet {
    border-radius: 14px 14px 0 0;
  }
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  background: #111827;
  border-top: 1px solid #374151;
  padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.25);
}

.bottom-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #d1d5db;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 0.45rem 0.35rem;
  cursor: pointer;
  min-height: 48px;
}

.bottom-nav-btn.is-active {
  color: #fef3c7;
  background: rgba(180, 83, 9, 0.22);
  box-shadow: inset 0 0 0 1px #b45309;
}

.bottom-nav-wa {
  color: #86efac;
}

.bottom-nav-wa:hover,
.bottom-nav-btn:hover {
  color: #fff;
}

.bottom-nav-label {
  line-height: 1.15;
  max-width: 7.5rem;
}

@media (min-width: 900px) {
  .bottom-nav {
    /* Keep bottom nav for PWA consistency on tablet/desktop too */
  }
}

@media print {
  .install-header-slot,
  .bottom-nav {
    display: none !important;
  }
  body {
    padding-bottom: 0;
  }
}
