/* ============================================================
   Calculadora de Precificação — Design tokens & base
   ============================================================ */
:root {
  /* Surfaces — deep blue-purple night */
  --bg:         oklch(0.16 0.018 270);
  --bg-2:       oklch(0.19 0.020 270);
  --surface:    oklch(0.22 0.022 270);
  --surface-2:  oklch(0.26 0.022 270);
  --surface-3:  oklch(0.30 0.022 270);
  --hairline:   oklch(0.34 0.018 270);
  --hairline-strong: oklch(0.42 0.020 270);

  /* Text */
  --fg:         oklch(0.96 0.008 90);
  --fg-2:       oklch(0.86 0.010 90);
  --fg-muted:   oklch(0.66 0.018 270);
  --fg-faint:   oklch(0.52 0.018 270);

  /* Brand & semantic */
  --brand:      oklch(0.82 0.16 175);   /* teal-emerald */
  --brand-2:    oklch(0.74 0.18 165);
  --brand-soft: oklch(0.30 0.08 175);

  --good:       oklch(0.78 0.18 155);   /* SAUDÁVEL */
  --good-soft:  oklch(0.30 0.09 155);
  --warn:       oklch(0.82 0.15 75);    /* APERTADO */
  --warn-soft:  oklch(0.30 0.08 70);
  --bad:        oklch(0.70 0.20 25);    /* PREJUÍZO */
  --bad-soft:   oklch(0.30 0.10 25);

  /* Radii & shadows */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 999px;

  --shadow-card: 0 1px 0 oklch(1 0 0 / 0.04) inset,
                 0 24px 60px -30px oklch(0 0 0 / 0.6);

  /* Type */
  --f-display: "Bricolage Grotesque", ui-serif, Georgia, serif;
  --f-sans: "Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, oklch(0.30 0.08 200 / 0.25), transparent 60%),
    radial-gradient(1000px 500px at -10% 100%, oklch(0.30 0.08 290 / 0.20), transparent 60%),
    var(--bg);
}

button { font: inherit; color: inherit; }

/* ============================================================
   App shell
   ============================================================ */
.app {
  max-width: 1480px;
  margin: 0 auto;
  padding: 36px 48px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  display: grid;
  place-items: center;
  color: oklch(0.15 0.02 200);
  font-weight: 700;
  font-family: var(--f-display);
  font-size: 20px;
  box-shadow: 0 6px 24px -8px var(--brand);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.brand-name {
  font-family: var(--f-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.topbar-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--fg-muted);
  font-size: 13px;
  font-family: var(--f-mono);
}
.topbar-meta .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 12px var(--brand);}

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-full);
  width: fit-content;
  margin-bottom: 32px;
}
.tab {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 11px 22px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--fg-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: color 0.15s ease, background 0.2s ease;
}
.tab:hover { color: var(--fg-2); }
.tab[aria-selected="true"] {
  background: var(--surface-3);
  color: var(--fg);
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.06) inset;
}
.tab-num {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-faint);
  background: oklch(0 0 0 / 0.25);
  padding: 2px 6px;
  border-radius: 6px;
}
.tab[aria-selected="true"] .tab-num { color: var(--brand); }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
}
.card-lg { padding: 32px; border-radius: var(--r-xl); }
.card-title {
  font-family: var(--f-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
}
.card-sub {
  color: var(--fg-muted);
  font-size: 13.5px;
  margin: 0 0 24px;
  line-height: 1.55;
  max-width: 70ch;
}

.section-eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.section-eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

/* ============================================================
   Form fields
   ============================================================ */
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}
.field-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.field-hint {
  font-size: 11.5px;
  color: var(--fg-faint);
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-prefix, .input-suffix {
  position: absolute;
  font-family: var(--f-mono);
  font-size: 12.5px;
  color: var(--fg-faint);
  pointer-events: none;
  user-select: none;
}
.input-prefix { left: 14px; }
.input-suffix { right: 14px; }

.input {
  appearance: none;
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  color: var(--fg);
  padding: 12px 14px;
  font-family: var(--f-mono);
  font-size: 15px;
  letter-spacing: -0.005em;
  border-radius: var(--r-md);
  transition: border 0.15s ease, background 0.15s ease;
  outline: none;
}
.input::placeholder { color: var(--fg-faint); }
.input:hover { border-color: var(--hairline-strong); }
.input:focus { border-color: var(--brand); background: oklch(0.20 0.025 270); }
.input.with-prefix { padding-left: 36px; }
.input.with-suffix { padding-right: 36px; }
.input-text {
  font-family: var(--f-sans);
  font-size: 14.5px;
}

/* Select buttons (segmented) */
.seg {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-full);
  padding: 4px;
  gap: 2px;
}
.seg-btn {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 9px 18px;
  border-radius: var(--r-full);
  color: var(--fg-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}
.seg-btn:hover { color: var(--fg-2); }
.seg-btn[aria-selected="true"] {
  background: var(--surface-3);
  color: var(--fg);
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.06) inset;
}
.seg-btn .ico {
  width: 14px;
  height: 14px;
  display: inline-block;
}

