/* === Ü-BOT V4 — Base styles & theme tokens === */

:root {
  /* Accent + transparencies — overridden by Settings via JS */
  --accent: #4c8bf5;
  --accent-hover: #6aa1ff;
  --accent-soft: rgba(76, 139, 245, 0.14);
  --accent-contrast: #ffffff;

  --chat-alpha: 0.78;   /* floating chat background opacity */
  --panel-alpha: 1;     /* panels glass effect */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05), 0 1px 1px rgba(0,0,0,0.03);
  --shadow-md: 0 6px 24px -8px rgba(15,23,42,0.18), 0 2px 6px rgba(15,23,42,0.06);
  --shadow-lg: 0 20px 48px -16px rgba(15,23,42,0.28), 0 8px 16px rgba(15,23,42,0.10);

  --fast: 160ms cubic-bezier(.4,0,.2,1);
  --med:  220ms cubic-bezier(.4,0,.2,1);

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  /* Compatibilidad para plugins legacy, incluido Universal Viewer. */
  --sans: var(--font-sans);
  --mono: var(--font-mono);
  --serif: Georgia, 'Times New Roman', serif;
  --line: var(--border);
  --line-2: var(--border);
  --ink: var(--fg);
  --ink-2: var(--fg-soft);
  --ink-3: var(--fg-mute);
  --bg-2: var(--surface-2);
  --bg-3: var(--surface-3);
}

/* Light theme (default) */
:root, [data-theme="light"] {
  --bg: #f6f7fb;
  --bg-soft: #eef0f6;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #f1f3f8;
  --border: #e3e6ee;
  --border-strong: #cdd2de;
  --fg: #11182a;
  --fg-soft: #4a5169;
  --fg-mute: #8088a0;
  --fg-faint: #a8aec1;
  --danger: #e23b50;
  --warn: #d97706;
  --ok: #16a34a;
  --info: #0ea5e9;
  --hover: rgba(15,23,42,0.05);
  --hover-strong: rgba(15,23,42,0.08);
  --scrim: rgba(15,23,42,0.45);
  --chat-bg: 255,255,255;
  --topbar-bg: rgba(255,255,255,0.85);
  --selection: rgba(76,139,245,0.18);
}

[data-theme="dark"] {
  --bg: #0c0f17;
  --bg-soft: #0f1320;
  --surface: #141826;
  --surface-2: #181d2d;
  --surface-3: #1d2335;
  --border: #232a3d;
  --border-strong: #2f3853;
  --fg: #e6e9f2;
  --fg-soft: #b3b9cc;
  --fg-mute: #818799;
  --fg-faint: #5b6178;
  --danger: #ff5d72;
  --warn: #f59e0b;
  --ok: #22c55e;
  --info: #38bdf8;
  --hover: rgba(255,255,255,0.05);
  --hover-strong: rgba(255,255,255,0.09);
  --scrim: rgba(0,0,0,0.6);
  --chat-bg: 20,24,38;
  --topbar-bg: rgba(20,24,38,0.78);
  --selection: rgba(76,139,245,0.28);
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  font-feature-settings: "cv11", "ss01";
}
::selection { background: var(--selection); }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; padding: 0; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Shell layout === */
.app {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 100%;
  height: 100vh;
  width: 100vw;
  background: var(--bg);
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  width: 232px;
  transition: width var(--med);
  overflow: hidden;
  position: relative;
}
.sidebar.collapsed { width: 60px; }
.sidebar-head {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 14px;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar.collapsed .sidebar-head { padding: 0 10px; justify-content: center; }
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent), #000 20%));
  color: var(--accent-contrast);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-text .v { color: var(--fg-mute); font-weight: 500; }
.sidebar.collapsed .brand-text { display: none; }

.sidebar-toggle {
  margin-left: auto;
  width: 26px; height: 26px;
  border-radius: 6px;
  color: var(--fg-mute);
  display: grid; place-items: center;
  transition: var(--fast);
}
.sidebar-toggle:hover { background: var(--hover); color: var(--fg); }
.sidebar.collapsed .sidebar-toggle { display: none; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-group-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-mute);
  padding: 10px 10px 6px;
}
.sidebar.collapsed .nav-group-label { display: none; }
.sidebar.collapsed .nav-group-label + .nav-item { margin-top: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--fg-soft);
  font-size: 13px;
  font-weight: 500;
  transition: var(--fast);
  white-space: nowrap;
  position: relative;
  cursor: pointer;
}
.nav-item:hover { background: var(--hover); color: var(--fg); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--fg-mute);
  display: grid; place-items: center;
}
.nav-item.active .nav-icon { color: var(--accent); }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  font-size: 10.5px;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 8px;
}
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .nav-item:hover::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 20;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Main */
.main {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  position: relative;
}

/* Topbar */
.topbar {
  height: 56px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 6px;
  position: relative;
  z-index: 5;
  min-width: 0;
}
.topbar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.topbar-sub {
  font-size: 12px;
  color: var(--fg-mute);
  margin-left: 4px;
}
.topbar-metrics {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar-metrics::-webkit-scrollbar { display: none; }
.topbar-metric {
  height: 30px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg-soft);
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}
.topbar-metric.system {
  height: 38px;
  min-width: 66px;
  padding: 0 7px 0 5px;
  background: var(--surface-3);
  gap: 6px;
}
.topbar-metric-spacer {
  flex: 1 1 auto;
  min-width: 28px;
}
.topbar-metric svg {
  color: var(--accent);
}
.topbar-metric.system svg {
  display: none;
}
.topbar-metric-label {
  color: var(--fg-mute);
  font-size: 11px;
  font-weight: 600;
}
.topbar-metric-value {
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
}
.topbar-metric-gauge {
  --gauge-track: color-mix(in srgb, var(--accent) 15%, var(--border));
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, var(--surface) 57%, transparent 59%),
    conic-gradient(var(--accent) var(--metric-percent), var(--gauge-track) 0);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 65%, transparent);
}
.topbar-metric-gauge span {
  transform: translateY(0.5px);
}
.topbar-search-trigger {
  flex: 0 0 auto;
  margin-right: 2px;
}
.topbar-search {
  margin-left: 24px;
  position: relative;
  flex: 1;
  max-width: 480px;
}
.topbar-search input {
  width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 7px 12px 7px 34px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--fg);
  outline: none;
  transition: var(--fast);
}
.topbar-search input::placeholder { color: var(--fg-mute); }
.topbar-search input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.topbar-search .ic {
  position: absolute;
  left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--fg-mute);
  pointer-events: none;
}
.topbar-search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg-mute);
  padding: 2px 6px;
  border-radius: 4px;
}
.topbar-spacer { flex: 1; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  min-width: max-content;
}
.notification-center {
  position: relative;
  flex: 0 0 auto;
}
.notification-bell-badge {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger);
  color: #fff;
  border: 2px solid var(--topbar-bg);
  font-size: 9px;
  line-height: 1;
  font-weight: 800;
}
.notification-panel {
  position: absolute;
  top: 42px;
  right: 0;
  width: min(390px, calc(100vw - 24px));
  max-height: min(640px, calc(100vh - 78px));
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  z-index: 90;
  overflow: hidden;
}
.notification-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
}
.notification-panel-head strong {
  display: block;
  color: var(--fg);
  font-size: 13px;
  font-weight: 800;
}
.notification-panel-head span {
  display: block;
  color: var(--fg-mute);
  font-size: 11px;
  margin-top: 2px;
}
.notification-panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.icon-btn.sm {
  width: 28px;
  height: 28px;
}
.notification-list {
  max-height: calc(min(640px, 100vh - 78px) - 57px);
  overflow: auto;
  padding: 6px;
}
.notification-empty {
  min-height: 90px;
  display: grid;
  place-items: center;
  gap: 8px;
  color: var(--fg-mute);
  font-size: 12px;
  text-align: center;
}
.notification-empty.danger {
  min-height: auto;
  padding: 10px;
  color: var(--danger);
}
.notification-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.notification-item + .notification-item {
  margin-top: 4px;
}
.notification-item:hover {
  background: var(--hover);
}
.notification-item.error {
  border-color: color-mix(in srgb, var(--danger) 26%, transparent);
  background: color-mix(in srgb, var(--danger) 6%, transparent);
}
.notification-item.warning {
  border-color: color-mix(in srgb, var(--warn) 30%, transparent);
  background: color-mix(in srgb, var(--warn) 7%, transparent);
}
.notification-item.success {
  border-color: color-mix(in srgb, var(--ok) 28%, transparent);
}
.notification-item-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--accent);
}
.notification-item.error .notification-item-icon { color: var(--danger); }
.notification-item.warning .notification-item-icon { color: var(--warn); }
.notification-item-body {
  min-width: 0;
}
.notification-item-kicker {
  color: var(--fg-mute);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 800;
}
.notification-item-title {
  color: var(--fg);
  font-size: 13px;
  font-weight: 800;
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.notification-item-text {
  color: var(--fg-soft);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.notification-item-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.notification-item-actions button {
  height: 25px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--fg-soft);
  font-size: 11px;
  font-weight: 700;
}
.notification-item-actions button:hover {
  color: var(--fg);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Icon button */
.icon-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  color: var(--fg-soft);
  display: grid; place-items: center;
  transition: var(--fast);
  position: relative;
  flex: 0 0 auto;
}
.icon-btn:hover { background: var(--hover); color: var(--fg); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--surface);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--fg-soft);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  flex: 0 0 auto;
  white-space: nowrap;
}
.status-pill .pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(34,197,94,0.4);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

/* Content frame */
.content {
  overflow: hidden;
  min-height: 0;
  display: flex;
  position: relative;
}
.module {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: var(--fast);
  border: 1px solid transparent;
  color: var(--fg);
  background: transparent;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { color: var(--fg-soft); }
.btn.outline { border-color: var(--border); background: var(--surface); }
.btn.outline:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: rgba(226,59,80,0.1); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.lg { padding: 9px 16px; font-size: 14px; }

/* Three-pane layout for many modules */
.three-pane {
  display: grid;
  grid-template-columns: 260px 380px 1fr;
  height: 100%;
  min-height: 0;
}
.two-pane {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100%;
  min-height: 0;
}
.pane {
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.pane:last-child { border-right: none; background: var(--bg); }
.pane-head {
  height: 52px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}
.pane-head h3 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.005em;
}
.pane-body { flex: 1; overflow-y: auto; }
.pane-body.padded { padding: 12px; }

/* List item generic (mail, contacts, etc) */
.list-row {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--fast);
  position: relative;
}
.list-row:hover { background: var(--surface-2); }
.list-row.selected { background: var(--accent-soft); }
.list-row.selected::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}
.list-row .row-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 2px;
}
.list-row .row-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-row .row-meta {
  font-size: 11px;
  color: var(--fg-mute);
  flex-shrink: 0;
}
.list-row .row-sub {
  font-size: 12.5px;
  color: var(--fg-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}
.list-row .row-preview {
  font-size: 12px;
  color: var(--fg-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.list-row.unread .row-title { font-weight: 700; }
.list-row.unread::after {
  content: '';
  position: absolute;
  right: 14px; top: 14px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.list-row.mail-row {
  background: var(--bg);
}
.list-row.mail-row.read {
  background: color-mix(in oklab, var(--bg) 86%, var(--surface-2));
}
.list-row.mail-row.read .row-title,
.list-row.mail-row.read .row-sub,
.list-row.mail-row.read .row-preview,
.list-row.mail-row.read .row-meta {
  color: var(--fg-mute);
}
.list-row.mail-row.read .row-title,
.list-row.mail-row.read .row-sub {
  font-weight: 500;
}
.list-row.mail-row.read .avatar {
  opacity: .72;
}
.list-row.mail-row.read:not(.selected) {
  opacity: .72;
}
.list-row.mail-row.read:hover {
  opacity: .9;
  background: var(--surface-2);
}
.list-row.mail-row.unread .row-sub {
  color: var(--fg);
  font-weight: 650;
}
.list-row.mail-row.selected {
  opacity: 1;
  background: var(--accent-soft);
}

.mail-bulk-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
  max-width: 100%;
  overflow: visible;
}
.mail-bulk-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 118px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.mail-bulk-actions .btn.sm {
  min-height: 28px;
  padding: 0 7px;
  gap: 4px;
  white-space: nowrap;
}
.mail-head-trash {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--fg-soft);
  border: 1px solid var(--border);
}
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.mail-recipient-chip {
  margin-top: 0;
  font-weight: 650;
  border-radius: 5px;
  background: transparent;
}
.mail-recipient-chip.recipient-to {
  color: #15803d;
  border-color: #bbf7d0;
  background: rgba(187, 247, 208, 0.18);
}
.mail-recipient-chip.recipient-cc {
  color: #b45309;
  border-color: #fde68a;
  background: rgba(253, 230, 138, 0.18);
}
.mail-recipient-chip.recipient-bcc {
  color: #dc2626;
  border-color: #fecaca;
  background: rgba(254, 202, 202, 0.18);
}
.mail-recipient-chip.recipient-sent,
.mail-recipient-chip.recipient-unknown {
  color: var(--fg-soft);
  border-color: var(--border);
}
.chip.dot::before {
  content:''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}

.company-strip {
  align-items: center;
  overflow-x: auto;
  flex-wrap: nowrap !important;
  padding: 0 0 12px;
  scrollbar-gutter: stable;
}
.notes-company-bar {
  padding: 12px 18px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.notes-company-bar .company-strip {
  margin-bottom: -1px;
}
.company-pill {
  --company-color: var(--accent);
  min-height: 30px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-soft);
  border-radius: 999px;
  padding: 5px 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--fast);
}
.company-pill:hover {
  border-color: var(--company-color);
  color: var(--fg);
}
.company-pill.active {
  background: color-mix(in srgb, var(--company-color) 14%, var(--surface));
  color: var(--fg);
  border-color: var(--company-color);
}
.company-pill img {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
}
.company-pill strong {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--company-color) 18%, var(--surface-2));
  color: inherit;
  font-size: 11px;
}

