/* ==========================================================================
   Noa 2027 — sistema visual "Calma operativa"
   Claro por defecto, oscuro automático. Un solo color de acción (índigo).
   ========================================================================== */

:root {
  --bg: #F7F7F5;
  --side: #FBFBFA;
  --surface: #FFFFFF;
  --surface-2: #F4F4F5;
  --input: #FFFFFF;
  --text: #18181B;
  --text-2: #52525B;
  --text-3: #6B6B74;
  --line: #E7E7E3;
  --line-strong: #D4D4D8;
  --seg: #EFEFEC;
  --seg-on: #FFFFFF;
  --nav-active: #EEEEFB;
  --hint: #EEF0FF;
  --accent: #4F46E5;
  --accent-hover: #4338CA;
  --accent-soft: #EEF0FF;
  --accent-text: #3730A3;
  --on-accent: #FFFFFF;
  --ok: #067647;
  --ok-soft: #D1FADF;
  --ok-dot: #12B76A;
  --urgent-bg: #FEE4E2; --urgent-fg: #B42318; --urgent-dot: #D92D20;
  --high-bg: #FEF0C7;   --high-fg: #93370D;   --high-dot: #DC6803;
  --mid-bg: #F4F4F5;    --mid-fg: #3F3F46;    --mid-dot: #71717A;
  --wait-bg: #EEF0FF;   --wait-fg: #3730A3;   --wait-dot: #6366F1;
  --toast-bg: #18181B; --toast-fg: #FAFAFA; --toast-btn: #27272A; --toast-link: #C7D2FE;
  --bubble-in: #FFFFFF;
  --bubble-out: #4F46E5;
  --shadow-1: 0 1px 2px rgba(16, 16, 20, 0.05);
  --shadow-2: 0 10px 30px rgba(16, 16, 20, 0.10);
  --scrim: rgba(9, 9, 11, 0.42);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F0F11; --side: #141417; --surface: #18181B; --surface-2: #1F1F23; --input: #18181B;
    --text: #FAFAFA; --text-2: #A1A1AA; --text-3: #8B8B94;
    --line: #27272A; --line-strong: #3F3F46; --seg: #1F1F23; --seg-on: #2E2E33;
    --nav-active: #232329; --hint: #1E1B4B;
    --accent: #6366F1; --accent-hover: #818CF8; --accent-soft: #1E1B4B; --accent-text: #C7D2FE;
    --ok: #75E0A7; --ok-soft: #053321;
    --urgent-bg: #3B1210; --urgent-fg: #FDA29B; --urgent-dot: #F04438;
    --high-bg: #3A2410;   --high-fg: #FEC84B;   --high-dot: #F79009;
    --mid-bg: #232329;    --mid-fg: #D4D4D8;    --mid-dot: #A1A1AA;
    --wait-bg: #1E1B4B;   --wait-fg: #C7D2FE;   --wait-dot: #818CF8;
    --toast-bg: #FAFAFA; --toast-fg: #18181B; --toast-btn: #E4E4E7; --toast-link: #3730A3;
    --bubble-in: #232329; --bubble-out: #4F46E5;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5);
    --scrim: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F0F11; --side: #141417; --surface: #18181B; --surface-2: #1F1F23; --input: #18181B;
  --text: #FAFAFA; --text-2: #A1A1AA; --text-3: #8B8B94;
  --line: #27272A; --line-strong: #3F3F46; --seg: #1F1F23; --seg-on: #2E2E33;
  --nav-active: #232329; --hint: #1E1B4B;
  --accent: #6366F1; --accent-hover: #818CF8; --accent-soft: #1E1B4B; --accent-text: #C7D2FE;
  --ok: #75E0A7; --ok-soft: #053321;
  --urgent-bg: #3B1210; --urgent-fg: #FDA29B; --urgent-dot: #F04438;
  --high-bg: #3A2410;   --high-fg: #FEC84B;   --high-dot: #F79009;
  --mid-bg: #232329;    --mid-fg: #D4D4D8;    --mid-dot: #A1A1AA;
  --wait-bg: #1E1B4B;   --wait-fg: #C7D2FE;   --wait-dot: #818CF8;
  --toast-bg: #FAFAFA; --toast-fg: #18181B; --toast-btn: #E4E4E7; --toast-link: #3730A3;
  --bubble-in: #232329; --bubble-out: #4F46E5;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 12px 32px rgba(0, 0, 0, 0.5);
  --scrim: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
svg.i { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i-sm { width: 16px; height: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Botones ---------- */
.btn {
  height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: background-color 160ms ease-out, transform 120ms ease-out, border-color 160ms;
}
.btn:active { transform: scale(0.97); }
a.btn { text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); font-weight: 500; padding: 0 12px; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 160ms, transform 120ms;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn.plain { border-color: transparent; background: transparent; color: var(--text-2); }

/* ---------- Chips / etiquetas ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; }
.tag.urgent { background: var(--urgent-bg); color: var(--urgent-fg); } .tag.urgent .dot { background: var(--urgent-dot); }
.tag.high { background: var(--high-bg); color: var(--high-fg); } .tag.high .dot { background: var(--high-dot); }
.tag.mid { background: var(--mid-bg); color: var(--mid-fg); } .tag.mid .dot { background: var(--mid-dot); }
.tag.wait { background: var(--wait-bg); color: var(--wait-fg); } .tag.wait .dot { background: var(--wait-dot); }
.tag.plain { background: var(--surface-2); color: var(--text-2); font-weight: 500; }

.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--seg); gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button {
  height: 36px; padding: 0 14px; border-radius: 9px; border: none; background: transparent;
  color: var(--text-2); font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background-color 160ms, color 160ms;
}
.seg button[aria-selected="true"] { background: var(--seg-on); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 500; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Avatares ---------- */
.av {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; letter-spacing: 0.01em;
}
.av.lg { width: 52px; height: 52px; font-size: 17px; }
.av.c0 { background: #E0E7FF; color: #3730A3; } .av.c1 { background: #D1FAE5; color: #065F46; }
.av.c2 { background: #FFEDD5; color: #9A3412; } .av.c3 { background: #F3E8FF; color: #6B21A8; }
.av.c4 { background: #E0F2FE; color: #075985; } .av.c5 { background: #FCE7F3; color: #9D174D; }
:root[data-theme="dark"] .av.c0 { background: #312E81; color: #C7D2FE; } :root[data-theme="dark"] .av.c1 { background: #064E3B; color: #A7F3D0; }
:root[data-theme="dark"] .av.c2 { background: #7C2D12; color: #FED7AA; } :root[data-theme="dark"] .av.c3 { background: #3B0764; color: #E9D5FF; }
:root[data-theme="dark"] .av.c4 { background: #0C4A6E; color: #BAE6FD; } :root[data-theme="dark"] .av.c5 { background: #831843; color: #FBCFE8; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .av.c0 { background: #312E81; color: #C7D2FE; } :root:not([data-theme="light"]) .av.c1 { background: #064E3B; color: #A7F3D0; }
  :root:not([data-theme="light"]) .av.c2 { background: #7C2D12; color: #FED7AA; } :root:not([data-theme="light"]) .av.c3 { background: #3B0764; color: #E9D5FF; }
  :root:not([data-theme="light"]) .av.c4 { background: #0C4A6E; color: #BAE6FD; } :root:not([data-theme="light"]) .av.c5 { background: #831843; color: #FBCFE8; }
}

/* ---------- Estructura ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

.side {
  width: 240px; flex-shrink: 0; display: flex; flex-direction: column; gap: 18px; padding: 18px 14px;
  border-right: 1px solid var(--line); background: var(--side); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
.brand-name { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.acct {
  height: 40px; width: 100%; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; text-align: left;
}
.acct .status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mid-dot); flex-shrink: 0; }
.acct .status-dot.on { background: var(--ok-dot); }
.acct .status-dot.warn { background: var(--high-dot); }
.acct span.grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 12px; font-weight: 600; color: var(--text-3); padding: 0 12px 6px; }
.nav a {
  height: 40px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: 10px;
  color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background-color 140ms;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--nav-active); color: var(--text); font-weight: 600; }
.nav a .count { margin-left: auto; font-size: 12px; color: var(--text-3); }
.nav a .badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.nav.sub a { height: 36px; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 6px 0; border-top: 1px solid var(--line); }
.side-foot .who { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.side-foot .who strong { font-size: 14px; }
.side-foot .who span { font-size: 12px; color: var(--text-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 16px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.cmd {
  flex: 1; max-width: 640px; height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  border-radius: 12px; background: var(--input); border: 1px solid var(--line); color: var(--text-3); text-align: left;
}
.cmd:hover { border-color: var(--line-strong); }
.cmd .grow { flex: 1; font-size: 15px; }
.kbd { font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--text-2); }
.sync { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.sync .status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mid-dot); }
.sync .status-dot.on { background: var(--ok-dot); }
.sync .status-dot.warn { background: var(--high-dot); }

.view { flex: 1; min-height: 0; display: flex; }
.view-pad { padding: 28px; overflow-y: auto; flex: 1; }

.tabbar { display: none; }

/* ---------- Encabezado de sección ---------- */
.h-title { margin: 0; font-family: var(--font-display); font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
.h-sub { margin: 4px 0 0; color: var(--text-2); font-size: 15px; }
.h-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.h-row > :first-child { flex: 1; min-width: 0; }
.h-row > :last-child:not(:first-child) { flex-shrink: 0; }

/* ---------- HOY ---------- */
.inbox { width: 520px; flex-shrink: 0; display: flex; flex-direction: column; gap: 18px; padding: 28px 24px 0 28px; border-right: 1px solid var(--line); min-height: 0; }
.inbox-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-bottom: 24px; margin: 0 -6px; padding-left: 6px; padding-right: 6px; }
.row {
  width: 100%; display: flex; gap: 14px; padding: 14px 16px; border-radius: 14px; border: 1px solid transparent;
  background: transparent; text-align: left; color: var(--text);
  transition: background-color 160ms, border-color 160ms, opacity 200ms, transform 220ms var(--ease), max-height 260ms var(--ease), padding 260ms var(--ease), margin 260ms var(--ease);
  max-height: 640px; overflow: hidden; flex-shrink: 0;
}
.row:hover { background: var(--surface); }
.row[aria-current="true"] { background: var(--surface); border-color: var(--accent); box-shadow: var(--shadow-1); }
.row.leaving { opacity: 0; transform: translateX(24px); max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: -6px; }
.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-top { display: flex; align-items: center; gap: 8px; }
.row-name { font-size: 15px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-when { font-size: 12px; color: var(--text-3); flex-shrink: 0; }
.row-ask { font-size: 14px; line-height: 1.45; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-tags { display: flex; gap: 6px; padding-top: 2px; flex-wrap: wrap; }
.row-actions { display: none; }

.detail { flex: 1; min-width: 0; overflow-y: auto; padding: 28px 36px 40px; }
.detail-inner { max-width: 760px; display: flex; flex-direction: column; gap: 22px; animation: fadeIn 200ms ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
.d-head { display: flex; align-items: center; gap: 14px; }
.d-head .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.d-head h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.d-head .meta { font-size: 14px; color: var(--text-2); }
.why { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--hint); }
.why p { margin: 0; font-size: 15px; line-height: 1.55; }
.why svg { color: var(--accent); margin-top: 2px; }
.section-label { font-size: 13px; font-weight: 600; color: var(--text-3); }
.bubbles { display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bubble-in); border: 1px solid var(--line); align-self: flex-start; }
.bubble.me { background: var(--bubble-out); color: #fff; border-color: transparent; align-self: flex-end; }
.bubble .b-meta { display: block; margin-top: 4px; font-size: 11px; opacity: 0.7; }
.draft {
  width: 100%; min-height: 96px; resize: vertical; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 15px; line-height: 1.55;
}
.draft:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.d-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.d-actions .push { margin-left: auto; }
.shortcuts { font-size: 12px; color: var(--text-3); display: flex; gap: 14px; flex-wrap: wrap; }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; color: var(--text-2); padding: 60px 20px; }
.empty svg { width: 44px; height: 44px; color: var(--ok-dot); stroke-width: 1.5; }
.empty strong { color: var(--text); font-size: 17px; }

.skeleton { border-radius: 14px; background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; height: 92px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- CHATS ---------- */
.chatlist { width: 380px; flex-shrink: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); min-height: 0; }
.chatlist-head { padding: 20px 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.search {
  height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--input); color: var(--text-3);
}
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--text); font-size: 15px; }
.chatlist-items { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 16px; }
.citem { width: 100%; display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; border: none; background: transparent; text-align: left; color: var(--text); }
.citem:hover { background: var(--surface-2); }
.citem[aria-current="true"] { background: var(--nav-active); }
.citem .c-body { flex: 1; min-width: 0; }
.citem .c-top { display: flex; gap: 8px; align-items: baseline; }
.citem .c-name { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.citem .c-time { font-size: 12px; color: var(--text-3); }
.citem .c-last { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Chats: fijados, no leídos, etiquetas de color y menú contextual */
:root {
  --lc-red-bg: #FEE4E2; --lc-red-fg: #B42318; --lc-orange-bg: #FFEAD5; --lc-orange-fg: #B93815;
  --lc-yellow-bg: #FEF7C3; --lc-yellow-fg: #854A0E; --lc-green-bg: #D1FADF; --lc-green-fg: #067647;
  --lc-teal-bg: #CCFBEF; --lc-teal-fg: #107569; --lc-blue-bg: #D1E9FF; --lc-blue-fg: #175CD3;
  --lc-violet-bg: #EBE9FE; --lc-violet-fg: #5925DC; --lc-pink-bg: #FCE7F6; --lc-pink-fg: #C11574;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --lc-red-bg: #3B1210; --lc-red-fg: #FDA29B; --lc-orange-bg: #3A1D0B; --lc-orange-fg: #F7B27A;
    --lc-yellow-bg: #332A06; --lc-yellow-fg: #FDE272; --lc-green-bg: #053321; --lc-green-fg: #75E0A7;
    --lc-teal-bg: #0A2E2B; --lc-teal-fg: #5FE9D0; --lc-blue-bg: #102A56; --lc-blue-fg: #84CAFF;
    --lc-violet-bg: #27115F; --lc-violet-fg: #BDB4FE; --lc-pink-bg: #4A0D2E; --lc-pink-fg: #FAA7E0;
  }
}
:root[data-theme="dark"] {
  --lc-red-bg: #3B1210; --lc-red-fg: #FDA29B; --lc-orange-bg: #3A1D0B; --lc-orange-fg: #F7B27A;
  --lc-yellow-bg: #332A06; --lc-yellow-fg: #FDE272; --lc-green-bg: #053321; --lc-green-fg: #75E0A7;
  --lc-teal-bg: #0A2E2B; --lc-teal-fg: #5FE9D0; --lc-blue-bg: #102A56; --lc-blue-fg: #84CAFF;
  --lc-violet-bg: #27115F; --lc-violet-fg: #BDB4FE; --lc-pink-bg: #4A0D2E; --lc-pink-fg: #FAA7E0;
}
.lc-red { --lc-bg: var(--lc-red-bg); --lc-fg: var(--lc-red-fg); }
.lc-orange { --lc-bg: var(--lc-orange-bg); --lc-fg: var(--lc-orange-fg); }
.lc-yellow { --lc-bg: var(--lc-yellow-bg); --lc-fg: var(--lc-yellow-fg); }
.lc-green { --lc-bg: var(--lc-green-bg); --lc-fg: var(--lc-green-fg); }
.lc-teal { --lc-bg: var(--lc-teal-bg); --lc-fg: var(--lc-teal-fg); }
.lc-blue { --lc-bg: var(--lc-blue-bg); --lc-fg: var(--lc-blue-fg); }
.lc-violet { --lc-bg: var(--lc-violet-bg); --lc-fg: var(--lc-violet-fg); }
.lc-pink { --lc-bg: var(--lc-pink-bg); --lc-fg: var(--lc-pink-fg); }
.lchip { display: inline-flex; align-items: center; height: 18px; max-width: 120px; padding: 0 7px; border-radius: 999px; background: var(--lc-bg, var(--surface-2)); color: var(--lc-fg, var(--text-2)); font-size: 11px; font-weight: 600; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.lchip.lc-more { background: var(--surface-2); color: var(--text-2); }
.crow { position: relative; }
.citem .c-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.citem .c-bottom .c-last { flex: 1; min-width: 0; }
.citem.has-unread .c-name { font-weight: 700; }
.citem.has-unread .c-last { color: var(--text); }
.citem.has-unread .c-time { color: var(--accent); font-weight: 600; }
.c-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.c-pin { display: inline-flex; color: var(--text-3); align-self: center; }
svg.i-xs { width: 13px; height: 13px; }
.c-labels { display: flex; gap: 4px; margin-top: 5px; min-width: 0; overflow: hidden; }
.c-more { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 120ms; box-shadow: var(--shadow-1); }
.crow:hover .c-more, .c-more:focus-visible, .crow:focus-within .c-more { opacity: 1; pointer-events: auto; }
.c-more:hover { color: var(--text); background: var(--surface-2); }
@media (hover: none) {
  .crow .citem { padding-right: 40px; }
  .c-more { opacity: 1; pointer-events: auto; border-color: transparent; background: transparent; box-shadow: none; right: 4px; }
}
.chips-labels:empty { display: none; }
.chip-label { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; font-size: 13px; }
.chip-label .ldot { width: 9px; height: 9px; border-radius: 50%; background: var(--lc-fg); }
.chip-label[aria-pressed="true"] { background: var(--lc-bg); color: var(--lc-fg); border-color: var(--lc-fg); }
.chip-ghost { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; font-size: 13px; border-style: dashed; color: var(--text-2); background: transparent; }
.cmenu { position: fixed; z-index: 60; min-width: 200px; display: flex; flex-direction: column; padding: 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-2); }
.cmenu button { display: flex; align-items: center; gap: 10px; text-align: left; height: 40px; padding: 0 10px; border: none; border-radius: 10px; background: transparent; color: var(--text); font-size: 14px; }
.cmenu button:hover, .cmenu button:focus-visible { background: var(--surface-2); outline: none; }
.conv-head .who-sub { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; }
.conv-head .who-sub > span:first-child { flex-shrink: 0; }
.conv-labels { display: flex; gap: 4px; min-width: 0; overflow: hidden; }
.conv-labels .lchip { color: var(--lc-fg, var(--text-2)); font-size: 11px; }
.conv-act { width: 40px; height: 40px; flex-shrink: 0; }
.conv-act[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.lpick-list { display: flex; flex-wrap: wrap; gap: 8px; }
.lpick { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.lpick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.lpick input { accent-color: var(--accent); margin: 0; }
.lpick .lchip { height: 22px; font-size: 13px; max-width: 200px; }
.lnew { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.lnew .field { flex: 1 1 180px; }
.lnew .field input { height: 40px; font-size: 15px; }
.lcolors { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 40px; }
.lcolor { position: relative; width: 26px; height: 26px; border-radius: 50%; background: var(--lc-bg); border: 2px solid var(--lc-fg); cursor: pointer; }
.lcolor input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.lcolor:has(input:checked) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--lc-fg); }
.lcolor:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.lmanage { align-self: flex-start; }
.lman { display: flex; flex-direction: column; gap: 10px; }
.lman-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.lman-prev { display: none; }
.lman-name { flex: 1 1 140px; min-width: 0; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--input); color: var(--text); font-size: 15px; }
.lman-name:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lman-count { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.lman-del { width: 36px; padding: 0; justify-content: center; color: var(--text-2); }
.c-follow { color: var(--accent); }
.conv-follow { flex-shrink: 0; gap: 6px; }
.conv-follow.is-on { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.fu-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.fu-card span { font-size: 13px; color: var(--text-2); }
.fu-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.fu-chips { flex-wrap: wrap; overflow: visible; }
.fu-chips .chip { height: 36px; }
.nav a .badge[data-count="chats"] { background: var(--urgent-dot); }
.c-unread.is-muted { background: var(--surface-2); color: var(--text-3); font-weight: 600; }
.cmenu-label { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); border-top: 1px solid var(--line); margin-top: 4px; }
.cmenu-label:first-child { border-top: none; margin-top: 0; }
.cmenu button[aria-checked="true"] { color: var(--accent-text); background: var(--accent-soft); font-weight: 600; }
.conv-act.is-on { color: var(--accent); }
.chatlist-head .h-actions { display: inline-flex; gap: 6px; align-items: center; }
#selModeBtn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.c-check { width: 22px; height: 22px; flex-shrink: 0; border-radius: 7px; border: 2px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; color: var(--on-accent); }
.crow.is-selected .c-check { background: var(--accent); border-color: var(--accent); }
.crow.is-selected .citem { background: var(--accent-soft); }
.chatlist.selecting .c-more { display: none; }
.clist-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 10px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.selbar { flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; border-top: 1px solid var(--line); background: var(--surface); box-shadow: 0 -6px 18px rgba(0,0,0,.06); min-width: 0; }
.selbar.hidden { display: none; }
.selbar-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.selbar-top strong { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selbar-x { width: 36px; padding: 0; justify-content: center; }
.selbar-actions { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.selbtn { flex-shrink: 0; display: inline-flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; padding: 6px 6px; border: none; border-radius: 10px; background: transparent; color: var(--text); font-size: 11.5px; font-weight: 500; }
.selbtn:hover:not(:disabled) { background: var(--surface-2); }
.selbtn:disabled { opacity: .4; }
.blab { display: flex; flex-direction: column; gap: 8px; }
.blab-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.blab-row .lchip { height: 24px; font-size: 13px; max-width: 180px; }
.blab-n { flex: 1; font-size: 12px; color: var(--text-3); }
.bnot { display: flex; flex-direction: column; gap: 8px; }
.bnot-opt { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); }
.bnot-opt:hover { border-color: var(--accent); }
.bnot-opt span { font-size: 13px; color: var(--text-2); }
@media (max-width: 900px) {
  #selModeBtn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #selModeBtn { width: 40px; padding: 0; justify-content: center; }
}
@media (max-width: 900px) {
  .conv-follow { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .conv-follow .cf-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.conv { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.conv-head { height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.conv-head .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conv-head strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-head span { font-size: 12px; color: var(--text-2); }
.conv-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.day-sep { align-self: center; font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--surface-2); padding: 4px 10px; border-radius: 999px; margin: 8px 0; }
.composer { flex-shrink: 0; display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.composer textarea {
  flex: 1; min-width: 0; max-height: 160px; min-height: 48px; resize: none; padding: 12px 16px; border-radius: 24px;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
}
.composer textarea:focus { outline: none; border-color: var(--accent); }
.composer .send { width: 48px; height: 48px; border-radius: 50%; border: none; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.composer .send:disabled { opacity: 0.5; }

/* ---------- PERSONAS ---------- */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 20px; }
.pcard { display: flex; gap: 12px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); text-align: left; color: var(--text); transition: border-color 160ms, transform 160ms; }
.pcard:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.pcard .p-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pcard .p-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .p-meta { font-size: 13px; color: var(--text-2); }
/* Personas con controles de vínculo: la tarjeta es un contenedor y el área clickeable un botón interno */
.pcard.pcard-care { flex-direction: column; gap: 10px; padding: 0; }
.pcard.pcard-care:hover { transform: none; }
.pcard-care .p-open { display: flex; gap: 12px; padding: 14px 14px 0; background: none; border: none; text-align: left; color: inherit; cursor: pointer; border-radius: 16px 16px 0 0; min-width: 0; }
.pcard-care .p-care { display: flex; align-items: center; gap: 8px; padding: 0 14px 14px 66px; }
.star-btn { width: 36px; height: 36px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text-3); cursor: pointer; }
.star-btn:hover { border-color: var(--line-strong); color: var(--text-2); }
.star-btn[aria-pressed="true"] { color: var(--high-dot); border-color: var(--high-dot); background: var(--high-bg); }
.star-btn[aria-pressed="true"] svg { fill: currentColor; }
.cad-select { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 14px; }
.cad-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- VÍNCULOS A CUIDAR ---------- */
.care { margin-top: 18px; max-width: 920px; }
.care:empty { display: none; }
.care h2 { font-size: 17px; font-weight: 650; margin: 0; }
.care-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.care-count { font-size: 13px; color: var(--text-2); }
.care-intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border-radius: 16px; border: 1px dashed var(--line-strong); background: var(--surface); }
.care-intro p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.45; }
.care-list, .sugg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.care-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.care-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.care-name { font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.care-imp { color: var(--high-dot); display: inline-flex; } .care-imp svg { fill: currentColor; }
.care-meta { font-size: 13px; color: var(--text-2); }
.care-why { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.care-row .btn { flex-shrink: 0; }
.care-more { margin-top: 6px; }
.care-ok { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; }
.care-all { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; padding: 4px 2px 10px; }
.sugg-list { max-height: min(56vh, 520px); overflow-y: auto; }
.sugg-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.sugg-row input[type=checkbox], .care-all input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.sugg-row .cad-select { flex: 0 0 150px; }
@media (max-width: 600px) {
  .care-row { flex-wrap: wrap; row-gap: 10px; }
  .care-row .care-body { flex: 1 1 calc(100% - 56px); }
  .care-row .btn { margin-left: 56px; }
  .care-why { white-space: normal; }
  .care-intro { flex-direction: column; align-items: flex-start; }
  .sugg-row { flex-wrap: wrap; }
  .sugg-row .care-body { flex: 1 1 calc(100% - 90px); }
  .sugg-row .cad-select { flex: 1 1 auto; margin-left: 28px; }
}

/* ---------- NOA ---------- */
.noa { flex: 1; display: flex; flex-direction: column; min-height: 0; max-width: 860px; margin: 0 auto; width: 100%; }
.noa-body { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.noa-hello { display: flex; flex-direction: column; gap: 14px; padding: 24px 0; }
.noa-msg { max-width: 84%; padding: 12px 16px; border-radius: 18px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; animation: msgIn 220ms var(--ease); }
.noa-msg.me { align-self: flex-end; background: var(--accent); color: #fff; }
.noa-msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.noa-msg.err { border-color: var(--urgent-dot); }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.typing { align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: blink 1s infinite ease-in-out; }
.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; } }
.noa-foot { flex-shrink: 0; padding: 10px 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.noa-form { display: flex; gap: 8px; align-items: flex-end; }

/* ---------- MÁS ---------- */
.more { max-width: 720px; display: flex; flex-direction: column; gap: 22px; }
.list-card { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; overflow: hidden; }
.list-card a, .list-card button.li {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 56px; text-decoration: none; color: var(--text);
  border: none; background: transparent; text-align: left; border-bottom: 1px solid var(--line);
}
.list-card > :last-child { border-bottom: none !important; }
.list-card a:hover, .list-card button.li:hover { background: var(--surface-2); }
.list-card .li-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-card .li-body span { font-size: 13px; color: var(--text-2); }
.list-card .li-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; }

/* ---------- Toast, hoja, paleta ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60; width: min(460px, calc(100vw - 24px));
  display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 10px 10px 18px; border-radius: 14px;
  background: var(--toast-bg); color: var(--toast-fg); box-shadow: var(--shadow-2); animation: toastIn 220ms var(--ease);
}
.toast span { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button { height: 36px; padding: 0 14px; border-radius: 10px; border: none; background: var(--toast-btn); color: var(--toast-link); font-weight: 600; font-size: 14px; flex-shrink: 0; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; animation: fade 200ms ease-out; display: flex; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  margin-top: auto; width: 100%; max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); animation: sheetUp 260ms var(--ease);
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 14px; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.palette {
  margin: 12vh auto auto; width: min(640px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-2); overflow: hidden; animation: sheetUp 200ms var(--ease);
}
.palette form { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette input { flex: 1; height: 56px; border: none; outline: none; background: transparent; font-size: 17px; color: var(--text); }
.palette .results { max-height: 50vh; overflow-y: auto; padding: 8px; }
.palette .res { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: none; background: transparent; text-align: left; color: var(--text); }
.palette .res[aria-selected="true"], .palette .res:hover { background: var(--surface-2); }
.palette .res small { color: var(--text-3); margin-left: auto; font-size: 12px; }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 18px; }
.login-card h1 { margin: 0; font-family: var(--font-display); font-size: 32px; letter-spacing: -0.02em; }
.login-card p { margin: 0; color: var(--text-2); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input { height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 16px; }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-error { color: var(--urgent-fg); font-size: 14px; min-height: 20px; }

/* ==========================================================================
   Celular
   ========================================================================== */
@media (max-width: 900px) {
  .side { display: none; }
  .topbar { display: none; }
  .app { flex-direction: column; }
  .main { min-height: 0; }
  .view { flex-direction: column; min-height: 0; }
  .view-pad { padding: 20px 16px 24px; }

  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
    flex-shrink: 0; height: calc(68px + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line); background: var(--surface);
  }
  .tabbar a {
    height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    text-decoration: none; color: var(--text-2); font-size: 11px; font-weight: 500; position: relative;
  }
  .tabbar a[aria-current="page"] { color: var(--accent); font-weight: 600; }
  .tabbar a .badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--urgent-dot); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
  .tabbar a.noa-btn { justify-self: center; width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35); }

  .mobile-head { padding: 18px 16px 10px; display: flex; flex-direction: column; gap: 12px; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .mobile-top .date { font-size: 13px; font-weight: 600; color: var(--text-2); }

  .inbox { width: auto; border-right: none; padding: 0; flex: 1; gap: 0; }
  .inbox > .h-row, .inbox > .seg-wrap { padding: 0 16px; }
  .inbox-list { padding: 8px 16px 20px; margin: 0; gap: 10px; }
  .row { flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
  .row[aria-current="true"] { border-color: var(--line); box-shadow: none; }
  .row-actions { display: flex; gap: 8px; width: 100%; }
  .row-actions .btn { flex: 1; }
  .detail { display: none; }
  .sheet .d-head { flex-wrap: wrap; }
  .sheet .d-head .who { flex: 1 1 60%; }
  .sheet .d-head h2 { font-size: 19px; }
  .sheet .d-actions .btn { flex: 1 1 auto; }
  .sheet .d-actions .push { margin-left: 0; }

  .chatlist { width: auto; border-right: none; flex: 1; }
  .chats-open .chatlist { display: none; }
  .conv { display: none; }
  .chats-open .conv { display: flex; }
  .conv-head { padding: 0 8px; }

  .seg { display: flex; }
  .seg button { flex: 1; }
  .h-title { font-size: 26px; }
  .noa-body { padding: 18px 16px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .people { grid-template-columns: 1fr; }
}
@media (min-width: 901px) {
  .mobile-only { display: none !important; }
}
@media (max-width: 900px) {
  .hide-mobile, .hide-mobile-flex { display: none !important; }
}

/* ---------- Conexión de WhatsApp ---------- */
.conn-list { display: flex; flex-direction: column; gap: 16px; }
.conn-card { display: flex; flex-direction: column; }
.conn-head { display: flex; align-items: center; gap: 12px; padding: 16px; }
.conn-state { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.conn-state .status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mid-dot); }
.conn-state .status-dot.on { background: var(--ok-dot); }
.conn-state .status-dot.warn { background: var(--high-dot); }
.conn-body:empty { display: none; }
.conn-body { padding: 0 16px 12px; }
.conn-ok { margin: 0; font-size: 14px; color: var(--text-2); }
.conn-pair { display: grid; grid-template-columns: auto 1fr; gap: 16px 24px; padding: 4px 16px 16px; align-items: start; }
.conn-qr { width: 240px; height: 240px; border-radius: 12px; background: #fff; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); overflow: hidden; }
.conn-qr img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.conn-qr .h-sub { color: #555; text-align: center; padding: 12px; }
.conn-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--text-2); line-height: 1.45; }
.conn-code { grid-column: 1 / -1; font-size: 14px; }
.conn-code summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.conn-code-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.conn-code-form .field { flex: 1 1 240px; }
.conn-code-out { margin-top: 12px; }
.conn-code-out p { margin: 0 0 8px; color: var(--text-2); }
.conn-code-value { font: 700 28px/1.2 "Inter Tight", Inter, system-ui, sans-serif; letter-spacing: 0.12em; color: var(--text); }
.conn-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); }
.conn-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 900px) {
  .conn-head { flex-wrap: wrap; }
  .conn-head .li-body { flex: 1 1 0; }
  .conn-state { flex-basis: 100%; padding-left: 48px; white-space: normal; }
  .conn-pair { grid-template-columns: 1fr; justify-items: center; }
  .conn-steps, .conn-code { justify-self: stretch; }
  .conn-qr { width: min(260px, 100%); height: auto; aspect-ratio: 1; }
}

/* ---------- Secciones embebidas (panel clásico dentro de la app) ---------- */
.view-embed { flex-direction: column; }
.embed-head { display: flex; align-items: center; gap: 8px; padding: 14px 20px 10px; border-bottom: 1px solid var(--line); }
.embed-head .h-title { font-size: 20px; margin: 0; }
.embed-back { width: 36px; padding: 0; justify-content: center; }
.embed-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: var(--bg); }
@media (max-width: 900px) { .embed-head { padding: 10px 12px; } }

/* ==========================================================================
   Secciones nativas (public/sections/*.js) — componentes compartidos
   ========================================================================== */
.btn-danger { background: var(--urgent-bg); color: var(--urgent-fg); }
.btn-danger:hover { filter: brightness(0.97); }

.sec { max-width: 1080px; display: flex; flex-direction: column; gap: 20px; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.sec-head .h-title { margin: 0; }
.sec-head .h-sub { margin: 4px 0 0; }
.sec-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sec-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.sec-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sec-search { flex: 1 1 220px; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--input); color: var(--text); font-size: 15px; }
.sec-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.sec-card { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sec-card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.sec-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sec-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }

.sec-list { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; overflow: hidden; }
.sec-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.sec-item:last-child { border-bottom: none; }
.sec-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sec-item-title { font-weight: 600; overflow-wrap: anywhere; }
.sec-item-meta { font-size: 13px; color: var(--text-3); display: flex; gap: 6px 12px; flex-wrap: wrap; }
.sec-item-text { font-size: 14px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.sec-item-actions { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.sec-item-actions .btn { padding: 0 10px; }

.kpi { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi-label { font-size: 13px; color: var(--text-2); }
.kpi-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--text-3); }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--mid-bg); color: var(--mid-fg); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--high-bg); color: var(--high-fg); }
.pill.bad { background: var(--urgent-bg); color: var(--urgent-fg); }
.pill.info { background: var(--wait-bg); color: var(--wait-fg); }

.sec-empty { border: 1px dashed var(--line-strong); border-radius: 16px; padding: 28px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--text-2); }
.sec-empty strong { color: var(--text); }
.sec-loading { color: var(--text-3); font-size: 14px; padding: 12px 0; }

.field textarea, .field select {
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 15px; width: 100%;
}
.field select { height: 44px; padding: 0 12px; }
.field textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.toggle { position: relative; width: 40px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.toggle span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background 150ms; }
.toggle span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 150ms var(--ease); box-shadow: var(--shadow-1); }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(16px); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Ventana modal (hoja en celular, diálogo en escritorio) */
.modal { display: flex; flex-direction: column; gap: 14px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { margin: 0; font-family: var(--font-display); font-size: 20px; letter-spacing: -0.01em; }
.modal-x { width: 36px; padding: 0; justify-content: center; }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.modal-text { margin: 0; color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
@media (min-width: 901px) {
  .scrim:has(.modal) { align-items: center; justify-content: center; }
  .modal { margin: auto; width: min(560px, calc(100vw - 48px)); max-height: 86dvh; border-radius: 20px; padding: 20px 22px; box-shadow: var(--shadow-2); }
  .modal.modal-wide { width: min(820px, calc(100vw - 48px)); }
  .modal .grab { display: none; }
}
@media (max-width: 900px) {
  .sec { gap: 16px; }
  .sec-item { flex-wrap: wrap; }
  .sec-item-actions { width: 100%; justify-content: flex-end; }
  .modal-foot .btn { flex: 1 1 auto; }
}

/* ---------- Hoy: búsqueda, filtros avanzados y orden ---------- */
.hoy-filters { display: flex; flex-direction: column; gap: 10px; }
.hoy-tools { display: flex; gap: 8px; align-items: center; }
.hoy-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--input); color: var(--text-3); }
.hoy-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hoy-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--text); font-size: 15px; height: 100%; }
.hoy-fbtn { display: inline-flex; align-items: center; gap: 6px; height: 40px; }
.hoy-fn { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; }
.hoy-sort { height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--input); color: var(--text); font-size: 14px; max-width: 150px; }
.hoy-fpanel { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.hoy-fgroup { display: flex; flex-direction: column; gap: 6px; }
.hoy-fgroup .chips { flex-wrap: wrap; overflow: visible; }
.hoy-fpanel > .btn { align-self: flex-start; }
.chip-n { opacity: 0.65; font-variant-numeric: tabular-nums; margin-left: 2px; }
.hoy-fsum { font-size: 13px; color: var(--text-3); }
.hoy-fsum:empty { display: none; }
@media (max-width: 900px) {
  .inbox > .hoy-filters { padding: 0 16px; }
  .hoy-tools { flex-wrap: wrap; }
  .hoy-search { flex-basis: 100%; }
  .hoy-fbtn { flex: 1; justify-content: center; }
  .hoy-sort { flex: 1; max-width: none; }
}

/* ---------- Botón Reportar (Back Center) ---------- */
.top-new { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.topbar .top-new + .sync { margin-left: 0; }
@media (max-width: 1100px) { .top-new span { display: none; } }
.report-row { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
@media (min-width: 901px) { .report-row { display: none; } }

/* ---------- Adjuntos y notas de voz en chats ---------- */
.composer .icon-btn.plain { width: 48px; height: 48px; flex-shrink: 0; }
.attach-bar { padding: 10px 16px 0; background: var(--surface); border-top: 1px solid var(--line); }
.attach-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 4px 4px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 14px;
}
.attach-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.attach-size { color: var(--text-3); font-size: 12px; flex-shrink: 0; }
.attach-chip .icon-btn { width: 36px; height: 36px; }
.rec-bar {
  flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 12px 16px 16px; border-top: 1px solid var(--line); background: var(--surface);
}
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--urgent-dot); animation: blink 1s infinite ease-in-out; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-hint { flex: 1; color: var(--text-2); font-size: 14px; }
.rec-bar .send { width: 48px; height: 48px; border-radius: 50%; border: none; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
.bubble.has-media { display: flex; flex-direction: column; gap: 6px; }
.b-text { white-space: pre-wrap; }
.b-audio { width: 260px; max-width: 100%; height: 40px; }
.b-img { display: block; max-width: 280px; max-height: 320px; width: 100%; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.b-img-link { display: block; }
.b-video { display: block; width: 280px; max-width: 100%; border-radius: 10px; background: #000; }
.b-doc { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; }
.bubble.me .b-doc { background: rgba(255, 255, 255, 0.18); color: #fff; }
.media-gone { font-size: 13px; opacity: 0.75; font-style: italic; }
@media (max-width: 900px) {
  .b-audio { width: 220px; }
  .b-img, .b-video { max-width: 220px; }
}

/* ---------- Programar una respuesta ---------- */
.sched { display: flex; flex-direction: column; gap: 12px; }
.sched-preview { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border-left: 3px solid var(--accent); color: var(--text); font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow-y: auto; }
.sched-note { margin: 0; display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--high-bg); color: var(--high-fg); font-size: 13px; }
.sched-note svg { margin-top: 2px; }
.sched-chips { flex-wrap: wrap; overflow: visible; }
.sched-custom { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.sched-custom input { height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--input); color: var(--text); font-size: 15px; max-width: 100%; }
.sched-custom input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sched-when { margin: 0; font-size: 14px; font-weight: 600; color: var(--accent-text); }

/* Indicador de estado: aviso cuando otra cuenta sí está conectada */
.sync-alt { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 500; }
.sync-alt:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 900px) { .sync-alt { display: none; } }

/* ---------- Modo foco ---------- */
.focus-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); font-size: 14px; color: var(--text); }
.focus-bar .status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mid-dot); flex-shrink: 0; }
.focus-bar .status-dot.on { background: var(--ok-dot); }
.focus-bar .status-dot.warn { background: var(--wait-dot); }
.focus-line { flex: 1 1 220px; min-width: 0; line-height: 1.45; }
.focus-bar .muted, .fs .muted { color: var(--text-2); }
.focus-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.focus-actions .focus-cfg { width: 36px; height: 36px; }
.link-btn { border: none; background: none; padding: 0; color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.focus-form { display: flex; flex-direction: column; gap: 14px; }
.focus-form .field input { height: 44px; font-size: 15px; }
.focus-row { font-size: 15px; gap: 10px; }
@media (max-width: 900px) {
  .inbox > .focus-bar { margin: 0 16px; }
  .focus-actions { width: 100%; }
  .focus-actions .btn-primary { flex: 1; height: 44px; }
}

/* Sesión de respuestas: pantalla completa por encima de la app (debajo de modales y avisos) */
html.fs-open, html.fs-open body { overflow: hidden; }
.fs { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; background: var(--bg); color: var(--text); animation: fade 160ms ease-out; }
.fs-head { display: flex; align-items: center; gap: 14px; padding: 12px 20px; padding-top: calc(12px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--surface); }
.fs-prog { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.fs-count { font-weight: 600; font-size: 14px; white-space: nowrap; }
.fs-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; max-width: 420px; }
.fs-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 240ms var(--ease); }
.fs-timer { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.fs-timer.over { color: var(--high-fg); }
.fs-body { flex: 1; min-height: 0; overflow-y: auto; padding: 28px 20px; }
.fs-card, .fs-summary { width: min(720px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.fs-card .d-head, .fs-care .d-head { display: flex; align-items: center; gap: 12px; }
.fs-card .who, .fs-care .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fs-card h2 { margin: 0; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-card .meta, .fs-care .meta { font-size: 13px; color: var(--text-2); }
.fs-title { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.4; }
.fs-card .draft { min-height: 120px; }
.fs-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 14px 20px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.fs-actions .btn { gap: 8px; }
.fs-actions kbd { font: 600 11px/1 var(--font); padding: 3px 6px; border-radius: 5px; border: 1px solid currentColor; opacity: 0.55; }
.fs-summary { align-items: center; text-align: center; padding-top: 4vh; }
.fs-summary h2 { margin: 0; font-family: var(--font-display); font-size: 28px; letter-spacing: -0.02em; }
.fs-summary > p { margin: 0; font-size: 16px; }
.fs-done-ico { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--ok-soft); color: var(--ok); }
.fs-done-ico svg { width: 28px; height: 28px; stroke-width: 2.2; }
.fs-stats { justify-content: center; flex-wrap: wrap; overflow: visible; }
.fs-care { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 12px; margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--line); }
.fs-care h3 { margin: 0; font-size: 18px; }
.fs-care > p { margin: 0; }
.fs-care-item { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.fs-care-item .draft { min-height: 72px; }
@media (max-width: 900px) {
  .fs-head { padding-left: 12px; padding-right: 8px; gap: 10px; }
  .fs-body { padding: 18px 16px; }
  .fs-card h2 { font-size: 18px; }
  /* Botones grandes al alcance del pulgar */
  .fs-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .fs-actions .btn { height: 52px; padding: 0 6px; font-size: 14px; white-space: normal; line-height: 1.15; }
  .fs-actions .fs-send { grid-column: 1 / -1; }
  .fs-summary h2 { font-size: 24px; }
}

/* Indicador de foco en la cabecera */
.focus-ind-wrap { position: relative; display: inline-flex; min-width: 0; }
.focus-ind { display: inline-flex; align-items: center; gap: 7px; height: 32px; max-width: 260px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; }
.focus-ind:hover { background: var(--surface-2); }
.focus-ind .fi-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.focus-ind .fi-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--wait-dot); }
.focus-ind.open { border-color: var(--ok-dot); }
.focus-ind.open .fi-dot { background: var(--ok-dot); }
.focus-ind.paused .fi-dot { background: var(--high-dot); }
.focus-ind.off { color: var(--text-3); font-weight: 500; }
.focus-ind.off .fi-dot { background: transparent; border: 1.5px solid var(--text-3); }
.focus-ind .fi-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.focus-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; min-width: 250px; display: flex; flex-direction: column; padding: 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-2); }
.focus-menu .fm-state { margin: 4px 10px 6px; font-size: 12px; color: var(--text-2); white-space: normal; }
.focus-menu button { text-align: left; height: 40px; padding: 0 10px; border: none; border-radius: 10px; background: transparent; color: var(--text); font-size: 14px; }
.focus-menu button:hover, .focus-menu button:focus-visible { background: var(--surface-2); }
@media (max-width: 1100px) and (min-width: 901px) { .focus-ind { max-width: 170px; } }
@media (max-width: 900px) {
  .mobile-top .focus-ind-wrap { margin-left: auto; flex: 0 1 auto; }
  .mobile-top .focus-ind { max-width: 200px; }
  .tabbar a.focus-mark::after { content: ''; position: absolute; top: 6px; left: calc(50% - 16px); width: 7px; height: 7px; border-radius: 50%; background: var(--wait-dot); box-shadow: 0 0 0 2px var(--surface); }
  .tabbar a.focus-open::after { background: var(--ok-dot); }
}
.fs-keys { margin: 0; font-size: 12px; color: var(--text-3); }
.focus-ind .fi-short { display: none; }
@media (max-width: 900px) {
  .focus-ind .fi-long { display: none; }
  .focus-ind .fi-short { display: inline; }
}

