/* Mantenimiento — estilos. Tokens primero; modo oscuro elegido a mano, no invertido. */
:root {
  color-scheme: light;
  /* Go Building: cyan #1DBFD9, gris #58595B, crema #F1F1EA, negro y blanco. El cyan rellena (botones, interruptores, barras)
     con texto negro encima; para letras sobre fondo claro se usa una versión más oscura, porque el cyan puro no se lee. */
  --bg: #f1f1ea;
  --surface: #ffffff;
  --surface-2: #f8f8f4;
  --surface-3: #ecece5;
  --ink: #111111;
  --ink-2: #3c3d3f;
  --muted: #58595b;
  --faint: #8e8f91;
  --line: #e2e2db;
  --line-2: #d2d2ca;
  --accent: #1dbfd9;
  --accent-ink: #111111;
  --accent-soft: #ddf4f8;
  --accent-strong: #19a9c0;
  --accent-text: #07707f;
  --focus: #07707f;
  --series-1: #1499af;
  --series-muted: #cfcfc8;
  --grid: #e7e7e0;
  --axis: #c8c8c0;
  /* estados (fijos, siempre con texto al lado) */
  --good: #0f8a3c; --good-bg: #e3f4e8;
  --warn: #9a6400; --warn-bg: #fdf0d2; --warn-dot: #f0a500;
  --info: #1f5fae; --info-bg: #e2edfb; --info-dot: #2a78d6;
  --serious: #b4501f; --serious-bg: #fde7dc; --serious-dot: #ec835a;
  --crit: #c22f2f; --crit-bg: #fde3e1; --crit-dot: #d03b3b;
  --mute-bg: #ecece5; --mute-dot: #a3a4a6;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .05), 0 1px 1px rgba(0, 0, 0, .03);
  --shadow-2: 0 8px 28px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .06);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar: 248px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --brand-ink: #58595b; --show-light: block; --show-dark: none;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0b0b0b; --surface: #151515; --surface-2: #1b1b1b; --surface-3: #242424;
    --ink: #f1f1ea; --ink-2: #c9c9c3; --muted: #9c9d9f; --faint: #6e6f71;
    --line: #272727; --line-2: #333333;
    --accent: #1dbfd9; --accent-ink: #0b0b0b; --accent-soft: #0f2c31; --accent-strong: #4fd0e4; --accent-text: #1dbfd9; --focus: #1dbfd9;
    --series-1: #1dbfd9; --series-muted: #3a3a3a; --grid: #232323; --axis: #3a3a3a;
    --good: #4cc77a; --good-bg: #15301f; --warn: #f3b94a; --warn-bg: #33270d; --info: #7fb2f0; --info-bg: #142640;
    --serious: #f29a72; --serious-bg: #3a2016; --crit: #f07a7a; --crit-bg: #3d1717; --mute-bg: #232323; --mute-dot: #6e6f71;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 10px 30px rgba(0, 0, 0, .5);
    --brand-ink: var(--ink); --show-light: none; --show-dark: block;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0b; --surface: #151515; --surface-2: #1b1b1b; --surface-3: #242424;
  --ink: #f1f1ea; --ink-2: #c9c9c3; --muted: #9c9d9f; --faint: #6e6f71;
  --line: #272727; --line-2: #333333;
  --accent: #1dbfd9; --accent-ink: #0b0b0b; --accent-soft: #0f2c31; --accent-strong: #4fd0e4; --accent-text: #1dbfd9; --focus: #1dbfd9;
  --series-1: #1dbfd9; --series-muted: #3a3a3a; --grid: #232323; --axis: #3a3a3a;
  --good: #4cc77a; --good-bg: #15301f; --warn: #f3b94a; --warn-bg: #33270d; --info: #7fb2f0; --info-bg: #142640;
  --serious: #f29a72; --serious-bg: #3a2016; --crit: #f07a7a; --crit-bg: #3d1717; --mute-bg: #232323; --mute-dot: #6e6f71;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4); --shadow-2: 0 10px 30px rgba(0, 0, 0, .5);
  --brand-ink: var(--ink); --show-light: none; --show-dark: block;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.grow { flex: 1; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.ic-wrap { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ic { display: block; }
.ic-faint { opacity: .45; }
[hidden] { display: none !important; }

/* --- Botones ------------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 10px;
  border: 1px solid transparent; background: none; font-weight: 550; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 1px 2px rgba(0, 0, 0, .18); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn-ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--faint); }
.btn-danger { background: var(--crit); color: #fff; }
.btn-danger-ghost { background: var(--surface); border-color: var(--line-2); color: var(--crit); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--crit-bg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; gap: 5px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: none; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-text); cursor: pointer; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }
.chip-btn { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.chip-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.chip-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }

/* --- Píldoras de estado (siempre con texto) ------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill-sm { height: 19px; padding: 0 7px; font-size: 11px; gap: 5px; }
.pill-sm .pill-dot { width: 6px; height: 6px; }
.tone-good { color: var(--good); background: var(--good-bg); }
.tone-warn { color: var(--warn); background: var(--warn-bg); }
.tone-warn .pill-dot { background: var(--warn-dot); }
.tone-info { color: var(--info); background: var(--info-bg); }
.tone-info .pill-dot { background: var(--info-dot); }
.tone-serious { color: var(--serious); background: var(--serious-bg); }
.tone-serious .pill-dot { background: var(--serious-dot); }
.tone-crit { color: var(--crit); background: var(--crit-bg); }
.tone-crit .pill-dot { background: var(--crit-dot); }
.tone-muted { color: var(--muted); background: var(--mute-bg); }
.tone-muted .pill-dot { background: var(--mute-dot); }
.tag-test { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--info); background: var(--info-bg); vertical-align: 1px; }
.cat-chip { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-size: 12px; white-space: nowrap; margin-right: 4px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--crit-dot); color: #fff; font-size: 11.5px; font-weight: 700; }

@font-face { font-family: "Cabinet Grotesk"; src: url(/static/fonts/CabinetGrotesk-800.woff2) format("woff2"); font-weight: 800; font-style: normal; font-display: swap; }

/* --- Estructura ----------------------------------------------------------------------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  padding: 18px 12px 16px; z-index: 30; overflow-y: auto; }
.claro { display: var(--show-light) !important; }
.oscuro { display: var(--show-dark) !important; }
/* Marca horizontal, igual que en el CRM de Go Building: «GO BUILDING» recortado | MANTENIMIENTO / GO BUILDING */
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px 10px; text-decoration: none !important; user-select: none; -webkit-user-select: none; }
.brand-logo { display: block; height: 32px; width: auto; flex: none; pointer-events: none; }
.brand-raya { width: 1px; align-self: stretch; margin: 2px 0; background: var(--line-2); flex: none; }
.brand-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; line-height: 1.05; text-transform: uppercase; font-family: "Cabinet Grotesk", var(--font); font-weight: 800; }
.brand-sub { font-size: 10.5px; letter-spacing: .2em; color: var(--muted); }
.brand-name { font-size: 17px; letter-spacing: .01em; color: var(--brand-ink); white-space: nowrap; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: 10px; color: var(--ink-2); font-weight: 500; text-decoration: none !important; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-label { flex: 1; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.bot-status { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-decoration: none !important; background: var(--surface-2); border: 1px solid var(--line); }
.bot-status strong { display: block; font-size: 12.5px; color: var(--ink); }
.bot-status small { display: block; font-size: 11.5px; color: var(--muted); }
.bot-status .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--mute-dot); }
.bot-status.tone-good, .bot-status.tone-warn, .bot-status.tone-muted { background: var(--surface-2); }
.bot-status.tone-good .dot { background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.bot-status.tone-warn .dot { background: var(--warn-dot); box-shadow: 0 0 0 3px var(--warn-bg); }
.side-user { display: flex; align-items: center; gap: 6px; padding: 4px 2px 0 6px; }
.side-user-name { flex: 1; font-weight: 550; font-size: 13px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.av-crit { background: var(--crit-bg); color: var(--crit); }
.main { flex: 1; margin-left: var(--sidebar); padding: 26px 32px 48px; min-width: 0; max-width: calc(1480px + var(--sidebar)); }
.main.main-full { max-width: none; }
.tabbar, .scrim { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.page-sub { color: var(--muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 18px 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.card-head h2 { font-size: 17px; font-weight: 700; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; max-width: 64ch; }
.card-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.link-more { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 550; }

/* --- Filtros ----------------------------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-btn { border: 0; background: none; height: 30px; padding: 0 11px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-weight: 500; font-size: 13px; white-space: nowrap; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
.filter { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 0 4px 0 10px; height: 36px; }
.filter-label { font-size: 12px; color: var(--muted); }
.filter select { border: 0; background: none; height: 34px; max-width: 190px; padding-right: 4px; cursor: pointer; }
select, input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), textarea {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; padding: 7px 10px; min-width: 0; }
select { padding-right: 26px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
.filter select:focus { box-shadow: none; }
.tk-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 0 10px; height: 36px; color: var(--muted); min-width: 220px; }
.tk-search input { border: 0 !important; box-shadow: none !important; padding: 0; height: 34px; flex: 1; background: none; }
.inline-select { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }

/* --- KPIs ------------------------------------------------------------------------------------------ */
.kpis { display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.kpis-sm { grid-template-columns: repeat(4, 1fr); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-hero .kpi-value { font-size: 34px; }
.kpi-note { font-size: 12px; color: var(--muted); }
.kpi-delta { font-size: 12px; font-weight: 600; }
.kpi-delta.tone-good { color: var(--good); background: none; }
.kpi-delta.tone-bad { color: var(--serious); }
.kpi-delta.tone-flat { color: var(--muted); }
.spark { flex: none; overflow: visible; }

/* --- Pedidos en el resumen ----------------------------------------------------------------------- */
.tickets-strip { margin-bottom: 16px; }
.strip-body { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 18px; align-items: start; }
.strip-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.strip-stat { display: flex; flex-direction: column; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.strip-stat strong { font-size: 22px; line-height: 1.1; color: var(--ink); }
.strip-stat span { font-size: 12px; color: var(--muted); }
.strip-stat.tone-warn { background: var(--warn-bg); } .strip-stat.tone-warn strong { color: var(--warn); }
.strip-stat.tone-info { background: var(--info-bg); } .strip-stat.tone-info strong { color: var(--info); }
.strip-stat.tone-crit { background: var(--crit-bg); } .strip-stat.tone-crit strong { color: var(--crit); }
.strip-stat.tone-muted { background: var(--surface-2); }
.strip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.strip-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; color: var(--ink); text-decoration: none !important; }
.strip-item:hover { background: var(--surface-2); }
.strip-item.unread .strip-who { font-weight: 700; }
.strip-thumb { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; flex: none; background: var(--surface-3); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.strip-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.strip-who { font-weight: 550; }
.strip-text { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.strip-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.strip-meta small { color: var(--faint); font-size: 11.5px; }
.strip-empty { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--muted); }

/* --- Gráficos --------------------------------------------------------------------------------------- */
.viz-body { min-height: 60px; }
.viz-empty { color: var(--muted); padding: 22px 0; text-align: center; }
.viz-note { color: var(--muted); font-size: 12px; margin-top: 8px; }
.barh { display: flex; flex-direction: column; gap: 2px; }
.barh-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; align-items: center; gap: 12px; padding: 5px 6px; border-radius: 8px; outline-offset: 0; }
.barh-row.clickable { cursor: pointer; }
.barh-row:hover, .barh-row:focus-visible { background: var(--surface-2); }
.barh-row:hover .barh-bar, .barh-row:focus-visible .barh-bar { filter: brightness(1.12); }
.barh-label { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barh-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.barh-bar { height: 14px; border-radius: 0 4px 4px 0; min-width: 2px; flex: none; max-width: calc(100% - 64px); }
.barh-val { font-size: 12.5px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
svg .viz-grid { stroke: var(--grid); stroke-width: 1; }
svg .viz-base { stroke: var(--axis); stroke-width: 1; }
svg .viz-tick { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
svg .viz-hit { fill: transparent; cursor: default; outline: none; }
svg .viz-hit.on, svg .viz-hit:focus { fill: var(--ink); fill-opacity: .04; }
.viz-legend { display: flex; gap: 16px; margin-top: 6px; font-size: 12.5px; color: var(--ink-2); }
.viz-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.viz-swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.viz-tt { position: fixed; z-index: 100; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: var(--shadow-2); padding: 8px 10px; font-size: 12.5px; opacity: 0; transform: translateY(4px); transition: opacity .1s, transform .1s; max-width: 280px; }
.viz-tt.on { opacity: 1; transform: none; }
.viz-tt-title { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.viz-tt-row { display: flex; align-items: center; gap: 7px; }
.viz-tt-row strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.viz-tt-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.viz-tt-label { color: var(--muted); }
.viz-table-wrap { max-height: 360px; overflow: auto; }
.viz-table, .tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.viz-table th, .viz-table td, .tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.viz-table th, .tbl th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface); position: sticky; top: 0; }
.viz-table .num, .tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td, .tbl tr.clickable:focus-visible td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.table-card { padding: 6px 8px; }
.tbl th.sortable button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font: inherit; }
.tbl th.sorted { color: var(--ink); }

/* problemas que se repiten */
.rec-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rec-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; background: var(--surface-2); color: var(--ink); text-decoration: none !important; border: 1px solid transparent; }
.rec-item:hover { border-color: var(--line-2); }
.rec-times { width: 38px; height: 38px; border-radius: 10px; background: var(--serious-bg); color: var(--serious); display: flex; align-items: center; justify-content: center; flex: none; font-size: 14px; }
.rec-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rec-main small { color: var(--muted); font-size: 12px; }
.rec-money { font-weight: 650; font-variant-numeric: tabular-nums; }
.rec-flag { margin-left: 6px; color: var(--serious); vertical-align: -2px; display: inline-flex; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--serious-bg); color: var(--ink); margin-bottom: 16px; }
.callout > .ic-wrap { color: var(--serious); margin-top: 2px; }

/* --- Bandeja de pedidos ---------------------------------------------------------------------------- */
.inbox { display: grid; grid-template-columns: 360px minmax(0, 1fr); height: calc(100vh - 128px); min-height: 520px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.inbox-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tk-tabs { display: flex; gap: 2px; padding: 10px 10px 0; }
.tk-tab { flex: 1; border: 0; background: none; padding: 8px 6px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 550; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tk-tab.on { background: var(--surface-3); color: var(--ink); }
.tk-count { font-size: 11.5px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 0 6px; color: var(--muted); }
.inbox-list .tk-search { margin: 10px; min-width: 0; }
.tk-list { list-style: none; margin: 0; padding: 0 6px 10px; overflow-y: auto; flex: 1; }
.tk-item { display: flex; gap: 11px; padding: 11px 10px; border-radius: 11px; color: var(--ink); text-decoration: none !important; position: relative; }
.tk-item:hover { background: var(--surface-2); }
.tk-item.sel { background: var(--accent-soft); }
.tk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tk-top { display: flex; justify-content: space-between; gap: 8px; }
.tk-who { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-item.unread .tk-who { font-weight: 750; }
.tk-time { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.tk-sub { display: flex; gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.tk-sub > * { flex: none; }
.tk-sub > span:nth-child(2) { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; }
.tk-unit { font-weight: 600; color: var(--ink-2); }
.tk-unit.none { font-weight: 400; color: var(--faint); font-style: italic; }
.tk-snippet { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 4px; align-items: center; }
.tk-item.unread .tk-snippet { color: var(--ink-2); }
.tk-media { display: inline-flex; align-items: center; color: var(--ink-2); }
.tk-flags { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--info-dot); margin-top: 4px; }
.tk-empty { padding: 28px 16px; text-align: center; color: var(--ink-2); }

.inbox-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.thread-empty, .thread-loading { margin: auto; text-align: center; max-width: 440px; padding: 30px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--ink-2); }
.thread-empty-art { width: 66px; height: 66px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; }
.notice { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg); color: var(--ink); font-size: 13px; text-align: left; flex-wrap: wrap; }
.notice .ic-wrap { color: var(--warn); margin-top: 1px; }
.thread-head { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.thread-head-row { display: flex; align-items: center; gap: 12px; }
.thread-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.tools-label { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.tools-label:first-child { margin-left: 0; }
.back-btn { display: none; }
.thread-who { flex: 1; min-width: 0; }
.thread-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.name-btn { border: 0; background: none; padding: 0; font-size: 16px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.name-btn:hover { color: var(--accent-text); }
.thread-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.thread-meta .sep { color: var(--faint); }
.inline-field { display: inline-flex; align-items: center; gap: 6px; }
.unit-input { width: 78px; height: 26px; padding: 2px 8px !important; font-weight: 600; }
.thread-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pill-select { height: 30px; border-radius: 999px !important; font-size: 12.5px; font-weight: 600; padding: 0 26px 0 10px !important; border: 1px solid var(--line-2); cursor: pointer; }
.pill-select.tone-warn, .pill-select.tone-info, .pill-select.tone-good, .pill-select.tone-crit, .pill-select.tone-serious { border-color: transparent; }
.thread-cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; flex: 1; min-height: 0; }
.thread-center { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.thread-body { flex: 1; overflow-y: auto; padding: 16px 20px 8px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); }
.day-sep, .ticket-sep { align-self: center; font-size: 11.5px; color: var(--muted); margin: 10px 0 4px; }
.day-sep span { background: var(--surface); border: 1px solid var(--line); padding: 2px 10px; border-radius: 999px; }
.ticket-sep { font-weight: 600; }
.call-note { align-self: center; font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.media-audio { width: 260px; max-width: 100%; height: 36px; }
.bot-note { align-self: center; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; text-align: center; }
.msg { display: flex; flex-direction: column; max-width: min(78%, 560px); }
.msg.in { align-self: flex-start; align-items: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg-bubble { padding: 9px 13px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.msg.in .msg-bubble { border-bottom-left-radius: 5px; }
.msg.out .msg-bubble { background: var(--accent); color: var(--accent-ink); border-color: transparent; border-bottom-right-radius: 5px; }
.msg.out.bot .msg-bubble { background: var(--accent-soft); color: var(--ink); border-color: transparent; }
.msg-tag { font-size: 11px; font-weight: 700; color: var(--accent-text); display: flex; align-items: center; gap: 3px; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .03em; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-meta { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 11px; color: var(--faint); margin: 3px 4px 2px; align-items: center; }
.msg-meta > span { white-space: nowrap; }
.msg-st { display: inline-flex; align-items: center; gap: 2px; }
.msg-st.st-delivered, .msg-st.st-read { color: var(--good); }
.msg-st.st-failed, .msg-st.st-undelivered, .msg-st.st-error { color: var(--crit); }
.msg-err { font-size: 12px; color: var(--crit); background: var(--crit-bg); padding: 4px 9px; border-radius: 8px; margin-top: 2px; display: flex; gap: 4px; align-items: flex-start; }
.msg-media { display: grid; gap: 4px; margin: 2px 0 6px; grid-template-columns: repeat(2, 1fr); }
.msg-media.n1, .msg-media.n0 { grid-template-columns: 1fr; }
.media-thumb { border: 0; padding: 0; background: none; cursor: zoom-in; border-radius: 10px; overflow: hidden; display: block; }
.media-thumb img { display: block; width: 100%; max-width: 280px; max-height: 260px; object-fit: cover; border-radius: 10px; }
.msg-media.n2 .media-thumb img, .msg-media.n3 .media-thumb img, .msg-media.n4 .media-thumb img { width: 140px; height: 140px; }
.media-file, .media-pending { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 8px; background: var(--surface-3); color: var(--ink); font-size: 12.5px; }
.composer { border-top: 1px solid var(--line); padding: 10px 14px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 40px; max-height: 160px; border-radius: 12px; }
.composer-info { font-size: 11.5px; color: var(--muted); min-height: 14px; }
.thread-side { border-left: 1px solid var(--line); overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--surface); }
.thread-side.in-drawer { border: 0; padding: 0; }
.side-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.side-card h4 { font-size: 13.5px; display: flex; align-items: center; gap: 5px; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mini-list li > a, .mini-list li > .mini-btn, .mini-list li { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--ink); text-decoration: none !important; }
.mini-list li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list li > a:hover .mini-text, .mini-btn:hover .mini-text { color: var(--accent-text); }
.mini-list li > a, .mini-list li > .mini-btn { flex: 1; min-width: 0; }
.mini-btn { border: 0; background: none; padding: 0; width: 100%; text-align: left; cursor: pointer; }
.mini-date { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 72px; }
.mini-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-money { font-variant-numeric: tabular-nums; font-weight: 600; }
.act-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.act-list li { display: flex; flex-direction: column; }
.act-list small { font-size: 11px; }
.photo-row { display: flex; gap: 6px; flex-wrap: wrap; }
.photo-row img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; display: block; }
.ficha-btn { display: none; }

/* foto en grande */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(8, 10, 9, .92); display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 92vw; max-height: 84vh; border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.lb-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; padding: 10px 14px; gap: 8px; color: #fff; }
.lb-bar .icon-btn { color: #fff; }
.lb-bar .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.lb-count { font-size: 13px; opacity: .8; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lb-nav.prev { left: 16px; } .lb-nav.next { right: 16px; }

/* --- Simulador ------------------------------------------------------------------------------------- */
.modal.modal-sim { width: min(880px, 96vw); }
.sim { display: grid; grid-template-columns: 340px 1fr; gap: 26px; align-items: start; }
.phone { position: relative; width: 340px; height: 620px; border-radius: 44px; background: #111; padding: 12px; box-shadow: var(--shadow-2), 0 0 0 2px #2a2a2a inset; display: flex; flex-direction: column; overflow: hidden; }
.phone-notch { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 110px; height: 26px; background: #111; border-radius: 0 0 16px 16px; z-index: 2; }
.phone-top { background: #f6f6f6; color: #111; border-radius: 32px 32px 0 0; padding: 32px 14px 10px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #e3e3e3; }
.phone-top strong { display: block; font-size: 14px; }
.phone-top small { color: #777; font-size: 11.5px; }
.phone-top .avatar { background: #ddf4f8; color: #07707f; }
.phone-screen { flex: 1; background: #fff; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.sim-hint { color: #8a8a8a; font-size: 12px; text-align: center; padding: 8px 10px; }
.sim-msg { max-width: 82%; padding: 8px 12px; border-radius: 18px; font-size: 13.5px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; font-family: -apple-system, system-ui, sans-serif; }
.sim-msg.me { align-self: flex-end; background: #2f7cf6; color: #fff; border-bottom-right-radius: 5px; }
.sim-msg.them { align-self: flex-start; background: #e9e9eb; color: #111; border-bottom-left-radius: 5px; }
.sim-img { display: block; max-width: 100%; max-height: 180px; border-radius: 12px; margin-bottom: 4px; }
.typing { display: flex; gap: 4px; padding: 12px 14px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #9a9a9a; animation: blink 1s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
.sim-preview { display: flex; gap: 6px; background: #fff; padding: 0 10px; }
.sim-file { position: relative; }
.sim-file img { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; display: block; }
.sim-file button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: #333; color: #fff; cursor: pointer; line-height: 1; }
.phone-bar { background: #fff; display: flex; align-items: center; gap: 6px; padding: 8px 8px 16px; border-radius: 0 0 32px 32px; border-top: 1px solid #eee; }
.phone-input { flex: 1; border-radius: 999px !important; border: 1px solid #d6d6d6 !important; background: #fff !important; color: #111 !important; padding: 7px 12px !important; box-shadow: none !important; }
.phone-attach, .phone-send { border: 0; background: none; cursor: pointer; color: #2f7cf6; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex: none; }
.phone-send { background: #2f7cf6; color: #fff; width: 30px; height: 30px; }
.sim-side { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.sim-side h3 { font-size: 17px; }
.sim-why:empty { display: none; }
.sim-reason { display: flex; gap: 10px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.sim-reason.yes .ic-wrap { color: var(--accent-text); }
.sim-reason div { display: flex; flex-direction: column; gap: 2px; }
.sim-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Planilla (Tabulator) --------------------------------------------------------------------------- */
.grid-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.grid-search { min-width: 260px; flex: 0 1 340px; }
.grid-total { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.param-banner { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--info-bg); color: var(--ink); margin-bottom: 12px; font-size: 13px; flex-wrap: wrap; }
.param-banner .ic-wrap { color: var(--info); }
.grid-card { padding: 0; overflow: hidden; }
.grid-host { height: calc(100vh - 236px); min-height: 420px; }
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-2); padding: 6px; min-width: 180px; }
.menu-check { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.menu-check:hover { background: var(--surface-2); }
.tabulator { background: var(--surface); border: 0; font-size: 13px; color: var(--ink); }
.tabulator .tabulator-header { background: var(--surface-2); border-bottom: 1px solid var(--line-2); color: var(--ink-2); font-weight: 600; }
.tabulator .tabulator-header .tabulator-col { background: var(--surface-2); border-right: 1px solid var(--line); }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content { padding: 8px 10px 6px; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-title { font-size: 12px; }
.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover { background: var(--surface-3); }
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter { margin-top: 5px; }
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input { height: 28px; padding: 3px 8px !important; font-size: 12px; font-weight: 400; border-radius: 7px; }
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter .tabulator-arrow { border-bottom-color: var(--faint); }
.tabulator .tabulator-tableholder .tabulator-table { background: var(--surface); color: var(--ink); }
.tabulator-row { background: var(--surface); border-bottom: 1px solid var(--line); min-height: 36px; }
.tabulator-row.tabulator-row-even { background: var(--surface); }
.tabulator-row:hover, .tabulator-row.tabulator-selectable:hover { background: var(--surface-2) !important; }
.tabulator-row .tabulator-cell { border-right: 1px solid var(--line); padding: 8px 10px; }
.tabulator-row .tabulator-cell.tabulator-editing { border: 2px solid var(--accent-text); padding: 0; background: var(--surface); }
.tabulator-row .tabulator-cell.tabulator-editing input, .tabulator-row .tabulator-cell.tabulator-editing select { border: 0 !important; box-shadow: none !important; border-radius: 0; height: 100%; padding: 6px 8px !important; background: var(--surface); }
.tabulator-row .tabulator-cell.tabulator-editable:hover { box-shadow: inset 0 0 0 1px var(--line-2); cursor: cell; }
.tabulator-row.row-open-wo .tabulator-cell:first-child { box-shadow: inset 3px 0 0 var(--warn-dot); }
.tabulator .tabulator-row.tabulator-group { background: var(--accent-soft); border-bottom: 1px solid var(--line-2); border-top: 1px solid var(--line-2); padding: 7px 10px; min-height: 34px; color: var(--ink); }
.tabulator .tabulator-row.tabulator-group:hover { background: var(--accent-soft) !important; filter: brightness(.98); }
.tabulator-row.tabulator-group span { margin-left: 0; color: var(--ink); }
.tabulator-row.tabulator-group .gh-name { font-weight: 700; margin-right: 10px; }
.tabulator-row.tabulator-group .gh-meta { color: var(--muted) !important; font-weight: 500; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tabulator-row.tabulator-group .tabulator-group-toggle { margin-right: 8px; }
.tabulator .tabulator-footer { background: var(--surface-2); border-top: 1px solid var(--line-2); color: var(--ink); }
.tabulator .tabulator-footer .tabulator-calcs-holder { background: var(--surface-2); border: 0; }
.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row { background: var(--surface-2) !important; }
.tabulator-row.tabulator-calcs .tabulator-cell { border-right: 0; }
.tabulator .tabulator-tableholder .tabulator-placeholder .tabulator-placeholder-contents { color: var(--muted); font-size: 14px; font-weight: 500; }
.tabulator-edit-list { background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow-2); color: var(--ink); font-size: 13px; }
.tabulator-edit-list .tabulator-edit-list-item { color: var(--ink); padding: 6px 10px; }
.tabulator-edit-list .tabulator-edit-list-item:hover, .tabulator-edit-list .tabulator-edit-list-item.focused { background: var(--accent-soft); color: var(--ink); }
.tabulator-edit-list .tabulator-edit-list-item.active { background: var(--accent); color: var(--accent-ink); }
.tabulator .tabulator-col-resize-handle:hover { background: var(--accent-soft); }
.col-open { padding: 0 !important; }
.row-open { border: 0; background: none; cursor: pointer; color: var(--faint); width: 100%; height: 34px; display: flex; align-items: center; justify-content: center; }
.row-open:hover { color: var(--accent-text); }
.sms-tag { display: inline-flex; vertical-align: -2px; color: var(--accent-text); margin-right: 5px; }
.txt-crit { color: var(--crit); font-weight: 600; }

/* --- Propietarios, unidades, proveedores -------------------------------------------------------------- */
.owner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.owner-card { display: flex; flex-direction: column; gap: 12px; }
.owner-card h3 { font-size: 15px; }
.unit-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; align-items: center; }
.unit-chip { font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); text-decoration: none !important; font-weight: 600; }
.unit-chip:hover { background: var(--accent-soft); color: var(--accent-text); }
.owner-num { display: flex; flex-direction: column; gap: 2px; }
.owner-num strong { font-size: 24px; letter-spacing: -0.02em; }
.owner-num .muted { font-size: 12.5px; }
.owner-cats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.owner-cats li { display: grid; grid-template-columns: minmax(0, 1.2fr) 1fr auto; gap: 10px; align-items: center; font-size: 12.5px; }
.owner-cats li > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.owner-cat-bar { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; display: block; }
.owner-cat-bar > span { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.owner-card footer { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-year { font-weight: 700; padding: 12px 0 6px; font-size: 13px; }
.tl-item { border-left: 2px solid var(--line-2); margin-left: 6px; }
.tl-btn { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; border: 0; background: none; text-align: left; padding: 8px 10px; cursor: pointer; border-radius: 0 10px 10px 0; color: var(--ink); }
.tl-btn:hover { background: var(--surface-2); }
.tl-date { color: var(--muted); font-size: 12.5px; }
.tl-main { display: flex; flex-direction: column; min-width: 0; }
.tl-main strong { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.cell-input { width: 100%; min-width: 120px; height: 30px; padding: 3px 8px !important; border-color: transparent !important; background: transparent !important; }
.cell-input:hover { border-color: var(--line-2) !important; }
.cell-input:focus { background: var(--surface) !important; border-color: var(--accent-text) !important; }
.strong-link { font-weight: 650; color: var(--ink); }
.share { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.share-bar { display: inline-block; height: 6px; border-radius: 0 3px 3px 0; background: var(--series-1); max-width: 60px; }
.tbl-vendors td, .tbl-units td { vertical-align: middle; }

/* --- Configuración ---------------------------------------------------------------------------------------- */
.cfg { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.cfg-nav { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; }
.cfg-link { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 9px; color: var(--ink-2); text-decoration: none !important; font-weight: 500; }
.cfg-link:hover { background: var(--surface); }
.cfg-link.on { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-1); }
.cfg-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cfg-sec { scroll-margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.cfg-sec .card-head { margin-bottom: 0; }
.cfg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.cfg-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cfg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld-label, .form label > span.label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.fld-help { font-size: 12px; color: var(--muted); }
.fld-help.warn { color: var(--serious); }
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chk { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 12px; border: 1px solid var(--line); }
.chk.done { background: var(--surface-2); }
.chk.done .chk-main strong { color: var(--muted); }
.chk-mark { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12.5px; flex: none;
  border: 1.5px solid var(--line-2); color: var(--muted); }
.chk.done .chk-mark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chk-main p { font-size: 12.5px; }
.chk-cta { flex: none; }
.cost-box { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); align-items: flex-start; }
.cost-box .ic-wrap { color: var(--accent-text); margin-top: 2px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 550; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { width: 40px; height: 23px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(17px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--focus); outline-offset: 2px; }
.hours { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.days { display: flex; gap: 4px; }
.day input { position: absolute; opacity: 0; }
.day span { display: inline-flex; width: 32px; height: 32px; border-radius: 50%; align-items: center; justify-content: center; border: 1px solid var(--line-2); cursor: pointer; font-weight: 600; font-size: 12.5px; background: var(--surface); }
.day input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.day input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.hours input[type="time"] { width: 110px; }
.tpl-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.tpl-head { display: flex; flex-direction: column; gap: 4px; }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.tpl-grid.two { grid-template-columns: 1fr 1fr; }
.tpl-grid > div { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tpl-box { display: flex; flex-direction: column; gap: 4px; }
.tpl-box textarea { resize: vertical; min-height: 92px; font-size: 13px; }
.tpl-preview { background: var(--surface-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; min-height: 92px; }
.tpl-preview .sim-msg { max-width: 100%; font-size: 12.5px; }
.example { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.example .sim-msg { max-width: 480px; }
details.adv { border-top: 1px solid var(--line); padding-top: 10px; }
details.adv > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
details.adv[open] > summary { margin-bottom: 14px; }
details.adv .btn { margin-top: 14px; }
.save-bar { position: sticky; bottom: 12px; display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 14px; border-radius: 12px;
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow-2); z-index: 5; }
.save-bar span { margin-right: auto; font-weight: 600; }
.save-bar .btn-ghost { background: transparent; color: var(--surface); border-color: rgba(255, 255, 255, .3); }
.quick-edit { display: flex; flex-direction: column; gap: 8px; }
.quick-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.quick-row textarea { resize: vertical; }
.diag { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.diag li { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; align-items: flex-start; }
.diag li.ok { background: var(--good-bg); } .diag li.ok .ic-wrap { color: var(--good); }
.diag li.bad { background: var(--warn-bg); } .diag li.bad .ic-wrap { color: var(--warn); }
.diag li p { font-size: 12.5px; }
.hunt { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--info-bg); align-items: flex-start; }
.hunt .ic-wrap { color: var(--info); margin-top: 2px; }
.hunt.ok { background: var(--good-bg); }
.hunt.ok .ic-wrap { color: var(--good); }
.hunt.bad { background: var(--warn-bg); }
.hunt.bad .ic-wrap { color: var(--warn); }
.copy-box { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.copy-row { display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.copy-row code { font-size: 12.5px; background: var(--surface); border: 1px solid var(--line); padding: 5px 8px; border-radius: 7px; overflow-wrap: anywhere; }
.test-sms { align-items: flex-end; }
.test-sms .fld { min-width: 240px; }
.guide { display: flex; flex-direction: column; gap: 14px; }
.guide-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.guide-item { display: grid; grid-template-columns: 210px minmax(0, 1fr) auto; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); align-items: start; }
.guide-item:last-child { border-bottom: 0; }
.guide-k { font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.guide-v { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.steps-small { margin: 0 0 4px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--ink-2); }

/* --- Formularios, modales, paneles -------------------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.form label input, .form label select, .form label textarea { font-weight: 400; font-size: 14px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.span-2 { grid-column: span 2; }
.desc-box { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.desc-box p { white-space: pre-wrap; margin-top: 4px; }
.desc-box .label { font-size: 12px; font-weight: 600; color: var(--muted); }
.modal-wrap { position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity .18s; }
.modal-wrap.in { opacity: 1; }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-2); width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; transform: translateY(8px) scale(.99); transition: transform .18s; }
.modal-wrap.in .modal { transform: none; }
.modal-wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px 22px; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 10px 22px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.drawer-wrap { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, .3); opacity: 0; transition: opacity .2s; }
.drawer-wrap.in { opacity: 1; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); box-shadow: var(--shadow-2); display: flex; flex-direction: column; transform: translateX(24px); transition: transform .22s; }
.drawer-wrap.in .drawer { transform: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 12px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 17px; overflow-wrap: anywhere; }
.drawer-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-foot { display: flex; gap: 8px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.detail-extra { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px; border: 2px dashed var(--line-2); border-radius: 14px; cursor: pointer; text-align: center; color: var(--ink-2); margin: 12px 0; }
.drop .ic-wrap { color: var(--accent-text); }
.drop.over, .drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop-name { font-weight: 600; color: var(--ink); }
.import-result ul { padding-left: 18px; }

/* --- Avisos ---------------------------------------------------------------------------------------------------- */
#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--surface); padding: 10px 12px 10px 14px; border-radius: 12px; box-shadow: var(--shadow-2);
  max-width: min(440px, calc(100vw - 36px)); font-size: 13.5px; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.in { opacity: 1; transform: none; }
.toast-error { background: var(--crit); color: #fff; }
.toast-msg { flex: 1; }
.toast-act { border: 0; background: rgba(255, 255, 255, .16); color: inherit; padding: 4px 10px; border-radius: 7px; cursor: pointer; font-weight: 600; }
.toast-x { border: 0; background: none; color: inherit; opacity: .7; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }

.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-art { width: 54px; height: 54px; border-radius: 16px; background: var(--surface-3); }

/* --- Ingreso ----------------------------------------------------------------------------------------------------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px; padding: 24px 16px; background: var(--bg); }
.login-logo { display: block; width: 170px; height: auto; }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-2); padding: 28px; display: flex; flex-direction: column; gap: 8px; }
.login-brand { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.login-brand strong { display: block; font-size: 18px; }
.login-brand span { color: var(--muted); font-size: 13px; }
.login-card label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-top: 6px; }
.login-card input { height: 42px; }
.login-card .btn { margin-top: 12px; height: 42px; }
.login-err { color: var(--crit); font-size: 13px; min-height: 18px; }
.boot-error { max-width: 420px; margin: 20vh auto; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* --- Pantallas medianas y celular ---------------------------------------------------------------------------- */
@media (max-width: 1360px) {
  .thread-cols { grid-template-columns: minmax(0, 1fr); }
  .thread-cols > .thread-side { display: none; }
  .ficha-btn { display: inline-flex; }
}
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .tpl-grid { grid-template-columns: 1fr 1fr; }
  .tpl-grid > div:last-child { grid-column: span 2; }
}
@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  .sidebar { width: 270px; transform: translateX(-100%); transition: transform .22s, visibility .22s; visibility: hidden; }
  body.nav-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-2); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 25; }
  .main { margin-left: 0; padding: 16px 16px 92px; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tab-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 10px; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none !important; cursor: pointer; min-width: 64px; }
  .tab-item.active { color: var(--accent-text); }
  .tab-badge { position: absolute; top: -2px; right: 8px; min-width: 18px; height: 18px; font-size: 10.5px; }
  .page-title h1 { font-size: 21px; }
  .hide-sm { display: none; }
  .inbox { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 190px); }
  .inbox.has-sel .inbox-list { display: none; }
  .main:has(.inbox.has-sel) > .page-head { display: none; }
  .inbox.has-sel { height: calc(100dvh - 104px); }
  .inbox:not(.has-sel) .inbox-thread { display: none; }
  .back-btn { display: inline-flex; }
  .thread-head { padding: 10px 12px; }
  .thread-head-row { flex-wrap: wrap; }
  .thread-actions { width: 100%; justify-content: flex-end; }
  .tools-label { display: none; }
  .msg { max-width: 88%; }
  .thread-body { padding: 12px; }
  .strip-body { grid-template-columns: minmax(0, 1fr); }
  .cfg { grid-template-columns: minmax(0, 1fr); }
  .cfg-nav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .cfg-link { white-space: nowrap; }
  .cfg-grid, .grid-form, .tpl-grid, .tpl-grid.two { grid-template-columns: minmax(0, 1fr); }
  .span-2, .tpl-grid > div:last-child { grid-column: auto; }
  .guide-item, .copy-row { grid-template-columns: minmax(0, 1fr) auto; }
  .guide-k, .copy-row .fld-label { grid-column: 1 / -1; }
  .quick-row { grid-template-columns: minmax(0, 1fr) auto; }
  .quick-row textarea { grid-column: 1 / -1; grid-row: 2; }
  .sim { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .phone { width: min(340px, 100%); height: 560px; }
  .grid-host { height: calc(100vh - 300px); }
  .tk-search, .grid-search { min-width: 0; flex: 1 1 100%; }
}
@media (max-width: 560px) {
  .kpis, .kpis-sm { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi-hero { grid-column: span 2; }
  .kpi-value { font-size: 22px; }
  .kpi-hero .kpi-value { font-size: 28px; }
  .card { padding: 14px; }
  .barh-row { grid-template-columns: minmax(90px, 40%) 1fr; gap: 8px; }
  .filter { flex: 1 1 calc(50% - 10px); min-width: 0; padding-left: 8px; }
  .filter-label { display: none; }
  .filter select { max-width: none; flex: 1; min-width: 0; width: 100%; }
  .seg { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .owner-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-wrap { padding: 0; align-items: flex-end; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; }
  .strip-stats { grid-template-columns: repeat(3, 1fr); }
  .tl-btn { grid-template-columns: 56px minmax(0, 1fr) auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .sidebar, .tabbar, .page-actions, .filters, .card-actions { display: none !important; }
  .main { margin: 0; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