/* Projects */
.projects-module {
  background: var(--bg);
}
.projects-topbar {
  gap: 10px;
}
.projects-search {
  width: min(380px, 30vw);
}
.projects-company-bar {
  flex-shrink: 0;
  padding: 11px 18px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: grid;
  gap: 8px;
}
.projects-company-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 3px;
}
.projects-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 250px minmax(420px, 1fr) 390px;
}
.projects-left,
.projects-list-pane,
.projects-detail-pane {
  min-width: 0;
}
.projects-grid-scroll {
  overflow-y: auto;
  background: var(--bg);
}
.projects-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 14px;
  align-content: start;
}
.projects-sidebar-content {
  display: grid;
  gap: 14px;
}
.project-sidebar-section {
  display: grid;
  gap: 5px;
}
.project-sidebar-company {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.project-sidebar-company strong,
.project-sidebar-company span {
  display: block;
}
.project-sidebar-company strong {
  font-size: 13.5px;
}
.project-sidebar-company span {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--fg-mute);
}
.project-sidebar-row,
.project-client-row > button:first-child {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--fg-soft);
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.project-sidebar-row:hover,
.project-client-row:hover {
  background: var(--hover);
}
.project-sidebar-row.active,
.project-client-row.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}
.project-sidebar-row span,
.project-client-row span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-sidebar-row b,
.project-client-row b {
  font-size: 11px;
  color: var(--fg-mute);
}
.project-client-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px 28px;
  align-items: center;
  border-radius: 7px;
}
.client-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}
.project-company-logo {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
}
.project-card {
  --project-color: var(--accent);
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  display: grid;
  gap: 12px;
  transition: var(--fast);
}
.project-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.project-card.active {
  border-color: var(--project-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--project-color) 18%, transparent);
}
.project-color-line {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--project-color);
}
.project-card-head {
  display: flex;
  gap: 10px;
}
.project-card-head h4 {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-family: var(--font-display);
  letter-spacing: 0;
}
.project-card-head p {
  margin: 0;
  color: var(--fg-soft);
  font-size: 12.5px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.project-card-actions {
  margin-left: auto;
  display: flex;
  gap: 3px;
}
.project-meta-row,
.project-card-foot {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--fg-mute);
  font-size: 11.5px;
  align-items: center;
}
.project-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  color: var(--fg-mute);
  font-size: 11.5px;
}
.project-progress div {
  grid-column: 1 / -1;
  height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.project-progress i {
  display: block;
  height: 100%;
  background: var(--project-color);
}
.project-assignment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.project-assignment select,
.project-detail-grid select,
.project-detail-grid input,
.pr-field input,
.pr-field select,
.pr-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--fg);
  padding: 7px 9px;
  font-size: 12.5px;
}
.project-detail-body {
  display: grid;
  gap: 14px;
}
.project-detail-hero {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.project-detail-mark {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--project-color);
  background: color-mix(in srgb, var(--project-color) 14%, var(--surface-2));
}
.project-detail-hero h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
}
.project-detail-hero p {
  margin: 5px 0 0;
  color: var(--fg-soft);
  font-size: 13px;
  line-height: 1.5;
}
.project-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.project-detail-grid label,
.pr-field {
  display: grid;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.project-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.project-info-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  display: grid;
  gap: 8px;
}
.project-info-list h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 13.5px;
}
.project-mini-item {
  display: flex;
  gap: 9px;
  padding: 8px;
  border-radius: 7px;
  background: var(--surface-2);
}
.project-mini-item strong {
  display: block;
  font-size: 12.5px;
}
.project-mini-item span {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--fg-mute);
}
.project-dialog {
  width: min(620px, calc(100vw - 40px));
}
.project-client-dialog {
  width: min(460px, calc(100vw - 40px));
}
.project-dialog-body {
  display: grid;
  gap: 12px;
  overflow: auto;
}
.project-dialog-actions {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.project-color-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.project-color-picker button {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 2px solid transparent;
  cursor: pointer;
}
.project-color-picker button.active {
  border-color: var(--fg);
}
.project-color-picker input {
  width: 42px;
  height: 30px;
  padding: 2px;
}

.inline-error {
  border: 1px solid color-mix(in srgb, var(--danger) 32%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.35;
  padding: 9px 10px;
}

@media (max-width: 1280px) {
  .projects-workspace {
    grid-template-columns: 230px minmax(380px, 1fr) 340px;
  }
}

/* Tree / folder list */
.tree { padding: 6px 8px; }
.tree-section {
  margin-bottom: 8px;
}
.tree-section-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-mute);
  cursor: pointer;
}
.tree-section-head:hover { color: var(--fg-soft); }
.tree-section-head .chev {
  transition: var(--fast);
  width: 14px; height: 14px;
}
.tree-section.collapsed .chev { transform: rotate(-90deg); }
.tree-section.collapsed .tree-items { display: none; }
.tree-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--fg-soft);
  cursor: pointer;
  transition: var(--fast);
  margin-bottom: 1px;
}
.tree-item:hover { background: var(--hover); color: var(--fg); }
.tree-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.code-file-tree .code-tree-item {
  min-height: 30px;
  border: 1px solid transparent;
}
.code-file-tree .code-tree-item.reading {
  background: color-mix(in oklab, var(--accent-soft), var(--surface) 38%);
  border-color: color-mix(in oklab, var(--accent), transparent 72%);
  box-shadow: inset 3px 0 0 var(--accent), 0 1px 0 rgba(15, 23, 42, 0.03);
  color: var(--fg);
}
.code-file-tree .code-tree-item.reading::after {
  content: "abierto";
  margin-left: 6px;
  font-size: 10px;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid color-mix(in oklab, var(--accent), transparent 74%);
  border-radius: 999px;
  padding: 0 6px;
}
.tree-item .ic { color: var(--fg-mute); width: 16px; }
.tree-item.active .ic { color: var(--accent); }
.tree-item .ct { margin-left: auto; font-size: 11px; color: var(--fg-mute); }
.tree-item.active .ct { color: var(--accent); }
.tree-item .note-board-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-item .inline-actions {
  margin-left: 2px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  opacity: .78;
}
.tree-item .inline-actions button {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.tree-item .inline-actions button:hover {
  background: color-mix(in oklab, currentColor 10%, transparent);
}
.tree-item .inline-actions.note-board-actions {
  opacity: 0;
  pointer-events: none;
  transition: var(--fast);
}
.tree-item:hover .inline-actions.note-board-actions,
.tree-item.active .inline-actions.note-board-actions,
.tree-item:focus-within .inline-actions.note-board-actions {
  opacity: .86;
  pointer-events: auto;
}
.tree-item.indent-2 { padding-left: 24px; }
.tree-item.indent-3 { padding-left: 36px; }
.tree-item.mail-folder-drop.drag-over {
  background: color-mix(in oklab, var(--accent) 14%, var(--surface));
}
.tree-item.mail-folder-drop.drop-inside {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.tree-item.mail-folder-drop.drop-before::before,
.tree-item.mail-folder-drop.drop-after::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 8px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 16%, transparent);
}
.tree-item.mail-folder-drop.drop-before::before {
  top: -2px;
}
.tree-item.mail-folder-drop.drop-after::after {
  bottom: -2px;
}
.folder-toggle,
.folder-toggle-spacer {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}
.folder-toggle {
  border: 0;
  background: transparent;
  color: var(--fg-mute);
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 4px;
  cursor: pointer;
}
.folder-toggle:hover {
  background: var(--hover);
  color: var(--fg);
}
.tree-item .unread-folder-count {
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  text-align: center;
  font-weight: 700;
}
.tree-item button.unread-folder-count {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  font: inherit;
}
.tree-item button.unread-folder-count:hover {
  background: var(--accent-hover);
}
.tree-item button.unread-folder-count:disabled {
  opacity: .6;
  cursor: wait;
}

/* Code module editor */
.code-editor-pane {
  background: var(--surface-2);
}
.code-editor-head {
  min-height: 52px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.code-editor-title {
  min-width: 0;
  display: grid;
  gap: 1px;
}
.code-editor-title strong {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.code-editor-title span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.code-editor-shell {
  min-height: 0;
  display: grid;
  background: var(--bg);
}
.code-editor-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  background: #fbfcff;
}
[data-theme="dark"] .code-editor-grid {
  background: #0b1020;
}
.code-line-gutter {
  margin: 0;
  padding: 14px 10px 14px 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface-2), var(--bg) 35%);
  color: var(--fg-faint);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.58;
  text-align: right;
  user-select: none;
}
.code-textarea {
  width: 100%;
  height: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  resize: none;
  overflow: auto;
  padding: 14px 16px;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 23px,
      color-mix(in oklab, var(--fg), transparent 97%) 24px
    ),
    transparent;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.58;
  tab-size: 2;
  white-space: pre;
  caret-color: var(--accent);
}
.code-textarea:focus {
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent), transparent 70%);
}
.code-editor-empty {
  min-height: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  color: var(--fg-mute);
  text-align: center;
}
.code-editor-empty h3 {
  margin: 0;
  color: var(--fg);
  font-size: 15px;
}
.code-editor-empty p {
  margin: 0;
  max-width: 340px;
}
.code-chat-pane {
  background: var(--bg);
}
.code-chat-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -5px;
  z-index: 8;
  width: 10px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: col-resize;
}
.code-chat-resizer::before {
  content: "";
  position: absolute;
  top: 58px;
  bottom: 58px;
  left: 4px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background var(--fast), box-shadow var(--fast);
}
.code-chat-resizer:hover::before,
body.ubot-pane-resizing .code-chat-resizer::before {
  background: color-mix(in oklab, var(--accent), transparent 32%);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent), transparent 84%);
}
.code-chat-head {
  min-width: 0;
  padding-left: 12px;
  padding-right: 10px;
  gap: 8px;
}
.code-coder-indicator {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid currentColor;
  background: color-mix(in oklab, currentColor 10%, var(--surface));
}
.code-coder-indicator.online {
  color: var(--ok);
}
.code-coder-indicator.offline {
  color: var(--danger);
}
.codex-mark {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
  font-family: var(--font-display);
}
.code-provider-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  min-width: 0;
}
.code-provider-switch button {
  min-width: 0;
  height: 26px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.code-provider-switch button.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.code-provider-chip.online {
  color: var(--ok);
}
.code-provider-chip.offline {
  color: var(--danger);
}
.code-chat-head-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.code-chat-head-actions .btn.sm {
  padding-left: 8px;
  padding-right: 8px;
}
.code-chat-compose-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.code-chat-compose-actions .btn.sm {
  min-width: 0;
  padding: 5px 10px;
}
.code-chat-compose-actions .code-chat-send {
  min-width: 68px;
  justify-content: center;
}

/* Meets module */
.meets-module {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 340px;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.meets-datebar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 8px;
}
.meets-calendar-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.meet-day-chip {
  min-width: 0;
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--fg-soft);
  display: grid;
  place-items: center;
  gap: 1px;
  position: relative;
}
.meet-day-chip span {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--fg-mute);
}
.meet-day-chip strong {
  font-family: var(--font-display);
  font-size: 15px;
}
.meet-day-chip em {
  position: absolute;
  right: 5px;
  top: 5px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 10px;
  color: var(--accent-contrast);
  background: var(--accent);
}
.meet-day-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.meet-day-chip.today {
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--ok), transparent 58%);
}
.meets-list {
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 6px;
}
.meet-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 8px;
  background: var(--surface);
  color: var(--fg);
}
.meet-row:hover {
  background: var(--hover);
}
.meet-row.active {
  border-color: color-mix(in oklab, var(--accent), transparent 60%);
  background: var(--accent-soft);
}
.meet-row.important {
  box-shadow: inset 3px 0 0 var(--danger);
}
.meet-row-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-mute);
}
.meet-row-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.meet-row-main strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.meet-row-main small {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--fg-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meets-sidebar-actions {
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex;
  gap: 8px;
}
.meets-detail-pane {
  background: var(--bg);
}
.meets-detail-head {
  min-width: 0;
}
.meets-alert-chip {
  color: var(--danger);
  border-color: color-mix(in oklab, var(--danger), transparent 40%);
}
.meets-detail-body {
  min-height: 0;
  overflow: auto;
  padding: 16px;
  display: grid;
  gap: 14px;
}
.meets-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.meets-form-grid label,
.meets-notes-grid label,
.meets-transcript {
  min-width: 0;
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-soft);
}
.meets-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.meets-notes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.meets-notes-grid textarea,
.meets-transcript textarea {
  width: 100%;
  min-height: 132px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  resize: vertical;
  padding: 10px;
  font: inherit;
  line-height: 1.45;
}
.meets-transcript textarea {
  min-height: 190px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.meets-bot-pane {
  background: var(--bg);
}
.meets-bot-body {
  display: grid;
  align-content: start;
  gap: 12px;
}
.meets-status-card,
.meets-agent-note {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  display: grid;
  gap: 8px;
}
.meets-status-card strong,
.meets-agent-note strong {
  font-size: 13px;
}
.meets-status-card span,
.meets-agent-note p {
  margin: 0;
  color: var(--fg-mute);
  font-size: 12px;
  line-height: 1.45;
}
.meets-record-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.meets-attachments {
  display: grid;
  gap: 6px;
}
.meet-attachment {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
}
.meet-attachment span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}
.meet-attachment small {
  color: var(--fg-mute);
  font-size: 11px;
}
.tree-item.active .unread-folder-count {
  color: var(--accent-contrast);
}
.list-row.mail-row[draggable="true"] {
  cursor: grab;
}
.list-row.mail-row[draggable="true"]:active {
  cursor: grabbing;
}
.context-menu {
  position: fixed;
  z-index: 120;
  min-width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
}
.context-menu-title {
  padding: 7px 9px 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.context-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--fg-soft);
  text-align: left;
}
.context-menu button:hover:not(:disabled) {
  background: var(--hover);
  color: var(--fg);
}
.context-menu button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(15, 23, 42, .28);
}
.modal-backdrop.clear {
  background: transparent;
}

/* Empty state */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  color: var(--fg-mute);
  height: 100%;
}
.empty .ic { color: var(--fg-faint); margin-bottom: 14px; }
.empty h4 { font-family: var(--font-display); font-weight: 600; margin: 0 0 4px; color: var(--fg-soft); font-size: 15px; }
.empty p { font-size: 13px; max-width: 320px; margin: 0; }

/* Chatbot */
.chat-module {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);   /* fila acotada al alto del contenedor:
       permite scroll interno de la lista y de los mensajes, y deja el composer
       SIEMPRE visible al fondo (si no, la fila crece al contenido y lo empuja fuera) */
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
}
.chat-sidebar {
  min-width: 0;
  min-height: 0;          /* deja que .chat-conversation-list haga scroll */
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
}
.chat-sidebar-head,
.chat-main-head {
  min-height: 62px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}
.chat-sidebar-head h3,
.chat-main-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
}
.chat-main-head h2 {
  font-size: 18px;
}
.chat-sidebar-head span,
.chat-main-head span,
.chat-muted {
  color: var(--fg-mute);
  font-size: 12px;
}
.chat-conversation-list {
  flex: 1;
  overflow: auto;
  padding: 8px;
}
.chat-conversation {
  position: relative;
  width: 100%;
  min-height: 56px;
  border-radius: 8px;
  padding: 9px 36px 9px 10px;
  color: var(--fg);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
}
.chat-conversation:hover,
.chat-conversation.active {
  background: var(--hover);
}
.chat-conversation.active {
  color: var(--accent);
}
.chat-conversation span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 13px;
}
.chat-conversation small {
  color: var(--fg-mute);
  font-size: 11px;
}
.chat-row-delete {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 26px;
  height: 26px;
  transform: translateY(-50%);
  border-radius: 7px;
  display: grid;
  place-items: center;
  opacity: 0;
  color: var(--fg-mute);
}
.chat-conversation:hover .chat-row-delete,
.chat-conversation:focus-within .chat-row-delete {
  opacity: 1;
}
.chat-row-delete:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
}
.chat-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.select.compact {
  width: min(260px, 42vw);
  height: 34px;
  padding-top: 0;
  padding-bottom: 0;
}
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-bubble {
  max-width: min(760px, 86%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  line-height: 1.5;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-contrast);
}
.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--fg);
}
.chat-bubble.thinking {
  color: var(--fg-mute);
  font-style: italic;
}
.chat-bubble details {
  margin-bottom: 8px;
  color: var(--fg-mute);
  font-size: 12px;
}
.chat-audio-reply {
  margin-top: 10px;
  display: grid;
  gap: 4px;
  min-width: 220px;
}
.chat-audio-reply audio {
  width: min(420px, 100%);
  height: 34px;
}
.chat-audio-reply span,
.chat-audio-error {
  font-size: 11.5px;
  color: var(--fg-mute);
}
.chat-audio-error {
  margin-top: 8px;
  color: var(--danger);
}
.chat-composer {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--surface-2);
}
.chat-attachments {
  flex: 1 0 100%;
}
.chat-composer textarea {
  flex: 1;
  min-width: 180px;
  min-height: 38px;
  max-height: 140px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  padding: 9px 11px;
  outline: none;
}
.chat-composer textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.chat-composer .icon-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

