/* Órbita CRM — sistema de diseño */
:root {
  --font: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #eef3fc;
  --surface: #ffffff;
  --surface-2: #f6f9fe;
  --surface-3: #e7eefb;
  --line: #dce4f3;
  --line-strong: #c3d2ef;
  --ink: #050f2c;
  --ink-2: #3e5079;
  --muted: #61739d;
  --navy: #050f2c;
  --navy-2: #0a1a42;
  --primary: #050f2c;
  --primary-ink: #ffffff;
  --primary-hover: #1a3f8c;
  --accent: #1a3f8c;
  --accent-ink: #0c1f4f;
  --accent-soft: #e3ecfd;
  --accent-2: #6aa2ff;
  --blue: #1f4fb3;
  --blue-soft: #e3ecfd;
  --good: #11805a;
  --good-soft: #e1f7ee;
  --warn: #9a6a00;
  --warn-soft: #fdf2d6;
  --bad: #c0392b;
  --bad-soft: #fde8e6;
  --seq-1: #c3d2ef;
  --seq-2: #6aa2ff;
  --seq-3: #1a3f8c;
  --seq-4: #050f2c;
  --chart: #1a3f8c;
  --chart-2: #9cc2ff;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(5, 15, 44, 0.05);
  --shadow: 0 1px 2px rgba(5, 15, 44, 0.05), 0 10px 30px -12px rgba(5, 15, 44, 0.18);
  --shadow-lg: 0 30px 70px -30px rgba(5, 15, 44, 0.55);
  --header-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #050f2c;
    --surface: #0a1a42;
    --surface-2: #0c1f4f;
    --surface-3: #13296a;
    --line: #1c2f63;
    --line-strong: #2a4180;
    --ink: #ffffff;
    --ink-2: #d4def4;
    --muted: #8fa2cc;
    --primary: #ffffff;
    --primary-ink: #050f2c;
    --primary-hover: #e6eeff;
    --accent: #6aa2ff;
    --accent-ink: #9cc2ff;
    --accent-soft: rgba(106, 162, 255, 0.16);
    --blue: #9cc2ff;
    --blue-soft: rgba(106, 162, 255, 0.16);
    --good: #3ccf9a;
    --good-soft: rgba(60, 207, 154, 0.14);
    --warn: #f0c060;
    --warn-soft: rgba(240, 192, 96, 0.14);
    --bad: #ff8a7d;
    --bad-soft: rgba(255, 138, 125, 0.14);
    --seq-1: #1a3f8c;
    --seq-2: #3a6ed0;
    --seq-3: #6aa2ff;
    --seq-4: #c3d2ef;
    --chart: #6aa2ff;
    --chart-2: #2a4180;
    --shadow-sm: none;
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #050f2c;
  --surface: #0a1a42;
  --surface-2: #0c1f4f;
  --surface-3: #13296a;
  --line: #1c2f63;
  --line-strong: #2a4180;
  --ink: #ffffff;
  --ink-2: #d4def4;
  --muted: #8fa2cc;
  --primary: #ffffff;
  --primary-ink: #050f2c;
  --primary-hover: #e6eeff;
  --accent: #6aa2ff;
  --accent-ink: #9cc2ff;
  --accent-soft: rgba(106, 162, 255, 0.16);
  --blue: #9cc2ff;
  --blue-soft: rgba(106, 162, 255, 0.16);
  --good: #3ccf9a;
  --good-soft: rgba(60, 207, 154, 0.14);
  --warn: #f0c060;
  --warn-soft: rgba(240, 192, 96, 0.14);
  --bad: #ff8a7d;
  --bad-soft: rgba(255, 138, 125, 0.14);
  --seq-1: #1a3f8c;
  --seq-2: #3a6ed0;
  --seq-3: #6aa2ff;
  --seq-4: #c3d2ef;
  --chart: #6aa2ff;
  --chart-2: #2a4180;
  --shadow-sm: none;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.015em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ───────── cabecera ───────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--navy);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