/* ============================================================
   Note / callout
   ============================================================ */
.note {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: oklch(0.26 0.04 200 / 0.35);
  border: 1px solid oklch(0.40 0.06 200 / 0.30);
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg-2);
}
.note-ico {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand);
  color: oklch(0.15 0 0);
  display: grid;
  place-items: center;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  margin-top: 1px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  appearance: none;
  border: 0;
  border-radius: var(--r-full);
  font-family: var(--f-sans);
  font-weight: 500;
  font-size: 14px;
  padding: 13px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand);
  color: oklch(0.15 0.02 200);
  font-weight: 600;
  box-shadow: 0 10px 28px -12px var(--brand);
}
.btn-primary:hover { background: var(--brand-2); }
.btn-primary:disabled {
  background: var(--surface-3);
  color: var(--fg-faint);
  box-shadow: none;
  cursor: not-allowed;
}
.btn-ghost {
  background: var(--surface-2);
  color: var(--fg-2);
  border: 1px solid var(--hairline);
}
.btn-ghost:hover { background: var(--surface-3); }
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--fg-muted);
}
.btn-icon:hover { color: var(--fg); background: var(--surface-3); }
.btn-link {
  background: transparent;
  color: var(--brand);
  padding: 6px 0;
  font-size: 13px;
}

/* ============================================================
   Big stat / KPI
   ============================================================ */
.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-faint);
  font-family: var(--f-mono);
}
.kpi-value {
  font-family: var(--f-display);
  font-size: 44px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1;
}
.kpi-value-mono {
  font-family: var(--f-mono);
  font-weight: 500;
}
.kpi-sub {
  font-size: 13px;
  color: var(--fg-muted);
}

/* Cost % big readout in tab 1 */
.cf-summary {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 36px;
  align-items: center;
  padding: 32px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, oklch(0.24 0.04 200) 0%, oklch(0.22 0.04 250) 100%);
  border: 1px solid var(--hairline);
  position: relative;
  overflow: hidden;
}
.cf-summary::before {
  content: "";
  position: absolute;
  inset: -50% -20% auto auto;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, var(--brand) 0%, transparent 60%);
  opacity: 0.10;
  filter: blur(20px);
  pointer-events: none;
}
.cf-pct {
  font-family: var(--f-display);
  font-size: 96px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.cf-pct .unit { font-size: 36px; color: var(--fg-muted); }

/* ============================================================
   Tab 2: produtos list mini
   ============================================================ */
.prod-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  padding: 6px 6px 6px 12px;
  border-radius: var(--r-full);
  font-size: 12.5px;
  color: var(--fg-2);
}
.prod-chip .del {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--fg-muted);
  border: 0;
}
.prod-chip .del:hover { color: var(--bad); background: var(--bad-soft); }

/* Insumos table */
.insumos {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.insumo-row {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 1fr 36px;
  gap: 10px;
  align-items: center;
}
.insumo-head {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 1fr 36px;
  gap: 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-faint);
  font-family: var(--f-mono);
  padding: 0 4px;
  margin-bottom: 2px;
}
.insumo-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4px 0;
  border-top: 1px dashed var(--hairline);
  margin-top: 8px;
}
.insumo-total .lbl { color: var(--fg-muted); font-size: 13px; }
.insumo-total .val { font-family: var(--f-mono); font-size: 16px; color: var(--fg); }