/* Floating chat */
.floating-chat {
  position: fixed;
  z-index: 50;
  width: 360px;
  height: 520px;
  display: flex;
  flex-direction: column;
  background: rgba(var(--chat-bg), var(--chat-alpha));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: opacity var(--fast), transform var(--fast);
}
.floating-chat.dragging {
  user-select: none;
  cursor: grabbing;
  transition: none;
}
.floating-chat.minimized {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  opacity: 0.42;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.floating-chat.minimized:hover,
.floating-chat.minimized:focus-within,
.floating-chat.minimized.dragging {
  opacity: 1;
}
.floating-chat.minimized .fc-body,
.floating-chat.minimized .fc-input,
.floating-chat.minimized .fc-title,
.floating-chat.minimized .fc-actions { display: none; }
.floating-chat.minimized .fc-head {
  height: 100%;
  padding: 0;
  border: none;
  justify-content: center;
}
.floating-chat.minimized .fc-toggle {
  width: 100%; height: 100%;
  background: transparent;
  color: var(--fg);
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  box-shadow: none;
}

.floating-chat.minimized .fc-toggle:hover {
  background: transparent;
}

.fc-logo-wrap {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.floating-chat.minimized .fc-logo-wrap {
  width: 46px;
  height: 46px;
}

.fc-logo-wrap.small {
  width: 18px;
  height: 18px;
}

.fc-logo {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
}

.fc-logo-dark {
  display: none;
}

[data-theme="dark"] .fc-logo-light {
  display: none;
}

[data-theme="dark"] .fc-logo-dark {
  display: block;
}

.fc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  flex-shrink: 0;
}
.fc-head:active { cursor: grabbing; }
.fc-title {
  flex: 1;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.fc-title .badge {
  font-size: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fc-actions { display: flex; gap: 2px; }
.fc-actions .icon-btn { width: 26px; height: 26px; }
.fc-actions .icon-btn.active,
.icon-btn.active {
  background: var(--accent);
  color: var(--accent-contrast);
}
.fc-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fc-msg {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  word-wrap: break-word;
}
.fc-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-contrast);
  border-bottom-right-radius: 4px;
}
.fc-msg.bot {
  align-self: flex-start;
  background: var(--surface-3);
  color: var(--fg);
  border-bottom-left-radius: 4px;
}
.fc-msg.thinking {
  color: var(--fg-mute);
  font-style: italic;
}
.fc-msg.bot .ctx {
  display: block;
  font-size: 10.5px;
  color: var(--fg-mute);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.image-attachment-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}
.image-attachment-tray.compact {
  gap: 5px;
}
.image-attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 220px;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 4px 6px 4px 4px;
  color: var(--fg-soft);
  font-size: 11.5px;
}
.image-attachment-pill img {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--surface-2);
}
.image-attachment-tray.compact .image-attachment-pill {
  padding: 3px;
}
.image-attachment-tray.compact .image-attachment-pill img {
  width: 28px;
  height: 28px;
}
.image-attachment-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-attachment-pill button {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--fg-mute);
  flex: 0 0 auto;
}
.image-attachment-pill button:hover {
  background: var(--hover);
  color: var(--danger);
}
.fc-msg .image-attachment-tray {
  margin-bottom: 6px;
}
.fc-input {
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
}
.fc-attachments {
  flex: 1 0 100%;
}
.fc-input .icon-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}
.fc-error {
  flex: 1 0 100%;
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  color: var(--danger);
  padding: 7px 9px;
  font-size: 11.5px;
  line-height: 1.35;
}
.fc-input textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  max-height: 100px;
  min-height: 34px;
  transition: var(--fast);
}
.fc-input textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fc-send {
  background: var(--accent);
  color: var(--accent-contrast);
  width: 34px; height: 34px;
  border-radius: 8px;
  display: grid; place-items: center;
  transition: var(--fast);
}
.fc-send:hover { background: var(--accent-hover); }
.fc-send:disabled { opacity: 0.5; cursor: default; }
.voice-recording {
  color: var(--danger);
  animation: voicePulse 1.1s ease-in-out infinite;
}
@keyframes voicePulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.fc-context-strip {
  padding: 6px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--fg-mute);
  display: flex;
  align-items: center;
  gap: 6px;
}
.fc-context-strip .label { font-weight: 600; color: var(--fg-soft); }

/* Command palette */
.cmdk-scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(6px);
  z-index: 80;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 14vh;
  animation: fade-in var(--fast);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.cmdk {
  width: min(640px, 90vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.cmdk input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 18px 18px 16px 46px;
  font-size: 15px;
  font-family: var(--font-display);
  outline: none;
}
.cmdk .ic {
  position: absolute;
  margin: 18px 0 0 16px;
  color: var(--fg-mute);
}
.cmdk-list {
  max-height: 380px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  padding: 6px;
}
.cmdk-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.cmdk-item.active { background: var(--accent-soft); color: var(--accent); }
.cmdk-item .ic { position: static; margin: 0; }
.cmdk-item .meta { margin-left: auto; font-size: 11px; color: var(--fg-mute); }
.cmdk-group {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--fg-mute);
  letter-spacing: 0.06em;
  padding: 10px 14px 6px;
}

/* Forms */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-row label { font-size: 12px; font-weight: 600; color: var(--fg-soft); }
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 13px;
  outline: none;
  transition: var(--fast);
  color: var(--fg);
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23818799' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }

/* Switch */
.switch {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}
.switch input { display: none; }
.switch .track {
  width: 34px; height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: var(--fast);
  flex-shrink: 0;
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: var(--shadow-sm);
  transition: var(--fast);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }

/* Slider */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--surface);
  box-shadow: var(--shadow-sm);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--surface);
}

/* Cards / panels */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.card-head h4 { margin: 0; font-family: var(--font-display); font-size: 14px; font-weight: 600; }

/* Mail detail body */
.mail-module {
  min-width: 0;
}
.mail-module .pane-head {
  min-width: 0;
}
.mail-module .pane-head h3 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-module .pane-head .toolbar {
  min-width: 0;
  flex-wrap: wrap;
}
.mail-detail {
  min-width: 0;
  overflow: auto;
}
.mail-detail > .pane-head {
  height: auto;
  min-height: 52px;
  flex-wrap: wrap;
  align-content: center;
  padding-top: 6px;
  padding-bottom: 6px;
}
.mail-detail-back {
  display: none;
}
.mail-detail-head {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.mail-detail-subj {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}
.mail-from {
  display: flex; align-items: center; gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}
.mail-from > div {
  min-width: 0;
}
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar.lg {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-contrast);
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mail-detail-body {
  padding: 22px 28px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--fg);
  max-width: 100%;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}
.mail-detail-body iframe,
.mail-detail-body img,
.mail-detail-body video,
.mail-detail-body canvas,
.mail-detail-body object,
.mail-detail-body embed {
  max-width: 100% !important;
}
.mail-detail-body table {
  max-width: 100% !important;
}
.mail-detail-body pre,
.mail-detail-body code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.mail-detail-body p { margin: 0 0 14px; }
.mail-attachments-panel {
  margin: 14px 28px 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  display: grid;
  gap: 8px;
}
.mail-attachments-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--fg);
  font-size: 12px;
  font-weight: 700;
}
.mail-detail-actions {
  padding: 14px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--surface-2);
  min-width: 0;
}

/* Calendar */
.cal-grid {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  grid-auto-rows: 56px;
  border-top: 1px solid var(--border);
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--surface);
}
.cal-grid .head-cell {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
  height: 56px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  font-size: 11px;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.cal-grid .head-cell .num {
  font-size: 18px;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--fg);
  margin-top: 2px;
}
.cal-grid .head-cell.today .num { color: var(--accent); }
.cal-grid .time-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--fg-mute);
  text-align: right;
  padding-right: 6px;
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.cal-grid .grid-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.cal-grid .all-day-cell {
  padding: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
  overflow: hidden;
}
.cal-grid .grid-cell:hover { background: var(--hover); }
.cal-grid .grid-cell.empty-slot,
.cal-month-cell.empty-slot {
  cursor: pointer;
}
.slot-add-hint {
  position: absolute;
  inset: 4px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
  padding: 5px 6px;
  border: 1px dashed color-mix(in oklab, var(--accent) 38%, var(--border));
  border-radius: 6px;
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 7%, transparent);
  font-size: 11px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translateY(2px);
  transition: var(--fast);
}
.cal-grid .grid-cell.empty-slot:hover .slot-add-hint,
.cal-month-cell.empty-slot:hover .slot-add-hint {
  opacity: 1;
  transform: translateY(0);
}
.cal-event {
  position: absolute;
  left: 4px;
  right: 4px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
  border-left: 3px solid currentColor;
  background: color-mix(in oklab, currentColor 16%, var(--surface));
  transition: var(--fast);
  z-index: 1;
}
.cal-event.conflict-accepted {
  color: #ef4444 !important;
  border-left-color: #ef4444;
  background: color-mix(in oklab, #ef4444 14%, var(--surface));
}
.cal-event.has-overlap {
  padding-right: 28px;
}
.cal-event:hover { z-index: 2; box-shadow: var(--shadow-md); }
.cal-event .time { font-size: 10.5px; opacity: 0.8; font-family: var(--font-mono); }
.cal-event.compact-travel {
  display: flex;
  align-items: center;
  padding: 3px 7px;
  border-left-width: 2px;
  border-radius: 999px;
  box-shadow: none;
  overflow: visible;
  z-index: 4;
}
.cal-event.compact-travel:hover {
  box-shadow: var(--shadow-sm);
}
.cal-event.compact-travel .title {
  width: 100%;
  font-size: 11px;
  line-height: 1;
}
.cal-event.compact-travel .title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.overlap-colors {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  display: grid;
  overflow: hidden;
  border-radius: 6px 0 0 6px;
}
.overlap-colors i {
  min-height: 3px;
}
.overlap-badge {
  position: absolute;
  right: 5px;
  top: 5px;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid currentColor;
  color: currentColor;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
.cal-event.conflict-accepted .overlap-badge {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}
.calendar-overlap-list {
  display: grid;
  gap: 7px;
}
.calendar-overlap-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 7px;
  background: var(--surface);
  padding: 8px 10px;
  cursor: pointer;
}
.calendar-overlap-item:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.calendar-overlap-item.active {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent);
}
.calendar-overlap-item.active .calendar-overlap-index {
  background: transparent;
  color: var(--accent);
}
.calendar-overlap-index {
  width: 21px;
  height: 21px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--fg-soft);
  font-size: 11px;
  font-weight: 800;
}
.calendar-overlap-item strong,
.calendar-overlap-item span {
  display: block;
  min-width: 0;
}
.calendar-overlap-item strong {
  color: var(--fg);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-overlap-item div > span {
  margin-top: 2px;
  color: var(--fg-mute);
  font-size: 11.5px;
}
.cal-event .title {
  color: var(--fg);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.cal-event .title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event-type-icon {
  flex: 0 0 auto;
  color: currentColor;
}
.cal-event-static {
  border: 0;
  border-left: 3px solid currentColor;
  border-radius: 6px;
  background: color-mix(in oklab, currentColor 16%, var(--surface));
  color: inherit;
  padding: 4px 6px;
  max-width: 100%;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event-static span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-source-row {
  gap: 8px;
  cursor: default;
}
.calendar-source-name {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--fg-soft);
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 3px 0;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-source-name:hover {
  color: var(--fg);
}
.calendar-source-config {
  opacity: 0;
  width: 24px;
  height: 24px;
}
.calendar-source-row:hover .calendar-source-config,
.calendar-source-config:focus-visible {
  opacity: 1;
}
.calendar-color-input {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px;
  background: var(--surface);
  cursor: pointer;
}
.calendar-source-panel {
  width: 460px;
  height: auto;
  max-height: calc(100vh - 96px);
}
.calendar-source-panel-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.calendar-source-color-field {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 8px;
  width: 100%;
}
.calendar-source-color-field input[type="color"] {
  width: 46px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  background: var(--surface);
}
.calendar-source-meta {
  display: grid;
  gap: 8px;
  padding: 8px 0 2px;
}
.cal-month-grid {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  grid-template-rows: 34px repeat(6, minmax(112px, 1fr));
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.cal-month-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-mute);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.cal-month-cell {
  min-height: 112px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px;
  overflow: hidden;
  background: var(--surface);
  position: relative;
}
.cal-month-cell.muted-month { background: var(--surface-2); opacity: .68; }
.cal-month-cell.today .cal-month-num {
  background: var(--accent);
  color: var(--accent-contrast);
}
.cal-month-num {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 6px;
}
.cal-month-event {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  text-align: left;
  border: 0;
  border-left: 3px solid currentColor;
  border-radius: 6px;
  padding: 4px 6px;
  background: color-mix(in oklab, currentColor 13%, var(--surface));
  color: inherit;
  cursor: pointer;
}
.cal-month-event span {
  color: var(--fg-mute);
  font-size: 10px;
  font-family: var(--font-mono);
}
.cal-month-event strong {
  min-width: 0;
  color: var(--fg);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-agenda {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 22px 40px;
  display: grid;
  align-content: start;
  gap: 14px;
}
.cal-agenda-day {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
}
.cal-agenda-date {
  color: var(--fg-mute);
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
}
.cal-agenda-date strong {
  display: block;
  margin-top: 4px;
  color: var(--fg);
  font-size: 24px;
  font-family: var(--font-display);
  letter-spacing: 0;
}
.cal-agenda-list {
  display: grid;
  gap: 8px;
}
.cal-agenda-event {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 12px;
  cursor: pointer;
}
.cal-agenda-event strong,
.cal-agenda-event span {
  display: block;
}
.cal-agenda-event strong {
  display: flex;
  align-items: center;
  gap: 5px;
}
.cal-agenda-event span {
  color: var(--fg-mute);
  font-size: 12px;
  margin-top: 3px;
}
.cal-agenda-event time {
  color: var(--fg-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}
.calendar-event-panel {
  min-width: 420px;
  min-height: 320px;
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - 58px);
}
.calendar-event-drag-handle {
  cursor: move;
  user-select: none;
}
.calendar-event-detail {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.calendar-event-detail h5 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 13px;
}
.calendar-event-panel .composer-head h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.event-detail-html,
.event-detail-text,
.event-detail-empty {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
  color: var(--fg);
  font-size: 13px;
  line-height: 1.5;
  max-height: 240px;
  overflow: auto;
}
.event-detail-html p,
.event-detail-html div { margin: 0 0 8px; }
.event-detail-html table {
  width: 100%;
  border-collapse: collapse;
}
.event-detail-html td,
.event-detail-html th {
  border: 1px solid var(--border);
  padding: 5px;
}
.event-detail-empty {
  color: var(--fg-mute);
  font-style: italic;
}
.attendee-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.calendar-event-resize {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  border-right: 2px solid color-mix(in oklab, var(--fg-mute) 60%, transparent);
  border-bottom: 2px solid color-mix(in oklab, var(--fg-mute) 60%, transparent);
  border-radius: 2px;
}
.calendar-draft-panel {
  width: min(440px, calc(100vw - 28px));
  right: 22px;
  top: 92px;
  bottom: auto;
  max-height: calc(100vh - 116px);
}
.calendar-draft-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  overflow: auto;
}
.calendar-draft-form .field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.calendar-draft-form .field span {
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.calendar-draft-form input,
.calendar-draft-form select,
.calendar-draft-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  padding: 8px 10px;
  font: inherit;
  min-width: 0;
}
.calendar-draft-form textarea {
  min-height: 84px;
  resize: vertical;
}
.calendar-draft-form .check-field {
  display: flex;
  align-items: center;
  gap: 8px;
}
.calendar-draft-form .check-field input {
  width: auto;
}
.calendar-icon-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.calendar-icon-choice button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--fg-soft);
  cursor: pointer;
}
.calendar-icon-choice button:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--fg);
}
.calendar-icon-choice button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.calendar-draft-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
}
.calendar-draft-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}
body.resizing-panel {
  cursor: nwse-resize;
  user-select: none;
}

