/*
  Panel de Tu Nueva Oficina.
  Concreto claro con verde botella como único color de marca. Los colores que sobran se reservan
  para dos cosas con significado: el color de cada asesor y el estado (ok, aviso, peligro).
  Sin tarjetas con sombra: listas, filas y líneas finas.
*/
:root {
  --font-display: "Bricolage Grotesque Variable", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-body: "Hanken Grotesk Variable", system-ui, -apple-system, "Segoe UI", sans-serif;

  --bg: #f1f2ee;
  --surface: #ffffff;
  --surface-2: #f7f8f5;
  --ink: #17201c;
  --muted: #5d6a64;
  --line: #dce0da;
  --line-strong: #b4bdb6;
  --primary: #0f3d32;
  --primary-ink: #ffffff;
  --primary-soft: #dcebe5;
  --focus: #0f7a5f;

  --ok: #1b6e48;
  --ok-bg: #dff1e7;
  --warn: #8a5200;
  --warn-bg: #fbebcf;
  --danger: #a63a22;
  --danger-bg: #f8e1da;
  --info: #245a8f;
  --info-bg: #dfeaf5;

  /* Color de cada asesor (7 tonos distinguibles) */
  --adv-0: #0b6fa4;
  --adv-1: #c2410c;
  --adv-2: #0a7f5f;
  --adv-3: #a23e8f;
  --adv-4: #8a5a00;
  --adv-5: #5b4bb5;
  --adv-6: #b4233a;
  --on-adv: #ffffff;

  /* Pines del mapa: no cambian con el tema porque el mapa siempre es claro */
  --pin-0: #0b6fa4;
  --pin-1: #c2410c;
  --pin-2: #0a7f5f;
  --pin-3: #a23e8f;
  --pin-4: #8a5a00;
  --pin-5: #5b4bb5;
  --pin-6: #b4233a;

  --radius: 6px;
  --rail: 236px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1512;
    --surface: #161e1a;
    --surface-2: #1b2520;
    --ink: #e7ede9;
    --muted: #9aa8a1;
    --line: #27322c;
    --line-strong: #41504a;
    --primary: #8fdcbc;
    --primary-ink: #0b1f18;
    --primary-soft: #1e332a;
    --focus: #7fd6b2;
    --ok: #5ad39a;
    --ok-bg: #173a2b;
    --warn: #f0b04e;
    --warn-bg: #3b2d12;
    --danger: #ff9a85;
    --danger-bg: #43211b;
    --info: #8ec0f0;
    --info-bg: #1b3047;
    --adv-0: #4aa8dc;
    --adv-1: #f08a50;
    --adv-2: #3cc79e;
    --adv-3: #d781c6;
    --adv-4: #d9a63a;
    --adv-5: #9b8df0;
    --adv-6: #f0697e;
    --on-adv: #0b1210;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100%; }
.rail {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px 14px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand { font: 700 1.2rem/1.1 var(--font-display); padding: 2px 10px 20px; }
.brand small { display: block; margin-top: 4px; font: 400 0.8rem/1.3 var(--font-body); color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--radius);
  color: var(--muted); font-weight: 500; text-decoration: none;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--primary-soft); }
.nav svg { width: 20px; height: 20px; flex: none; }
.who { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.who strong { display: block; font-weight: 600; }
.who span { color: var(--muted); font-size: 13px; }

main {
  min-width: 0;
  padding: 30px clamp(16px, 3vw, 44px) 72px;
  padding-left: max(clamp(16px, 3vw, 44px), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(16px, 3vw, 44px), env(safe-area-inset-right, 0px));
}
.view { max-width: 1240px; margin-inline: auto; display: flex; flex-direction: column; gap: 28px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.page-head h1 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); line-height: 1.1; font-weight: 700; }
.page-head p { margin-top: 4px; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; inset: auto 0 0 0; z-index: 30; height: auto;
    flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    padding-left: max(8px, env(safe-area-inset-left, 0px));
    padding-right: max(8px, env(safe-area-inset-right, 0px));
    border-right: 0; border-top: 1px solid var(--line);
  }
  .brand, .who { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-between; }
  .nav a { flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 11.5px; justify-content: center; }
  main { padding-top: 20px; padding-bottom: 104px; }
}

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 7px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn.quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 14px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13.5px; font-weight: 600; }
.field > small { color: var(--muted); font-size: 12.5px; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="search"], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
textarea { min-height: 84px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 17px; height: 17px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-error { color: var(--danger); font-size: 14px; min-height: 1.2em; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.seg button { min-height: 36px; padding: 6px 14px; border: 0; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); }

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill-toggle {
  display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 12px 4px 9px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); cursor: pointer; font-weight: 500;
}
.pill-toggle[aria-pressed="false"] { color: var(--muted); border-style: dashed; }
.pill-toggle[aria-pressed="false"] .dot { opacity: 0.35; }
.dot { width: 10px; height: 10px; min-width: 10px; border-radius: 50%; background: var(--c, var(--line-strong)); flex: none; display: inline-block; }

