/* MLG CRM — sistema visual v2.
   Dirección: referencias InvestIQ / Finexy / Crextio. Lienzo gris cálido, tarjetas blancas de 24px,
   navegación en píldoras con activo en negro, un acento naranja y una tarjeta oscura de contraste.
   Tipografía: Plus Jakarta Sans. Fuente de verdad: design-system/mlg-crm/MASTER.md */
:root {
  --canvas: #EDEDEA; --surface: #FFFFFF; --surface-2: #F5F5F2; --surface-3: #E9E9E5;
  --line: #E4E4E0; --line-strong: #CFCFCA;
  --ink: #141413; --ink-2: #5B5B57; --ink-3: #8C8C86; --ink-4: #B3B3AE;
  --accent: #F0541E; --accent-2: #FF7A3D; --accent-ink: #C2400C; --accent-soft: #FCEBE3;
  --black: #141413; --black-2: #2A2A28;
  --danger: #D6382B; --danger-soft: #FBE7E4; --success: #1E8A4C; --success-soft: #E3F3E9;
  --warn: #B8720A; --warn-soft: #FBF1DD; --info: #2B6BE4; --info-soft: #E8F0FD;
  --r-xl: 28px; --r-lg: 24px; --r-md: 16px; --r-sm: 12px;
  --shadow-card: 0 1px 2px rgba(20,20,19,.03), 0 12px 32px -14px rgba(20,20,19,.12);
  --shadow-hover: 0 2px 4px rgba(20,20,19,.04), 0 20px 40px -16px rgba(20,20,19,.18);
  --shadow-float: 0 30px 80px -24px rgba(20,20,19,.32);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2,.8,.2,1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 36px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
h2 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--ink-2); } .small { font-size: 13px; } .mono { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; } .grow { flex: 1; min-width: 0; } .wrap { flex-wrap: wrap; }
.hidden { display: none !important; } .nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- arranque / autenticación ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border-radius: var(--r-xl); padding: 40px 36px; box-shadow: var(--shadow-card); }
.auth-card .brand { margin-bottom: 28px; }
.auth-card h1 { font-size: 28px; margin-bottom: 6px; }
.auth-card form { display: grid; gap: 16px; margin-top: 26px; }