/* Notes */
.note-card {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: var(--fast);
  position: relative;
}
.note-card[draggable="true"] { cursor: grab; }
.note-card[draggable="true"]:active { cursor: grabbing; }
.note-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.note-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.note-card .color-tag {
  position: absolute;
  top: 0; left: 14px; right: 14px;
  height: 3px;
  border-radius: 0 0 3px 3px;
}
.note-card .nc-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 6px;
  display: flex; align-items: center; gap: 6px;
}
.note-card .nc-body {
  font-size: 12.5px;
  color: var(--fg-soft);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-card .nc-foot {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 11px;
  color: var(--fg-mute);
}
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 18px;
  align-content: start;
}
.notes-module {
  display: grid;
  height: 100%;
  min-height: 0;
}
.notes-module > .pane {
  min-width: 0;
}
.notes-detail-resizer {
  width: 6px;
  cursor: col-resize;
  background: var(--border);
  position: relative;
}
.notes-detail-resizer::after {
  content: "";
  position: absolute;
  inset: 0 2px;
  background: transparent;
}
.notes-detail-resizer:hover,
.is-resizing-notes-detail .notes-detail-resizer {
  background: var(--accent);
}
.is-resizing-notes-detail {
  cursor: col-resize;
  user-select: none;
}
.notes-detail-pane {
  border-left: 0;
}
.note-attachments {
  display: grid;
  gap: 10px;
}
.note-attachments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.note-attachments-head > div {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.note-attachment-list {
  display: grid;
  gap: 8px;
}
.note-attachment-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 28px 28px;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.note-attachment-row img,
.note-attachment-icon {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background: var(--surface-2);
  object-fit: cover;
  display: grid;
  place-items: center;
  color: var(--fg-mute);
}
.note-attachment-row strong,
.note-attachment-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-attachment-row strong {
  font-size: 12.5px;
}
.note-attachment-row span {
  margin-top: 2px;
  font-size: 11px;
  color: var(--fg-mute);
}
.note-camera-dialog {
  position: fixed;
  z-index: 130;
  left: 50%;
  top: 50%;
  width: min(680px, calc(100vw - 40px));
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.note-camera-dialog .pane-head {
  justify-content: flex-start;
}
.note-camera-dialog .pane-head .icon-btn {
  margin-left: auto;
}
.note-camera-body {
  min-height: 320px;
  background: #020617;
  display: grid;
  place-items: center;
  padding: 12px;
}
.note-camera-body video {
  width: 100%;
  max-height: 62vh;
  border-radius: 8px;
  object-fit: contain;
  background: #020617;
}
.note-camera-body .note-soft {
  max-width: 420px;
  color: var(--fg);
  background: var(--surface);
}
.note-camera-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.note-board-dialog {
  width: min(500px, calc(100vw - 32px));
}
.note-board-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .12);
  flex: 0 0 auto;
}
.note-board-field {
  display: grid;
  gap: 7px;
}
.note-board-field > span {
  color: var(--fg-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.note-board-color-picker {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
}
.note-board-color-picker button {
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08);
}
.note-board-preview-row {
  border: 1px dashed var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  padding: 8px;
}
.note-board-preview-row .tree-item {
  margin: 0;
}
.note-duplicate-dialog {
  position: fixed;
  z-index: 125;
  left: 50%;
  top: 50%;
  width: min(520px, calc(100vw - 40px));
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

/* Meets */
.meets-module {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 320px;
  height: 100%;
}
.meets-sidebar,
.meets-actions {
  background: var(--surface);
}
.meets-left-scroll,
.meets-right-scroll,
.meets-detail-scroll {
  overflow: auto;
}
.meets-stats,
.meets-sync-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.stat-mini {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 9px 10px;
  display: grid;
  gap: 2px;
}
.stat-mini strong {
  font-family: var(--font-mono);
  font-size: 17px;
  color: var(--fg);
}
.stat-mini span {
  color: var(--fg-mute);
  font-size: 11px;
}
.meets-daybar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0;
}
.meets-date-picker {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 10px;
  margin: -2px 0 10px;
}
.meets-date-head,
.meets-date-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.meets-date-head strong {
  font-size: 13px;
  color: var(--fg);
}
.meets-date-weekdays,
.meets-date-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.meets-date-weekdays {
  margin: 10px 0 5px;
}
.meets-date-weekdays span {
  text-align: center;
  font-size: 10px;
  color: var(--fg-mute);
  font-weight: 700;
}
.meets-date-cell,
.meets-date-empty {
  min-width: 0;
  height: 31px;
}
.meets-date-cell {
  position: relative;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--fg);
  font-size: 12px;
  cursor: pointer;
}
.meets-date-cell:hover {
  background: var(--hover);
}
.meets-date-cell.today {
  border-color: color-mix(in oklab, var(--accent) 45%, var(--border));
}
.meets-date-cell.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.meets-date-cell em {
  position: absolute;
  right: 2px;
  bottom: 2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 9px;
  line-height: 14px;
  font-style: normal;
  font-weight: 800;
}
.meets-date-actions {
  justify-content: flex-end;
  margin-top: 10px;
}
.meets-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.meet-row {
  border: 1px solid var(--border);
  border-left: 3px solid var(--ok);
  border-radius: 8px;
  background: var(--surface);
  display: grid;
  grid-template-columns: auto 34px minmax(0, 1fr);
  gap: 9px;
  padding: 10px;
  cursor: pointer;
  transition: var(--fast);
}
.meet-row:hover {
  border-color: color-mix(in oklab, var(--accent) 45%, var(--border));
  border-left-color: var(--ok);
  box-shadow: var(--shadow-sm);
}
.meet-row.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  border-left-color: var(--ok);
}
.meet-row.participating {
  border-left-color: var(--danger);
}
.meet-row.participating:hover {
  border-left-color: var(--danger);
}
.meet-row.selected.participating {
  border-left-color: var(--danger);
}
.meet-row input[type="checkbox"] {
  margin-top: 9px;
}
.meet-row-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--accent);
  display: grid;
  place-items: center;
}
.meet-row-title {
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meet-row-meta {
  margin-top: 3px;
  color: var(--fg-mute);
  font-size: 11.5px;
}
.meet-row-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}
.meet-progress {
  height: 4px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
  margin-top: 7px;
}
.meet-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.meets-hero-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.title-input {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  border-color: transparent;
  padding-left: 0;
}
.title-input:focus {
  padding-left: 10px;
}
.meet-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--fg-mute);
  font-size: 12px;
  margin-top: 6px;
}
.meet-detail-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.meets-edit-grid {
  display: grid;
  grid-template-columns: 140px 110px 110px minmax(180px, 1fr);
  gap: 10px;
}
.field {
  display: grid;
  gap: 5px;
}
.field > span {
  font-size: 10.5px;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
}
.meets-meta-card,
.meets-audio-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.meets-doc-grid,
.meets-text-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.attachment-box {
  display: grid;
  gap: 8px;
}
.section-title {
  font-size: 12px;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
}
.meets-transcript {
  min-height: 260px;
  line-height: 1.55;
}
.meet-summary-box {
  min-height: 132px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
  white-space: pre-wrap;
  line-height: 1.55;
  color: var(--fg-soft);
}
.meets-actions-list {
  display: grid;
  gap: 6px;
}
.meets-actions-list > div {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  padding: 8px 9px;
  display: flex;
  gap: 7px;
  align-items: flex-start;
  font-size: 12.5px;
}
.meets-form {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  display: grid;
  gap: 9px;
}
.two-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.meets-sync-card {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
@media (max-width: 1280px) {
  .meets-module {
    grid-template-columns: 300px minmax(0, 1fr);
  }
  .meets-actions {
    display: none;
  }
  .meets-edit-grid,
  .meets-doc-grid,
  .meets-text-grid {
    grid-template-columns: 1fr;
  }
}

/* Meets V4 current screen: keep the new meeting workspace above legacy rules. */
.module.meets-module {
  grid-template-columns: 320px minmax(0, 1fr) 340px;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.module.meets-module .meets-list {
  padding: 8px;
  margin-top: 0;
  align-content: start;
}
.module.meets-module .meet-row {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-left: 1px solid transparent;
  padding: 9px 8px;
  box-shadow: inset 3px 0 0 var(--ok);
}
.module.meets-module .meet-row:hover {
  background: var(--hover);
  border-color: transparent;
  border-left-color: transparent;
  box-shadow: inset 3px 0 0 var(--ok);
}
.module.meets-module .meet-row.active {
  border-color: color-mix(in oklab, var(--accent), transparent 60%);
  background: var(--accent-soft);
}
.module.meets-module .meet-row.important {
  box-shadow: inset 3px 0 0 var(--danger);
}
.module.meets-module .meet-row-main strong,
.module.meets-module .meet-row-main small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 1280px) {
  .module.meets-module {
    grid-template-columns: 300px minmax(0, 1fr) 320px;
  }
}

/* Tasks kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  padding: 18px;
  height: 100%;
  overflow: auto;
}
.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.kanban-col-head {
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.kanban-col-head h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.kanban-col-head .ct {
  font-size: 11px;
  color: var(--fg-mute);
  font-variant-numeric: tabular-nums;
}
.kanban-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: var(--fast);
}
.task-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.task-card.done { opacity: 0.6; }
.task-card.done .tc-title { text-decoration: line-through; }
.tc-title { font-size: 13px; font-weight: 500; margin: 0 0 5px; }
.tc-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 11px; color: var(--fg-mute); }
.priority-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.priority-dot.p-high { background: var(--danger); }
.priority-dot.p-med { background: var(--warn); }
.priority-dot.p-low { background: var(--info); }

/* Map */
.map-wrap { position: relative; flex: 1; overflow: hidden; background: var(--bg); }
.map-canvas {
  position: absolute;
  inset: 0;
  touch-action: none;
  background:
    radial-gradient(circle at 30% 40%, color-mix(in oklab, var(--accent) 8%, transparent), transparent 50%),
    radial-gradient(circle at 70% 60%, color-mix(in oklab, #14b8a6 8%, transparent), transparent 60%),
    var(--bg-soft);
}
.map-canvas canvas {
  touch-action: none;
}
.map-grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.4;
  pointer-events: none;
}
.map-middle-rotating,
.map-middle-rotating canvas {
  cursor: grabbing !important;
}
.map-route {
  position: absolute;
  top: 30%; left: 20%;
  width: 55%; height: 40%;
  pointer-events: none;
}
.map-toolbar {
  position: absolute;
  top: 14px; left: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  display: flex;
  gap: 2px;
  box-shadow: var(--shadow-md);
  z-index: 5;
}
.map-controls {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-md);
  z-index: 5;
}
.map-attribution {
  position: absolute;
  bottom: 8px; right: 12px;
  font-size: 10px;
  color: var(--fg-mute);
  font-family: var(--font-mono);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  z-index: 4;
}
.map-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  font-size: 22px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  cursor: pointer;
  transition: var(--fast);
}
.map-pin:hover { transform: translate(-50%, -100%) scale(1.15); }

.map-module-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: 100%;
  min-height: 0;
}
.map-sidebar-body {
  overflow: auto;
}
.map-section-title {
  margin: 12px 0 7px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
}
.map-style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.map-style-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.map-style-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.map-toggle-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.map-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  font-size: 12px;
}
.map-toggle-row > span:first-child {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.map-toggle-row em {
  color: var(--fg-mute);
  font-size: 11px;
  font-style: normal;
}
.map-mini-toolbar {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.map-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 10px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.map-tabs button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fg-mute);
  font: inherit;
  font-size: 11px;
  padding: 6px 4px;
  cursor: pointer;
}
.map-tabs button.active {
  background: var(--surface);
  color: var(--fg);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.map-panel-block {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.map-filter-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.map-filter-row select,
.input-like {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--fg);
  padding: 6px 9px;
  font: inherit;
  font-size: 12px;
}
.map-group {
  margin-top: 5px;
}
.map-group-head,
.map-city-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}
.map-group-head {
  padding: 6px 2px;
  border-bottom: 1px solid var(--border);
}
.map-group-head strong {
  flex: 1;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.map-group-head span,
.map-city-head em {
  color: var(--fg-mute);
  font-size: 11px;
  font-style: normal;
}
.map-city {
  padding-left: 8px;
}
.map-city-head {
  padding: 4px 0;
  color: var(--fg-mute);
  font-size: 11px;
}
.map-city-head span {
  flex: 1;
}
.map-waypoint-row {
  margin: 3px 0;
  border-left: 3px solid var(--accent);
  border-radius: 7px;
  background: transparent;
}
.map-waypoint-row.active {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.map-waypoint-main {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--fg);
  text-align: left;
  padding: 5px 7px;
  cursor: pointer;
}
.map-waypoint-main span:nth-child(2) {
  min-width: 0;
  flex: 1;
}
.map-waypoint-main strong,
.map-waypoint-main em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-waypoint-main strong {
  font-size: 12px;
}
.map-waypoint-main em {
  color: var(--fg-mute);
  font-size: 10.5px;
  font-style: normal;
}
.map-waypoint-detail {
  padding: 0 8px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mono-mini {
  color: var(--fg-mute);
  font-size: 10.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tag-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tag-row span {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-mute);
  font-size: 10.5px;
}
.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.row-actions.end {
  justify-content: flex-end;
}
.map-waypoint-editor {
  margin: 0 8px 8px 10px;
}
.swatch-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}
.swatch-row button {
  min-width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  font-size: 10px;
}
.swatch-row button.active {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.route-stop-row,
.category-row,
.offline-zone-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}
.route-stop-row > span {
  width: 18px;
  color: var(--fg-mute);
  font-size: 11px;
}
.route-stop-row strong,
.offline-zone-row strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.category-row input[type="color"] {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
}
.category-row input[type="text"],
.category-row input:not([type]) {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  padding: 5px 7px;
  font: inherit;
  font-size: 12px;
}
.category-row span {
  color: var(--fg-mute);
  font-size: 11px;
}
.offline-zone-row div {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.offline-zone-row span {
  color: var(--fg-mute);
  font-size: 10.5px;
}
.empty-mini {
  padding: 14px 8px;
  color: var(--fg-mute);
  text-align: center;
  font-size: 12px;
}
.map-search-bar {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(580px, calc(100% - 120px));
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  z-index: 7;
}
.map-search-bar input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 13px;
}
.map-search-results {
  position: absolute;
  top: 60px;
  left: 14px;
  width: min(580px, calc(100% - 120px));
  max-height: min(60vh, 460px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  z-index: 8;
}
.map-search-results button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}
.map-search-results strong,
.map-search-results span {
  display: block;
}
.map-search-results span {
  margin-top: 2px;
  color: var(--fg-mute);
  font-size: 11.5px;
}
.map-control-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.map-selected-card,
.map-route-card {
  position: absolute;
  z-index: 7;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.map-selected-card {
  right: 14px;
  top: 14px;
  width: 320px;
  padding: 14px;
}
.map-selected-card p {
  margin: 8px 0 0;
  color: var(--fg-mute);
  font-size: 12px;
  line-height: 1.4;
}
.map-route-card {
  left: 14px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 11px;
  font-size: 12px;
}
.map-route-card span {
  color: var(--fg-mute);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  margin-top: 8px;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-mute);
  font-size: 11px;
}
.chip.mail-recipient-chip {
  margin-top: 0;
  border-radius: 5px;
}

/* Stats grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.stat .lbl { font-size: 11.5px; color: var(--fg-mute); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin-bottom: 6px; }
.stat .val { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.015em; }
.stat .sub { font-size: 11.5px; color: var(--fg-mute); margin-top: 2px; }
.stat.accent .val { color: var(--accent); }

/* Color swatches */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}
.swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  border: 2px solid transparent;
  transition: var(--fast);
}
.swatch:hover { transform: scale(1.06); }
.swatch.active {
  border-color: var(--fg);
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent);
}
.swatch.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  color: white;
  font-weight: bold;
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Composer */
.composer-overlay {
  position: fixed;
  bottom: 18px;
  right: 18px;
  width: 780px;
  max-width: calc(100vw - 32px);
  height: min(780px, calc(100vh - 80px));
  max-height: calc(100vh - 60px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 70;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slide-up var(--med);
}
@keyframes slide-up { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.composer-head {
  background: var(--surface-2);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.composer-head h4 { margin: 0; font-family: var(--font-display); font-size: 13.5px; }
.composer-fields {
  padding: 14px 16px;
  display: flex; flex-direction: column;
  gap: 0;
}
.composer-fields .field {
  display: flex; align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.composer-fields .field label {
  font-size: 12px; color: var(--fg-mute); width: 50px; flex-shrink: 0;
}
.composer-fields .field input {
  flex: 1; border: 0; background: transparent; outline: none;
  font-size: 13px;
}
.composer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;            /* si no cabe, scrollea el cuerpo — el pie (Enviar) nunca se recorta */
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.composer-body textarea {
  width: 100%;
  min-height: 120px;         /* antes 220px: en ventanas bajas empujaba el pie fuera y ocultaba «Enviar» */
  flex: 1 1 auto;
  border: 0; outline: none; resize: none;
  background: transparent;
  font-family: var(--font-sans);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.6;
}
.forward-preview {
  flex: 0 0 auto;
  max-height: 150px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.forward-preview-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--fg);
}
.forward-preview-meta {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--fg-mute);
  border-bottom: 1px solid var(--border);
  line-height: 1.45;
}
.forward-preview iframe {
  width: 100%;
  height: 142px;
  border: 0;
  background: #fff;
  display: block;
}
.forward-preview pre {
  margin: 0;
  max-height: 142px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.45 var(--font-mono);
  color: var(--fg);
}
.composer-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--surface-2);
}
.contact-editor {
  width: 560px;
  height: 520px;
}
.contact-source-color {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px;
  background: var(--surface);
  cursor: pointer;
  margin-left: auto;
}
.composer-foot {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;          /* nunca se cortan los botones si falta ancho */
  flex-shrink: 0;
  background: var(--surface-2);
}
.composer-foot .select-inline {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--fg);
  font-size: 12px;
  padding: 0 8px;
}