/* ============================================================
   Tab 3: Dashboard
   ============================================================ */
.dash-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 24px;
}
.dash-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.dash-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* Verdict block */
.verdict {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.verdict-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  padding: 6px 14px 6px 6px;
  border-radius: var(--r-full);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.verdict-tag .pill {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px;
}
.verdict--good .verdict-tag { color: var(--good); background: var(--good-soft); }
.verdict--good .pill { background: var(--good); color: oklch(0.18 0.04 155); }
.verdict--warn .verdict-tag { color: var(--warn); background: var(--warn-soft); }
.verdict--warn .pill { background: var(--warn); color: oklch(0.20 0.05 75); }
.verdict--bad .verdict-tag { color: var(--bad); background: var(--bad-soft); }
.verdict--bad .pill { background: var(--bad); color: oklch(0.95 0.02 25); }

.verdict-headline {
  font-family: var(--f-display);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}
.verdict-body {
  color: var(--fg-muted);
  font-size: 14px;
  line-height: 1.6;
  max-width: 46ch;
}

/* Gauge */
.gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.gauge {
  width: 280px;
  height: 165px;
  position: relative;
}
.gauge svg { width: 100%; height: 100%; display: block; overflow: visible; }
.gauge-readout {
  position: absolute;
  inset: auto 0 6px 0;
  text-align: center;
}
.gauge-readout .v {
  font-family: var(--f-display);
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
}
.gauge-readout .l {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-faint);
  font-family: var(--f-mono);
}

/* Price comparison */
.price-compare {
  display: grid;
  grid-template-columns: 1fr 24px 1fr;
  gap: 16px;
  align-items: stretch;
}
.price-card {
  padding: 22px;
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline);
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.price-card.recommended {
  border-color: var(--brand);
  background: linear-gradient(180deg, oklch(0.22 0.04 175) 0%, oklch(0.20 0.03 200) 100%);
}
.price-card .pc-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-faint);
  font-family: var(--f-mono);
}
.price-card.recommended .pc-label { color: var(--brand); }
.price-card .pc-value {
  font-family: var(--f-mono);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-top: 4px;
}
.price-card .pc-delta { font-size: 12.5px; color: var(--fg-muted); margin-top: auto; padding-top: 12px; }

.price-vs {
  display: grid;
  place-items: center;
  color: var(--fg-faint);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
}

/* Composition bar */
.comp-bar-track {
  width: 100%;
  height: 56px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  display: flex;
  overflow: hidden;
}
.comp-seg {
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  color: oklch(0.15 0 0);
  transition: flex-basis 0.35s ease;
  border-right: 1px solid oklch(0 0 0 / 0.15);
}
.comp-seg:last-child { border-right: 0; }
.comp-legend {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-top: 18px;
}
.comp-legend-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 12px;
  border-left: 3px solid var(--seg-color, var(--hairline));
}
.comp-legend-item .lbl {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
}
.comp-legend-item .val {
  font-family: var(--f-mono);
  font-size: 15px;
  color: var(--fg);
}
.comp-legend-item .pct {
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--fg-faint);
}

/* Mini KPI cards */
.mini-kpi {
  padding: 20px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--hairline);
}
.mini-kpi .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-faint);
  font-family: var(--f-mono);
}
.mini-kpi .val {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 30px;
  letter-spacing: -0.02em;
  margin-top: 10px;
  line-height: 1;
}
.mini-kpi .sub { color: var(--fg-muted); font-size: 12.5px; margin-top: 8px; }