:root[data-theme="dark"] .topbar { background: #030a1f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .topbar { background: #030a1f; } }
.topbar-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px;
  max-width: 1480px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand small { display: block; font-weight: 500; font-size: 10.5px; opacity: 0.6; letter-spacing: 0.02em; margin-top: -2px; }
.brand svg { flex: none; }
.search {
  flex: 1; max-width: 560px; position: relative; margin: 0 auto;
}
.search input {
  width: 100%; height: 38px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  color: #fff; padding: 0 12px 0 38px; outline: none;
  transition: background 0.15s, border-color 0.15s;
}
.search input::placeholder { color: rgba(255, 255, 255, 0.55); }
.search input:focus { background: rgba(255, 255, 255, 0.12); border-color: rgba(106, 162, 255, 0.7); }
.search .icon { position: absolute; left: 12px; top: 10px; opacity: 0.6; }
.search kbd { position: absolute; right: 10px; top: 9px; font-size: 11px; opacity: 0.5; border: 1px solid rgba(255,255,255,.25); border-radius: 5px; padding: 0 5px; font-family: var(--font); }
.search-results {
  position: absolute; top: 46px; left: 0; right: 0;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 6px; max-height: 70vh; overflow: auto;
}
.search-results .group { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 8px 10px 4px; font-weight: 600; }
.search-results a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; }
.search-results a.active, .search-results a:hover { background: var(--surface-3); }
.search-results .sub { color: var(--muted); font-size: 12.5px; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: inherit;
}
.topbar .icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.icon-btn:hover { background: var(--surface-3); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-grid; place-items: center; font-weight: 700; font-size: 12.5px;
  background: linear-gradient(135deg, #6aa2ff, #1a3f8c); color: #fff; flex: none;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.tabs {
  display: flex; gap: 2px; padding: 0 14px; overflow-x: auto; scrollbar-width: none;
  max-width: 1480px; margin: 0 auto;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 10px 14px 11px; color: rgba(255, 255, 255, 0.68); font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent; display: flex; gap: 8px; align-items: center;
}
.tabs a:hover { color: #fff; }
.tabs a.on { color: #fff; border-bottom-color: #6aa2ff; }
.menu-btn { display: none; }

/* ───────── layout ───────── */
.page { max-width: 1480px; margin: 0 auto; padding: 24px 20px 64px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; }
.page-head .spacer { flex: 1; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-head h3 { font-size: 14.5px; font-weight: 600; }
.card-head .spacer { flex: 1; }
.card-body { padding: 14px 18px 18px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ───────── botones y formularios ───────── */
.btn {
  height: 38px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.dark { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 999px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 999px 0 0 999px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 999px 999px 0; }
.btn-group .btn.on { background: var(--surface-3); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--accent); }
.input, select.input, textarea.input {
  width: 100%; min-height: 38px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.err-text { color: var(--bad); font-size: 12.5px; }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 22px; transition: 0.15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::before { transform: translateX(16px); }

/* ───────── etiquetas ───────── */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.pill.plain::before { display: none; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); font-size: 12px; margin: 0 4px 4px 0; color: var(--ink-2); }

/* ───────── KPI ───────── */
.kpi { padding: 18px; position: relative; overflow: hidden; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; }
.kpi .hint { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kpi .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.kpi .ico.blue { background: var(--blue-soft); color: var(--blue); }
.kpi .ico.good { background: var(--good-soft); color: var(--good); }
.kpi .ico.bad { background: var(--bad-soft); color: var(--bad); }

/* ───────── gráficos ───────── */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11.5px; font-family: var(--font); }
.chart .val { fill: var(--ink-2); font-weight: 600; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--chart); transition: opacity 0.12s; }
.chart .bar-bg { fill: var(--surface-3); }
.chart g:hover .bar { opacity: 0.82; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; font-size: 13px; position: relative; }
.hbar .track { height: 10px; background: var(--surface-3); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--chart); border-radius: 0 4px 4px 0; }
.hbar .v { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2); min-width: 86px; text-align: right; }
.hbar:hover .fill { opacity: 0.85; }
.tip {
  position: fixed; z-index: 100; pointer-events: none; background: var(--navy); color: #fff;
  padding: 7px 10px; border-radius: 8px; font-size: 12.5px; box-shadow: var(--shadow-lg); white-space: nowrap;
}
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.stack { display: flex; height: 12px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--surface); }
.stack div { height: 100%; }

/* ───────── listas ───────── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.toolbar .spacer { flex: 1; }
.view-select { font-weight: 700; font-size: 15px; border: 0; background: transparent; padding: 4px 26px 4px 4px; border-radius: 8px; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7493' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 6px center; }
.view-select:hover { background-color: var(--surface-3); }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 10px 12px;
  background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none;
  position: sticky; top: 0;
}
table.list th.sortable { cursor: pointer; }
table.list th.sortable:hover { color: var(--ink); }
table.list td { padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
table.list tr:hover td { background: var(--surface-2); }
table.list tr.sel td { background: var(--accent-soft); }
table.list td a.title { font-weight: 600; color: var(--blue); }
table.list td a.title:hover { text-decoration: underline; }
table.list .chk { width: 36px; }
.bulkbar { display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: var(--accent-soft); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty h4 { color: var(--ink); margin-bottom: 4px; font-size: 15px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-soft); color: var(--blue); border-radius: 8px; padding: 3px 4px 3px 10px; font-size: 12.5px; font-weight: 600; }
.filter-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 4px; font-size: 14px; }
.popover { position: absolute; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px; min-width: 240px; }
.rel { position: relative; }
.check-list label { display: flex; gap: 8px; align-items: center; padding: 5px 4px; border-radius: 6px; cursor: pointer; }
.check-list label:hover { background: var(--surface-3); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 14px; color: var(--muted); font-size: 13px; }

/* ───────── kanban ───────── */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); min-height: 220px; display: flex; flex-direction: column; transition: background 0.12s, border-color 0.12s; }
.kcol.over { background: var(--accent-soft); border-color: var(--accent); }
.kcol-head { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.kcol-head .t { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.kcol-head .count { background: var(--surface-3); border-radius: 999px; padding: 0 8px; font-size: 12px; color: var(--muted); }
.kcol-head .sum { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kcol-head .bar { height: 3px; border-radius: 3px; margin-top: 10px; background: var(--surface-3); overflow: hidden; }
.kcol-head .bar span { display: block; height: 100%; background: var(--chart); }
.kcol-body { padding: 10px; display: grid; gap: 8px; }
.kcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: grab;
  box-shadow: var(--shadow-sm); transition: box-shadow 0.12s, transform 0.12s;
}
.kcard:hover { box-shadow: var(--shadow); }
.kcard.dragging { opacity: 0.5; transform: rotate(1deg); }
.kcard .n { font-weight: 600; color: var(--ink); display: block; margin-bottom: 4px; line-height: 1.35; }
.kcard .a { color: var(--muted); font-size: 12.5px; }
.kcard .f { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12.5px; }
.kcard .amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.kcard .move { display: none; }

/* ───────── ficha ───────── */
.rec-head { padding: 20px 22px; display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.rec-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; color: #fff; flex: none; }
.rec-icon.account { background: linear-gradient(135deg, #1a3f8c, #6aa2ff); }
.rec-icon.contact { background: linear-gradient(135deg, #0e7a5a, #3ccf9a); }
.rec-icon.opportunity { background: linear-gradient(135deg, #050f2c, #1a3f8c); }
.rec-icon.case { background: linear-gradient(135deg, #3e5079, #8fa2cc); }
.rec-icon.task { background: linear-gradient(135deg, #2a5bc7, #9cc2ff); }
.rec-icon.activity { background: linear-gradient(135deg, #495057, #868e96); }
.rec-title { flex: 1; min-width: 220px; }
.rec-title h1 { font-size: 22px; font-weight: 700; line-height: 1.25; }
.rec-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.highlights { display: flex; gap: 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.highlights > div { padding: 12px 22px; border-right: 1px solid var(--line); min-width: 140px; }
.highlights > div:last-child { border-right: 0; }
.highlights .k { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.highlights .v { font-weight: 600; margin-top: 2px; }
.path { display: flex; gap: 4px; padding: 14px 22px; border-top: 1px solid var(--line); overflow-x: auto; }
.path button {
  flex: 1; min-width: 110px; height: 34px; border: 0; cursor: pointer; font-weight: 600; font-size: 12.5px;
  background: var(--surface-3); color: var(--ink-2); position: relative;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
  padding: 0 18px; white-space: nowrap;
}
.path button:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 8px 0 0 8px; }
.path button:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 8px 8px 0; }
.path button.done { background: var(--blue-soft); color: var(--blue); }
.path button.current { background: #050f2c; color: #fff; }
:root[data-theme="dark"] .path button.current { background: var(--blue); color: #06102a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .path button.current { background: var(--blue); color: #06102a; } }
.path button.won { background: var(--good); color: #fff; }
.path button.lost { background: var(--bad); color: #fff; }
.path button:hover:not(.current) { filter: brightness(0.96); }
.rec-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.dfield { padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.dfield.wide { grid-column: 1 / -1; }
.dfield .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.dfield .v { display: flex; align-items: center; gap: 8px; min-height: 26px; word-break: break-word; }
.dfield .v .txt { flex: 1; white-space: pre-wrap; }
.dfield .edit { opacity: 0; border: 0; background: transparent; cursor: pointer; color: var(--muted); border-radius: 6px; padding: 2px 4px; }
.dfield:hover .edit { opacity: 1; }
.dfield:hover { background: linear-gradient(90deg, transparent, var(--surface-2) 30%, var(--surface-2) 70%, transparent); }
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 14px; overflow-x: auto; }
.subtabs button { border: 0; background: transparent; padding: 12px 10px 11px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.subtabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.related-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.related-item:last-child { border-bottom: 0; }
.related-item .main { flex: 1; min-width: 0; }
.related-item .main a { font-weight: 600; color: var(--blue); }
.related-item .sub { color: var(--muted); font-size: 12.5px; }

/* ───────── línea de tiempo ───────── */
.composer { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.composer .types { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.composer .types button { display: inline-flex; gap: 6px; align-items: center; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.composer .types button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.timeline { padding: 6px 16px 16px; }
.tl-day { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin: 16px 0 6px; }
.tl-item { display: grid; grid-template-columns: 32px 1fr; gap: 12px; position: relative; padding: 8px 0; }
.tl-item::before { content: ""; position: absolute; left: 15px; top: 40px; bottom: -8px; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.tl-ico.Llamada { background: var(--good-soft); color: var(--good); }
.tl-ico.Email { background: var(--blue-soft); color: var(--blue); }
.tl-ico.Reunión { background: var(--accent-soft); color: var(--accent-ink); }
.tl-ico.Nota { background: var(--warn-soft); color: var(--warn); }
.tl-ico.sys { background: var(--surface-3); color: var(--muted); }
.tl-body .t { font-weight: 600; }
.tl-body .m { color: var(--muted); font-size: 12.5px; }
.tl-body .b { color: var(--ink-2); margin-top: 3px; white-space: pre-wrap; }
.task-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--good); margin-top: 1px; cursor: pointer; }
.task-row.done .t { text-decoration: line-through; color: var(--muted); }
.task-row .t { font-weight: 600; }
.task-row .m { font-size: 12.5px; color: var(--muted); }
.overdue { color: var(--bad) !important; font-weight: 600; }

/* ───────── panel lateral ───────── */
.scrim { position: fixed; inset: 0; background: rgba(6, 11, 28, 0.42); z-index: 60; animation: fade 0.15s; backdrop-filter: blur(2px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); z-index: 61;
  background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slide 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 17px; flex: 1; }
.drawer-body { padding: 20px; overflow: auto; flex: 1; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.modal { position: fixed; z-index: 62; left: 50%; top: 18vh; transform: translateX(-50%); width: min(440px, calc(100vw - 32px)); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 22px; animation: pop 0.15s; }
.modal h3 { font-size: 17px; margin-bottom: 6px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes pop { from { transform: translateX(-50%) scale(0.97); opacity: 0; } }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--navy); color: #fff; padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; animation: pop2 0.2s; font-weight: 500; }
:root[data-theme="dark"] .toast { background: #1c2756; }
.toast.error { background: var(--bad); }
@keyframes pop2 { from { transform: translateY(8px); opacity: 0; } }

/* ───────── menú de usuario ───────── */
.menu { position: absolute; right: 0; top: 44px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; z-index: 50; }
.menu a, .menu button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-3); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu .who { padding: 8px 10px 10px; }
.menu .who b { display: block; }
.menu .who span { font-size: 12.5px; color: var(--muted); }

/* ───────── flujos ───────── */
.flow-card { padding: 16px 18px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.flow-card + .flow-card { border-top: 1px solid var(--line); }
.flow-card .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.flow-card .ico.off { background: var(--surface-3); color: var(--muted); }
.flow-card h4 { font-size: 14.5px; }
.flow-card h4 a:hover { color: var(--blue); }
.flow-card p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.flow-meta { display: flex; gap: 12px; margin-top: 6px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.flow-editor { display: grid; grid-template-columns: minmax(0, 1fr) 470px; gap: 16px; align-items: start; }
.canvas {
  background-color: var(--surface-2);
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1px);
  background-size: 18px 18px;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 16px 40px; min-height: 560px;
  display: flex; flex-direction: column; align-items: center;
}
.fblock {
  width: min(440px, 100%); background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px;
  box-shadow: var(--shadow); cursor: pointer; display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.fblock:hover { border-color: var(--line-strong); }
.fblock.sel { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.fblock .bico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.fblock .bico.trigger { background: linear-gradient(135deg, #3b5bdb, #5c7cfa); }
.fblock .bico.cond { background: linear-gradient(135deg, #f08c00, #fcc419); }
.fblock .bico.action { background: linear-gradient(135deg, #050f2c, #1a3f8c); }
.fblock .k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.fblock .t { font-weight: 600; line-height: 1.35; }
.fblock .s { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.fblock.end { grid-template-columns: 1fr; text-align: center; padding: 10px; cursor: default; color: var(--muted); font-weight: 600; width: auto; min-width: 120px; border-style: dashed; box-shadow: none; }
.connector { display: flex; flex-direction: column; align-items: center; height: 64px; justify-content: center; position: relative; }
.connector::before { content: ""; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--line-strong); }
.connector button {
  position: relative; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--line-strong);
  background: var(--surface); cursor: pointer; display: grid; place-items: center; color: var(--muted); transition: 0.12s;
}
.connector button:hover { border-color: var(--accent); color: #fff; background: var(--accent); transform: scale(1.08); }
.side-panel { position: sticky; top: calc(var(--header-h) + 60px); }
.rule-row { display: grid; grid-template-columns: 1.15fr 1fr 1fr auto; gap: 6px; margin-bottom: 8px; align-items: center; }
.kv-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; margin-bottom: 8px; }
.logic-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.logic-toggle button { border: 0; padding: 4px 12px; background: transparent; font-weight: 700; cursor: pointer; font-size: 12px; }
.logic-toggle button.on { background: var(--navy); color: #fff; }
.help { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
.run-row { display: grid; grid-template-columns: 22px 140px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.run-row .e { color: var(--bad); }

/* ───────── auth ───────── */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art {
  background: radial-gradient(900px 520px at 85% 20%, rgba(106, 162, 255, 0.28), transparent 60%), radial-gradient(700px 500px at 0% 100%, rgba(26, 63, 140, 0.55), transparent 60%), #050f2c;
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-art .kicker { font-size: 13px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #9cc2ff; margin-bottom: 14px; }
.auth-spot { position: absolute; right: -140px; bottom: -140px; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(255,255,255,.14); box-shadow: 0 0 0 60px rgba(255,255,255,.03), 0 0 0 120px rgba(255,255,255,.02); }
.auth-art h2 { font-size: 34px; line-height: 1.15; max-width: 460px; letter-spacing: -0.025em; }
.auth-art p { color: rgba(255, 255, 255, 0.72); max-width: 420px; font-size: 15px; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-form form { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: 26px; margin-bottom: 6px; }
.auth-form p.lead { color: var(--muted); margin: 0 0 24px; }
.auth-form .btn { width: 100%; height: 44px; justify-content: center; font-size: 15px; }
.auth-form .input { min-height: 44px; }
.loader { display: grid; place-items: center; min-height: 60vh; color: var(--muted); }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ───────── responsive ───────── */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two, .rec-layout, .flow-editor { grid-template-columns: 1fr; }
  .side-panel { position: static; }
  .thirds { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --header-h: 56px; }
  .topbar-inner { gap: 8px; padding: 0 10px; }
  .brand .txt { display: none; }
  .search kbd { display: none; }
  .menu-btn { display: inline-grid; }
  .tabs { display: none; }
  .tabs.open {
    display: flex; flex-direction: column; position: fixed; top: var(--header-h); left: 0; bottom: 0; width: 260px;
    background: var(--navy); padding: 12px; z-index: 45; box-shadow: var(--shadow-lg); gap: 2px;
  }
  .tabs.open a { border-bottom: 0; border-radius: 10px; padding: 12px 14px; }
  .tabs.open a.on { background: rgba(255, 255, 255, 0.1); }
  .page { padding: 16px 16px 48px; }
  .kpis, .halves { grid-template-columns: 1fr 1fr; }
  .kpi .value { font-size: 22px; }
  .details { grid-template-columns: 1fr; }
  .highlights > div { min-width: 50%; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 16px; }
  .rec-head { padding: 16px; }
  .path { padding: 12px 16px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .hbar { grid-template-columns: 84px 1fr auto; }
  .hbar .v { min-width: 70px; }
  .kcard .move { display: block; margin-top: 8px; }
  .rule-row { grid-template-columns: 1fr 1fr; }
  .flow-card { grid-template-columns: auto 1fr; }
  .flow-card > :last-child { grid-column: 1 / -1; }
  .run-row { grid-template-columns: 22px 1fr; }
  .run-row > :nth-child(3) { grid-column: 1 / -1; }
  .top-actions .hide-sm { display: none; }
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr; }
}
.hover-bg:hover{background:var(--surface-3)}

.cols { display: flex; gap: 10px; align-items: stretch; padding-top: 6px; }
.cols .col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cols .plot { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-bottom: 1px solid var(--line-strong); background: repeating-linear-gradient(to top, transparent 0, transparent calc(50% - 1px), var(--line) calc(50% - 1px), var(--line) 50%); }
.cols .cbar { width: min(56%, 64px); background: var(--chart); border-radius: 4px 4px 0 0; transition: opacity .12s; }
.cols .col:hover .cbar { opacity: .82; }
.cols .cv { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; white-space: nowrap; }
.cols .cl { text-align: center; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ───────── marca Sobtree ───────── */
.wordmark { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; }
.brand-word { font-size: 22px; font-weight: 800; letter-spacing: -0.035em; line-height: 1; }
.dot-accent { color: #6aa2ff; }
.brand-bar { width: 1px; height: 22px; background: currentColor; opacity: 0.3; }
.brand-tag { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.eyebrow { color: var(--accent); }
.brand .mark { display: none; }
@media (max-width: 760px) { .brand .mark { display: inline-flex; } .brand .txt { display: none; } }

/* ───────── flujos v2 ───────── */
.rec-icon.flowicon { background: linear-gradient(135deg, #050f2c, #1a3f8c); width: 38px; height: 38px; border-radius: 11px; color: #fff; }
.rec-head .rec-icon.flowicon { width: 46px; height: 46px; border-radius: 13px; }
.title-input { font-size: 19px; font-weight: 700; border-color: transparent; padding-left: 6px; margin-left: -6px; }
.desc-input { border-color: transparent; padding-left: 6px; margin-left: -6px; color: var(--muted); }
.title-input:hover, .desc-input:hover { border-color: var(--line); }
.issues-box { margin: 0 22px 16px; background: var(--bad-soft); color: var(--bad); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; }
.issues-box ul { margin: 6px 0 0; padding-left: 18px; }
.run-banner { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--good-soft); color: var(--ink); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; font-weight: 600; }
.run-row.picked { background: var(--accent-soft); border-radius: 10px; }
.flow-host { min-height: 520px; }
.backlink { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.flow-host:empty { display: grid; place-items: center; }
.flow-host:empty::before { content: ""; width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* ───────── tablas como tarjetas en el móvil ───────── */
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 28px 16px; display: grid; justify-items: center; gap: 6px; text-align: center; cursor: pointer; background: var(--surface-2); color: var(--ink-2); transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.demo-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-size: 10.5px; font-weight: 800; letter-spacing: .06em; }
.draft-banner { display: flex; gap: 10px; align-items: center; background: var(--warn-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: 14px; padding: 12px 16px; font-weight: 700; margin-bottom: 14px; }
.progress { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--chart); border-radius: 999px; }
.progress.warning > span { background: var(--warn); }
.progress.exceeded > span { background: var(--bad); }
.acc-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 0 14px; border-bottom: 1px solid var(--line); }
.acc-tabs::-webkit-scrollbar { display: none; }
.acc-tabs a { padding: 12px 10px 11px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.acc-tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.casillas td:first-child { width: 64px; font-weight: 700; color: var(--accent); }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 18px; }
.kv-grid .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.kv-grid .v { font-weight: 600; }
.grouped { display: flex; gap: 6px; align-items: flex-end; height: 180px; border-bottom: 1px solid var(--line-strong); padding-top: 20px; }
.grouped .g { flex: 1; display: flex; gap: 3px; align-items: flex-end; height: 100%; justify-content: center; }
.grouped .b1, .grouped .b2 { width: min(38%, 22px); border-radius: 4px 4px 0 0; }
.grouped .b1 { background: var(--chart); }
.grouped .b2 { background: var(--chart-2); }
.grouped-labels { display: flex; gap: 6px; }
.grouped-labels span { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); padding-top: 6px; }
@media (max-width: 760px) {
  table.list.cards thead { display: none; }
  table.list.cards, table.list.cards tbody, table.list.cards tr, table.list.cards td { display: block; width: 100%; }
  table.list.cards tr { border-bottom: 1px solid var(--line); padding: 12px 14px; position: relative; }
  table.list.cards td { border: 0; padding: 2px 0; white-space: normal; max-width: none; display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
  table.list.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 600; flex: none; }
  table.list.cards td.primary { font-size: 15.5px; font-weight: 700; padding-bottom: 6px; display: block; padding-right: 40px; }
  table.list.cards td.primary::before, table.list.cards td.chk::before, table.list.cards td.noLabel::before { display: none; }
  table.list.cards td.chk { position: absolute; right: 10px; top: 12px; width: auto; display: block; }
  table.list.cards td.hide-sm { display: none; }
  table.list.cards td.num { text-align: right; }
  table.list.cards tfoot tr { background: var(--surface-2); }
}

.demo-toggle { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.entry { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.entry-head { display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: var(--surface-2); flex-wrap: wrap; font-size: 13.5px; }
.entry-desc { flex: 1; min-width: 160px; }
.entry-lines td { padding: 8px 14px; }
.entry-lines tr:last-child td { border-bottom: 0; }
.roles-matrix td, .roles-matrix th { padding: 8px 10px; }
.roles-matrix input { width: 18px; height: 18px; }

/* ───────── menú inferior (móvil) ───────── */
.bottom-nav { display: none; }
.sheet { display: none; }
@media (max-width: 760px) {
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px rgba(5, 15, 44, 0.08); }
  .bottom-nav a, .bottom-nav button { display: grid; justify-items: center; gap: 2px; padding: 7px 2px 6px; min-height: 54px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; border-radius: 12px; cursor: pointer; }
  .bottom-nav span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bottom-nav .on { color: var(--accent); background: var(--accent-soft); }
  .sheet { display: grid; position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: var(--surface); border-radius: 22px 22px 0 0; padding: 8px 12px calc(76px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: up 0.18s ease-out; gap: 2px; }
  .sheet a, .sheet button { display: flex; gap: 14px; align-items: center; min-height: 52px; padding: 0 12px; border-radius: 12px; border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 600; font-size: 15.5px; text-align: left; cursor: pointer; }
  .sheet a:active, .sheet button:active { background: var(--surface-3); }
  .sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); justify-self: center; margin: 4px 0 10px; }
  main { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(78px + env(safe-area-inset-bottom)); }
}
@keyframes up { from { transform: translateY(30px); opacity: 0; } }

/* ───────── ajustes finos del móvil ───────── */
main { overflow-x: clip; }
.card, .grid > * { min-width: 0; }
@media (max-width: 760px) {
  .halves, .two, .thirds { grid-template-columns: 1fr !important; }
  .card-head { flex-wrap: wrap; row-gap: 4px; }
  .card-head .spacer { flex-basis: 0; }
  .related-item { flex-wrap: wrap; }
  .related-item .btn { white-space: normal; height: auto; min-height: 40px; padding: 8px 14px; text-align: left; line-height: 1.3; }
  .btn { min-height: 42px; }
  .btn.sm { min-height: 36px; }
  .input, select.input { min-height: 44px; font-size: 16px; }
  .input.sm, select.input.sm { min-height: 40px; font-size: 15px; }
  .toolbar { gap: 8px; }
  .toolbar .input.sm { max-width: none !important; flex: 1 1 160px; }
  table.list.cards td .cv { text-align: right; min-width: 0; overflow-wrap: anywhere; }
  table.list.cards td.primary .cv { text-align: left; }
  .page-head h1 { font-size: 20px; }
  .rec-actions { width: 100%; }
  .drawer { width: 100vw; }
  .drawer-foot .btn { flex: 1; justify-content: center; }
  .modal { top: auto; bottom: 0; transform: none; left: 0; width: 100vw; border-radius: 20px 20px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .kanban { scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; grid-auto-columns: 82%; }
  .kcol { scroll-snap-align: start; }
  .flow-card .btn.sm { min-height: 40px; }
  .casillas td { white-space: normal; }
  .acc-tabs a { padding: 14px 10px 13px; }
}
@media (max-width: 420px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi .value { font-size: 20px; } .kpi { padding: 14px; } }
@media (max-width: 760px) { .modal { animation: up 0.18s ease-out; } }
