@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ===== Tokens (alineados a la familia CUBOT - ver SuperAdmin de travels) ===== */
:root {
  --radius: 0.875rem;
  --background: oklch(0.985 0.003 280);
  --foreground: oklch(0.2 0.04 280);
  --card: oklch(1 0 0);
  --primary: oklch(0.55 0.22 285);
  --primary-foreground: oklch(0.99 0.005 280);
  --primary-soft: oklch(0.96 0.025 285);
  --accent: oklch(0.96 0.025 285);
  --muted: oklch(0.97 0.008 280);
  --muted-foreground: oklch(0.5 0.025 280);
  --accent-foreground: oklch(0.4 0.18 285);
  --gold: oklch(0.78 0.14 70);
  --gold-foreground: oklch(0.22 0.04 70);
  --destructive: oklch(0.6 0.22 22);
  --success: oklch(0.62 0.16 155);
  --border: oklch(0.93 0.008 280);
  --sidebar: oklch(1 0 0);
  --sidebar-border: oklch(0.94 0.008 280);
  --shadow-soft: 0 1px 2px oklch(0.4 0.15 280 / 0.04), 0 1px 3px oklch(0.4 0.15 280 / 0.05);
  --shadow-card: 0 4px 24px -8px oklch(0.4 0.15 280 / 0.10);
  --gradient-violet: linear-gradient(135deg, oklch(0.6 0.22 285), oklch(0.45 0.24 290));
}

html, body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}

a, .btn-link { color: var(--primary); }
h1, h2, h3 { letter-spacing: -0.01em; }

/* ===== Layout shell ===== */
.cubot-shell { display: flex; min-height: 100vh; }
.cubot-sidebar {
  width: 268px; flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.cubot-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cubot-topbar {
  height: 60px; display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 0 24px; border-bottom: 1px solid var(--border);
  background: oklch(1 0 0 / 0.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.cubot-content { padding: 26px 30px; width: 100%; }

/* Piezas del menu movil: ocultas en escritorio. */
.cubot-nav-toggle { display: none; }
.cubot-nav-overlay { display: none; }
.cubot-hamburger { display: none; }
.cubot-topbar-brand { display: none; }

/* ===== Sidebar header / brand ===== */
.cubot-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid var(--sidebar-border); }
.cubot-logo { position: relative; width: 38px; height: 38px; border-radius: 12px; background: var(--gradient-violet); display: grid; place-items: center; box-shadow: var(--shadow-soft); color: #fff; }
.cubot-logo svg { width: 18px; height: 18px; }
.cubot-logo::after { content: ""; position: absolute; bottom: -2px; right: -2px; width: 11px; height: 11px; border-radius: 50%; background: var(--gold); border: 2px solid var(--sidebar); }
.cubot-brand-name { font-weight: 800; font-size: 15px; letter-spacing: -0.02em; line-height: 1; }
.cubot-brand-name span { color: var(--primary); }
.cubot-brand-sub { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted-foreground); font-weight: 600; margin-top: 3px; }

.cubot-agency { margin: 12px 14px 4px; border-radius: 10px; background: var(--primary-soft); border: 1px solid oklch(0.55 0.22 285 / 0.15); padding: 10px 12px; }
.cubot-agency .lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: oklch(0.55 0.22 285 / 0.85); }
.cubot-agency .name { font-size: 14px; font-weight: 600; }
.cubot-agency .meta { font-size: 11px; color: var(--muted-foreground); }

/* ===== Sidebar nav ===== */
.cubot-nav { flex: 1; overflow-y: auto; padding: 8px 10px; }
.cubot-nav-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: oklch(0.5 0.025 280 / 0.8); padding: 14px 8px 6px; }
.cubot-nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: oklch(0.35 0.04 280); text-decoration: none; font-size: 13.5px; font-weight: 500; line-height: 1.2; transition: background .12s, color .12s; }
.cubot-nav-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.cubot-nav-link:hover { background: var(--muted); color: var(--foreground); }
.cubot-nav-link.active { background: var(--primary-soft); color: var(--accent-foreground); font-weight: 600; }
.cubot-nav-link.active svg { opacity: 1; color: var(--primary); }
.cubot-nav-badge { margin-left: auto; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 7px; background: oklch(0.55 0.22 285 / 0.12); color: var(--primary); }

/* ===== Sidebar footer (user) ===== */
.cubot-user { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--sidebar-border); }
.cubot-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, oklch(0.82 0.13 70), oklch(0.74 0.15 70)); color: var(--gold-foreground); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.cubot-user .nm { font-size: 12.5px; font-weight: 600; }
.cubot-user .rl { font-size: 11px; color: var(--muted-foreground); }
.cubot-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-left: auto; }

.cubot-user-chip { font-size: 13px; color: var(--muted-foreground); }
.cubot-user-chip strong { color: var(--foreground); font-weight: 600; }

/* ===== Page / module header ===== */
.page-title { font-size: 1.7rem; font-weight: 800; margin: 4px 0 2px; }
.page-title span { color: var(--primary); }
.page-sub { font-size: 0.9rem; color: var(--muted-foreground); margin-bottom: 22px; }
.module-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.module-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.module-icon svg { width: 19px; height: 19px; }
.module-eyebrow { display: flex; align-items: center; gap: 10px; }
.module-eyebrow span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.18em; color: var(--primary); }

/* ===== Placeholder "Proximamente" ===== */
.coming-soon { max-width: 1040px; border: 1px dashed var(--border); border-radius: 1.25rem; background: var(--card); padding: 56px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.coming-soon-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin-bottom: 16px; }
.coming-soon-icon svg { width: 26px; height: 26px; }
.coming-soon h3 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.coming-soon p { font-size: 0.9rem; color: var(--muted-foreground); margin: 6px 0 0; max-width: 420px; }
.coming-soon-phase { display: inline-block; margin-top: 16px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; background: oklch(0.55 0.22 285 / 0.12); color: var(--primary); }