/* Empty state */
.empty {
  text-align: center;
  padding: 80px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.empty-art {
  width: 96px; height: 96px;
  border-radius: 28px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  display: grid;
  place-items: center;
  color: var(--brand);
}
.empty h2 {
  font-family: var(--f-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
}
.empty p {
  color: var(--fg-muted);
  margin: 0;
  max-width: 44ch;
  font-size: 14.5px;
  line-height: 1.55;
}

/* Danger callout */
.alert-danger {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: oklch(0.26 0.07 25 / 0.45);
  border: 1px solid oklch(0.45 0.10 25 / 0.5);
  color: oklch(0.92 0.04 25);
}
.alert-danger .ico {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bad);
  color: oklch(0.95 0 0);
  display: grid; place-items: center;
  font-weight: 700;
}
.alert-danger strong { color: oklch(0.96 0.04 25); }

/* Product selector */
.prod-select {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-full);
}
.prod-select select {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--fg);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding-right: 24px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%237a7f95' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right center;
}
.prod-select select:focus { outline: none; }
.prod-select-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-faint);
  font-family: var(--f-mono);
}

/* utility */
.row { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { gap: 20px; }
.stack-xl { gap: 28px; }
.hr { height: 1px; background: var(--hairline); margin: 4px 0; border: 0; }
.mt-lg { margin-top: 24px; }
.mt-xl { margin-top: 32px; }
.text-muted { color: var(--fg-muted); }
.text-faint { color: var(--fg-faint); }
.mono { font-family: var(--f-mono); }

/* ============================================================
   Responsive — Tablet (≤1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .app { padding: 28px 32px 64px; max-width: 100%; }

  /* Dashboards de 2 col → 1 col */
  .dash-grid { grid-template-columns: 1fr; gap: 20px; }
  .dash-grid-3 { grid-template-columns: 1fr 1fr; }
  .dash-grid-4 { grid-template-columns: 1fr 1fr; }

  /* CF summary mais comprimida */
  .cf-pct { font-size: 80px; }
  .cf-summary { padding: 28px; gap: 24px; }

  /* Card padding */
  .card { padding: 24px; }
  .card-lg { padding: 26px; }

  /* Composição de preço: 3 colunas */
  .comp-legend { grid-template-columns: repeat(3, 1fr) !important; gap: 12px; }

  /* Gauge menor no tablet */
  .gauge { width: 240px; height: 145px; }
}

/* ============================================================
   Responsive — Mobile (≤720px)
   ============================================================ */