/* Settings page */
.settings-wrap {
  padding: 28px 32px;
  max-width: 900px;
  margin: 0 auto;
  overflow-y: auto;
  width: 100%;
}
.settings-section {
  margin-bottom: 32px;
}
.settings-section > h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.005em;
}
.settings-section > .desc {
  font-size: 13px;
  color: var(--fg-mute);
  margin: 0 0 16px;
}

.row-setting {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.row-setting:first-of-type { border-top: 0; }
.row-setting .meta h5 { margin: 0 0 2px; font-size: 13.5px; font-weight: 600; }
.row-setting .meta p { margin: 0; font-size: 12px; color: var(--fg-mute); max-width: 380px; }
.row-setting .control { display: flex; align-items: center; gap: 10px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.tab {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-soft);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--fast);
  margin-bottom: -1px;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Toolbar inside pane heads / lists */
.toolbar {
  display: flex; align-items: center; gap: 4px;
  margin-left: auto;
}

/* Files module */
.files-browser-head {
  gap: 12px;
  min-width: 0;
}
.files-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
  font-size: 13px;
  color: var(--fg-soft);
}
.files-actions {
  gap: 8px;
  flex: 0 0 auto;
}
.files-folder-search {
  width: clamp(260px, 24vw, 380px);
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 9px 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in oklab, var(--surface), var(--surface-2) 45%);
  color: var(--fg-mute);
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
.files-folder-search:focus-within {
  border-color: color-mix(in oklab, var(--accent), var(--border) 30%);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.files-folder-search input {
  min-width: 0;
  flex: 1;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font-size: 12.5px;
}
.files-folder-search input::placeholder { color: var(--fg-mute); }
.files-folder-search button {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--fg-mute);
  flex: 0 0 auto;
}
.files-folder-search button:hover {
  background: var(--hover);
  color: var(--fg);
}
.files-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 34px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.files-view-toggle button {
  width: 28px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--fg-mute);
  transition: var(--fast);
}
.files-view-toggle button:hover {
  color: var(--fg);
  background: var(--hover);
}
.files-view-toggle button.active {
  color: var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.files-grid {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 12px;
}
.files-card {
  min-height: 158px;
  padding: 10px;
  display: grid;
  grid-template-rows: 86px auto auto;
  gap: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast), background var(--fast);
}
.files-card:hover {
  border-color: color-mix(in oklab, var(--accent), var(--border) 55%);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.files-card-preview {
  border-radius: 6px;
  display: grid;
  place-items: center;
}
.files-card-meta {
  min-width: 0;
}
.files-card-meta > div:first-child {
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.files-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.files-card-footer > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.files-card-actions {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
}

/* Status bar */
.status-strip {
  height: 26px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  padding: 0 14px;
  font-size: 11px;
  color: var(--fg-mute);
  display: flex; align-items: center; gap: 14px;
}
.status-strip .sep { width: 1px; height: 12px; background: var(--border); }

/* Toasts */
.toast-wrap {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  animation: slide-up var(--fast);
  pointer-events: auto;
}
.toast.ok { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--danger); }

/* Utility */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.muted { color: var(--fg-mute); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.flex-1 { flex: 1; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pointer { cursor: pointer; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* Drag handle visual */
.drag-handle {
  display: inline-flex;
  align-items: center;
  color: var(--fg-mute);
  cursor: grab;
}
.drag-handle:active { cursor: grabbing; }

/* Pin pulse for fixed chat home */
.fc-pinned-indicator {
  position: absolute;
  top: 4px; right: 4px;
  color: var(--accent);
  font-size: 9px;
}

@media (max-width: 1100px) {
  .three-pane { grid-template-columns: 220px 320px 1fr; }
}
.upper-label {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  margin-bottom: 8px;
}

.corporate-tab {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-soft);
  border-radius: 7px;
  padding: 6px 8px;
  cursor: pointer;
  text-align: left;
}

.corporate-tab span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.corporate-tab b {
  min-width: 22px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 11px;
}

.corporate-tab:hover,
.corporate-tab.active {
  background: var(--active);
  color: var(--accent-strong);
}

.corporate-tab.warn.active {
  background: rgba(245, 158, 11, .14);
  color: #a16207;
}

.company-logo {
  display: grid;
  place-items: center;
  font-weight: 800;
  font-family: var(--font-mono);
  overflow: hidden;
}

.square-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.note-soft {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--fg-soft);
  font-size: 12px;
  line-height: 1.45;
}

.linkish {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.info-block,
.editor-section,
.detail-panel {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 12px;
}

.info-block h4,
.detail-panel h4 {
  margin: 0 0 8px;
  color: var(--fg-mute);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.info-block > div,
.detail-panel > div {
  display: grid;
  gap: 7px;
  font-size: 13px;
  line-height: 1.45;
}

.mini-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.mini-row > span {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-top: 4px;
  flex-shrink: 0;
}

.mini-row div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.client-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px 28px;
  gap: 6px;
  align-items: center;
}

.mini-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-row small {
  color: var(--fg-mute);
  overflow: hidden;
  text-overflow: ellipsis;
}

.sticky-actions {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--active);
}

.sticky-actions strong {
  flex: 1;
  font-size: 12px;
}

.editor-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.editor-title strong {
  flex: 1;
  color: var(--fg-mute);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.mini-editor {
  display: grid;
  gap: 7px;
  padding: 8px 0;
  border-top: 1px dashed var(--border);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.matter-card {
  width: 100%;
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  background: var(--surface);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 7px;
  text-align: left;
  cursor: grab;
}

.matter-card:hover {
  background: var(--hover);
}

.matter-card.active {
  background: var(--active);
  border-left-color: var(--accent);
}

.matter-card.flagged {
  border-color: rgba(245, 158, 11, .45);
  border-left-color: #f59e0b;
}

.matter-title {
  color: var(--fg);
  font-weight: 750;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.matter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
  color: var(--fg-mute);
  font-size: 10.5px;
  font-family: var(--font-mono);
}

.matter-meta span {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.matter-card p {
  margin: 7px 0 0;
  color: var(--fg-soft);
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.star-toggle {
  color: var(--fg-mute);
  cursor: pointer;
}

.star-toggle.on {
  color: #f59e0b;
}

.timeline-row {
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  display: grid;
  gap: 3px;
}

.attachment-row,
.file-row,
.trash-row {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 10px;
}

.attachment-row > div,
.file-row > div,
.file-row > .grow {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

/* La lista de archivos de WhatsApp pone el nombre y los datos en un <span class="grow">:
   que no herede la letra pequeña ni el nowrap de los span de dentro. */
.file-row > span.grow { font-size: inherit; color: inherit; white-space: normal; overflow: visible; }
.file-row > .grow small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-file-dir { display: inline-block; vertical-align: middle; margin-right: 2px; }

.attachment-row strong,
.file-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-row span,
.file-row span,
.trash-row span {
  color: var(--fg-mute);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row {
  margin-bottom: 7px;
  cursor: pointer;
}

.file-row:hover {
  background: var(--hover);
}

.mail-attachment-row {
  width: 100%;
  margin: 0;
  cursor: pointer;
}

.mail-attachment-row:hover {
  background: var(--hover);
}

.mail-attachment-row > .mail-attachment-icon {
  flex: 0 0 36px;
}

.mail-attachment-row > .mail-attachment-meta {
  flex: 1;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: var(--fg-mute);
  font-size: 11px;
  font-family: var(--font-mono);
  overflow: hidden;
}

.breadcrumbs button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--accent-strong);
  cursor: pointer;
  font: inherit;
}

.media-module {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.media-module.has-preview {
  grid-template-columns: 260px minmax(0, 1fr) 360px;
}

.media-sidebar,
.media-browser,
.media-preview {
  min-width: 0;
  min-height: 0;
}

.media-status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 14px;
}

.media-status-card .status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, .12);
  flex: 0 0 auto;
}

.media-status-card .status-dot.ok {
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, .12);
}

.media-status-card strong,
.media-status-card span {
  display: block;
}

.media-status-card strong {
  color: var(--fg);
  font-size: 12px;
}

.media-status-card span {
  max-width: 190px;
  color: var(--fg-mute);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-filter-list {
  display: grid;
  gap: 7px;
}

.media-filter,
.media-folder-row {
  width: 100%;
  display: grid;
  align-items: center;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg);
  border-radius: 8px;
  padding: 8px 9px;
  text-align: left;
  cursor: pointer;
}

.media-folder-row {
  grid-template-columns: auto minmax(0, 1fr);
}

.media-filter:hover,
.media-folder-row:hover {
  background: var(--hover);
}

.media-filter.active,
.media-folder-row.active {
  border-color: color-mix(in srgb, var(--media-color, var(--accent)) 32%, var(--border));
  background: color-mix(in srgb, var(--media-color, var(--accent)) 12%, var(--surface));
  color: var(--accent-strong);
}

.media-filter svg {
  color: var(--media-color, var(--accent));
}

.media-filter span,
.media-folder-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.media-filter b {
  min-width: 22px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--fg-mute);
  padding: 2px 6px;
  text-align: center;
  font-size: 11px;
}

.media-search {
  width: min(360px, 32vw);
}

.media-breadcrumbs {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
  overflow: hidden;
}

.media-breadcrumbs button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-soft);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  cursor: pointer;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-breadcrumbs button:hover {
  background: var(--hover);
}

.media-scroll {
  overflow: auto;
  padding: 14px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  align-items: start;
}

.media-tile {
  min-width: 0;
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 10px;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}

.media-tile:hover,
.media-list-row:hover {
  background: var(--hover);
}

.media-tile.active,
.media-list-row.active {
  border-color: var(--accent);
  background: var(--active);
}

.media-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg-mute);
  overflow: hidden;
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-tile strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.media-tile span {
  color: var(--fg-mute);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-list {
  display: grid;
  gap: 7px;
}

.media-list-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 70px 80px 145px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  border-radius: 8px;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.media-list-row span,
.media-list-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-list-row b {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 750;
}

.media-list-row small {
  color: var(--fg-mute);
  font-size: 11px;
}

.media-preview-inner {
  display: grid;
  gap: 14px;
}

.media-preview-inner img,
.media-preview-inner video {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.media-preview-inner audio {
  width: 100%;
}

.media-preview-inner h2 {
  margin: 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.media-preview-inner p {
  margin: 5px 0 0;
  color: var(--fg-mute);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.media-meta {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
  gap: 8px 10px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.media-meta span {
  color: var(--fg-mute);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.media-meta strong {
  color: var(--fg);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .media-module.has-preview {
    grid-template-columns: 230px minmax(0, 1fr) 320px;
  }
}
.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.context-menu {
  position: fixed;
  z-index: 1001;
  width: 255px;
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  border-radius: 8px;
  padding: 6px;
}

.context-menu button {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--fg);
  border-radius: 6px;
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
}

.context-menu button:hover {
  background: var(--hover);
}

.menu-title {
  padding: 6px 8px 8px;
  color: var(--fg-mute);
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, .28);
  padding: 24px;
}

.modal-card {
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
}

.modal-head h3 {
  margin: 0;
  flex: 1;
}

.modal-body {
  overflow: auto;
  padding: 14px;
}

.toast-like {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  border: 1px solid rgba(239, 68, 68, .3);
  background: var(--surface);
  color: var(--danger);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 10px 12px;
  font-size: 13px;
}

.whatsapp-module {
  display: grid;
  grid-template-columns: minmax(360px, 380px) 1fr minmax(300px, 320px);
  height: 100%;
  min-height: 0;
}

.row {
  display: flex;
  align-items: center;
}

.row.gap {
  gap: 8px;
}

.row.wrap {
  flex-wrap: wrap;
}

.grow {
  min-width: 0;
  flex: 1;
}

.plain {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.seg {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  padding: 5px 9px;
  font-size: 12px;
}

.seg.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.alert.error {
  margin: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.35;
}

.whatsapp-module .pane {
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}

.whatsapp-module .main-pane {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  background: var(--bg);
}

.whatsapp-module .main-pane.linking {
  grid-template-rows: auto 1fr;
}

.whatsapp-module .pane-head {
  gap: 12px;
}

.whatsapp-module .pane-head > div:first-child {
  min-width: 0;
}

.whatsapp-module .pane-head strong,
.whatsapp-module .pane-head small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-module .pane-head .toolbar {
  flex-shrink: 0;
}

.wa-accounts,
.filter-tabs {
  padding: 10px 12px 0;
}

.wa-accounts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.wa-accounts .chip {
  max-width: 100%;
}

.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warning); }

.panel-block {
  display: grid;
  gap: 8px;
  margin: 10px 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.panel-block textarea,
.composer textarea {
  resize: vertical;
}

.wa-account-panel input {
  min-width: 0;
}

.account-name-row {
  align-items: stretch;
}

.account-name-row input {
  flex: 1;
}

.account-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.account-actions .btn {
  justify-content: center;
  min-height: 32px;
}

.wa-create-account {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
}

.qr-box {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--fg-mute);
  font-size: 12px;
}

.qr-box img {
  width: 220px;
  max-width: 100%;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.wa-not-connected {
  display: grid;
  min-height: 360px;
  align-items: center;
  padding: 12px;
}

.wa-linking-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 24px;
}

.wa-link-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(460px, 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  text-align: center;
}

.wa-link-card h3,
.wa-link-card p {
  margin: 0;
}

.wa-link-card p {
  max-width: 340px;
  color: var(--fg-mute);
  line-height: 1.45;
}

.wa-link-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}

.wa-link-qr {
  width: min(300px, 76vw);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.wa-qr-placeholder {
  display: grid;
  place-items: center;
  gap: 8px;
  width: min(300px, 76vw);
  aspect-ratio: 1;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--fg-mute);
}

.wa-link-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.whatsapp-module .search-box {
  margin: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 0 10px;
  color: var(--fg-mute);
}

.whatsapp-module select,
.whatsapp-module input,
.whatsapp-module textarea {
  min-width: 0;
}

.whatsapp-module .search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
}

.wa-file-type-filter {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 10px 12px 6px;
}

.wa-file-type-filter button {
  display: grid;
  place-items: center;
  height: 32px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--fg-mute);
  cursor: pointer;
}

