@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Outfit:wght@400;500;600;700&display=swap");

:root {
  --navy: #071824;
  --ocean: #0c3d52;
  --sea: #14708a;
  --mist: #f3f8fa;
  --ink: #102432;
  --muted: #5c7380;
  --line: rgba(16, 36, 50, 0.12);
  --ok: #2f8f6b;
  --warn: #c45c2a;
  --white: #fff;
  --shadow: 0 18px 50px rgba(7, 24, 36, 0.12);
  --font: "Outfit", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 400px at 0% 0%, rgba(20, 112, 138, 0.16), transparent 55%),
    linear-gradient(180deg, #eef6f8, #f7fbfc 40%, #e8f2f5);
  min-height: 100vh;
}
a { color: var(--sea); text-decoration: none; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 24px; }
.top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.brand { font-family: var(--display); font-size: 1.5rem; margin: 0; }
.login-brand { text-align: center; margin-bottom: 14px; }
.logo-login {
  max-width: 220px;
  width: 100%;
  height: auto;
  display: inline-block;
}
.top-brand { display: flex; align-items: center; gap: 14px; }
.logo-header {
  height: 52px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  display: block;
}
.muted { color: var(--muted); font-size: 0.9rem; }
.card {
  background: rgba(255,255,255,0.86);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 600;
  cursor: pointer; font: inherit;
}
.btn-primary { background: linear-gradient(135deg, #1785a2, #0c4a63); color: #fff; }
.btn-secondary { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-danger { background: rgba(196,92,42,.12); color: var(--warn); }
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.85rem; }
.field input, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; font: inherit; background: #fff;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.alert {
  padding: 12px 14px; border-radius: 12px; margin-bottom: 14px;
  background: rgba(196,92,42,.1); color: #7a3418;
}
.alert-ok { background: rgba(47,143,107,.12); color: #1f6b4d; }
.nav { display: flex; gap: 10px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--ink); font-size: 0.72rem; text-transform: none; letter-spacing: .02em; font-weight: 600; line-height: 1.25; }
th .muted { display: block; font-weight: 400; text-transform: none; font-size: 0.68rem; }
tfoot td { font-weight: 700; background: rgba(20,112,138,.06); }
.login-body { min-height: 100vh; }
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  padding:
    max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
}
.login-card {
  width: min(420px, 100%);
  text-align: center;
}
.login-card h1 {
  font-family: var(--display);
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 4.5vw, 1.75rem);
}
.login-card .field { text-align: left; }
.login-tagline { margin: 0 0 18px; }
.login-form .field input {
  min-height: 48px;
  font-size: 16px;
}
.btn-login {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
  font-size: 1rem;
}
.login-foot { margin: 16px 0 0; font-size: 0.8rem; }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.mod {
  padding: 18px; border-radius: 16px; border: 1px solid var(--line);
  background: #fff; transition: transform .15s ease;
}
.mod:hover { transform: translateY(-2px); }
.mod h3 { margin: 0 0 6px; font-size: 1.05rem; }
.badge {
  display: inline-block; font-size: 0.72rem; padding: 4px 8px; border-radius: 999px;
  background: rgba(20,112,138,.12); color: var(--sea); font-weight: 600;
}
.badge-soon { background: rgba(92,115,128,.12); color: var(--muted); }
/* —— Responsive global —— */
html { -webkit-text-size-adjust: 100%; }
.field input,
.field select,
.pda-table input,
.pda-notes {
  font-size: 16px; /* evita zoom automático en iOS */
}
@media (max-width: 700px) {
  .grid2 { grid-template-columns: 1fr; }
  .wrap, .wrap-wide { padding: 14px; }
  .brand { font-size: 1.2rem; }
  .logo-header { height: 40px; max-width: 120px; }
  .top { align-items: flex-start; margin-bottom: 14px; }
  .top-brand { gap: 10px; min-width: 0; flex: 1 1 auto; }
  .top-brand .muted { font-size: 0.8rem; }
  .nav { width: 100%; }
  .nav .btn { flex: 1 1 auto; min-height: 44px; padding: 10px 12px; font-size: 0.88rem; }
  .card { padding: 16px; border-radius: 14px; }
  .modules { grid-template-columns: 1fr; }
  .mod { min-height: 44px; }
  .login-page {
    padding: 16px;
    padding:
      max(16px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
    align-content: center;
  }
  .login-card {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 20px 18px;
  }
  .logo-login { max-width: min(200px, 70vw); }
  .login-form .field { margin-bottom: 16px; }
  .login-form .field label { font-size: 0.9rem; margin-bottom: 8px; }
  .login-form .field input {
    min-height: 52px;
    padding: 14px 14px;
    border-radius: 14px;
  }
  .btn-login { min-height: 52px; border-radius: 14px; }
  .table-wrap {
    margin: 0 -4px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  table { font-size: 0.8rem; }
}

/* PDA / FDA form */
.wrap-wide { max-width: 1280px; }
.pda-estimate {
  color: #9b2c2c;
  font-size: 0.88rem;
  margin: 0 0 14px;
  font-weight: 500;
}
.pda-subh {
  font-size: 0.95rem;
  margin: 18px 0 10px;
  color: var(--ocean);
}
.grid-specs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.grid-specs-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 28px;
  align-items: start;
}
.specs-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.specs-col .field label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.term-help {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(20, 112, 138, 0.35);
  background: rgba(20, 112, 138, 0.1);
  color: var(--ocean);
  font: 600 0.7rem/1 var(--font);
  cursor: help;
}
.term-help:hover,
.term-help:focus {
  background: var(--ocean);
  color: #fff;
  border-color: var(--ocean);
  outline: none;
}
.term-help-th {
  width: 16px;
  height: 16px;
  font-size: 0.62rem;
  vertical-align: middle;
  margin-right: 2px;
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.45);
  color: #fff;
}
.term-help-th:hover,
.term-help-th:focus {
  background: #fff;
  color: var(--ocean);
}
.term-popover {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(7, 24, 36, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
}
.term-popover[hidden] { display: none !important; }
.term-popover-card {
  position: relative;
  width: min(420px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 22px 22px 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.term-popover-card h4 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--ink);
  padding-right: 28px;
}
.term-popover-card p { margin: 0 0 10px; line-height: 1.45; font-size: 0.92rem; }
.term-popover-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.pda-lines-wrap {
  margin-bottom: 16px;
  padding: 0;
  overflow: hidden;
}
.pda-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.pda-table th {
  background: var(--ocean);
  color: #fff;
  padding: 10px 8px;
  font-size: 0.72rem;
  letter-spacing: .03em;
  white-space: nowrap;
}
.pda-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pda-section-row td {
  background: #d6eaf0;
  color: var(--ocean);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: .04em;
  padding: 8px 10px;
}
.pda-table input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 8px;
  font: inherit;
  background: #fff;
}
.pda-table input:focus {
  outline: none;
  border-color: rgba(20, 112, 138, 0.45);
  background: #f7fcfd;
}
.pda-table .inp-sm { min-width: 48px; max-width: 72px; }
.pda-table .inp-desc { min-width: 180px; }
.pda-table .inp-num { min-width: 88px; text-align: right; }
.pda-cop { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; padding-right: 10px !important; }
.pda-vat-auto .js-usd,
.pda-vat-auto .js-rate,
.pda-vat-auto .js-data {
  background: #f0f7f9;
  color: var(--ocean);
}
.pda-summary-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 14px;
}
.pda-sum { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.pda-sum td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
.pda-sum td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pda-sum tr.strong td { font-weight: 700; background: rgba(20, 112, 138, 0.08); }
.pay-block { font-size: 0.88rem; line-height: 1.55; margin: 0 0 12px; }
.pay-notify { margin: 0; padding-left: 18px; font-size: 0.85rem; color: var(--sea); }
.pda-notes {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  resize: vertical;
  background: #fff;
  color: #9b2c2c;
}
@media (max-width: 900px) {
  .pda-summary-grid { grid-template-columns: 1fr; }
  .grid-specs-2 { grid-template-columns: 1fr; }
}

/* PDA líneas → tarjetas en celular */
@media (max-width: 760px) {
  .pda-lines-wrap {
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }
  .pda-table thead { display: none; }
  .pda-table,
  .pda-table tbody {
    display: block;
    width: 100%;
  }
  .pda-section-row {
    display: block;
    margin: 14px 0 8px;
  }
  .pda-section-row td {
    display: block;
    border-radius: 10px;
    padding: 10px 12px !important;
    letter-spacing: .03em;
  }
  .pda-line {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.95);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(7, 24, 36, 0.06);
  }
  .pda-line td {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 0 !important;
    padding: 0 !important;
    white-space: normal;
    min-width: 0;
  }
  .pda-line td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: .02em;
  }
  .pda-line td[data-label="Descripción"] {
    grid-column: 1 / -1;
  }
  .pda-line td[data-label="TOTAL USD"],
  .pda-line td[data-label="COP"] {
    grid-column: span 1;
  }
  .pda-table .inp-sm,
  .pda-table .inp-desc,
  .pda-table .inp-num {
    min-width: 0;
    max-width: none;
    width: 100%;
    min-height: 42px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 16px;
  }
  .pda-cop {
    padding: 10px !important;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f7fbfc;
    text-align: right;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }
  .pda-estimate { font-size: 0.82rem; line-height: 1.4; }
  .pda-subh { font-size: 0.9rem; }
  .pda-sum td { white-space: normal; font-size: 0.85rem; }
  .term-help {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }
  .term-popover { padding: 12px; align-items: end; }
  .term-popover-card {
    width: 100%;
    border-radius: 16px 16px 12px 12px;
    max-height: 70vh;
    overflow: auto;
  }
}

/* Itinerario / listados: scroll horizontal suave en móvil */
@media (max-width: 700px) {
  .table-wrap:not(.pda-lines-wrap) {
    overflow-x: auto;
  }
  .table-wrap:not(.pda-lines-wrap) table {
    min-width: 720px;
  }
}