@media (max-width: 720px) {
  .app { padding: 20px 16px 60px; }

  /* Topbar empilha */
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 22px;
  }
  .topbar-meta { font-size: 11.5px; }
  .brand-mark { width: 34px; height: 34px; font-size: 18px; border-radius: 10px; }
  .brand-name { font-size: 17px; }
  .brand-sub { font-size: 10.5px; }

  /* Tabs ocupam largura total, com scroll horizontal se precisar */
  .tabs {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 22px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    padding: 10px 14px;
    font-size: 13px;
    flex-shrink: 0;
    border-radius: 10px;
    gap: 8px;
  }
  .tab-num { font-size: 10px; padding: 2px 5px; }

  /* Cards mais compactos */
  .card { padding: 18px; border-radius: 16px; }
  .card-lg { padding: 20px; border-radius: 18px; }
  .card-title { font-size: 19px; }
  .card-sub { font-size: 13px; margin-bottom: 18px; }

  /* Field grids viram 1 coluna */
  .field-grid,
  .field-grid-3 { grid-template-columns: 1fr !important; gap: 14px; }

  /* CF summary empilha */
  .cf-summary {
    grid-template-columns: 1fr !important;
    padding: 24px 20px;
    gap: 20px;
    border-radius: 20px;
  }
  .cf-pct { font-size: 64px; }
  .cf-pct .unit { font-size: 24px; }
  .cf-summary .kpi { align-items: flex-start !important; text-align: left !important; }
  .cf-summary > div:last-child {
    align-items: flex-start !important;
    width: 100%;
    flex-direction: row !important;
    justify-content: space-between !important;
    flex-wrap: wrap;
    gap: 16px !important;
  }
  .cf-summary .kpi-value { font-size: 22px !important; }

  /* Calculadora topo */
  .card-lg > div[style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .card-lg > div[style*="grid-template-columns: 2fr 1fr"] .kpi {
    align-items: flex-start !important;
  }

  /* Segmented control: scroll horizontal */
  .seg {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-width: 100%;
  }
  .seg::-webkit-scrollbar { display: none; }
  .seg-btn {
    flex-shrink: 0;
    padding: 9px 14px;
    font-size: 13px;
  }

  /* Modo de cálculo: força 1 coluna nos inputs */
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  /* Cabeçalhos com "rótulo + ação" (setor, etc.) também empilham */
  div[style*="grid-template-columns: 1fr auto"] {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }
  /* Permite manter algumas exceções via inline (já 1fr) */

  /* Insumos: cabeçalho some, linhas viram blocos */
  .insumo-head { display: none; }
  .insumo-row {
    grid-template-columns: 1fr 1fr 36px;
    grid-template-areas:
      "nome  nome  del"
      "qtd   preco preco";
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    background: var(--bg-2);
    border: 1px solid var(--hairline);
  }
  .insumo-row > *:nth-child(1) { grid-area: nome; }
  .insumo-row > *:nth-child(2) { grid-area: qtd; }
  .insumo-row > *:nth-child(3) { grid-area: preco; }
  .insumo-row > *:nth-child(4) { grid-area: del; align-self: start; }

  /* Verdict (topo da aba 3) empilha */
  .verdict + div,
  .card.card-lg.verdict > div {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    text-align: left;
  }
  .verdict-headline { font-size: 26px; }
  .verdict-body { font-size: 13.5px; }
  .gauge-wrap { align-self: center; }
  .gauge { width: 100%; max-width: 280px; height: auto; aspect-ratio: 280 / 165; }

  /* Price compare: empilha, VS no meio */
  .price-compare {
    grid-template-columns: 1fr;
    grid-template-rows: auto 32px auto;
    gap: 10px;
  }
  .price-vs { writing-mode: horizontal-tb; padding: 4px 0; }
  .price-card .pc-value { font-size: 26px; }

  /* Composição: legenda em 2 col */
  .comp-legend { grid-template-columns: 1fr 1fr !important; gap: 12px; }
  .comp-bar-track { height: 48px; }
  .comp-seg { font-size: 10px; }

  /* Mini KPIs: 1 col em mobile estreito; ainda 2 col por padrão */
  .dash-grid-3,
  .dash-grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .mini-kpi { padding: 16px; border-radius: 14px; }
  .mini-kpi .val { font-size: 24px; }
  .mini-kpi .sub { font-size: 11.5px; }
  .mini-kpi .lbl { font-size: 10px; }

  /* KPI value sizes */
  .kpi-value { font-size: 32px; }

  /* Botões full width quando estiverem em barra de ação */
  .row.mt-xl {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px;
  }
  .row.mt-xl .btn { justify-content: center; width: 100%; }

  /* Selector de produto: full width */
  .prod-select { width: 100%; justify-content: space-between; padding: 12px 14px; }
  .prod-select select { font-size: 14px; max-width: 70vw; }

  /* Alert + Note padding */
  .alert-danger { padding: 14px 16px; font-size: 13px; }
  .note { padding: 12px 14px; font-size: 12.5px; }

  /* Empty state mais compacto */
  .empty { padding: 56px 16px; }
  .empty-art { width: 76px; height: 76px; border-radius: 22px; }
  .empty h2 { font-size: 22px; }
  .empty p { font-size: 13.5px; }

  /* Section eyebrow não some, fica menor */
  .section-eyebrow { font-size: 10px; }
}

/* ============================================================
   Responsive — Mobile estreito (≤420px)
   ============================================================ */
@media (max-width: 420px) {
  .app { padding: 18px 12px 56px; }
  .cf-pct { font-size: 56px; }
  .cf-pct .unit { font-size: 20px; }
  .dash-grid-3,
  .dash-grid-4 { grid-template-columns: 1fr; }
  .comp-legend { grid-template-columns: 1fr !important; }
  .verdict-headline { font-size: 22px; }
  .price-card .pc-value { font-size: 22px; }
  .tab { padding: 9px 12px; font-size: 12.5px; }
}
