/* ============================================================
   Panel-Dashboard · Real Flow AI · v3 (preview)
   - Soporte dual: [data-theme="dark"] (default) + [data-theme="light"]
   - Tokens semánticos · cero hardcoded
   - Tipografía Inter · spacing/sombras refinadas
   ============================================================ */

* { box-sizing: border-box; }

html { color-scheme: dark light; }
html, body {
  margin: 0; padding: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-page);
  color: var(--text);
  transition: background-color 200ms ease, color 200ms ease;
}

:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;

  --radius-sm: 4px;
  --radius:    6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition:      200ms cubic-bezier(0.4, 0, 0.2, 1);

  --brand-orange:        #E85D04;
  --brand-orange-bright: #FF6E1F;
  --brand-cyan:          #06b6d4;
  --brand-purple:        #8b5cf6;
}

[data-theme="dark"] {
  --bg-page:      #0a0e14;
  --bg-panel:     #11161e;
  --bg-subtle:    #161c25;
  --bg-elevated:  #1c2330;
  --bg-deep:      #060a10;
  --bg-hover:     #1f2733;

  --border:        #232a36;
  --border-soft:   #1a212c;
  --border-strong: #353e4d;
  --border-focus:  #E85D04;

  --text:        #e6edf3;
  --text-strong: #ffffff;
  --text-muted:  #8b95a3;
  --text-dim:    #5d6772;

  --green:         #3fb950;
  --green-bright:  #56d364;
  --green-bg:      rgba(63, 185, 80, 0.12);
  --green-border:  rgba(63, 185, 80, 0.32);

  --amber:         #e3b341;
  --amber-bright:  #f1c75a;
  --amber-bg:      rgba(227, 179, 65, 0.12);
  --amber-border:  rgba(227, 179, 65, 0.32);

  --coral:         #da3633;
  --coral-bright:  #ff7b7b;
  --coral-bg:      rgba(218, 54, 51, 0.14);
  --coral-border:  rgba(218, 54, 51, 0.36);

  --orange:        #E85D04;
  --orange-bright: #FF6E1F;
  --orange-bg:     rgba(249, 115, 22, 0.14);
  --orange-border: rgba(249, 115, 22, 0.36);

  --cyan:          #06b6d4;
  --cyan-bg:       rgba(6, 182, 212, 0.12);

  --purple:        #a78bfa;
  --purple-bg:     rgba(167, 139, 250, 0.14);

  --bubble-in:     var(--bg-elevated);
  --bubble-out:    rgba(249, 115, 22, 0.14);

  --skeleton-base:  #1a212c;
  --skeleton-shine: #232b38;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow:    0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);

  --bar-bg: var(--bg-deep);
}

[data-theme="light"] {
  --bg-page:      #f7f8fa;
  --bg-panel:     #ffffff;
  --bg-subtle:    #f1f3f5;
  --bg-elevated:  #f7f8fa;
  --bg-deep:      #eceef1;
  --bg-hover:     #f1f3f5;

  --border:        #e4e7eb;
  --border-soft:   #ecedf1;
  --border-strong: #c1c7d0;
  --border-focus:  #E85D04;

  --text:        #1a202c;
  --text-strong: #0d1117;
  --text-muted:  #5b6776;
  --text-dim:    #8b95a3;

  --green:         #16a34a;
  --green-bright:  #22c55e;
  --green-bg:      #ecfdf5;
  --green-border:  #a7f3d0;

  --amber:         #b45309;
  --amber-bright:  #d97706;
  --amber-bg:      #fffbeb;
  --amber-border:  #fcd34d;

  --coral:         #dc2626;
  --coral-bright:  #ef4444;
  --coral-bg:      #fef2f2;
  --coral-border:  #fecaca;

  --orange:        #ea580c;
  --orange-bright: #E85D04;
  --orange-bg:     #fff7ed;
  --orange-border: #fed7aa;

  --cyan:          #0891b2;
  --cyan-bg:       #ecfeff;

  --purple:        #7c3aed;
  --purple-bg:     #f5f3ff;

  --bubble-in:     var(--bg-elevated);
  --bubble-out:    rgba(232, 93, 4, 0.10);

  --skeleton-base:  #eceef1;
  --skeleton-shine: #f5f6f8;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow:    0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.18);

  --bar-bg: #eceef1;
}