.wa-file-type-filter button:hover {
  color: var(--fg);
  background: var(--surface);
}

.wa-file-type-filter button.active {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
}

.whatsapp-module .list.scroll {
  height: calc(100% - 162px);
  overflow: auto;
}

.chat-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 8px 10px;
  overflow: hidden;
  text-align: left;
  border-left: 3px solid transparent;
  border-radius: 8px;
}

.chat-item.active {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 82%, var(--panel));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

.chat-item.active .grow strong {
  color: var(--accent);
}

.wa-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  overflow: hidden;
  flex: 0 0 38px;
}

.chat-item .avatar {
  width: 38px;
  height: 38px;
}

.chat-item .grow,
.wa-chat-head > div {
  min-width: 0;
}

.chat-item .grow strong,
.chat-item .grow small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-item .grow strong {
  color: var(--fg);
  font-size: 13px;
}

.chat-item .grow small {
  margin-top: 3px;
  color: var(--fg-mute);
  font-size: 12px;
}

.wa-avatar img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--surface);
}

.wa-avatar .avatar-fallback {
  position: relative;
  z-index: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.wa-chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.wa-chat-head .wa-avatar {
  flex: 0 0 38px;
}

.right-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 62px;
}

.right-meta small {
  color: var(--fg-mute);
  font-size: 11px;
  white-space: nowrap;
}

.right-meta b {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
}

.subbar {
  border-bottom: 1px solid var(--border);
}

.subbar .search-box.wide {
  max-width: none;
}

.wa-messages {
  min-height: 0;
  overflow: auto;
  padding: 20px 28px;
  background: var(--bg);
}

.wa-message {
  display: flex;
  margin: 7px 0;
}

.wa-message.mine {
  justify-content: flex-end;
}

.wa-message.theirs {
  justify-content: flex-start;
}

.wa-message .bubble {
  max-width: min(620px, 72%);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}

.wa-message.mine .bubble {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.wa-author {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.wa-message small {
  display: block;
  margin-top: 5px;
  color: var(--fg-mute);
  text-align: right;
  font-size: 11px;
}

.msg-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.quote {
  border-left: 3px solid var(--accent);
  color: var(--fg-mute);
  margin-bottom: 6px;
  padding-left: 8px;
  font-size: 12px;
}

.media-thumb {
  display: grid;
  gap: 6px;
  text-align: left;
  max-width: 280px;
}

.media-thumb img {
  max-width: 260px;
  max-height: 260px;
  border-radius: 8px;
  object-fit: cover;
}

.media-thumb small {
  margin: 0;
  text-align: left;
  color: var(--fg-mute);
}

.wa-attachment-card {
  display: grid;
  gap: 8px;
  max-width: 360px;
  text-align: left;
}

.wa-attachment-card audio {
  width: min(320px, 100%);
}

/* Notas de voz al estilo WhatsApp */
.wa-audio {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(300px, 100%);
  min-width: 220px;
  padding: 4px 2px;
}
.wa-audio-play {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.wa-audio-play:hover { filter: brightness(1.08); }
.wa-audio-body { flex: 1 1 auto; min-width: 0; display: grid; gap: 6px; }
.wa-audio-bar {
  position: relative;
  height: 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--fg-mute) 35%, transparent);
  cursor: pointer;
}
.wa-audio-bar::before { content: ""; position: absolute; inset: -8px 0; }
.wa-audio-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--accent); }
.wa-audio-knob {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.wa-audio-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--fg-mute); font-variant-numeric: tabular-nums; }
.wa-audio-tools { display: inline-flex; align-items: center; gap: 6px; }
.wa-audio-speed {
  border: 1px solid var(--border);
  background: var(--surface, transparent);
  color: var(--fg);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  cursor: pointer;
  line-height: 16px;
}
.wa-audio-viewer { border: none; background: transparent; color: var(--fg-mute); cursor: pointer; padding: 2px; display: inline-flex; }
.wa-audio-viewer:hover { color: var(--fg); }
.wa-audio-mic { flex: 0 0 auto; color: var(--fg-mute); display: inline-flex; }
.wa-audio.playing .wa-audio-mic { color: var(--accent); }

.wa-attachment-card video {
  width: min(320px, 100%);
  max-height: 220px;
  border-radius: 8px;
  object-fit: cover;
  background: #000;
}

.wa-attachment-card span {
  color: var(--accent);
  font-weight: 700;
}

.wa-file-button {
  display: inline-flex;
  max-width: min(360px, 100%);
  justify-content: flex-start;
  gap: 8px;
}

.wa-file-button span {
  margin-left: auto;
  color: var(--fg-mute);
  font-size: 11px;
  font-weight: 600;
}

.composer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 12px;
}

.composer textarea {
  flex: 1;
  min-height: 38px;
  max-height: 120px;
}

.whatsapp-module .wa-composer {
  display: grid;
  gap: 9px;
  padding: 12px 14px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 86%, transparent), var(--surface));
}

.whatsapp-module .wa-composer-shell {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--border) 86%, var(--accent) 14%);
  border-radius: 8px;
  background: var(--panel);
  padding: 6px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.whatsapp-module .wa-composer-shell:focus-within {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent);
}

.whatsapp-module .wa-composer-shell textarea {
  flex: 1;
  width: 100%;
  min-height: 42px;
  max-height: 132px;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 10px 4px;
  resize: none;
  color: var(--fg);
  line-height: 1.4;
  box-shadow: none;
}

.whatsapp-module .wa-composer-shell textarea::placeholder {
  color: var(--fg-mute);
}

.whatsapp-module .wa-composer-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, var(--accent) 8%);
}

.whatsapp-module .wa-composer-icon:disabled {
  opacity: 0.45;
}

.whatsapp-module .wa-send-btn {
  min-height: 40px;
  border-radius: 8px;
  padding-inline: 15px;
  align-self: stretch;
}

.whatsapp-module .wa-reply-card,
.whatsapp-module .wa-upload-area {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.whatsapp-module .wa-reply-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 3px solid var(--accent);
  padding: 8px 9px 8px 10px;
}

.whatsapp-module .wa-reply-card div {
  min-width: 0;
  flex: 1;
}

.whatsapp-module .wa-reply-card small {
  display: block;
  margin-bottom: 2px;
  color: var(--fg-mute);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.whatsapp-module .wa-reply-card span {
  display: block;
  overflow: hidden;
  color: var(--fg);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-module .wa-upload-area {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.whatsapp-module .wa-upload-tray {
  display: flex;
  max-height: 118px;
  flex-wrap: wrap;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.whatsapp-module .wa-upload-pill {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 8px;
  min-width: min(260px, 100%);
  border: 1px solid color-mix(in srgb, var(--border) 88%, var(--accent) 12%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, var(--panel));
  padding: 6px;
}

.whatsapp-module .wa-upload-pill img,
.whatsapp-module .wa-upload-pill > span {
  width: 42px;
  height: 42px;
  border-radius: 6px;
}

.whatsapp-module .wa-upload-pill img {
  object-fit: cover;
  background: var(--surface);
}

.whatsapp-module .wa-upload-pill > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.whatsapp-module .wa-upload-pill strong {
  overflow: hidden;
  color: var(--fg);
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-module .wa-upload-pill .plain {
  width: 24px;
  height: 24px;
  border-radius: 7px;
}

.whatsapp-module .wa-caption-input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 10px;
}

.reply-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 6px 8px;
  color: var(--fg-mute);
  font-size: 12px;
}

.reply-strip span {
  flex: 1;
}

.file-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding: 9px 12px;
}

.file-ico {
  color: var(--accent);
}

.ai-status {
  display: inline-flex;
  width: max-content;
  margin-top: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10px;
}

.ai-status.indexed {
  border-color: color-mix(in srgb, var(--ok) 35%, var(--border));
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
  color: var(--ok);
}

.ai-status.error {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
}

/* Universal Viewer plugin */
#ubot-plugin-preview-root {
  position: fixed;
  inset: 0;
  z-index: 12000;
  pointer-events: none;
}

#ubot-plugin-preview-root .iframe-window {
  pointer-events: auto;
}

.iframe-window {
  position: fixed;
  z-index: 12000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 420px;
  min-height: 280px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
}

.iframe-header {
  height: 38px;
  flex: 0 0 auto;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  cursor: move;
  user-select: none;
  touch-action: none;
  -webkit-user-select: none;
}

.iframe-header .file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-soft);
  font-family: var(--font-mono);
  font-size: 11px;
}

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

.iframe-header .actions button,
.iframe-header .actions a {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--fg-mute);
}

.iframe-header .actions button:hover,
.iframe-header .actions a:hover {
  background: var(--hover);
  color: var(--fg);
  text-decoration: none;
}

.iframe-header .actions svg {
  width: 14px;
  height: 14px;
}

.iframe-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.iframe-resizer {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: var(--fg-mute);
  cursor: nwse-resize;
  touch-action: none;
}

body.ubot-viewer-dragging {
  cursor: grabbing;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

body.ubot-pane-resizing {
  cursor: col-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 1200px) {
  .iframe-window {
    border-radius: 12px;
  }

  .iframe-header {
    min-height: 44px;
    height: 44px;
    padding: 0 12px;
  }

  .iframe-header .actions button,
  .iframe-header .actions a {
    width: 34px;
    height: 34px;
  }

  .iframe-resizer {
    width: 36px;
    height: 36px;
    color: var(--accent);
    background: linear-gradient(135deg, transparent 0 48%, color-mix(in srgb, var(--accent) 10%, transparent) 49% 100%);
  }

  .whatsapp-module {
    grid-template-columns: minmax(280px, 340px) 1fr;
  }

  .whatsapp-module > .pane:last-child {
    display: none;
  }
}

.reporting-section-label {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  margin-bottom: 6px;
}

.tree-item.as-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.reporting-provider-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.reporting-provider-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reporting-provider-logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #005ce0;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.reporting-provider-title {
  font-size: 13px;
  font-weight: 650;
}

.reporting-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-mute);
}

.reporting-status.ok { background: var(--ok); }
.reporting-status.warn { background: var(--warn); }
.reporting-status.error { background: var(--danger); }
.reporting-status.idle { background: var(--border-strong, var(--border)); }

.reporting-provider-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}

.reporting-metric-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reporting-metric-row,
.reporting-metric-card-row {
  width: 100%;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fg-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  padding: 6px 8px;
}

.reporting-metric-row:hover,
.reporting-metric-card-row:hover {
  background: var(--hover);
  color: var(--fg);
}

.reporting-metric-row span,
.reporting-metric-card-row span {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reporting-metric-row strong,
.reporting-metric-card-row strong {
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 650;
}

.empty-inline {
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--fg-mute);
  font-size: 12px;
  padding: 10px;
}

.reporting-banner {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 14px;
  font-size: 13px;
}

.reporting-banner.ok {
  border-color: rgba(34, 197, 94, .28);
  color: var(--ok);
}

.reporting-banner.error {
  border-color: rgba(239, 68, 68, .32);
  color: var(--danger);
}

.reporting-bars {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}

.reporting-bars span {
  width: 42%;
  min-height: 4px;
  border-radius: 4px 4px 2px 2px;
}

.reporting-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.reporting-summary-item {
  min-height: 62px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 4px 8px;
  align-items: center;
  padding: 10px;
}

.reporting-summary-item svg {
  color: var(--fg-mute);
}

.reporting-summary-item span {
  color: var(--fg-mute);
  font-size: 12px;
}

.reporting-summary-item strong {
  grid-column: 2;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 18px;
}

.reporting-modal-card {
  width: min(560px, calc(100vw - 48px));
}

.reporting-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reporting-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--fg-soft);
  font-size: 12px;
  font-weight: 650;
}

.reporting-form input,
.reporting-form select {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--fg);
  padding: 0 10px;
  font: inherit;
  font-weight: 500;
}

.reporting-form .check-row {
  flex-direction: row;
  align-items: center;
}

.reporting-form .check-row input {
  width: 16px;
  height: 16px;
}

.reporting-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
}

.btn.danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, .3);
}

/* === Tablet / iPad responsiveness ===
   Keep the app usable on 11" iPad without horizontal page scroll. */
