/* Identidad DOOMO 360: gris #313131 dominante, rojo #EB1E01 de acento, tipografía Poppins */
:root {
  color-scheme: light;
  --brand: #313131;
  --brand-red: #EB1E01;
  --bg: #f4f4f4;
  --side: #313131;
  --side-text: #ffffff;
  --side-muted: #b9b9b9;
  --card: #ffffff;
  --soft: #f1f1f1;
  --border: #e3e3e3;
  --text: #313131;
  --text-2: #5c5c5c;
  --muted: #8f8f8f;
  --accent: #313131;
  --accent-hover: #1f1f1f;
  --accent-soft: #ececec;
  --on-accent: #ffffff;
  --red: #EB1E01;
  --red-hover: #c91a01;
  --red-soft: #fde9e5;
  --link: #c91a01;
  --grid: #ececec;
  --series-1: #EB1E01;
  --series-2: #2a78d6;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-other: #b4b4b4;
  --good: #16794a;   --good-bg: #e3f6ec;
  --bad: #c2343a;    --bad-bg: #fde8e8;
  --shadow: 0 10px 30px rgba(49, 49, 49, 0.10);
  --radius: 20px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1d1d1d;
  --side: #313131;
  --card: #262626;
  --soft: #2e2e2e;
  --border: #3a3a3a;
  --text: #f2f2f2;
  --text-2: #c9c9c9;
  --muted: #9a9a9a;
  --accent: #EB1E01;
  --accent-hover: #ff3a1f;
  --accent-soft: #3a2420;
  --on-accent: #ffffff;
  --red-soft: #3a2420;
  --link: #ff6a52;
  --grid: #333333;
  --series-1: #f2432a;
  --series-2: #3987e5;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-other: #5f5f5f;
  --good: #5fd39a;   --good-bg: #173527;
  --bad: #ff8c8c;    --bad-bg: #3b1d20;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1d1d1d; --side: #313131; --card: #262626; --soft: #2e2e2e; --border: #3a3a3a;
    --text: #f2f2f2; --text-2: #c9c9c9; --muted: #9a9a9a;
    --accent: #EB1E01; --accent-hover: #ff3a1f; --accent-soft: #3a2420; --on-accent: #ffffff;
    --red-soft: #3a2420; --link: #ff6a52;
    --grid: #333333;
    --series-1: #f2432a; --series-2: #3987e5; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181;
    --series-other: #5f5f5f;
    --good: #5fd39a; --good-bg: #173527; --bad: #ff8c8c; --bad-bg: #3b1d20;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { font-weight: 600; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--side);
  color: var(--side-text);
  padding: 26px 18px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: block; padding: 4px 10px 30px; color: #ffffff; }
.brand svg { width: 100%; max-width: 170px; height: auto; display: block; }
.brand small { display: block; color: var(--side-muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px;
  color: var(--side-text); text-decoration: none; font-weight: 500; border: 0; background: none; cursor: pointer; text-align: left; width: 100%;
}
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); }
.nav-item.active { background: var(--red); color: #ffffff; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 20px; padding: 1px 7px; }
.nav-item.active .nav-badge { background: #ffffff; color: var(--red); }
.sidebar .spacer { flex: 1; }
.theme-toggle {
  display: inline-flex; gap: 4px; padding: 4px; border-radius: 40px; border: 1px solid rgba(255, 255, 255, 0.18); background: transparent; margin-top: 14px; align-self: flex-start;
}
.theme-toggle button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: none; cursor: pointer; display: grid; place-items: center; color: var(--side-muted); }
.theme-toggle button.on { background: var(--red); color: #ffffff; }
.theme-toggle svg { width: 18px; height: 18px; }

.main { padding: 26px 32px 40px; min-width: 0; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.topbar h1 { font-size: 26px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--card);
  display: grid; place-items: center; cursor: pointer; position: relative; color: var(--text);
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { border-color: var(--red); color: var(--red); }
.icon-btn .dot {
  position: absolute; top: -3px; right: -3px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px;
}
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 5px 16px 5px 5px; border: 1px solid var(--border); border-radius: 40px; background: var(--card);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #ffffff;
  display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 84px; height: 84px; font-size: 28px; }
:root[data-theme="dark"] .avatar { background: #4a4a4a; }
.user-chip .who { line-height: 1.2; }
.user-chip .who b { font-weight: 600; display: block; }
.user-chip .who small { color: var(--muted); font-size: 12px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 40px;
  border: 1px solid var(--border); background: var(--card); cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--text);
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ai-btn { background: var(--red); border-color: var(--red); color: #ffffff; }
.btn.ai-btn:hover { background: var(--red-hover); }
.btn:hover { border-color: var(--red); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: progress; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 40px; padding: 3px; background: var(--card); }
.seg button { border: 0; background: none; padding: 8px 14px; border-radius: 40px; cursor: pointer; color: var(--text-2); font-weight: 500; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.input, .select, textarea.input {
  height: 40px; border: 1px solid var(--border); border-radius: 12px; padding: 0 12px; background: var(--card); outline: none; min-width: 0;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.select.pill { border-radius: 40px; height: 34px; font-size: 13px; padding: 0 10px; }
.pw-wrap { position: relative; display: grid; }
.pw-wrap .input { width: 100%; padding-right: 46px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: none;
  border-radius: 10px; cursor: pointer; color: var(--muted); display: grid; place-items: center;
}
.pw-toggle:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); }
.pw-toggle:disabled { opacity: .4; cursor: default; }
.pw-toggle svg { width: 18px; height: 18px; }
label.field { display: grid; gap: 6px; font-weight: 500; font-size: 13px; color: var(--text-2); }
label.field small { color: var(--muted); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 17px; font-weight: 600; }
.corner { width: 40px; height: 40px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi h4 { margin: 0; font-weight: 600; font-size: 16px; }
.kpi .value { font-size: 30px; font-weight: 700; margin: 22px 0 14px; letter-spacing: -0.02em; }
.kpi .value small { color: var(--muted); font-weight: 600; font-size: 18px; margin-left: 4px; }
.kpi .foot { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 8px; font-weight: 600; font-size: 12px; }
.delta.up { background: var(--good-bg); color: var(--good); }
.delta.down { background: var(--bad-bg); color: var(--bad); }
.delta.flat { background: var(--soft); color: var(--text-2); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }

/* ---------- Gráficos ---------- */
.legend { display: flex; gap: 16px; align-items: center; color: var(--text-2); font-size: 13px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.donut-box { container-type: inline-size; }
.donut-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 14px; align-items: center; }
@container (max-width: 380px) {
  .donut-wrap { grid-template-columns: 1fr; }
  .donut-wrap svg { width: 150px; justify-self: center; grid-row: 1; }
}
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 13px; }
.donut-legend li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; }
.donut-legend i { width: 10px; height: 10px; border-radius: 50%; }
.donut-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend b { font-weight: 600; color: var(--text-2); }
.tooltip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 9px 12px; font-size: 12.5px; min-width: 120px;
}
.tooltip b { display: block; margin-bottom: 4px; }
.tooltip .row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tooltip .row span { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.tooltip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.funnel { display: grid; gap: 13px; }
.funnel .row { display: grid; gap: 6px; }
.funnel .top { display: flex; justify-content: space-between; font-size: 13.5px; }
.funnel .top b { color: var(--accent); font-weight: 600; }
.bar-track { height: 22px; background: var(--accent-soft); border-radius: 12px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 12px; color: var(--on-accent); font-size: 11px; font-weight: 600; display: flex; align-items: center; padding-left: 10px; min-width: 30px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead th {
  background: var(--soft); color: var(--accent); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
  text-align: left; padding: 12px 14px; white-space: nowrap;
}
thead th:first-child { border-radius: 14px 0 0 14px; }
thead th:last-child { border-radius: 0 14px 14px 0; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--soft); }
.lead-name { font-weight: 600; }
.sub { color: var(--muted); font-size: 12px; }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.wa {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e3f6ec; color: #16794a; margin-left: 6px; vertical-align: middle;
}
:root[data-theme="dark"] .wa { background: #173527; color: #5fd39a; }
.wa svg { width: 15px; height: 15px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-nuevo { background: #e9e9e9; color: #313131; }
:root[data-theme="dark"] .st-nuevo { background: #3d3d3d; color: #f2f2f2; }
.st-contactado { background: #e4effc; color: #1f5fae; }
.st-calificado { background: #fdf2dc; color: #8a5a00; }
.st-seguimiento { background: #dff4f1; color: #136b60; }
.st-propuesta { background: #fbe7f0; color: #a3305f; }
.st-ganado { background: var(--good-bg); color: var(--good); }
.st-perdido { background: var(--soft); color: var(--muted); }
:root[data-theme="dark"] .st-contactado { background: #1c2c44; color: #8cb8f2; }
:root[data-theme="dark"] .st-calificado { background: #3a2d10; color: #f0c35c; }
:root[data-theme="dark"] .st-seguimiento { background: #173a36; color: #7fd6ca; }
:root[data-theme="dark"] .st-propuesta { background: #3a1c2a; color: #f19bbf; }

/* ---------- Pipeline ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.col { background: var(--soft); border-radius: var(--radius); padding: 12px; min-height: 300px; max-height: calc(100vh - 150px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.col.over { outline: 2px dashed var(--accent); outline-offset: -4px; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 2px; }
.col-head .count { color: var(--muted); font-weight: 600; font-size: 12px; }
.kcard { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px; cursor: grab; display: grid; gap: 4px; }
.kcard:hover { border-color: var(--accent); }
.kcard.dragging { opacity: .4; }

/* ---------- Drawer / modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 16, 40, .35); z-index: 40; display: flex; justify-content: flex-end; }
.overlay.center { justify-content: center; align-items: center; padding: 16px; }
.drawer { width: min(520px, 100%); height: 100%; background: var(--card); overflow-y: auto; padding: 24px; box-shadow: var(--shadow); }
.modal { width: min(560px, 100%); max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.modal h2, .drawer h2 { margin: 0 0 4px; font-size: 21px; }
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 16px 0; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-word; }
.section-title { font-weight: 600; margin: 22px 0 10px; font-size: 15px; }
.note { background: var(--soft); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; white-space: pre-wrap; }
.note .sub { margin-top: 4px; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 13px; }
.timeline li { display: flex; gap: 8px; }
.timeline li::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; background: var(--side); padding: 16px; }
.auth .card { width: min(420px, 100%); padding: 30px; box-shadow: var(--shadow); }
.auth h1 { margin: 14px 0 4px; font-size: 24px; }
.auth form { display: grid; gap: 14px; margin-top: 20px; }
.error { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 70; display: grid; gap: 8px; }
.toast { background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow); font-weight: 500; max-width: 340px; animation: pop .2s ease-out; }
.toast.err { background: var(--bad); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

.help { color: var(--text-2); line-height: 1.6; font-size: 13.5px; }
.help ol { padding-left: 20px; margin: 8px 0; }
.help code { background: var(--soft); padding: 2px 6px; border-radius: 6px; font-size: 12.5px; word-break: break-all; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.status-line i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }

.menu-btn { display: none; }

/* ---------- Seguimientos: prioridad por fecha y color ---------- */
:root {
  --u-overdue: #c01c28; --u-overdue-bg: #c01c28; --u-overdue-fg: #ffffff;
  --u-today: #d92d20;   --u-today-bg: #fee4e2;   --u-today-fg: #b42318;
  --u-soon: #dc6803;    --u-soon-bg: #fef0c7;    --u-soon-fg: #93370d;
  --u-ok: #079455;      --u-ok-bg: #dcfae6;      --u-ok-fg: #067647;
  --u-done: #98a2b3;    --u-done-bg: var(--soft); --u-done-fg: var(--muted);
}
:root[data-theme="dark"] {
  --u-overdue: #f04438; --u-overdue-bg: #d92d20; --u-overdue-fg: #ffffff;
  --u-today: #f97066;   --u-today-bg: #4a1714;   --u-today-fg: #fda29b;
  --u-soon: #fdb022;    --u-soon-bg: #45300a;    --u-soon-fg: #fec84b;
  --u-ok: #47cd89;      --u-ok-bg: #0f3a25;      --u-ok-fg: #75e0a7;
  --u-done: #667085;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --u-overdue: #f04438; --u-overdue-bg: #d92d20; --u-overdue-fg: #ffffff;
    --u-today: #f97066;   --u-today-bg: #4a1714;   --u-today-fg: #fda29b;
    --u-soon: #fdb022;    --u-soon-bg: #45300a;    --u-soon-fg: #fec84b;
    --u-ok: #47cd89;      --u-ok-bg: #0f3a25;      --u-ok-fg: #75e0a7;
    --u-done: #667085;
  }
}
.ubadge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.ubadge.u-overdue { background: var(--u-overdue-bg); color: var(--u-overdue-fg); }
.ubadge.u-today { background: var(--u-today-bg); color: var(--u-today-fg); }
.ubadge.u-soon { background: var(--u-soon-bg); color: var(--u-soon-fg); }
.ubadge.u-ok { background: var(--u-ok-bg); color: var(--u-ok-fg); }
.ubadge.u-done { background: var(--u-done-bg); color: var(--u-done-fg); }
.u-legend { display: flex; gap: 6px; flex-wrap: wrap; }
.task-list { display: grid; gap: 8px; }
.task-group { margin-bottom: 14px; }
.task {
  display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--border); border-left: 6px solid var(--u-ok); border-radius: 14px; padding: 10px 12px; background: var(--card);
}
.task.u-overdue { border-left-color: var(--u-overdue); background: color-mix(in srgb, var(--u-overdue) 6%, var(--card)); }
.task.u-today { border-left-color: var(--u-today); }
.task.u-soon { border-left-color: var(--u-soon); }
.task.u-done { border-left-color: var(--u-done); opacity: .75; }
.task-main { display: grid; gap: 3px; min-width: 0; flex: 1 1 260px; }
.task-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-note { color: var(--text-2); }
.task-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.task-actions .btn svg { width: 14px; height: 14px; }
.task-form { background: var(--soft); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.quick-dates { display: flex; gap: 6px; flex-wrap: wrap; }

.note-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.note-foot .btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }

/* ---------- Selector de espacio CRM | Tareas ---------- */
.space-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: -8px 0 14px;
  background: rgba(255, 255, 255, 0.08); border-radius: 14px;
}
.space-switch a {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 6px; border-radius: 10px;
  color: var(--side-muted); text-decoration: none; font-weight: 600; font-size: 13px;
}
.space-switch a svg { width: 16px; height: 16px; }
.space-switch a:hover { color: #ffffff; }
.space-switch a.on { background: #ffffff; color: var(--brand); }
.nav-group { display: flex; flex-direction: column; gap: 6px; }
.nav-group[hidden] { display: none; }

/* ---------- Gestor de tareas ---------- */
.kpi-dark { background: var(--brand); border-color: var(--brand); color: #ffffff; }
.kpi-dark h4 { color: #ffffff; }
.kpi-dark .foot { color: #c9c9c9; }
:root[data-theme="dark"] .kpi-dark { background: #000000; border-color: #3a3a3a; }
.kpi-spark { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.spark { width: 120px; height: 40px; color: #ffffff; flex: none; }
.kpi-soft { background: var(--soft); }
.kpi-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--card); border: 1px solid var(--border); }
.ico-vencidas { color: var(--u-today); }
.ico-en_progreso { color: #2a78d6; }
.kpi-alert .value { color: var(--u-today); }
.pill { border: 1px solid var(--border); background: var(--card); border-radius: 40px; padding: 7px 14px; cursor: pointer; font-weight: 500; font-size: 13px; color: var(--text-2); }
.pill:hover { border-color: var(--red); }
.pill.on { background: var(--brand); border-color: var(--brand); color: #ffffff; }
:root[data-theme="dark"] .pill.on { background: var(--red); border-color: var(--red); }
.people { display: grid; gap: 8px; }
.person { background: var(--soft); border-radius: 16px; }
.person-row {
  width: 100%; display: grid; grid-template-columns: 22px minmax(0, 1.4fr) 1fr 1fr 28px; align-items: center; gap: 10px;
  padding: 10px 14px; border: 0; background: none; cursor: pointer; text-align: left; border-radius: 16px;
}
.person-row:hover { background: rgba(49, 49, 49, 0.05); }
.person-row .chev { font-size: 18px; color: var(--muted); transition: transform .15s; display: inline-block; }
.person.open .chev { transform: rotate(90deg); }
.person-row .who-inline b { font-weight: 600; }
.pnum b { font-weight: 600; }
.pmore { text-align: center; font-weight: 700; color: var(--text-2); border-radius: 8px; }
.pmore:hover { background: var(--card); }
.person-tasks { padding: 0 12px 12px; display: grid; gap: 6px; }
.ttlist { display: grid; gap: 6px; }
.ttrow {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; flex-wrap: wrap;
}
.ttrow:hover { border-color: var(--red); }
.ttrow.done .tttitle { text-decoration: line-through; color: var(--muted); }
.ttcheck {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--border); background: var(--card); flex: none;
  display: grid; place-items: center; cursor: pointer; color: #ffffff; padding: 0;
}
.ttcheck:hover:not(:disabled) { border-color: var(--good); }
.ttrow.done .ttcheck { background: var(--good); border-color: var(--good); }
.ttcheck svg { width: 14px; height: 14px; }
.ttcheck:disabled { cursor: not-allowed; opacity: .5; }
.ttmain { flex: 1 1 220px; min-width: 0; }
.tttitle { font-weight: 600; }
.ttmeta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.prio, .ttst { display: inline-flex; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.prio-alta { background: var(--u-today-bg); color: var(--u-today-fg); }
.prio-media { background: var(--u-soon-bg); color: var(--u-soon-fg); }
.prio-baja { background: var(--soft); color: var(--text-2); }
.ttst-pendiente { background: #e9e9e9; color: #313131; }
.ttst-en_progreso { background: #e4effc; color: #1f5fae; }
.ttst-completada { background: var(--good-bg); color: var(--good); }
:root[data-theme="dark"] .ttst-pendiente { background: #3d3d3d; color: #f2f2f2; }
:root[data-theme="dark"] .ttst-en_progreso { background: #1c2c44; color: #8cb8f2; }
.board-3 { grid-template-columns: repeat(3, minmax(240px, 1fr)); }
.ttcard-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
@media (max-width: 820px) {
  .person-row { grid-template-columns: 18px minmax(0, 1fr) auto; }
  .person-row .pvenc, .person-row .pmore { display: none; }
}

/* ---------- Miembros del equipo y notificaciones ---------- */
.pop-wrap { position: relative; }
.popover {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 45; width: 320px; max-height: 70vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 8px;
}
.popover[hidden] { display: none; }
.pop-title { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; padding: 6px 8px 10px; }
.team-online {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px 0 14px; border-radius: 40px;
  border: 1px solid var(--border); background: var(--card); cursor: pointer; color: var(--text);
}
.team-online:hover { border-color: var(--red); }
.team-label { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.team-label small { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.team-label b { font-size: 13px; }
.stack { display: flex; align-items: center; }
.stack-av { position: relative; display: inline-flex; border-radius: 50%; box-shadow: 0 0 0 2px var(--card); }
.stack .stack-av + .stack-av { margin-left: -8px; }
.stack-av.on::after {
  content: ''; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%;
  background: #16a34a; box-shadow: 0 0 0 2px var(--card);
}
.stack-av .avatar.sm { width: 28px; height: 28px; }
.stack-more { margin-left: -8px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; background: var(--soft); box-shadow: 0 0 0 2px var(--card); }
.member { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; }
.member:hover { background: var(--soft); }
.online-txt { color: #16a34a; font-weight: 600; }
.notif { display: flex; gap: 10px; padding: 9px 8px; border-radius: 12px; color: var(--text); text-decoration: none; font-size: 13px; line-height: 1.4; }
.notif:hover { background: var(--soft); }
.notif.unread { background: var(--red-soft); }
.notif-ico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); flex: none; font-weight: 700; color: var(--red); }

/* ---------- Menciones y comentarios ---------- */
.mention { color: var(--red); font-weight: 600; background: var(--red-soft); border-radius: 6px; padding: 0 4px; }
.mention-wrap { position: relative; display: grid; }
.mention-list {
  position: absolute; left: 0; top: 100%; z-index: 50; min-width: 220px; margin-top: 4px; background: var(--card);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 4px;
}
.mention-list[hidden] { display: none; }
.mention-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; }
.mention-list button.on, .mention-list button:hover { background: var(--soft); }
.comments { display: grid; gap: 10px; max-height: 300px; overflow-y: auto; margin-bottom: 10px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment-body { background: var(--soft); border-radius: 4px 14px 14px 14px; padding: 8px 12px; flex: 1; line-height: 1.5; font-size: 13.5px; }
.comment.mine .comment-body { background: var(--red-soft); }
.comment-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 2px; }
.link-btn { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; }
.link-btn:hover { color: var(--bad); }
.comment-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.comment-form .input { resize: vertical; }

/* ---------- Mi actividad ---------- */
.act-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.act-main { display: grid; gap: 16px; min-width: 0; }
.profile-top { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.avatar.xl { width: 112px; height: 112px; font-size: 38px; border-radius: 24px; }
.profile-info { flex: 1; min-width: 200px; }
.profile-info h2 { margin: 0 0 4px; font-size: 22px; }
.profile-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; color: var(--text-2); font-size: 13px; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.pstat { font-size: 26px; font-weight: 600; margin: 4px 0 10px; }
.pbar { height: 4px; border-radius: 4px; }
.bar-pink { background: #f19ba3; }
.bar-teal { background: #6cc9bd; }
.bar-lime { background: #b7dd6a; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile { border-radius: 20px; padding: 16px; min-height: 150px; display: flex; flex-direction: column; justify-content: space-between; color: #313131; text-decoration: none; }
.tile:hover { filter: brightness(0.97); }
.tile-lime { background: #e3f5b8; }
.tile-teal { background: #b9e6df; }
.tile-pink { background: #f7c6cb; }
:root[data-theme="dark"] .tile { color: #f2f2f2; }
:root[data-theme="dark"] .tile-lime { background: #3c4a1f; }
:root[data-theme="dark"] .tile-teal { background: #1f4440; }
:root[data-theme="dark"] .tile-pink { background: #4a2629; }
.tile-head { display: flex; justify-content: space-between; gap: 8px; }
.tile-head b { font-weight: 600; line-height: 1.3; }
.tile-arrow { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.55); flex: none; }
:root[data-theme="dark"] .tile-arrow { background: rgba(0, 0, 0, 0.25); }
.tile-arrow svg { width: 15px; height: 15px; }
.tile-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.tile-foot small { display: block; font-size: 11.5px; opacity: .8; }
.tile-n { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.08); font-weight: 600; flex: none; }
.feed-card { position: sticky; top: 16px; max-height: calc(100vh - 140px); display: flex; flex-direction: column; }
.feed { overflow-y: auto; display: grid; gap: 10px; padding-right: 4px; }
.feed-item { display: grid; grid-template-columns: 52px 1fr; gap: 8px; }
.feed-date { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); padding-top: 8px; text-transform: capitalize; }
.feed-date b { color: var(--text-2); font-weight: 600; }
.feed-card-in {
  text-align: left; border: 1px solid var(--border); background: var(--card); border-radius: 14px; padding: 10px 12px;
  cursor: pointer; display: grid; gap: 6px; font-size: 13px; color: var(--text); min-width: 0;
}
.feed-card-in:hover { border-color: var(--red); }
.feed-text { line-height: 1.4; overflow-wrap: anywhere; }
.feed-tags { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ftag { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; border: 1px solid var(--border); }
.ftag-lead { background: var(--red-soft); color: var(--red); border-color: transparent; }
.ftag-tarea { background: #e4effc; color: #1f5fae; border-color: transparent; }
:root[data-theme="dark"] .ftag-tarea { background: #1c2c44; color: #8cb8f2; }
@media (max-width: 1150px) {
  .act-grid { grid-template-columns: 1fr; }
  .feed-card { position: static; max-height: none; }
}
@media (max-width: 820px) {
  .team-label { display: none; }
  .team-online { padding: 0 6px; }
  .tiles, .profile-stats { grid-template-columns: 1fr; }
  .popover { position: fixed; left: 12px; right: 12px; top: 70px; width: auto; }
}

/* ---------- Vista normal / Modo superadmin ---------- */
.btn.super-toggle { gap: 6px; }
.btn.super-toggle svg { width: 16px; height: 16px; }
.btn.super-toggle.on { background: var(--red); border-color: var(--red); color: #ffffff; animation: superPulse 2s ease-in-out infinite; }
@keyframes superPulse { 50% { box-shadow: 0 0 0 5px var(--red-soft); } }
@media (prefers-reduced-motion: reduce) { .btn.super-toggle.on { animation: none; } }
.super-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -6px 0 18px; padding: 10px 14px;
  border-radius: 14px; background: var(--red); color: #ffffff; font-size: 13.5px;
}
.super-strip[hidden] { display: none; }
.super-strip .btn { margin-left: auto; background: #ffffff; color: var(--red); border-color: #ffffff; }

/* ---------- Bloqueo de leads y permisos ---------- */
.lock-mini { display: inline-flex; vertical-align: middle; margin-left: 6px; color: var(--muted); }
.lead-name .lock-mini { margin: 0 6px 0 0; }
.lock-mini svg { width: 14px; height: 14px; }
.lock-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.lock-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.lock-chip > svg { width: 14px; height: 14px; color: var(--muted); }
.lock-banner {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 16px; padding: 12px 14px;
  border-radius: 14px; background: var(--soft); border: 1px solid var(--border); border-left: 5px solid var(--brand);
}
.lock-banner > svg { width: 22px; height: 22px; flex: none; }
.lock-banner > div { flex: 1 1 220px; }
:root[data-theme="dark"] .lock-banner { border-left-color: var(--red); }
.kcard.locked { cursor: pointer; background: var(--soft); }
.perm-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; }
.perm-row .who-inline { gap: 10px; }

/* ---------- Asistente IA ---------- */
.ai-drawer { display: flex; flex-direction: column; gap: 14px; }
.ai-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.ai-msg { padding: 10px 14px; border-radius: 16px; max-width: 92%; line-height: 1.55; font-size: 13.5px; }
.ai-msg.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); white-space: pre-wrap; }
.ai-msg.assistant { background: var(--soft); }
.ai-msg p { margin: 0 0 6px; }
.ai-msg ul { margin: 4px 0 8px; padding-left: 18px; }
.ai-msg .md-h { font-weight: 700; margin: 8px 0 4px; }
.ai-sug { white-space: normal; height: auto; padding: 8px 14px; text-align: left; }
.ai-ask { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.ai-ask .input { resize: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1150px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-btn { display: grid; }
  .main { padding: 16px; }
  .topbar h1 { font-size: 21px; }
  .user-chip .who { display: none; }
  .ai-btn span, .super-toggle span { display: none; }
  .super-toggle { padding: 0 12px; }
  .ai-btn { padding: 0 12px; }
  .user-chip { padding: 5px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .value { font-size: 23px; margin: 14px 0 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .hide-sm { display: none; }
}
@media (max-width: 460px) {
  .kpis { grid-template-columns: 1fr; }
  .top-actions .icon-btn.search { display: none; }
}

/* ---------- Marca: login y perfil ---------- */
.auth-logo { color: var(--brand); width: 190px; margin-bottom: 6px; }
:root[data-theme="dark"] .auth-logo { color: #ffffff; }
.auth-logo svg { width: 100%; height: auto; display: block; }
.profile-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-row .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.who-inline { display: inline-flex; align-items: center; gap: 6px; }

/* =====================================================================
   Tema "Cristal": fondo monocromático difuminado con parallax + vidrio esmerilado
   (se activa con data-glass sobre el tema oscuro, así reutiliza todas sus reglas)
   ===================================================================== */
:root[data-glass] {
  --bg: #121212;
  --side: rgba(22, 22, 22, 0.42);
  --card: rgba(255, 255, 255, 0.055);
  --soft: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.11);
  --text: #f4f4f4;
  --text-2: #cfcfcf;
  --muted: #a3a3a3;
  --grid: rgba(255, 255, 255, 0.08);
  --accent-soft: rgba(235, 30, 1, 0.16);
  --red-soft: rgba(235, 30, 1, 0.16);
  --glass-blur: blur(28px) saturate(140%);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
:root[data-glass] body { background: #121212; }

/* Fondo: formas grandes en grises de la marca, muy difuminadas */
#glassBg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: #141414; pointer-events: none; }
/* Manchas de color grandes y muy difuminadas (estilo "frosted"): grafitos, brasa cálida y humo gris verdoso */
#glassBg .blob { position: absolute; border-radius: 50%; filter: blur(110px); will-change: translate; animation: blobDrift 40s ease-in-out infinite alternate; }
#glassBg .b1 { width: 70vw; height: 70vw; left: -22vw; top: -30vw; background: #3d3d3a; opacity: .95; }
#glassBg .b2 { width: 48vw; height: 48vw; right: -14vw; top: -6vh; background: #4a4d44; opacity: .7; animation-duration: 48s; animation-delay: -12s; }
#glassBg .b3 { width: 46vw; height: 40vw; left: 34vw; bottom: -18vw; background: #8a3b1c; opacity: .55; animation-duration: 54s; animation-delay: -20s; }
#glassBg .b4 { width: 38vw; height: 38vw; left: -6vw; bottom: -8vh; background: #232a26; opacity: .9; animation-duration: 44s; }
#glassBg .b5 { width: 26vw; height: 22vw; right: 8vw; bottom: 6vh; background: #b0502a; opacity: .35; animation-duration: 60s; animation-delay: -30s; }
#glassBg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 100% at 50% 40%, transparent 40%, rgba(0, 0, 0, 0.45) 100%); }
#glassBg .grain {
  position: absolute; inset: -50%; opacity: .09; mix-blend-mode: overlay; z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes blobDrift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5vw, -4vh) scale(1.1); }
  100% { transform: translate(-4vw, 5vh) scale(.94); }
}
@media (prefers-reduced-motion: reduce) { #glassBg .blob { animation: none; } }

/* Superficies de vidrio esmerilado */
:root[data-glass] .sidebar,
:root[data-glass] .card,
:root[data-glass] .modal,
:root[data-glass] .drawer,
:root[data-glass] .popover,
:root[data-glass] .tooltip,
:root[data-glass] .user-chip,
:root[data-glass] .team-online,
:root[data-glass] .icon-btn,
:root[data-glass] .seg,
:root[data-glass] .auth .card,
:root[data-glass] .person,
:root[data-glass] .col,
:root[data-glass] .mention-list {
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-hi), var(--shadow);
}
:root[data-glass] .card, :root[data-glass] .person, :root[data-glass] .col { box-shadow: var(--glass-hi); }
:root[data-glass] .sidebar { border-right: 1px solid var(--border); }
:root[data-glass] .main { background: transparent; }
:root[data-glass] .auth { background: transparent; }
:root[data-glass] .modal, :root[data-glass] .drawer, :root[data-glass] .popover { background: rgba(28, 28, 28, 0.72); }
:root[data-glass] .overlay { background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
:root[data-glass] .input, :root[data-glass] .select { background: rgba(0, 0, 0, 0.22); }
:root[data-glass] .select option { background: #1e1e1e; color: #f4f4f4; }
:root[data-glass] thead th { background: rgba(255, 255, 255, 0.06); color: var(--text-2); }
:root[data-glass] .kcard, :root[data-glass] .ttrow, :root[data-glass] .feed-card-in, :root[data-glass] .task { background: rgba(255, 255, 255, 0.05); }
:root[data-glass] .kpi-dark { background: rgba(0, 0, 0, 0.45); border-color: rgba(255, 255, 255, 0.12); }
:root[data-glass] .tile-lime { background: rgba(183, 221, 106, 0.22); }
:root[data-glass] .tile-teal { background: rgba(108, 201, 189, 0.22); }
:root[data-glass] .tile-pink { background: rgba(241, 155, 163, 0.22); }
:root[data-glass] .toast { background: rgba(244, 244, 244, 0.92); color: #161616; backdrop-filter: blur(10px); }
/* Navegadores sin backdrop-filter: superficies sólidas oscuras para que se lea bien */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root[data-glass] { --card: #222222; --soft: #2a2a2a; --side: #1a1a1a; }
}
:root[data-glass] .seg button.on { background: rgba(255, 255, 255, 0.16); color: #ffffff; }
:root[data-glass] .pill.on { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.25); color: #ffffff; }

/* =====================================================================
   Pantalla de ingreso con onboarding (siempre sobre el fondo cristal)
   ===================================================================== */
.onboard {
  --card: rgba(255, 255, 255, 0.07); --soft: rgba(255, 255, 255, 0.08); --border: rgba(255, 255, 255, 0.14);
  --text: #f6f6f6; --text-2: #d6d6d6; --muted: #a9a9a9; --accent: #EB1E01; --accent-hover: #ff3a1f; --on-accent: #fff;
  color: var(--text); background: transparent; min-height: 100vh;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 440px); gap: clamp(24px, 5vw, 80px);
  align-items: center; padding: clamp(20px, 5vw, 72px); place-items: center stretch;
}
.ob { display: flex; flex-direction: column; gap: 28px; min-height: min(640px, 80vh); justify-content: space-between; max-width: 680px; }
.ob-logo { color: #fff; width: 170px; }
.ob-logo svg, .ob-login-logo svg { width: 100%; height: auto; display: block; }
.ob-stage { position: relative; min-height: 380px; }
.ob-slide { position: absolute; inset: 0; opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; pointer-events: none; }
.ob-slide.on { opacity: 1; transform: none; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .ob-slide { transition: none; } }
.ob-kicker { display: inline-block; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #ffb39f; background: rgba(235, 30, 1, 0.16); border: 1px solid rgba(235, 30, 1, 0.3); padding: 5px 12px; border-radius: 30px; }
.onboard .ob-title { font-size: clamp(36px, 5.2vw, 68px); line-height: 1.04; font-weight: 600; letter-spacing: -0.02em; margin: 18px 0 14px; color: #fff; text-shadow: 0 2px 30px rgba(0, 0, 0, 0.25); }
.ob-text { font-size: clamp(14px, 1.3vw, 17px); color: var(--text-2); max-width: 520px; line-height: 1.6; margin: 0 0 26px; }
.ob-visual { display: grid; gap: 10px; max-width: 420px; }
.ob-chip {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(20px) saturate(140%); -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 30px rgba(0, 0, 0, 0.25);
}
.ob-chip b { display: block; font-weight: 600; font-size: 14px; }
.ob-chip small { color: var(--muted); font-size: 12px; }
.ob-c2 { margin-left: 34px; opacity: .92; }
.ob-dot { width: 10px; height: 10px; border-radius: 50%; background: #8f8f8f; flex: none; }
.ob-dot.red { background: #EB1E01; box-shadow: 0 0 0 4px rgba(235, 30, 1, 0.25); }
.ob-tag { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; flex: none; }
.t-red { background: #c01c28; color: #fff; }
.t-amber { background: rgba(253, 176, 34, 0.2); color: #fec84b; }
.ob-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #3a3a3a; font-weight: 700; flex: none; position: relative; }
.ob-av.on::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 2px #2a2a2a; }
.ob-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ob-dots { display: flex; gap: 8px; }
.ob-dots button { width: 8px; height: 8px; border-radius: 8px; border: 0; padding: 0; background: rgba(255, 255, 255, 0.3); cursor: pointer; transition: width .3s, background .3s; }
.ob-dots button.on { width: 28px; background: #fff; }
.ob-arrows { display: flex; gap: 8px; }
.ob-arrows button {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06);
  color: #fff; font-size: 22px; line-height: 1; cursor: pointer; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.ob-arrows button:hover { background: rgba(255, 255, 255, 0.14); }
.ob-login {
  width: 100%; padding: clamp(24px, 3vw, 36px); border-radius: 28px;
  background: rgba(24, 24, 24, 0.55); border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(30px) saturate(150%); -webkit-backdrop-filter: blur(30px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 30px 80px rgba(0, 0, 0, 0.45);
}
.ob-login-logo { display: none; width: 150px; color: #fff; margin-bottom: 14px; }
.ob-login h2 { margin: 0 0 6px; font-size: 26px; color: #fff; }
.ob-login form { display: grid; gap: 14px; margin-top: 22px; }
.ob-login .field { color: var(--text-2); }
.ob-login .input { background: rgba(0, 0, 0, 0.28); border-color: rgba(255, 255, 255, 0.16); color: #fff; height: 46px; }
.ob-login .input::placeholder { color: #8d8d8d; }
.ob-login .input:focus { border-color: #EB1E01; box-shadow: 0 0 0 3px rgba(235, 30, 1, 0.22); }
.ob-login .pw-toggle { color: #bdbdbd; }
.ob-submit { justify-content: center; height: 48px; font-weight: 600; font-size: 15px; background: #EB1E01; border-color: #EB1E01; color: #fff; }
.ob-submit:hover { background: #ff3a1f; }
.ob-login .error { color: #ff9b9b; }
.ob-foot { margin: 22px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
@media (max-width: 900px) {
  .onboard { grid-template-columns: 1fr; align-content: start; }
  .ob { min-height: 0; gap: 18px; }
  .ob-logo { display: none; }
  .ob-login-logo { display: block; }
  .ob-stage { min-height: 300px; }
  .ob-login { order: -1; }
  .ob-visual { display: none; }
}

/* =====================================================================
   Dashboard v2 — dirección "editorial": menos cajas, menos píldoras,
   jerarquía por tipografía y separadores finos
   ===================================================================== */
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.dv2 { display: grid; gap: 14px; }
.dv2 .card { border-radius: 12px; box-shadow: none; padding: 0; }
.dv2-bar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-bottom: 4px; }
.dv2-bar .eyebrow { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 500; color: var(--text-2); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tabs button {
  border: 0; background: none; padding: 8px 12px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--red); }
.dv2-actions { margin-left: auto; display: flex; gap: 8px; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--text-2); padding: 0 12px; }
.btn.quiet:hover { background: var(--soft); border-color: transparent; color: var(--text); }
.btn.sq { border-radius: 10px; height: 38px; }
.btn.quiet svg, .btn.sq svg { width: 16px; height: 16px; }

/* Franja de métricas: una principal grande + tres secundarias en lista */
.dv2-metrics { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr); }
.m-main { display: flex; flex-direction: column; gap: 6px; padding: 22px 24px; border-right: 1px solid var(--border); text-decoration: none; color: var(--text); }
.m-big { font-size: 56px; font-weight: 500; letter-spacing: -0.035em; line-height: 1; margin: 6px 0 4px; }
.m-delta { font-size: 13px; color: var(--muted); }
.m-delta.up { color: var(--good); }
.m-delta.down { color: var(--bad); }
.m-delta span { color: var(--muted); }
.m-side { display: grid; }
.m-row {
  display: grid; grid-template-columns: minmax(120px, 1fr) auto minmax(150px, 1.2fr); align-items: baseline; gap: 16px;
  padding: 14px 24px; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border);
}
.m-row:last-child { border-bottom: 0; }
.m-row:hover, .m-main:hover { background: var(--soft); }
.m-label { font-size: 13.5px; color: var(--text-2); }
.m-val { font-size: 26px; font-weight: 500; letter-spacing: -0.02em; text-align: right; min-width: 56px; }
.m-note { font-size: 12.5px; color: var(--muted); }

/* Paneles */
.dv2-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 14px; }
.dv2 .dv2-panel { padding: 18px 20px 20px; }
.dv2-panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.dv2-panel h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.legend-txt { font-size: 12.5px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.legend-txt span { color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.sw.s1 { background: var(--series-1); }
.sw.s3 { background: var(--series-3); margin-left: 8px; }
.link-quiet { font-size: 12.5px; color: var(--text-2); text-decoration: none; }
.link-quiet:hover { color: var(--red); }
.empty-note { color: var(--muted); font-size: 13px; margin: 8px 0; }

/* Origen: barras horizontales de un solo color */
.src-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.src-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.src-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-top small { color: var(--muted); font-size: 12px; }
.src-bar { height: 6px; background: var(--soft); border-radius: 2px; overflow: hidden; }
.src-bar span { display: block; height: 100%; background: var(--series-1); border-radius: 2px; }
.src-list .other .src-bar span { background: var(--series-other); }
.src-list .other .src-name { color: var(--muted); }

/* Esperan respuesta: lista densa y accionable */
.wait-list { list-style: none; margin: 0 -20px; padding: 0; }
.wait-list li {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) 40px auto; align-items: center; gap: 12px;
  padding: 10px 20px; border-top: 1px solid var(--border); cursor: pointer;
}
.wait-list li:hover { background: var(--soft); }
.wait-age { font-size: 13px; font-weight: 600; color: var(--text-2); }
.wait-main { display: flex; flex-direction: column; min-width: 0; }
.wait-main b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wait-main span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-free { font-size: 11.5px; color: var(--muted); }
.wa-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--good); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.wa-link:hover { background: var(--good-bg); }
.wa-link svg { width: 15px; height: 15px; }

/* Embudo compacto */
.funnel2 { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.funnel2 li { display: grid; grid-template-columns: 92px minmax(0, 1fr) 36px 38px; align-items: center; gap: 10px; font-size: 13px; }
.f-label { color: var(--text-2); }
.f-track { height: 6px; background: var(--soft); border-radius: 2px; overflow: hidden; }
.f-track span { display: block; height: 100%; background: var(--text-2); border-radius: 2px; }
.fs-ganado .f-track span { background: var(--good); }
.fs-perdido .f-track span { background: var(--series-other); }
.f-n { text-align: right; font-weight: 600; }
.f-pct { text-align: right; color: var(--muted); font-size: 12px; }

@media (max-width: 1150px) { .dv2-grid { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .dv2-metrics { grid-template-columns: 1fr; }
  .m-main { border-right: 0; border-bottom: 1px solid var(--border); }
  .m-big { font-size: 44px; }
  .m-row { grid-template-columns: 1fr auto; padding: 12px 18px; }
  .m-note { grid-column: 1 / -1; margin-top: -8px; }
  .dv2-actions { margin-left: 0; width: 100%; }
  .wait-list li { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .wait-owner { display: none; }
  .wa-link span { display: none; }
}

/* ---------- Roles de usuario ---------- */
.icon-btn.gear { width: 36px; height: 36px; }
.icon-btn.gear svg { width: 17px; height: 17px; }
.owner-tag { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--red-soft); color: var(--red); margin-left: 4px; }
.um-head { display: flex; gap: 14px; align-items: center; }
.um-head h2 { margin: 0; }
.role-pick { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.role-pick legend { margin-bottom: 8px; }
.role-pick[disabled] { opacity: .65; }
.role-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.role-opt:hover { border-color: var(--text-2); }
.role-opt.on { border-color: var(--red); background: var(--red-soft); }
.role-opt input { margin-top: 3px; accent-color: var(--red); }
.role-opt b { display: block; font-weight: 600; }
.role-opt small { color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.perm-switch[hidden] { display: none; }
.um-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.um-row .eyebrow { margin-right: 6px; }
.um-actions { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid var(--border); }

/* ---------- Foto de fondo en la pantalla de ingreso ---------- */
#glassBg.with-photo .blob { display: none; }
.login-photo { position: absolute; inset: 0; overflow: hidden; }
.login-photo img { position: absolute; max-width: none; user-select: none; }
/* toda la foto con el desenfoque "frosted" */
.ph-blur { filter: blur(16px) saturate(115%) brightness(.72); }
/* el logo y el chaleco quedan nítidos, con borde suave */
.ph-sharp {
  position: absolute; inset: 0;
  -webkit-mask-image: radial-gradient(ellipse var(--rx, 30vw) var(--ry, 22vh) at var(--mx, 42vw) var(--my, 26vh), #000 45%, transparent 100%);
  mask-image: radial-gradient(ellipse var(--rx, 30vw) var(--ry, 22vh) at var(--mx, 42vw) var(--my, 26vh), #000 45%, transparent 100%);
}
.ph-sharp img { filter: saturate(105%) brightness(.92); }
/* sombras para que se lean el texto (abajo) y el formulario (derecha) */
.ph-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(0deg, rgba(10, 10, 10, 0.88) 0%, rgba(10, 10, 10, 0.35) 38%, transparent 60%),
    linear-gradient(90deg, transparent 50%, rgba(10, 10, 10, 0.55) 78%, rgba(10, 10, 10, 0.75) 100%);
}
#glassBg.with-photo .grain { opacity: .06; }
/* el onboarding baja para no tapar el logo del chaleco */
#glassBg.with-photo ~ #app .onboard .ob { align-self: end; min-height: 0; justify-content: flex-end; gap: 18px; padding-bottom: 8px; }
#glassBg.with-photo ~ #app .onboard .ob-logo { display: none; }
#glassBg.with-photo ~ #app .onboard .ob-visual { display: none; }
#glassBg.with-photo ~ #app .onboard .ob-stage { min-height: 250px; }
#glassBg.with-photo ~ #app .onboard .ob-title { font-size: clamp(32px, 3.8vw, 54px); }
#glassBg.with-photo ~ #app .onboard .ob-login-logo { display: block; }
@media (max-width: 900px) {
  .ph-shade { background: linear-gradient(0deg, rgba(10, 10, 10, 0.9) 0%, rgba(10, 10, 10, 0.5) 45%, rgba(10, 10, 10, 0.15) 70%, transparent 100%); }
  #glassBg.with-photo ~ #app .onboard { padding-top: 46vh; }
}
/* Frosted fuerte en toda la foto y desenfoque leve sólo sobre el logo, para que se lea */
.ph-blur { filter: blur(34px) saturate(120%) brightness(.66); }
.ph-sharp {
  display: block;
  -webkit-mask-image: radial-gradient(ellipse var(--rx) var(--ry) at var(--mx) var(--my), #000 30%, rgba(0, 0, 0, 0.6) 60%, transparent 100%);
  mask-image: radial-gradient(ellipse var(--rx) var(--ry) at var(--mx) var(--my), #000 30%, rgba(0, 0, 0, 0.6) 60%, transparent 100%);
}
.ph-sharp img { filter: blur(2.5px) saturate(108%) brightness(.86); }

/* ---------- Editor de etapas ---------- */
.stage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.stage-list li {
  display: grid; grid-template-columns: 18px 12px minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--card);
}
.stage-list li.dragging { opacity: .4; }
.stage-list .drag { cursor: grab; color: var(--muted); letter-spacing: -2px; user-select: none; }
.stage-list .stage-dot { width: 12px; height: 12px; padding: 0; border-radius: 50%; background: currentColor; }
.stage-list .stage-dot::before { display: none; }
.stage-list .input { height: 34px; }
.stage-list small { font-size: 11px; white-space: nowrap; }
.stage-move { display: flex; gap: 4px; }
.stage-move .btn.sm { height: 30px; padding: 0 9px; }
.stage-list li { grid-template-columns: 18px 12px minmax(0, 1fr) auto; row-gap: 2px; }
.stage-list li > small { grid-column: 3; grid-row: 2; padding-left: 2px; }
.stage-list li > small:empty { display: none; }
.stage-list .stage-move { grid-column: 4; grid-row: 1 / span 2; }
.stage-list .drag, .stage-list .stage-dot { grid-row: 1 / span 2; }
.col-head[draggable="true"] { cursor: grab; }
.col.col-dragging { opacity: .45; }
.col-rename { font: inherit; font-size: 13px; padding: 3px 8px; border-radius: 8px; border: 1px solid var(--accent, #EB1E01); width: 70%; background: transparent; color: inherit; }

.mention-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: 12px; }
.mention-chips:empty { display: none; }
.due-pick { display: flex; gap: 8px; align-items: center; }
.due-pick [data-d] { flex: 1.4; cursor: pointer; min-width: 0; }
.due-pick [data-t] { flex: 1; cursor: pointer; min-width: 0; }
.comment-tools { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; }
.check-inline { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.img-prev { height: 42px; border-radius: 6px; vertical-align: middle; margin-right: 6px; }
.comment-img { display: block; max-width: 100%; max-height: 260px; margin-top: 8px; border-radius: 10px; border: 1px solid rgba(127,127,127,.25); }
.comment-form .mention-chips { grid-column: 1 / -1; order: 3; }
.comment-form .comment-tools { order: 4; }

/* ---- Áreas, confidencial y aprobaciones ---- */
.board-4 { grid-template-columns: repeat(4, minmax(220px, 1fr)); }
.ttst-en_revision { background: #fff1d6; color: #8a5a00; }
:root[data-theme="dark"] .ttst-en_revision, :root[data-glass] .ttst-en_revision { background: #3f3218; color: #f4c86a; }
.dept, .conf-chip, .appr-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.dept { background: rgba(127,127,127,.14); }
.dept-marketing { background: rgba(235,30,1,.12); color: #EB1E01; }
.dept-administracion { background: rgba(31,95,174,.14); color: #3d7fd0; }
.dept-obras { background: rgba(200,130,0,.16); color: #b87800; }
.dept-comercial { background: rgba(30,140,80,.15); color: #1f9a5a; }
.conf-chip { background: #313131; color: #fff; }
.conf-chip svg { width: 11px; height: 11px; }
.appr-chip { background: rgba(127,127,127,.14); }
.appr-pendiente { background: #fff1d6; color: #8a5a00; }
.appr-aprobada { background: var(--good-bg); color: var(--good); }
.appr-rechazada { background: rgba(235,30,1,.12); color: #EB1E01; }
.ttcard-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.ttmeta { flex-wrap: wrap; }
.dept-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 12px; background: rgba(127,127,127,.1); }
.dtab { border: 0; background: none; padding: 6px 12px; border-radius: 9px; font: inherit; font-size: 13px; cursor: pointer; color: inherit; opacity: .75; }
.dtab.on { background: var(--card, #fff); opacity: 1; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
:root[data-glass] .dtab.on, :root[data-theme="dark"] .dtab.on { background: rgba(255,255,255,.14); }
.conf-switch { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.conf-switch svg { width: 14px; height: 14px; flex: none; margin-top: 3px; }
.approve-box { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: #fff1d6; color: #5c3d00; }
:root[data-theme="dark"] .approve-box, :root[data-glass] .approve-box { background: #3f3218; color: #f4dca0; }
.approve-box .sub { color: inherit; opacity: .8; }
.approve-actions { display: flex; gap: 8px; }

/* ---- Ubicaciones ---- */
.geo-map { height: 420px; width: 100%; }
.geo-pin { width: 12px; height: 12px; border-radius: 50%; background: #EB1E01; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); opacity: .7; }
.geo-pin.last { width: 34px; height: 34px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center; opacity: 1; color: #fff; font: 600 11px Poppins, sans-serif; }
.geo-pin.last { line-height: 1; }
.leaflet-container { font-family: Poppins, sans-serif; }
.geo-pin.last span { transform: rotate(45deg); }
.geo-link { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; } .geo-link svg, #pinBtn svg, #geoNow svg { width: 16px; height: 16px; flex: none; }

.geo-fail { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: rgba(235,30,1,.14); color: #ff6a52; }
.geo-del { width: 28px; height: 28px; font-size: 12px; opacity: .6; }
.geo-del:hover { opacity: 1; color: #EB1E01; }
.geo-fail { white-space: nowrap; }