/* Modo foco: barra compacta de una línea (pedido: ocupaba demasiado espacio) */
.focus-bar { flex-wrap: nowrap; gap: 8px; padding: 4px 6px 4px 12px; border-radius: 999px; font-size: 13px; min-height: 34px; }
.focus-bar .focus-line { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.focus-bar .focus-go { font-size: 13px; white-space: nowrap; flex-shrink: 0; }
.focus-bar .focus-cfg { width: 28px; height: 28px; flex-shrink: 0; }
@media (max-width: 900px) {
  .focus-bar .focus-go { font-size: 13px; }
}

/* Modo foco: explicación, presets y horarios */
.fh { display: flex; flex-direction: column; gap: 14px; }
.fh-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.fh-steps li { display: flex; gap: 12px; align-items: flex-start; }
.fh-ico { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); }
.fh-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; color: var(--text-2); line-height: 1.45; }
.fh-txt strong { color: var(--text); font-size: 15px; }
.fh-example, .fh-urgent { margin: 0; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.fh-example { background: var(--hint); color: var(--text); }
.fh-urgent { background: var(--surface-2); color: var(--text-2); }
.fh-urgent strong, .fh-example strong { color: var(--text); }
.fp-list { display: flex; flex-direction: column; gap: 8px; }
.fp { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); text-align: left; }
.fp:hover { background: var(--surface-2); }
.fp[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.fp-radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); flex-shrink: 0; }
.fp[aria-checked="true"] .fp-radio { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 45%, transparent 50%); }
.fp-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.fp-txt strong { font-size: 15px; }
.fp-txt span { font-size: 13px; color: var(--text-2); }
.fc-set { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fc-set legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.fc-hours { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.fc-hour-list { display: flex; flex-wrap: wrap; gap: 8px; }
.fc-hour { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--input); }
.fc-hour input { border: none; background: transparent; color: var(--text); font-size: 15px; height: 36px; width: 92px; }
.fc-hour input:focus { outline: none; }
.fc-hour:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fc-hour .icon-btn { width: 32px; height: 32px; }
.fc-help { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--surface-2); }
.fc-help summary { cursor: pointer; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; color: var(--accent-text); }
.fc-help[open] summary { margin-bottom: 12px; }
.fc-help .fh-example { background: var(--surface); }
.focus-bar .focus-help { font-weight: 700; font-size: 14px; color: var(--text-2); }