@media (max-width: 1240px) {
  html,
  body,
  #root,
  .app {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .sidebar {
    width: 60px !important;
  }

  .sidebar-head {
    padding: 0 10px !important;
    justify-content: center !important;
  }

  .brand-text,
  .sidebar-toggle,
  .nav-group-label,
  .nav-label,
  .nav-badge {
    display: none !important;
  }

  .nav-item {
    justify-content: center !important;
    padding: 8px !important;
  }

  .sidebar-foot > .nav-item:not([data-label]) {
    display: none !important;
  }

  .main,
  .content,
  .module {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .pane {
    min-width: 0;
  }

  .module > .pane:not(:last-child),
  .three-pane > .pane:not(:last-child),
  .two-pane > .pane:not(:last-child),
  .chat-module > .pane:not(:last-child),
  .calendar-module > .pane:not(:last-child),
  .files-module > .pane:not(:last-child),
  .whatsapp-module > .pane:not(:last-child),
  .code-module > .pane:not(:last-child),
  .settings-module > .pane:not(:last-child),
  .reporting-module > .pane:not(:last-child),
  .library-module > .pane:not(:last-child),
  .media-module > .pane:not(:last-child),
  .projects-workspace > .pane:not(:last-child),
  .botis-layout > .pane:not(:last-child) {
    position: relative;
  }

  .module > .pane:not(:last-child)::after,
  .three-pane > .pane:not(:last-child)::after,
  .two-pane > .pane:not(:last-child)::after,
  .chat-module > .pane:not(:last-child)::after,
  .calendar-module > .pane:not(:last-child)::after,
  .files-module > .pane:not(:last-child)::after,
  .whatsapp-module > .pane:not(:last-child)::after,
  .code-module > .pane:not(:last-child)::after,
  .settings-module > .pane:not(:last-child)::after,
  .reporting-module > .pane:not(:last-child)::after,
  .library-module > .pane:not(:last-child)::after,
  .media-module > .pane:not(:last-child)::after,
  .projects-workspace > .pane:not(:last-child)::after,
  .botis-layout > .pane:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 56px;
    right: -6px;
    bottom: 56px;
    width: 12px;
    z-index: 5;
    pointer-events: none;
    background: linear-gradient(
      90deg,
      transparent 0 35%,
      color-mix(in srgb, var(--accent) 22%, transparent) 36% 44%,
      transparent 45% 100%
    );
    opacity: 0.42;
  }

  .topbar {
    padding: 0 8px;
    gap: 4px;
  }

  .topbar-metrics {
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    gap: 4px;
  }

  .topbar-metric:not(.system) {
    height: 28px;
    padding: 0 7px;
  }

  .topbar-metric-spacer {
    display: none !important;
  }

  .topbar-actions {
    flex: 0 0 auto;
    gap: 2px;
  }

  .topbar-actions .icon-btn {
    width: 32px;
    height: 32px;
  }

  .status-pill {
    max-width: 92px;
    padding: 4px 7px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .three-pane {
    grid-template-columns: minmax(210px, 240px) minmax(300px, 340px) minmax(0, 1fr) !important;
  }

  .mail-module {
    grid-template-columns: minmax(200px, 220px) minmax(280px, 310px) minmax(0, 1fr) !important;
  }

  .botis-layout {
    grid-template-columns: 260px minmax(0, 1fr) !important;
  }

  .two-pane,
  .chat-module {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr) !important;
  }

  .calendar-module {
    grid-template-columns: 238px minmax(0, 1fr) !important;
  }

  .calendar-module > .pane:last-child > .pane-head {
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    align-content: center;
    gap: 6px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .calendar-module > .pane:last-child > .pane-head h3 {
    flex: 1 1 170px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .calendar-module > .pane:last-child > .pane-head .toolbar {
    min-width: 0;
    margin-left: 0 !important;
  }

  .calendar-module .cal-grid {
    grid-template-columns: 44px repeat(7, minmax(0, 1fr)) !important;
    grid-auto-rows: 54px;
  }

  .calendar-module .cal-event {
    left: 3px;
    right: 3px;
    padding: 5px 6px;
    font-size: 11px;
  }

  .calendar-module .cal-event .time {
    font-size: 10px;
  }

  .calendar-module .time-cell {
    padding-right: 6px;
    font-size: 11px;
  }

  .calendar-event-panel,
  .iframe-window {
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;
  }

  .settings-module,
  .reporting-module,
  .library-module,
  .files-module {
    grid-template-columns: 220px minmax(0, 1fr) !important;
  }

  .files-folder-search {
    width: min(320px, 30vw);
  }

  .files-module [style*="minmax(0, 1fr) 100px 100px 140px 80px"],
  .files-module [style*="minmax(0px, 1fr) 100px 100px 140px 80px"] {
    grid-template-columns: minmax(0, 1fr) 78px !important;
  }

  .files-module [style*="minmax(0, 1fr) 100px 100px 140px 80px"] > :nth-child(2),
  .files-module [style*="minmax(0, 1fr) 100px 100px 140px 80px"] > :nth-child(3),
  .files-module [style*="minmax(0, 1fr) 100px 100px 140px 80px"] > :nth-child(4),
  .files-module [style*="minmax(0px, 1fr) 100px 100px 140px 80px"] > :nth-child(2),
  .files-module [style*="minmax(0px, 1fr) 100px 100px 140px 80px"] > :nth-child(3),
  .files-module [style*="minmax(0px, 1fr) 100px 100px 140px 80px"] > :nth-child(4) {
    display: none !important;
  }

  .whatsapp-module {
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr) !important;
  }

  .whatsapp-module > .pane:first-child {
    width: auto !important;
    min-width: 0 !important;
  }

  .whatsapp-module > .pane:last-child {
    display: none !important;
  }

  .projects-workspace {
    grid-template-columns: 220px minmax(0, 1fr) 320px !important;
  }

  .meets-module {
    grid-template-columns: 280px minmax(0, 1fr) 300px !important;
  }

  .projects-search {
    width: min(300px, 28vw);
  }

  .corporate-module > div[style*="300px 340px"] {
    grid-template-columns: 240px minmax(280px, 340px) minmax(0, 1fr) !important;
  }

  .corporate-module > div[style*="300px 340px"] > :nth-child(4) {
    display: none !important;
  }

  .code-module {
    grid-template-columns: 260px minmax(0, 1fr) minmax(280px, 32vw) !important;
  }

  .code-module [style*="minmax(520px"] {
    min-width: 0 !important;
  }

  .map-module-grid {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .media-module.has-preview {
    grid-template-columns: 230px minmax(0, 1fr) 300px;
  }
}

/* ── iPad / pantallas estrechas (≤900px): Chatbot usable ── */
@media (max-width: 900px) {
  .chat-module { grid-template-columns: 150px minmax(0, 1fr); }
  .chat-sidebar-head,
  .chat-main-head { min-height: 50px; padding: 8px 10px; }
  .chat-conversation-list { padding: 6px; }
  .chat-messages { padding: 12px; gap: 10px; }
  .chat-bubble { max-width: 94%; }
  .chat-composer { padding: 8px 10px; }

  /* Composer de correo: casi pantalla completa (en vez de un panelito a la derecha) */
  .composer-overlay {
    left: 12px; right: 12px; bottom: 12px;
    width: auto;
    height: min(88vh, calc(100vh - 24px));
    max-width: none;
  }
}

/* ── Reorg detalle Meets (2026-06-17) ── */
.meets-notes-big { min-width: 0; display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--fg-soft); }
.meets-notes-big textarea {
  width: 100%; min-height: 300px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--fg); resize: vertical; padding: 10px; font: inherit; line-height: 1.45;
}
.meets-acta { display: grid; gap: 6px; }
.meets-acta-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 700; color: var(--fg-soft); }
.meets-acta textarea {
  width: 100%; min-height: 220px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--fg); resize: vertical; padding: 10px; font: inherit; line-height: 1.5;
}
.meets-side-field { display: grid; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--fg-soft); }
.meets-side-field textarea {
  width: 100%; min-height: 64px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--fg); resize: vertical; padding: 8px; font: inherit; line-height: 1.4; font-weight: 400;
}

