/* ===========================================================
   Ambrosía · Cotizador de Viáticos — identidad: negro/blanco, serif, mucho aire.
   Mobile-first.
   =========================================================== */
:root {
  --ink: #000000;
  --paper: #ffffff;
  --muted: #6b6b6b;
  --line: #111111;
  --hairline: #d9d9d9;
  --alert: #000;
  --serif: "Adobe Caslon Pro", "Times New Roman", Times, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 400; letter-spacing: .01em; }

/* ---- Layout ---- */
header.app {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--ink);
  position: sticky; top: 0; background: var(--paper); z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo-img { height: 42px; width: auto; display: block; }
.brand-sub { border-left: 1px solid var(--hairline); padding-left: 14px; }
.brand-sub span { display: block; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); line-height: 1.5; }
.logo-login { height: 96px; width: auto; display: block; margin: 0 auto 14px; }
.session { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; gap: 14px; align-items: center; }
.session a { color: var(--ink); cursor: pointer; text-decoration: none; border-bottom: 1px solid var(--ink); }

main { max-width: 720px; margin: 0 auto; padding: 24px 20px 80px; }
nav.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--hairline); margin-bottom: 26px; flex-wrap: wrap; }
nav.tabs button {
  background: none; border: none; padding: 10px 0; cursor: pointer; font: inherit;
  font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
nav.tabs button.active { color: var(--ink); border-bottom-color: var(--ink); }

section.view { display: none; }
section.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to {opacity:1; transform:none;} }

h1.title { font-size: 30px; margin: 0 0 4px; }
p.lede { color: var(--muted); margin: 0 0 28px; }

/* ---- Pasos del formulario ---- */
.step { margin-bottom: 36px; }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding-bottom: 9px; border-bottom: 1px solid var(--ink); }
.step-head .num { width: 26px; height: 26px; flex: none; border: 1px solid var(--ink); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 14px; }
.step-head h2 { font-size: 18px; margin: 0; letter-spacing: .03em; }

/* ---- Forms ---- */
.field { margin-bottom: 22px; }
.field > label { display: block; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.field > label .req { color: var(--ink); font-weight: 700; margin-left: 1px; }
.field > label .opt { color: var(--muted); text-transform: none; letter-spacing: 0; font-style: italic; font-weight: 400; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; font-style: italic; }
input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%; font: inherit; padding: 12px 0; border: none; border-bottom: 1px solid var(--ink);
  background: transparent; border-radius: 0; -webkit-appearance: none; appearance: none;
}
/* El select se ve como desplegable: chevron a la derecha. */
select {
  cursor: pointer; padding-right: 26px;
  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 d="M1 1l5 5 5-5" fill="none" stroke="%23000000" stroke-width="1.6"/></svg>');
  background-repeat: no-repeat; background-position: right 2px center;
}
input:focus, select:focus, textarea:focus { outline: none; border-bottom-width: 2px; }
.row { display: flex; gap: 16px; }
.row .field { flex: 1; }

.toggle { display: inline-flex; border: 1px solid var(--ink); }
.toggle button { background: var(--paper); border: none; padding: 10px 20px; cursor: pointer; font: inherit; font-size: 14px; }
.toggle button.on { background: var(--ink); color: var(--paper); }
.toggle button + button { border-left: 1px solid var(--ink); }

button.primary {
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
  padding: 15px 28px; font: inherit; font-size: 14px; letter-spacing: .12em; text-transform: uppercase;
  cursor: pointer; width: 100%;
}
button.primary:disabled { opacity: .4; cursor: not-allowed; }
button.ghost {
  background: var(--paper); color: var(--ink); border: 1px solid var(--ink);
  padding: 13px 22px; font: inherit; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; cursor: pointer;
}
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.actions button { flex: 1; min-width: 140px; }

/* ---- Autocomplete de dirección ---- */
.autocomplete { position: relative; }
.suggest {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30;
  background: var(--paper); border: 1px solid var(--ink); border-top: none;
  margin: 0; padding: 0; list-style: none; max-height: 260px; overflow-y: auto; display: none;
}
.suggest li { padding: 11px 12px; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--hairline); }
.suggest li:last-child { border-bottom: none; }
.suggest li:hover { background: var(--ink); color: var(--paper); }