/* ---------- Semáforo "Cómo venís hoy" ---------- */
.tl { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; font-size: 11px; font-weight: 800; line-height: 1; color: #fff; }
.tl.sm { width: 16px; height: 16px; font-size: 10px; }
.tl.lg { width: 36px; height: 36px; font-size: 18px; }
.tl-green { background: #12B76A; }
/* Forma + símbolo además del color: verde círculo ✓, amarillo triángulo !, rojo cuadrado ✕ */
.tl-yellow { background: #F5B300; color: #3B2600; border-radius: 0; clip-path: polygon(50% 4%, 100% 96%, 0 96%); align-items: flex-end; padding-bottom: 0.15em; }
.tl-red { background: #D92D20; border-radius: 4px; }
.tl-btn { border: none; background: transparent; padding: 4px; margin: -4px 0 -4px -4px; border-radius: 999px; display: inline-flex; }
.tl-btn:hover { background: var(--surface-2); }
.tp { display: flex; flex-direction: column; gap: 14px; }
.tp.compact { gap: 10px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); max-width: 300px; }
.tp-head { display: flex; gap: 12px; align-items: flex-start; }
.tp.compact .tp-head .tl.lg { width: 28px; height: 28px; font-size: 14px; }
.tp-head-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tp-head-txt strong { font-size: 15px; }
.tp-head-txt span { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.tp-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.tp-num { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.tp-num b { font-family: var(--font-display); font-size: 22px; line-height: 1.1; }
.tp-num span { font-size: 12px; color: var(--text-2); line-height: 1.3; }
.tp-num small { font-size: 11px; color: var(--text-3); }
.tp.compact .tp-num { padding: 8px; }
.tp.compact .tp-num b { font-size: 18px; }
.tp-tips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tp-tips li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.45; padding: 10px 12px; border-radius: 12px; background: var(--hint); color: var(--text); }
.tp-tips li svg { color: var(--accent); margin-top: 1px; }
.tp.compact .tp-tips li { padding: 8px 10px; }
.focus-menu:has(.tp) { width: min(320px, calc(100vw - 24px)); }
.fc-calm { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Pantalla de calma ---------- */
html.calm-open, html.calm-open body { overflow: hidden; }
.calm {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; overflow-y: auto;
  color: #1E1B4B;
  background: linear-gradient(135deg, #EEF0FF, #E0F2FE, #F0FDF4, #FDF2F8, #EEF0FF);
  background-size: 400% 400%;
  animation: calmBg 40s ease-in-out infinite, fade 400ms ease-out;
}
:root[data-theme="dark"] .calm { color: #E0E7FF; background-image: linear-gradient(135deg, #0B1026, #111833, #0E1F2B, #161028, #0B1026); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .calm { color: #E0E7FF; background-image: linear-gradient(135deg, #0B1026, #111833, #0E1F2B, #161028, #0B1026); } }
@keyframes calmBg { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.calm.leaving { opacity: 0; transition: opacity 300ms ease-out; }
.calm-waves { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.calm-inner { position: relative; width: min(560px, 100%); padding: 32px 20px; padding-top: calc(32px + env(safe-area-inset-top)); padding-bottom: calc(32px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; margin: auto; }
.calm-kicker { margin: 0; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.75; }
.calm h1 { margin: 0; font-family: var(--font-display); font-size: clamp(28px, 6vw, 40px); line-height: 1.15; letter-spacing: -0.02em; font-weight: 700; }
.calm-msg { margin: 0; font-size: 17px; line-height: 1.55; opacity: 0.9; max-width: 440px; }
.calm-urgent { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #FDA29B; background: #FEF3F2; color: #B42318; padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.calm-actions { display: flex; flex-direction: column; gap: 10px; width: min(340px, 100%); margin-top: 6px; }
.calm-actions .btn { height: 52px; font-size: 16px; border-radius: 14px; }
.calm-enter { color: inherit; opacity: 0.85; }
.calm-enter:disabled { opacity: 0.55; }
.calm .btn-ghost:hover:not(:disabled) { background: rgba(127, 127, 160, 0.14); color: inherit; }
.calm-tools { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 10px; }
.calm-tool { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(99, 102, 241, 0.35); background: rgba(255, 255, 255, 0.45); color: inherit; font-size: 14px; font-weight: 600; }
.calm-tool[aria-pressed="true"] { background: #4F46E5; border-color: #4F46E5; color: #fff; }
.calm-audio { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.calm-select { height: 40px; padding: 0 10px; border-radius: 999px; border: 1px solid rgba(99, 102, 241, 0.35); background: rgba(255, 255, 255, 0.45); color: inherit; font-size: 14px; }
.calm-vol { width: 110px; accent-color: #6366F1; }
:root[data-theme="dark"] .calm-tool, :root[data-theme="dark"] .calm-select { background: rgba(255, 255, 255, 0.06); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .calm-tool, :root:not([data-theme="light"]) .calm-select { background: rgba(255, 255, 255, 0.06); } }
.calm-select option { color: #18181B; }
.calm-breath { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.calm-circle { width: 170px; height: 170px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: radial-gradient(circle at 50% 40%, rgba(129, 140, 248, 0.55), rgba(99, 102, 241, 0.25) 60%, rgba(99, 102, 241, 0.08));
  box-shadow: 0 0 60px rgba(99, 102, 241, 0.35); transition-property: transform; transition-timing-function: ease-in-out; transform: scale(0.55); }
.calm-circle span { font-size: 20px; font-weight: 700; }
.calm-circle small { font-size: 14px; opacity: 0.8; font-variant-numeric: tabular-nums; }
.calm-chips { justify-content: center; }
.calm .chip { background: rgba(255, 255, 255, 0.4); color: inherit; border-color: rgba(99, 102, 241, 0.35); }
.calm .chip[aria-checked="true"] { background: #4F46E5; color: #fff; border-color: #4F46E5; }
.calm.in-focus h1 { font-size: clamp(26px, 5vw, 34px); }
@media (prefers-reduced-motion: reduce) {
  .calm { animation: none; }
  .calm-circle { transition: none !important; }
}
@media (max-width: 900px) {
  .calm-inner { gap: 14px; }
  .calm-circle { width: 140px; height: 140px; }
}
.calm .calm-tool[aria-pressed="true"] { background: #4F46E5; border-color: #4F46E5; color: #fff; }
/* Pausa: entrada suave cuando llega sola, salida siempre visible */
.calm.soft { animation: calmBg 40s ease-in-out infinite, fade 1400ms ease-out; }
.calm-hint { margin: 0; min-height: 18px; font-size: 13px; opacity: 0.8; }
.calm .calm-enter.btn-secondary { background: rgba(255, 255, 255, 0.7); border-color: rgba(99, 102, 241, 0.45); color: #1E1B4B; }
:root[data-theme="dark"] .calm .calm-enter.btn-secondary { background: rgba(255, 255, 255, 0.1); color: #E0E7FF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .calm .calm-enter.btn-secondary { background: rgba(255, 255, 255, 0.1); color: #E0E7FF; } }
@media (prefers-reduced-motion: reduce) { .calm.soft { animation: none; } }

/* ---------- Llamar (abre WhatsApp, el teléfono o FaceTime) ---------- */
.call-sheet { display: flex; flex-direction: column; gap: 8px; }
.call-sheet .modal-text { font-variant-numeric: tabular-nums; }
.call-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); text-decoration: none; min-height: 56px; }
.call-opt:hover { background: var(--surface-2); }
.call-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.call-body { display: flex; flex-direction: column; min-width: 0; }
.call-body span { font-size: 13px; color: var(--text-2); }
.call-note { margin: 4px 0 0; font-size: 12px; color: var(--text-3); }

/* ---------- Fuera de foco / Volver al foco ---------- */
.focus-ind.out { border-color: var(--high-dot); background: var(--high-bg); color: var(--high-fg); }
.focus-back-top { height: 32px; padding: 0 12px; border-radius: 999px; font-size: 13px; gap: 6px; flex-shrink: 0; }
.focus-back { height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; gap: 5px; flex-shrink: 0; }
.focus-back-float { display: none; }
.mobile-only-inline { display: none; }
@media (max-width: 900px) {
  .mobile-only-inline { display: inline; }
  .mobile-top .focus-back-top { padding: 0 10px; }
  .mobile-top .focus-back-top span { display: none; }  /* en la cabecera de Hoy queda el ícono; abajo va el botón con texto */
  .focus-back-float:not(.hidden) { display: inline-flex; position: fixed; left: 50%; transform: translateX(-50%); bottom: var(--float-bottom, calc(80px + env(safe-area-inset-bottom))); z-index: 30; height: 44px; border-radius: 999px; box-shadow: var(--shadow-2); gap: 8px; }
  .focus-bar .focus-back span { display: none; }
}
@media (min-width: 901px) { .focus-back-float { display: none !important; } }

/* ---------- Métricas de hoy en la cabecera ---------- */
.hm { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hm:empty { display: none; }
.hm-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.hm-chip b { color: var(--text); font-weight: 700; }
.hm-chip svg { color: var(--accent); }
.hm-chip:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 900px) {
  /* chips deslizables dentro de su fila (sin scroll horizontal de página) */
  .hm { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; -webkit-overflow-scrolling: touch; max-width: calc(100vw - 16px); }
  .hm::-webkit-scrollbar { display: none; }
}
@media (max-width: 900px) {
  /* Cabecera de conversación en el celular: Llamar y Seguimiento; fijar, avisos y etiquetas siguen en el menú "…" del chat */
  .conv-head #convPin, .conv-head #convTag, .conv-head #convNotify { display: none; }
  .conv-head .who { min-width: 0; flex: 1; }
}

/* ==================== Escritorio: tooltips, barra lateral y riel derecho ==================== */
/* Tooltip único: nombre + para qué */
.tip { position: fixed; z-index: 120; max-width: 260px; padding: 8px 11px; border-radius: 10px; background: var(--toast-bg); color: var(--toast-fg); font-size: 12.5px; line-height: 1.4; box-shadow: var(--shadow-2); pointer-events: none; opacity: 0; transform: translateY(2px); transition: opacity 120ms ease-out, transform 120ms ease-out; display: flex; flex-direction: column; gap: 2px; }
.tip.on { opacity: 1; transform: none; }
.tip strong { font-weight: 700; font-size: 13px; }
.tip span { opacity: 0.85; }

/* Botón para achicar la barra y para el riel derecho */
.brand { position: relative; }
.side-toggle { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent; color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; }
.side-toggle:hover { background: var(--surface-2); color: var(--text); }
.rr-toggle { width: 36px; height: 36px; flex-shrink: 0; }
.rr-toggle[aria-pressed="true"] { color: var(--accent); }
.nav.sub .nav-sub-ico { display: none; }
.nav.sub a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* "Tu día" debajo del menú */
.side-extra { display: flex; flex-direction: column; gap: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.side-extra:empty { display: none; }
.side-mini { display: none; }
.sx { display: flex; flex-direction: column; gap: 6px; padding: 0 4px; }
.sx.sx-hidden { display: none; }
.sx-h { margin: 0; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 0 8px; }
.sx-state { margin: 0; padding: 0 8px; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text); }
.sx-sub { margin: 0; padding: 0 8px; font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.sx-sub b { color: var(--text); }
.sx .muted { color: var(--text-3); }
.sx-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--wait-dot); }
.sx-dot.open { background: var(--ok-dot); }
.sx-dot.out { background: var(--high-dot); box-shadow: 0 0 0 3px var(--high-bg); }
.sx-dot.paused, .sx-dot.off { background: transparent; border: 1.5px solid var(--text-3); }
.sx-btn { margin: 4px 8px 0; justify-content: center; }
.sx-back { height: 40px; gap: 8px; }
.sx-back kbd { font: 600 11px/1 var(--font); padding: 3px 6px; border-radius: 5px; background: rgba(255, 255, 255, 0.2); }
.sx-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.sx-row { width: 100%; height: 32px; display: flex; align-items: center; gap: 10px; padding: 0 8px; border: none; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 13px; text-align: left; }
.sx-row:hover { background: var(--surface-2); color: var(--text); }
.sx-row svg { color: var(--accent); }
.sx-row-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.sx-urg { color: var(--urgent-fg); }
.sx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.sx-a { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px; border: none; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 12.5px; text-align: left; min-width: 0; }
.sx-a:hover { background: var(--surface-2); color: var(--text); }
.sx-a svg { color: var(--accent); }
.sx-a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-person { display: flex; align-items: center; gap: 8px; padding: 3px 8px; }
.sx-person .av { width: 26px; height: 26px; font-size: 10px; }
.sx-p-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sx-p-n { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-p-s { font-size: 11.5px; color: var(--text-3); }
.sx-person .link-btn { font-size: 12.5px; }
.side-extra.sx-compact { gap: 10px; }
.side-extra.sx-compact .sx-sub { font-size: 12px; }

/* Barra achicada: riel de íconos */
@media (min-width: 901px) {
  .side { transition: width 200ms var(--ease), padding 200ms var(--ease); }
  html.side-collapsed .side { width: 68px; padding: 18px 10px; gap: 14px; overflow-x: hidden; }
  html.side-collapsed .brand { flex-direction: column; gap: 10px; padding: 0; }
  html.side-collapsed .brand-name, html.side-collapsed .side .nav-label, html.side-collapsed .side-foot .who, html.side-collapsed .side-extra { display: none; }
  html.side-collapsed .side-toggle { margin: 0; }
  html.side-collapsed .acct { width: 46px; padding: 0; justify-content: center; }
  html.side-collapsed .acct .grow, html.side-collapsed .acct > svg { display: none; }
  html.side-collapsed .nav a { width: 46px; padding: 0; justify-content: center; position: relative; }
  html.side-collapsed .nav a > span:not(.badge) { display: none; }
  html.side-collapsed .nav a .badge { position: absolute; top: 2px; right: 0; margin: 0; min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
  html.side-collapsed .nav.sub .nav-sub-ico { display: inline-block; width: 20px; height: 20px; }
  html.side-collapsed .nav.sub a { height: 38px; }
  html.side-collapsed .side-foot { justify-content: center; padding: 10px 0 0; }
  html.side-collapsed .side-mini { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
}
.rail-btn { position: relative; width: 44px; height: 44px; border-radius: 12px; border: none; background: transparent; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rail-btn:hover { background: var(--surface-2); color: var(--text); }
.rail-btn[aria-pressed="true"] { background: var(--nav-active); color: var(--accent-text); }
.side-mini-focus .mini-dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--wait-dot); box-shadow: 0 0 0 2px var(--side); }
.side-mini-focus .mini-dot.out { background: var(--high-dot); }
.side-mini-focus .mini-dot.window { background: var(--ok-dot); }
.side-mini-focus .mini-dot.off, .side-mini-focus .mini-dot.paused, .side-mini-focus .mini-dot.free { background: var(--mid-dot); }
.side-mini-focus.out { color: var(--high-fg); background: var(--high-bg); }

/* Riel derecho de acciones (estilo Google) y panel acoplado */
.rrail, .rpanel { display: none; }
@media (min-width: 901px) {
  html.rrail-on .rrail { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 60px; flex-shrink: 0; padding: 12px 0; border-left: 1px solid var(--line); background: var(--side); overflow-y: auto; }
  .rail-sep { width: 24px; height: 1px; background: var(--line); margin: 6px 0; }
  .rrail [data-rail="hide"] { margin-top: auto; }
  .rail-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
  .rail-badge.urgent { background: var(--urgent-dot); }
  html.rpanel-open .rpanel { display: flex; flex-direction: column; width: 360px; flex-shrink: 0; border-left: 1px solid var(--line); background: var(--surface); min-height: 0; animation: rpIn 180ms var(--ease); }
  /* Con el riel visible, Jarvis y Reportar viven ahí (sin duplicados) */
  html.rrail-on #jarvisBtn, html.rrail-on [data-sec="feedback"].fb-fab { display: none !important; }
}
@keyframes rpIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.rp-head { height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--line); }
.rp-head h2 { margin: 0; flex: 1; font-family: var(--font-display); font-size: 18px; letter-spacing: -0.01em; }
.rp-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 12px 20px; display: flex; flex-direction: column; gap: 18px; }
.rp-body .tp-tips { padding: 0 8px; }

.side-extra.sx-hidden { display: none; }
.side-extra.sx-tight .sx-focus .sx-sub, .side-extra.sx-tight .sx-focus .sx-h { display: none; }
.side-extra.sx-compact .sx-row { height: 28px; }
.side-extra.sx-compact .sx-a { height: 30px; }
.cmd .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 901px) { html.rrail-on .jarvis-hint { right: 80px; } html.rpanel-open.rrail-on .jarvis-hint { right: 440px; } }

/* Acciones rápidas: ícono arriba, etiqueta corta abajo (entra completa en la barra) */
.sx-grid .sx-a { flex-direction: column; justify-content: center; gap: 4px; height: 50px; padding: 0 4px; font-size: 11.5px; text-align: center; }
.side-extra.sx-compact .sx-grid .sx-a { height: 46px; }
/* Barra superior que se adapta al ancho disponible (con el panel derecho abierto o la ventana angosta):
   "Volver al foco" nunca se pierde */
@media (min-width: 901px) {
  .topbar { container-type: inline-size; gap: 10px; padding: 0 16px 0 20px; }
  .cmd { flex: 1 1 160px; min-width: 120px; }
  .focus-ind-wrap, .focus-back-top, .sync, .rr-toggle { flex-shrink: 0; }
  .sync { min-width: 0; }
}
@container (max-width: 900px) {
  .topbar .cmd .kbd { display: none; }
  .topbar .sync > span:not(.status-dot), .topbar .sync > a { display: none; }
}
@container (max-width: 760px) {
  .topbar .focus-ind .fi-long { display: none; }
  .topbar .focus-ind .fi-short { display: inline; }
}
@container (max-width: 600px) {
  .topbar .focus-back-top span { display: none; }
  .topbar .cmd .grow { display: none; }
  .topbar .cmd { flex: 0 0 auto; min-width: 0; padding: 0 11px; }
}
@media (max-width: 900px) { .mobile-top .focus-back-top { display: none !important; } } /* en celular, "Volver al foco" es el botón flotante (visible en todas las pantallas) */

/* Tildes de WhatsApp */
.bubble .b-meta { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.ticks { display: inline-flex; align-items: center; font-size: 11px; line-height: 1; color: var(--muted, #8a8f98); }
.ticks svg { width: 16px; height: 11px; fill: currentColor; }
.ticks[data-info] { cursor: pointer; border-radius: 4px; padding: 1px; }
.ticks[data-info]:hover, .ticks[data-info]:focus-visible { background: rgba(0,0,0,.08); outline: none; }
.ticks.t-read, .ticks.t-played { color: #34b7f1; }
.ticks.t-error { color: #d93025; font-weight: 700; padding: 0 4px; }
.msg-info { display: flex; flex-direction: column; gap: 4px; }
.msg-info .mi-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line, rgba(0,0,0,.08)); }
.msg-info .mi-row.off { opacity: .45; }
.msg-info .mi-label { flex: 1; }
.msg-info .mi-when { font-size: 13px; color: var(--muted, #8a8f98); }
.msg-info .mi-h { display: flex; align-items: center; gap: 6px; margin: 12px 0 2px; font-size: 14px; }
.msg-info .mi-empty { font-size: 13px; color: var(--muted, #8a8f98); margin: 4px 0; }

/* Etiqueta puesta por la asistente */
.lchip.lc-auto { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 40%, transparent); }
.chip.chip-auto { color: var(--accent-text); }
.set-voice input[type=range] { accent-color: var(--accent); width: 100%; }

/* Foto de perfil de WhatsApp sobre las iniciales */
.av { position: relative; overflow: hidden; }
.av .av-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

/* Nombre del contacto editable en la cabecera de la conversación */
.who-name { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; text-align: left; min-width: 0; }
.who-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-name:disabled { cursor: default; }
.who-name .who-edit { width: 14px; height: 14px; opacity: .45; flex-shrink: 0; }
.who-name:hover .who-edit, .who-name:focus-visible .who-edit { opacity: .9; }

/* ---------- Hoy en el celular: cabecera compacta que se va con el scroll ---------- */
@media (max-width: 900px) {
  .inbox { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .inbox > .inbox-list { flex: none; overflow: visible; min-height: auto; }
  .inbox > .mobile-top { padding: 10px 16px 0 !important; }
  .inbox > .h-row { padding-top: 4px; }
  .inbox .h-title { font-size: 24px; line-height: 1.15; }
  .inbox .h-sub { font-size: 13px; margin-top: 2px; }
  .inbox .hm { margin-top: 8px; gap: 5px; }
  .inbox .hm-chip { height: 26px; padding: 0 8px; font-size: 12px; gap: 4px; }
  .inbox .hm-chip svg { width: 13px; height: 13px; }
  /* El estado de foco ya está arriba (indicador) y en el botón flotante "Volver al foco" */
  .inbox > .focus-bar { display: none; }
  /* Pestañas fijas arriba al hacer scroll; el resto de la cabecera se va */
  .inbox > .seg-wrap { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-top: 8px; padding-bottom: 6px; }
  .inbox .seg button { padding-top: 6px; padding-bottom: 6px; font-size: 14px; }
  /* Buscar + filtros + orden en una sola fila */
  .hoy-tools { flex-wrap: nowrap; gap: 6px; }
  .hoy-search { flex: 1 1 auto; flex-basis: auto; min-width: 0; }
  .hoy-search input { min-width: 0; }
  .hoy-fbtn { flex: 0 0 auto; width: 40px; padding: 0; justify-content: center; position: relative; }
  .hoy-fbtn .hoy-fbtn-l { display: none; }
  .hoy-fbtn .hoy-fn { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; font-size: 11px; padding: 0 4px; }
  .hoy-sort { flex: 0 0 auto; max-width: 112px; font-size: 13px; padding: 0 6px; }
  .inbox > .hoy-filters { padding: 2px 16px 0; }
}

/* Personas: aire abajo en las tarjetas (las etiquetas quedaban pegadas al borde en el celular) */
.pcard.pcard-care { padding-bottom: 14px; }
.pcard-care .p-care { padding-bottom: 0; }
.pcard-care .p-body > span:last-child { margin-bottom: 2px; }

/* Reenviar mensaje */
.bubble { position: relative; }
.b-fwd { position: absolute; top: 50%; transform: translateY(-50%); right: -38px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: inherit; display: grid; place-items: center; padding: 0; cursor: pointer; opacity: 0; transition: opacity .15s; }
.bubble.me .b-fwd { right: auto; left: -38px; color: var(--text, inherit); }
.bubble:hover .b-fwd, .b-fwd:focus-visible { opacity: .9; }
@media (hover: none) { .b-fwd { opacity: .55; } }
.fwd-preview { padding: 10px 12px; border-radius: 12px; background: var(--bubble-in); border: 1px solid var(--line); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 12px; max-height: 84px; overflow: hidden; }
.fwd-list { display: flex; flex-direction: column; gap: 2px; max-height: min(46vh, 360px); overflow-y: auto; margin-top: 8px; }
.fwd-item { display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.fwd-item:hover { background: var(--hint, rgba(127,127,127,.08)); }
.fwd-item .av { width: 34px; height: 34px; flex-shrink: 0; }
.fwd-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fwd-name small { opacity: .6; margin-left: 4px; }
.fwd-check { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; color: transparent; flex-shrink: 0; }
.fwd-item[aria-selected="true"] .fwd-check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.fwd-count { font-size: 13px; opacity: .7; margin: 8px 0 0; }

/* ===================================================================   Juego sutil + movimiento: anillos del día, ronda, triage, transición y foco visual
   Solo transform / opacity (y el trazo de los anillos). Con "reducir movimiento" no hay animaciones.
   ========================================================================== */
.rg-focus { --rc: var(--accent); }
.rg-reply { --rc: var(--ok-dot); }
.rg-calm { --rc: #0EA5E9; }
.rings-wrap:empty { display: none; }
.rings { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); text-align: left; font: inherit; cursor: pointer; transition: background-color 160ms; }
.rings:hover { background: var(--surface-2); }
.rings-svg { width: 52px; height: 52px; flex-shrink: 0; }
.rings-svg circle { fill: none; stroke: var(--rc); stroke-width: 6; stroke-linecap: round; }
.rings-svg .rg-track { opacity: 0.16; }
.rings-svg .rg-fill { transition: stroke-dashoffset 1200ms var(--ease); }
.rings-svg .rg-fill.rg-none { opacity: 0.3; }
.rings-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13px; color: var(--text-2); }
.rg-n { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.rg-n i { width: 8px; height: 8px; border-radius: 50%; background: var(--rc); flex-shrink: 0; }
.rg-n b { color: var(--text); font-variant-numeric: tabular-nums; }
.rings-streak { flex-shrink: 0; margin-left: auto; padding: 4px 10px; border-radius: 999px; background: var(--high-bg); color: var(--high-fg); font-size: 13px; font-weight: 700; white-space: nowrap; }
.rings-help { display: flex; flex-direction: column; gap: 12px; }
.rh-row { margin: 0; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--text-2); }
.rh-row strong { color: var(--text); }
.rh-dot { width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; border: 3px solid var(--rc); flex-shrink: 0; }
.rh-ico { width: 14px; flex-shrink: 0; text-align: center; font-size: 13px; }
@media (max-width: 900px) {
  .inbox > .rings-wrap { margin: 12px 16px 0; }
  .inbox > .rings-wrap + .focus-bar { margin-top: 8px; }
  .rings { gap: 10px; }
  .rings-svg { width: 46px; height: 46px; }
  .rings-txt { gap: 0 10px; font-size: 12.5px; }
}

/* ---------- Ronda de respuestas ---------- */
.fs-k { font-weight: 500; color: var(--text-2); margin-right: 2px; }
.fs-swipe { position: relative; width: min(720px, 100%); margin: 0 auto; }
.fs-swipe .fs-card { position: relative; z-index: 1; background: var(--bg); touch-action: pan-y; animation: cardIn 260ms var(--ease); transition: transform 420ms cubic-bezier(.34, 1.56, .64, 1); will-change: transform; }
.fs-swipe .fs-card.dragging { transition: none; cursor: grabbing; user-select: none; }
.fs-swipe .fs-card.flying { transition: transform 180ms ease-in, opacity 180ms ease-in; opacity: 0; }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.swipe-hint { position: absolute; top: 24px; z-index: 0; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; opacity: 0; transform: scale(calc(0.85 + var(--sw, 0) * 0.15)); }
.swipe-done { left: 4px; background: var(--ok-soft); color: var(--ok); }
.swipe-later { right: 4px; background: var(--high-bg); color: var(--high-fg); }
.fs-swipe.sw-r .swipe-done, .fs-swipe.sw-l .swipe-later { opacity: var(--sw, 0); }
.fs-swipe-tip { margin: 0; font-size: 12px; color: var(--text-3); text-align: center; }

.triage { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.triage-q { font-size: 13px; font-weight: 600; color: var(--text-2); }
.triage-btns { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.tri { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: background-color 150ms, transform 120ms; }
.tri:hover { background: var(--surface-2); }
.tri:active { transform: scale(0.96); }
.tri.tri-main { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tri.tri-main:hover { background: var(--accent-hover); }
.tri:disabled { opacity: 0.5; }

/* Tilde con rebote al resolver */
.fs-tick { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.fs-tick span { width: 88px; height: 88px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--ok-dot); color: #fff; box-shadow: 0 12px 32px rgba(18, 183, 106, 0.35); animation: tickPop 650ms cubic-bezier(.34, 1.56, .64, 1) forwards; }
.fs-tick svg { width: 44px; height: 44px; stroke-width: 2.6; }
@keyframes tickPop { 0% { transform: scale(0.3); opacity: 0; } 35% { transform: scale(1.12); opacity: 1; } 55% { transform: scale(0.96); } 75% { transform: scale(1); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }

/* Bandeja en cero */
.fs-zero { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.fs-zero h2 { margin: 0; }
.fs-zero > p { margin: 0; font-size: 16px; }
.fs-zero-k { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ok); }
.fs-zero-ico { width: 76px; height: 76px; background: var(--ok-dot); color: #fff; animation: tickPopIn 700ms cubic-bezier(.34, 1.56, .64, 1); }
.fs-zero-ico svg { width: 38px; height: 38px; stroke-width: 2.6; }
.fs-zero.settled .fs-zero-ico { animation: none; }
@keyframes tickPopIn { 0% { transform: scale(0.3); opacity: 0; } 45% { transform: scale(1.15); opacity: 1; } 70% { transform: scale(0.95); } 100% { transform: scale(1); } }
.fs-best { margin: 4px 0 0; min-height: 22px; font-size: 14px; color: var(--text-2); }
.fs-best.is-new { padding: 6px 14px; border-radius: 14px; background: var(--high-bg); color: var(--high-fg); }
.fs-best strong { font-weight: 700; }
.fs-confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 71; pointer-events: none; }

/* ---------- Transición antes de WhatsApp ---------- */
.tr { z-index: 85; }
.tr-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; }
.tr-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 140px; flex: 1 1 140px; max-width: 180px; padding: 14px 12px; border-radius: 16px; border: 1px solid rgba(99, 102, 241, 0.35); background: rgba(255, 255, 255, 0.55); color: inherit; font: inherit; cursor: pointer; transition: transform 140ms ease-out, background-color 160ms; }
.tr-chip strong { font-size: 15px; }
.tr-chip small { font-size: 12px; opacity: 0.75; }
.tr-chip:hover { background: rgba(255, 255, 255, 0.8); }
.tr-chip:active { transform: scale(0.97); }
.tr-chip.is-last { border-color: #4F46E5; box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.25); }
:root[data-theme="dark"] .tr-chip { background: rgba(255, 255, 255, 0.06); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tr-chip { background: rgba(255, 255, 255, 0.06); } }
.tr-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.tr-orb { position: relative; width: 180px; height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tr-prog { position: absolute; inset: 0; width: 100%; height: 100%; }
.tr-prog circle { fill: none; stroke-width: 5; stroke-linecap: round; }
.tr-prog-track { stroke: rgba(99, 102, 241, 0.18); }
.tr-prog-fill { stroke: #6366F1; }
.tr-breath { position: absolute; inset: 22px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, rgba(129, 140, 248, 0.55), rgba(99, 102, 241, 0.22) 60%, rgba(99, 102, 241, 0.06)); transform: scale(0.6); transition: transform 4s ease-in-out; }
.tr-orb[data-kind="breath"].inhale .tr-breath { transform: scale(1); }
.tr-orb:not([data-kind="breath"]) .tr-breath { transform: scale(0.85); opacity: 0.5; }
.tr-big { position: relative; font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tr-small { position: relative; font-size: 13px; opacity: 0.8; }
.tr-orb.done .tr-big { animation: tickPopIn 600ms cubic-bezier(.34, 1.56, .64, 1); }
.tr-prompt { margin: 0; max-width: 380px; font-size: 16px; line-height: 1.5; min-height: 48px; }
.tr-actions { margin-top: 0; }
@media (max-width: 900px) { .tr-orb { width: 156px; height: 156px; } .tr-chip { min-width: 0; flex-basis: 100%; max-width: none; flex-direction: row; justify-content: space-between; padding: 12px 16px; } }

/* ---------- El foco como estado visual ---------- */
/* Fuera de la ventana el acento se apaga (lo calcula noa.js con color-mix) y avatares/etiquetas bajan el tono */
html.focus-quiet .tag:not(.plain), html.focus-quiet .av { opacity: 0.85; }
.tag, .av { transition: opacity 600ms ease-out; }
.focus-wake-fx { position: fixed; inset: 0; z-index: 25; pointer-events: none; background: radial-gradient(60% 45% at 50% 30%, var(--accent), transparent 70%); opacity: 0; animation: wakeFx 1100ms ease-out forwards; }
@keyframes wakeFx { 0% { opacity: 0; transform: scale(0.92); } 30% { opacity: 0.22; } 100% { opacity: 0; transform: scale(1.08); } }
html.focus-wake .focus-ind { animation: wakePulse 900ms cubic-bezier(.34, 1.56, .64, 1); }
@keyframes wakePulse { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .rings-svg .rg-fill, .fs-swipe .fs-card, .tr-breath, .tag, .av { transition: none !important; }
  .fs-swipe .fs-card, .fs-zero-ico, .tr-orb.done .tr-big, .fs-tick span { animation: none !important; }
  .focus-wake-fx { display: none; }
}

/* ---------- Juego sutil en el celular: toques ≥ 44px, texto ≥ 14px, acciones al alcance del pulgar ---------- */
@media (max-width: 900px) {
  .rings { min-height: 64px; padding: 8px 12px 8px 8px; }
  .rings-txt, .rings-streak { font-size: 14px; }
  .triage-q { font-size: 14px; width: 100%; }
  .triage-btns { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; gap: 8px; }
  .tri { height: 44px; min-height: 44px; justify-content: center; padding: 0 8px; font-size: 14px; }
  .fs-swipe-tip { font-size: 14px; }
  .fs-zero-k { font-size: 14px; }
  /* Bandeja en cero: "Volver a Hoy" abajo, fijo y grande, sobre la zona segura */
  .fs-summary { min-height: 100%; }
  .fs-summary > [data-fs="exit"] { position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); width: 100%; height: 52px; margin-top: auto; z-index: 2; box-shadow: var(--shadow-2); background: var(--surface); }
  /* Transición: el contenido baja a la mitad inferior (uso con una mano) */
  .tr { align-items: flex-end; }
  .tr-inner { margin: auto 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .tr-chip { min-height: 56px; }
  .tr-chip strong { font-size: 16px; }
  .tr-chip small, .tr-small, .calm-kicker { font-size: 14px; }
  .tr-actions .btn { width: 100%; }
}
=======
/* Acciones del mensaje (reaccionar, reenviar) — reemplaza el botón suelto de reenviar */
.b-fwd { display: none; }
.b-acts { position: absolute; top: 50%; transform: translateY(-50%); right: -76px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.bubble.me .b-acts { right: auto; left: -76px; flex-direction: row-reverse; }
.bubble:hover .b-acts, .b-acts:focus-within { opacity: .95; }
@media (hover: none) { .b-acts { opacity: .55; } }
.b-act { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--text, inherit); display: grid; place-items: center; padding: 0; cursor: pointer; }
.b-act:active { transform: scale(.92); }
/* Reacciones debajo de la burbuja */
.bubble.has-reacts, .bubble:has(.b-reacts) { margin-bottom: 14px; }
.b-reacts { position: absolute; bottom: -14px; right: 10px; display: flex; gap: 2px; }
.bubble.me .b-reacts { right: auto; left: 10px; }
.b-react { display: inline-flex; align-items: center; gap: 2px; padding: 1px 6px; min-height: 24px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--text, inherit); font-size: 14px; line-height: 1; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.b-react small { font-size: 11px; opacity: .75; }
.b-react.mine { border-color: var(--accent); }
/* Barra de reacciones rápidas y selector de emojis/GIF */
.react-bar, .emoji-pop { position: fixed; z-index: 80; background: var(--bg); border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(0,0,0,.18); }
.react-bar { display: flex; gap: 2px; padding: 4px; border-radius: 999px; animation: popIn .14s ease-out; }
.react-bar button { width: 40px; height: 40px; border: 0; background: none; border-radius: 50%; font-size: 24px; line-height: 1; cursor: pointer; display: grid; place-items: center; color: inherit; transition: transform .12s; }
.react-bar button:hover, .react-bar button:focus-visible { transform: scale(1.18); background: var(--hint, rgba(127,127,127,.1)); }
.react-bar button.on { background: var(--accent-soft, rgba(127,127,127,.15)); }
.emoji-pop { width: min(352px, calc(100vw - 16px)); border-radius: 16px; overflow: hidden; animation: popIn .14s ease-out; }
.ep-tabs { display: flex; border-bottom: 1px solid var(--line); }
.ep-tabs button { flex: 1; padding: 10px; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; cursor: pointer; opacity: .6; border-bottom: 2px solid transparent; }
.ep-tabs button[aria-selected="true"] { opacity: 1; border-bottom-color: var(--accent); }
.ep-body { max-height: min(320px, 46vh); overflow-y: auto; padding: 6px 8px 10px; }
.ep-h { margin: 8px 4px 4px; font-size: 12px; font-weight: 600; opacity: .6; }
.ep-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.ep-e { aspect-ratio: 1; border: 0; background: none; font-size: 24px; line-height: 1; border-radius: 8px; cursor: pointer; padding: 0; }
.ep-e:hover, .ep-e:focus-visible { background: var(--hint, rgba(127,127,127,.1)); }
.ep-gifbar { display: flex; gap: 6px; align-items: center; padding: 4px 0 8px; }
.ep-gifbar input[type="search"] { flex: 1; min-width: 0; }
.ep-gifs { columns: 2; column-gap: 6px; }
.ep-gif { display: block; width: 100%; border: 0; padding: 0; margin: 0 0 6px; background: var(--hint, rgba(127,127,127,.1)); border-radius: 8px; overflow: hidden; cursor: pointer; break-inside: avoid; }
.ep-gif img { display: block; width: 100%; height: auto; }
@keyframes popIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .react-bar, .emoji-pop { animation: none; } .react-bar button { transition: none; } }

/* Celular: sin botones sueltos al costado de cada mensaje; se usa mantener apretado (hoja de acciones) */
@media (hover: none) and (max-width: 900px) {
  .b-acts { display: none; }
  .bubble { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; transition: transform .18s ease; }
  .bubble.pressing { transform: scale(.97); }
  .b-react { min-height: 28px; padding: 2px 8px; font-size: 15px; }
}
.ms-react { display: flex; justify-content: space-between; gap: 4px; padding: 4px 0 12px; }
.ms-react button { flex: 1; min-width: 44px; height: 52px; border: 0; border-radius: 14px; background: var(--hint, rgba(127,127,127,.08)); font-size: 26px; line-height: 1; cursor: pointer; display: grid; place-items: center; color: inherit; }
.ms-react button.on { background: var(--accent-soft, rgba(127,127,127,.18)); box-shadow: inset 0 0 0 2px var(--accent); }
.ms-react button:active { transform: scale(.94); }
.ms-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.ms-item { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 6px; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; font-size: 16px; text-align: left; cursor: pointer; }
.ms-item:last-child { border-bottom: 0; }
@media (prefers-reduced-motion: reduce) { .bubble { transition: none; } .bubble.pressing { transform: none; } }

/* Integrantes del grupo */
.who-members { padding: 0; border: 0; background: none; color: var(--accent-text, var(--accent)); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.gm-count { font-size: 13px; opacity: .7; margin: 4px 0 6px; }
.gm-list { display: flex; flex-direction: column; max-height: min(58vh, 480px); overflow-y: auto; margin: 0 -4px; }
.gm-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.gm-row:last-child { border-bottom: 0; }
.gm-row .av { width: 40px; height: 40px; flex-shrink: 0; }
.gm-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gm-txt strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.gm-txt small { font-size: 13px; opacity: .65; }
.gm-admin { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft, rgba(127,127,127,.12)); color: var(--accent-text, inherit); flex-shrink: 0; }
.gm-msg { min-height: 40px; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 900px) { .gm-msg { min-height: 44px; } }

/* Menciones en grupos (@todos / @contacto) */
.composer { position: relative; }
.mention-pop { position: absolute; left: 12px; right: 12px; bottom: calc(100% + 6px); max-height: min(44vh, 340px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 4px; z-index: 30; display: flex; flex-direction: column; }
.mention-pop.hidden { display: none; }
.mp-item { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; width: 100%; }
.mp-item.is-sel, .mp-item:hover { background: var(--accent-soft, rgba(127,127,127,.12)); }
.mp-item .av { width: 34px; height: 34px; flex-shrink: 0; }
.mp-all { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; flex-shrink: 0; }
.mp-txt { display: flex; flex-direction: column; min-width: 0; }
.mp-txt strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-txt small { font-size: 12px; opacity: .65; }
.mp-empty { margin: 0; padding: 12px; font-size: 14px; opacity: .7; }
.b-mention { color: var(--accent-text, var(--accent)); font-weight: 600; }
@media (max-width: 900px) { .mention-pop { left: 8px; right: 8px; } .mp-item { min-height: 52px; } }

/* Soltar un archivo sobre la conversación */
.conv { position: relative; }
.conv.is-dropping::after { content: 'Soltá el archivo para adjuntarlo'; position: absolute; inset: 8px; display: flex; align-items: center; justify-content: center; border: 2px dashed var(--accent); border-radius: 16px; background: color-mix(in srgb, var(--surface) 82%, transparent); color: var(--accent-text, var(--accent)); font-weight: 600; font-size: 16px; z-index: 40; pointer-events: none; }


/* ==========================================================================
   Hoy: más lugar para las tarjetas.
   Saludo, números y anillos se desplazan con la lista; solo las pestañas y los
   filtros quedan fijos arriba. El resumen se puede ocultar (botón con gráfico).
   ========================================================================== */
.inbox { overflow-y: auto; gap: 12px; padding-top: 20px; }
.inbox > .inbox-list { flex: none; overflow: visible; min-height: auto; }
.inbox .h-title { font-size: 24px; }
.inbox-sticky {
  position: sticky; top: 0; z-index: 4; display: flex; flex-direction: column; gap: 8px;
  margin: 0 -6px; padding: 8px 6px 10px; background: var(--bg); border-bottom: 1px solid transparent;
}
.inbox-sticky .seg { max-width: 100%; }
html.hoy-compact .inbox .hm, html.hoy-compact .inbox .rings-wrap { display: none; }
@media (max-width: 900px) {
  .inbox-sticky { margin: 0; padding: 8px 16px 10px; }
  .inbox-sticky > .seg-wrap, .inbox-sticky > .hoy-filters { padding: 0; }
  .inbox .h-title { font-size: 22px; }
}

/* ==========================================================================
   Chats: filtros compactos (Tipo y Etiquetas) con menú desplegable
   ========================================================================== */
.chat-filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; min-width: 0; }
.fbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px 0 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 500;
  min-width: 0; max-width: 60%;
}
.fbtn:hover { background: var(--surface-2); }
.fbtn[aria-expanded="true"] { border-color: var(--accent); }
.fbtn.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.fbtn-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbtn > svg:last-child { transform: rotate(90deg); opacity: .7; flex-shrink: 0; }
.fbtn-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.fbtn-x { width: 36px; height: 36px; }
.fpop {
  position: fixed; z-index: 70; overflow-y: auto; padding: 6px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-2); animation: sheetUp 160ms var(--ease);
}
.fpop-item {
  width: 100%; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border: none; border-radius: 10px;
  background: transparent; color: var(--text); font-size: 14px; text-align: left;
}
.fpop-item:hover, .fpop-item:focus-visible { background: var(--surface-2); }
.fpop-item[aria-checked="true"] { font-weight: 600; }
.fpop-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fpop-sp { width: 16px; flex-shrink: 0; }
.fpop-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.fpop-search { display: flex; align-items: center; gap: 8px; height: 38px; margin: 2px 2px 6px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); color: var(--text-3); }
.fpop-search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; color: var(--text); font-size: 14px; }
.ldot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--lc-fg, currentColor); }

/* Botón de cuenta: redondel con la inicial (P / B) */
.acct.acct-circle { width: auto; height: auto; padding: 0; border: none; background: transparent; align-self: flex-start; }
.acct-ring {
  width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--mid-dot); color: #fff; font-weight: 800; font-size: 15px; letter-spacing: 0; box-shadow: 0 0 0 3px var(--bg);
  transition: background-color 200ms, transform 120ms;
}
.acct-ring.on { background: #12B76A; }
.acct-ring.warn { background: var(--high-dot); }
.acct.acct-circle:hover .acct-ring { transform: scale(1.06); }
.acct.acct-circle:focus-visible { outline: none; }
.acct.acct-circle:focus-visible .acct-ring { outline: 2px solid var(--accent); outline-offset: 2px; }
html.side-collapsed .acct.acct-circle { width: auto; align-self: center; }

/* Botón de actualizar: gira mientras trae los datos */
[data-hard-refresh].is-spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