/* ---------- marca ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { width: 40px; height: 40px; border-radius: 13px; background: var(--black); color: #fff; display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.brand-name span { font-weight: 500; color: var(--ink-3); margin-left: 6px; }

/* ---------- estructura ---------- */
.app { max-width: 1560px; margin: 0 auto; padding: 0 28px 56px; }
.topbar { position: sticky; top: 0; z-index: 20; height: 84px; display: flex; align-items: center; gap: 20px; background: rgba(237,237,234,.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.pillnav { display: flex; gap: 2px; padding: 4px; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow-card); margin: 0 auto; }
.pillnav a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; font-weight: 500; font-size: 14.5px; color: var(--ink-2); transition: background .18s var(--ease), color .18s; white-space: nowrap; }
.pillnav a:hover { background: var(--surface-2); color: var(--ink); }
.pillnav a.active { background: var(--black); color: #fff; }
.pillnav .count { font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; display: inline-grid; place-items: center; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.search { position: relative; width: 280px; }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { width: 100%; height: 46px; padding: 0 16px 0 46px; border-radius: 999px; border: 1px solid transparent; background: var(--surface); box-shadow: var(--shadow-card); outline: none; transition: box-shadow .18s, border-color .18s; }
.search input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 4px rgba(240,84,30,.12); }
.avatar-btn { padding: 0; border: 0; background: none; border-radius: 50%; }
.avatar-btn .avatar { box-shadow: 0 0 0 3px var(--surface); }
.demo-pill { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--warn-soft); color: var(--warn); padding: 6px 12px; border-radius: 999px; }
.layout { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 28px; margin-top: 10px; }
.rail { position: sticky; top: 100px; display: flex; flex-direction: column; align-items: center; gap: 10px; height: calc(100vh - 124px); }
.rail-btn { width: 48px; height: 48px; border-radius: 50%; border: 1px solid transparent; background: var(--surface); color: var(--ink-2); display: grid; place-items: center; box-shadow: var(--shadow-card); transition: transform .18s var(--ease), box-shadow .18s, background .18s, color .18s; }
.rail-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); color: var(--ink); }
.rail-btn.primary { background: var(--accent); color: #fff; }
.rail-btn.primary:hover { background: var(--accent-ink); color: #fff; }
.rail-btn.active { background: var(--black); color: #fff; }
.rail-spacer { flex: 1; }
.main { min-width: 0; }
.demo-banner { display: flex; align-items: center; gap: 12px; margin: 6px 0 18px; padding: 10px 10px 10px 18px; border-radius: 999px; background: var(--warn-soft); color: #6E4502; font-size: 13.5px; }
.demo-banner strong { font-weight: 600; }
.demo-banner > span { flex: 1 1 200px; }
.demo-banner .btn { background: #fff; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin: 18px 0 26px; }
.page-head p { color: var(--ink-2); margin-top: 8px; font-size: 15px; }
.page-head .eyebrow { font-size: 13px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.bottomnav { display: none; }

/* ---------- botones, campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .18s, border-color .18s, transform .15s var(--ease), box-shadow .18s, color .18s; }
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--black); border-color: var(--black); color: #fff; }
.btn-primary:hover { background: var(--black-2); border-color: var(--black-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 20px -10px rgba(240,84,30,.6); }
.btn-accent:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-danger { color: var(--danger); } .btn-danger:hover { background: var(--danger-soft); border-color: #F3C4BE; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; } .btn-sm svg.ic { width: 15px; height: 15px; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; } .btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-link { border: 0; background: none; color: var(--ink); font-weight: 600; padding: 0; height: auto; font-size: 13.5px; }
.btn-link:hover { color: var(--accent-ink); background: none; }
.btn-wa:hover { background: #E6F6EC; border-color: #B5E3C5; color: #15703F; }
.btn.loading { pointer-events: none; opacity: .7; }
.input, .select, textarea.input { width: 100%; height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); outline: none; transition: border-color .18s, box-shadow .18s, background .18s; font-size: 14.5px; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px rgba(240,84,30,.12); }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238C8C86' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.select.inline { width: auto; height: 42px; padding: 0 36px 0 16px; border-radius: 999px; font-size: 13.5px; font-weight: 500; background-color: var(--surface); border-color: transparent; box-shadow: var(--shadow-card); }
.select.inline:focus { border-color: var(--line-strong); }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; min-height: 80px; line-height: 1.5; }
.field { display: grid; gap: 7px; } .field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .req::after { content: ' *'; color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } .form-grid .full { grid-column: 1 / -1; }
.form-error { color: var(--danger); font-size: 13.5px; background: var(--danger-soft); padding: 10px 14px; border-radius: 12px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--black); }
.seg { display: inline-flex; background: var(--surface); padding: 4px; border-radius: 999px; box-shadow: var(--shadow-card); }
.seg button { border: 0; background: transparent; height: 34px; padding: 0 16px; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 7px; transition: background .18s, color .18s; }
.seg button:hover { color: var(--ink); } .seg button.active { background: var(--black); color: #fff; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .date { width: auto; height: 42px; border-radius: 999px; font-size: 13.5px; background: var(--surface); border-color: transparent; box-shadow: var(--shadow-card); padding: 0 14px; }
.toolbar .sep { width: 1px; height: 26px; background: var(--line-strong); margin: 0 4px; }
input[type=checkbox].tick { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); cursor: pointer; flex: none; display: grid; place-items: center; transition: background .15s, border-color .15s; margin: 0; }
input[type=checkbox].tick:hover { border-color: var(--ink-3); }
input[type=checkbox].tick:checked { background: var(--success); border-color: var(--success); }
input[type=checkbox].tick:checked::after { content: ''; width: 6px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }

/* ---------- tarjetas, badges, avatares, chips ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 24px 0; }
.card-body { padding: 18px 24px 24px; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--cs, var(--surface-3)); color: var(--c, var(--ink-2)); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-nuevo { --c: #2458C8; --cs: #E6EEFC; } .st-contactado { --c: #6B40B8; --cs: #EEE8FA; } .st-seguimiento { --c: #A4650A; --cs: #FBF0DB; }
.st-visita { --c: #0E7A6D; --cs: #DFF2EE; } .st-negociacion { --c: #C2400C; --cs: #FCEBE3; } .st-cerrado { --c: #1B7A43; --cs: #E1F2E7; } .st-descartado { --c: #6A6A66; --cs: #ECECE8; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--av-fg, #3E4756); background: var(--av-bg, #E6E8EC); flex: none; letter-spacing: .01em; overflow: hidden; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; } .avatar.md { width: 40px; height: 40px; font-size: 14px; } .avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.avatar.empty { background: var(--surface-3); color: var(--ink-4); border: 1.5px dashed var(--line-strong); }
.avatar svg.ic { width: 16px; height: 16px; } .avatar.sm svg.ic { width: 12px; height: 12px; } .avatar.lg svg.ic { width: 22px; height: 22px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.chip svg.ic { width: 13px; height: 13px; }
.chip.overdue { background: var(--danger-soft); color: var(--danger); } .chip.today { background: var(--accent-soft); color: var(--accent-ink); }
.chip.done { background: var(--success-soft); color: var(--success); } .chip.none { color: var(--ink-3); background: transparent; border: 1.5px dashed var(--line-strong); font-weight: 500; }
.empty-state { text-align: center; padding: 56px 24px; color: var(--ink-2); }
.empty-state .ic-wrap { width: 60px; height: 60px; border-radius: 20px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 16px; color: var(--ink-3); }
.empty-state .ic-wrap svg { width: 26px; height: 26px; }
.empty-state h2 { color: var(--ink); margin-bottom: 6px; font-size: 20px; } .empty-state .actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.notice { padding: 12px 16px; border-radius: 14px; font-size: 13.5px; background: var(--surface-2); }
.notice.warn { background: var(--warn-soft); color: #6E4502; } .notice.ok { background: var(--success-soft); color: #155F35; } .notice.danger { background: var(--danger-soft); color: #8F2419; }
.notice code, .status-line code { font-size: 12px; background: rgba(0,0,0,.06); padding: 2px 6px; border-radius: 6px; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; } .kv dt { color: var(--ink-3); } .kv dd { margin: 0; }

/* ---------- panel principal ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 18px; }
.stat { display: flex; flex-direction: column; justify-content: space-between; gap: 22px; min-height: 164px; padding: 22px 24px; transition: transform .2s var(--ease), box-shadow .2s; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.stat .tile { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.stat .label { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.stat .value { font-size: 38px; font-weight: 600; letter-spacing: -.04em; line-height: 1; margin-top: 8px; }
.stat .delta { font-size: 13px; color: var(--ink-3); margin-top: 8px; font-weight: 500; }
.stat .delta.up { color: var(--success); }
.stat.accent { background: linear-gradient(135deg, var(--accent-2) 0%, var(--accent) 100%); color: #fff; box-shadow: 0 18px 40px -16px rgba(240,84,30,.55); }
.stat.accent .tile { background: rgba(255,255,255,.22); color: #fff; } .stat.accent .label, .stat.accent .delta, .stat.accent .delta.up { color: rgba(255,255,255,.88); }
.stat.dark { background: var(--black); color: #fff; }
.stat.dark .tile { background: rgba(255,255,255,.12); color: #fff; } .stat.dark .label, .stat.dark .delta { color: rgba(255,255,255,.7); }
.grid-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; margin-bottom: 18px; }
.stack { display: flex; gap: 3px; height: 16px; border-radius: 999px; overflow: hidden; margin: 6px 0 20px; }
.stack .seg-bar { background: var(--c); min-width: 3px; transition: flex .5s var(--ease); border-radius: 2px; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 28px; }
.legend-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; cursor: pointer; }
.legend-item:hover .name { color: var(--accent-ink); }
.legend-item .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.legend-item .name { flex: 1; font-weight: 500; } .legend-item .n { font-weight: 700; } .legend-item .pct { color: var(--ink-3); width: 38px; text-align: right; font-size: 13px; }
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); cursor: pointer; }
.list-item:first-child { border-top: 0; padding-top: 4px; } .list-item:last-child { padding-bottom: 0; }
.list-item:hover .title { color: var(--accent-ink); }
.list-item .title { font-weight: 600; font-size: 14.5px; } .list-item .sub { font-size: 13px; color: var(--ink-3); margin-top: 1px; }

/* ---------- tabla ---------- */
.table-wrap { overflow-x: auto; overflow-y: hidden; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; padding: 16px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { padding-left: 24px; } th:last-child, td:last-child { padding-right: 24px; }
td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14.5px; }
td.email { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; transition: background .15s; } tbody tr:hover { background: var(--surface-2); }
tbody tr.attention td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
.cell-name { display: flex; align-items: center; gap: 12px; } .cell-name > div { min-width: 0; }
.cell-name .n, .cell-name .p { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-name .n { font-weight: 600; } .cell-name .p { font-size: 12.5px; color: var(--ink-3); }

/* ---------- tablero ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: 292px; gap: 16px; overflow-x: auto; padding: 4px 4px 16px; align-items: start; scroll-snap-type: x proximity; }
.kcol { background: var(--surface); border-radius: var(--r-lg); padding: 12px; min-height: 180px; scroll-snap-align: start; box-shadow: var(--shadow-card); transition: box-shadow .18s, background .18s; }
.kcol.over { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent), var(--shadow-hover); }
.kcol-head { display: flex; align-items: center; gap: 9px; padding: 8px 10px 14px; font-weight: 600; font-size: 14px; }
.kcol-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.kcol-head .count { margin-left: auto; font-weight: 600; color: var(--ink-2); font-size: 12px; background: var(--surface-2); min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; display: inline-grid; place-items: center; }
.kcards { display: grid; gap: 8px; min-height: 48px; }
.kcard { background: var(--surface-2); border-radius: var(--r-md); padding: 14px 14px 12px; cursor: grab; border: 1px solid transparent; transition: box-shadow .18s, transform .18s var(--ease), background .18s, border-color .18s; }
.kcard:hover { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.kcard.dragging { opacity: .4; }
.kcard .n { font-weight: 600; font-size: 14.5px; } .kcard .p { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.kcard .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 8px; }
.kcard .contact { display: flex; gap: 6px; color: var(--ink-4); } .kcard .contact svg { width: 14px; height: 14px; }
.kempty { font-size: 13px; color: var(--ink-3); text-align: center; padding: 22px 8px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); }

/* ---------- ficha lateral ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(20,20,19,.32); z-index: 40; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 12px; right: 12px; bottom: 12px; width: 600px; max-width: calc(100vw - 24px); background: var(--surface); z-index: 41; display: flex; flex-direction: column; border-radius: var(--r-xl); box-shadow: var(--shadow-float); animation: slide .26s var(--ease); overflow: hidden; }
@keyframes slide { from { transform: translateX(32px); opacity: 0; } }
.drawer-head { padding: 26px 28px 20px; border-bottom: 1px solid var(--line); }
.drawer-head .who { display: flex; align-items: flex-start; gap: 16px; }
.drawer-head h2 { font-size: 24px; letter-spacing: -.02em; line-height: 1.15; }
.drawer-head .meta { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.drawer-body { overflow-y: auto; flex: 1; padding: 0 28px 36px; }
.drawer-section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.drawer-section:last-child { border-bottom: 0; }
.drawer-section h3 { margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.drawer-section h3 .count { font-weight: 500; color: var(--ink-3); text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.drawer-actions { display: flex; gap: 8px; padding: 20px 0 6px; flex-wrap: wrap; }
.drawer-actions .btn { flex: 1; }
.stepper { display: flex; gap: 4px; margin-top: 20px; }
.step-btn { flex: 1; height: 38px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--ink-3); font-size: 11.5px; font-weight: 700; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .18s, color .18s; }
.step-btn:hover { background: var(--surface-3); color: var(--ink); }
.step-btn.done { background: var(--black); color: #fff; }
.step-btn.current { background: var(--accent); color: #fff; }
.step-btn.current:hover { background: var(--accent-ink); }
.discard-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--ink-3); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.task-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.task-row:first-child { border-top: 0; padding-top: 0; }
.task-row .t { font-weight: 600; font-size: 14.5px; } .task-row.done .t { text-decoration: line-through; color: var(--ink-3); font-weight: 500; }
.task-row .sub { font-size: 13px; color: var(--ink-3); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.task-row .del { opacity: 0; transition: opacity .15s; } .task-row:hover .del, .task-row .del:focus-visible { opacity: 1; }
.note { padding: 14px 16px; background: var(--surface-2); border-radius: var(--r-md); margin-top: 10px; }
.note .who { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; font-weight: 500; }
.note .body { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.timeline { display: grid; }
.tl-item { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 9px 0; position: relative; }
.tl-item::before { content: ''; position: absolute; left: 13px; top: 36px; bottom: -9px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-item .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.tl-item .dot svg { width: 13px; height: 13px; }
.tl-item .dot.note { background: var(--warn-soft); color: var(--warn); } .tl-item .dot.status { background: var(--info-soft); color: var(--info); }
.tl-item .dot.task_done { background: var(--success-soft); color: var(--success); } .tl-item .dot.created { background: var(--accent-soft); color: var(--accent); }
.tl-item .body { font-size: 14px; word-break: break-word; padding-top: 4px; } .tl-item .who { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.inline-form { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; margin-top: 14px; align-items: center; }
.inline-form .title { grid-column: 1 / -1; }
.inline-form .input, .inline-form .select { height: 42px; font-size: 14px; }
.inline-form .date { width: 150px; } .inline-form .select { width: 100%; }

/* ---------- seguimientos ---------- */
.task-group { margin-bottom: 22px; }
.task-group h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding-left: 4px; }
.task-group h3 .count { font-weight: 500; color: var(--ink-3); text-transform: none; letter-spacing: 0; }
.task-group.overdue h3 { color: var(--danger); } .task-group.today h3 { color: var(--accent-ink); }
.task-line { display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 16px; padding: 14px 22px; border-top: 1px solid var(--line); }
.task-line:first-child { border-top: 0; }
.task-line .t { font-weight: 600; font-size: 14.5px; } .task-line .lead { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.task-line .lead a:hover { color: var(--accent-ink); text-decoration: underline; }
.task-line.done .t { text-decoration: line-through; color: var(--ink-3); font-weight: 500; }
.task-line .del { opacity: 0; transition: opacity .15s; } .task-line:hover .del, .task-line .del:focus-visible { opacity: 1; }

/* ---------- importación ---------- */
.steps { display: flex; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-3); padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-card); }
.step .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 12px; font-weight: 700; }
.step.active { background: var(--black); color: #fff; } .step.active .num { background: var(--accent); color: #fff; }
.step.done { color: var(--ink); } .step.done .num { background: var(--success); color: #fff; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--r-lg); padding: 56px 24px; text-align: center; cursor: pointer; transition: border-color .18s, background .18s; background: var(--surface); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .ic-wrap { width: 60px; height: 60px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin: 0 auto 16px; }
.dropzone .ic-wrap svg { width: 26px; height: 26px; }
.map-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.preview table th, .preview table td { padding: 10px 14px; font-size: 13.5px; }
.preview tbody tr { cursor: default; } .preview tbody tr:hover { background: transparent; }
.preview { border: 1px solid var(--line); border-radius: var(--r-md); }
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.summary .s { padding: 16px 18px; border-radius: var(--r-md); background: var(--surface-2); }
.summary .s .v { font-size: 26px; font-weight: 600; letter-spacing: -.03em; } .summary .s .l { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.summary .s.ok .v { color: var(--success); } .summary .s.warn .v { color: var(--warn); } .summary .s.dim .v { color: var(--ink-3); }
.dup-row td { vertical-align: top; } .dup-row .vs { font-size: 13px; color: var(--ink-2); }
.dup-row tbody tr { cursor: default; } .dup-row tbody tr:hover { background: transparent; }
.dup-row { border: 1px solid var(--line); border-radius: var(--r-md); }

/* ---------- ajustes ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; align-items: start; }
.settings-grid .card.full { grid-column: 1 / -1; }
.team-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.team-row:first-child { border-top: 0; padding-top: 0; }
.team-row .n { font-weight: 600; } .team-row .e { font-size: 13px; color: var(--ink-3); }
.role { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.role.admin { background: var(--accent-soft); color: var(--accent-ink); }
.status-line { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; font-size: 14px; }
.status-line svg { margin-top: 2px; } .status-line .ok { color: var(--success); } .status-line .no { color: var(--ink-4); }
ol.guide { padding-left: 20px; margin: 10px 0 0; display: grid; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
details summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }

/* ---------- modal, avisos ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,20,19,.4); z-index: 60; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { width: 100%; max-width: 540px; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-float); animation: pop .2s var(--ease); max-height: calc(100vh - 40px); overflow-y: auto; }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px 0; }
.modal-head h2 { font-size: 22px; letter-spacing: -.02em; }
.modal-body { padding: 20px 28px 28px; display: grid; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }
#toasts { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: var(--black); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-float); display: flex; align-items: center; gap: 10px; animation: toast-in .25s var(--ease); white-space: nowrap; max-width: 90vw; }
.toast.error { background: var(--danger); } .toast.ok svg { color: #7FDFA3; }
@keyframes toast-in { from { transform: translateY(14px); opacity: 0; } }

/* ---------- tiempo real y Google Sheets ---------- */
.live-row { margin-top: 12px; min-height: 30px; }
.live-row:empty { display: none; }
.live-pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow-card); }
.live-pill svg.ic { width: 14px; height: 14px; }
.live-pill.ok { color: var(--success); }
.live-pill.err { color: var(--danger); background: var(--danger-soft); box-shadow: none; }
.live-pill.off:hover, .live-pill.err:hover { color: var(--accent-ink); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(30,138,76,.5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(30,138,76,0); } 100% { box-shadow: 0 0 0 0 rgba(30,138,76,0); } }
@keyframes fresh { from { background: var(--accent-soft); } to { background: transparent; } }
tbody tr.fresh, .list-item.fresh { animation: fresh 4s ease-out 2; }
.kcard.fresh { box-shadow: 0 0 0 2px var(--accent), var(--shadow-hover); background: var(--surface); }
.tl-item .dot.reentry { background: var(--accent-soft); color: var(--accent-ink); }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.answer { background: var(--surface-2); border-radius: var(--r-sm); padding: 12px 14px; }
.answer dt { font-size: 12px; color: var(--ink-3); font-weight: 500; line-height: 1.4; }
.answer dd { margin: 4px 0 0; font-weight: 600; font-size: 14.5px; }
.sheets-form { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.sheets-form .full { grid-column: 1 / -1; }
.private-guide { margin-top: 14px; }
.private-guide summary { padding: 6px 0; }
.code-box { position: relative; margin-top: 14px; }
.code-box .btn { position: absolute; top: 10px; right: 10px; background: #fff; }
.code-box pre { margin: 0; max-height: 300px; overflow: auto; background: var(--black); color: #E9E9E5; border-radius: var(--r-md); padding: 16px 18px; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; }
.settings-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }

/* ---------- casa u oficina ---------- */
.kind { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: -2px; }
.kind svg.ic { width: 13px; height: 13px; }
.kind-casa { color: #7A5A1E; } .kind-oficina { color: #3D5A80; }
.kind-switch { flex-wrap: wrap; }
.kind-switch button svg.ic { width: 15px; height: 15px; }
.kind-switch .n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.kind-switch button.active .n { background: rgba(255,255,255,.2); color: #fff; }
.kind-pick { display: flex; width: 100%; box-shadow: none; background: var(--surface-2); }
.kind-pick button { flex: 1; justify-content: center; height: 38px; }
.task-line .lead .kind { margin-right: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1400px) {
  th.opt2, td.opt2 { display: none; }
  .search { width: 220px; }
}
@media (max-width: 1180px) {
  .pillnav a span { display: none; } .pillnav a { padding: 10px 14px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .map-grid { grid-template-columns: repeat(2, 1fr); }
  .legend { grid-template-columns: 1fr; }
  .settings-trio { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .app { padding: 0 16px 100px; }
  .topbar { height: 68px; gap: 10px; }
  .brand-name { display: none; } .brand-mark { width: 36px; height: 36px; }
  .pillnav, .rail { display: none; }
  .search { flex: 1; width: auto; } .search input { height: 42px; }
  .topbar-right { flex: 1; } .topbar-right .btn-accent span { display: none; } .topbar-right .btn-accent { width: 42px; height: 42px; padding: 0; }
  .demo-pill { display: none; }
  .layout { grid-template-columns: 1fr; gap: 0; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottomnav a { display: grid; justify-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--ink-3); padding: 4px 10px; border-radius: 12px; min-width: 58px; position: relative; }
  .bottomnav a.active { color: var(--ink); } .bottomnav a.active svg { color: var(--accent); }
  .bottomnav .count { position: absolute; top: -2px; right: 6px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; display: inline-grid; place-items: center; }
  h1 { font-size: 28px; }
  .page-head { margin: 10px 0 18px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; } .stat { padding: 18px; min-height: 140px; gap: 14px; } .stat .value { font-size: 30px; }
  .summary { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .drawer { top: 0; right: 0; bottom: 0; width: 100vw; max-width: 100vw; border-radius: 0; }
  .drawer-head, .drawer-body { padding-left: 20px; padding-right: 20px; }
  .quick { grid-template-columns: 1fr; }
  .stepper { flex-wrap: wrap; } .step-btn { flex: 1 1 30%; }
  .inline-form { grid-template-columns: 1fr 1fr; } .inline-form .title, .inline-form button { grid-column: 1 / -1; } .inline-form .date { width: 100%; }
  .task-line { grid-template-columns: auto 1fr auto; padding: 14px 16px; } .task-line .av, .task-line .del { display: none; }
  th.opt, td.opt { display: none; }
  th:first-child, td:first-child { padding-left: 16px; } th:last-child, td:last-child { padding-right: 16px; }
  .map-grid { grid-template-columns: 1fr; }
  .answers, .sheets-form, .settings-trio { grid-template-columns: 1fr; }
  .card-head { padding: 18px 18px 0; } .card-body { padding: 14px 18px 18px; }
  .demo-banner { border-radius: var(--r-md); }
}
@media (max-width: 760px) {
  .kind-switch { display: grid; grid-template-columns: auto 1fr 1fr; width: 100%; border-radius: 18px; }
  .kind-switch button { justify-content: center; padding: 0 10px; white-space: nowrap; font-size: 12.5px; }
  .kind-switch button:nth-child(4) { grid-column: 1 / -1; }
  .kind-switch button svg.ic, .kind-switch .n { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