/* ===== Buttons (override bootstrap minimo) ===== */
.btn { border-radius: 0.6rem; font-weight: 600; font-size: 0.875rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover, .btn-primary:focus { background: oklch(0.5 0.22 285); border-color: oklch(0.5 0.22 285); color: #fff; }
.btn-outline-secondary { color: var(--foreground); border-color: var(--border); background: var(--card); }
.btn-outline-secondary:hover { background: var(--muted); color: var(--foreground); }

/* ===== Login (dev) ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(1200px 600px at 50% -10%, oklch(0.93 0.05 285), transparent), var(--background); }
.login-card { width: 420px; max-width: 92vw; background: var(--card); padding: 34px; border-radius: 1.25rem; box-shadow: var(--shadow-card); border: 1px solid var(--border); }
.login-logo { width: 48px; height: 48px; border-radius: 14px; background: var(--gradient-violet); display: grid; place-items: center; color: #fff; margin-bottom: 16px; }
.login-logo svg { width: 22px; height: 22px; }
.login-title { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.login-title span { color: var(--primary); }
.login-sub { font-size: .9rem; color: var(--muted-foreground); margin: 4px 0 22px; }
.login-roles { display: flex; flex-direction: column; gap: 10px; }
.login-role { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.login-role:hover { border-color: var(--primary); box-shadow: 0 0 0 3px oklch(0.55 0.22 285 / 0.12); }
.login-role .ic { width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.login-role .ic svg { width: 18px; height: 18px; }
.login-role .t { font-weight: 700; font-size: .95rem; }
.login-role .d { font-size: .8rem; color: var(--muted-foreground); }
.login-note { margin-top: 18px; font-size: .75rem; color: var(--muted-foreground); line-height: 1.5; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: oklch(0.2 0.04 280 / 0.45); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-dialog { pointer-events: auto; background: var(--card); border-radius: 1.1rem; box-shadow: 0 16px 40px -12px oklch(0.42 0.22 285 / 0.28); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; margin: 0; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.modal-close { display: grid; place-items: center; width: 34px; height: 34px; margin: -6px -6px -6px 0; border-radius: 0.6rem; background: none; border: none; font-size: 1.4rem; color: var(--muted-foreground); cursor: pointer; line-height: 1; }
.modal-close:hover { background: var(--muted); color: var(--foreground); }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px; border-top: 1px solid var(--border); }
.field { margin-bottom: 14px; }

/* error boundary */
.blazor-error-boundary { background: var(--destructive); padding: 1rem; color: white; border-radius: 8px; }
.blazor-error-boundary::after { content: "Ha ocurrido un error."; }

#blazor-error-ui { color-scheme: light only; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); box-sizing: border-box; display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* ===== Responsive: sidebar off-canvas por debajo de 992px ===== */
@media (max-width: 991.98px) {
  .cubot-sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-card); }
  .cubot-nav-toggle:checked ~ .cubot-sidebar { transform: translateX(0); }
  .cubot-nav-toggle:checked ~ .cubot-nav-overlay { display: block; position: fixed; inset: 0; background: oklch(0.2 0.04 280 / 0.45); z-index: 30; }
  .cubot-hamburger { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border); background: var(--card); color: var(--foreground); cursor: pointer; margin-right: auto; }
  .cubot-hamburger svg { width: 20px; height: 20px; }
  .cubot-topbar-brand { display: inline-block; font-weight: 800; font-size: 15px; margin-right: auto; }
  .cubot-topbar-brand span { color: var(--primary); }
}

/* ===== Modulo Agentes IA (portado desde CUBOT.travels) ===== */

/* KPIs (resumen de consumo de IA) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; max-width: 1000px; }
.kpi-card { background: var(--card); border: 1px solid var(--border); border-radius: 1.25rem; padding: 18px 20px; box-shadow: var(--shadow-soft); }
.kpi-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-foreground); font-weight: 700; margin-top: 14px; }
.kpi-value { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-hint { font-size: 11px; color: var(--muted-foreground); }

/* Tarjeta de aviso (cv-warn) */
.cv-warn { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; font-size: 13px; color: var(--muted-foreground); }
.cv-warn a { color: var(--primary); font-weight: 600; }

/* Filas y rejillas de campos */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

/* Titulo de seccion (reutilizado del pipeline) */
.pl-stagegroup-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800; color: var(--primary); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }

/* Lista de agentes */
.ag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; max-width: 1040px; }
.ag-card { border: 1px solid var(--border); border-radius: 14px; background: var(--card); padding: 16px 18px; box-shadow: var(--shadow-soft); display: flex; flex-direction: column; gap: 6px; }
.ag-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ag-card-del { width: 24px; height: 24px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--muted-foreground); font-size: 16px; line-height: 1; display: inline-grid; place-items: center; cursor: pointer; padding: 0; transition: all 0.15s; }
.ag-card-del:hover { border-color: var(--destructive); color: var(--destructive); background: oklch(0.97 0.03 25); }
.ag-card-del:disabled { opacity: 0.4; cursor: not-allowed; }
.ag-provider { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); }
.ag-provider.p-claude, .p-claude { background: oklch(0.95 0.05 40); color: oklch(0.5 0.16 40); }
.ag-provider.p-gemini, .p-gemini { background: oklch(0.95 0.05 255); color: oklch(0.5 0.16 255); }
.ag-provider.p-gpt, .p-gpt { background: oklch(0.95 0.05 160); color: oklch(0.45 0.13 160); }
.ag-provider.p-deepseek, .p-deepseek { background: oklch(0.95 0.05 320); color: oklch(0.5 0.16 320); }
.ag-name { font-weight: 700; font-size: 15px; margin-top: 4px; }
.ag-role { font-size: 12px; color: var(--muted-foreground); }
.ag-prompt { font-size: 12px; color: var(--muted-foreground); margin: 6px 0; line-height: 1.45; min-height: 34px; }
.ag-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); }
.ag-actions { display: flex; gap: 6px; }

/* Toggle on/off */
.ag-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.ag-switch input { opacity: 0; width: 0; height: 0; }
.ag-slider { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: .2s; cursor: pointer; }
.ag-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.ag-switch input:checked + .ag-slider { background: oklch(0.6 0.16 150); }
.ag-switch input:checked + .ag-slider::before { transform: translateX(18px); }

