/* Blink CRM · estilos. Tokens en :root; --accent lo puede cambiar la marca de cada cuenta. */
:root {
  --bg: #000000;
  --surface: #0B0B0B;
  --surface-2: #121212;
  --surface-3: #1A1A1A;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);
  --text: #FFFFFF;
  --muted: rgba(255,255,255,0.55);
  --faint: rgba(255,255,255,0.32);
  --accent: #D6FC16;
  --accent-ink: #0B0B0B;          /* texto sobre el acento */
  --danger: #FF5A5F;
  --warn: #FFB547;
  --radius: 12px;
  --radius-sm: 8px;
  --display: 'Bebas Neue', Impact, sans-serif;
  --body: 'Poppins', system-ui, -apple-system, sans-serif;
  --sidebar: 232px;
  --shadow: 0 20px 60px rgba(0,0,0,0.6);

  /* Colores de etapa (apagados, legibles sobre negro) */
  --c-gray: #8A8A8A; --c-yellow: #E8D44D; --c-orange: #F29A4A; --c-red: #F2665F; --c-pink: #EE77B5;
  --c-purple: #A98BF5; --c-blue: #5FA8F5; --c-teal: #4CC9B8; --c-green: #D6FC16;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 700px at 70% -10%, rgba(214,252,22,0.035), transparent 60%),
    radial-gradient(900px 600px at 0% 100%, #0d0d0d, transparent 70%),
    var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
/* textura de puntos sutil */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.04;
  background-image: radial-gradient(#fff 1px, transparent 1px); background-size: 22px 22px;
}
#app { position: relative; z-index: 1; height: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ── Arranque ─────────────────────────────────────────── */
.boot { height: 100%; display: grid; place-items: center; }
.boot-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; box-shadow: 0 0 24px var(--accent); }
@keyframes pulse { 50% { transform: scale(0.6); opacity: 0.5; } }

/* ── Layout ───────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; height: 100%; }
.sidebar {
  border-right: 1px solid var(--border); background: rgba(11,11,11,0.85); backdrop-filter: blur(12px);
  display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; text-decoration: none; }
.brand img { height: 28px; max-width: 150px; object-fit: contain; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: #000; border: 1px solid var(--border-strong); display: grid; place-items: center; }
.brand-mark::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.brand-name { font-family: var(--display); font-size: 24px; letter-spacing: 0.06em; line-height: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none; font-weight: 500; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-3); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item .count { margin-left: auto; font-size: 12px; background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 0 7px; font-weight: 600; }
.nav-sub { padding-left: 28px; font-size: 13px; padding-top: 6px; padding-bottom: 6px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--faint); padding: 16px 12px 6px; }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; padding-left: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 600; font-size: 12px; flex: none; border: 1px solid var(--border-strong); }
.sidebar-foot .who { min-width: 0; flex: 1; }
.sidebar-foot .who b { display: block; font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { font-size: 11px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 28px 14px; flex-wrap: wrap; }
.page-title { font-family: var(--display); font-size: 40px; letter-spacing: 0.04em; line-height: 1; margin: 0; }
.page-sub { color: var(--muted); font-size: 13px; }
.topbar .spacer { flex: 1; }
.content { flex: 1; overflow: auto; padding: 0 28px 28px; }
.mobile-bar { display: none; }

/* ── Controles ────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border-strong);
  background: var(--surface-2); padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 500;
  white-space: nowrap; text-decoration: none; transition: transform .12s cubic-bezier(.16,1,.3,1), background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-3); border-color: rgba(255,255,255,0.24); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); border-color: var(--accent); box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-icon { padding: 7px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.input, select.input, textarea.input {
  width: 100%; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea.input { resize: vertical; min-height: 84px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.input-sm { padding: 5px 10px; font-size: 13px; }
.search { position: relative; min-width: 220px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--muted); }
.search .input { padding-left: 34px; }
label.field { display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
label.field > span { text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.hidden { display: none !important; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500;
  background: var(--surface-3); border: 1px solid var(--border); white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-btn { cursor: pointer; }
.chip-btn:hover { border-color: var(--border-strong); }
.chip-btn.on { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent); }
.temp-templado { color: #F2C14E; }
.temp-caliente { color: #FF7A45; }
.temp-casi_cierre { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.overdue { color: var(--danger) !important; }

/* Colores por nombre */
[data-color="gray"] { --c: var(--c-gray); } [data-color="yellow"] { --c: var(--c-yellow); } [data-color="orange"] { --c: var(--c-orange); }
[data-color="red"] { --c: var(--c-red); } [data-color="pink"] { --c: var(--c-pink); } [data-color="purple"] { --c: var(--c-purple); }
[data-color="blue"] { --c: var(--c-blue); } [data-color="teal"] { --c: var(--c-teal); } [data-color="green"] { --c: var(--c-green); }
.stage-chip { color: var(--c, var(--muted)); }
.stage-chip .label { color: var(--text); }

/* ── Tablero (pipeline) ───────────────────────────────── */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 0 28px 14px; }
.board { display: flex; gap: 14px; height: 100%; padding-bottom: 8px; align-items: flex-start; }
.col {
  flex: 0 0 290px; background: rgba(18,18,18,0.7); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; max-height: 100%; transition: border-color .15s, background .15s;
}
.col.drop { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.col-head { padding: 12px 14px 10px; border-bottom: 1px solid var(--border); }
.col-head .t { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.col-head .t .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.col-head .t .n { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 13px; }
.col-head .sum { font-size: 12px; color: var(--muted); margin-top: 2px; }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; cursor: pointer;
  transition: border-color .15s, transform .15s cubic-bezier(.16,1,.3,1), box-shadow .15s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.card.dragging { opacity: .4; }
.card .name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.card .name .q { color: var(--accent); width: 14px; height: 14px; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.card .last { font-size: 12px; color: var(--muted); margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .val { font-family: var(--display); font-size: 18px; letter-spacing: .04em; margin-left: auto; }
.card .fu { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.card .fu svg { width: 13px; height: 13px; }
.drop-marker { height: 3px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.col-more { font-size: 12px; color: var(--muted); text-align: center; padding: 4px; cursor: pointer; }

/* ── Tabla ─────────────────────────────────────────────── */
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; background: rgba(11,11,11,0.8); max-height: 100%; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.grid th, .grid td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.grid th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; font-weight: 500; color: var(--muted); font-size: 12px; cursor: pointer; user-select: none; }
.grid th:hover { color: var(--text); }
.grid th.sorted { color: var(--accent); }
.grid tbody tr { cursor: pointer; transition: background .1s; }
.grid tbody tr:hover { background: var(--surface-2); }
.grid td.name { font-weight: 600; position: sticky; left: 0; background: inherit; }
.grid tbody tr td.name { background: var(--surface); }
.grid tbody tr:hover td.name { background: var(--surface-2); }
.grid td select.cell-select { background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 2px 4px; cursor: pointer; max-width: 170px; }
.grid td select.cell-select:hover { border-color: var(--border-strong); }
.grid td svg { width: 16px; height: 16px; vertical-align: middle; }
.grid td.num { font-variant-numeric: tabular-nums; text-align: right; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; font-family: var(--display); font-size: 28px; letter-spacing: .05em; color: var(--text); font-weight: 400; margin-bottom: 4px; }

/* ── Hoy ───────────────────────────────────────────────── */
.today-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.panel { background: rgba(11,11,11,0.85); border: 1px solid var(--border); border-radius: var(--radius); }
.panel-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.panel-head h3 { margin: 0; font-family: var(--display); font-size: 22px; letter-spacing: .05em; font-weight: 400; }
.panel-head .n { margin-left: auto; color: var(--muted); }
.panel-body { padding: 6px; }
.task { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-sm); cursor: pointer; }
.task:hover { background: var(--surface-2); }
.task .ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); flex: none; }
.task .ico svg { width: 16px; height: 16px; }
.task .txt { flex: 1; min-width: 0; }
.task .txt b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task .txt span { font-size: 12px; color: var(--muted); }
.task .acts { display: flex; gap: 4px; }

/* ── Panel de métricas ─────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: rgba(11,11,11,0.85); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .l { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.kpi .v { font-family: var(--display); font-size: 44px; letter-spacing: .03em; line-height: 1.05; margin-top: 4px; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi.key { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.kpi.key .v { color: var(--accent); text-shadow: 0 0 24px color-mix(in srgb, var(--accent) 40%, transparent); }
.charts { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.bars { display: grid; gap: 8px; padding: 14px 16px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 60px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .track { height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar-row .fill { height: 100%; background: var(--c, var(--muted)); border-radius: 99px; transition: width .8s cubic-bezier(.16,1,.3,1); }
.bar-row .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.spark { padding: 16px; }
.spark svg { width: 100%; height: 180px; display: block; }

/* ── Ficha (drawer) ───────────────────────────────────── */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; animation: fade .2s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--surface); z-index: 41;
  border-left: 1px solid var(--border-strong); box-shadow: var(--shadow); display: flex; flex-direction: column;
  animation: slide .32s cubic-bezier(.16,1,.3,1);
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.drawer-head .top { display: flex; align-items: flex-start; gap: 10px; }
.drawer-head .name-input { font-family: var(--display); font-size: 34px; letter-spacing: .04em; background: transparent; border: 0; outline: 0; padding: 0; flex: 1; min-width: 0; line-height: 1.1; }
.drawer-head .name-input:focus { color: var(--accent); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 40px; display: grid; gap: 18px; align-content: start; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.deal-bar { display: grid; grid-template-columns: 1.4fr 1fr 0.8fr; gap: 8px; margin-top: 14px; }
.section-t { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.next-step { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.next-step.due { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.logger { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: grid; gap: 10px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 6px 12px; border-radius: 99px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 13px; border: 1px solid transparent; background: none; display: inline-flex; gap: 6px; align-items: center; }
.tab svg { width: 14px; height: 14px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); background: var(--surface-3); border-color: var(--border-strong); }
.timeline { position: relative; display: grid; gap: 2px; }
.timeline::before { content: ''; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 1px; background: var(--border-strong); }
.tl { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 8px 0; position: relative; }
.tl .ico { width: 31px; height: 31px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--border-strong); display: grid; place-items: center; z-index: 1; }
.tl .ico svg { width: 15px; height: 15px; }
.tl[data-type="stage"] .ico { color: var(--c-blue); }
.tl[data-type="form"] .ico { color: var(--accent); }
.tl[data-type="call"] .ico { color: var(--c-orange); }
.tl[data-type="whatsapp"] .ico { color: #25D366; }
.tl[data-type="email"] .ico { color: var(--c-purple); }
.tl[data-type="meeting"] .ico { color: var(--c-teal); }
.tl .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl .head b { font-weight: 600; font-size: 13px; }
.tl .head time { font-size: 12px; color: var(--muted); }
.tl .body { white-space: pre-wrap; color: rgba(255,255,255,.82); font-size: 13px; margin-top: 2px; word-break: break-word; }
.tl .tools { opacity: 0; transition: opacity .15s; margin-left: auto; display: flex; gap: 2px; }
.tl:hover .tools { opacity: 1; }
.props { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; align-items: center; }
.props .k { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.props .input { background: transparent; border-color: transparent; padding: 6px 8px; }
.props .input:hover { border-color: var(--border); }
.props .input:focus { background: var(--surface-2); border-color: var(--accent); }

/* ── Modal, toast, login ──────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 60; display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal { width: min(520px, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow); padding: 22px; animation: pop .3s cubic-bezier(.16,1,.3,1); max-height: 100%; overflow: auto; }
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0; } }
.modal h2 { font-family: var(--display); font-weight: 400; font-size: 32px; letter-spacing: .05em; margin: 0 0 14px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; }
.toast { background: var(--surface-3); border: 1px solid var(--border-strong); padding: 10px 16px; border-radius: 99px; box-shadow: var(--shadow); animation: pop .25s cubic-bezier(.16,1,.3,1); font-weight: 500; }
.toast.err { border-color: var(--danger); color: #ffd5d6; }
.toast.ok::before { content: '●'; color: var(--accent); margin-right: 8px; }

.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); }
.auth-card .brand { justify-content: center; padding-bottom: 8px; }
.auth-card h1 { font-family: var(--display); font-weight: 400; font-size: 56px; letter-spacing: .05em; text-align: center; margin: 8px 0 4px; line-height: 1; }
.auth-card h1 em { font-style: normal; color: var(--accent); text-shadow: 0 0 30px color-mix(in srgb, var(--accent) 45%, transparent); }
.auth-card p.lead { text-align: center; color: var(--muted); margin: 0 0 24px; }
.auth-card form { display: grid; gap: 12px; background: rgba(11,11,11,.9); border: 1px solid var(--border); border-radius: 16px; padding: 22px; }
.auth-card .err { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ── Ajustes ───────────────────────────────────────────── */
.settings { display: grid; gap: 16px; max-width: 920px; }
.settings .panel-body { padding: 16px; }
.stage-row, .field-row { display: grid; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.stage-row { grid-template-columns: 1fr 130px 140px auto; }
.field-row { grid-template-columns: 1fr 140px 1fr auto; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: #050505; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; overflow: auto; white-space: pre; color: #d9f99d; }
.keybox { font-family: ui-monospace, Menlo, monospace; background: #050505; border: 1px dashed var(--accent); padding: 10px 12px; border-radius: var(--radius-sm); word-break: break-all; }
.log { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--muted); max-height: 160px; overflow: auto; }

/* ── Móvil ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { position: fixed; inset: 0 30% 0 0; z-index: 50; transform: translateX(-102%); transition: transform .3s cubic-bezier(.16,1,.3,1); min-width: 240px; }
  .shell.menu-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: rgba(11,11,11,.9); }
  .topbar { padding: 14px 16px 10px; }
  .page-title { font-size: 32px; }
  .content { padding: 0 16px 20px; }
  .filters { padding: 0 16px 10px; }
  .search { min-width: 0; flex: 1; }
  .charts { grid-template-columns: 1fr; }
  .grid-2, .deal-bar, .next-step { grid-template-columns: 1fr; }
  .props { grid-template-columns: 1fr; }
  .props .k { margin-top: 6px; }
  .stage-row, .field-row { grid-template-columns: 1fr 1fr; }
  .bar-row { grid-template-columns: 90px 1fr 40px; }
  .col { flex-basis: 82vw; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── Email: editor de plantillas ──────────────────────── */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.preview-col { position: sticky; top: 0; }
.preview-col iframe { width: 100%; height: calc(100vh - 170px); min-height: 480px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.55; }
.help { line-height: 1.7; }
.title-input { font-family: var(--display); font-size: 36px; letter-spacing: .04em; background: transparent; border: 0; outline: 0; color: var(--text); width: 100%; padding: 0; line-height: 1.1; }
.title-input:focus { color: var(--accent); }

/* ── Automatizaciones ─────────────────────────────────── */
.auto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.auto-card { display: grid; gap: 8px; background: rgba(11,11,11,.85); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-decoration: none; transition: border-color .15s, transform .15s cubic-bezier(.16,1,.3,1); }
.auto-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.auto-card h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 26px; letter-spacing: .04em; }
.auto-card svg { width: 14px; height: 14px; vertical-align: -2px; }
.auto-stats { display: flex; gap: 20px; margin-top: 4px; }
.auto-stats div { display: grid; }
.auto-stats b { font-family: var(--display); font-size: 28px; font-weight: 400; letter-spacing: .03em; line-height: 1; }
.auto-stats span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.status-pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--border-strong); color: var(--muted); white-space: nowrap; }
.status-pill.s-active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 35%, transparent); }
.status-pill.s-paused { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.recipe { display: flex; gap: 14px; align-items: flex-start; text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; cursor: pointer; transition: border-color .15s; }
.recipe:hover { border-color: var(--accent); }
.recipe svg { width: 22px; height: 22px; flex: none; color: var(--accent); margin-top: 2px; }
.recipe b { display: block; }
.recipe small { color: var(--muted); font-size: 13px; }

.flow-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.flow { display: flex; flex-direction: column; align-items: center; padding: 8px 0 40px; }
.node { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.node-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.node-head b { font-weight: 600; }
.node-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); flex: none; }
.node-ico svg { width: 16px; height: 16px; }
.node-num { font-family: var(--display); font-size: 18px; color: var(--faint); width: 18px; text-align: center; }
.node-tools { margin-left: auto; display: flex; gap: 2px; opacity: .5; transition: opacity .15s; }
.node:hover .node-tools { opacity: 1; }
.node-body { padding: 12px 14px; display: grid; gap: 8px; }
.node-body a { color: var(--accent); }
.node-stats { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.node-stats span:nth-child(2) { color: var(--accent); }
.node-trigger { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.node-trigger .node-ico { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent); }
.node-email .node-ico { color: var(--c-purple); }
.node-wait .node-ico { color: var(--c-yellow); }
.node-condition .node-ico { color: var(--c-blue); }
.node-stage .node-ico { color: var(--c-teal); }
.node-followup .node-ico { color: var(--c-orange); }
.node-end { width: auto; padding: 10px 18px; border-radius: 99px; color: var(--muted); display: flex; gap: 8px; align-items: center; box-shadow: none; }
.node-end svg { width: 16px; height: 16px; }
.flow-line { position: relative; height: 46px; width: 2px; background: repeating-linear-gradient(to bottom, var(--border-strong) 0 5px, transparent 5px 9px); display: grid; place-items: center; }
.flow-add { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--bg); color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: all .15s cubic-bezier(.16,1,.3,1); padding: 0; }
.flow-add svg { width: 14px; height: 14px; }
.flow-add:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); transform: scale(1.15); box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 50%, transparent); }
.add-menu { position: absolute; top: 40px; left: 50%; transform: translateX(-50%); z-index: 20; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 12px; padding: 6px; box-shadow: var(--shadow); display: grid; min-width: 230px; animation: pop .2s cubic-bezier(.16,1,.3,1); }
.add-menu button { display: flex; gap: 10px; align-items: center; background: none; border: 0; padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.add-menu button:hover:not([disabled]) { background: var(--surface-3); }
.add-menu button[disabled] { opacity: .4; cursor: default; }
.add-menu svg { width: 16px; height: 16px; }
.flow-side { display: grid; gap: 16px; position: sticky; top: 0; }
.run-row { display: grid; text-align: left; background: none; border: 0; padding: 8px; border-radius: 8px; cursor: pointer; }
.run-row:hover { background: var(--surface-2); }

/* ── Ficha: email y automatizaciones ──────────────────── */
.mini-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.mini-row:last-child { border-bottom: 0; }
.tl[data-type="automation"] .ico { color: var(--accent); }
.tl[data-type="email_open"] .ico, .tl[data-type="email_click"] .ico { color: var(--c-purple); }
.tl[data-type="unsubscribe"] .ico { color: var(--danger); }
.mail-flags { display: inline-flex; gap: 6px; margin-left: 6px; }
.dns-row { display: grid; grid-template-columns: 90px 1fr; gap: 10px; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.ok-dot { color: var(--accent); } .bad-dot { color: var(--danger); } .warn-dot { color: var(--warn); }

@media (max-width: 1100px) { .flow-layout, .editor-grid { grid-template-columns: 1fr; } .flow-side, .preview-col { position: static; } }
.panel-head > svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.chip svg, .mini-row svg, .small svg { width: 14px; height: 14px; flex: none; }
.ses-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-top: 12px; background: var(--surface-2); }
.ses-box .log { margin-top: 8px; white-space: pre-wrap; color: var(--accent); }
.dom { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
table.dns { margin-top: 8px; font-size: 12px; }
table.dns td, table.dns th { white-space: normal; word-break: break-all; max-width: none; }
code.copy { cursor: pointer; background: #050505; border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; font-size: 11.5px; }
code.copy:hover { border-color: var(--accent); }
.paused-banner { background: color-mix(in srgb, var(--danger) 14%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 50%, transparent); border-radius: var(--radius); padding: 10px 14px; display: flex; gap: 10px; align-items: center; }