a { color: var(--cyan); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--orange-bright); }

button { font-family: inherit; }

::selection { background: var(--orange); color: white; }

:where(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.dashboard { max-width: 1280px; margin: 0 auto; }

/* ===== NAVBAR v4 · barra superior navy (Option B · port 2026-06-01) ===== */
:root { --navy: #0A1628; }   /* navy de marca (realflowai.mx) */
[data-theme="dark"] { --navy: #0c1118; }

.navbar {
  background: var(--navy);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.navbar-row { max-width: 1280px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; }
.navbar-top {
  justify-content: space-between; min-height: 56px; gap: var(--space-3); flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.navbar-brand { display: flex; align-items: center; gap: 11px; }
.navbar-biz .bn { color: #fff; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.navbar-biz .bs { color: rgba(255,255,255,0.5); font-size: 12px; margin-top: 1px; }
.navbar-right { display: flex; align-items: center; gap: var(--space-3); }

/* Overrides de contraste sobre fondo navy */
.navbar .business-phone {
  color: rgba(255,255,255,0.72); font-size: 12.5px; font-weight: 500;
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
}
.navbar .user-chip { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.13); }
.navbar .user-chip-name { color: #fff; }
.navbar .user-chip-logout { color: rgba(255,255,255,0.7); }
.navbar .user-chip-logout:hover { color: #fff; }
.navbar .theme-toggle {
  border-color: rgba(255,255,255,0.16); background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.78);
}
.navbar .theme-toggle:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* Tabs */
.nav-tabs { gap: 4px; flex-wrap: wrap; }
.nav-tab {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer;
  color: rgba(255,255,255,0.65); text-decoration: none; font-weight: 500; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--transition-fast);
}
.nav-tab svg { width: 16px; height: 16px; }
.nav-tab:hover { color: #fff; }
.nav-tab.on { color: #fff; border-bottom-color: var(--orange); }
.nav-tab .soon {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
  background: rgba(255,255,255,0.16); color: #fff; padding: 2px 6px; border-radius: var(--radius-pill); margin-left: 2px;
}
.navbar .nav-badge { background: var(--orange); color: #fff; border-color: transparent; }

/* Subbar · contexto del dashboard (periodo + live) */
.subbar {
  max-width: 1280px; margin: 0 auto; padding: 12px 28px;
  display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3); flex-wrap: wrap;
}
@media (max-width: 720px) { .navbar-row, .subbar { padding-left: 16px; padding-right: 16px; } }

/* ===== TOPBAR (legacy · usado por calendar.html / conversation.html hasta migrarlas) ===== */
.topbar {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.brand { display: flex; align-items: center; gap: 10px; }

.av {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-bright));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.35);
}

.bn {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}

.bs {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}

.topbar-right { display: flex; align-items: center; gap: var(--space-3); }

/* Context-bar · sub-barra debajo de la nav con controles del contexto actual */
.context-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-soft);
}
.context-bar-left {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.context-bar-right {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
@media (max-width: 720px) {
  .context-bar { padding: 8px 16px; }
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--green);
  text-transform: uppercase;
  padding: 4px 10px;
  background: var(--green-bg);
  border-radius: var(--radius-pill);
  border: 1px solid var(--green-border);
}

.ld {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 6px var(--green);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* User chip (sesión activa + logout) */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  max-width: 220px;
}

.user-chip-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.user-chip-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.user-chip-logout:hover {
  color: var(--coral);
  background: var(--coral-bg);
}

/* Theme toggle */
.theme-toggle {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: inline-block; }
[data-theme="light"] .theme-toggle .icon-sun  { display: inline-block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Period selector buttons */
.period-selector {
  display: inline-flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
}

.period-selector .db {
  padding: 5px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.period-selector .db:hover { color: var(--text); }

.period-selector .db.on {
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ===== PANEL NAV ===== */
.panel-nav {
  display: flex;
  gap: 4px;
  margin: 16px 16px 0;
  padding: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: max-content;
}

.panel-nav-link {
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  text-decoration: none;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.panel-nav-link:hover { color: var(--text); background: var(--bg-hover); }

.panel-nav-link.on {
  background: var(--orange);
  color: white;
}
.panel-nav-link.on:hover { background: var(--orange-bright); color: white; }

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: var(--radius-pill);
  background: var(--orange-bg);
  color: var(--orange);
  font-size: 10.5px;
  font-weight: 700;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  line-height: 1;
  border: 1px solid var(--orange-border);
}
.panel-nav-link.on .nav-badge { background: rgba(255,255,255,0.22); color: white; border-color: transparent; }
.nav-badge:empty { display: none; }

/* ===== KPIs ===== */
.kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding: 14px 20px 8px;
}
.kpis-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) { .kpis, .kpis-4 { grid-template-columns: repeat(2, 1fr); } }

.kpi {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px 6px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  overflow: hidden;
}

.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.kpi-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.kv {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-strong);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.kv.o { color: var(--orange); }
.kv.y { color: var(--amber); }
.kv.g { color: var(--green); }
.kv.r { color: var(--coral); }
.kv.p { color: var(--purple); }

.kpi-delta {
  font-size: 11px;
  font-weight: 600;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  white-space: nowrap;
}
.kpi-delta:empty { display: none; }
.kpi-delta .delta-arrow { font-size: 10px; line-height: 1; }
.kpi-delta.up    { color: var(--green);  background: var(--green-bg);  border-color: var(--green-border); }
.kpi-delta.down  { color: var(--coral);  background: var(--coral-bg);  border-color: var(--coral-border); }
.kpi-delta.flat  { color: var(--text-muted); background: var(--bg-elevated); border-color: var(--border); }

.kl {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 0;
  font-weight: 500;
  line-height: 1.3;
}

.kpi-spark {
  margin-top: 4px;
  height: 18px;
  position: relative;
}
.kpi-spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.kpi-spark .spark-area { opacity: 0.22; }
.kpi-spark .spark-line { fill: none; stroke-width: 1.6; }
.kpi-spark.up    .spark-line  { stroke: var(--green); }
.kpi-spark.up    .spark-area  { fill: var(--green); }
.kpi-spark.down  .spark-line  { stroke: var(--coral); }
.kpi-spark.down  .spark-area  { fill: var(--coral); }
.kpi-spark.flat  .spark-line  { stroke: var(--text-muted); }
.kpi-spark.flat  .spark-area  { fill: var(--text-muted); }
.kpi-spark.brand .spark-line  { stroke: var(--orange); }
.kpi-spark.brand .spark-area  { fill: var(--orange); }
.kpi-spark.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ===== BODY ===== */
.body { padding: 4px 20px 20px; }

/* ===== CONTRACT BAR · rediseñado v2 ===== */
.contract-bar {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 18px 10px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.contract-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.contract-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.005em;
  line-height: 1.3;
}

.contract-track {
  position: relative;
  height: 8px;
  background: var(--bar-bg);
  border-radius: var(--radius-pill);
  overflow: visible;
  margin: 12px 0 6px;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: var(--radius-pill);
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1), background-color 400ms ease;
}
.progress-fill.warn { background: var(--amber); }
.progress-fill.crit { background: var(--coral); }

.progress-marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--text-muted);
  left: 50%;
  border-radius: 1px;
}
.progress-marker-label {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.contract-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.contract-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.contract-stat-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.contract-stat-value {
  font-size: 16px;
  font-weight: 700;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}
.contract-detail {
  font-size: 12px;
  color: var(--text-muted);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.pct-value {
  font-size: 22px;
  font-weight: 700;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}

/* ===== TRIAGE ===== */
.triage {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 768px) { .triage { grid-template-columns: 1fr; } }

/* Triage strip · versión compacta horizontal · reemplaza .triage en dashboard */
.triage-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.triage-strip-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-right: 4px;
}
.tchip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}
.tchip:hover { background: var(--bg-elevated); }
.tchip-num {
  font-weight: 700;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.tchip.crit { border-color: var(--coral-border); background: var(--coral-bg); }
.tchip.crit .tchip-num { color: var(--coral); }
.tchip.mod  { border-color: var(--amber-border); background: var(--amber-bg); }
.tchip.mod  .tchip-num { color: var(--amber); }
.tchip.low  { border-color: var(--green-border); background: var(--green-bg); }
.tchip.low  .tchip-num { color: var(--green); }
.tchip.zero { opacity: 0.55; background: var(--bg-panel); border-color: var(--border-soft); }
.tchip.zero .tchip-num { color: var(--text-muted); }

.tbox {
  border-radius: var(--radius-md);
  padding: 14px 16px 14px 20px;
  border: 1px solid;
  background: var(--bg-panel);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.tbox::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
}

.tbox.crit { border-color: var(--coral-border); }
.tbox.crit::before { background: var(--coral); }
.tbox.mod  { border-color: var(--amber-border); }
.tbox.mod::before  { background: var(--amber); }
.tbox.low  { border-color: var(--green-border); }
.tbox.low::before  { background: var(--green); }

.tnum {
  font-size: 30px;
  font-weight: 700;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.tnum.r { color: var(--coral); }
.tnum.y { color: var(--amber); }
.tnum.g { color: var(--green); }

.tlabel {
  font-size: 13px;
  color: var(--text);
  margin-top: 4px;
  font-weight: 500;
}

.tbadge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  margin-top: 8px;
  display: inline-block;
  font-weight: 500;
}

.tb-r { background: var(--coral-bg); color: var(--coral); }
.tb-y { background: var(--amber-bg); color: var(--amber); }
.tb-g { background: var(--green-bg); color: var(--green); }

/* ===== TOOLBAR (legacy) ===== */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

.tl-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 6px;
}

.bc {
  background: var(--coral);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
}

.divider { width: 1px; height: 16px; background: var(--border); margin: 0 4px; }

.filter-btns, .date-btns { display: flex; gap: 4px; }

.fb, .db {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.fb:hover, .db:hover { color: var(--text); border-color: var(--border-strong); }

.fb.on {
  background: var(--orange);
  color: white;
  border-color: var(--orange);
}

.date-group { display: flex; align-items: center; gap: 6px; }
.date-label { font-size: 13px; color: var(--text-dim); }
.spacer { flex: 1; }

.search {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  width: 220px;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-bg);
}

/* ===== PENDING TABLE (legacy) ===== */
.table-wrap {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.thead {
  display: grid;
  grid-template-columns: 20px 200px 1fr 150px 80px 100px 100px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  align-items: center;
}

.th {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.row {
  display: grid;
  grid-template-columns: 20px 200px 1fr 150px 80px 100px 100px;
  padding: 12px 16px;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--transition-fast);
}

.row:last-child { border-bottom: none; }
.row:hover { background: var(--bg-hover); }
.row.crit { border-left: 3px solid var(--coral); }
.row.mod  { border-left: 3px solid var(--amber); }
.row.low  { border-left: 3px solid var(--green); }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dr { background: var(--coral); box-shadow: 0 0 6px var(--coral-border); }
.dy { background: var(--amber); }
.dg { background: var(--green); }

.cell-client { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cname { font-size: 14px; color: var(--text); font-weight: 600; }

.cnum {
  font-size: 12px;
  color: var(--text-dim);
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

.cmsg {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-style: italic;
  padding-right: 8px;
}

.tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  display: inline-block;
  font-weight: 500;
  white-space: nowrap;
}

.tag-r { background: var(--coral-bg); color: var(--coral); }
.tag-y { background: var(--amber-bg); color: var(--amber); }
.tag-g { background: var(--green-bg); color: var(--green); }

.ago {
  font-size: 12px;
  color: var(--text-dim);
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.actions { display: flex; gap: 4px; align-items: center; }

.btn-sm {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-muted);
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.btn-sm:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-hover); }

.btn-o {
  background: var(--orange);
  color: white;
  border-color: var(--orange);
}
.btn-o:hover { background: var(--orange-bright); color: white; border-color: var(--orange-bright); }

.btn-g {
  background: var(--bg-panel);
  border-color: var(--green-border);
  color: var(--green);
}
.btn-g:hover { background: var(--green-bg); color: var(--green); border-color: var(--green); }

/* ===== SECTION ===== */
.section { margin-bottom: var(--space-6); }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  letter-spacing: -0.005em;
}

.section-eyebrow {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.section-headblock {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--space-3);
  gap: var(--space-3);
  flex-wrap: wrap;
}

.section-title .count {
  background: var(--bg-elevated);
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  text-transform: none;
  letter-spacing: 0;
}

.see-all { font-size: 12px; color: var(--text-muted); }
.see-all a { color: var(--cyan); }

/* ===== CONV LIST ===== */
.conv-list {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* Estilos visuales internos de .conv-item · el grid/layout se define más abajo (sección dual-col) */
.conv-item .name .cnum {
  font-weight: 400;
  color: var(--text-dim);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  margin-left: 6px;
  font-size: 12px;
}

.see-more {
  text-align: center;
  padding: 14px;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-soft);
}

.conv-item .name {
  font-weight: 600;
  color: var(--text-strong);
  font-size: 13px;
  line-height: 1.3;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-item .preview {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.conv-item .status-tag {
  font-size: 10px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.conv-item .status-tag.active   { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.conv-item .status-tag.handoff  { background: var(--coral-bg); color: var(--coral); border: 1px solid var(--coral-border); }
.conv-item .status-tag.closed   { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }

.conv-item .ts {
  font-size: 11px;
  color: var(--text-dim);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  white-space: nowrap;
}

/* ===== EMPTY / LOADING ===== */
.empty, .loading {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.empty .emoji {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
  opacity: 0.7;
}

/* ===== CONVERSATION DETAIL ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  margin: 16px 20px 0;
  font-weight: 500;
  transition: color var(--transition-fast);
}
.back-link:hover { color: var(--text); }

.conv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: var(--space-3);
  background: var(--bg-panel);
}

.conv-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.01em;
}

.conv-header small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 3px;
}

.status-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-badge.ok      { background: var(--green-bg);  color: var(--green);  border-color: var(--green-border); }
.status-badge.warn    { background: var(--amber-bg);  color: var(--amber);  border-color: var(--amber-border); }
.status-badge.crit    { background: var(--coral-bg);  color: var(--coral);  border-color: var(--coral-border); }
.status-badge.neutral { background: var(--bg-elevated); color: var(--text-muted); border-color: var(--border); }

.message-thread {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}

.msg {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  max-width: 80%;
  font-size: 13.5px;
  line-height: 1.55;
  border: 1px solid transparent;
}

.msg.user {
  background: var(--bg-elevated);
  align-self: flex-start;
  border-color: var(--border);
  border-bottom-left-radius: 3px;
  color: var(--text);
}

.msg.assistant {
  background: var(--orange-bg);
  border-color: var(--orange-border);
  align-self: flex-end;
  border-bottom-right-radius: 3px;
  color: var(--text);
}

.msg.human {
  background: var(--green-bg);
  border-color: var(--green-border);
  align-self: flex-end;
  border-bottom-right-radius: 3px;
  color: var(--text);
}

.msg.system {
  background: var(--bg-subtle);
  align-self: center;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  max-width: 70%;
  text-align: center;
}

.msg .role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 700;
}

.msg .ts {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

/* ===== ESCALATION CARDS ===== */
.escalations { display: grid; gap: var(--space-3); }

.esc-card {
  background: var(--coral-bg);
  border: 1px solid var(--coral-border);
  border-left: 3px solid var(--coral);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.esc-card.handled {
  background: var(--bg-panel);
  border-color: var(--border);
  border-left-color: var(--green);
}

.esc-card .name { font-weight: 600; font-size: 14px; color: var(--text-strong); }
.esc-card .meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.esc-card .reason {
  display: inline-block;
  background: var(--coral-bg);
  color: var(--coral);
  padding: 2px 8px;
  border-radius: var(--radius);
  font-size: 11px;
  margin-right: 6px;
  font-weight: 600;
  border: 1px solid var(--coral-border);
}

.esc-card .quote {
  margin: 10px 0 4px 0;
  padding: 8px 12px;
  background: var(--bg-panel);
  border-left: 2px solid var(--coral);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 12.5px;
  font-style: italic;
  color: var(--text);
}

.section-title.urgent .count {
  background: var(--coral-bg);
  color: var(--coral);
  border-color: var(--coral-border);
}

/* Refresh button (conversation.html · inline styles override) */
#refresh-now {
  padding: 6px 12px !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--border) !important;
  background: var(--bg-elevated) !important;
  color: var(--text) !important;
  font-size: 12px !important;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
#refresh-now:hover {
  background: var(--bg-hover) !important;
  border-color: var(--border-strong) !important;
}

/* ============================================================
   v3.1 (2026-05-12 noche) · Dual-col layout + WhatsApp master-detail
   ============================================================ */

/* Business phone in topbar (a la izq de period selector) */
.business-phone {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Dual column: Pendientes (izq) + Conversaciones (der) */
.dual-col {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 12px;
  margin-top: 14px;
}
.dual-col .section { margin: 0; }
.pending-col { min-height: 600px; display: flex; flex-direction: column; }
.pending-col #pending-rows { flex: 1; }
.conv-col { display: flex; flex-direction: column; min-height: 600px; }

/* Conversations split · lista | chat */
.conv-split {
  display: grid;
  grid-template-columns: 320px 1fr;
  flex: 1;
  border-top: 1px solid var(--border);
  min-height: 540px;
  max-height: 720px;
}
.conv-list-pane {
  border-right: 1px solid var(--border);
  overflow: hidden;
  padding: 6px;
}
.conv-list-pane .conv-list {
  display: flex; flex-direction: column; gap: 4px;
}
/* Layout flexbox · más determinístico que grid para 5 items con jerarquía clara */
.conv-item {
  cursor: pointer;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.conv-item > .avatar { flex-shrink: 0; }
.conv-item .conv-body {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.conv-item .conv-meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
a.conv-item:hover { color: inherit; text-decoration: none; }
.conv-item:hover { background: var(--bg-elevated); border-color: var(--border); }
.conv-item-selected,
.conv-item-selected:hover {
  background: var(--bg-elevated);
  border-color: transparent;
  box-shadow: inset 3px 0 0 var(--orange);
}
.conv-item .name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.conv-item .preview {
  font-size: 11.5px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 220px;
}
.conv-item .ts { font-size: 10px; color: var(--text-dim); grid-column: 2; }
.conv-item .status-tag { font-size: 10px; padding: 2px 7px; align-self: start; }

/* Chat pane (derecha del split) */
.conv-chat-pane {
  display: flex; flex-direction: column;
  overflow: hidden;
}
.chat-empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--text-dim); padding: 24px;
}
.chat-empty-icon { font-size: 42px; opacity: 0.4; }
.chat-empty-text { font-size: 13px; text-align: center; max-width: 280px; line-height: 1.5; }
.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.chat-header-name { font-size: 14px; font-weight: 600; color: var(--text); }
.chat-header-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.chat-header-link { color: var(--cyan); text-decoration: none; }
.chat-header-link:hover { text-decoration: underline; }
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.chat-bubble {
  max-width: 75%;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  word-wrap: break-word;
}
.chat-bubble-text { color: var(--text); white-space: pre-wrap; }
.chat-bubble-ts {
  font-size: 9.5px; color: var(--text-dim); margin-top: 4px;
  text-align: right;
}
.chat-bubble-left {
  align-self: flex-start;
  background: var(--bubble-in);
  border-bottom-left-radius: 2px;
}
.chat-bubble-right {
  align-self: flex-end;
  background: var(--bubble-out);
  border-bottom-right-radius: 2px;
}

/* Mobile · collapse a 1 columna */
@media (max-width: 980px) {
  .dual-col {
    grid-template-columns: 1fr;
  }
  .conv-split {
    grid-template-columns: 1fr;
  }
  .conv-list-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 280px;
  }
  .business-phone { display: none; }
}

/* ===== SKELETON LOADERS · reemplazan empty/loading con emoji ===== */
.skeleton-list {
  display: flex; flex-direction: column; gap: 6px;
  padding: 4px 0;
}
.sk-row {
  display: grid;
  grid-template-columns: 1fr 60px;
  gap: 6px 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
}
.sk-row > div { display: flex; flex-direction: column; gap: 6px; }
.sk-bar {
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--skeleton-base) 0%, var(--skeleton-shine) 50%, var(--skeleton-base) 100%);
  background-size: 200% 100%;
  animation: sk-shine 1400ms ease-in-out infinite;
}
.sk-bar.w-70 { width: 70%; }
.sk-bar.w-90 { width: 90%; }
.sk-bar.w-40 { width: 40%; }
@keyframes sk-shine {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== EMPTY STATE refinado (sin emoji 40pt) ===== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  background: var(--bg-panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
}
.empty-state .es-icon {
  width: 36px; height: 36px;
  margin: 0 auto 10px;
  color: var(--text-dim);
  stroke-width: 1.5;
}
.empty-state .es-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.empty-state .es-sub {
  font-size: 12px;
  color: var(--text-dim);
}
.empty-state .es-cta {
  margin-top: 12px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-fast);
}
.empty-state .es-cta:hover { background: var(--bg-hover); border-color: var(--border-strong); }

/* ===== TOAST · top-right notifications ===== */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 260px;
  max-width: 380px;
  padding: 12px 14px 12px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-muted);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toast-in 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--coral); }
.toast.info    { border-left-color: var(--cyan); }
.toast-icon {
  flex-shrink: 0;
  width: 18px; height: 18px;
  margin-top: 1px;
}
.toast.success .toast-icon { color: var(--green); }
.toast.error   .toast-icon { color: var(--coral); }
.toast.info    .toast-icon { color: var(--cyan); }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 2px 4px;
  font-size: 16px;
  line-height: 1;
}
.toast-close:hover { color: var(--text); }
.toast.toast-out { animation: toast-out 200ms cubic-bezier(0.4, 0, 0.2, 1) forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ===== AVATARES con iniciales · color hash determinístico ===== */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  background: var(--text-muted);
  user-select: none;
}
.avatar.av-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.avatar-anon {
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
}
.avatar.avatar-anon svg { width: 18px; height: 18px; opacity: 0.8; }
.avatar.avatar-anon.av-sm svg { width: 14px; height: 14px; }