/* Cupo mensual de tokens */
.ag-quota-bar { height: 6px; border-radius: 999px; background: var(--muted); overflow: hidden; margin: 6px 0 4px; }
.ag-quota-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }
.ag-quota-fill.over { background: var(--destructive); }

/* Editor en dos columnas */
.ag-editor-cols { display: flex; gap: 18px; align-items: flex-start; }
.ag-editor-left { flex: 1; min-width: 0; }
.ag-editor-right { width: 380px; flex: none; border-left: 1px solid var(--border); padding-left: 18px; align-self: stretch; }
@media (max-width: 980px) { .ag-editor-cols { flex-direction: column; } .ag-editor-right { width: 100%; border-left: none; border-top: 1px solid var(--border); padding-left: 0; padding-top: 14px; } }

/* Editor de texto enriquecido (formato WhatsApp + emojis) */
.ag-rich-toolbar, .rt-toolbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 5px; border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0; background: var(--muted); position: relative; }
.rt-btn { min-width: 28px; height: 26px; padding: 0 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); cursor: pointer; font-size: 12px; line-height: 1; display: inline-grid; place-items: center; }
.rt-btn:hover { border-color: var(--primary); }
.rt-btn.on { background: var(--primary); color: #fff; }
.rt-toolbar + textarea { border-top-left-radius: 0; border-top-right-radius: 0; }
.rt-emojis, .ag-emoji-grid { position: absolute; top: 34px; left: 5px; z-index: 5; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 6px; box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.rt-emoji { width: 28px; height: 28px; border: none; background: none; cursor: pointer; font-size: 16px; border-radius: 6px; }
.rt-emoji:hover { background: var(--muted); }

/* Listas de prompts/recursos/cache */
.ag-list { display: flex; flex-direction: column; gap: 8px; }
.ag-list-scroll { max-height: 440px; overflow-y: auto; padding-right: 6px; }
.ag-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--card); }
.ag-item-main { flex: 1; min-width: 0; }
.ag-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-item-sub { font-size: 11.5px; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-rtype { flex: none; width: 38px; height: 26px; border-radius: 6px; background: var(--accent); color: var(--primary); font-size: 9.5px; font-weight: 800; display: grid; place-items: center; letter-spacing: 0.04em; }
.ag-pill-sticky { display: inline-block; margin-left: 8px; padding: 1px 8px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; border-radius: 999px; background: oklch(0.94 0.04 80); color: oklch(0.45 0.12 60); border: 1px solid oklch(0.85 0.07 80); vertical-align: middle; }
.ag-file { display: flex; flex-direction: column; gap: 4px; font-size: 11px; }

/* Acordeon para colapsar secciones del editor */
.ag-accordion { border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.ag-accordion-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; background: transparent; border: 0; cursor: pointer; text-align: left; }
.ag-accordion-head:hover { background: var(--muted); }
.ag-accordion-chev { display: inline-block; transition: transform 0.15s ease; color: var(--muted-foreground); font-size: 12px; width: 14px; }
.ag-accordion-chev.open { transform: rotate(90deg); }
.ag-accordion-count { display: inline-grid; place-items: center; min-width: 28px; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--accent); color: var(--primary); font-size: 11px; font-weight: 700; }
.ag-accordion-spacer { flex: 1; }
.ag-accordion-body { padding: 4px 12px 14px; border-top: 1px solid var(--border); }

/* Chat de prueba */
.ag-test { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ag-test-body { max-height: 380px; min-height: 160px; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--muted); }
.ag-test-empty { color: var(--muted-foreground); font-size: 12.5px; text-align: center; margin: auto; font-style: italic; }
.ag-test-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--card); }
.ag-test-input input { flex: 1; }
.ag-bubble { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.ag-bubble.me { align-self: flex-end; background: var(--gradient-violet, #7c4dff); color: #fff; border-bottom-right-radius: 4px; }
.ag-bubble.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ag-bubble.ag-typing, .ag-typing { color: var(--muted-foreground); font-style: italic; }
.ag-attach { margin-top: 6px; }
.ag-attach img, .ag-attach video { max-width: 200px; max-height: 200px; border-radius: 8px; display: block; }
.ag-attach audio { max-width: 220px; }
.ag-attach a { font-size: 12px; font-weight: 600; color: var(--primary); text-decoration: none; }
.ag-bubble.bot .ag-attach a { color: var(--primary); }
.ag-attach-text { background: rgba(0,0,0,0.04); border-left: 3px solid var(--primary); border-radius: 4px; padding: 6px 8px; font-size: 12.5px; white-space: pre-wrap; }
.ag-attach-cap { font-size: 12px; margin-top: 3px; }

/* Enviar prueba a telefono */
.ag-phone { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; background: var(--card); }
.ag-phone-toggle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ag-phone-row { display: flex; gap: 6px; margin-top: 8px; }
.ag-phone-row .form-control { font-size: 12px; }

/* Log cronologico de prompts enviados a la IA */
.ag-prompt-entry { border: 1px solid var(--border); border-radius: 10px; background: var(--card); padding: 10px 12px; }
.ag-prompt-entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 11.5px; }
.ag-prompt-entry-time { color: var(--muted-foreground); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; }
.ag-prompt-entry-title { color: var(--primary); font-weight: 700; font-size: 11.5px; }
.ag-prompt-entry-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground); margin: 4px 0 4px; }
.ag-prompt-entry textarea { resize: vertical; }

/* ===== Mi cuenta (Cuenta.razor) - portado desde CUBOT.travels ===== */

/* Tonos para .kpi-icon: pintan el badge segun la familia visual de la marca. */
.kpi-icon.tone-primary { background: var(--primary-soft); color: var(--primary); }
.kpi-icon.tone-gold { background: oklch(0.78 0.14 70 / 0.16); color: var(--gold-foreground); }
.kpi-icon.tone-success { background: oklch(0.62 0.16 155 / 0.15); color: var(--success); }
.kpi-icon.tone-danger { background: oklch(0.6 0.22 22 / 0.10); color: var(--destructive); }

