/* Seaboard CRM — estilos. Móvil primero; a partir de 960 px, dos columnas.
   Sin estilos en línea (la CSP los bloquea): todo se hace con clases.          */
:root {
    --ink: #111111; --muted: #5F5F5F; --line: #E4E1DB; --bg: #F5F4F0; --card: #FFFFFF;
    --ok: #17794A; --ok-bg: #E6F3EC; --warn: #9A5B00; --warn-bg: #FBF1DC; --late: #B3261E; --late-bg: #FBE9E7;
    --info: #1F4FD8; --info-bg: #E8EEFC; --r: 10px; --tab: 62px;
    --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.45 Archivo, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, p, ul, ol, dl, dd, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ic { width: 22px; height: 22px; flex: none; }
.boot { padding: 48px 20px; text-align: center; color: var(--muted); }
.hint { color: var(--muted); font-size: 15px; }
.opt { color: var(--muted); font-weight: 400; font-size: 14px; }

/* ---- armazón ----------------------------------------------------------- */
.shell { min-height: 100dvh; padding-bottom: calc(var(--tab) + var(--safe-b)); }
.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; min-height: 54px; padding: var(--safe-t) 16px 0; background: var(--card); border-bottom: 1px solid var(--line); }
.bar__brand { font-weight: 800; letter-spacing: .02em; }
.bar__brand span { font-weight: 400; color: var(--muted); }
.bar__back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin-left: -8px; padding-right: 10px; font-weight: 600; text-decoration: none; }
.bar__back + .bar__brand { display: none; }
.bar__nav { display: none; }
.col--main { display: none; }
.shell--main .col--list { display: none; }
.shell--main .col--main { display: block; }
.page { padding: 20px 16px 32px; max-width: 760px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tab) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--card); border-top: 1px solid var(--line); }
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12.500px; color: var(--muted); text-decoration: none; }
.tabs a[aria-current] { color: var(--ink); font-weight: 600; }
.tabs a[aria-current]::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; background: var(--ink); border-radius: 0 0 3px 3px; }
.badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--late); color: #fff; font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }

/* ---- lista ------------------------------------------------------------- */
.tools { position: sticky; top: calc(54px + var(--safe-t)); z-index: 4; display: grid; gap: 8px; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
.tools__row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.search, select, .field input, .field textarea, .nextform input { width: 100%; min-height: 48px; padding: 10px 12px; background: var(--card); border: 1px solid #C9C5BD; border-radius: var(--r); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 19px) 21px, calc(100% - 13px) 21px; background-size: 6px 6px; background-repeat: no-repeat; text-overflow: ellipsis; }
.tools select { min-height: 44px; font-size: 15px; }
.count { padding: 12px 16px 6px; color: var(--muted); font-size: 14.500px; }
.rows { background: var(--card); border-top: 1px solid var(--line); }
.rows li { border-bottom: 1px solid var(--line); }
.rows--card { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.rows--card li:last-child { border-bottom: 0; }
.row { display: grid; gap: 3px; padding: 14px 16px; text-decoration: none; }
.row[aria-current] { background: #EFEDE7; box-shadow: inset 4px 0 0 var(--ink); }
.row__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.row__name { font-weight: 600; font-size: 18px; line-height: 1.25; }
.row__sub { color: var(--muted); font-size: 15px; }
.row__sub b { color: var(--info); font-weight: 600; }
.row__next { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; font-size: 15px; }
.row__next .ic { width: 18px; height: 18px; margin-top: 2px; }
.row__next.is-late { color: var(--late); }
.row__next.is-now { color: var(--ok); }

.pill, .tag { display: inline-block; flex: none; padding: 3px 10px; border-radius: 999px; font-size: 13.500px; font-weight: 600; white-space: nowrap; background: #ECEAE4; color: #3D3D3D; }
.pill--contactado { background: var(--info-bg); color: var(--info); }
.pill--reunion, .pill--propuesta { background: var(--warn-bg); color: var(--warn); }
.pill--ganado { background: var(--ok-bg); color: var(--ok); }
.pill--perdido { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.tag { background: transparent; box-shadow: inset 0 0 0 1px #C9C5BD; font-weight: 400; }
.empty { padding: 40px 20px; text-align: center; display: grid; gap: 12px; justify-items: center; }

/* ---- ficha ------------------------------------------------------------- */
h1 { font-size: 27px; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; }
.head__sub { margin-top: 4px; color: var(--muted); }
.head__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.page > h1 + .hint { margin-top: 6px; }
.page > h1 ~ .form, .page > h1 ~ .sec:first-of-type { margin-top: 20px; }

.next { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 12px 14px; background: var(--warn-bg); border-radius: var(--r); }
.next.is-late { background: var(--late-bg); }
.next__label { font-size: 14px; font-weight: 600; color: var(--warn); }
.next.is-late .next__label { color: var(--late); }
.next__text { font-weight: 600; }

.acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-top: 16px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 68px; padding: 8px 4px; background: var(--card); border: 1px solid #C9C5BD; border-radius: var(--r); font-size: 15px; font-weight: 600; text-decoration: none; text-align: center; }
.act--main { background: var(--ink); border-color: var(--ink); color: #fff; }

.sec { margin-top: 28px; }
.sec h2 { font-size: 19px; font-weight: 600; margin-bottom: 10px; }
.sec h2 .num { color: var(--muted); font-weight: 400; }
.sec--late h2 { color: var(--late); }
.sec--box { padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.sec > .hint { margin-bottom: 10px; }
.lead-text { font-size: 17px; }
.lead-text + .hint { margin-top: 6px; }

.people { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.person { display: grid; gap: 2px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.person__name { font-weight: 600; }
.person__role { color: var(--ink); font-size: 15.500px; }
.person__note { color: var(--muted); font-size: 14px; }
.person__links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; font-size: 15px; }
.person__links a { font-weight: 600; }

.seg, .quick { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 42px; padding: 8px 14px; background: var(--card); border: 1px solid #C9C5BD; border-radius: 999px; font-size: 15.500px; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.nextform { margin-top: 4px; padding-top: 14px; border-top: 1px dashed #C9C5BD; display: grid; gap: 10px; }
.nextform legend { float: left; width: 100%; padding: 14px 0 0; font-weight: 600; }
.nextform legend + * { clear: both; }
.quick input[type="date"] { width: auto; flex: 1 1 150px; min-height: 42px; padding: 6px 10px; }

.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.step { display: grid; gap: 1px; padding: 10px 12px; min-height: 60px; text-align: left; background: var(--card); border: 1px solid #C9C5BD; border-radius: var(--r); }
.step b { font-weight: 600; }
.step span { color: var(--muted); font-size: 14px; }
.step[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.step[aria-pressed="true"] span { color: #D6D6D6; }
.step--ganado[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); }

.log { border-left: 2px solid var(--line); margin-left: 4px; }
.log__item { position: relative; padding: 0 0 16px 16px; }
.log__item::before { content: ""; position: absolute; left: -6px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.log__item--estado::before { background: var(--card); box-shadow: 0 0 0 2px #B9B5AD; }
.log__item--web::before { background: var(--info); }
.log__meta { color: var(--muted); font-size: 14px; }
.log__meta b { color: var(--ink); font-weight: 600; }
.log__text { white-space: pre-line; overflow-wrap: anywhere; }
.log__item--estado .log__text { color: var(--muted); }

.more { margin-top: 10px; }
.more > summary { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "+"; display: inline-block; width: 18px; text-decoration: none; }
.more[open] > summary::before { content: "–"; }
.more--big { margin-top: 0; border-top: 1px solid var(--line); }
.more--big > summary { display: flex; min-height: 52px; text-decoration: none; }
.more > .form, .more > .dl { margin: 6px 0 16px; }
.dl { display: grid; gap: 12px; }
.dl dt { color: var(--muted); font-size: 14px; }
.dl dd { white-space: pre-line; overflow-wrap: anywhere; }
.danger { margin-top: 20px; }

/* ---- formularios y botones -------------------------------------------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label { font-size: 15px; font-weight: 600; }
.field textarea { min-height: 92px; resize: vertical; }
.form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 10px 22px; background: var(--ink); color: #fff; border: 1px solid var(--ink); border-radius: var(--r); font-weight: 600; text-decoration: none; }
.btn:disabled { opacity: .5; }
.btn--sm { min-height: 44px; padding: 8px 16px; }
.btn--ghost { background: transparent; color: var(--ink); border-color: #C9C5BD; }
.btn--block { width: 100%; }
.link { padding: 0; background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; }
.link--muted { color: var(--muted); }
.link--danger { color: var(--late); min-height: 44px; }
.msg { font-size: 15px; min-height: 0; }
.msg--err { color: var(--late); font-weight: 600; }
.msg--ok { color: var(--ok); font-weight: 600; }

.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth__box { width: 100%; max-width: 400px; padding: 24px 20px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.auth__brand { font-size: 22px; font-weight: 800; letter-spacing: .02em; }
.auth__brand span { font-weight: 400; color: var(--muted); }

@media (min-width: 620px) {
    .form--2 { grid-template-columns: 1fr 1fr; }
    .form--2 > .full { grid-column: 1 / -1; }
    .steps { grid-template-columns: repeat(3, 1fr); }
    .page { padding: 28px 28px 40px; }
    .shell--main .page, .shell--list .page { margin-inline: auto; }
}

/* ---- PC y iPad apaisado: lista a la izquierda, contenido a la derecha ---- */
@media (min-width: 960px) {
    .shell { padding-bottom: 0; height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
    .tabs, .bar__back { display: none; }
    .bar__back + .bar__brand { display: inline; }
    .bar { padding-inline: 24px; min-height: 60px; }
    .bar__nav { display: flex; gap: 4px; margin-left: 28px; }
    .bar__nav a { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 16px; }
    .bar__nav a[aria-current] { background: var(--ink); color: #fff; font-weight: 600; }
    .bar__nav .ic { width: 19px; height: 19px; }
    .bar__nav .badge { position: static; margin-left: 2px; }
    .cols { display: grid; grid-template-columns: minmax(340px, 400px) 1fr; min-height: 0; }
    .col { overflow-y: auto; }
    .col--list, .shell--main .col--list { display: block; border-right: 1px solid var(--line); }
    .col--main { display: block; background: var(--card); }
    .tools { top: 0; }
    .page { margin: 0 auto; padding: 32px 40px 56px; }
    .rows--card, .people, .sec--box { background: var(--bg); }
    .sec--box .chip, .sec--box input, .sec--box textarea { background: var(--card); }
}