/* ---- Distancia box ---- */
.dist {
  border: 1px solid var(--hairline); padding: 16px; margin: 6px 0 4px; display: none;
}
.dist.show { display: block; }
.dist .km { font-family: var(--serif); font-size: 26px; }
.dist .addr { font-size: 13px; color: var(--muted); }
.dist a.maplink { font-size: 12px; border-bottom: 1px solid var(--ink); color: var(--ink); text-decoration: none; }
.casetas-grid { display: flex; gap: 12px; margin-top: 14px; }
.casetas-grid .field { margin: 0; }

/* ---- Resultado ---- */
.total-card { border: 2px solid var(--ink); padding: 26px 22px; text-align: center; margin-bottom: 8px; }
.total-card .lbl { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.total-card .amount { font-family: var(--serif); font-size: 46px; line-height: 1.05; margin: 6px 0; }
.kpis { display: flex; gap: 0; border: 1px solid var(--hairline); border-top: none; margin-bottom: 26px; }
.kpis div { flex: 1; padding: 14px; text-align: center; }
.kpis div + div { border-left: 1px solid var(--hairline); }
.kpis .k { font-family: var(--serif); font-size: 22px; }
.kpis .t { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

table.breakdown { width: 100%; border-collapse: collapse; margin-bottom: 26px; }
table.breakdown td { padding: 11px 0; border-bottom: 1px solid var(--hairline); }
table.breakdown td.amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.breakdown tr.sub td { font-style: italic; color: var(--muted); }
table.breakdown tr.grand td { border-top: 2px solid var(--ink); border-bottom: none; font-family: var(--serif); font-size: 20px; padding-top: 14px; }

.alert { border: 1px solid var(--ink); padding: 14px 16px; margin-bottom: 14px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.alert.solid { background: var(--ink); color: var(--paper); }
.alert .mark { font-family: var(--serif); font-weight: 700; }

details.personal { border: 1px solid var(--hairline); padding: 12px 16px; margin-bottom: 26px; }
details.personal summary { cursor: pointer; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
details.personal table { width: 100%; border-collapse: collapse; margin-top: 12px; }
details.personal td { padding: 6px 0; border-bottom: 1px solid var(--hairline); font-size: 14px; }
details.personal td.amt { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Listas / registro ---- */
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--ink); padding: 8px 6px; }
table.list td { padding: 10px 6px; border-bottom: 1px solid var(--hairline); }
table.list td.amt { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--muted); }
.tag { display: inline-block; border: 1px solid var(--ink); padding: 1px 7px; font-size: 11px; letter-spacing: .05em; }
.tag.warn { background: var(--ink); color: var(--paper); }

/* ---- Admin ---- */
.param-section { margin-bottom: 30px; }
.param-section h3 { border-bottom: 1px solid var(--ink); padding-bottom: 6px; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; }
.param-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--hairline); }
.param-row .name { flex: 1; font-size: 14px; }
.param-row input { width: 120px; text-align: right; }
.param-row .por-confirmar { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--ink); padding: 1px 6px; }
.param-row .nota { display: block; font-size: 11px; color: var(--muted); font-style: italic; }
.ro-note { border: 1px solid var(--ink); padding: 12px 14px; font-size: 13px; margin-bottom: 22px; }
.param-row input:disabled { color: var(--muted); border-bottom-color: var(--hairline); -webkit-text-fill-color: var(--muted); opacity: 1; }

/* ---- Login ---- */
.login-wrap { max-width: 360px; margin: 12vh auto; text-align: center; }
.login-wrap .word { font-family: var(--serif); font-size: 26px; letter-spacing: .22em; text-transform: uppercase; }
.login-wrap p { color: var(--muted); margin-bottom: 30px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 20px; font-size: 14px; z-index: 50; opacity: 0; transition: opacity .25s; max-width: 90%; }
.toast.show { opacity: 1; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--paper); border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 640px) {
  h1.title { font-size: 38px; }
  .total-card .amount { font-size: 56px; }
}

/* ---- Print (export PDF de la cotización) ---- */
@media print {
  header.app .session, nav.tabs, .actions, button, .field button { display: none !important; }
  header.app { border-bottom: 2px solid #000; }
  main { max-width: none; }
  .view:not(.active) { display: none; }
  .dist, details.personal { display: block !important; }
  details.personal { border: none; }
  a[href]:after { content: ""; }
}