/* Etiqueta de campo "discreta" arriba de un dato fuerte (Datos de la empresa, Plan activo, ...). */
.wlbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-foreground); font-weight: 700; }

/* Grid de dos tarjetas (Plan activo / Limites). */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; max-width: 1040px; }

/* Logo de la agencia (cuadrado redondeado). */
.acct-logo { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; border: 1px solid var(--border); background: var(--card); flex-shrink: 0; }
.acct-logo-empty { display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; color: var(--primary); background: var(--primary-soft); }

/* Bloque API de integracion colapsable. */
.acct-api > summary { list-style: none; cursor: pointer; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.acct-api > summary::-webkit-details-marker { display: none; }
.acct-api > summary::before { content: "\25B8"; color: var(--muted-foreground); margin-right: 8px; transition: transform .15s ease; }
.acct-api[open] > summary::before { transform: rotate(90deg); }
.acct-api > summary:hover { background: var(--muted); border-radius: 1.25rem; }
/* ===== Auth (login + registro autogestion, diseno de dos paneles) ===== */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: #fff; }
@media (max-width: 900px) { .auth-shell { grid-template-columns: 1fr; } .auth-aside { display: none !important; } }

/* Panel izquierdo morado */
.auth-aside { position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(-45deg, #4f46e5, #6366f1, #7c3aed, #4338ca); background-size: 300% 300%; animation: authGradient 14s ease infinite; }
@keyframes authGradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.auth-aside-deco { position: absolute; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.16), transparent 65%); pointer-events: none; }
.auth-deco-tr { top: -60px; right: -60px; }
.auth-deco-bl { bottom: -60px; left: -60px; }
.auth-brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-brand-logo { width: 46px; height: 46px; border-radius: 13px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); display: grid; place-items: center; backdrop-filter: blur(6px); }
.auth-brand-logo svg { width: 22px; height: 22px; transform: rotate(-45deg); }
.auth-brand-logo-img { height: 46px; max-width: 180px; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,.92); padding: 6px 10px; }
.auth-brand-name { font-size: 1.45rem; font-weight: 800; letter-spacing: -0.02em; }
.auth-aside-body { position: relative; z-index: 1; max-width: 420px; }
.auth-aside-body h2 { font-size: 2.1rem; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 14px; }
.auth-aside-body p { font-size: 1rem; line-height: 1.6; color: rgba(255,255,255,.9); margin: 0 0 22px; }
.auth-dots { display: flex; gap: 8px; }
.auth-dots span { width: 8px; height: 8px; border-radius: 99px; background: rgba(255,255,255,.45); }
.auth-dots span:first-child { width: 22px; background: #fff; }

/* Panel derecho formularios */
.auth-main { display: flex; flex-direction: column; padding: 40px clamp(24px, 6vw, 80px); }
.auth-form-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 440px; width: 100%; margin: 0 auto; }
.auth-pane-signup { display: none; }
.auth-shell.is-signup .auth-pane-login { display: none; }
.auth-shell.is-signup .auth-pane-signup { display: block; }
.auth-head { margin-bottom: 26px; }
.auth-head h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; color: var(--foreground); margin: 0 0 6px; }
.auth-head p { font-size: .92rem; color: var(--muted-foreground); margin: 0; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); }
.auth-field input { width: 100%; padding: 13px 15px; border-radius: 12px; border: 1px solid var(--border); background: var(--background); font-size: .95rem; transition: border-color .15s, box-shadow .15s; }
.auth-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px oklch(0.62 0.2 285 / .15); background: #fff; }
.auth-input-icon { position: relative; }
.auth-input-icon input { padding-right: 78px; }
.auth-eye { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: .68rem; font-weight: 700; letter-spacing: .04em; color: var(--muted-foreground); cursor: pointer; }
.auth-eye:hover { color: var(--primary); }
.auth-submit { margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px; border: none; border-radius: 12px; background: var(--gradient-violet, #4f46e5); color: #fff; font-size: .98rem; font-weight: 700; cursor: pointer; box-shadow: 0 10px 24px -10px rgba(79,70,229,.6); transition: transform .12s, box-shadow .15s; }
.auth-submit:hover { box-shadow: 0 14px 30px -10px rgba(79,70,229,.7); }
.auth-submit:active { transform: scale(.99); }
.auth-submit svg { width: 16px; height: 16px; }
.auth-switch { margin-top: 24px; text-align: center; font-size: .9rem; color: var(--muted-foreground); }
.auth-switch button { background: none; border: none; color: var(--primary); font-weight: 700; cursor: pointer; margin-left: 4px; }
.auth-switch button:hover { text-decoration: underline; }
.auth-alert { padding: 11px 14px; border-radius: 10px; font-size: .88rem; margin-bottom: 18px; }
.auth-alert-error { background: oklch(0.95 0.04 25); color: oklch(0.5 0.2 25); border: 1px solid oklch(0.85 0.08 25); }
.auth-alert-ok { background: oklch(0.95 0.05 150); color: oklch(0.45 0.13 150); border: 1px solid oklch(0.85 0.09 150); }
.auth-label-row { display: flex; justify-content: space-between; align-items: center; }
.auth-forgot { font-size: .72rem; font-weight: 700; color: var(--primary); text-decoration: none; }
.auth-forgot:hover { text-decoration: underline; }
.auth-legal { font-size: .76rem; line-height: 1.5; color: var(--muted-foreground); margin: 2px 0 0; }
.auth-footer { text-align: center; font-size: .76rem; color: var(--muted-foreground); padding-top: 24px; border-top: 1px solid var(--border); margin-top: 24px; }
.auth-providers { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 18px; }
.auth-provider { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--background); font-size: .9rem; font-weight: 600; color: var(--foreground); cursor: pointer; }
.auth-provider[disabled] { opacity: .65; cursor: not-allowed; }
.auth-provider small { font-size: .68rem; color: var(--muted-foreground); font-weight: 600; }
.auth-hint { margin: -8px 0 14px; font-size: .8rem; color: #dc2626; }
.auth-input-error { border-color: #dc2626 !important; box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
.auth-divider { position: relative; text-align: center; margin: 18px 0; }
.auth-divider::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.auth-divider span { position: relative; background: #fff; padding: 0 12px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted-foreground); }


/* === Modulo Tableros (Kanban) === */
/* Vista lista de tableros (board picker). */
.tb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; max-width: 1280px; }
.tb-card { border: 1px solid var(--border); border-radius: 14px; background: var(--card); padding: 18px 20px; cursor: pointer; transition: all 0.15s; }
.tb-card:hover { border-color: var(--primary); box-shadow: var(--shadow-soft); transform: translateY(-1px); }
.tb-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tb-card-color { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.tb-card-name { font-weight: 700; font-size: 15.5px; }
.tb-card-desc { font-size: 12.5px; color: var(--muted-foreground); margin-bottom: 12px; min-height: 32px; }
.tb-card-foot { display: flex; gap: 8px; font-size: 11px; color: var(--muted-foreground); }
.tb-card-stat { background: var(--accent); padding: 3px 10px; border-radius: 999px; }

/* Toolbar superior del tablero (search + sort + view + filtros). */
.tb-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 8px 10px; margin-bottom: 18px; box-shadow: var(--shadow-soft); flex-wrap: wrap; }
.tb-toolbar-search { position: relative; flex: 1; min-width: 240px; max-width: 420px; }
.tb-toolbar-search input { width: 100%; padding: 8px 12px 8px 36px; background: var(--muted); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.tb-toolbar-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tb-toolbar-search .tb-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); width: 16px; height: 16px; }
.tb-toolbar-right { display: flex; align-items: center; gap: 12px; }
.tb-sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted-foreground); }
.tb-sort select { background: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 12.5px; }
.tb-view { display: flex; background: var(--muted); padding: 3px; border-radius: 8px; border: 1px solid var(--border); }
.tb-view button { background: transparent; border: 0; padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted-foreground); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.tb-view button.active { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-soft); }
.tb-view svg { width: 14px; height: 14px; }

