@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/poppins-400.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/poppins-600.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/poppins-700.woff2") format("woff2");
}

:root {
  --brand: #1f4e78;
  --primary: #1a56db;
  --gold: #c7a04a;
  --success: #0f766e;
  --danger: #b42318;
  --whatsapp: #128c7e;
  --whatsapp-dark: #075e54;
  --text: #0f1a3d;
  --text2: #5b6478;
  --bg: #eef2f7;
  --card: #ffffff;
  --border: #d8e0ea;
  --shadow: 0 10px 28px rgba(15, 26, 61, 0.09);
  --radius: 14px;
  --touch: 48px;
  --ink-tank: #1f4e78;
  --fill-tank: #c5d6e8;
  --fill-tank-on: #9ec0e6;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Poppins, "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(26, 86, 219, 0.12), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(31, 78, 120, 0.1), transparent 50%),
    linear-gradient(180deg, #f7f9fc 0%, var(--bg) 42%, #e8eef5 100%);
  line-height: 1.45;
}

a {
  color: var(--primary);
}

/* —— Mobile first —— */
.wrap {
  width: min(1120px, calc(100% - 20px));
  margin: 0 auto;
  padding: 16px 0 calc(40px + var(--safe-bottom));
}

.topbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.brand-mark {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}

.brand-block h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand);
  line-height: 1.2;
}

.brand-block p {
  margin: 0;
  color: var(--text2);
  max-width: 42rem;
  font-size: 0.9rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(31, 78, 120, 0.08);
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

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

.card h2 {
  margin: 0 0 4px;
  font-size: 1.02rem;
  color: var(--brand);
}

.card .sub {
  margin: 0 0 14px;
  color: var(--text2);
  font-size: 0.84rem;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.step-num {
  width: 28px;
  height: 28px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.seg button {
  min-height: var(--touch);
  border: 1.5px solid var(--border);
  background: #f8fafc;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.seg button:hover {
  border-color: #b7c5d8;
}

.seg button.is-on {
  border-color: var(--primary);
  background: rgba(26, 86, 219, 0.08);
  color: var(--primary);
}

/* Formas de tanque — diagramas */
.shapes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.shape {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fbfcfe;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.shape:hover {
  border-color: #aebcd0;
}

.shape.is-on {
  border-color: var(--primary);
  background: rgba(26, 86, 219, 0.06);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.14);
}

.shape.is-on .shape-svg .tank-fill {
  fill: var(--fill-tank-on);
}

.shape.is-on .shape-svg .tank-stroke {
  stroke: var(--primary);
}

.shape-svg {
  width: 72px;
  height: 56px;
  display: block;
  flex-shrink: 0;
}

.shape-svg .tank-fill {
  fill: var(--fill-tank);
  transition: fill 0.15s;
}

.shape-svg .tank-stroke {
  fill: none;
  stroke: var(--ink-tank);
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition: stroke 0.15s;
}

.shape-svg .tank-accent {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.4;
  stroke-dasharray: 3 2;
  opacity: 0.85;
}

.shape-svg .tank-dim {
  fill: var(--text2);
  font-size: 7px;
  font-family: Poppins, sans-serif;
  font-weight: 600;
}

.shape-body strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--brand);
  line-height: 1.25;
}

.shape-body span {
  display: block;
  margin-top: 3px;
  font-size: 0.74rem;
  color: var(--text2);
  line-height: 1.3;
}

.fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.fields.full {
  grid-template-columns: 1fr;
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text2);
}

input,
select,
textarea {
  min-height: var(--touch);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  font: inherit;
  font-weight: 500;
  font-size: 16px; /* evita zoom iOS */
  color: var(--text);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(26, 86, 219, 0.35);
  border-color: var(--primary);
}

textarea {
  min-height: 120px;
  padding: 10px 12px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--text2);
}

