/* Kuukum Cotiza — Menta fresca (claro) / Menta profunda (oscuro).
   Una columna de teléfono; asistente de 4 pasos con barra de acciones fija abajo. */
:root {
  --primary: #002C37; --accent: #5ED1C3; --accent-soft: #E8F6F4; --on-accent: #002C37;
  --error: #C44040; --warn: #B7791F; --ok: #1E8C7E; --neutral: #7A8B8C;
  --bg: #F8F9FA; --surface: #FFFFFF; --surface-2: #F0F5F5; --fg: #0E2A31; --muted: #5F7273; --line: #DCE5E5;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --tap: 48px; --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #0A3946; --accent-soft: #0C3B42; --bg: #001E28; --surface: #04293A; --surface-2: #08323F;
    --fg: #E6F2F1; --muted: #8FA6A7; --line: #16404B; color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 16px/1.4 var(--font); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Estructura ---------- */
.screen { min-height: 100%; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.topbar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; }
.topbar img { width: 36px; height: 36px; border-radius: 10px; background: #fff; }
.topbar h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { flex: 1; padding: 4px 16px calc(120px + env(safe-area-inset-bottom)); display: grid; gap: 14px; align-content: start; max-width: 560px; width: 100%; margin: 0 auto; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); display: grid; place-items: center; color: var(--fg); flex: none; }
.icon-btn.lock { background: #FBE4E4; color: var(--error); }
@media (prefers-color-scheme: dark) { .icon-btn.lock { background: #3B1414; color: #F08A8A; } }
.icon-btn svg, .act svg { width: 22px; height: 22px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.sync-pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 0; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.sync-pill.pend { background: #FFF3DC; color: #7A4B00; }
.sync-pill.err { background: #FBE4E4; color: var(--error); }
@media (prefers-color-scheme: dark) { .sync-pill.pend { background: #3B2C0A; color: #F5C26B; } .sync-pill.err { background: #3B1414; color: #F08A8A; } }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Barra de pestañas ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 8px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: center; gap: 8px; z-index: 5; }
.tab { flex: 1; max-width: 200px; height: 52px; border-radius: 16px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; align-content: center; gap: 2px; font-size: 12px; font-weight: 600; }
.tab svg { width: 24px; height: 24px; }
.tab.on { background: var(--accent-soft); color: var(--fg); }

/* ---------- Asistente ---------- */
.wiz-head { padding: 12px 16px 6px; max-width: 560px; width: 100%; margin: 0 auto; }
.wiz-head .row { display: flex; align-items: center; gap: 12px; }
.wiz-head h1 { margin: 0; font-size: 20px; font-weight: 800; flex: 1; }
.wiz-head .step-name { font-size: 13px; color: var(--muted); margin-top: 10px; }
.progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.progress span { height: 5px; border-radius: 3px; background: var(--line); }
.progress span.on { background: var(--accent); }
.actions { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); display: flex; justify-content: center; gap: 14px; z-index: 5; }
.act { display: grid; justify-items: center; gap: 4px; border: 0; background: none; padding: 0; font-size: 11px; font-weight: 600; color: var(--muted); }
.act .c { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.act.ghost .c { background: var(--surface-2); color: var(--fg); }
.act[disabled] { opacity: .4; pointer-events: none; }
.act.wide .c { width: auto; padding: 0 22px; border-radius: 999px; gap: 8px; display: flex; align-items: center; font-size: 16px; font-weight: 700; }

/* ---------- Componentes ---------- */
.search { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-radius: var(--r); background: var(--surface-2); border: 1.5px solid transparent; }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 16px; height: 100%; }
.search svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, .field textarea, .field select { min-height: var(--tap); border: 0; border-bottom: 1.5px solid var(--line); background: transparent; padding: 10px 0; font-size: 16px; color: var(--fg); border-radius: 0; outline: none; width: 100%; }
.field textarea { resize: vertical; min-height: 80px; line-height: 1.4; }
.field input:focus, .field textarea:focus { border-bottom-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 10px; }
.card h3 { margin: 0; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 2px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; width: 100%; }
.li .grow { flex: 1; min-width: 0; }
.li .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.li .s { font-size: 14px; color: var(--ok); }
.picked { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1.5px solid var(--accent); }
.picked .grow { flex: 1; min-width: 0; }
.picked b { display: block; font-size: 17px; }
.check { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.check svg { width: 18px; height: 18px; stroke-width: 2; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.label { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; font-size: 15px; font-weight: 500; white-space: nowrap; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.pill { height: var(--tap); padding: 0 20px; border-radius: 999px; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 16px; line-height: 1; }
.pill.soft { background: var(--accent-soft); color: var(--fg); }
.pill.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--fg); }
.pill.danger { background: transparent; border: 1.5px solid var(--error); color: var(--error); }
.pill.block { width: 100%; }
.dashed { border: 1.5px dashed var(--neutral); border-radius: var(--r); background: transparent; min-height: 76px; display: grid; place-items: center; gap: 2px; color: var(--muted); font-size: 15px; width: 100%; }
.dashed svg { width: 22px; height: 22px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 15px; }

/* Partidas */
.line { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 10px; }
.line .name { font-weight: 600; font-size: 15px; }
.line .row { display: grid; grid-template-columns: auto 1fr 1fr; gap: 12px; align-items: end; }
.line .foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.line .foot b { color: var(--fg); font-size: 16px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: none; display: grid; place-items: center; }
.stepper button svg { width: 18px; height: 18px; }
.stepper input { width: 52px; text-align: center; border: 0; border-bottom: 1.5px solid var(--line); background: transparent; height: 40px; font: 700 17px var(--mono); outline: none; }
.link-del { border: 0; background: none; color: var(--error); font-size: 14px; font-weight: 600; min-height: 36px; padding: 0; }

.toggle { display: flex; align-items: center; justify-content: space-between; min-height: var(--tap); font-size: 16px; }
.toggle input { appearance: none; width: 52px; height: 32px; border-radius: 999px; background: var(--line); position: relative; margin: 0; flex: none; }
.toggle input::after { content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { left: 23px; }

/* Resumen / totales */
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.kv.big { font-size: 20px; font-weight: 800; }
.kv .num { white-space: nowrap; }
.profit { border-radius: var(--r); padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--primary); color: #fff; }
.profit small { display: block; font-size: 12px; opacity: .75; }
.profit b { font: 800 22px var(--mono); }
.badge { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.b-ok { background: var(--ok); color: #fff; } .b-warn { background: var(--warn); color: #fff; } .b-bad { background: var(--error); color: #fff; }

/* Lista de cotizaciones */
.qcard { display: grid; gap: 4px; padding: 14px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; width: 100%; }
.qcard .r1, .qcard .r3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.qcard .folio { font: 800 16px var(--mono); }
.qcard .total { font: 800 18px var(--mono); }
.st { height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; border: 1.5px solid transparent; white-space: nowrap; }
.st.ok { color: var(--ok); border-color: var(--ok); }
.st.pend { color: #8A5A00; background: #FFF3DC; }
.st.err { color: var(--error); background: #FBE4E4; }
.st.draft { color: var(--muted); border-color: var(--line); }
@media (prefers-color-scheme: dark) { .st.pend { background: #3B2C0A; color: #F5C26B; } .st.err { background: #3B1414; color: #F08A8A; } }

/* Hoja inferior (configurador de producto) */
.backdrop { position: fixed; inset: 0; background: rgba(0, 20, 28, .45); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92%; z-index: 21; background: var(--surface); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); max-width: 600px; margin: 0 auto; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--accent); margin: 10px auto 4px; }
.sheet h2 { margin: 6px 16px 10px; font-size: 20px; text-align: center; }
.sheet .body { overflow-y: auto; padding: 0 16px 12px; display: grid; gap: 12px; }
.sheet .foot { padding: 12px 16px; display: flex; gap: 10px; border-top: 1px solid var(--line); }
.sheet .foot .pill { flex: 1; }
.facet { display: grid; gap: 6px; }
.res { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 12px; background: none; text-align: left; width: 100%; }
.res.on { border-color: var(--accent); background: var(--accent-soft); }
.res .grow { flex: 1; min-width: 0; font-size: 14px; }
.res .p { font: 700 15px var(--mono); white-space: nowrap; }
.res .m { font: 12px var(--mono); color: var(--ok); }

/* Login */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); text-align: center; }
#gbtn { min-height: 44px; border-radius: 999px; overflow: hidden; }
.login .box { display: grid; gap: 18px; justify-items: center; max-width: 340px; }
.login img { width: 140px; height: 140px; border-radius: 28px; background: #fff; }
.login p { margin: 0; color: var(--muted); }
.notice { padding: 12px 14px; border-radius: 12px; background: #FBE4E4; color: var(--error); font-size: 14px; text-align: left; }
.notice.info { background: var(--accent-soft); color: var(--fg); }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(112px + env(safe-area-inset-bottom)); background: var(--primary); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 15px; z-index: 40; max-width: calc(100% - 32px); text-align: center; }
.verify { padding: 16px; border-radius: var(--r); display: grid; gap: 8px; }
.verify.ok { background: var(--accent-soft); }
.verify.bad { background: #FBE4E4; color: var(--error); }
@media (prefers-color-scheme: dark) { .verify.bad { background: #3B1414; color: #F08A8A; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