/* Tablero Kanban (vista detalle). */
.tb-board { display: flex; gap: 18px; overflow-x: auto; padding-bottom: 14px; min-height: 480px; }
.tb-col { width: 320px; min-width: 320px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; max-height: calc(100vh - 320px); }
.tb-col-drag { background: oklch(0.97 0.04 290); border: 2px dashed var(--primary); }
.tb-col-head { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); background: oklch(0.985 0 0); border-radius: 14px 14px 0 0; }
.tb-col-name { font-weight: 600; font-size: 14px; color: var(--foreground); }
.tb-col-count { background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.tb-col-body { padding: 12px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background: oklch(0.99 0 0); }
.tb-col-empty { text-align: center; padding: 24px 12px; font-size: 12.5px; color: var(--muted-foreground); font-style: italic; }
.tb-col-foot { padding: 12px; border-top: 1px solid var(--border); background: var(--card); border-radius: 0 0 14px 14px; }
/* Boton compacto en el footer de cada columna: solo abre el modal de nueva tarea. */
.tb-col-add { width: 100%; padding: 6px 10px; border: 1px dashed var(--border); background: transparent; color: var(--muted-foreground); border-radius: 8px; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center; gap: 6px; line-height: 1; }
.tb-col-add:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.tb-col-add-plus { font-size: 14px; font-weight: 700; line-height: 1; }
.tb-col-add svg { width: 12px; height: 12px; flex: none; }

/* Asegura que cualquier SVG inline en botones/listas del modulo Tableros no se infle. */
.tb-toolbar svg { width: 14px; height: 14px; flex: none; }
.tb-card-meta-item svg { width: 12px; height: 12px; flex: none; }
.tb-due svg { width: 12px; height: 12px; flex: none; }
.tb-modal-side-btn svg { width: 14px; height: 14px; flex: none; }
.tb-modal-add-btn svg { width: 14px; height: 14px; flex: none; }
.tb-modal-close svg { width: 18px; height: 18px; flex: none; }
.tb-pop svg { width: 14px; height: 14px; flex: none; }
.tb-check-item input[type="checkbox"] { flex: none; }
.tb-check-item-del svg { width: 14px; height: 14px; flex: none; }
.tb-modal-head-icon { width: 26px !important; height: 26px !important; }
.tb-modal-section-icon { width: 22px !important; height: 22px !important; }
/* Avatar SVG fallback (cuando no hay miembros). */
.tb-avatar.empty svg { width: 12px; height: 12px; flex: none; }

/* Tarjetas dentro de las columnas del Kanban. */
.tb-card-item { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer; transition: all 0.15s; box-shadow: 0 1px 2px oklch(0 0 0 / 0.04); }
.tb-card-item:hover { border-color: var(--primary); box-shadow: var(--shadow-soft); }
.tb-card-item.dragging { opacity: 0.5; }
.tb-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.tb-tag { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: oklch(0.94 0 0); color: oklch(0.4 0.02 240); }
.tb-card-title { font-size: 13.5px; font-weight: 500; margin-bottom: 10px; line-height: 1.35; color: var(--foreground); }
.tb-card-meta { display: flex; gap: 12px; color: var(--muted-foreground); font-size: 11px; margin-bottom: 10px; align-items: center; }
.tb-card-meta-item { display: flex; align-items: center; gap: 3px; }
.tb-card-meta-item svg { width: 12px; height: 12px; }
.tb-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tb-members { display: flex; }
.tb-avatar { width: 24px; height: 24px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 9.5px; font-weight: 700; display: grid; place-items: center; margin-left: -6px; border: 2px solid var(--card); }
.tb-avatar:first-child { margin-left: 0; }
.tb-avatar.empty { background: transparent; border: 2px dashed var(--border); color: var(--muted-foreground); }
.tb-avatar.lg { width: 32px; height: 32px; font-size: 11.5px; }
.tb-due { font-size: 11px; color: var(--muted-foreground); display: flex; align-items: center; gap: 3px; }
.tb-due svg { width: 12px; height: 12px; }
.tb-due.late { color: var(--destructive); background: oklch(0.96 0.03 25); padding: 2px 7px; border-radius: 4px; }
.tb-card-new { background: var(--card); border: 1px solid var(--primary); border-radius: 10px; padding: 12px; }
.tb-card-new textarea { width: 100%; border: 0; outline: 0; font-size: 13.5px; resize: none; min-height: 60px; background: transparent; }
.tb-card-new-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }

/* Vista Lista (sustituye al Kanban cuando se elige). */
.tb-list { background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.tb-list table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tb-list thead th { text-align: left; padding: 12px 16px; background: oklch(0.985 0 0); border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground); }
.tb-list tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tb-list tbody tr:hover { background: var(--muted); cursor: pointer; }
.tb-list tbody tr:last-child td { border-bottom: 0; }
.tb-list-empty { padding: 32px; text-align: center; color: var(--muted-foreground); font-style: italic; }
.tb-status { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.tb-status.todo { background: var(--muted); color: var(--muted-foreground); }
.tb-status.progress { background: oklch(0.94 0.05 240); color: oklch(0.4 0.18 240); }
.tb-status.review { background: oklch(0.94 0.06 65); color: oklch(0.45 0.18 65); }
.tb-status.done { background: oklch(0.94 0.07 145); color: oklch(0.4 0.17 145); }

/* Modal detalle de tarjeta (2 columnas: contenido + sidebar). */
.tb-modal { width: 100%; max-width: 880px; background: oklch(0.98 0 0); border-radius: 14px; position: relative; }
.tb-modal-head { padding: 22px 28px 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.tb-modal-head-icon { width: 26px; height: 26px; color: var(--muted-foreground); flex: none; margin-top: 2px; }
.tb-modal-head-content { flex: 1; }
.tb-modal-title { font-size: 1.4rem; font-weight: 700; line-height: 1.2; margin: 0 0 4px; color: var(--foreground); }
.tb-modal-subtitle { font-size: 13px; color: var(--muted-foreground); margin: 0; }
.tb-modal-subtitle strong { color: var(--foreground); text-decoration: underline; cursor: pointer; }
.tb-modal-close { width: 32px; height: 32px; border: 0; background: transparent; border-radius: 999px; color: var(--muted-foreground); cursor: pointer; display: grid; place-items: center; transition: background 0.15s; flex: none; }
.tb-modal-close:hover { background: var(--muted); }
.tb-modal-body { display: flex; gap: 32px; padding: 8px 28px 28px; }
.tb-modal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.tb-modal-side { width: 200px; flex: none; display: flex; flex-direction: column; gap: 22px; }
.tb-modal-side h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-foreground); margin: 0 0 8px; }
.tb-modal-side-btn { width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: oklch(0.93 0 0); color: var(--foreground); border: 0; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background 0.15s; }
.tb-modal-side-btn:hover { background: oklch(0.88 0 0); }
.tb-modal-side-btn svg { width: 14px; height: 14px; flex: none; }
.tb-modal-side-btn.danger { color: var(--foreground); }
.tb-modal-side-btn.danger:hover { background: oklch(0.95 0.04 25); color: var(--destructive); }
.tb-modal-side-btn.danger svg { color: var(--destructive); }
.tb-modal-side-divider { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* Secciones dentro del modal (members/tags/desc/checklist/activity). */
.tb-modal-section { display: flex; gap: 16px; align-items: flex-start; }
.tb-modal-section-icon { width: 22px; height: 22px; color: var(--muted-foreground); flex: none; margin-top: 4px; }
.tb-modal-section-body { flex: 1; min-width: 0; }
.tb-modal-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tb-modal-section-title { font-size: 1rem; font-weight: 600; color: var(--foreground); margin: 0; }
.tb-modal-section-action { padding: 5px 12px; background: oklch(0.93 0 0); color: var(--foreground); border: 0; border-radius: 4px; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background 0.15s; }
.tb-modal-section-action:hover { background: oklch(0.88 0 0); }
.tb-modal-inline-row { display: flex; flex-wrap: wrap; gap: 24px; padding-left: 38px; }
.tb-modal-mini-h4 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground); margin: 0 0 8px; }
.tb-modal-add-btn { width: 32px; height: 32px; border-radius: 999px; background: oklch(0.93 0 0); border: 0; display: grid; place-items: center; cursor: pointer; color: var(--muted-foreground); transition: background 0.15s; }
.tb-modal-add-btn:hover { background: oklch(0.88 0 0); }
.tb-modal-add-btn.sq { border-radius: 4px; width: 32px; height: 28px; }
.tb-modal-tag { font-size: 13px; font-weight: 500; padding: 4px 12px; border-radius: 4px; background: oklch(0.91 0 0); color: var(--foreground); cursor: pointer; }
.tb-modal-tag:hover { opacity: 0.85; }

/* Descripcion. */
.tb-desc-empty { padding: 12px 14px; background: oklch(0.93 0 0); border-radius: 6px; color: var(--muted-foreground); font-size: 13px; cursor: pointer; transition: background 0.15s; }
.tb-desc-empty:hover { background: oklch(0.88 0 0); }
.tb-desc-text { font-size: 13.5px; color: var(--foreground); white-space: pre-wrap; line-height: 1.55; cursor: pointer; }
.tb-desc-edit { display: flex; flex-direction: column; gap: 8px; }
.tb-desc-edit textarea { width: 100%; min-height: 100px; padding: 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13.5px; font-family: inherit; resize: vertical; }
.tb-desc-edit-actions { display: flex; gap: 8px; }