/* ---------- Estados y avisos ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px;
  border-radius: 4px; font-size: 12.5px; font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip.ok { background: var(--ok-bg); color: var(--ok); box-shadow: none; }
.chip.warn { background: var(--warn-bg); color: var(--warn); box-shadow: none; }
.chip.danger { background: var(--danger-bg); color: var(--danger); box-shadow: none; }
.chip.info { background: var(--info-bg); color: var(--info); box-shadow: none; }
.chip.plain::before { display: none; }

.empty { padding: 36px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty strong { display: block; color: var(--ink); font: 600 1.05rem var(--font-display); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }
.error-box { padding: 16px; border: 1px solid var(--danger); border-radius: var(--radius); background: var(--danger-bg); color: var(--danger); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

#toasts { position: fixed; z-index: 100; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 460px); pointer-events: none; }
.toast { pointer-events: auto; padding: 10px 16px; border-radius: var(--radius); background: var(--ink); color: var(--bg); font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,0.25); }
.toast.error { background: var(--danger); color: #fff; }
@media (max-width: 860px) { #toasts { bottom: 88px; } }

/* ---------- Secciones ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 1.25rem; font-weight: 700; }
.section-head p { color: var(--muted); font-size: 14px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.metric { padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; text-align: left; border: 0; background: none; border-left: 1px solid var(--line); text-decoration: none; color: inherit; cursor: pointer; }
.metric:first-child { border-left: 0; }
.metric:hover { background: var(--surface-2); }
.metric .label { color: var(--muted); font-size: 13.5px; }
.metric .value { font: 700 2rem/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.metric .note { color: var(--muted); font-size: 13px; }
.metric.alert .value { color: var(--danger); }
@media (max-width: 700px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { border-left: 0; border-top: 1px solid var(--line); padding: 12px 14px; }
  .metric:nth-child(-n+2) { border-top: 0; }
  .metric:nth-child(even) { border-left: 1px solid var(--line); }
  .metric:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .metric .value { font-size: 1.6rem; }
}

.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
@media (max-width: 960px) { .cols { grid-template-columns: minmax(0, 1fr); } }

.rows { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  width: 100%; padding: 11px 4px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.row:hover { background: var(--surface-2); }
.row .main { min-width: 0; }
.row .main strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .main span { display: block; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .time { font-weight: 600; min-width: 62px; font-variant-numeric: tabular-nums; }
.row .side { color: var(--muted); font-size: 13px; text-align: right; }

/* ---------- Línea de tiempo del equipo hoy ---------- */
.lanes { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
.lanes-body { position: relative; min-width: 720px; --label: 168px; }
.lane { display: grid; grid-template-columns: var(--label) minmax(0, 1fr); border-top: 1px solid var(--line); }
.lane:first-child { border-top: 0; }
.lane-name { padding: 10px 14px; display: flex; flex-direction: column; justify-content: center; gap: 1px; border-right: 1px solid var(--line); }
.lane-name strong { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.lane-name > span { color: var(--muted); font-size: 12.5px; padding-left: 18px; }
.lane-track {
  position: relative; height: 62px;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: calc(100% / var(--hours)) 100%;
}
.lane-axis .lane-track { height: 30px; background-image: none; }
.lane-axis .tick { white-space: nowrap; position: absolute; top: 6px; transform: translateX(-50%); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lane-axis .tick:last-child { transform: translateX(-100%); padding-right: 4px; }
.lane-axis .lane-name { border-right: 1px solid var(--line); }
.block {
  position: absolute; top: 8px; bottom: 8px; min-width: 24px;
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
  padding: 3px 8px; border: 2px solid var(--c); border-radius: 4px;
  background: var(--c); color: var(--on-adv); text-align: left; cursor: pointer; overflow: hidden;
  font-size: 12.5px; line-height: 1.2;
}
.block strong { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.92; }
.block.pendiente { background: var(--surface); color: var(--ink); border-style: dashed; }
.block.realizada { opacity: 0.55; }
.now-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); left: calc(var(--label) + (100% - var(--label)) * var(--p)); pointer-events: none; z-index: 2; }
.now-line::before { content: "Ahora"; position: absolute; top: 4px; left: 5px; font-size: 11px; font-weight: 700; color: var(--danger); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 22px; height: 12px; border-radius: 3px; border: 2px solid var(--ink); display: inline-block; }
.legend i.solid { background: var(--ink); }
.legend i.dashed { border-style: dashed; }
.legend i.faded { background: var(--ink); opacity: 0.4; }

/* ---------- Calendario ---------- */
.cal-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.fc { --fc-border-color: var(--line); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2); --fc-today-bg-color: var(--primary-soft); --fc-now-indicator-color: var(--danger); --fc-list-event-hover-bg-color: var(--surface-2); --fc-button-bg-color: var(--surface); --fc-button-border-color: var(--line-strong); --fc-button-text-color: var(--ink); --fc-button-hover-bg-color: var(--surface-2); --fc-button-hover-border-color: var(--line-strong); --fc-button-active-bg-color: var(--primary); --fc-button-active-border-color: var(--primary); font-family: var(--font-body); color: var(--ink); }
.fc .fc-button { font-weight: 600; text-transform: none; border-radius: var(--radius); box-shadow: none !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { color: var(--primary-ink); }
.fc .fc-toolbar-title { font: 700 1.35rem var(--font-display); text-transform: capitalize; }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number, .fc .fc-list-day-text, .fc .fc-list-day-side-text { color: var(--ink); text-decoration: none; text-transform: capitalize; }
.fc .fc-timegrid-slot-label-cushion, .fc .fc-list-event-time { color: var(--muted); }
.fc .fc-timegrid-slot { height: 2.1em; }
.fc-event { cursor: pointer; border-radius: 4px; border-width: 2px; }
.fc-event.st-pendiente { background: var(--surface) !important; border-style: dashed !important; }
.fc-event.st-pendiente .fc-event-main { color: var(--ink) !important; }
.fc-event.st-realizada { opacity: 0.6; }
.fc-event.st-cancelada, .fc-event.st-no_asistio { opacity: 0.45; text-decoration: line-through; }
.fc-event .fc-event-main { color: var(--on-adv); }
@media (max-width: 700px) { .cal-wrap { padding: 8px; } .fc .fc-toolbar { flex-direction: column; gap: 8px; } }

/* ---------- Mapa ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: stretch; }
.map-box { position: relative; height: clamp(440px, calc(100dvh - 250px), 820px); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
#map { position: absolute; inset: 0; z-index: 0; }
.map-side { height: clamp(440px, calc(100dvh - 250px), 820px); overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.map-empty { position: absolute; z-index: 400; left: 12px; right: 12px; top: 12px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-strong); }
.group-head { position: sticky; top: 0; z-index: 1; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.group-head strong { display: flex; align-items: center; gap: 8px; }
.group-head > span { display: block; padding-left: 18px; color: var(--muted); font-size: 13px; }
.stop { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; width: 100%; padding: 10px 14px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.stop:hover, .stop.active { background: var(--surface-2); }
.stop .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-size: 12.5px; font-weight: 700; }
.stop.pendiente .n { background: #fff; color: var(--c); box-shadow: inset 0 0 0 2px var(--c); }
.stop strong { display: block; font-weight: 600; }
.stop span:not(.chip):not(.n) { display: block; color: var(--muted); font-size: 13.5px; }
.stop .chip { margin-top: 4px; }
.pin-wrap { background: none; border: 0; }
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--c); border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45); display: grid; place-items: center; }
.pin span { transform: rotate(45deg); color: #fff; font: 700 12px/1 var(--font-body); }
.pin.pendiente { background: #fff; border-color: var(--c); }
.pin.pendiente span { color: var(--c); }
.pin.realizada { opacity: 0.6; }
.pin.active { outline: 3px solid rgba(15, 61, 50, 0.55); outline-offset: 2px; }
.popup strong { display: block; font-size: 14.5px; }
.popup p { margin: 2px 0; color: #444; font-size: 13px; }
.popup .btn { margin-top: 8px; }
@media (max-width: 960px) { .map-layout { grid-template-columns: minmax(0, 1fr); } .map-box { height: 56dvh; min-height: 360px; } .map-side { height: auto; max-height: 420px; } }

/* ---------- Tablero de seguimiento ---------- */
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 14px; scroll-snap-type: x proximity; }
.col { flex: 0 0 276px; scroll-snap-align: start; display: flex; flex-direction: column; max-height: calc(100dvh - 240px); min-height: 200px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.col.over { outline: 2px dashed var(--primary); outline-offset: 2px; }
.col-head { padding: 11px 12px 9px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.col-head h3 { font-size: 1rem; font-weight: 700; }
.col-head span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.col-body { padding: 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.col-empty { padding: 18px 8px; text-align: center; color: var(--muted); font-size: 13.5px; }
.lead { width: 100%; text-align: left; padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 5px; }
.lead:hover { border-color: var(--line-strong); }
.lead[draggable="true"] { cursor: grab; }
.lead.dragging { opacity: 0.4; }
.lead strong { font-weight: 700; }
.lead .meta { color: var(--muted); font-size: 13.5px; }
.lead .foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lead .owner { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
@media (max-width: 700px) { .col { flex-basis: 84vw; max-height: none; } }

/* ---------- Equipo ---------- */
.scroll-x { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 11px 14px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; vertical-align: middle; }
th { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
td.name > div { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.l { text-align: left; }
.bar-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 130px; }
.bar { width: 100%; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font: 12.5px var(--font-body); }
.chart .val { fill: var(--ink); font-weight: 700; }
.chart .grid { stroke: var(--line); }
.chart .bar-rect { fill: var(--primary); }
.chart .bar-rect.now { fill: var(--primary); }
.chart .bar-rect.past { fill: var(--primary); opacity: 0.55; }
.chart-box { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
.chart-box svg { min-width: 520px; }
.deal-type { font-size: 12.5px; font-weight: 600; color: var(--muted); }

/* ---------- Diálogos y cajones ---------- */
dialog.dlg { padding: 0; border: 0; color: var(--ink); background: var(--surface); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3); display: flex; flex-direction: column; overflow: hidden; }
dialog.dlg::backdrop { background: rgba(8, 16, 12, 0.5); }
dialog.dlg[open] { display: flex; }
dialog.modal { width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); border-radius: 10px; }
dialog.modal.wide { width: min(820px, calc(100vw - 24px)); }
dialog.modal.small { width: min(440px, calc(100vw - 24px)); }
dialog.drawer { width: min(540px, 100vw); height: 100dvh; max-height: none; margin: 0 0 0 auto; border-radius: 0; }
@media (prefers-reduced-motion: no-preference) {
  dialog.drawer[open] { animation: slide-in 0.2s ease-out; }
  dialog.modal[open] { animation: pop-in 0.15s ease-out; }
  @keyframes slide-in { from { transform: translateX(32px); opacity: 0; } }
  @keyframes pop-in { from { transform: translateY(8px); opacity: 0; } }
}
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 12px 20px; border-bottom: 1px solid var(--line); flex: none; }
.dlg-head h2 { font-size: 1.25rem; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dlg-body { padding: 18px 20px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; flex: 1; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.block-title { font: 700 1rem var(--font-display); margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 6px 14px; font-size: 14.5px; }
.kv dt { color: var(--muted); }
.kv dd { overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.timeline { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; }
.timeline li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding-bottom: 14px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .mark { width: 15px; height: 15px; margin-top: 3px; border-radius: 50%; border: 3px solid var(--line-strong); background: var(--surface); }
.timeline .nota .mark { border-color: var(--info); }
.timeline .estatus .mark { border-color: var(--primary); }
.timeline .cita .mark { border-color: var(--warn); }
.timeline .cierre .mark { border-color: var(--ok); background: var(--ok); }
.timeline p { overflow-wrap: anywhere; white-space: pre-wrap; }
.timeline small { color: var(--muted); font-size: 12.5px; }
.picker { height: 260px; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; position: relative; }
.picker > div { position: absolute; inset: 0; z-index: 0; }
.mini-map { height: 170px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; position: relative; }
.mini-map > div { position: absolute; inset: 0; z-index: 0; }
.geo-results { list-style: none; padding: 0; margin: 6px 0 0; border: 1px solid var(--line); border-radius: var(--radius); }
.geo-results button { width: 100%; text-align: left; padding: 8px 10px; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.geo-results li:last-child button { border-bottom: 0; }
.geo-results button:hover { background: var(--surface-2); }
.conflict-list { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.radio-row { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-row label { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; font-weight: 600; }
.radio-row label:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); }

/* ---------- Entrar ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login h1 { font-size: 2.2rem; line-height: 1.05; font-weight: 700; }
.login p { color: var(--muted); }
.login .btn { width: 100%; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