/* ===== BIZ SELECT · admin business switcher en context-bar ===== */
.biz-select {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
  height: 32px;
}
.biz-select-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange);
  background: var(--orange-bg);
  border-right: 1px solid var(--border);
}
.biz-select-input {
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  padding: 0 28px 0 10px;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b95a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
}
.biz-select-input:hover { color: var(--text-strong); }
.biz-select-input option { background: var(--bg-panel); color: var(--text); }

/* ===== CONV-TOOLBAR · search + filter chips arriba de la lista ===== */
.conv-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-panel);
  flex-wrap: wrap;
}
.conv-search {
  position: relative;
  flex: 1 1 200px;
  min-width: 160px;
}
.conv-search-input {
  width: 100%;
  height: 32px;
  padding: 0 12px 0 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}
.conv-search-input::placeholder { color: var(--text-dim); }
.conv-search-input:focus { border-color: var(--orange); background: var(--bg-panel); }
.conv-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-dim);
  pointer-events: none;
}
.conv-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: none;
}
.conv-search-input:not(:placeholder-shown) + .conv-search-clear { display: inline-flex; align-items: center; justify-content: center; }

.filter-chips {
  display: inline-flex;
  gap: 4px;
}
.filter-chip {
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}
.filter-chip:hover { color: var(--text); background: var(--bg-elevated); }
.filter-chip.on {
  background: var(--bg-elevated);
  color: var(--text-strong);
  border-color: var(--border);
}

/* Override conv-list-pane para hacer espacio al toolbar */
.conv-list-pane { display: flex; flex-direction: column; }
.conv-list-pane .conv-list { padding: 6px 6px 12px; overflow-y: auto; overflow-x: hidden; flex: 1; scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.conv-list-pane .conv-list::-webkit-scrollbar { width: 8px; }
.conv-list-pane .conv-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
.conv-list-pane .conv-list::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 720px) {
  .conv-toolbar { padding: 8px 10px; gap: 6px; }
  .filter-chip { padding: 4px 9px; font-size: 11px; }
}