/* Checklist. */
.tb-check-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tb-check-progress-label { font-size: 11.5px; color: var(--muted-foreground); width: 36px; }
.tb-check-bar { flex: 1; height: 8px; background: oklch(0.92 0 0); border-radius: 999px; overflow: hidden; }
.tb-check-bar-fill { height: 100%; background: var(--primary); transition: width 0.3s; }
.tb-check-list { display: flex; flex-direction: column; gap: 4px; }
.tb-check-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 4px; transition: background 0.15s; }
.tb-check-item:hover { background: oklch(0.93 0 0); }
.tb-check-item input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; flex: none; }
.tb-check-item-text { flex: 1; font-size: 13.5px; color: var(--foreground); }
.tb-check-item-text.done { color: var(--muted-foreground); text-decoration: line-through; }
.tb-check-item-del { background: transparent; border: 0; color: var(--muted-foreground); cursor: pointer; padding: 4px; border-radius: 4px; opacity: 0; transition: opacity 0.15s; }
.tb-check-item:hover .tb-check-item-del { opacity: 1; }
.tb-check-item-del:hover { color: var(--destructive); background: oklch(0.95 0.04 25); }
.tb-check-add { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.tb-check-add input { flex: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

/* Actividad (comentarios + log). */
.tb-act-input { display: flex; gap: 10px; margin-bottom: 18px; }
.tb-act-input-box { flex: 1; background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; transition: box-shadow 0.15s; }
.tb-act-input-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tb-act-input-box textarea { width: 100%; min-height: 60px; padding: 10px 12px; border: 0; outline: 0; font-size: 13px; font-family: inherit; resize: none; }
.tb-act-input-foot { background: oklch(0.985 0 0); padding: 6px 10px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); }
.tb-act-list { display: flex; flex-direction: column; gap: 14px; }
.tb-act-item { display: flex; gap: 12px; }
.tb-act-item-avatar { width: 32px; height: 32px; border-radius: 999px; background: oklch(0.93 0 0); color: var(--muted-foreground); font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; }
.tb-act-item-bubble { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; flex: 1; box-shadow: 0 1px 2px oklch(0 0 0 / 0.04); max-width: 100%; }
.tb-act-item-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.tb-act-item-name { font-weight: 600; font-size: 13px; color: var(--foreground); }
.tb-act-item-time { font-size: 11px; color: var(--muted-foreground); }
.tb-act-item-text { font-size: 13px; color: var(--foreground); margin: 0; }
.tb-act-item-action { font-size: 13px; color: var(--muted-foreground); margin-top: 6px; }
.tb-act-item-action strong { color: var(--foreground); font-weight: 600; }

/* Popover de seleccion (miembros/etiquetas/datas). Posicionado DENTRO del modal a la izquierda del sidebar. */
.tb-pop { position: absolute; z-index: 60; background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 12px 32px oklch(0 0 0 / 0.18); padding: 14px 14px 12px; width: 280px; right: 232px; }
.tb-pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tb-pop-title { font-size: 13px; font-weight: 600; color: var(--foreground); }
.tb-pop-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.tb-pop-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; transition: background 0.15s; font-size: 13px; }
.tb-pop-item:hover { background: var(--muted); }
.tb-pop-item.selected { background: var(--primary-soft); color: var(--primary); }
.tb-pop-add { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.tb-pop-add input { flex: 1; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 12.5px; }

/* Paleta de colores para titulo de tarjeta. */
.tb-color-swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.tb-color-swatch { width: 100%; aspect-ratio: 1; border: 2px solid transparent; border-radius: 6px; cursor: pointer; padding: 0; transition: transform 0.1s, border-color 0.15s; }
.tb-color-swatch:hover { transform: scale(1.08); }
.tb-color-swatch.selected { border-color: var(--foreground); }
.tb-color-swatch.clear { background: var(--card); border: 1px dashed var(--border); color: var(--muted-foreground); font-size: 12px; font-weight: 700; display: grid; place-items: center; }

/* Configurar tablero (panel lateral). */
.tb-config { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 980px; }
.tb-config-section { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.tb-config-section h3 { font-size: 14px; font-weight: 700; margin: 0 0 12px; }
.tb-config-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.tb-config-row:last-child { border-bottom: 0; }
.tb-config-row .tb-color-dot { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.tb-config-row input[type="text"] { flex: 1; padding: 4px 8px; border: 1px solid transparent; border-radius: 4px; font-size: 13px; background: transparent; }
.tb-config-row input[type="text"]:focus { border-color: var(--primary); outline: 0; background: var(--muted); }

/* Entradas del log de prompts enviados a la IA (chat de prueba del agente). */
.ag-prompt-entry { border: 1px solid var(--border); border-radius: 10px; background: var(--card); padding: 10px 12px; }
.ag-prompt-entry-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 11.5px; }
.ag-prompt-entry-time { color: var(--muted-foreground); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; }
.ag-prompt-entry-title { color: var(--primary); font-weight: 700; font-size: 11.5px; }
.ag-prompt-entry-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground); margin: 4px 0 4px; }
.ag-prompt-entry textarea { resize: vertical; }

/* Scroll dentro de listas largas (recursos, cache fields). ~10 items visibles. */
.ag-list-scroll { max-height: 440px; overflow-y: auto; padding-right: 6px; }

/* Acordeon para colapsar secciones del editor de agente. */
.ag-accordion { border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.ag-accordion-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; background: transparent; border: 0; cursor: pointer; text-align: left; }
.ag-accordion-head:hover { background: var(--muted); }
.ag-accordion-chev { display: inline-block; transition: transform 0.15s ease; color: var(--muted-foreground); font-size: 12px; width: 14px; }
.ag-accordion-chev.open { transform: rotate(90deg); }
.ag-accordion-count { display: inline-grid; place-items: center; min-width: 28px; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--accent); color: var(--primary); font-size: 11px; font-weight: 700; }
.ag-accordion-spacer { flex: 1; }
.ag-accordion-body { padding: 4px 12px 14px; border-top: 1px solid var(--border); }

