/* ===========================================================================
   Kargare LatAm — Calculadora de Costo de Importación
   Estilo confiable, operativo, profesional. Sin recursos externos (offline).
   =========================================================================== */

:root {
  --brand: #130f24;
  --brand-2: #6b26d9;
  --accent: #6b26d9;
  --accent-d: #5820b5;
  --bg: #fcfcfd;
  --card: #ffffff;
  --ink: #130f24;
  --muted: #625e70;
  --line: #dedbe6;
  --soft: #f3eff9;
  --ok-ink: #15803d; --ok-bg: #dcfce7;
  --warn-ink: #b45309; --warn-bg: #fef3c7;
  --bad-ink: #b91c1c; --bad-bg: #fee2e2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 35, 60, .06), 0 6px 20px rgba(16, 35, 60, .08);
  --font: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

img, svg { max-width: 100%; }

a { color: var(--brand-2); }

/* ---- Header ---------------------------------------------------------- */
.site-header {
  background: var(--brand);
  color: #fff;
  padding: 14px 18px;
}
.site-header__wrap { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo {
  width: 38px; height: 38px; border-radius: 9px; flex: 0 0 auto;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 18px;
  display: grid; place-items: center; letter-spacing: -.5px;
}
.site-header h1 { font-size: 18px; margin: 0; line-height: 1.2; }
.site-header p { margin: 0; font-size: 13px; opacity: .85; }

/* ---- Hero / promesa -------------------------------------------------- */
.hero { max-width: 1120px; margin: 18px auto 0; padding: 0 18px; }
.hero h2 { font-size: clamp(20px, 3.4vw, 28px); margin: 0 0 6px; letter-spacing: -.4px; }
.hero p { margin: 0; color: var(--muted); max-width: 60ch; }

/* ---- Layout ---------------------------------------------------------- */
.layout {
  max-width: 1120px;
  margin: 18px auto 60px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}
@media (min-width: 920px) {
  .layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .results-col { position: sticky; top: 14px; }
}

/* ---- Cards ----------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card:last-child { margin-bottom: 0; }
.group__title { font-size: 15px; font-weight: 700; margin: 0 0 4px; color: var(--brand); }
.group__note { font-size: 13px; color: var(--muted); margin: 0 0 12px; }

/* ---- Fields ---------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.field .req { color: var(--bad-ink); margin-left: 2px; }
.field .opt { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 4px; }
.field .help { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .affix {
  position: absolute; color: var(--muted); font-size: 14px; pointer-events: none;
}
.input-wrap .affix.prefix { left: 12px; }
.input-wrap .affix.suffix { right: 12px; }
.input-wrap.has-prefix input { padding-left: 26px; }
.input-wrap.has-suffix input { padding-right: 30px; }

input, select {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  appearance: none;
  -webkit-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 fill='%235b6b7d' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field.has-error input, .field.has-error select { border-color: var(--bad-ink); }
.field__error { display: none; color: var(--bad-ink); font-size: 12.5px; margin-top: 4px; }
.field.has-error .field__error { display: block; }

/* ---- Term chips + inline tip ---------------------------------------- */
.terms { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.term {
  font: inherit; font-size: 12px; cursor: pointer;
  background: var(--soft); color: var(--brand-2);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 9px; display: inline-flex; align-items: center; gap: 5px;
}
.term:hover { background: #e4ebf3; }
.term .i { width: 14px; height: 14px; border-radius: 50%; background: var(--brand-2); color: #fff;
  font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.term[aria-expanded="true"] { background: var(--brand-2); color: #fff; }
.term[aria-expanded="true"] .i { background: #fff; color: var(--brand-2); }
.tip {
  display: none; margin-top: 8px; padding: 10px 12px;
  background: #f7fbff; border: 1px solid #d7e6f3; border-left: 3px solid var(--accent);
  border-radius: 8px; font-size: 13px; color: #25313f;
}
.tip.open { display: block; }
.tip strong { color: var(--brand); }

/* ---- Results --------------------------------------------------------- */
.results__placeholder { color: var(--muted); font-size: 14px; text-align: center; padding: 20px 8px; }
.results__placeholder strong { color: var(--ink); }

.disclaimer {
  background: var(--warn-bg); color: var(--warn-ink);
  border: 1px solid #f3d98f; border-radius: 9px;
  font-size: 12.5px; padding: 9px 12px; margin-bottom: 14px;
}

.total-card {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 60%, var(--accent-d) 140%);
  color: #fff; border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
}
.total-card .eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; opacity: .8; margin: 0 0 6px; }
.total-card .range { font-size: clamp(24px, 6vw, 34px); font-weight: 800; letter-spacing: -.6px; line-height: 1.1; }
.total-card .mid { margin-top: 6px; font-size: 14px; opacity: .92; }
.total-card .mid b { font-weight: 700; }

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.metric { background: var(--soft); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; }
.metric .k { font-size: 12px; color: var(--muted); }
.metric .v { font-size: 17px; font-weight: 700; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700;
  padding: 5px 10px; border-radius: 999px; }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.alto { color: var(--ok-ink); background: var(--ok-bg); }
.badge.medio { color: var(--warn-ink); background: var(--warn-bg); }
.badge.bajo { color: var(--bad-ink); background: var(--bad-bg); }
.confidence-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.confidence-row .what { font-size: 12.5px; color: var(--muted); }

/* ---- Breakdown ------------------------------------------------------- */
.breakdown { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.breakdown h3 { font-size: 13px; margin: 0; padding: 10px 14px; background: var(--soft); border-bottom: 1px solid var(--line); }
.line { border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; }
.line__label { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; text-align: left;
  background: none; border: 0; color: var(--ink); font-family: inherit; cursor: default; padding: 0; }
.line__label.clickable { cursor: pointer; }
.line__label.clickable .i { width: 15px; height: 15px; border-radius: 50%; background: var(--soft);
  color: var(--brand-2); border: 1px solid var(--line); font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.line__val { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; white-space: nowrap; }
.line__tip { display: none; padding: 0 14px 11px; font-size: 12.5px; color: var(--muted); }
.line__tip.open { display: block; }
.line.muted .line__val { color: var(--muted); font-weight: 500; }
.line.total-line { background: #f0f7f5; }
.line.total-line .line__label { font-weight: 800; }
.line.total-line .line__val { font-weight: 800; font-size: 16px; color: var(--brand); }
.line.sub .line__label { padding-left: 14px; color: var(--muted); font-size: 13px; }

/* ---- Missing / notes ------------------------------------------------- */
.note-box { font-size: 13px; border-radius: 9px; padding: 11px 13px; margin-bottom: 14px; }
.note-box.info { background: #eef6ff; border: 1px solid #cfe4fb; color: #1d4e7a; }
.note-box.soft { background: var(--soft); border: 1px solid var(--line); color: var(--muted); }
.note-box ul { margin: 6px 0 0; padding-left: 18px; }
.note-box li { margin: 2px 0; }

/* ---- CTA + lead form ------------------------------------------------- */
.cta-card { background: var(--brand); color: #fff; border-radius: var(--radius); padding: 18px; }
.cta-card h3 { margin: 0 0 6px; font-size: 18px; }
.cta-card p { margin: 0 0 14px; font-size: 14px; opacity: .9; }

.btn {
  font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  border: 0; border-radius: 10px; padding: 12px 16px; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-d); }
.btn-wa { background: #25d366; color: #04340f; }
.btn-wa:hover { filter: brightness(.96); }
.btn-ghost { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.btn-ghost:hover { background: rgba(255,255,255,.2); }
.btn-outline { background: #fff; color: var(--brand); border: 1px solid var(--line); }
.btn-row { display: grid; gap: 10px; }

.lead-form { display: none; margin-top: 14px; background: #fff; color: var(--ink);
  border-radius: 10px; padding: 14px; }
.lead-form.open { display: block; }
.lead-form .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 460px) { .lead-form .grid2 { grid-template-columns: 1fr; } .metrics { grid-template-columns: 1fr; } }
.lead-form textarea { width: 100%; font: inherit; font-size: 15px; border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px; resize: vertical; min-height: 62px; }
.lead-done { display: none; }
.lead-done.open { display: block; }
.grade-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.grade-A { background: var(--ok-bg); color: var(--ok-ink); }
.grade-B { background: var(--warn-bg); color: var(--warn-ink); }
.grade-C { background: var(--soft); color: var(--muted); }

/* ---- Footer ---------------------------------------------------------- */
.site-footer { max-width: 1120px; margin: 0 auto 40px; padding: 0 18px; color: var(--muted); font-size: 12px; }
.site-footer .ph { color: var(--warn-ink); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; }
.toast.show { opacity: 1; }
.back-home { color: inherit; display: inline-flex; align-items: center; min-height: 44px; flex-shrink: 0; }
.wordmark { font: 700 28px/1 'Space Grotesk', sans-serif; letter-spacing: -1.2px; gap: 5px; text-decoration: none; margin-right: 16px; }
.wordmark img { width: 11px; height: 11px; }
@media (max-width: 600px) {
  .field input, .field select, .lead-form textarea { font-size: 16px; min-height: 44px; min-width: 0; max-width: 100%; }
  .site-header__wrap { flex-wrap: wrap; }
}