/* ---- WhatsApp: visor ampliado con zoom ---- */
.wa-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(8, 12, 18, .93);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 16px;
}
.wa-lightbox-bar {
  position: absolute; top: 12px; right: 12px; left: 12px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(20, 28, 38, .92); border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px; padding: 8px 12px; color: #e6edf3;
}
.wa-lightbox-name { flex: 1; font-size: 13px; opacity: .92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-lightbox-zoom { font-size: 12px; opacity: .65; min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.wa-lightbox-bar .icon-btn { color: #e6edf3; }
.wa-lightbox-stage { display: flex; align-items: center; justify-content: center; overflow: hidden; max-width: 96vw; max-height: 84vh; }
.wa-lightbox-stage img { transform-origin: center center; will-change: transform; border-radius: 6px; }
.wa-lightbox-hint { position: absolute; bottom: 14px; color: #9fb0c3; font-size: 12px; }
.media-thumb-wrap { display: flex; flex-direction: column; gap: 4px; }
.media-thumb { cursor: zoom-in; }

/* ---- WhatsApp: enlaces dentro de los mensajes ---- */
.wa-link { color: #0b7285; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.wa-link:hover { color: #095c6b; }
body.dark .wa-link, .dark .wa-link { color: #38bdf8; }

/* ---- WhatsApp: estados por persona ---- */
.wa-status-person { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.wa-status-person:hover { background: rgba(127,127,127,.10); }
.wa-status-person .wa-status-count { margin-left: auto; font-size: 12px; opacity: .7; }
.wa-status-ring { border: 2px solid #25d366; border-radius: 50%; padding: 2px; }
.wa-file-dir { font-size: 11px; padding: 1px 6px; border-radius: 999px; border: 1px solid currentColor; opacity: .85; }
.wa-file-dir.in { color: #0b7285; }
.wa-file-dir.out { color: #2f9e44; }

/* ---- WhatsApp: ficha de persona (especialista de perfilado) ---- */
.wa-profile-card {
  background: var(--panel, #121a26); color: #e6edf3;
  border: 1px solid rgba(255,255,255,.10); border-radius: 16px;
  padding: 18px 20px; max-width: 620px; width: 92vw; max-height: 82vh; overflow: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.wa-profile-head { display: flex; align-items: center; gap: 10px; }
.wa-profile-head strong { font-size: 17px; }
.wa-profile-head .icon-btn { margin-left: auto; color: #e6edf3; }
.wa-profile-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; opacity: .9; }
.wa-vinculo { font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid currentColor; text-transform: capitalize; }
.wa-vinculo.familia, .wa-vinculo.pareja { color: #f783ac; }
.wa-vinculo\.ex-pareja, .wa-vinculo[class*="ex-pareja"] { color: #ffa8a8; }
.wa-vinculo.amigo { color: #63e6be; }
.wa-vinculo.cliente, .wa-vinculo.proveedor, .wa-vinculo[class*="companero"] { color: #74c0fc; }
.wa-vinculo.desconocido, .wa-vinculo.conocido { color: #adb5bd; }

/* ---- Chat flotante: adjuntos, cola y parar ---- */
.fc-attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 8px 0; }
.fc-att { position: relative; border: 1px solid rgba(127,127,127,.28); border-radius: 8px; overflow: hidden; background: rgba(127,127,127,.08); }
.fc-att img { display: block; width: 54px; height: 54px; object-fit: cover; }
.fc-att-file { display: inline-flex; align-items: center; gap: 5px; padding: 8px 10px; font-size: 11px; }
.fc-att-x {
  position: absolute; top: 1px; right: 1px; width: 17px; height: 17px; line-height: 15px;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; cursor: pointer;
  font-size: 13px; padding: 0; text-align: center;
}
.fc-queue { padding: 4px 10px; font-size: 11px; opacity: .7; }
.fc-attach {
  border: 0; background: transparent; cursor: pointer; padding: 6px;
  color: inherit; opacity: .65; align-self: flex-end;
}
.fc-attach:hover { opacity: 1; }
.fc-send.fc-stop { background: #e03131; }
.fc-send.fc-stop:hover { background: #c92a2a; }

/* ---- Módulo Social (Instagram) ----
   Se calca la estructura de tres paneles de WhatsApp, que ya funciona: la
   pantalla nació sin una sola regla propia y se veía como HTML en crudo. */
.social-module {
  display: grid;
  grid-template-columns: minmax(300px, 340px) 1fr minmax(280px, 320px);
  height: 100%;
  min-height: 0;
}
.social-module .pane {
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.social-module .pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 56px;
}
.social-module .pane-head strong { font-size: 15px; }
.social-module .pane-head small { display: block; opacity: .65; font-size: 12px; }
.social-module .pane-head .icon-btn { margin-left: auto; }

/* Lista de conversaciones */
.social-module .list.scroll { flex: 1; min-height: 0; overflow-y: auto; }
.social-module .list-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; border: 0; background: transparent; cursor: pointer;
  text-align: left; color: inherit; border-bottom: 1px solid var(--border);
}
.social-module .list-item:hover { background: rgba(127,127,127,.09); }
.social-module .list-item.active { background: rgba(37,211,102,.12); }
.social-module .list-item strong { font-size: 14px; }
.social-module .list-item small { font-size: 12px; opacity: .62; display: block; }

/* Burbujas de mensaje */
.social-module .fc-msg {
  padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.4;
  background: var(--surface); border: 1px solid var(--border); word-break: break-word;
}
.social-module .fc-msg.user {
  background: #128c4a; color: #fff; border-color: transparent; border-bottom-right-radius: 4px;
}
.social-module .fc-msg.bot { border-bottom-left-radius: 4px; }
.social-module .fc-msg.user .muted { color: rgba(255,255,255,.75); }

/* Campos de texto del módulo */
.social-module input {
  padding: 9px 11px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--fg);
}
.social-module .fc-error {
  background: rgba(224,49,49,.10); border: 1px solid rgba(224,49,49,.35);
  color: #e03131; padding: 10px 12px; border-radius: 10px; font-size: 13px;
}


/* ── Agente Social (pantalla de Agentes) ───────────────────────────── */
.social-agent .sa-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); padding-bottom: 10px;
}
.social-agent .sa-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: transparent; color: var(--fg-mute);
  border: 1px solid transparent; cursor: pointer; transition: background .15s, color .15s;
}
.social-agent .sa-tab:hover { background: var(--surface); color: var(--fg); }
.social-agent .sa-tab.active {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent);
}
.social-agent .sa-tab .chip { font-size: 10.5px; padding: 1px 6px; }

.social-agent .sa-rule {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; background: var(--surface);
}
.social-agent .sa-rule.off { opacity: .55; }
.social-agent .sa-rule-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px;
}
.social-agent .sa-rule-head .icon-btn { padding: 3px; }
.social-agent .sa-rule-prompt {
  margin-top: 8px; padding: 9px 10px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 12.5px; line-height: 1.5; color: var(--fg);
  white-space: pre-wrap;
}
.social-agent .sa-editor { padding: 14px; border-color: var(--accent); }
.social-agent .sa-editor select.input,
.social-agent .sa-editor input.input { width: 100%; }
.social-agent .sa-master {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 12px 0; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
}
.social-agent .sa-master.on {
  border-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, var(--surface));
}
.lb-person-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
}

/* ── Instagram · historias ─────────────────────────────────────────── */
.ig-story-thumb {
  position: relative; width: 88px; padding: 0; border: 0; background: none;
  cursor: pointer; display: block; text-align: left;
}
.ig-story-thumb img, .ig-story-noimg {
  width: 88px; height: 150px; object-fit: cover; border-radius: 8px;
  display: block; background: var(--surface); border: 1px solid var(--border);
}
.ig-story-thumb small { font-size: 10px; display: block; margin-top: 2px; }
.ig-story-thumb:hover img { outline: 2px solid var(--accent); outline-offset: 1px; }
.ig-story-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.7); pointer-events: none;
  height: 150px;
}

.ig-visor {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.88); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.ig-visor-caja {
  width: min(440px, 96vw); max-height: 94vh;
  display: flex; flex-direction: column; gap: 8px;
}
.ig-visor-barras { display: flex; gap: 3px; }
.ig-visor-barra {
  flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.28);
}
.ig-visor-barra.on { background: #fff; }
.ig-visor-cab {
  display: flex; align-items: center; gap: 8px; color: #fff; font-size: 13px;
}
.ig-visor-cab .muted { color: rgba(255,255,255,.65); }
.ig-visor-cab .chip { background: rgba(255,255,255,.14); color: #fff; border: 0; }
.ig-visor-cab .icon-btn { color: #fff; }
.ig-visor-media {
  position: relative; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  background: #000; border-radius: 12px; overflow: hidden;
}
.ig-visor-media img, .ig-visor-media video {
  max-width: 100%; max-height: calc(94vh - 120px);
  width: auto; height: auto; display: block; border-radius: 12px;
}
.ig-visor-nav {
  position: absolute; top: 0; bottom: 0; width: 33%;
  border: 0; background: none; color: rgba(255,255,255,.75); cursor: pointer;
  display: flex; align-items: center; opacity: 0; transition: opacity .15s;
}
.ig-visor-media:hover .ig-visor-nav { opacity: 1; }
.ig-visor-nav.izq { left: 0; justify-content: flex-start; padding-left: 6px; }
.ig-visor-nav.der { right: 0; justify-content: flex-end; padding-right: 6px; }
.ig-visor-pie {
  color: #fff; font-size: 13px; line-height: 1.5; text-align: center;
  padding: 0 8px; max-height: 20vh; overflow: auto;
}

/* Instagram · reel o publicación compartida dentro de un mensaje */
.ig-share {
  display: flex; gap: 10px; align-items: stretch; text-decoration: none;
  margin-bottom: 6px; padding: 8px; border-radius: 10px;
  background: rgba(127, 127, 127, .10); border: 1px solid var(--border);
  color: inherit; max-width: 300px; transition: background .15s;
}
.ig-share:hover { background: rgba(127, 127, 127, .18); }
.ig-share-thumb {
  width: 68px; height: 96px; object-fit: cover; border-radius: 7px;
  flex: 0 0 auto; background: var(--surface);
}
.ig-share-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; justify-content: center; }
.ig-share-kind {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; text-transform: capitalize; opacity: .85;
}
.ig-share-author {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ig-share-author img { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }
.ig-share-title, .ig-share-sub {
  font-size: 11.5px; line-height: 1.35; opacity: .85;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ig-share-sub { opacity: .65; }

/* Instagram · reel o publicación abierta dentro de Ü-BOT */
.ig-post {
  width: min(460px, 96vw); max-height: 94vh;
  display: flex; flex-direction: column; gap: 8px;
}
.ig-post .ig-visor-media { max-height: 68vh; }
.ig-post .ig-visor-media img, .ig-post .ig-visor-media video {
  max-height: 68vh; max-width: 100%; width: auto; border-radius: 12px;
}
.ig-post-pie { color: #fff; display: flex; flex-direction: column; gap: 6px; }
.ig-post-stats {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12px;
}
.ig-post-stats span { display: inline-flex; align-items: center; gap: 4px; }
.ig-post-stats .muted { color: rgba(255,255,255,.6); }
.ig-post-caption {
  font-size: 12.5px; line-height: 1.5; max-height: 16vh; overflow: auto;
  white-space: pre-wrap; color: rgba(255,255,255,.9);
}
/* la tarjeta del mensaje es un botón: que no parezca uno */
button.ig-share { font: inherit; text-align: left; cursor: pointer; width: 100%; }

/* ── Correo · «BOT responde» (conversación para redactar) ──────────── */
.modal-card.ai-reply {
  width: min(760px, 94vw);
  /* Tres filas: cabecera, cuerpo que hace scroll, y la barra de acciones
     siempre visible abajo. Con el `grid-template-rows: auto 1fr` que trae
     .modal-card, la barra se salía por debajo del recuadro. */
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(88vh, 780px);
}
.ai-reply-body {
  padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
  overflow: auto; min-height: 0;
}
.ai-reply-draft {
  width: 100%; min-height: 220px; resize: vertical;
  border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  background: var(--bg); color: var(--fg); font-size: 13.5px; line-height: 1.6;
  font-family: inherit;
}
.ai-reply-draft:focus { outline: none; border-color: var(--accent); }
.ai-reply-chat {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 150px; overflow: auto;
  border-top: 1px dashed var(--border); padding-top: 8px;
}
.ai-reply-turn {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 12.5px; line-height: 1.45; color: var(--fg-mute);
  background: var(--surface); border-radius: 8px; padding: 6px 9px;
}
.ai-reply-foot {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface);
}
.ai-reply-foot .input { flex: 1; }

/* Code · selector de modelo por proveedor */


/* El selector de proveedor ya son cinco: que quepan sin romperse */



/* Code · desplegables de proveedor y modelo (cinco botones no cabían) */




.modal-card.coder-config { width: min(520px, 94vw); }
.modal-card.coder-config code {
  font-family: var(--font-mono); font-size: 11.5px;
  background: var(--surface-2, var(--surface)); padding: 1px 5px; border-radius: 4px;
}

/* ── Code · cabecera del panel del agente ──────────────────────────
   Va en DOS filas: el panel mide ~350 px y en una sola los controles se
   solapaban hasta quedar ilegibles. */
.code-chat-head {
  height: auto;
  min-height: 52px;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
}
.cch-row {
  display: flex; align-items: center; gap: 6px; min-width: 0;
}
.cch-provider {
  flex: 1 1 auto; min-width: 0;
  font-size: 12px; padding: 5px 8px; font-weight: 600;
}
.cch-model {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--font-mono); font-size: 11px; padding: 4px 8px;
  color: var(--fg-mute);
}
.cch-sudo {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; white-space: nowrap; cursor: pointer;
}
.cch-sudo input { margin: 0; }
.code-chat-head .icon-btn { flex: 0 0 auto; padding: 4px; }
.code-chat-head .code-coder-indicator {
  width: 26px; height: 26px; flex: 0 0 26px;
}
.cch-aviso {
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--warn); line-height: 1.3;
}
.cch-aviso b { font-family: var(--font-mono); font-weight: 600; }

/* UCODE · aviso de que el backend principal está caído */
/* Cabecera de UCODE: el logo es el atajo al código de Ü-BOT. */
.ucode-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  padding: 3px;
  margin-right: 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
}
.ucode-logo:hover { border-color: var(--accent); background: var(--accent-soft); }
.ucode-logo img { width: 100%; height: 100%; object-fit: contain; }

/* Atajos a sitios: proyectos de casa y lo que esté enchufado. */
.ucode-lugares { display: flex; flex-wrap: wrap; gap: 4px; }
.ucode-lugar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted, inherit);
  cursor: pointer;
  white-space: nowrap;
}
.ucode-lugar:hover { border-color: var(--accent); color: var(--accent); }
.ucode-lugar.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* Rutas que suelta el coder en el chat: se pinchan y se abren en el árbol. */
.ucode-ruta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0 3px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.ucode-ruta:hover {
  border-color: var(--accent);
  text-decoration: underline;
}

.ucode-rescate {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: 12px; line-height: 1.4;
  background: color-mix(in srgb, var(--warn) 16%, var(--surface));
  border-bottom: 1px solid var(--warn);
  color: var(--fg);
}
.app-cargando {
  display: grid; place-items: center; height: 100vh;
  color: var(--fg-mute); font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Pantalla de acceso
   Estaba sin una sola regla: el formulario salía en crudo, con la tipografía
   por defecto del navegador. Es lo PRIMERO que se ve al caducar la sesión, así
   que va con la misma paleta y los mismos radios que el resto.
   ═══════════════════════════════════════════════════════════════════════════ */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
  position: relative; overflow: hidden;
}
/* Mancha de color de fondo, decorativa */
.login-shape {
  position: absolute; border-radius: 50%;
  background: var(--accent-soft);
  filter: blur(80px); pointer-events: none;
  width: 420px; height: 420px; top: -120px; right: -100px;
}
.login-shape:nth-of-type(2) { width: 340px; height: 340px; top: auto; right: auto; bottom: -140px; left: -110px; }

.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.14);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-title { font-family: var(--font-display); font-size: 20px; font-weight: 650; color: var(--fg); line-height: 1.2; }
.login-sub { font-size: 12px; color: var(--fg-mute); margin-top: 2px; }
.login-h { margin: 0 0 6px; font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--fg); }
.login-p { margin: 0 0 18px; font-size: 13px; color: var(--fg-soft); line-height: 1.5; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form .form-row { display: flex; flex-direction: column; gap: 6px; }
.login-form label { font-size: 12px; font-weight: 500; color: var(--fg-mute); }
.login-form input {
  width: 100%; padding: 10px 12px;
  background: var(--surface-2); color: var(--fg);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; font-family: inherit;
}
.login-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Selector de canal */
.login-segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;
  padding: 4px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.login-seg {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 6px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--fg-soft);
  font-size: 13px; font-family: inherit; cursor: pointer;
  transition: background .15s, color .15s;
}
.login-seg:hover:not(.is-off) { background: var(--surface-3); color: var(--fg); }
.login-seg.active { background: var(--accent); color: var(--accent-contrast); font-weight: 550; }
/* Canal que el backend dice que no puede entregar: se ve, pero no se pulsa.
   Mejor apagado y con el motivo en el title que ausente sin explicación. */
.login-seg.is-off { opacity: .38; cursor: not-allowed; text-decoration: line-through; }

.login-code {
  text-align: center; letter-spacing: .5em; font-size: 22px;
  font-family: var(--font-mono, ui-monospace, monospace); font-weight: 600;
  padding: 14px 12px !important;
}
.login-err, .login-info {
  padding: 10px 12px; border-radius: var(--radius);
  font-size: 13px; line-height: 1.45;
}
.login-err { background: rgba(220, 38, 38, .12); border: 1px solid rgba(220, 38, 38, .3); color: #dc2626; }
.login-info { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--fg); }
.login-divider { height: 1px; background: var(--border); margin: 4px 0; border: 0; }
.login-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.login-foot button { background: none; border: 0; color: var(--fg-mute); font-size: 12px; font-family: inherit; cursor: pointer; padding: 4px 0; }
.login-foot button:hover { color: var(--accent); text-decoration: underline; }
.login-advanced { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }

@media (max-width: 480px) {
  .login-card { padding: 20px; border-radius: var(--radius); }
  .login-seg { font-size: 12px; padding: 8px 4px; }
}

/* Buscador de personas del Agente Social.
   Con 400 chats un <select> no sirve: hay que poder escribir «serg» y que
   salga. Las que ya tienen regla se marcan, para no crear una duplicada. */
.social-agent .sa-buscador {
  margin: 10px 0 14px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.social-agent .sa-sugerencias {
  margin-top: 8px;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.social-agent .sa-sugerencia {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px;
  background: transparent; border: 0; border-radius: var(--radius-sm);
  color: var(--fg); font: inherit; font-size: 13px; text-align: left;
  cursor: pointer;
}
.social-agent .sa-sugerencia:hover { background: var(--surface-3); }
.social-agent .sa-sugerencia strong { font-weight: 550; }
.social-agent .sa-sugerencia .chip { flex-shrink: 0; }
.social-agent .sa-auto-vinculo {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 10px; padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.social-agent .sa-auto-vinculo input { margin-top: 2px; flex-shrink: 0; }
.social-agent .sa-auto-vinculo:hover { border-color: var(--accent); }

/* Editor de reglas de correo: bloques «Si …» y «Entonces …».
   Con varias condiciones y varias acciones, una rejilla de campos sueltos ya
   no se lee: hace falta ver de un vistazo dónde acaba la condición y empieza
   lo que se hace con el correo. */
.mail-regla-bloque {
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 8px;
}
.mail-regla-cab { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.mail-regla-mini { width: auto; padding: 4px 8px; font-size: 12.5px; }
.mail-regla-fila { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mail-regla-fila .input { flex: 1; min-width: 110px; padding: 6px 8px; font-size: 12.5px; }
.mail-regla-fila .icon-btn { flex-shrink: 0; }
.mail-regla-fila .icon-btn:disabled { opacity: .3; cursor: default; }

/* Conversation children follow the selected Appearance accent in both themes. */
.mail-thread-toggle { display: inline-flex; align-items: center; gap: 2px; align-self: flex-start; margin-top: 7px; padding: 3px 5px; border: 1px solid color-mix(in oklab, var(--accent) 30%, var(--border)); border-radius: 6px; background: color-mix(in oklab, var(--accent) 12%, var(--bg)); color: var(--fg); cursor: pointer; font-size: 11px; }
.mail-thread-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.list-row.mail-row.mail-thread-child { margin-left: 20px; border-left: 2px solid color-mix(in oklab, var(--accent) 28%, var(--bg)); }
.list-row.mail-row.mail-thread-open:not(.selected) { background: color-mix(in oklab, var(--accent) 5%, var(--bg)); opacity: 1; }
.list-row.mail-row.mail-thread-child:not(.selected) { background: color-mix(in oklab, var(--accent) 8%, var(--bg)); opacity: 1; }
.list-row.mail-row.mail-thread-child:hover { background: color-mix(in oklab, var(--accent) 13%, var(--bg)); }
.list-row.mail-row.mail-thread-child.selected { background: color-mix(in oklab, var(--accent) 18%, var(--bg)); }

/* ---------- BOT dentro del chat de WhatsApp (panel derecho) ---------- */
.wa-bot-panel { display: flex; flex-direction: column; gap: 8px; padding: 8px 10px 16px; overflow: auto; flex: 1; min-height: 0; }
.wa-bot-panel .panel-block { margin: 0; }
.wa-bot-panel .panel-block > strong { display: flex; align-items: center; gap: 6px; }
.wa-bot-panel textarea { width: 100%; resize: vertical; font: inherit; }
.wa-bot-panel input { flex: 1; min-width: 0; }
.wa-bot-error { background: rgba(226, 59, 80, 0.12); border: 1px solid rgba(226, 59, 80, 0.4); color: var(--danger); padding: 6px 10px; border-radius: 8px; font-size: 12.5px; }
.wa-bot-objetivo { margin: 4px 0 0; white-space: pre-wrap; font-size: 13px; line-height: 1.4; }
.wa-bot-estado { display: flex; gap: 6px; align-items: flex-start; margin: 8px 0 0; padding: 6px 8px; border-radius: 8px; background: var(--accent-soft); font-size: 12.5px; line-height: 1.4; }
.wa-bot-panel .muted.small, .wa-bot-panel p.small { font-size: 12px; margin: 6px 0 0; }
.wa-bot-modos { display: flex; gap: 6px; margin: 8px 0; }
.wa-bot-modos.compact { margin: 8px 0 0; }
.wa-bot-modo { flex: 1; display: flex; gap: 8px; align-items: flex-start; text-align: left; padding: 8px; border-radius: 10px; border: 1px solid var(--border, rgba(127,127,127,0.3)); background: transparent; color: inherit; cursor: pointer; }
.wa-bot-modo span { display: flex; flex-direction: column; gap: 2px; }
.wa-bot-modo small { opacity: 0.7; font-size: 11px; line-height: 1.3; }
.wa-bot-modo.active { border-color: var(--accent); background: var(--accent-soft); }
.wa-bot-modos .seg.active.autonomo { background: rgba(34, 197, 94, 0.18); color: #16a34a; border-color: rgba(34,197,94,0.5); }
.wa-bot-modos .seg.active.supervisor { background: rgba(245, 158, 11, 0.16); color: var(--warn); border-color: rgba(245,158,11,0.5); }
.wa-bot-modos .seg.active.off { background: rgba(127,127,127,0.18); }
.wa-bot-propuesta { border: 1px solid rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.08); }
.wa-bot-charla { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 8px; max-height: 260px; overflow: auto; }
.wa-bot-burbuja { padding: 6px 9px; border-radius: 10px; font-size: 12.5px; line-height: 1.4; white-space: pre-wrap; max-width: 95%; }
.wa-bot-burbuja.ron { align-self: flex-end; background: var(--accent-soft); }
.wa-bot-burbuja.bot { align-self: flex-start; background: rgba(127,127,127,0.14); }
.wa-bot-lista { list-style: none; margin: 6px 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.wa-bot-lista li { line-height: 1.4; }
.wa-bot-lista.tareas li { display: flex; gap: 6px; align-items: flex-start; }
.wa-bot-lista.tareas li .icon-btn { flex-shrink: 0; }
.wa-bot-lista.tareas li.hecha span, .wa-bot-lista.tareas li.descartada span { opacity: 0.55; text-decoration: line-through; }
.wa-bot-lista.tareas li small { display: block; opacity: 0.8; text-decoration: none; }
.wa-bot-lista.registro li { display: flex; flex-direction: column; gap: 1px; padding: 4px 0; border-bottom: 1px solid rgba(127,127,127,0.15); }
.wa-bot-lista.registro li span { white-space: pre-wrap; }
.wa-bot-toggle { display: flex; align-items: center; gap: 6px; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; font: inherit; }
.wa-bot-btn { display: inline-flex; align-items: center; gap: 5px; }
.wa-bot-btn.autonomo { border-color: rgba(34,197,94,0.6); color: #16a34a; }
.wa-bot-btn.supervisor { border-color: rgba(245,158,11,0.6); color: var(--warn); }
.wa-bot-btn.active { background: var(--accent-soft); border-color: var(--accent); color: inherit; }
.wa-bot-mark { display: inline-flex; vertical-align: -2px; margin-right: 4px; color: #16a34a; }
.wa-bot-mark.supervisor { color: var(--warn); }
.wa-bot-mark-text { color: var(--warn); }

/* WhatsApp · supervisión de BOT por chat (no supervisar = no saca tareas/agenda) */
.wa-unsupervised-mark { display: inline-flex; vertical-align: -2px; margin-right: 4px; color: var(--fg-mute); }
.wa-supervision-btn.off { color: var(--warn); }
.wa-supervision-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 10px 0; padding: 10px 12px; border: 1px solid var(--border, rgba(0,0,0,0.1)); border-radius: 10px; background: var(--accent-soft); }
.wa-supervision-card.off { background: transparent; border-style: dashed; }
.wa-supervision-card strong { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.wa-supervision-card small { display: block; margin-top: 2px; color: var(--fg-mute); font-size: 11.5px; line-height: 1.3; }
.wa-supervision-card .btn { flex-shrink: 0; }