.hint strong {
  color: var(--brand);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.actions-share {
  margin-top: 0;
}

.btn {
  min-height: var(--touch);
  padding: 0 16px;
  border-radius: 12px;
  border: 0;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-block {
  width: 100%;
}

.btn-ico {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-secondary {
  background: rgba(31, 78, 120, 0.08);
  color: var(--brand);
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #fff;
}

.btn-whatsapp:hover {
  background: var(--whatsapp-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1.5px solid var(--border);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.share-panel {
  margin-top: 16px;
  padding: 14px;
  border-radius: 12px;
  background: #f5f8fb;
  border: 1px solid var(--border);
}

.share-label {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand);
}

.share-hint {
  margin-top: 10px;
}

.preview-label {
  margin-top: 14px;
}

.alert {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
}

.alert-warn {
  background: #fff8e8;
  color: #8a5a00;
  border: 1px solid #f0d79a;
}

.alert-err {
  background: #fef3f2;
  color: var(--danger);
  border: 1px solid #f3c6c2;
}

.alert-ok {
  background: #ecfdf8;
  color: var(--success);
  border: 1px solid #9fd9cb;
}

.chart-wrap {
  height: 180px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #f8fafc;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}

.chart-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stat {
  background: #f5f8fb;
  border-radius: 10px;
  padding: 10px 8px;
}

.stat b {
  display: block;
  font-size: 0.95rem;
  color: var(--brand);
  word-break: break-word;
}

.stat span {
  font-size: 0.68rem;
  color: var(--text2);
  font-weight: 600;
}

.table-scroll {
  max-height: 280px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th,
td {
  padding: 10px;
  text-align: right;
  border-bottom: 1px solid #eef2f6;
}

th {
  position: sticky;
  top: 0;
  background: #f3f6fa;
  color: var(--text2);
  font-weight: 600;
  text-align: right;
}

td:first-child,
th:first-child {
  text-align: left;
}

.footer-note {
  margin-top: 20px;
  color: var(--text2);
  font-size: 0.78rem;
  text-align: center;
  padding: 0 4px;
}

.footer-note code {
  font-size: 0.76rem;
  background: rgba(31, 78, 120, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
}

.hidden {
  display: none !important;
}

.portion-help {
  background: #f5f8fb;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  font-size: 0.84rem;
  color: var(--text2);
}

.portion-help ol {
  margin: 8px 0 0;
  padding-left: 1.2rem;
}

/* ≤479 — estrecho (ya es base; ajustes finos) */
@media (max-width: 479px) {
  .wrap {
    width: calc(100% - 16px);
    padding-top: 12px;
  }

  .brand-block h1 {
    font-size: 1.25rem;
  }

  .stat b {
    font-size: 0.88rem;
  }

  .shape {
    grid-template-columns: 64px 1fr;
    gap: 10px;
    min-height: 80px;
    padding: 8px 10px;
  }

  .shape-svg {
    width: 64px;
    height: 50px;
  }
}

/* ≤767 — tablet chica / landscape móvil */
@media (min-width: 480px) and (max-width: 767px) {
  .shapes {
    grid-template-columns: 1fr 1fr;
  }

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

  .actions-share {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .actions-share .btn {
    flex: 1 1 calc(50% - 5px);
    width: auto;
    min-width: 140px;
  }
}

/* ≤1023 — tablet / desktop estrecho */
@media (min-width: 768px) and (max-width: 1023px) {
  .wrap {
    width: min(1120px, calc(100% - 28px));
    padding: 22px 0 56px;
  }

  .brand-block h1 {
    font-size: 1.55rem;
  }

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

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

  .actions,
  .actions-share {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .btn {
    width: auto;
  }

  .btn-block {
    width: 100%;
  }

  .actions-share .btn {
    flex: 1 1 auto;
  }

  .chart-wrap {
    height: 200px;
  }
}

/* ≥1024 — dos columnas */
@media (min-width: 1024px) {
  .wrap {
    width: min(1120px, calc(100% - 32px));
    padding: 28px 0 64px;
  }

  .topbar {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
  }

  .brand-block h1 {
    font-size: clamp(1.45rem, 2.2vw, 1.9rem);
  }

  .grid {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 18px;
  }

  .card {
    padding: 18px 18px 20px;
  }

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

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

  .actions,
  .actions-share {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .btn {
    width: auto;
  }

  .btn-block {
    width: auto;
    min-width: 180px;
  }

  .actions-share .btn {
    flex: 1 1 auto;
  }

  .chart-wrap {
    height: 200px;
  }

  .table-scroll {
    max-height: 340px;
  }
}

@media (min-width: 1200px) {
  .shapes {
    grid-template-columns: repeat(3, 1fr);
  }
}
