/* FILLSUN CRM
   Azul noche para la estructura, papel frío para el trabajo,
   y ámbar solar solo para lo que pide acción: la próxima tarea y la temperatura. */

:root {
    --night: #0E2740;
    --night-2: #17395B;
    --night-3: #234B72;
    --night-ink: #B9C9DA;
    --paper: #F2F4F6;
    --card: #FFFFFF;
    --ink: #142130;
    --muted: #5A6878;
    --line: #D9E0E7;
    --line-2: #ECEFF3;
    --sun: #F4A300;
    --sun-deep: #D98A00;
    --sun-ink: #6E4600;
    --sun-soft: #FFF3D3;
    --good: #1C7C52;
    --good-soft: #E3F3EA;
    --bad: #B5382E;
    --bad-soft: #FBE9E7;
    --warn: #9C5B00;
    --warn-soft: #FFF0DA;
    --wa: #1A9A52;
    --wa-deep: #13803F;
    --r-sm: 6px;
    --r: 10px;
    --r-lg: 16px;
    --shadow: 0 1px 2px rgba(14, 39, 64, .06), 0 4px 16px rgba(14, 39, 64, .05);
    --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --tabbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
    color: var(--ink);
    background: var(--paper);
    font-variation-settings: "wdth" 100;
}
a { color: var(--night-3); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--night); }
img, svg { display: block; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: 28px; font-weight: 750; font-variation-settings: "wdth" 112; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 650; font-variation-settings: "wdth" 106; }
h3 { font-size: 14px; font-weight: 650; margin: 20px 0 8px; }
h2 small, h3 small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; font-variation-settings: "wdth" 100; }
p { margin: 0 0 10px; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.block { display: block; }
.strong { font-weight: 650; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
code { background: var(--line-2); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
    background: var(--night);
    color: var(--night-ink);
    display: flex; flex-direction: column;
    padding: 20px 14px;
    position: sticky; top: 0; height: 100vh;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    color: #fff; text-decoration: none;
    font-size: 17px; font-weight: 500; letter-spacing: .02em;
    font-variation-settings: "wdth" 118;
    padding: 0 6px 18px;
}
.brand b { font-weight: 800; color: var(--sun); }
.brand:hover { color: #fff; }
.brand--dark { color: var(--night); padding: 0 0 18px; }
.brand--dark b { color: var(--sun-deep); }
.logo { width: 30px; height: 30px; color: currentColor; }
.side__new { margin-bottom: 18px; }
.side__nav { display: flex; flex-direction: column; gap: 2px; }
.side__nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 10px; border-radius: var(--r-sm);
    color: var(--night-ink); text-decoration: none; font-weight: 500;
}
.side__nav a:hover { background: var(--night-2); color: #fff; }
.side__nav a.is-active { background: var(--night-2); color: #fff; box-shadow: inset 3px 0 0 var(--sun); }
.side__nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.side__nav span { flex: 1; }
.count {
    font-style: normal; font-size: 12px; font-weight: 700;
    background: var(--sun); color: var(--night);
    min-width: 22px; height: 22px; padding: 0 6px;
    border-radius: 11px; display: inline-grid; place-items: center;
}
.count--quiet { background: var(--line-2); color: var(--muted); margin-left: 8px; }
.side__user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--night-2); }
.side__user b { display: block; color: #fff; font-size: 14px; font-weight: 600; }
.side__user small { display: block; color: var(--night-ink); font-size: 12px; }
.side__user div { flex: 1; min-width: 0; }
.side__user .linkbtn { color: var(--night-ink); }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center; flex: none;
    background: var(--night-3); color: #fff; font-weight: 700; font-size: 13px; text-decoration: none;
}
.avatar--sm { width: 32px; height: 32px; background: var(--line-2); color: var(--night); }

.main { min-width: 0; padding: 28px 32px 48px; }
.page { max-width: 1040px; margin: 0 auto; }
.page--wide { max-width: none; }
.page--narrow { max-width: 680px; }
.page--lead { max-width: 1180px; }
.page__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.page__head .muted { margin: 4px 0 0; }
.crumb { display: inline-block; font-size: 13px; color: var(--muted); margin-bottom: 10px; text-decoration: none; }
.crumb::before { content: "‹ "; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 40px; padding: 0 16px;
    font: inherit; font-weight: 600; font-size: 14px; line-height: 1;
    color: var(--ink); background: var(--card);
    border: 1px solid var(--line); border-radius: var(--r-sm);
    text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #B8C3CF; color: var(--ink); }
.btn--sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--primary { background: var(--night); border-color: var(--night); color: #fff; }
.btn--primary:hover { background: var(--night-2); color: #fff; }
.btn--dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--dark:hover { color: #fff; background: #000; }
.btn--sun { background: var(--sun); border-color: var(--sun); color: var(--night); }
.btn--sun:hover { background: #FFB520; color: var(--night); border-color: #FFB520; }
.btn--wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn--wa:hover { background: var(--wa-deep); color: #fff; }
.btn--good { background: var(--good); border-color: var(--good); color: #fff; }
.btn--good:hover { color: #fff; filter: brightness(1.08); }
.btn--bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--bad:hover { color: #fff; filter: brightness(1.08); }
.btn--ghost-bad { color: var(--bad); }
.btn--ghost-bad:hover { color: var(--bad); border-color: var(--bad); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--night-3); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn--quiet { color: var(--muted); }
.linkbtn--bad { color: var(--bad); }

/* ---------- Avisos ---------- */
.toast {
    position: relative;
    max-width: 1040px; margin: 0 auto 16px;
    padding: 12px 44px 12px 16px;
    border-radius: var(--r-sm);
    background: var(--good-soft); color: #0F4F33;
    border-left: 4px solid var(--good);
}
.toast--error { background: var(--bad-soft); color: #7D241D; border-left-color: var(--bad); }
.toast--warn { background: var(--warn-soft); color: #6B3F00; border-left-color: var(--sun-deep); }
.toast__x { position: absolute; right: 8px; top: 6px; background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.alert { padding: 12px 14px; border-radius: var(--r-sm); background: var(--line-2); margin-bottom: 14px; }
.alert--error { background: var(--bad-soft); color: #7D241D; }
.alert--warn { background: var(--warn-soft); color: #6B3F00; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.hint--strong { color: var(--sun-ink); background: var(--sun-soft); padding: 10px 12px; border-radius: var(--r-sm); }
.hint--warn { color: var(--warn); }

/* ---------- Formularios ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form h2 { margin-top: 6px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea {
    font: inherit; font-size: 15px; color: var(--ink);
    background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm);
    padding: 9px 11px; min-height: 42px; width: 100%;
}
textarea { resize: vertical; min-height: 0; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--night-3); box-shadow: 0 0 0 3px rgba(35, 75, 114, .15); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--night); flex: none; }
.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; color: var(--ink); font-size: 14px; cursor: pointer; }
.check small { color: var(--muted); margin-left: auto; }
.check--field { align-self: end; min-height: 42px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
legend { font-size: 15px; font-weight: 650; color: var(--ink); padding: 0; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span2 { grid-column: 1 / -1; }
.form__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 180px; }
details > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--night-3); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "+ "; }
details[open] > summary::before { content: "– "; }
details > summary.btn::before, .tabbar__more > summary::before, .pop > summary::before, .obj > summary::before { content: none; }

/* ---------- Paneles y listas ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 18px; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel h3:first-child { margin-top: 0; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.row:first-child { border-top: 0; }
.row.is-off { opacity: .55; }
.row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row__title { font-weight: 650; color: var(--ink); text-decoration: none; font-size: 15px; }
a.row__title:hover { text-decoration: underline; }
.row__meta { font-size: 14px; }
.row__sub { font-size: 13px; color: var(--muted); }
.row__actions { display: flex; gap: 8px; align-items: center; }
.due { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.due--late, .late { color: var(--bad); font-weight: 600; }
.warn { color: var(--warn); font-weight: 600; }
.clock { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; min-width: 48px; color: var(--night); }
.clock--quiet { color: var(--muted); font-weight: 500; }
.wait { font-size: 13px; font-weight: 700; min-width: 64px; color: var(--sun-ink); font-variant-numeric: tabular-nums; }
.wait--late { color: var(--bad); }
.more { margin: 10px 0 0; font-size: 14px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 20px; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.tag--ganado { background: var(--good-soft); color: var(--good); }
.tag--perdido { background: var(--bad-soft); color: var(--bad); }
.tag--nueva { background: var(--sun-soft); color: var(--sun-ink); }
.empty { text-align: center; padding: 48px 20px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--r); margin-bottom: 18px; }
.empty h2 { font-size: 20px; margin-bottom: 8px; }
.empty p { color: var(--muted); max-width: 46ch; margin: 0 auto 18px; }

/* ---------- Temperatura (sol) ---------- */
.temp { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.temp line { stroke-width: 2.2; stroke-linecap: round; }
.temp .off { stroke: #D3DAE2; }
.temp .on { stroke: var(--sun); }
.temp .core { fill: none; stroke: #B6C1CD; stroke-width: 2; }
.temp--tibio .core { fill: var(--sun-soft); stroke: var(--sun); }
.temp--caliente .core { fill: var(--sun); stroke: var(--sun-deep); }
.temp--caliente .on { stroke: var(--sun-deep); }
.temp__label { font-size: 13px; font-weight: 600; color: var(--muted); }

/* ---------- Mi día ---------- */
.daybar {
    list-style: none; margin: 0 0 22px; padding: 0;
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
}
.daybar li { padding: 14px 18px; border-left: 1px solid var(--line-2); display: flex; align-items: baseline; gap: 8px; }
.daybar li:first-child { border-left: 0; }
.daybar b { font-size: 26px; font-weight: 750; font-variation-settings: "wdth" 112; font-variant-numeric: tabular-nums; color: var(--night); }
.daybar span { font-size: 13px; color: var(--muted); line-height: 1.25; }
.daybar .is-hot b { color: var(--sun-deep); }
.daybar .is-late b { color: var(--bad); }
.daybar .is-warn b { color: var(--warn); }
.block { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 20px 6px; margin-bottom: 18px; }
.block > h2 { margin-bottom: 6px; }
.block--hot { border-color: var(--sun); box-shadow: inset 4px 0 0 var(--sun); }
.block--warn { box-shadow: inset 4px 0 0 var(--line); }
.task.is-late .row__meta { color: var(--bad); }

/* ---------- Ficha del cliente ---------- */
.lead-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.lead-head__id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.lead-head h1 { margin-bottom: 6px; }
.lead-head__contact { display: flex; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.chip { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 20px; background: var(--night); color: #fff; }
.chip--consultivo { background: var(--sun); color: var(--night); }
.chip--rapido { background: var(--night-3); }
.chip--quiet { background: var(--line-2); color: var(--muted); }

.stepper { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; }
.stepper ol { list-style: none; margin: 0 0 12px; padding: 0; display: flex; gap: 4px; overflow-x: auto; }
.stepper li {
    flex: 1 1 0; min-width: 96px;
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 600; color: var(--muted);
    padding: 8px 10px; background: var(--paper); border-radius: var(--r-sm);
    white-space: nowrap;
}
.stepper li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: #fff; border: 1px solid var(--line); flex: none; }
.stepper li.is-done { color: var(--night-3); }
.stepper li.is-done span { background: var(--night-3); border-color: var(--night-3); color: #fff; }
.stepper li.is-current { background: var(--night); color: #fff; }
.stepper li.is-current span { background: var(--sun); border-color: var(--sun); color: var(--night); }
.stepper__closed { font-weight: 650; margin: 0 0 12px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--line-2); }
.stepper__closed--ganado { background: var(--good-soft); color: var(--good); }
.stepper__closed--perdido { background: var(--bad-soft); color: var(--bad); }
.stepper__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* La próxima acción: el elemento que más se ve de toda la ficha */
.next {
    display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px;
    background: var(--sun-soft); border: 1px solid #F1D48A; border-left: 6px solid var(--sun);
    border-radius: var(--r); padding: 16px 18px; margin-bottom: 20px;
}
.next--late { background: var(--bad-soft); border-color: #EBC1BC; border-left-color: var(--bad); }
.next--empty { background: var(--card); border-color: var(--sun); border-style: dashed; border-left-style: solid; }
.next__body { flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; }
.next__label { font-size: 12.5px; font-weight: 700; color: var(--sun-ink); }
.next--late .next__label, .next--late time { color: var(--bad); }
.next__body strong { font-size: 19px; font-weight: 700; font-variation-settings: "wdth" 106; }
.next__body time { font-size: 13.5px; color: var(--muted); font-weight: 500; }
.next__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.next__add { flex-basis: 100%; }
.next__add form { margin-top: 10px; }
.pop { position: relative; }
.pop__body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; box-shadow: var(--shadow); display: flex; gap: 8px; width: max-content; }
.pop__body input { width: auto; }

.lead-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.lead-main { grid-column: 1; grid-row: 1; min-width: 0; }
.guide {
    grid-column: 2; grid-row: 1;
    position: sticky; top: 16px;
    background: var(--night); color: #E6EDF4;
    border-radius: var(--r); padding: 20px;
    max-height: calc(100vh - 32px); overflow-y: auto;
}
.guide h2 { color: #fff; margin-bottom: 8px; }
.guide h3 { color: #fff; border-top: 1px solid var(--night-2); padding-top: 16px; }
.guide__goal { font-size: 16px; font-weight: 600; color: var(--sun); line-height: 1.35; }
.guide__steps { margin: 0 0 10px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.guide__steps li::marker { color: var(--sun); font-weight: 700; }
.guide__rule { font-size: 13px; color: var(--night-ink); border-left: 2px solid var(--sun); padding-left: 10px; margin: 12px 0 0; }
.guide .mini th { color: #fff; }
.guide .mini td { color: var(--night-ink); }
.guide .mini th, .guide .mini td { border-color: var(--night-2); }
.guide .btn { margin-top: 10px; }
.tpl-list { display: flex; flex-direction: column; gap: 6px; }
.tpl {
    text-align: left; font: inherit; font-size: 14px; font-weight: 500;
    background: var(--night-2); color: #fff; border: 1px solid var(--night-3);
    border-radius: var(--r-sm); padding: 9px 12px; cursor: pointer;
}
.tpl::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--wa); margin-right: 8px; vertical-align: 1px; }
.tpl:hover { background: var(--night-3); }
.objections { display: flex; flex-direction: column; gap: 6px; }
.obj { background: var(--night-2); border-radius: var(--r-sm); padding: 10px 12px; font-size: 14px; }
.obj > summary { color: #fff; display: flex; align-items: center; justify-content: space-between; }
.obj[open] > summary { margin-bottom: 8px; }
.obj p { color: #DDE6EF; margin-bottom: 8px; }
.obj__why { color: var(--night-ink) !important; font-size: 13px; }
.obj__why b { color: #fff; }
.obj__actions { display: flex; gap: 6px; flex-wrap: wrap; }

.ficha .panel__head { position: sticky; top: 0; background: var(--card); z-index: 5; margin: -20px -20px 14px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); border-radius: var(--r) var(--r) 0 0; }
.qa { margin-bottom: 22px; }
.qa__item { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; padding: 6px 0 6px 12px; border-left: 3px solid var(--line); }
.qa__item span { font-size: 14px; font-weight: 500; color: var(--ink); }
.qa__item.is-answered { border-left-color: var(--good); }
.qa__item.is-answered span { color: var(--muted); }
.signals { background: var(--paper); border-radius: var(--r-sm); padding: 14px; margin-bottom: 18px; }
.signals legend { float: left; }
.signals output { margin-left: auto; font-weight: 700; color: var(--sun-ink); background: var(--sun-soft); padding: 2px 10px; border-radius: 20px; font-size: 13px; }
.contact-data { margin-bottom: 18px; }
.contact-data .grid2 { margin-top: 14px; }

.finance { background: var(--paper); border-radius: var(--r-sm); padding: 14px; }
.finance h3 { margin-top: 0; }
.finance .btn { margin-top: 10px; }
table.mini { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini th, .mini td { text-align: left; padding: 7px 8px 7px 0; border-top: 1px solid var(--line); vertical-align: top; }
.mini thead th { border-top: 0; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.mini th small { display: block; font-weight: 400; color: var(--muted); }
.guide .mini th small { color: var(--night-ink); }
.mini .good { color: var(--good); font-weight: 600; }

.meeting { padding: 12px 0; border-top: 1px solid var(--line-2); }
.meeting:first-child { border-top: 0; }
.meeting__head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-bottom: 4px; }
.meeting--agendada .tag { background: var(--sun-soft); color: var(--sun-ink); }
.meeting--realizada .tag { background: var(--good-soft); color: var(--good); }
.meeting--ausente .tag, .meeting--cancelada .tag { background: var(--bad-soft); color: var(--bad); }
.meeting__result { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.meeting__result input { flex: 1 1 220px; width: auto; min-height: 32px; padding: 5px 10px; font-size: 14px; }
.visit { margin-top: 10px; }
.visit form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.add { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.add form { margin-top: 12px; }

.note-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.note-form__bar { display: flex; gap: 16px; align-items: center; }
.note-form__bar .btn { margin-left: auto; }
.tasklist { list-style: none; margin: 0 0 16px; padding: 0; }
.tasklist li { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.tasklist li span { flex: 1; }
.tasklist time { color: var(--muted); font-size: 13px; }
.tasklist .is-late time { color: var(--bad); font-weight: 600; }
.timeline { list-style: none; margin: 16px 0 0; padding: 0; }
.tl { display: flex; gap: 12px; padding: 9px 0; }
.tl p { margin: 0; font-size: 14px; white-space: pre-line; }
.tl small { color: var(--muted); font-size: 12.5px; }
.tl__icon { flex: none; width: 34px; height: 22px; border-radius: 11px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; background: var(--line-2); color: var(--muted); }
.tl--whatsapp .tl__icon { background: var(--good-soft); color: var(--wa-deep); }
.tl--etapa .tl__icon { background: var(--night); color: #fff; }
.tl--objecion .tl__icon { background: var(--bad-soft); color: var(--bad); }
.tl--reunion .tl__icon, .tl--presupuesto .tl__icon { background: var(--sun-soft); color: var(--sun-ink); }
.tl--sistema p, .tl--tarea p { color: var(--muted); }
.danger { text-align: right; margin-top: 8px; }

/* ---------- Diálogos ---------- */
.dialog {
    width: min(560px, calc(100vw - 24px));
    border: 0; border-radius: var(--r-lg); padding: 24px;
    box-shadow: 0 20px 60px rgba(14, 39, 64, .3);
    color: var(--ink);
}
.dialog::backdrop { background: rgba(14, 39, 64, .45); }
.dialog h2 { font-size: 20px; margin-bottom: 14px; padding-right: 30px; }
.dialog textarea { margin-top: 12px; font-size: 15px; }
.dialog__x { position: absolute; top: 12px; right: 12px; }
.dialog__x button { background: none; border: 0; font-size: 26px; cursor: pointer; color: var(--muted); line-height: 1; }
.dialog__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 14px; }
.dialog form:not(.dialog__x) { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Embudo ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select, .filters input { width: auto; min-height: 38px; padding: 6px 10px; font-size: 14px; }
.filters--bar { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; margin-bottom: 16px; }
.filters--bar input[type="search"] { flex: 1 1 260px; }
.vfilter select { width: auto; min-height: 38px; padding: 6px 10px; font-size: 14px; font-weight: 600; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(176px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: #E7EBEF; border-radius: var(--r); min-height: 200px; display: flex; flex-direction: column; }
.col.is-over { background: var(--sun-soft); outline: 2px dashed var(--sun); }
.col__head { padding: 12px 12px 8px; }
.col__head h2 { font-size: 14px; }
.col__head span { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col__body { padding: 0 8px 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.col__empty { color: var(--muted); font-size: 13px; text-align: center; padding: 16px 0; margin: 0; }
.card {
    position: relative; display: flex; flex-direction: column; gap: 4px;
    background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm);
    padding: 10px 12px; text-decoration: none; color: var(--ink); cursor: grab;
}
.card:hover { border-color: var(--night-3); color: var(--ink); }
.card.is-dragging { opacity: .4; }
.card__top { display: flex; align-items: center; gap: 8px; }
.card__top b { font-size: 14px; font-weight: 650; line-height: 1.2; }
.card__meta { font-size: 12.5px; color: var(--muted); }
.card__amount { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.card__next { font-size: 12px; color: var(--sun-ink); font-weight: 600; }
.card__next.is-late { color: var(--bad); }
.card__next.is-none { color: var(--warn); }
.card__who { position: absolute; top: 8px; right: 8px; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.closed { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.closed section { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.closed h2 { font-size: 14px; margin-bottom: 8px; }
.closed h2 span { font-weight: 400; color: var(--muted); }
.closed p { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 14px; margin: 0; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.panel .table-wrap { border: 0; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFBFC; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 16px; font-size: 14px; }

/* ---------- Métricas ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); margin: 0 0 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.kpis > div { padding: 16px 18px; border-left: 1px solid var(--line-2); }
.kpis > div:first-child { border-left: 0; }
.kpis dt { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpis dd { margin: 4px 0 2px; font-size: 26px; font-weight: 750; font-variation-settings: "wdth" 112; font-variant-numeric: tabular-nums; color: var(--night); }
.kpis small { color: var(--muted); font-size: 12.5px; }
.kpis .is-late dd { color: var(--bad); }
.metrics-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 18px; }
.metrics-grid--3 { grid-template-columns: repeat(3, 1fr); }
.metrics-grid .panel { margin-bottom: 18px; }
.funnel, .bars { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.funnel li, .bars li { display: grid; grid-template-columns: 130px 1fr 52px; align-items: center; gap: 4px 12px; font-size: 14px; }
.funnel li small, .bars li small { grid-column: 2 / 4; color: var(--muted); font-size: 12px; margin-top: -2px; }
.funnel__track, .bars__track { height: 22px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.funnel__fill { display: block; height: 100%; background: var(--night-3); border-radius: 4px; }
.funnel li:last-child .funnel__fill { background: var(--sun); }
.bars__fill { display: block; height: 100%; background: var(--night-3); border-radius: 4px; }
.funnel b, .bars b { text-align: right; font-variant-numeric: tabular-nums; }
.bars__label, .funnel__label { font-weight: 500; }

/* ---------- Ajustes ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.is-active { color: var(--night); border-bottom-color: var(--sun); }
.tpl-row { display: block; padding: 10px 0; border-top: 1px solid var(--line-2); text-decoration: none; color: var(--ink); }
.tpl-row b { display: block; font-size: 14px; }
.tpl-row span { font-size: 13px; color: var(--muted); }
.tpl-row:hover b { text-decoration: underline; }
.tpl-row.is-off { opacity: .55; }

/* ---------- Nueva consulta ---------- */
.picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pick { flex-direction: row; cursor: pointer; }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pick span {
    flex: 1; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-sm);
    font-size: 15px; font-weight: 600; color: var(--ink); background: #fff; text-align: center;
}
.pick input:checked + span { border-color: var(--night); background: var(--night); color: #fff; box-shadow: inset 0 -3px 0 var(--sun); }
.pick input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 2px; }

/* ---------- Entrada e instalación ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: var(--night); }
.auth-card { width: min(420px, 100%); background: #fff; border-radius: var(--r-lg); padding: 32px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.auth-card--wide { width: min(560px, 100%); }
.auth-card h1 { font-size: 24px; margin-bottom: 14px; }
.auth-card .form { margin-bottom: 14px; }
.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------- Resumen para la reunión ---------- */
.brief section { margin-bottom: 22px; }
.brief h2 { margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--sun); display: inline-block; }
.brief__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }
.dl--wide { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.lead-quote { font-size: 18px; font-weight: 600; font-variation-settings: "wdth" 104; line-height: 1.35; }
.checklist { padding-left: 0; list-style: none; }
.checklist li { padding: 4px 0 4px 26px; position: relative; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 7px; width: 14px; height: 14px; border: 2px solid var(--line); border-radius: 3px; }
.plain { padding-left: 18px; margin: 0; }
.plain li { margin-bottom: 6px; }

/* ---------- Barra inferior del celular ---------- */
.tabbar { display: none; }

@media (max-width: 1100px) {
    .lead-grid { grid-template-columns: 1fr; }
    .guide { grid-column: 1; grid-row: auto; position: static; max-height: none; }
    .lead-main { grid-row: auto; }
    .kpis { grid-template-columns: repeat(3, 1fr); }
    .kpis > div:nth-child(4) { border-left: 0; }
    .kpis > div:nth-child(n+4) { border-top: 1px solid var(--line-2); }
    .metrics-grid, .metrics-grid--3 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .shell { display: block; }
    .side { display: none; }
    .main { padding: 18px 14px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
    h1 { font-size: 24px; }
    .tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
        height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: var(--night); border-top: 1px solid var(--night-2);
    }
    .tabbar > a, .tabbar__more > summary {
        flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        color: var(--night-ink); text-decoration: none; font-size: 11px; font-weight: 600; position: relative;
    }
    .tabbar__more { flex: 1; display: flex; }
    .tabbar__more > summary { list-style: none; height: 100%; }
    .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
    .tabbar__more > summary svg { fill: currentColor; stroke: none; }
    .tabbar .is-active { color: #fff; }
    .tabbar .is-active::after { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--sun); }
    .tabbar .count { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 11px; }
    .tabbar__new { flex: 0 0 64px !important; }
    .tabbar__new svg { width: 46px; height: 46px; padding: 11px; border-radius: 50%; background: var(--sun); stroke: var(--night) !important; stroke-width: 2.4 !important; }
    .sheet {
        position: fixed; left: 10px; right: 10px; bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom));
        background: #fff; border-radius: var(--r-lg); box-shadow: 0 10px 40px rgba(0, 0, 0, .3); padding: 8px; display: flex; flex-direction: column;
    }
    .sheet a, .sheet button { padding: 14px; font: inherit; font-size: 16px; font-weight: 600; color: var(--ink); text-decoration: none; text-align: left; background: none; border: 0; border-radius: var(--r-sm); width: 100%; }
    .sheet a:active { background: var(--paper); }
    .sheet form { display: block; border-top: 1px solid var(--line-2); }
    .sheet button { color: var(--bad); }

    .daybar { grid-template-columns: 1fr 1fr; }
    .daybar li:nth-child(3) { border-left: 0; }
    .daybar li:nth-child(n+3) { border-top: 1px solid var(--line-2); }
    .daybar b { font-size: 22px; }
    .block { padding: 14px 14px 4px; }
    .row { flex-wrap: wrap; gap: 8px 12px; }
    .row__main { flex: 1 1 calc(100% - 90px); }
    .row .wait { flex: 0 0 auto; min-width: 52px; }
    .row .due { order: 3; }
    .row__actions { order: 4; margin-left: auto; }
    .grid2 { grid-template-columns: 1fr; }
    .qa__item { grid-template-columns: 1fr; gap: 6px; }
    .lead-head__contact { width: 100%; }
    .lead-head__contact .btn { flex: 1; }
    .stepper li { min-width: 0; flex: 0 0 auto; }
    .stepper__actions .btn, .stepper__actions form { flex: 1 1 auto; }
    .stepper__actions form .btn { width: 100%; }
    .next__actions { width: 100%; }
    .next__actions > * { flex: 1; }
    .next__actions .btn { width: 100%; }
    .pop__body { left: 0; right: auto; flex-direction: column; width: 260px; }
    .board { grid-auto-columns: 82vw; scroll-snap-type: x mandatory; }
    .col { scroll-snap-align: start; }
    .closed { grid-template-columns: 1fr; }
    .kpis { grid-template-columns: 1fr 1fr; }
    .kpis > div { border-left: 0 !important; border-top: 1px solid var(--line-2); }
    .kpis > div:nth-child(-n+2) { border-top: 0; }
    .kpis > div:nth-child(even) { border-left: 1px solid var(--line-2) !important; }
    .funnel li, .bars li { grid-template-columns: 96px 1fr 40px; }
    .brief__grid { grid-template-columns: 1fr; }
    .dl, .dl--wide { grid-template-columns: 1fr; gap: 2px; }
    .dl dd { margin-bottom: 8px; }
    .picker { grid-template-columns: 1fr; }
    .checks { grid-template-columns: 1fr; }
    .panel { padding: 16px; }
    .ficha .panel__head { margin: -16px -16px 14px; padding: 12px 16px; }
    .table { font-size: 13.5px; }
    .toast { margin-bottom: 12px; }
    .dialog { padding: 20px; }
}

@media print {
    .side, .tabbar, .noprint, .toast { display: none !important; }
    .shell { display: block; }
    .main { padding: 0; }
    body { background: #fff; font-size: 12pt; }
    .brief h2 { border-bottom-color: #000; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