/* Chat de prueba del agente */
.ag-test { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ag-test-body { max-height: 380px; min-height: 160px; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--muted); }
.ag-test-empty { color: var(--muted-foreground); font-size: 12.5px; text-align: center; margin: auto; font-style: italic; }
.ag-bubble { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.ag-bubble.me { align-self: flex-end; background: var(--gradient-violet, #7c4dff); color: #fff; border-bottom-right-radius: 4px; }
.ag-bubble.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ag-bubble.ag-typing { color: var(--muted-foreground); font-style: italic; }
.ag-attach { margin-top: 6px; }
.ag-attach img, .ag-attach video { max-width: 200px; max-height: 200px; border-radius: 8px; display: block; }
.ag-attach audio { max-width: 220px; }
.ag-attach a { font-size: 12px; font-weight: 600; color: var(--primary); text-decoration: none; }
.ag-bubble.bot .ag-attach a { color: var(--primary); }
.ag-attach-text { background: rgba(0,0,0,0.04); border-left: 3px solid var(--primary); border-radius: 4px; padding: 6px 8px; font-size: 12.5px; white-space: pre-wrap; }
.ag-attach-cap { font-size: 12px; margin-top: 3px; }

/* Enviar prueba a telefono */
.ag-phone { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; background: var(--card); }
.ag-phone-toggle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ag-phone-row { display: flex; gap: 6px; margin-top: 8px; }
.ag-phone-row .form-control { font-size: 12px; }
.ag-test-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--card); }
.ag-test-input input { flex: 1; }

/* Separador visual entre campos del lead (tipo de campo Separador) */
.pl-quote-tplsel { max-width: 200px; font-size: 12.5px; padding: 4px 8px; }
.pl-field-separator { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; color: var(--primary); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.pl-field-separator::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.pl-chat-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 9px; }
/* Contenedor fijo (no hace scroll) para el chat: ancla el overlay de drag&drop a la vista visible */
.pl-chat-bodywrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* Overlay para arrastrar y soltar documentos sobre la conversacion (visible aunque el chat este lleno) */
.pl-chat-dropmask { display: none; position: absolute; inset: 8px; z-index: 5; border: 2px dashed var(--primary); border-radius: 12px; background: color-mix(in srgb, var(--primary) 12%, #fff); color: var(--primary); font-weight: 700; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.pl-chat-bodywrap.pl-chat-dragover .pl-chat-dropmask { display: flex; }
.pl-date-divider { text-align: center; font-size: 10px; color: var(--muted-foreground); letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; margin: 4px 0 2px; display: flex; align-items: center; gap: 10px; }
.pl-date-divider::before, .pl-date-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.pl-bubble { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; word-wrap: break-word; }
.pl-bubble .t { font-size: 9.5px; opacity: 0.7; margin-top: 3px; }
.pl-bubble.out { align-self: flex-end; background: var(--gradient-violet); color: #fff; border-bottom-right-radius: 4px; }
.pl-bubble.in { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.pl-chat-empty { color: var(--muted-foreground); font-size: 12px; text-align: center; margin: auto; font-style: italic; padding: 20px; }

/* Mensajes pregrabados con categorias */
.pl-chat-quick { padding: 10px 14px 6px; border-top: 1px solid var(--border); background: var(--card); }
.pl-qr-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.pl-qr-head > span { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: var(--muted-foreground); }
.pl-qr-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.pl-qr-tab { font-size: 10.5px; padding: 3px 9px; border-radius: 999px; color: var(--muted-foreground); font-weight: 700; border: none; background: none; cursor: pointer; letter-spacing: 0.02em; }
.pl-qr-tab:hover { color: var(--foreground); }
.pl-qr-tab.active { background: var(--primary); color: #fff; }
.pl-qr-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 116px; overflow-y: auto; }
.pl-quick-chip { font-size: 11.5px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--muted); color: var(--foreground); cursor: pointer; text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-quick-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--accent); }
.pl-chat-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--card); align-items: center; }
.pl-chat-input input { flex: 1; border: 1px solid var(--border); border-radius: 999px; padding: 9px 14px; font-size: 13px; min-width: 0; }
.pl-quote-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--card); }
.pl-quote-actions .btn { font-size: 12.5px; padding: 7px 12px; }
.pl-quote-confirm { font-size: 12.5px; font-weight: 600; color: var(--foreground); }
.pl-quote-msg { font-size: 12px; color: var(--muted-foreground); }
.pl-chat-send { width: 38px; height: 38px; border-radius: 50%; background: var(--gradient-violet); color: #fff; border: none; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.pl-chat-send:disabled { opacity: 0.5; cursor: default; }
.pl-chat-send svg { width: 16px; height: 16px; }

/* Adjuntos */
.pl-attach { position: relative; flex-shrink: 0; }
.pl-attach-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--muted); color: var(--muted-foreground); display: grid; place-items: center; cursor: pointer; }
.pl-attach-btn:hover { color: var(--primary); border-color: var(--primary); }
.pl-attach-btn svg { width: 16px; height: 16px; }
.pl-attach-menu { position: absolute; bottom: 44px; left: 0; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); padding: 6px; display: flex; flex-direction: column; gap: 2px; z-index: 20; min-width: 150px; }
.pl-attach-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; font-size: 12.5px; color: var(--foreground); background: none; border: none; cursor: pointer; text-align: left; }
.pl-attach-item:hover { background: var(--muted); }
.pl-attach-item svg { width: 15px; height: 15px; color: var(--muted-foreground); }
.pl-media-img { max-width: 220px; max-height: 220px; border-radius: 8px; display: block; margin-bottom: 4px; }
.pl-media-doc { display: inline-block; font-size: 12.5px; text-decoration: underline; margin-bottom: 4px; }
.pl-bubble.out .pl-media-doc { color: #fff; }

/* Toggle Datos/Chat: solo visible en movil. */
.pl-lead-mobtabs { display: none; }
@media (max-width: 880px) {
    .pl-lead-dialog { flex-direction: column; max-height: 94vh; }
    .pl-lead-mobtabs { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--border); background: var(--card); flex: 0 0 auto; }
    .pl-lead-mobtabs button { flex: 1; padding: 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--muted); font-weight: 700; font-size: 13px; color: var(--muted-foreground); cursor: pointer; }
    .pl-lead-mobtabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
    /* Mostrar solo el panel seleccionado y dejar que ocupe el alto disponible. */
    .pl-lead-dialog .pl-lead-left, .pl-lead-dialog .pl-chat { flex: 1 1 auto; max-height: none; min-height: 0; }
    .pl-lead-dialog.mob-datos .pl-chat { display: none; }
    .pl-lead-dialog.mob-chat .pl-lead-left { display: none; }
    .pl-chat { border-left: none; border-top: 1px solid var(--border); }
}

