/* KLI · Pipeline — sistema visual v6
   Base fría y calma, barra lateral petróleo, color solo para estado y acción.
   Tipografía: IBM Plex Sans, cifras tabulares en todo lo numérico. */

:root {
  --canvas: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --surface-3: #eaeef2;
  --ink: #15212b;
  --ink-2: #4a5864;
  --ink-3: #7d8a95;
  --line: #e1e6eb;
  --line-2: #cfd7de;

  --sb-bg: #102027;
  --sb-ink: #c9d6dc;
  --sb-ink-2: #7f97a2;
  --sb-hover: #18303a;
  --sb-active: #1f3d49;

  --accent: #0b6e61;
  --accent-hover: #095c51;
  --accent-ink: #ffffff;
  --accent-soft: #e2f2ee;
  --accent-text: #0a6357;

  --viz-1: #12957f;
  --viz-1-soft: #c9e9e2;
  --viz-2: #6250d6;

  --warn: #a65b00;
  --warn-soft: #fdf0dc;
  --danger: #bb3326;
  --danger-soft: #fbe7e4;
  --ok: #1b7a43;
  --ok-soft: #e3f3e9;
  --gold: #b8860b;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --shadow-pop: 0 10px 30px rgba(16, 32, 39, .14), 0 2px 6px rgba(16, 32, 39, .08);
  --font: "IBM Plex Sans", ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0d1418; --surface: #141d23; --surface-2: #19242b; --surface-3: #1f2c34;
    --ink: #e6ecef; --ink-2: #a8b6bf; --ink-3: #74858f; --line: #24323b; --line-2: #2f404a;
    --sb-bg: #0a1216; --sb-ink: #c3d0d6; --sb-ink-2: #6b828c; --sb-hover: #12212a; --sb-active: #193039;
    --accent: #1ba58f; --accent-hover: #22b9a1; --accent-ink: #06231e; --accent-soft: #123631; --accent-text: #5fd0bb;
    --viz-1: #1ba58f; --viz-1-soft: #1d3b37; --viz-2: #9085e9;
    --warn: #e7a24a; --warn-soft: #3a2a13; --danger: #f07c6f; --danger-soft: #3d1d19; --ok: #5cc98a; --ok-soft: #143323; --gold: #e0b44a;
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #0d1418; --surface: #141d23; --surface-2: #19242b; --surface-3: #1f2c34;
  --ink: #e6ecef; --ink-2: #a8b6bf; --ink-3: #74858f; --line: #24323b; --line-2: #2f404a;
  --sb-bg: #0a1216; --sb-ink: #c3d0d6; --sb-ink-2: #6b828c; --sb-hover: #12212a; --sb-active: #193039;
  --accent: #1ba58f; --accent-hover: #22b9a1; --accent-ink: #06231e; --accent-soft: #123631; --accent-text: #5fd0bb;
  --viz-1: #1ba58f; --viz-1-soft: #1d3b37; --viz-2: #9085e9;
  --warn: #e7a24a; --warn-soft: #3a2a13; --danger: #f07c6f; --danger-soft: #3d1d19; --ok: #5cc98a; --ok-soft: #143323; --gold: #e0b44a;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { overflow-x: hidden; background: var(--canvas); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.005em; }
a { color: var(--accent-text); }
svg { flex: none; }
.num, .money, .metric-value, .kpi-v, .hero-v, .fact-v, .col-sum, .fn-val, .src-v { font-variant-numeric: tabular-nums; }
.meta { color: var(--ink-3); font-size: 12.5px; }
.muted { color: var(--ink-3); }
.strong { font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Controles ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: var(--r-sm); padding: 7px 12px; cursor: pointer; text-decoration: none; white-space: nowrap; font-weight: 500; line-height: 1.3; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--ink); }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; border: 0; background: transparent; cursor: pointer; color: var(--ink-3); padding: 6px; border-radius: var(--r-sm); font-size: 14px; line-height: 1; text-decoration: none; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.link { border: 0; background: none; padding: 0; color: var(--accent-text); cursor: pointer; text-align: left; font: inherit; }
.link:hover { text-decoration: underline; }
.link.small { font-size: 12.5px; }
label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-sm); padding: 7px 10px; font-size: 14px; font-weight: 400; color: var(--ink); min-height: 36px;
}
textarea { resize: vertical; min-height: 0; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: -1px; border-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
input:disabled { opacity: .55; }
.toggle { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 13px; cursor: pointer; user-select: none; font-weight: 400; }
.form-error { color: var(--danger); margin: 0; min-height: 1em; font-size: 13px; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: transparent; padding: 5px 11px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 32, 39, .12); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.chip { border: 1px dashed var(--line-2); background: var(--surface); border-radius: 99px; padding: 3px 10px; font-size: 12px; cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: var(--accent); color: var(--accent-text); }
.contact-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.contact-chips:empty { display: none; }
code { font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
kbd { font: 11px var(--font); color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; }

/* Etiquetas de estado */
.tag, .stage-pill, .badge, .late-tag, .today-tag, .stale-tag, .kind-tag, .sev {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; line-height: 1.5; padding: 0 7px; border-radius: 4px; white-space: nowrap;
}
.tag { background: var(--surface-3); color: var(--ink-2); }
.tag.cotizado { background: var(--accent-soft); color: var(--accent-text); }
.tag.firmado { background: var(--ok-soft); color: var(--ok); }
.stage-pill { background: var(--surface-3); color: var(--ink-2); }
.badge { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.badge.warn { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.mtg { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.late-tag, .stale-tag { background: var(--warn-soft); color: var(--warn); }
.today-tag { background: var(--accent-soft); color: var(--accent-text); }
.kind-tag { background: var(--surface-3); color: var(--ink-2); }
.kind-tag.k-cotizacion { background: var(--accent-soft); color: var(--accent-text); }
.kind-tag.k-presentacion { background: color-mix(in srgb, var(--viz-2) 14%, var(--surface)); color: color-mix(in srgb, var(--viz-2) 85%, var(--ink)); }
.kind-tag.k-contrato { background: var(--ok-soft); color: var(--ok); }
.initials, .avatar { width: 26px; height: 26px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent-text); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; flex: none; letter-spacing: .02em; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login-art { background: var(--sb-bg); color: var(--sb-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 56px solid color-mix(in srgb, var(--viz-1) 22%, transparent); }
.login-brand .mark { font-size: 22px; }
.login-quote { font-size: 26px; line-height: 1.3; max-width: 22ch; color: #e8f0f2; font-weight: 500; margin: 0; position: relative; z-index: 1; }
.login-card { align-self: center; justify-self: center; width: min(380px, calc(100% - 32px)); display: grid; gap: 14px; padding: 24px 0; }
.login-card h1 { font-size: 22px; }
.login-card .meta { margin: -8px 0 6px; }
.login-card .login-or { text-align: center; margin: 0 0 10px; }
/* Selector de idioma del ingreso (fase 0.5): usa los colores del tema, sin estilos nuevos de marca */
.lang-switch { display: flex; gap: 4px; justify-self: end; margin-bottom: -6px; }
.lang-opt { background: none; border: 1px solid var(--line-2); border-radius: 6px; padding: 3px 9px; font: inherit; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.lang-opt:hover { background: var(--surface-3); }
.lang-opt.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.mark { font-weight: 700; letter-spacing: .16em; color: #fff; }
@media (max-width: 820px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--sb-bg); color: var(--sb-ink); display: flex; flex-direction: column; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 12; }
.sb-brand { display: flex; align-items: baseline; gap: 10px; padding: 6px 10px 18px; }
.sb-brand .mark { font-size: 17px; }
/* Encargo 29: logo de la empresa del dominio, al lado del nombre */
.mark-logo { height: 22px; width: auto; max-width: 120px; align-self: center; object-fit: contain; }
.login-brand { display: flex; align-items: center; gap: 10px; }
.sb-sub { color: var(--sb-ink-2); font-size: 13px; }
.sb-label { color: var(--sb-ink-2); font-size: 11.5px; font-weight: 500; padding: 16px 10px 6px; }
.sb-group { display: grid; gap: 1px; }
.sidebar .view-btn, .sb-link { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; background: transparent; color: var(--sb-ink); padding: 8px 10px; border-radius: var(--r-md); cursor: pointer; text-align: left; font-size: 14px; font-weight: 500; }
.sidebar .view-btn svg, .sb-link svg { width: 18px; height: 18px; color: var(--sb-ink-2); }
.sidebar .view-btn:hover, .sb-link:hover { background: var(--sb-hover); }
.sidebar .view-btn.active, .sb-link.active { background: var(--sb-active); color: #fff; }
.sidebar .view-btn.active svg, .sb-link.active svg { color: #5fd0bb; }
.sidebar .count { margin-left: auto; font-size: 11.5px; min-width: 20px; text-align: center; padding: 0 6px; border-radius: 99px; background: rgba(255, 255, 255, .08); color: var(--sb-ink); font-variant-numeric: tabular-nums; }
.sidebar .count:empty { display: none; }
.sidebar .count.unread { background: var(--viz-1); color: #fff; }
.sb-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .07); display: grid; gap: 4px; }
.sb-link { font-size: 13px; color: var(--sb-ink-2); --sb-bg: var(--sb-bg); }
.sb-user { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--sb-ink); padding: 8px 10px; border-radius: var(--r-md); cursor: pointer; text-align: left; font-weight: 500; }
.sb-user:hover { background: var(--sb-hover); }
.sb-user .avatar { background: #24414c; color: #bfe9df; }
.sb-user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-scrim { position: fixed; inset: 0; background: rgba(8, 14, 18, .45); z-index: 11; }

.main-col { min-width: 0; display: flex; flex-direction: column; position: relative; }
.topbar { position: sticky; top: 0; z-index: 8; display: flex; align-items: center; gap: 16px; padding: 12px 28px; background: color-mix(in srgb, var(--canvas) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.menu-btn { display: none; }
.page-title { min-width: 0; margin-right: auto; }
.page-title h1 { font-size: 20px; font-weight: 600; line-height: 1.2; }
.page-title p { margin: 1px 0 0; }
.page-title p:empty { display: none; }
.gsearch { position: relative; display: flex; align-items: center; width: min(380px, 34vw); }
.gsearch > svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; z-index: 1; }
.gsearch input { padding-left: 34px !important; padding-right: 44px !important; }
.gsearch kbd { position: absolute; right: 9px; }
.gs-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 6px; max-height: 70vh; overflow-y: auto; z-index: 20; }
.gs-title { font-size: 11.5px; color: var(--ink-3); padding: 8px 10px 4px; font-weight: 500; }
.gs-group button { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%; border: 0; background: none; padding: 7px 10px; border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.gs-group button:hover, .gs-group button:focus-visible { background: var(--surface-2); }
.gs-empty { padding: 12px; margin: 0; color: var(--ink-3); }
.create-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 6px; min-width: 180px; z-index: 20; display: grid; }
.menu button { border: 0; background: none; text-align: left; padding: 8px 12px; border-radius: var(--r-sm); cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
main { padding: 20px 28px 48px; min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.toolbar h2 { font-size: 16px; font-weight: 600; }

/* ---------- Paneles ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; min-width: 0; }
.panel.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.panel h3 { font-size: 14.5px; font-weight: 600; margin-bottom: 10px; }
.panel h4 { font-size: 12.5px; color: var(--ink-3); margin: 14px 0 4px; font-weight: 500; }
.panel-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-h h3 { margin: 0; }
.empty-state { color: var(--ink-3); padding: 32px; text-align: center; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r-lg); margin: 0; }
.empty-state p { margin: 0 0 8px; }
.notice { display: block; width: 100%; text-align: left; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); color: var(--ink); border-radius: var(--r-lg); padding: 11px 16px; margin-bottom: 14px; cursor: pointer; font: inherit; }
.notice:hover { border-color: var(--accent); }
.notice.soft { background: var(--surface); color: var(--ink-2); }

/* ---------- Métricas (oportunidades) ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 16px; overflow: hidden; }
.metric { padding: 12px 18px; border-left: 1px solid var(--line); }
.metric:first-child { border-left: 0; }
.metric-label { font-size: 12.5px; color: var(--ink-3); }
.metric-value { font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.metric-note { font-size: 12px; color: var(--ink-3); }
.metric.warn .metric-value { color: var(--danger); }
.metric.clickable { cursor: pointer; }
.metric.clickable:hover { background: var(--surface-2); }

/* ---------- Tablero ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(258px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: var(--surface-3); border-radius: var(--r-lg); min-height: 200px; display: flex; flex-direction: column; }
.col-head { padding: 12px 12px 8px; display: grid; gap: 2px; border-top: 3px solid var(--viz-1); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.col.won .col-head { border-top-color: var(--ok); }
.col.lost .col-head { border-top-color: var(--ink-3); }
.col-name { display: flex; align-items: center; gap: 8px; }
.col-title { font-weight: 600; font-size: 13.5px; }
.col-count { font-size: 12px; color: var(--ink-3); background: var(--surface); border-radius: 99px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.col-sum { font-size: 12.5px; color: var(--ink-2); min-height: 19px; }
.col-sum .pond { color: var(--accent-text); }
.col-body { padding: 4px 8px 10px; display: grid; gap: 8px; align-content: start; flex: 1; min-height: 120px; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -4px; }
.empty-col { color: var(--ink-3); font-size: 12px; text-align: center; padding: 22px 8px; border: 1px dashed var(--line-2); border-radius: var(--r-md); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px 12px; cursor: pointer; display: grid; gap: 7px; transition: border-color .12s, box-shadow .12s; }
.card:hover { border-color: var(--line-2); box-shadow: 0 2px 8px rgba(16, 32, 39, .08); }
.card.dragging { opacity: .45; }
.card.is-stale { box-shadow: inset 3px 0 0 var(--warn); }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: start; }
.card-client { font-weight: 600; font-size: 14px; line-height: 1.3; }
.card-top .initials { width: 22px; height: 22px; font-size: 10px; }
.card-who { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 12.5px; color: var(--ink-2); margin-top: -3px; }
.card-who .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); }
.card-amount { display: flex; align-items: center; gap: 8px; }
.card-amount strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.meter, .mini-meter { display: block; height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.meter span, .mini-meter span { display: block; height: 100%; background: var(--viz-1); border-radius: 2px; }
.mini-meter { display: inline-block; width: 38px; margin-right: 6px; vertical-align: middle; }
.card-signals { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 12px; color: var(--ink-3); margin-top: -2px; }
.prob { font-weight: 600; color: var(--accent-text); }
.prob.custom::after { content: "*"; }
.next { font-size: 12.5px; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 7px; }
.next .date { color: var(--ink-3); margin-left: 4px; font-variant-numeric: tabular-nums; }
.next.overdue .date { color: var(--danger); font-weight: 600; }
.badges { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.badges .badge { height: 20px; }

/* ---------- Tablas ---------- */
.list { overflow-x: auto; }
.list table, .dtable { width: 100%; border-collapse: collapse; background: var(--surface); }
.list table { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.list th, .list td, .dtable th, .dtable td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list th, .dtable th { font-size: 12px; color: var(--ink-3); font-weight: 500; background: var(--surface-2); white-space: nowrap; }
.list th { cursor: pointer; user-select: none; }
.list th:hover { color: var(--ink); }
.list tr:last-child td, .dtable tr:last-child td { border-bottom: 0; }
.list tbody tr, .dtable tbody tr { cursor: pointer; }
.list tbody tr:hover, .dtable tbody tr:hover { background: var(--surface-2); }
.list td.num, .list th.num, .dtable .num { text-align: right; white-space: nowrap; }
.dtable th { background: transparent; padding-top: 0; }
.dtable td, .dtable th { padding-left: 8px; padding-right: 8px; }
.dtable td:first-child, .dtable th:first-child { padding-left: 0; }
.dtable td:last-child, .dtable th:last-child { padding-right: 0; }

/* ---------- Ficha de oportunidad ---------- */
.scrim { position: fixed; inset: 0; background: rgba(8, 14, 18, .38); z-index: 30; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(1100px, 100%); background: var(--canvas); z-index: 31; transform: translateX(100%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(8, 14, 18, .18); }
.drawer.open { transform: none; visibility: visible; transition: transform .22s ease; }
.rec-head { display: flex; gap: 14px; align-items: flex-start; padding: 16px 20px 10px; background: var(--surface); }
.rec-title { flex: 1; min-width: 0; }
.drawer-title { font-size: 21px !important; font-weight: 600 !important; border: 1px solid transparent !important; padding: 2px 6px !important; margin-left: -7px; background: transparent !important; min-height: 0 !important; }
.drawer-title:hover { border-color: var(--line) !important; }
.drawer-title:focus { border-color: var(--accent) !important; background: var(--surface) !important; }
.stage-meta { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }
.outcome { display: flex; gap: 6px; align-items: center; }
.btn-won { color: var(--ok); }
.btn-won:hover, .btn-won.active { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-lost { color: var(--danger); }
.btn-lost:hover, .btn-lost.active { background: var(--danger); border-color: var(--danger); color: #fff; }
.stepper { display: flex; padding: 0 20px 14px; background: var(--surface); gap: 3px; }
.step { flex: 1; min-width: 0; border: 0; background: var(--surface-3); padding: 7px 6px 6px; cursor: pointer; display: grid; gap: 0; text-align: center; color: var(--ink-2); clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%); }
.step:first-child { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); border-radius: 6px 0 0 6px; }
.step:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 9px 50%); border-radius: 0 6px 6px 0; }
.step:hover { background: var(--line-2); }
.step-label { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
.step-pct { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.step.past { background: var(--viz-1-soft); color: var(--accent-text); }
.step.current { background: var(--accent); color: var(--accent-ink); }
.step.current .step-pct { color: var(--accent-ink); opacity: .85; }
.rec-facts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fact { padding: 10px 20px; border-left: 1px solid var(--line); display: grid; min-width: 0; }
.fact:first-child { border-left: 0; }
.fact-l { font-size: 12px; color: var(--ink-3); }
.fact-v { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact-n { font-size: 12px; color: var(--ink-3); }
.fact.warn .fact-v, .fact.warn .fact-n { color: var(--danger); }
.rec-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 340px 1fr; }
.rec-about { overflow-y: auto; padding: 8px 16px 24px 20px; border-right: 1px solid var(--line); background: var(--surface); display: grid; gap: 4px; align-content: start; }
.about-sec { border-bottom: 1px solid var(--line); padding: 4px 0 12px; }
.about-sec > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; padding: 8px 0; list-style: none; display: flex; align-items: center; gap: 6px; }
.about-sec > summary::-webkit-details-marker { display: none; }
.about-sec > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.6px solid var(--ink-3); border-bottom: 1.6px solid var(--ink-3); transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
.about-sec[open] > summary::before { transform: rotate(45deg); }
.about-sec[open] { display: grid; gap: 10px; }
.saved { margin: 4px 0 0; font-size: 12px; color: var(--ink-3); min-height: 1em; }
.drawer-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 8px; }
.rec-main { overflow-y: auto; padding: 0 24px 32px; min-width: 0; }
.rec-tabs { position: sticky; top: 0; z-index: 2; display: flex; gap: 2px; background: var(--canvas); border-bottom: 1px solid var(--line); margin: 0 -24px 16px; padding: 8px 24px 0; overflow-x: auto; }
.rtab { border: 0; background: none; padding: 8px 12px 9px; cursor: pointer; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.rtab:hover { color: var(--ink); }
.rtab.active { color: var(--ink); border-bottom-color: var(--accent); }
.rcount { font-size: 11.5px; background: var(--surface-3); border-radius: 99px; padding: 0 6px; color: var(--ink-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.rcount:empty { display: none; }
.rpane { display: grid; gap: 12px; align-content: start; }
.pane-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pane-head .meta { margin: 0; }

/* Composer y línea de tiempo */
.composer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; display: grid; gap: 8px; }
.note-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kind-pick { display: flex; flex-wrap: wrap; gap: 4px; }
.kind-opt { display: inline-flex; font-size: 12.5px; font-weight: 500; }
.kind-opt input { position: absolute; opacity: 0; pointer-events: none; }
.kind-opt span { border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; cursor: pointer; color: var(--ink-2); background: var(--surface); }
.kind-opt span:hover { border-color: var(--line-2); }
.kind-opt input:checked + span { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.kind-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.notes-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.timeline .note { position: relative; padding: 0 0 14px 24px; }
.timeline .note::before { content: ""; position: absolute; left: 4px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--canvas); border: 2px solid var(--line-2); }
.timeline .note::after { content: ""; position: absolute; left: 9px; top: 19px; bottom: 0; width: 1px; background: var(--line-2); }
.timeline .note:last-child::after { display: none; }
.timeline .note.decision::before { border-color: var(--viz-2); background: var(--viz-2); }
.timeline .note.llamada::before, .timeline .note.reunion::before, .timeline .note.email::before, .timeline .note.whatsapp::before { border-color: var(--viz-1); background: var(--viz-1); }
.timeline .note.cambio { color: var(--ink-3); font-size: 13px; }
.timeline .note:not(.cambio) .note-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 9px 12px; }
.note-body { white-space: pre-wrap; }
.note .kind { color: var(--accent-text); font-weight: 600; font-size: 12px; margin-right: 6px; }
.note.decision .kind { color: color-mix(in srgb, var(--viz-2) 85%, var(--ink)); }
.note-meta { font-size: 11.5px; color: var(--ink-3); display: flex; gap: 8px; margin-top: 3px; }
.note-meta button { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 0; font-size: 11.5px; text-decoration: underline; }

/* Tareas */
.task-form { display: grid; grid-template-columns: 1fr 150px 150px auto; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; }
.task-list, .quote-list, .attn-list, .feed, .meet-list, .contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.task { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 9px 10px; border-radius: var(--r-md); background: var(--surface); border: 1px solid transparent; }
.rpane .task, .task-group .task { border-color: var(--line); margin-bottom: 4px; }
.task:hover { border-color: var(--line-2); }
.task .task-check { margin-top: 3px; width: 16px; height: 16px; cursor: pointer; }
.task-title { font-size: 14px; }
.task.done .task-title { text-decoration: line-through; color: var(--ink-3); }
.task.late .task-title { color: var(--danger); font-weight: 500; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.task-meta input[type=date], .task-meta select { width: auto !important; min-height: 0 !important; padding: 1px 6px !important; font-size: 12px !important; border-color: var(--line) !important; background: transparent !important; }
.task .task-del { opacity: 0; }
.task:hover .task-del, .task:focus-within .task-del { opacity: 1; }
.empty, .task-list .empty, .quote-list .empty, .attn-list .empty, .meet-list .empty, .contact-list .empty { padding: 10px 2px; color: var(--ink-3); font-size: 13px; }
.task-group { margin-bottom: 18px; }
.task-group h3 { font-size: 13.5px; margin: 0 0 8px; display: flex; gap: 8px; align-items: baseline; }
.task-group.warn h3 { color: var(--danger); }

/* Archivos */
.quote { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); margin-bottom: 4px; }
.quote-main { min-width: 0; display: grid; gap: 2px; }
.quote-title { font-weight: 600; color: var(--ink); text-decoration: none; margin-left: 4px; }
.quote-title:hover { color: var(--accent-text); text-decoration: underline; }
.quote-actions { display: flex; align-items: center; gap: 2px; }
.quote-status { width: auto !important; min-height: 0 !important; padding: 2px 8px !important; font-size: 12px !important; font-weight: 500; border-radius: 99px !important; }
.status-enviada { color: var(--accent-text); background: var(--accent-soft) !important; border-color: transparent !important; }
.status-aceptada { color: var(--ok); background: var(--ok-soft) !important; border-color: transparent !important; }
.status-rechazada { color: var(--danger); background: var(--danger-soft) !important; border-color: transparent !important; }
.quote-form { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; }
.file-drop { position: relative; border: 1.5px dashed var(--line-2); border-radius: var(--r-md); padding: 18px; text-align: center; color: var(--ink-2); cursor: pointer; font-weight: 500; background: var(--surface-2); }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop.over, .file-drop:hover { border-color: var(--accent); color: var(--accent-text); }
.file-drop.has-file { border-style: solid; border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }

/* Contactos en la ficha */
.contact { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 7px 6px; border-radius: var(--r-md); }
.contact:hover { background: var(--surface-2); }
.contact.is-dm { background: color-mix(in srgb, var(--gold) 9%, var(--surface)); }
.contact-main { min-width: 0; }
.contact-main strong { font-weight: 600; }
.contact-main .task-meta span { overflow: hidden; text-overflow: ellipsis; }
.contact .quote-actions .icon-btn { padding: 4px; }
.star { border: 0; background: none; cursor: pointer; font-size: 16px; color: var(--line-2); padding: 0 2px; line-height: 1; }
.star:hover, .star.on { color: var(--gold); }
.contact-form { display: grid; grid-template-columns: 1fr; gap: 6px; }
.contact-form button { justify-self: end; }
#contactToggle { justify-self: start; }

/* Emails */
.mail-items { list-style: none; padding: 0; margin: 0; display: grid; }
.rpane .mail-items { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.mail { display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mail:last-child { border-bottom: 0; }
.mail:hover { background: var(--surface-2); }
.mail.selected { background: var(--accent-soft); }
.mail-dir { color: var(--ink-3); font-size: 13px; padding-top: 1px; }
.mail.out .mail-dir { color: var(--accent-text); }
.mail-main { min-width: 0; display: grid; gap: 1px; }
.mail-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.mail-top .meta { white-space: nowrap; flex: none; }
.mail-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.mail.unread .mail-who, .mail.unread .mail-subject { font-weight: 700; color: var(--ink); }
.mail.unread .mail-dir::after { content: "•"; color: var(--accent); margin-left: 2px; }
.mail-subject { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-snippet { color: var(--ink-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-full { margin-top: 8px; cursor: auto; }
.mail-head { line-height: 1.6; margin-bottom: 6px; }
.mail-body { white-space: pre-wrap; word-wrap: break-word; font: 13.5px/1.6 var(--font); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; margin: 0 0 8px; max-height: 440px; overflow: auto; }
.mail-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mail-actions a { text-decoration: none; }
.sugg { font-size: 12px; color: var(--accent-text); }

/* Bandeja */
.inbox { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 16px; align-items: start; }
.inbox-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.inbox-tools { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); gap: 8px; }
.inbox-hint { margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.inbox-hint:empty { display: none; }
.inbox-list .mail-items { max-height: calc(100vh - 230px); overflow-y: auto; }
.inbox-reader { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; min-height: 320px; position: sticky; top: 84px; }
.inbox-reader .empty-state { border: 0; }
.reader h2 { font-size: 18px; margin: 0 0 12px; }
.link-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.link-bar select { width: auto !important; min-width: 200px; flex: 1; }

/* Reuniones */
.meet { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 9px 10px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); margin-bottom: 4px; }
.panel .meet { border-color: transparent; padding: 7px 4px; margin: 0; }
.panel .meet:hover { background: var(--surface-2); }
.meet-date { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); border-radius: var(--r-md); padding: 4px 0; line-height: 1.1; }
.meet-date span { font-size: 17px; font-weight: 700; }
.meet-date small { font-size: 10.5px; }
.meet.past .meet-date { background: var(--surface-3); color: var(--ink-3); }
.meet.cancelled strong { text-decoration: line-through; color: var(--ink-3); }
.meet .task-meta a { color: var(--accent-text); font-weight: 600; }

/* Calendario */
.cal-tools h2 { flex: 1; }
.cal-legend { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: 8px; }
.dot.d-meet { background: var(--viz-1); }
.dot.d-task { background: var(--warn); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.cal-day { border-left: 1px solid var(--line); min-height: 280px; display: flex; flex-direction: column; }
.cal-day:first-child { border-left: 0; }
.cal-day.past { background: var(--surface-2); }
.cal-day header { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.cal-day.today header { box-shadow: inset 0 3px 0 var(--accent); }
.cal-dow { font-size: 12px; color: var(--ink-3); text-transform: capitalize; }
.cal-num { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-day.today .cal-num { color: var(--accent-text); }
.cal-items { padding: 6px; display: grid; gap: 5px; align-content: start; }
.cal-meet, .cal-task { border: 0; text-align: left; cursor: pointer; border-radius: var(--r-sm); padding: 6px 8px; display: grid; gap: 1px; font: inherit; }
.cal-meet { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--viz-1); }
.cal-meet.cancelled { opacity: .5; text-decoration: line-through; }
.cal-time { font-size: 11.5px; font-weight: 600; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.cal-mt { font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.cal-client { font-size: 11.5px; color: var(--ink-3); }
.cal-task { background: var(--warn-soft); color: var(--warn); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* ---------- Mi día ---------- */
.today-hello { margin: 0 0 14px; color: var(--ink-2); }
.today-hello::first-letter { text-transform: uppercase; }
.today-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.today-col { display: grid; gap: 16px; }
.attn-list li { padding: 9px 2px; border-bottom: 1px solid var(--line); display: grid; gap: 3px; }
.attn-list li:last-child { border-bottom: 0; }
.why { display: flex; flex-wrap: wrap; gap: 4px; }
.why span { font-size: 11.5px; color: var(--warn); background: var(--warn-soft); border-radius: 4px; padding: 0 7px; }
.forecast { width: 100%; border-collapse: collapse; font-size: 13px; }
.forecast th, .forecast td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.forecast th { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.forecast .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.forecast tr.past td { color: var(--danger); }
.forecast tr.muted-row td { color: var(--ink-3); }
.bar-cell { width: 22%; }
.bar { display: block; height: 8px; border-radius: 4px; background: var(--viz-1); min-width: 2px; }
.panel.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.feed li { display: grid; grid-template-columns: 22px 1fr; gap: 6px; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.feed li:last-child { border-bottom: 0; }
.feed-ico { color: var(--ink-3); text-align: center; }
.feed-body { color: var(--ink-2); }

/* ---------- Cuadro de situación ---------- */
.dash { display: grid; gap: 16px; }
.hero-band { border: 1px solid var(--line); display: grid; grid-template-columns: minmax(280px, 1.15fr) 2fr; background: var(--sb-bg); color: #dbe7eb; border-radius: var(--r-lg); overflow: hidden; }
.hero-main { padding: 22px 26px; display: grid; gap: 4px; align-content: center; }
.hero-l { font-size: 13px; color: #8fb0bb; }
.hero-v { font-size: 44px; font-weight: 600; letter-spacing: -.02em; line-height: 1.05; color: #fff; }
.hero-n { font-size: 13px; color: #a9c1c9; }
.hero-meter { height: 6px; background: rgba(255, 255, 255, .1); border-radius: 3px; overflow: hidden; margin-top: 10px; max-width: 360px; }
.hero-meter span { display: block; height: 100%; background: #34c3a9; border-radius: 3px; }
.hero-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-left: 1px solid rgba(255, 255, 255, .08); }
.kpi { padding: 20px 18px; border-left: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 2px; align-content: center; }
.kpi:first-child { border-left: 0; }
.kpi-l { font-size: 12.5px; color: #8fb0bb; }
.kpi-v { font-size: 22px; font-weight: 600; color: #fff; }
.kpi-n { font-size: 12px; color: #86a3ad; }
.kpi.warn .kpi-v { color: #ffb38a; }
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.span-7 { grid-column: span 7; }
.span-5 { grid-column: span 5; }
.legend { display: inline-flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.pond, .sw.s1 { background: var(--viz-1); }
.sw.gross { background: var(--viz-1-soft); }
.sw.s2 { background: var(--viz-2); }
.funnel { display: grid; gap: 10px; }
.fn-row { display: grid; grid-template-columns: 170px 1fr 150px; gap: 14px; align-items: center; outline-offset: 2px; border-radius: 4px; }
.fn-label { display: grid; line-height: 1.3; }
.fn-label span:first-child { font-weight: 500; }
.fn-track { position: relative; height: 22px; background: var(--surface-2); border-radius: 4px; }
.fn-gross, .fn-pond { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.fn-gross { background: var(--viz-1-soft); }
.fn-pond { background: var(--viz-1); box-shadow: 2px 0 0 var(--surface); }
.fn-val { display: grid; text-align: right; line-height: 1.3; }
.forecast-chart svg { display: block; height: 200px; overflow: visible; }
.forecast-chart .axis { stroke: var(--line-2); stroke-width: 1; }
.forecast-chart .hit { fill: transparent; }
.forecast-chart .fc-col:hover .hit, .forecast-chart .fc-col:focus .hit { fill: var(--surface-2); }
.forecast-chart .fc-col { outline: none; }
.forecast-chart .fc-gross { fill: var(--viz-1-soft); }
.forecast-chart .fc-pond { fill: var(--viz-1); }
.forecast-chart .late .fc-pond { fill: var(--danger); }
.forecast-chart .late .fc-gross { fill: var(--danger-soft); }
.forecast-chart .fc-val { font-size: 11.5px; fill: var(--ink-2); font-weight: 600; font-family: var(--font); }
.forecast-chart .fc-lab { font-size: 12px; fill: var(--ink-3); font-family: var(--font); text-transform: capitalize; }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; }
.alert { display: grid; grid-template-columns: 78px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: start; }
.alert:last-child { border-bottom: 0; }
.sev { justify-content: center; margin-top: 1px; }
.sev-3 .sev { background: var(--danger-soft); color: var(--danger); }
.sev-2 .sev { background: var(--warn-soft); color: var(--warn); }
.sev-1 .sev { background: var(--surface-3); color: var(--ink-2); }
.alert-t { font-size: 13px; color: var(--ink-2); }
.act-bars { display: grid; gap: 12px; }
.ab-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; }
.ab-label { font-size: 13px; color: var(--ink-2); }
.ab-bars { display: grid; gap: 3px; }
.ab-bar { display: grid; grid-template-columns: 1fr 28px; align-items: center; gap: 8px; border-radius: 3px; outline-offset: 2px; }
.ab-bar span { display: block; height: 10px; border-radius: 0 4px 4px 0; min-width: 2px; }
.ab-bar.s1 span { background: var(--viz-1); }
.ab-bar.s2 span { background: var(--viz-2); }
.ab-bar em { font-style: normal; font-size: 12px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.src { display: grid; gap: 10px; }
.src-row { display: grid; grid-template-columns: 120px 1fr 92px; gap: 4px 10px; align-items: center; border-radius: 4px; outline-offset: 2px; }
.src-row .src-n { grid-column: 2 / -1; }
.src-l { font-size: 13px; }
.src-track { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.src-track span { display: block; height: 100%; background: var(--viz-1); border-radius: 0 4px 4px 0; }
.src-row.muted .src-track span { background: var(--line-2); }
.src-v { text-align: right; font-size: 13px; font-weight: 600; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--surface); font-size: 12.5px; padding: 6px 10px; border-radius: var(--r-sm); max-width: 300px; box-shadow: var(--shadow-pop); }

/* ---------- Contactos / archivos ---------- */
.contacts-tools input[type=search] { width: auto; flex: 1; min-width: 220px; }
.co-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.co-cols h3, .small-h { font-size: 13.5px; margin: 0; }
.block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }

/* ---------- Modales ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(8, 14, 18, .42); z-index: 40; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--r-lg); width: min(620px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-pop); margin: 0; }
.modal-wide { width: min(780px, 100%); }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal h2 { font-size: 16.5px; font-weight: 600; flex: 1; }
.modal-body { padding: 16px 18px; overflow-y: auto; display: grid; gap: 12px; }
.modal-body section { display: grid; gap: 10px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.modal-foot .form-error { margin-right: auto; }
.tabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 10px 9px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.pane-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.sig-preview { background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: var(--r-md); padding: 8px 12px; }
.sig-preview pre { margin: 4px 0 0; font: 13px/1.5 var(--font); white-space: pre-wrap; }
.status-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; display: grid; gap: 6px; }
.status-card.ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.status-card.err { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
.mail-form { display: grid; gap: 10px; }
.mail-form details { display: grid; gap: 8px; }
.privacy-note { font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border-radius: var(--r-md); padding: 10px 12px; }
.copy-row { display: flex; gap: 6px; }
.copy-row input { font-size: 12.5px; }
.howto { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.tpl-editor { display: grid; grid-template-columns: 200px 1fr; gap: 12px; }
.tpl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; align-content: start; }
.tpl-item { width: 100%; text-align: left; border: 0; background: none; padding: 7px 9px; border-radius: var(--r-sm); cursor: pointer; color: var(--ink-2); }
.tpl-item:hover { background: var(--surface-2); }
.tpl-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.tpl-form { display: grid; gap: 8px; }
.quoted summary { cursor: pointer; font-size: 12px; color: var(--ink-3); }
.quoted pre { white-space: pre-wrap; font: 12px/1.5 var(--font); color: var(--ink-3); max-height: 160px; overflow: auto; border-left: 2px solid var(--line-2); padding-left: 10px; }
#mBody { font: 14px/1.6 var(--font); }
.stages-table { width: 100%; border-collapse: collapse; }
.stages-table th { font-size: 12px; color: var(--ink-3); font-weight: 500; text-align: left; padding: 4px; }
.stages-table td { padding: 4px; }
.stages-table .pct { width: 76px; }
.stages-table .move { white-space: nowrap; }
.stages-table .num { text-align: right; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(16px); background: var(--ink); color: var(--surface); padding: 9px 16px; border-radius: var(--r-md); font-size: 13.5px; opacity: 0; transition: .2s; pointer-events: none; z-index: 60; box-shadow: var(--shadow-pop); }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .hero-band { grid-template-columns: 1fr; }
  .hero-kpis { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .08); }
}
@media (max-width: 1100px) {
  .span-7, .span-5 { grid-column: 1 / -1; }
  .rec-body { grid-template-columns: 300px 1fr; }
  .rec-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rec-facts .fact:nth-child(n+4) { display: none; }
  .gsearch { width: 260px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .gsearch { order: 3; width: 100%; }
  .gsearch kbd { display: none; }
  main { padding: 14px 16px 40px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .today-grid, .inbox { grid-template-columns: 1fr; }
  .inbox-reader { position: static; }
  .drawer { overflow-y: auto; }
  .rec-body { grid-template-columns: 1fr; flex: none; }
  .rec-about, .rec-main { overflow: visible; }
  .rec-about { border-right: 0; border-bottom: 1px solid var(--line); }
  .hero-kpis { grid-template-columns: 1fr 1fr; }
  .kpi { border-top: 1px solid rgba(255, 255, 255, .08); }
  .kpi:nth-child(odd) { border-left: 0; }
  .fn-row { grid-template-columns: 1fr; gap: 4px; }
  .fn-val { text-align: left; grid-auto-flow: column; justify-content: start; gap: 8px; }
  .ab-row { grid-template-columns: 1fr; gap: 4px; }
  .cal-grid { grid-template-columns: 1fr 1fr; }
  .cal-day { min-height: 0; border-top: 1px solid var(--line); }
  .task-form { grid-template-columns: 1fr 1fr; }
  .task-form #taskTitle { grid-column: 1 / -1; }
  .co-cols, .tpl-editor, .grid3 { grid-template-columns: 1fr; }
  .board { grid-auto-columns: 84%; scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .list table { min-width: 760px; }
  .step-pct { display: none; }
  .stepper { overflow-x: auto; }
  .step { min-width: 92px; }
}
@media (max-width: 560px) {
  .page-title h1 { font-size: 18px; }
  .hero-v { font-size: 34px; }
  .rec-head { flex-wrap: wrap; }
  .outcome { width: 100%; }
  .rec-facts { grid-template-columns: 1fr 1fr; }
  .rec-facts .fact:nth-child(3) { border-left: 0; }
  .grid2 { grid-template-columns: 1fr; }
}

.table-wrap { overflow-x: auto; margin: 0 -2px; }
.table-wrap .dtable { min-width: 560px; }
.list td { max-width: 280px; }

/* ---------- v7: ejecución, cobros, motivos de pérdida, resumen semanal ---------- */
.sidebar .count.warn:not(:empty) { background: var(--danger); color: #fff; }
.rcount.warn:not(:empty) { background: var(--danger-soft); color: var(--danger); }
.kpi.warn .kpi-v { color: var(--danger); }
.mini-meter.wide { width: 72px; }

.exec-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); margin-bottom: 18px; }
.exec-sum > .meta { grid-column: 1 / -1; padding: 14px 16px; margin: 0; line-height: 1.5; }
.exec-sum .fact { padding: 10px 14px; }
.exec-sum .fact:first-child { border-left: 0; }
.exec-sum .mini-meter { margin-top: 6px; }
.exec-block { margin-bottom: 22px; }
.exec-block h3 { font-size: 13.5px; margin: 0; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.inline-form input { flex: 1 1 140px; min-width: 0; }
.inline-form input[type=date] { flex: 0 0 150px; }
.inline-form input[type=number] { flex: 0 1 120px; }

.ms-list, .plan-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.ms-list .empty, .plan-list .empty { padding: 6px 0; }
.ms { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start; padding: 9px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.ms-check { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; padding: 0; margin-top: 1px; }
.ms-check:hover { border-color: var(--accent); }
.ms.completado .ms-check { background: var(--accent); border-color: var(--accent); }
.ms.completado .ms-title { color: var(--ink-3); text-decoration: line-through; }
.ms.en_curso .ms-check { border-color: var(--viz-1); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 10px var(--viz-1); }
.ms-title { font-weight: 500; }
.ms .task-meta input, .ms .task-meta select { height: 26px; font-size: 12px; padding: 0 6px; width: auto; }

.plan { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.plan.inactive { opacity: .62; }
.plan .quote-actions { flex-shrink: 0; }
.kind-tag.k-mensual { background: var(--accent-soft); color: var(--accent-text); }
.kind-tag.k-cuotas { background: color-mix(in srgb, var(--viz-2) 14%, var(--surface)); color: color-mix(in srgb, var(--viz-2) 85%, var(--ink)); }
.kind-tag.k-unico { background: var(--surface-3); color: var(--ink-2); }
#planForm { margin-top: 8px; }
#planForm .seg { justify-self: start; }

.ch-table, #executionTable table { width: 100%; }
.ch-table select, .ch-table input, #executionTable select, #executionTable input { height: 28px; font-size: 12.5px; padding: 0 6px; width: 100%; min-width: 92px; }
.ch-status.st-cobrado { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.ch-status.st-facturado { color: var(--accent-text); background: var(--accent-soft); border-color: transparent; }
.ch-status.st-anulado { color: var(--ink-3); }
tr.late td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
tr.total td { border-top: 1px solid var(--line-2); background: var(--surface-2); }
#executionTable tbody tr[data-id] { cursor: pointer; }
#executionTable .late-tag { margin-left: 4px; }
.exec-metrics { margin-bottom: 14px; }

.reason-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reason { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; background: var(--surface); font-size: 13px; }
.reason:hover { border-color: var(--line-2); background: var(--surface-2); }
.reason input { margin: 0; accent-color: var(--accent); width: auto; height: auto; }
.reason:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

.digest-box { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); display: grid; gap: 8px; }
.digest-box .meta { margin: 0; line-height: 1.5; }

.sw.cash-paid { background: var(--viz-1); }
.sw.cash-exp { background: var(--viz-1-soft); }
.forecast-chart .c-paid { fill: var(--viz-1); }
.forecast-chart .c-exp { fill: var(--viz-1-soft); }
.lost-row .src-track span { background: var(--viz-2); }

@media (max-width: 900px) {
  .exec-sum { grid-template-columns: 1fr 1fr; }
  .exec-sum .fact:nth-child(3) { border-left: 0; }
  .exec-sum .fact:nth-child(n+3) { border-top: 1px solid var(--line); }
  .plan { flex-direction: column; align-items: stretch; }
}
@media (max-width: 560px) { .reason-grid { grid-template-columns: 1fr; } }
.lost-row { grid-template-columns: 170px 1fr 40px; }

.hero-kpis .kpi:nth-child(n+5) { border-top: 1px solid rgba(255, 255, 255, .08); }
.hero-kpis .kpi { padding: 16px 18px; }

/* ---------- v8: horas ---------- */
.exec-sum.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.exec-sum .fact-v small { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.mini-meter.over span { background: var(--danger); }
.over-txt { color: var(--danger); font-weight: 600; }
.toolbar-spacer { flex: 1; }
.month-nav { display: inline-flex; align-items: center; gap: 6px; }
.month-nav strong { min-width: 150px; text-align: center; font-weight: 600; text-transform: capitalize; }
.month-nav .icon-btn { font-size: 18px; line-height: 1; }
.metric-split { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; font-weight: 400; color: var(--ink-2); }
.metric-split strong { color: var(--ink); font-size: 18px; font-weight: 600; }
.sub-h { font-size: 13.5px; margin: 22px 0 8px; }

.time-inline { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.time-inline input { width: 70px; height: 28px; padding: 0 8px; font-size: 13px; }
.time-inline select { height: 28px; font-size: 12.5px; padding: 0 6px; width: auto; }
.time-inline .meta { font-size: 12px; }
.hours-chip { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 4px; font-size: 11.5px; font-weight: 600; background: var(--accent-soft); color: var(--accent-text); vertical-align: 1px; }
.phase-divider { list-style: none; display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; color: var(--ok); font-size: 12px; font-weight: 600; }
.phase-divider::before, .phase-divider::after { content: ''; flex: 1; height: 1px; background: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.phase-divider span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hours-months { margin: 8px 0 4px; }
.hm-grid { display: grid; gap: 6px; }
.hm-row { display: grid; grid-template-columns: 38px 1fr 86px; gap: 10px; align-items: center; font-size: 12.5px; border-radius: 4px; }
.hm-l { color: var(--ink-3); text-transform: capitalize; }
.hm-track { position: relative; height: 10px; background: var(--surface-2); border-radius: 4px; }
.hm-fill { display: block; height: 100%; background: var(--viz-1); border-radius: 0 4px 4px 0; }
.hm-row.over .hm-fill { background: var(--danger); }
.hm-cap { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 1px; transform: translateX(-1px); }
.hm-v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.hm-v small { font-weight: 400; color: var(--ink-3); }
.hm-legend { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 12px; }
.hm-cap-k { display: inline-block; width: 2px; height: 12px; background: var(--ink); }

.hours-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.hours-list .empty { padding: 4px 0; line-height: 1.5; }
.hours-item { display: grid; grid-template-columns: 54px 1fr auto auto; gap: 10px; align-items: start; padding: 9px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.hi-date { font-size: 12px; color: var(--ink-3); padding-top: 2px; font-variant-numeric: tabular-nums; }
.hi-h { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hi-act { display: flex; gap: 2px; }
.hi-act .icon-btn { width: 26px; height: 26px; font-size: 13px; }
@media (max-width: 900px) {
  .exec-sum.five { grid-template-columns: 1fr 1fr; }
  .exec-sum.five .fact:nth-child(5) { border-left: 0; border-top: 1px solid var(--line); }
  .time-inline .meta { display: none; }
}
.composer .time-inline label { display: inline; font-size: 12.5px; }
.composer .time-inline input { width: 72px; flex: none; }
.composer .time-inline select { width: auto; flex: none; }
.composer .note-actions { gap: 10px; flex-wrap: wrap; }
.month-nav strong { text-transform: none; }
#noteHours { width: 72px; height: 30px; }
#noteCat { width: auto; height: 30px; }

/* ---------- v9: cronómetro (ver v12: dock) ---------- */
.stop-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.stop-head strong { font-size: 15px; }
.stop-time { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.play-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--accent); display: inline-grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.play-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.play-btn svg { width: 14px; height: 14px; fill: currentColor; }
.play-btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- v9: ficha de proyecto ---------- */
.proj-only { display: none !important; }
.drawer.project .proj-only { display: inline-flex !important; }
.drawer.project .opp-only, .drawer.project .stepper, .drawer.project #wonBtn, .drawer.project #lostBtn { display: none !important; }
.drawer.project .rec-facts { border-top: 0; }
.proj-pill { background: var(--accent-soft); color: var(--accent-text); margin-right: 4px; }
.stage-meta .link { font-size: inherit; }
.sale-hidden { display: none !important; }
.phase-divider button { font-size: 12px; font-weight: 500; white-space: nowrap; }
.proj-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; }
.timeline.compact .note-body { font-size: 13.5px; }
.timeline.compact .note { padding-bottom: 8px; }
.plan.slim { padding: 8px 12px; font-size: 13.5px; }
.plan.slim.late { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.rec-tabs { overflow-x: auto; scrollbar-width: thin; }
@media (max-width: 900px) { .proj-grid { grid-template-columns: 1fr; } }

/* ---------- v9: Mi día ---------- */
.today { max-width: 820px; }
.day-head { margin: 4px 0 18px; }
.day-date { margin: 0; font-size: 24px; font-weight: 600; }
.day-line { margin: 4px 0 0; font-size: 14.5px; color: var(--ink-2); }
.day-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 26px 0 10px; }
.day-h small { font-weight: 400; color: var(--ink-3); }
.day-h span { font-weight: 400; color: var(--ink-3); }
.day-h.warn { color: var(--danger); }
.day-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.day-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 13px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.day-item.meeting, .day-item.pending { grid-template-columns: 52px minmax(0, 1fr) auto; }
.day-item.nonext { grid-template-columns: minmax(0, 1fr) auto; }
.day-item.late { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.day-item.pending { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); background: var(--warn-soft); }
.day-item .task-check { width: 22px; height: 22px; margin: 0; }
.di-time { font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.di-title { font-size: 15px; }
.di-sub { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.di-sub .client { font-weight: 500; }
.day-quiet { font-size: 14px; color: var(--ink-3); padding: 14px 18px; border: 1px dashed var(--line-2); border-radius: 10px; margin: 0; }
@media (max-width: 560px) {
  .day-item { padding: 11px 12px; gap: 10px; }
  .di-title { font-size: 14.5px; }
  .play-btn { width: 44px; height: 44px; }
}
.drawer.project .exec-sum { display: none; }

/* ---------- v9b: barra lateral plegable + bandeja sin desborde ---------- */
.inbox { grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); }
.inbox-list, .inbox-reader { min-width: 0; }
.inbox-reader { overflow: hidden; }
.mail-body, .reader, .mail-full { overflow-wrap: anywhere; word-break: break-word; }
.link-bar { flex-wrap: wrap; }
.mail-items .mail-item, .mail-items li { min-width: 0; }
.sidebar { transition: width .15s ease; }
@media (min-width: 901px) {
  .shell.sb-collapsed { grid-template-columns: 64px 1fr; }
  .shell.sb-collapsed > .main-col { grid-column: 2; }
  .shell.sb-collapsed:not(.sb-peek) .sidebar { width: 64px; overflow: hidden; }
  .shell.sb-collapsed:not(.sb-peek) .sidebar .sb-sub,
  .shell.sb-collapsed:not(.sb-peek) .sidebar .sb-label,
  .shell.sb-collapsed:not(.sb-peek) .sidebar .view-btn > span:not(.count),
  .shell.sb-collapsed:not(.sb-peek) .sidebar .sb-link > span,
  .shell.sb-collapsed:not(.sb-peek) .sidebar .sb-user-name { display: none; }
  .shell.sb-collapsed:not(.sb-peek) .sidebar .sb-group + .sb-group, .shell.sb-collapsed:not(.sb-peek) .sidebar .sb-label + .sb-group { margin-top: 14px; }
  .shell.sb-collapsed:not(.sb-peek) .sidebar .view-btn,
  .shell.sb-collapsed:not(.sb-peek) .sidebar .sb-link,
  .shell.sb-collapsed:not(.sb-peek) .sidebar .sb-user { justify-content: center; padding: 10px 0; position: relative; }
  .shell.sb-collapsed:not(.sb-peek) .sidebar .count { position: absolute; top: 4px; right: 8px; margin: 0; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; line-height: 16px; }
  .shell.sb-collapsed:not(.sb-peek) .sidebar .sb-brand { justify-content: center; padding: 6px 0 14px; }
}

/* ---------- v10: app instalable ---------- */
.pwa-hint { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.pwa-hint span { flex: 1; }
.pwa-hint .icon-btn { color: var(--accent-text); }
@media (display-mode: standalone) {
  .sidebar { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
  .topbar { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
}

/* ---------- v10b: tablas como tarjetas en el celular ---------- */
@media (max-width: 900px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox-list .mail-items { max-height: 40vh; }
}
@media (max-width: 700px) {
  .list table, .table-wrap .dtable { display: block; min-width: 0; border: 0; background: transparent; }
  .list thead, .table-wrap .dtable thead { display: none; }
  .list tbody, .table-wrap .dtable tbody { display: grid; gap: 8px; }
  .list tbody tr, .table-wrap .dtable tbody tr { display: grid; grid-template-columns: 1fr; gap: 2px 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
  .list tbody tr.total { background: var(--surface-2); }
  .list td, .table-wrap .dtable td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0; border: 0; max-width: none; text-align: left !important; }
  .list td[data-label]::before, .table-wrap .dtable td[data-label]::before { content: attr(data-label); font-size: 12px; color: var(--ink-3); flex: 0 0 auto; }
  .list td:first-child, .table-wrap .dtable td:first-child { display: block; font-size: 15px; padding-bottom: 6px; }
  .list td:first-child::before, .table-wrap .dtable td:first-child::before { display: none; }
  .list td.is-empty:not(:first-child), .list td.no-label:empty { display: none; }
  .list td.span-all { display: block; }
  .list td br { display: none; }
  .list td .meta { margin-left: 6px; }
  .list td select, .list td input { width: auto; max-width: 60%; }
  .list td .mini-meter { margin: 0; }
  .list tr.late td:first-child { box-shadow: none; }
  .list tr.late { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
  .ch-table { margin-top: 8px; }
  .sub-h { margin-top: 18px; }
}

/* ---------- v11: sin conexión ---------- */
.net-chip { font: inherit; font-size: 12px; font-weight: 500; border-radius: 99px; padding: 3px 10px; border: 1px solid transparent; cursor: pointer; white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.net-chip.off { background: rgba(255, 255, 255, .1); color: #fff; border-color: #3f6b7a; }
.net-chip.sync { background: #e7a24a; color: #15212b; }
.net-chip.bad { background: var(--danger); color: #fff; }
body.is-offline .btn-primary#emailNew, body.is-offline #quoteToggle, body.is-offline #meetingNew { opacity: .5; }
@media (max-width: 900px) { .net-chip { font-size: 11.5px; padding: 2px 8px; } }

/* ---------- v12: cronómetro en el pie de la barra lateral (escritorio) y pastilla flotante (celular) ---------- */
.timer-dock { position: fixed; left: 0; bottom: 0; width: 236px; box-sizing: border-box; background: var(--sb-bg); color: var(--sb-ink); padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid rgba(255, 255, 255, .08); z-index: 13; display: grid; gap: 8px; font-size: 13px; }
.sidebar { padding-bottom: 150px; }
.tb-idle { display: grid; gap: 6px; }
.tb-main { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 40px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.tb-main:hover { background: var(--accent-hover); }
.tb-main svg { width: 14px; height: 14px; fill: currentColor; }
.tb-today { color: var(--sb-ink-2); font-size: 12px; }
.tb-run { display: grid; gap: 8px; }
.tb-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-dot { width: 8px; height: 8px; border-radius: 50%; background: #e7a24a; flex: none; }
.timer-dock.paused .tb-dot { background: var(--sb-ink-2); }
.tb-clock { font-variant-numeric: tabular-nums; font-size: 20px; color: #fff; letter-spacing: .01em; }
.timer-dock.paused .tb-clock { color: var(--sb-ink-2); }
.tb-proj { color: var(--sb-ink); font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; text-align: left; }
.tb-proj:hover { color: #fff; text-decoration: underline; }
.tb-actions { display: grid; grid-template-columns: minmax(84px, 1fr) auto auto; gap: 6px; }
.tb-cat { height: 30px; min-height: 0; padding: 0 6px; font-size: 12px; min-width: 0; background: transparent; color: var(--sb-ink); border-color: #2f5563; border-radius: 8px; }
.tb-cat option { color: var(--ink); background: var(--surface); }
.btn.tb-btn { height: 30px; min-height: 0; font-size: 12.5px; background: transparent; color: #fff; border-color: #2f5563; padding: 0 10px; }
.btn.tb-btn:hover { background: var(--sb-hover); }
.btn.tb-btn.tb-stop { background: #fff; color: var(--ink); border-color: #fff; }
.btn.tb-btn.tb-stop:hover { background: #e6ecef; }
.timer-dock .net-chip { font: inherit; font-size: 12px; font-weight: 500; text-align: left; padding: 0; border: 0; background: transparent; color: #e7a24a; cursor: pointer; white-space: normal; max-width: none; }
.timer-dock .net-chip.off { color: var(--sb-ink); }
.timer-dock .net-chip.bad { color: #f07c6f; }
.tb-pick { position: absolute; left: 10px; right: 10px; bottom: calc(100% + 8px); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 8px; z-index: 30; }
.tb-pick input { margin-bottom: 6px; }
.tb-list { max-height: 50vh; overflow-y: auto; }
.tb-opt { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--ink); text-align: left; border-radius: var(--r-md); cursor: pointer; min-height: 44px; }
.tb-opt:hover, .tb-opt:focus-visible { background: var(--surface-2); }
.tb-opt small { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
/* Selector de empresa (encargo 32): la lista que se abre bajo el campo, con «Crear empresa nueva…» aparte, al final */
.ep-wrap { position: relative; }
.ep-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 6px; z-index: 30; max-height: 280px; overflow-y: auto; font-weight: 400; }
.ep-list .tb-opt.active { background: var(--surface-2); }
.ep-list .tb-opt small { white-space: normal; text-align: right; }
.ep-list .ep-new { border-top: 1px solid var(--line); border-radius: 0 0 var(--r-md) var(--r-md); margin-top: 4px; color: var(--accent-text); font-weight: 500; }
.ep-empty { margin: 0; padding: 8px 12px; }
.stop-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.stop-head strong { font-size: 15px; }
.stop-time { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.play-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--accent); display: inline-grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.play-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.play-btn svg { width: 14px; height: 14px; fill: currentColor; }
.play-btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (min-width: 901px) {
  .shell.sb-collapsed:not(.sb-peek) .timer-dock { width: 64px; padding: 10px 6px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .shell.sb-collapsed:not(.sb-peek) .timer-dock .tb-main span, .shell.sb-collapsed:not(.sb-peek) .timer-dock .tb-today,
  .shell.sb-collapsed:not(.sb-peek) .timer-dock .tb-proj, .shell.sb-collapsed:not(.sb-peek) .timer-dock .tb-actions,
  .shell.sb-collapsed:not(.sb-peek) .timer-dock .net-chip { display: none; }
  .shell.sb-collapsed:not(.sb-peek) .timer-dock .tb-clock { font-size: 12px; }
  .shell.sb-collapsed:not(.sb-peek) .timer-dock .tb-row { justify-content: center; }
  .shell.sb-collapsed:not(.sb-peek) .timer-dock .tb-main { width: 40px; margin: 0 auto; }
}
@media (max-width: 900px) {
  .sidebar { padding-bottom: 24px; }
  main { padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
  .timer-dock { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: auto; border-radius: 16px; border: 0; box-shadow: 0 10px 30px rgba(8, 14, 18, .35); padding: 10px 14px; }
  .tb-idle { grid-template-columns: 1fr auto; align-items: center; }
  .tb-main { height: 44px; }
  .tb-today { text-align: right; max-width: 40%; }
  .tb-run { gap: 6px; }
  .tb-actions { grid-template-columns: 1fr auto auto; }
  .btn.tb-btn { height: 40px; font-size: 14px; }
  .tb-cat { height: 40px; }
  .tb-pick { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); top: auto; max-height: 60vh; display: grid; grid-template-rows: auto 1fr; }
  .tb-list { max-height: none; overflow-y: auto; }
}
@media (max-width: 900px) { .sidebar.open ~ .timer-dock { display: none; } }
@media (max-width: 900px) {
  .tb-main { white-space: nowrap; }
  .tb-today { white-space: nowrap; max-width: none; }
  .tb-today .tt-week { display: none; }
  .tb-idle { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
}

/* ---------- v12: tickets ---------- */
.tk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tk { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.tk:hover { border-color: var(--line-2); }
.tk.closed { opacity: .65; }
.tk-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
/* Encargo 30: selección para resolver o cerrar varios */
.tk.with-sel { grid-template-columns: 18px 10px minmax(0, 1fr) auto; }
.tk-selw { display: flex; align-items: center; justify-content: center; cursor: pointer; }
.tk-sel { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.tk.p-alta .tk-dot { background: var(--warn); }
.tk.p-urgente .tk-dot { background: var(--danger); }
.tk.p-normal .tk-dot { background: var(--viz-1); }
.tk-line { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.tk-key { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: var(--accent-text); background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; flex: none; }
.tk-key.sm { font-size: 10.5px; cursor: pointer; }
.tk-ttl { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-st { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 4px; background: var(--surface-3); color: var(--ink-2); }
.tk-st.st-nuevo { background: color-mix(in srgb, var(--viz-2) 14%, var(--surface)); color: color-mix(in srgb, var(--viz-2) 85%, var(--ink)); }
.tk-st.st-en_curso { background: var(--accent-soft); color: var(--accent-text); }
.tk-st.st-esperando { background: var(--warn-soft); color: var(--warn); }
.tk-st.st-resuelto, .tk-st.st-cerrado { background: var(--ok-soft); color: var(--ok); }
.tk-settings { display: grid; gap: 4px; padding: 10px 14px; margin: 10px 0 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); font-size: 13px; }
.count-inline { font-size: 11px; background: var(--surface); border-radius: 99px; padding: 0 6px; margin-left: 4px; color: var(--ink-2); }
.count-inline:empty { display: none; }
.tk-modal { max-width: 860px; }
.tk-head { gap: 12px; }
.tk-head-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.tk-head .tk-key { font-size: 13px; padding: 3px 8px; }
.tk-title { flex: 1; min-width: 0; font-size: 17px; }
.tk-body { display: grid; gap: 12px; }
.tk-props { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tk-props label { font-size: 12px; }
.tk-props select, .tk-props input { min-height: 34px; padding: 5px 8px; font-size: 13.5px; }
.tk-billable { grid-column: span 2; align-self: end; margin-bottom: 8px; }
.tk-meta { margin: -4px 0 0; }
.tk-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tk-actions .spacer { flex: 1; }
.tk-del { color: var(--danger); }
.tk-tabs { margin: 4px -24px 10px; }
#tkWork.on { background: var(--accent-hover); }
.tk-global .tk-ttl { white-space: normal; }
.day-list + .tk-list, .tk-list + .day-h { margin-top: 0; }
@media (max-width: 700px) {
  .tk-props { grid-template-columns: 1fr 1fr; }
  .tk { grid-template-columns: 10px minmax(0, 1fr) auto; padding: 10px 12px; }
  .tk.with-sel { grid-template-columns: 22px 10px minmax(0, 1fr) auto; }
  .tk-sel { width: 22px; height: 22px; }
  .tk-selw { width: 44px; height: 44px; margin: -11px; } /* 44 px de área táctil */
  .tk-ttl { white-space: normal; }
  .tk-tabs { margin: 4px -16px 10px; }
}
#tkNoteHours { width: 72px; height: 30px; }
#tkNoteCat { width: auto; height: 30px; }
.tk-modal .composer { padding: 10px; }

/* ---------- v13: tareas con ficha ---------- */
.task-title.clickable, .di-title.clickable { cursor: pointer; }
.task-title.clickable:hover, .di-title.clickable:hover { color: var(--accent-text); }
.task-outcome { font-size: 13px; color: var(--ink-2); margin-top: 2px; padding-left: 8px; border-left: 2px solid var(--line-2); }
.task-props { grid-template-columns: 1fr 1fr 1.4fr; align-items: end; }
.task-ctx { display: grid; gap: 4px; font-size: 13px; padding-bottom: 6px; }
.task-check.big { width: 22px; height: 22px; flex: none; }
.done-task { margin: 0 0 4px; font-size: 14.5px; }
@media (max-width: 700px) { .task-props { grid-template-columns: 1fr 1fr; } .task-ctx { grid-column: span 2; } }

/* Fase 1.6: empresas */
/* Selector de empresa arriba del menú (mockup 01): botón con los puntos de color y un menú */
.bu-pick { position: relative; margin: 0 0 10px; }
.bu-btn { display: flex; align-items: center; gap: 9px; width: 100%; border: 1px solid rgba(255, 255, 255, .14); background: #18303a; color: #fff; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; font: inherit; font-size: 13.5px; font-weight: 500; }
.bu-btn:hover { background: var(--sb-hover); }
.bu-btn-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bu-btn svg { width: 16px; height: 16px; color: var(--sb-ink-2); flex: none; }
.bu-dots { display: inline-flex; padding-left: 3px; flex: none; }
.bu-dots .bu-dot { margin-left: -3px; border: 1.5px solid #102027; }
.bu-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--bu); flex: none; }
.bu-menu { left: 0; right: 0; top: calc(100% + 4px); z-index: 30; }
.bu-menu button { display: flex; align-items: center; gap: 9px; width: 100%; }
.bu-menu button.active { font-weight: 600; background: var(--surface-2); }
.bu-menu .bu-dots .bu-dot { border-color: var(--surface); }
/* Etiqueta corta de empresa (KLI, EVT, 12E) con punto de color */
.bu-code { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; line-height: 1.6; padding: 0 7px; border-radius: 4px; background: color-mix(in srgb, var(--bu) 13%, var(--surface)); color: color-mix(in srgb, var(--bu) 80%, var(--ink)); white-space: nowrap; vertical-align: middle; flex: none; }
.bu-code::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--bu); }
/* Filtro por empresa del tablero (chips), solo en "Todas" */
.bu-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bu-chips[hidden] { display: none; }
.bu-chip-f { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 99px; padding: 4px 11px; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; min-height: 30px; }
.bu-chip-f.active { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.bu-chip-f .bu-dot { width: 8px; height: 8px; }
.bu-chip .bu-dot { margin-right: 5px; }
@media (min-width: 901px) {
  .shell.sb-collapsed:not(.sb-peek) .sidebar .bu-btn-name, .shell.sb-collapsed:not(.sb-peek) .sidebar .bu-btn svg { display: none; }
  .shell.sb-collapsed:not(.sb-peek) .sidebar .bu-btn { justify-content: center; padding: 8px 0; }
}
.bu-tag { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 500; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.bu-choices { display: grid; gap: 8px; }
.admin-table select { font-size: 12px; padding: 2px 4px; }
.admin-table td { vertical-align: top; }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.admin-unit { margin: 2px 0; }
.admin-unit-card { border-top: 1px solid var(--line); padding-top: 12px; }
.co-share { border-top: 1px solid var(--line); padding-top: 12px; }

/* ---------- Celular: ajuste de adaptación (rama mobile-ux). En escritorio (más de 900px y mouse) nada de esto aplica ---------- */
.bu-chip, .search-btn, .stage-sel, .card-move { display: none; }
.sidebar { height: 100dvh; }
.dlg-wrap { z-index: 41; }
.dlg-text { margin: 0; color: var(--ink-2); white-space: pre-line; }
.dlg-copy { display: flex; gap: 8px; }
.dlg-copy input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Pantallas táctiles: sin zoom de iOS al tocar un campo (16px mínimo) y áreas de 44px */
@media (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { font-size: 16px !important; }
  #f_client { font-size: 19px !important; }
  .btn, .btn-small, .icon-btn, .tab, .rtab, .seg-btn, .view-btn, .sb-link, .menu button, .tb-cat, .btn.tb-btn { min-height: 44px; }
  .icon-btn, .hi-act .icon-btn { min-width: 44px; width: auto; height: auto; }
  .btn-small { padding: 8px 12px; font-size: 14px; }
  input[type=checkbox] { width: 22px; height: 22px; }
  .toggle { min-height: 44px; }
  .card-move { display: block; margin-top: 2px; min-height: 40px !important; font-size: 15px !important; color: var(--ink-2); background: var(--surface-2); }
}

@media (max-width: 900px) {
  /* Barra superior en un solo renglón: menú, título, empresa, buscar (ícono que se despliega) y Crear */
  .topbar { flex-wrap: nowrap; gap: 6px; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
  .page-title { flex: 1; min-width: 0; margin-right: 0; }
  .page-title h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-title p { display: none; }
  .search-btn { display: inline-grid; }
  .gsearch { display: none; }
  .topbar.searching .gsearch { display: flex; position: absolute; left: 12px; right: 12px; top: calc(6px + env(safe-area-inset-top, 0px)); width: auto; z-index: 3; }
  .topbar.searching .gsearch input { box-shadow: var(--shadow-pop); }
  .bu-chip { display: inline-block; flex: none; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 99px; padding: 4px 10px; font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; min-height: 32px; }
  .bu-chip[hidden] { display: none; }
  #createBtn { padding-left: 10px; padding-right: 12px; }
  #sbPin { display: none; }
  .admin-users .admin-dot { display: none; }
  main { padding-top: 12px; }
  /* Controles segmentados: se desplazan dentro de su caja, la página no se mueve de costado */
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .toolbar { gap: 8px 12px; }
  /* Menú lateral: alto real de la pantalla y el usuario siempre a la vista */
  .sidebar { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
  /* Ventanas: nunca más anchas que la pantalla */
  .modal-wrap { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .modal { max-height: calc(var(--vvh, 100dvh) - 32px); min-width: 0; }
  .modal-body { min-width: 0; }
  /* Cronómetro: se oculta mientras hay una ventana, la ficha o el menú abiertos */
  body:has(.modal-wrap:not([hidden])) .timer-dock, body:has(.drawer.open) .timer-dock { display: none; }
  /* Ficha: encabezado fijo con la etapa en un selector */
  .rec-head { position: sticky; top: 0; z-index: 4; padding: 10px 14px 10px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); border-bottom: 1px solid var(--line); gap: 8px; }
  .drawer-title { font-size: 19px !important; }
  .stage-sel { display: block; margin-top: 6px; max-width: 100%; }
  .stage-meta { font-size: 12px; }
  .stepper { display: none; }
  .drawer.project .stage-sel { display: none; }
  .rec-tabs { top: var(--rh, 0px); margin: 0 -16px 12px; padding: 4px 16px 0; }
  .rec-main { padding: 0 16px 32px; }
  .rec-about { padding: 8px 16px 20px; }
  .fact { padding: 10px 14px; }
  .drawer { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .co-share .contact { grid-template-columns: minmax(0, 1fr) auto; }
}

@media (max-width: 700px) {
  /* Ventanas como hoja inferior; las anchas (perfil, administración, tickets, empresa), a pantalla completa */
  .modal-wrap { place-items: end center; padding: 0; top: var(--vvt, 0px); bottom: auto; height: var(--vvh, 100dvh); }
  .modal { width: 100%; max-height: calc(var(--vvh, 100dvh) - 24px - env(safe-area-inset-top, 0px)); border-radius: 16px 16px 0 0; }
  .modal-wide, .tk-modal { height: calc(var(--vvh, 100dvh) - env(safe-area-inset-top, 0px)); max-height: none; border-radius: 0; }
  .modal > .drawer-head, .modal > .tabs, .modal > .modal-foot { flex: none; }
  .modal > .modal-body { flex: 1; min-height: 0; overscroll-behavior: contain; }
  .modal-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; }
  .modal > .modal-body:last-child { padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .drawer-head { padding: 10px 14px; }
  .modal-body { padding: 14px; }
  .tabs { padding: 0 6px; scrollbar-width: none; flex: none; }

  /* Lista de oportunidades compacta: nombre, cliente y empresa; etapa, monto y próxima acción. El resto, en la ficha */
  #list tbody tr { gap: 0 12px; padding: 10px 12px; }
  #list td:nth-child(2), #list td:nth-child(5), #list td:nth-child(6), #list td:nth-child(7), #list td:nth-child(10), #list td:nth-child(11) { display: none; }
  #list td:first-child { padding-bottom: 4px; }
  #list td:first-child br { display: block; }
  #list td:first-child .meta { display: block; margin: 2px 0 0; }
  #list td:first-child .bu-code { margin-left: 4px; }
  #list td:nth-child(4) br, #list td:nth-child(4) .tag { display: none; }

  /* Administración → Usuarios: una tarjeta por persona */
  .admin-users, .admin-users tbody, .admin-users tr, .admin-users td { display: block; }
  .admin-users thead { display: none; }
  .admin-users tbody { display: grid; gap: 10px; }
  .admin-users tr { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
  .admin-users td { padding: 3px 0; border: 0; }
  .admin-users .admin-unit { margin: 6px 0; }
  .admin-users .admin-unit-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; align-items: center; }
  .admin-users .admin-actions { justify-content: flex-start; padding-top: 8px; }
  .admin-users .admin-state { font-size: 13px; color: var(--ink-2); }

  .admin-unit-card { padding-top: 16px; margin-top: 4px; }
  .admin-unit-card .pane-actions { justify-content: flex-start; }
}
/* Celulares angostos: "Crear" queda como ícono (+) para que el título entre en la barra */
@media (max-width: 420px) {
  #createBtn { font-size: 0; gap: 0; padding: 0; width: 44px; justify-content: center; }
  #createBtn svg { width: 20px; height: 20px; }
}

/* ---------- Celular: barra de navegación inferior y hoja «Más» (reemplazan al menú lateral hasta 900px) ---------- */
.bottom-nav { display: none; }
@media (max-width: 900px) {
  .sidebar, .sb-scrim, .menu-btn { display: none !important; }
  .topbar { padding-left: 16px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 14; background: var(--sb-bg); border-top: 1px solid rgba(255, 255, 255, .08); padding: 4px 4px env(safe-area-inset-bottom, 0px); }
  .bn-btn { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 52px; border: 0; background: transparent; color: var(--sb-ink-2); font: inherit; font-size: 11px; font-weight: 500; cursor: pointer; border-radius: 10px; min-width: 0; padding: 4px 2px; }
  .bn-btn.active { color: #fff; }
  .bn-btn.active .bn-ico { background: var(--sb-active); }
  .bn-btn.active svg { color: #5fd0bb; }
  .bn-ico { position: relative; display: grid; place-items: center; width: 48px; height: 28px; border-radius: 99px; }
  .bn-ico svg { width: 20px; height: 20px; }
  .bn-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; letter-spacing: -.01em; }
  .bottom-nav { padding-left: 2px; padding-right: 2px; }
  .bn-btn { padding: 4px 0; }
  .bn-count { position: absolute; top: -3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; font-size: 10.5px; font-weight: 600; line-height: 18px; text-align: center; background: rgba(255, 255, 255, .16); color: #fff; font-variant-numeric: tabular-nums; }
  .bn-count.unread { background: var(--viz-1); }
  .bn-count.warn { background: var(--danger); }
  /* Se oculta con el teclado abierto y con una ventana o la ficha abiertas */
  body.kbd-open .bottom-nav, body:has(.modal-wrap:not([hidden])) .bottom-nav, body:has(.drawer.open) .bottom-nav { display: none; }
  /* Cronómetro: pastilla compacta justo arriba de la barra */
  .timer-dock { bottom: calc(64px + env(safe-area-inset-bottom, 0px)); left: 10px; right: 10px; padding: 6px 8px 6px 6px; border-radius: 14px; gap: 6px; }
  .tb-main { height: 38px; font-size: 14px; border-radius: 10px; }
  .tb-today { font-size: 12px; }
  body.kbd-open .timer-dock { display: none; }
  main { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
  body.page-locked { overflow: hidden; }
  /* Hoja «Más» */
  .sheet-body { gap: 4px; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .more-group { display: grid; gap: 2px; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .more-group:last-child { border-bottom: 0; }
  .more-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 10px; border: 0; background: transparent; border-radius: var(--r-md); font: inherit; font-size: 15px; color: var(--ink); text-align: left; cursor: pointer; }
  .more-item:hover, .more-item.active { background: var(--surface-2); }
  .more-item svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
  .more-item .avatar { width: 24px; height: 24px; font-size: 10px; }
  .more-item .bn-count { position: static; margin-left: auto; background: var(--surface-3); color: var(--ink-2); }
  .more-item .bn-count.warn { background: var(--danger); color: #fff; }
  .more-logout { color: var(--danger); }
  .more-label { font-size: 12px; color: var(--ink-3); padding: 10px 10px 2px; }
  .more-units { display: grid; gap: 2px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .more-units button { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 10px; border: 0; background: transparent; border-radius: var(--r-md); font: inherit; font-size: 15px; color: var(--ink); text-align: left; cursor: pointer; }
  .more-units button.active { background: var(--surface-2); font-weight: 600; }
  .more-units .bu-dots .bu-dot { border-color: var(--surface); }
}

/* ---------- Fase 2: leads ---------- */
.leads-tools { gap: 10px; }
.lead-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.lead-chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 99px; padding: 4px 12px; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.lead-chip b { font-weight: 500; font-variant-numeric: tabular-nums; margin-left: 2px; }
.lead-chip:hover { border-color: var(--accent); color: var(--accent-text); }
.lead-chip.active { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.lead-chip.quiet:not(.active) { border-style: dashed; color: var(--ink-3); }
.leads-filters input[type=search] { width: auto; min-width: 240px; flex: 1 1 240px; max-width: 360px; }
.leads-filters select { width: auto; }
.lead-st { display: inline-flex; font-size: 11.5px; font-weight: 500; line-height: 1.5; padding: 0 7px; border-radius: 4px; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.lead-st.st-calificado, .lead-st.st-convertido { background: var(--ok-soft); color: var(--ok); }
.lead-st.st-en_conversacion, .lead-st.st-contactado { background: var(--warn-soft); color: var(--warn); }
.lead-st.st-contactado { background: var(--accent-soft); color: var(--accent-text); }
.lead-st.st-no_contactar { background: var(--danger-soft); color: var(--danger); }
.lead-av { width: 24px; height: 24px; font-size: 10px; }
.lead-due.late { color: var(--warn); }
.leads-view .list th { cursor: default; }
.leads-view .list th.chk, .leads-view .list td.chk { width: 36px; padding-right: 0; }
.lead-act { text-align: right; white-space: nowrap; }
.lead-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.lead-bulk select { width: auto; }
.lead-foot { display: flex; align-items: center; gap: 10px; padding: 10px 2px; }
.lead-foot .spacer { flex: 1; }
.lead-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; }
.lead-modal { width: min(720px, 100%); }
.lead-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.lead-form label { display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-3); min-width: 0; }
.lead-form .wide { grid-column: 1 / -1; }
.lead-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lead-actions .spacer { flex: 1; }
.lead-inline { display: flex; gap: 8px; margin: 8px 0; }
.lead-inline input:first-child { flex: 1; min-width: 0; }
.lead-inline select { width: auto; }
@media (max-width: 900px) {
  .lead-chips { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
  .leads-filters input[type=search] { max-width: none; flex-basis: 100%; }
  .leads-filters select { flex: 1 1 40%; min-width: 0; }
  .lead-bulk select { flex: 1 1 40%; }
}
@media (max-width: 700px) {
  .lead-form { grid-template-columns: 1fr; }
  .leads-view .list td.chk { position: absolute; right: 10px; top: 10px; width: auto; }
  .leads-view .list tbody tr { position: relative; }
  .lead-act { text-align: left; }
  .leads-view .list td.lead-name { display: block; font-size: 15px; padding: 0 28px 6px 0; }
  .leads-view .list td.lead-name::before { display: none; }
  .lead-inline { flex-wrap: wrap; }
}

/* Importación de leads por CSV */
.lead-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); font-size: 13.5px; }
.lead-banner svg { width: 16px; height: 16px; flex: none; color: var(--accent-text); }
.lead-banner span:first-of-type { flex: 1; min-width: 0; }
.imp-opts { margin: 14px 0; }
.imp-counts { display: flex; gap: 10px; margin-bottom: 12px; }
.imp-n { flex: 1; background: var(--surface-2); border-radius: var(--r-md); padding: 10px 14px; font-size: 13px; color: var(--ink-2); }
.imp-n b { display: block; font-size: 24px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.imp-n.ok b { color: var(--ok); } .imp-n.bad b { color: var(--danger); }
.imp-list { list-style: none; margin: 4px 0 12px; padding: 0; font-size: 13px; display: grid; gap: 4px; }
#leadImportModal h4 { margin: 12px 0 2px; font-size: 13px; }
#leadImportModal .modal-body { overflow: auto; }
@media (max-width: 700px) { .imp-counts { flex-direction: column; } }

/* Tablero de leads */
.lead-stats { display: grid; gap: 14px; }
.lead-stats .kpis, .lead-block .kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.lead-block { margin-bottom: 14px; }
.lead-stats button.kpi { font: inherit; text-align: left; cursor: pointer; border: 1px solid var(--line); }
.lead-stats button.kpi:hover { border-color: var(--accent); }
.span-12 { grid-column: 1 / -1; }
.lead-stats .src-row { cursor: pointer; grid-template-columns: 130px 1fr 40px; }
.lead-stats [data-stat-owner] { cursor: pointer; }
@media (max-width: 900px) { .lead-stats .kpis, .lead-block .kpis { grid-template-columns: repeat(2, 1fr); } }

.lead-stats button.kpi, .lead-block .kpi { background: var(--surface); color: var(--ink); }
.lead-stats .kpi .kpi-l, .lead-block .kpi .kpi-l { color: var(--ink-3); }
.lead-stats .kpi .kpi-v, .lead-block .kpi .kpi-v { color: var(--ink); }
.lead-stats .kpi.warn .kpi-v, .lead-block .kpi.warn .kpi-v { color: var(--danger); }

/* ---------- Administración a pantalla completa (encargo 01) ---------- */
.admin-view { display: grid; gap: 14px; align-content: start; }
.admin-view > .tabs { padding: 0; }
#adminBody { display: grid; gap: 14px; align-content: start; min-width: 0; }
.admin-table { width: 100%; }
.admin-table select { font-size: 13px; padding: 3px 6px; }
.admin-table td { vertical-align: top; }
.admin-unit-card { border-top: 1px solid var(--line); }
.admin-unit-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* Resumen en palabras (Roles y Usuarios) */
.rl-words-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; }
.rl-words-list li { display: flex; gap: 8px; align-items: baseline; }
.rl-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; transform: translateY(-1px); }
.rl-dot.ok { background: var(--accent); } .rl-dot.info { background: #1d4f91; } .rl-dot.off { background: var(--ink-3); } .rl-dot.warn { background: var(--danger); }
.rl-peek { margin-top: 2px; }
.rl-peek summary { cursor: pointer; color: var(--accent-text); font-size: 12.5px; padding: 2px 0; }
/* Roles: lista a la izquierda, rol elegido a la derecha */
.rl-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.rl-list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.rl-list-head h3 { font-size: 15px; font-weight: 600; }
.rl-list-head .btn svg { width: 14px; height: 14px; }
#rlList { display: grid; gap: 8px; }
.rl-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.rl-item.active { border-color: var(--accent); background: var(--accent-soft); }
.rl-pick { display: grid; gap: 1px; width: 100%; text-align: left; border: 0; background: transparent; padding: 11px 14px; cursor: pointer; }
.rl-pick strong { font-size: 14px; }
.rl-list > .meta { margin-top: 12px; }
.rl-editor { display: grid; gap: 14px; min-width: 0; }
.rl-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; min-width: 0; }
.rl-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.rl-head-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.rl-name { display: grid; gap: 3px; flex: 1 1 220px; font-size: 12.5px; color: var(--ink-3); }
.rl-name input { font-size: 15px; font-weight: 500; }
.rl-actions { display: flex; gap: 8px; }
.rl-words { margin: 14px 0 8px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.rl-dirty { color: var(--warn); font-weight: 500; margin-left: 6px; }
.rl-group { margin: 14px -18px 0; padding: 7px 18px; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.rl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 230px; gap: 14px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rl-row:last-child { border-bottom: 0; }
.rl-mod { display: grid; min-width: 0; }
.rl-scope { min-width: 0; }
.rl-scope .seg { max-width: 100%; }
.seg-btn:disabled { opacity: .45; cursor: not-allowed; }
.rl-lvl .seg-btn.active[data-level="editar"] { background: var(--accent-soft); color: var(--accent-text); }
.rl-lvl .seg-btn.active[data-level="ver"] { background: #e6eefa; color: #1d4f91; }
.rl-check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.rl-check input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.rl-check > span { display: grid; }
@media (max-width: 1100px) { .rl-wrap { grid-template-columns: 250px minmax(0, 1fr); } .rl-row { grid-template-columns: minmax(0, 1fr) auto; } .rl-scope { grid-column: 1 / -1; } }
@media (max-width: 900px) {
  .rl-wrap { grid-template-columns: 1fr; }
  .rl-slot .rl-editor { padding: 0 10px 12px; border-top: 1px solid var(--line); }
  .rl-slot .rl-card { padding: 14px 12px; }
  .rl-slot .rl-group { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
  .rl-row { grid-template-columns: 1fr; gap: 8px; }
  .rl-lvl { display: grid; grid-template-columns: repeat(3, 1fr); }
  .rl-scope .seg { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .rl-actions { width: 100%; } .rl-actions .btn { flex: 1; }
  .admin-users .rl-peek-slot { margin-top: 4px; }
}
@media (max-width: 700px) {
  .rl-head-row { display: grid; }
}

/* ---------- Cliente ganado (encargo 02): leyenda, contrato, abono y estado de cuenta ---------- */
.debt-chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 500; white-space: nowrap; vertical-align: middle; margin-left: 6px; }
.debt-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.debt-chip.con_deuda { background: var(--danger-soft); color: var(--danger); }
.debt-chip.al_dia { background: var(--ok-soft); color: var(--ok); }
.debt-chip.sin_datos { background: var(--surface-3); color: var(--ink-2); }
.co-modal { width: min(1120px, 100%); }
.co-head { gap: 8px; }
.co-head h2 { flex: 0 1 auto; }
.co-legend { flex: 1; display: flex; align-items: center; }
.co-legend .debt-chip { font-size: 12.5px; padding: 2px 10px; }
.co-body { background: var(--canvas); }
.co-resumen { display: grid; gap: 14px; }
.cg-unit { display: grid; gap: 12px; }
.cg-unit-name { font-size: 13px; color: var(--ink-2); margin: 4px 0 0; }
.cg-strip { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); }
.cg-strip strong { font-size: 14px; }
.cg-strip p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.cg-strip.debt { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
.cg-strip.debt strong, .cg-strip.debt .cg-ico { color: var(--danger); }
.cg-strip.ok .cg-ico { color: var(--ok); }
.cg-strip.none .cg-ico { color: var(--ink-3); }
.cg-strip-note { font-size: 12.5px; }
.cg-ico { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.cg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.cg-panel { display: grid; gap: 12px; }
.cg-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cg-head h3 { margin: 0; margin-right: auto; }
.cg-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); }
.cg-file svg { width: 20px; height: 20px; color: var(--accent-text); }
.cg-file.empty { justify-content: space-between; }
.cg-file-main { display: grid; flex: 1; min-width: 0; }
.cg-file-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.cg-facts.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cg-fact { display: grid; min-width: 0; }
.cg-l { font-size: 12.5px; color: var(--ink-3); }
.cg-v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cg-v.late { color: var(--danger); }
.cg-n { font-size: 12.5px; color: var(--ink-3); }
.cg-cover { margin: 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.cg-badge { font-size: 11.5px; padding: 1px 7px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.cg-badge.ok { background: var(--ok-soft); color: var(--ok); }
.cg-badge.late { background: var(--danger-soft); color: var(--danger); }
.cg-hours-l { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.cg-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 6px 0 4px; }
.cg-bar span { display: block; height: 100%; background: var(--accent); }
.cg-bar.over span { background: var(--warn); }
.cg-months { padding-top: 8px; border-top: 1px solid var(--line); }
.cg-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cg-invoices { list-style: none; margin: 0; padding: 0; }
.cg-invoices li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.cg-num { font-variant-numeric: tabular-nums; }
.cg-foot { margin: 0; }
.cg-warn { margin: 0; padding: 8px 10px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.cg-form { display: grid; gap: 10px; }
.cg-search { display: flex; gap: 8px; }
.cg-search input { flex: 1; min-width: 0; }
.cg-sugs { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.cg-sugs li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); }
.cg-sugs li > div { display: grid; min-width: 0; }
.cg-others { margin: 0; }
.d-contract { display: grid; gap: 12px; margin: 12px 0; }
.cg-dlegend { display: flex; align-items: center; gap: 8px; }
.cg-dlegend .debt-chip { margin-left: 0; }
.admin-cobro { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.admin-cobro h4 { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); }
@media (max-width: 900px) {
  .cg-grid { grid-template-columns: 1fr; }
  .cg-facts, .cg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cg-invoices li { grid-template-columns: 1fr auto; }
  .cg-invoices li .meta { grid-column: 1; }
  .co-head { flex-wrap: wrap; }
  .co-legend { order: 3; flex-basis: 100%; }
}
.admin-sync { margin-top: 8px; }
.admin-runs { font-size: 12.5px; margin-top: 6px; }
.avisos-view { display: grid; gap: 12px; }
.av-cola { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.av-msg { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.av-msg p { margin: 6px 0 0; white-space: pre-line; font-size: 13.5px; color: var(--ink-2); }
.av-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-2); }
.cg-badge.warn { background: var(--warn-soft); color: var(--warn); }
.admin-avisos { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; display: grid; gap: 8px; }
.admin-avisos h4 { margin: 0; font-size: 13px; color: var(--ink-2); }
.admin-plazos { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.admin-plazos h4 { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); }
.admin-plazo-actual td { font-weight: 600; }
.admin-lote select { max-width: 280px; }
.tkx-list li { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.tkx-list a { color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tkx-list a:hover { text-decoration: underline; }
.late-txt { color: var(--danger); }
.dz-links { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.dz-link { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; display: grid; gap: 4px; background: var(--surface); }
.dz-link-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.dz-bars { display: flex; align-items: flex-end; gap: 2px; height: 42px; padding-top: 2px; }
.dz-bars span { flex: 1; max-width: 18px; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .85; }
.dz-lib { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dz-lib > li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dz-lib > li.archivado { opacity: .65; }
.dz-lib-main { display: grid; min-width: 0; }
.dz-lib-links { grid-column: 1 / -1; }
.dz-preview img { max-width: 320px; width: 100%; border: 1px solid var(--line); border-radius: var(--r-md); }
.dz-url code { font-size: 12.5px; word-break: break-all; }
.l-dossiers:empty { display: none; }
.l-dossiers { margin-bottom: 12px; }
@media (max-width: 700px) { .dz-lib > li { grid-template-columns: 1fr; } }

/* Mesa de ayuda (encargo 07): conversación del ticket */
.tk-conv { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.tk-msg { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; background: var(--surface); }
.tk-msg.cliente { border-left: 3px solid var(--accent); }
.tk-msg.interno { background: var(--warn-soft, #fdf6e3); border-style: dashed; }
.tk-msg-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.tk-msg-b { white-space: pre-wrap; overflow-wrap: anywhere; }
.tk-review { margin-bottom: 10px; }
.mesa-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
.mesa-grid h4 { margin: 0 0 6px; font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.mesa-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mesa-bars li { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.mesa-rev { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mesa-rev li { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.mesa-rev li > div { display: grid; gap: 2px; min-width: 0; }
.mesa-rev pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; max-height: 240px; overflow: auto; }
@media (max-width: 900px) { .mesa-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Agente (encargo 08) */
.ag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ag-form { display: grid; gap: 8px; margin: 8px 0; }
.ag-form label { display: grid; gap: 4px; }
.ag-wrap { overflow-x: auto; max-width: 100%; }
.ag-act td { vertical-align: top; }
.ag-act code { word-break: break-all; }
.ag-act tr.ag-err td { color: var(--danger); }
.ag-admin { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 12px; }
.ag-admin > li { border-bottom: 1px solid var(--line); padding-bottom: 12px; display: grid; gap: 6px; }
.ag-token { word-break: break-all; font-size: 12.5px; }
.push-prefs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; margin-top: 8px; }
@media (max-width: 700px) { .push-prefs { grid-template-columns: 1fr; } }
.dz-titles { margin: 0 0 10px; padding-left: 20px; columns: 2; font-size: 13px; color: var(--ink-3); }
@media (max-width: 700px) { .dz-titles { columns: 1; } }

/* Empresas en acordeón (encargo 11) */
.adm-acc-tools { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.adm-unit > summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; list-style: none; min-height: 44px; }
.adm-unit > summary::-webkit-details-marker, .adm-sec > summary::-webkit-details-marker { display: none; }
.adm-unit > summary::before, .adm-sec > summary::before { content: '›'; display: inline-block; transition: transform .15s; color: var(--ink-3); }
.adm-unit[open] > summary::before, .adm-sec[open] > summary::before { transform: rotate(90deg); }
.adm-code { color: #fff; font-weight: 700; font-size: 12px; padding: 2px 7px; border-radius: 6px; }
.adm-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.adm-unit[open] .adm-tags { display: none; }
.adm-sec { border-top: 1px solid var(--line); }
.adm-sec > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; min-height: 44px; font-weight: 600; }
.adm-sec-st { font-weight: 400; color: var(--ink-3); font-size: 13px; margin-left: auto; text-align: right; }
.adm-sec-st.warn, .adm-sec.adm-warn > summary > span:first-child::after { color: var(--danger); }
.adm-sec.adm-warn > summary > span:first-child::after { content: ' •'; }
.adm-sec-body { padding: 4px 0 12px; }
.unit-pick { display: grid; gap: 4px; margin-bottom: 10px; }
.unit-pick-slot:empty { display: none; }
.send-as select { margin-left: 6px; max-width: 100%; }

/* Encargo 13: la ficha entra en la pantalla */
.rtab[hidden] { display: none !important; }
.cg-minis { display: grid; gap: 6px; margin: 4px 0 14px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius, 8px); background: var(--surface); }
.cg-mini { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.cg-mini-h { font-weight: 600; }
.cg-bar.mini { display: inline-block; width: 120px; height: 6px; vertical-align: middle; }
.cg-fold { border: 1px solid var(--line); border-radius: var(--radius, 8px); background: var(--surface); }
.cg-fold > summary { cursor: pointer; padding: 10px 14px; list-style: none; }
.cg-fold > summary::-webkit-details-marker { display: none; }
.cg-fold > summary::before { content: '▸'; color: var(--ink-3); margin-right: 4px; }
.cg-fold[open] > summary::before { content: '▾'; }
.cg-fold > .cg-panel { border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0; }
/* Pestañas que no entran a lo ancho: se desplazan de costado con un degradado que avisa que hay más */
.tabs.more-r, .rec-tabs.more-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.tabs.more-l.more-r, .rec-tabs.more-l.more-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
.tabs.more-l:not(.more-r), .rec-tabs.more-l:not(.more-r) { -webkit-mask-image: linear-gradient(to right, transparent, #000 40px); mask-image: linear-gradient(to right, transparent, #000 40px); }
.tabs, .rec-tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar, .rec-tabs::-webkit-scrollbar { display: none; }
/* Indicadores más bajos en pantallas de poca altura */
@media (max-height: 820px) and (min-width: 701px) {
  .fact { padding: 5px 16px; }
  .fact-v { font-size: 15px; }
  .rec-head { padding-top: 10px; padding-bottom: 6px; }
}
/* Encargo 12: Presentaciones, links y seguimiento */
.dz-tabs { margin: 8px 0 12px; }
.dz-lib-actions { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dz-search input { min-width: min(320px, 100%); }
.dz-notes { white-space: pre-wrap; }
.dz-detail { display: grid; gap: 8px; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius, 8px); background: var(--surface); }
.dz-detail h4 { margin: 4px 0 0; }
.dz-slides, .dz-visits { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.dz-slides li { display: grid; grid-template-columns: 2em minmax(0, 1fr) minmax(60px, 160px) auto; gap: 8px; align-items: center; }
.dz-slide-n { color: var(--ink-3); text-align: right; }
.dz-slide-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-slide-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.dz-slide-bar > span { display: block; height: 100%; background: var(--accent); }
.dz-visits li { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.dz-mail { margin-top: 8px; }
.dz-search { flex: 1 1 260px; }
.dz-search input { width: 100%; }
.dz-url code { word-break: break-all; }
@media (max-width: 700px) {
  .dz-slides li { grid-template-columns: 2em minmax(0, 1fr) auto; }
  .dz-slide-t { white-space: normal; }
  .dz-slide-bar { grid-column: 2 / -1; }
}
/* Encargo 10 B: cuentas de Google en Mi perfil y eventos propios de Google en el Calendario (borde punteado: no son reuniones del CRM) */
.g-accs { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 8px; }
.g-accs li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.cal-meet.cal-gev { border: 1px dashed var(--line-2); background: var(--surface); box-shadow: inset 3px 0 0 var(--ink-3); text-decoration: none; color: inherit; }
.g-accs li > div:first-child { min-width: 0; overflow-wrap: anywhere; }

/* ---------- Encargo 15: la ficha como página (oportunidad, proyecto, lead y cliente) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.topbar { z-index: 12; }
.drawer { top: var(--tb-h, 0px); left: 236px; right: 0; bottom: 0; width: auto; height: auto; box-shadow: none; z-index: 11; transform: none; transition: none; overflow-y: auto; display: block; padding: 0 28px 48px; }
.drawer.open { transition: none; }
body:has(.shell.sb-collapsed) .drawer { left: 64px; }
#scrim { display: none !important; }
.rec-back { padding: 14px 0 4px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; }
.back-link:hover { color: var(--ink); text-decoration: underline; }
.rec-head { background: transparent; padding: 0 0 10px; align-items: center; flex-wrap: wrap; }
.rec-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.rec-title-row .drawer-title { width: auto; max-width: 100%; }
.rec-tags { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drawer .stage-sel { display: block; width: auto; min-width: 190px; max-width: 280px; }
.drawer .stepper, .drawer #dContract { display: none !important; }
.drawer .outcome { gap: 8px; flex-wrap: wrap; }
.rec-facts, .drawer.project .rec-facts { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--line); border-radius: 12px; margin: 4px 0 14px; overflow: hidden; }
.rec-facts[hidden] { display: none; }
.rec-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; min-height: 0; flex: none; }
.rec-main { overflow: visible; padding: 0; }
.rec-tabs { position: sticky; top: 0; margin: 0 0 14px; padding: 6px 0 0; background: var(--canvas); z-index: 3; }
.rec-about { border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px 14px; position: sticky; top: 10px; max-height: calc(100vh - var(--tb-h, 0px) - 24px); overflow-y: auto; }
.datos-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 4px 0 8px; border-bottom: 1px solid var(--line); }
.datos-head h2 { margin: 0; font-size: 15px; }
.datos-head .meta { font-size: 12px; }
.datos-tab { display: none !important; }
.drawer:not(.project) .proj-block { display: none; }
/* Datos: se leen como texto; al pasar por encima se ve que se editan, y al tocarlos son campos. Se guardan solos, como antes. */
.rec-about label { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); }
.rec-about .grid2 { grid-template-columns: 1fr; gap: 10px; }
.rec-about .sr-label { display: block; }
#recAbout label input, #recAbout label select, #recAbout label textarea { border-color: transparent; background: transparent; box-shadow: none; padding: 4px 6px; min-height: 32px; color: var(--ink); font-size: 14px; font-weight: 500; }
#recAbout label select { -webkit-appearance: none; appearance: none; background-image: none; cursor: pointer; }
#recAbout label input:hover, #recAbout label select:hover, #recAbout label textarea:hover { border-color: var(--line-2); }
#recAbout label input:focus, #recAbout label select:focus, #recAbout label textarea:focus { border-color: var(--accent); background: var(--surface); }
.rec-about label input::placeholder, .rec-about label textarea::placeholder { color: var(--ink-3); font-weight: 400; }
.rec-about .about-sec > summary { font-size: 14px; }
/* Pestañas: «Más» abre un menú (posición fija: la barra se desplaza de costado y no puede recortarlo) */
.rtab-more { display: inline-flex; }
.rtab-more[hidden] { display: none; }
.rtab-menu { position: fixed; z-index: 45; display: grid; min-width: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 4px; }
.rtab-menu[hidden] { display: none; }
.rtab-menu .rtab { border-bottom: 0; justify-content: flex-start; width: 100%; border-radius: 8px; }
.rtab-menu .rtab.active { background: var(--surface-2); }
/* Resumen */
.sum-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.sum-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.sum-head h3 { margin: 0; font-size: 14px; }
.sum-next-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sum-next-txt { display: grid; gap: 2px; min-width: 0; }
.sum-next-txt strong { font-size: 15px; }
.sum-next-actions { display: flex; gap: 6px; flex: none; }
.sum-next-edit { margin-top: 12px; }
.sum-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.sum-grid .sum-card { margin-bottom: 14px; }
.sum-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.sum-list li { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; }
#sumTasks li { grid-template-columns: minmax(0, 1fr) auto; }
.sum-when, .sum-who { color: var(--ink-3); font-size: 12.5px; }
.sum-what { min-width: 0; overflow-wrap: anywhere; }
.late-txt { color: var(--danger) !important; }
@media (max-width: 1199px) {
  .rec-body { grid-template-columns: minmax(0, 1fr); }
  .datos-tab { display: inline-flex !important; }
  .rec-about { display: none; position: static; max-height: none; }
  .drawer[data-tab="datos"] .rec-about { display: grid; }
}
/* Lead y cliente: su ventana es una página en el área de trabajo */
.page-only { display: none !important; }
.modal-wrap.as-page { inset: var(--tb-h, 0px) 0 0 236px; background: var(--canvas); padding: 0; display: block; z-index: 11; }
body:has(.shell.sb-collapsed) .modal-wrap.as-page { left: 64px; }
.modal-wrap.as-page > .modal { width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; box-shadow: none; }
.modal-wrap.as-page .page-only { display: inline-flex !important; margin-right: 8px; }
.modal-wrap.as-page .drawer-head > .icon-btn[data-close] { display: none; }
@media (max-width: 900px) {
  .drawer { top: 0; left: 0; padding: 0 16px calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 13; }
  .rec-back { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .rec-head { position: static; padding: 0 0 8px; border-bottom: 0; }
  .rec-facts, .drawer.project .rec-facts { grid-template-columns: 1fr 1fr; }
  .rec-facts .fact:nth-child(n+5) { display: none; }
  .rec-facts .fact:nth-child(odd) { border-left: 0; }
  .rec-facts .fact:nth-child(n+3) { border-top: 1px solid var(--line); }
  .rec-tabs { top: 0; margin: 0 -16px 12px; padding: 4px 16px 0; }
  .sum-grid { grid-template-columns: minmax(0, 1fr); }
  .sum-next-row { flex-direction: column; align-items: stretch; }
  .sum-next-actions .btn { flex: 1; justify-content: center; min-height: 44px; }
  .drawer .stage-sel { min-width: 0; max-width: 100%; }
  /* «Trabajar en esto», fijo sobre la barra de abajo */
  .drawer.project.open #projWork { position: fixed; left: 12px; right: 12px; bottom: calc(66px + env(safe-area-inset-bottom, 0px)); z-index: 15; height: 48px; justify-content: center; font-size: 15px; border-radius: 12px; }
  .modal-wrap.as-page { inset: 0; z-index: 13; }
}
@media (min-width: 901px) and (max-width: 1100px) { .rec-facts .fact:nth-child(n+4) { display: grid; } }
/* Cronómetro del menú: nunca más ancho que la barra (encargo 15) */
.tb-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.tb-actions .tb-cat { grid-column: 1 / -1; }
.tb-actions .tb-btn { min-width: 0; justify-content: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-row { min-width: 0; }
@media (min-width: 901px) {
  .shell.sb-collapsed:not(.sb-peek) .timer-dock { width: 64px; padding: 10px 8px; }
  .shell.sb-collapsed:not(.sb-peek) .timer-dock :is(.tb-main span, .tb-today, .tb-proj, .tb-actions, .net-chip) { display: none; }
  .shell.sb-collapsed:not(.sb-peek) .timer-dock .tb-clock { font-size: 11px; }
}
.modal-wrap.as-page .modal > .tabs, .modal-wrap.as-page .modal > .drawer-head { flex: none; }
@media (max-width: 900px) { .drawer.project.open { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); } }
/* Lead como página: sus datos se leen como texto (con su botón «Guardar», como siempre) */
#leadModal.as-page #leadForm label :is(input, select, textarea):not([type=checkbox]) { border-color: transparent; background: transparent; box-shadow: none; padding-left: 0; font-weight: 500; }
#leadModal.as-page #leadForm label :is(input, select, textarea):not([type=checkbox]):hover { border-color: var(--line-2); padding-left: 8px; }
#leadModal.as-page #leadForm label :is(input, select, textarea):not([type=checkbox]):focus { border-color: var(--accent); background: var(--surface); padding-left: 8px; }
#leadModal.as-page #leadForm label select { -webkit-appearance: none; appearance: none; background-image: none; }
#leadModal.as-page .modal-body { max-width: 1100px; }

/* ---------- Encargo 16: buscador ---------- */
.gs-results { width: min(560px, 92vw); left: auto; right: 0; max-height: 75vh; }
.gs-group + .gs-group { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.gs-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.gs-title .link { font-size: 12px; text-transform: none; letter-spacing: 0; }
.gs-item { display: grid; gap: 2px; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: var(--r-md); cursor: pointer; font: inherit; color: var(--ink); min-width: 0; }
.gs-item:hover, .gs-item:focus-visible { background: var(--surface-2); }
.gs-line { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.gs-line strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.gs-meta { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.gs-frag { font-size: 13px; color: var(--ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.gs-item mark, .search-view mark { background: color-mix(in srgb, var(--warn) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.gs-all { display: block; width: 100%; margin-top: 6px; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 10px; font: inherit; font-weight: 500; color: var(--accent-text); cursor: pointer; }
.search-view { max-width: 900px; display: grid; gap: 18px; }
.sv-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.sv-head h2 { margin: 0; font-size: 15px; }
.sv-list { display: grid; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; }
.tk-msg.hit { outline: 2px solid var(--warn); outline-offset: 2px; }
@media (max-width: 900px) {
  /* Celular: los resultados ocupan la pantalla, con la misma agrupación */
  .topbar.searching .gs-results { position: fixed; left: 0; right: 0; top: calc(56px + env(safe-area-inset-top, 0px)); bottom: 0; width: auto; max-height: none; border-radius: 0; border: 0; z-index: 20; padding: 8px 12px calc(80px + env(safe-area-inset-bottom, 0px)); }
  .gs-item { padding: 10px 8px; }
}
.gs-results .gs-item { display: grid; justify-content: stretch; align-items: start; text-align: left; }
.gs-results .gs-item .gs-line, .gs-results .gs-item .gs-meta { justify-content: flex-start; }
@media (max-width: 900px) {
  /* El desenfoque de la barra haría que los resultados se ubiquen respecto de ella (y se corten): mientras se busca, sin él */
  .topbar.searching { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--canvas); }
  body:has(.topbar.searching) .timer-dock { display: none; }
}

/* ---------- Encargo 17: ficha del cliente como la del proyecto (indicadores y columna «Datos») ---------- */
.co-sub { margin: 0; padding: 0 20px 8px; color: var(--ink-3); font-size: 13px; }
.co-sub:empty { display: none; }
.modal-wrap.as-page .co-facts { margin: 0 0 4px; }
@media (min-width: 1200px) {
  #companyModal.as-page #coTabs [data-cotab="datos"] { display: none; }
  #companyModal.as-page .co-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
  #companyModal.as-page .co-body > [data-copane] { grid-column: 1; grid-row: 1; min-width: 0; }
  #companyModal.as-page .co-body > [data-copane="datos"] { display: block !important; grid-column: 2; grid-row: 1; border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px 14px; position: sticky; top: 10px; }
  #companyModal.as-page [data-copane="datos"] :is(.grid2, .grid3) { grid-template-columns: 1fr; }
}
#companyModal .modal > :is(.co-sub, .co-facts) { flex: none; }
/* Datos editables en el lugar, como la columna del proyecto */
#companyModal.as-page [data-copane="datos"] label :is(input, textarea):not([type=checkbox]) { border-color: transparent; background: transparent; box-shadow: none; padding-left: 0; font-weight: 500; }
#companyModal.as-page [data-copane="datos"] label :is(input, textarea):not([type=checkbox]):hover { border-color: var(--line-2); padding-left: 8px; }
#companyModal.as-page [data-copane="datos"] label :is(input, textarea):not([type=checkbox]):focus { border-color: var(--accent); background: var(--surface); padding-left: 8px; }
/* ---------- Encargo 17B: clientes del sistema de tickets sin vincular ---------- */
.tksin { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.tksin .table-wrap { overflow-x: auto; }
.tksin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tksin-table th, .tksin-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tksin-table th { font-weight: 500; color: var(--ink-3); font-size: 12px; }
.tksin-link { display: flex; gap: 6px; align-items: center; }
.tksin-link select { min-width: 0; max-width: 260px; }
.tksin .tag.ok { background: var(--accent-soft); color: var(--accent-text); }
.tksin .tag.warn { background: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--ink); }

/* ---------- Encargo 18: socios ---------- */
.sx-pane { display: grid; gap: 14px; }
.sx-facts { border: 1px solid var(--line); border-radius: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sx-due { color: var(--warn-text, #9a5b00); }
.sx-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 12px 16px; display: grid; gap: 8px; }
.sx-card header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sx-card .sx-edit { margin-left: auto; }
.sx-rol { background: var(--accent-soft); color: var(--accent-text); }
.sx-terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 6px 16px; align-items: start; }
.sx-terms > div { display: grid; gap: 2px; min-width: 0; }
.sx-warn { margin: 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 18%, transparent); font-size: 13px; }
.sx-warn-inline, .sx-red { color: var(--danger); font-size: 12.5px; }
.sx-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.sx-table th, .sx-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.sx-table th { font-weight: 500; color: var(--ink-3); font-size: 12px; }
.sx-table .num { text-align: right; white-space: nowrap; }
.sx-table .sx-acc { text-align: right; white-space: nowrap; }
.sx-table tr.late td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.sx-table tr.sx-na td { color: var(--ink-3); }
.sx-det > td { background: var(--surface-2); padding: 4px 8px; }
.sx-st { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.sx-a_pagar { background: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--ink); }
.sx-pagado { background: var(--accent-soft); color: var(--accent-text); }
.sx-a_revisar { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.sx-liq { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); font-size: 13.5px; margin-bottom: 12px; }
.sx-filtros { gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sx-pie { margin-top: 10px; }
.sx-como:empty { display: none; }
.sx-como { margin: 4px 0 12px; }
@media (max-width: 900px) {
  .sx-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Celular: las tablas pasan a tarjetas apiladas, sin desplazamiento horizontal */
  .sx-table thead { display: none; }
  .sx-table, .sx-table tbody, .sx-table tr, .sx-table td { display: block; width: 100%; }
  .sx-table tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; padding: 6px 4px; background: var(--surface); }
  .sx-table td { border: 0; padding: 3px 8px; }
  .sx-table .num, .sx-table .sx-acc { text-align: left; white-space: normal; }
}
.sx-filtros select { width: auto !important; min-width: 160px; flex: 0 0 auto; }
@media (max-width: 900px) { .sx-filtros select { flex: 1 1 140px; } }
.sx-filtros { display: flex; align-items: center; }
/* ---------- Encargo 15d: «Datos» arranca plegado, con un resumen por sección ---------- */
.rec-about .about-sec, #companyModal [data-copane="datos"] .about-sec { padding: 0; }
.rec-about .about-sec[open], #companyModal [data-copane="datos"] .about-sec[open] { padding-bottom: 12px; }
.about-sec > summary { min-height: 40px; padding: 4px 0; box-sizing: border-box; min-width: 0; }
.about-sec > summary > span:first-child { flex: none; }
.sec-res { margin-left: auto; padding-left: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); font-weight: 400; font-size: 13px; }
.about-sec[open] > summary .sec-res { display: none; }
#companyModal [data-copane="datos"] .co-share { border: 0; padding: 0; margin: 0; }
/* 15d: el resumen se corta con «…» en vez de ensanchar la columna */
.about-sec { min-width: 0; }
.sec-res { flex: 1 1 0; text-align: right; }
.rec-about { min-width: 0; }
/* Encargo 19: «Parte de: grupo» bajo el nombre */
.co-grupo { font-size: 13px; margin-left: 8px; }
.co-grupo:empty { display: none; }

/* Encargo 19c: vincular con Alegra */
.alv-sug { display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; margin-top: 4px; }
.alv-aviso { color: var(--danger); font-size: 12.5px; }
.admin-lote [data-co] { width: 100%; min-width: 220px; }

/* Encargo 20: sin sesión, la ficha y las ventanas no se ven (lo escrito queda en memoria para la misma persona) */
body.sin-sesion #drawer, body.sin-sesion .modal-wrap:not(#login *) { visibility: hidden !important; }

/* ---------- Encargo 24: la barra plegada se abre con clic, por encima de todo ---------- */
@media (min-width: 901px) {
  /* Abierta temporalmente: completa de arriba a abajo, sobre la barra de arriba y las fichas, con velo; el contenido no se corre */
  .shell.sb-peek .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 236px; z-index: 35; box-shadow: 12px 0 40px rgba(8, 14, 18, .28); overflow-y: auto; }
  .shell.sb-peek .timer-dock { z-index: 36; box-shadow: 12px 0 40px rgba(8, 14, 18, .28); }
  .shell.sb-peek .sb-scrim { z-index: 34; }
  /* Contadores en el riel: arriba a la derecha del ícono, sin taparlo */
  .shell.sb-collapsed:not(.sb-peek) .sidebar .count { top: 0; right: -10px; }
}
.sb-tip { white-space: nowrap; }
/* Encargo 23: saldo menor · posible retención (ámbar, no rojo: no es deuda) */
.debt-chip.saldo_menor { background: var(--warn-soft); color: var(--warn); }
.cg-strip.minor { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.cg-strip.minor strong, .cg-strip.minor .cg-ico { color: var(--warn); }
.sm-list .num { white-space: nowrap; }
.cg-invoices li.minor .cg-badge { grid-column: 1 / -1; justify-self: start; } /* encargo 23: la etiqueta larga va abajo, sin apretar la fila */

/* Encargo 26: unir empresas y personas duplicadas */
.unir-wrap { overflow-x: auto; margin-bottom: 8px; padding-bottom: 6px; }
.unir-t tbody th { white-space: nowrap; font-size: 12px; color: var(--ink-3); font-weight: 500; text-align: left; }
.unir-t tbody tr { cursor: default; }
.unir-t td { overflow-wrap: break-word; }
.unir-t tr:last-child th { border-bottom: 0; }
.unir-sec { margin-top: 14px; }
.sel-box { vertical-align: middle; margin-right: 6px !important; }
.unir-motivos { display: inline-flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; min-width: 0; }
