/* ─── ACP — Neo-Futurista Refined ─── */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #1a1d24;
  --surface: rgba(30, 34, 42, 0.9);
  --card: rgba(28, 32, 40, 0.9);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text: #e8eaed;
  --muted: rgba(255, 255, 255, 0.5);
  --accent: #5b9cf6;
  --accent-glow: rgba(91, 156, 246, 0.3);
  --accent-dim: rgba(91, 156, 246, 0.12);
  --purple: #8b5cf6;
  --purple-glow: rgba(139, 92, 246, 0.3);
  --purple-dim: rgba(139, 92, 246, 0.12);
  --success: #34d399;
  --error: #f87171;
  --warning: #fbbf24;
  --info: #60a5fa;
  --font: 13px/1.5 'Outfit', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --chart-grid: rgba(255, 255, 255, 0.08);
  --text-muted: rgba(255, 255, 255, 0.35);
  --radius: 6px;
  --radius-sm: 4px;
  --transition: all 0.2s ease;
}

[data-theme="light"] {
  --bg: #f4f5f7;
  --surface: rgba(255, 255, 255, 0.9);
  --card: rgba(255, 255, 255, 0.95);
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);
  --text: #111827;
  --muted: rgba(0, 0, 0, 0.45);
  --accent: #00a88a;
  --accent-glow: rgba(0, 168, 138, 0.25);
  --accent-dim: rgba(0, 168, 138, 0.1);
  --purple: #7c3aed;
  --purple-glow: rgba(124, 58, 237, 0.25);
  --purple-dim: rgba(124, 58, 237, 0.1);
  --chart-grid: rgba(0, 0, 0, 0.08);
  --text-muted: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  font: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Custom Scrollbar ─── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* ─── Sidebar ─── */

.sidebar {
  width: 250px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(16, 18, 26, 0.95) 0%, rgba(10, 11, 16, 0.98) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  z-index: 50;
}

[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(244, 245, 247, 0.98) 100%);
}

.sidebar-brand {
  padding: 16px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--mono);
}

.sidebar nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.sidebar-nav-item {
  display: block;
  padding: 8px 16px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] .sidebar-nav-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.sidebar-nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
  background: var(--accent-dim);
}

.sidebar-separator {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border) 20%, var(--border) 80%, transparent 100%);
  margin: 8px 16px;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* ─── Hamburger ─── */

.hamburger {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 60;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  padding: 4px 10px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

@media (max-width: 768px) {
  .hamburger {
    font-size: 26px;
    padding: 10px 16px;
    top: 8px;
    left: 8px;
    min-width: 52px;
    min-height: 48px;
  }
}

.hamburger:hover {
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ─── Content ─── */

.content {
  margin-left: 250px;
  flex: 1;
  padding: 24px 32px;
  min-height: 100vh;
  overflow-x: hidden;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.subsection-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin: 24px 0 12px;
  font-family: var(--mono);
}

/* ─── Agent Header ─── */

.agent-header {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.agent-header h2 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-header-meta {
  display: flex;
  gap: 16px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

/* ─── Tab Bar ─── */

.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  margin-bottom: 16px;
  overflow-x: auto;
}

.tab-item {
  padding: 8px 16px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: var(--transition);
}

.tab-item:hover {
  color: var(--text);
}

.tab-item.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.tab-content {
  min-height: 200px;
}

/* ─── Stats Grid ─── */

.stats-grid {
  display: flex;
  gap: 10px;
}

.stat-card {
  flex: 1;
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 20px rgba(0, 212, 170, 0.06);
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
  font-family: var(--mono);
}

.stat-subtitle {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ─── Card Grid ─── */

.card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.card-grid > .panel {
  flex: 1;
  min-width: 150px;
}

/* ─── Panel ─── */

.panel {
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: var(--transition);
}

.panel:hover {
  border-color: var(--border-hover);
}

.panel-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
  color: var(--text);
}

/* ─── Tables ─── */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
  font-family: var(--mono);
}

td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

tr:hover td {
  background: rgba(0, 212, 170, 0.03);
  border-left: 2px solid var(--accent);
}

[data-theme="light"] tr:hover td {
  background: rgba(0, 168, 138, 0.04);
}

tr:hover td:first-child {
  border-left: 2px solid var(--accent);
}

tr:hover td:not(:first-child) {
  border-left: none;
}

/* ─── Badges ─── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--mono);
}

.badge-ok {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
}

.badge-fail {
  background: rgba(248, 113, 113, 0.12);
  color: var(--error);
}

.badge-pending {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid var(--border);
}

[data-theme="light"] .badge-neutral {
  background: rgba(0, 0, 0, 0.04);
}

/* ─── Buttons ─── */

.btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  transition: var(--transition);
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.btn-approve {
  border-color: var(--success);
  color: var(--success);
}

.btn-approve:hover {
  background: rgba(52, 211, 153, 0.1);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.25);
}

.btn-deny {
  border-color: var(--error);
  color: var(--error);
}

.btn-deny:hover {
  background: rgba(248, 113, 113, 0.1);
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.25);
}

.btn-group {
  display: flex;
  gap: 6px;
}

/* ─── Code ─── */

.code-editor {
  width: 100%;
  min-height: calc(100vh - 380px);
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(6, 7, 10, 0.9);
  border: 1px solid var(--border);
  padding: 12px;
  color: var(--accent);
  resize: vertical;
  border-radius: var(--radius);
  line-height: 1.6;
  transition: var(--transition);
}

.code-editor:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

[data-theme="light"] .code-editor {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

.code-viewer {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(6, 7, 10, 0.9);
  border: 1px solid var(--border);
  padding: 12px;
  white-space: pre-wrap;
  overflow: auto;
  max-height: 500px;
  border-radius: var(--radius);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
}

[data-theme="light"] .code-viewer {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
}

/* ─── States ─── */

.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.loading-state {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ─── Status Dot ─── */

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.ok {
  background: var(--success);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
}

.status-dot.fail {
  background: var(--error);
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.5);
}

.status-dot.warn {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

/* ─── Esferas ─── */

.esfera-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.esfera-label {
  width: 80px;
  font-size: 12px;
  text-transform: capitalize;
  color: var(--purple);
  font-weight: 500;
}

.esfera-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

[data-theme="light"] .esfera-bar {
  background: rgba(0, 0, 0, 0.06);
}

.esfera-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--purple), var(--accent));
}

.esfera-value {
  width: 30px;
  font-size: 12px;
  text-align: right;
  color: var(--muted);
  font-family: var(--mono);
}

/* ─── Progress Bar ─── */

.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

[data-theme="light"] .progress-bar {
  background: rgba(0, 0, 0, 0.06);
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}

/* ─── Modal ─── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 24px;
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  overflow: auto;
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ─── iframes ─── */

.terminal-iframe {
  width: 100%;
  height: calc(100vh - 250px);
  border: none;
  background: var(--bg);
  border-radius: var(--radius);
}

/* ─── Memory Tree ─── */

.tree-item {
  padding: 4px 0;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  transition: var(--transition);
}

.tree-item:hover {
  color: var(--accent);
}

.tree-dir {
  font-weight: 500;
  color: var(--text);
}

.tree-children {
  padding-left: 16px;
}

/* ─── Routine Card ─── */

.routine-card {
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  transition: var(--transition);
}

.routine-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.routine-name {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.routine-schedule {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
}

/* ─── Timeline ─── */

.timeline-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: var(--transition);
}

.timeline-item:hover {
  background: rgba(0, 212, 170, 0.03);
}

.timeline-time {
  width: 80px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
}

.timeline-source {
  width: 80px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
}

.timeline-text {
  flex: 1;
}

/* ─── Status dots en sidebar ─── */

.sidebar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  background: var(--muted);
}

.sidebar-dot.running {
  background: var(--success);
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.5);
  animation: pulse-green 3s ease-in-out infinite;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(52, 211, 153, 0.5); }
  50% { opacity: 0.6; box-shadow: 0 0 3px rgba(52, 211, 153, 0.2); }
}

.sidebar-dot.warn {
  background: var(--warning);
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.5);
}

.sidebar-dot.stopped {
  background: var(--error);
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.5);
}

.sidebar-dot.esferas {
  animation: esfera-colors 8s ease infinite;
}

@keyframes esfera-colors {
  0%   { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.5); }
  20%  { background: #f87171; box-shadow: 0 0 6px rgba(248,113,113,0.5); }
  40%  { background: #60a5fa; box-shadow: 0 0 6px rgba(96,165,250,0.5); }
  60%  { background: #fbbf24; box-shadow: 0 0 6px rgba(251,191,36,0.5); }
  80%  { background: #c084fc; box-shadow: 0 0 6px rgba(192,132,252,0.5); }
  100% { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.5); }
}

/* ─── Badge en sidebar ─── */

.sidebar-badge {
  background: rgba(248, 113, 113, 0.2);
  color: var(--error);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  margin-left: 6px;
  display: none;
  font-family: var(--mono);
}

.sidebar-badge.visible {
  display: inline;
}

/* ─── Boton actualizar ─── */

.btn-refresh {
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  border-radius: var(--radius-sm);
  float: right;
  font-family: var(--mono);
  transition: var(--transition);
}

.btn-refresh:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ─── Responsive ─── */

/* =======================================================================
   MOBILE — Supersimple version
   ======================================================================= */

@media (max-width: 768px) {

  /* --- Sidebar: overlay fullscreen --- */
  .sidebar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    z-index: 100;
    background: var(--bg);
    padding-top: 48px;
  }
  .sidebar.open {
    display: flex;
  }
  .sidebar-nav-item {
    padding: 14px 20px;
    font-size: 14px;
  }

  .hamburger {
    display: block;
  }

  /* --- Content: full width, tighter padding --- */
  .content {
    margin-left: 0;
    padding: 12px;
    padding-top: 48px;
  }

  .section-title {
    font-size: 14px;
    letter-spacing: 0.8px;
  }

  .subsection-title {
    font-size: 12px;
    margin-top: 16px;
    margin-bottom: 10px;
  }

  /* --- Stats: 2 columns, compact --- */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }

  .stat-card {
    padding: 10px !important;
  }

  .stat-value {
    font-size: 22px !important;
  }

  .stat-label {
    font-size: 9px !important;
    letter-spacing: 1px !important;
  }

  /* --- Hide stat cards on mobile --- */
  #dashboard-stats {
    display: none !important;
  }

  /* --- Esferas: center emoji+score block --- */
  .esferas-hero {
    justify-content: center !important;
    gap: 24px !important;
    margin: 8px auto !important;
    width: fit-content !important;
  }

    /* --- Hide sections on mobile --- */
  #section-rutinas,
  #section-recordatorios,
  #section-memoria {
    display: none !important;
  }

  /* Hide sidebar links to hidden sections */
  .sidebar-nav-item[data-section="rutinas"],
  .sidebar-nav-item[data-section="recordatorios"],
  .sidebar-nav-item[data-section="memoria"] {
    display: none !important;
  }

    #dashboard-alerts-row {
    flex-direction: column !important;
    gap: 12px !important;
  }

  /* --- Alertas + Approvals: stack vertically --- */
  #section-dashboard > div[style*=display:flex][style*=gap:20px] {
    flex-direction: column !important;
    gap: 12px !important;
  }

  .stat-subtitle {
    font-size: 10px !important;
  }

  /* --- Card grid: single column --- */
  .card-grid {
    grid-template-columns: 1fr !important;
  }

  /* --- Agent cards: force single column on 2x2 grids --- */
  /* Targets inline style grids from JS */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* --- 2-column layouts → stack vertically --- */
  [style*="grid-template-columns:1fr 1fr;"],
  [style*="grid-template-columns: 1fr 1fr;"] {
    grid-template-columns: 1fr !important;
  }

  /* Esferas 3-column → 1 column */
  [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Panels: tighter padding --- */
  .panel {
    padding: 10px !important;
  }

  .agent-card-name {
    font-size: 13px !important;
  }

  .agent-label {
    font-size: 8px !important;
  }

  .agent-meta {
    font-size: 9px !important;
  }

  .btn-group .btn {
    padding: 4px 10px !important;
    font-size: 10px !important;
  }

  /* --- Tables: compact --- */
  table {
    font-size: 11px !important;
  }

  th {
    padding: 6px 8px !important;
    font-size: 9px !important;
  }

  td {
    padding: 6px 8px !important;
    font-size: 11px !important;
  }

  /* --- Mi Dia: stack timeline + historial --- */
  #section-mi-dia [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  .mi-dia-header {
    padding: 10px 12px !important;
  }

  .mi-dia-header .mi-dia-icon {
    font-size: 16px !important;
    width: 24px !important;
  }

  .mi-dia-header .mi-dia-title {
    font-size: 12px !important;
  }

  .mi-dia-body {
    padding: 0 12px 10px 40px !important;
  }

  .mi-dia-row {
    grid-template-columns: 40px 70px 1fr auto !important;
    gap: 4px !important;
    font-size: 10px !important;
  }

  .mi-dia-time {
    font-size: 10px !important;
  }

  .mi-dia-agent {
    font-size: 10px !important;
  }

  .mi-dia-desc {
    font-size: 10px !important;
  }

  /* --- Rutinas: stack, no fixed height --- */
  #rutinas-content > div[style*="display:flex"] {
    flex-direction: column !important;
    height: auto !important;
  }

  #rutinas-content > div[style*="display:flex"] > div[style*="width:540px"] {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    max-height: 300px;
    overflow-y: auto;
  }

  #rutinas-content [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  .code-editor {
    min-height: 200px !important;
  }

  /* --- Contactos: stack master-detail --- */
  .ctc-layout {
    flex-direction: column !important;
    height: auto !important;
  }

  .ctc-list-panel {
    width: 100% !important;
    max-height: 250px;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
  }

  .ctc-detail-panel {
    padding: 12px !important;
  }

  .ctc-grid {
    grid-template-columns: 1fr !important;
  }

  /* --- Badges: keep readable --- */
  .badge {
    font-size: 10px !important;
    padding: 2px 6px !important;
  }

  /* --- Modals: full width --- */
  .modal-card {
    width: 95% !important;
    max-width: none !important;
    margin: 20px auto !important;
  }

  /* --- Esferas section --- */
  .esfera-item {
    padding: 4px 0 !important;
  }

  /* --- Reminder items --- */
  .reminder-item {
    padding: 8px 4px !important;
  }

  /* --- Scrollbar: hide on mobile --- */
  ::-webkit-scrollbar {
    width: 2px !important;
  }

  /* --- Hide non-essential on mobile --- */
  .sidebar-footer,
  .sidebar-brand div[style*="font-size:10px"] {
    display: none;
  }

  /* --- Flex layouts with gap > 16px: reduce --- */
  [style*="gap:20px"] {
    gap: 10px !important;
  }

  /* --- Memory tree: smaller --- */
  .tree-item {
    font-size: 11px !important;
    padding: 4px 8px !important;
  }

  /* --- Recordatorios: stack master-detail --- */
  #recordatorios-content > div[style*="display:flex"] {
    flex-direction: column !important;
    height: auto !important;
  }

  #recordatorios-content > div[style*="display:flex"] > div[style*="width:220px"] {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    max-height: 250px;
    overflow-y: auto;
  }

  /* --- Proyectos kanban: vertical stack --- */
  #proyectos-content [style*="display:flex"][style*="overflow-x:auto"] {
    flex-direction: column !important;
    height: auto !important;
    overflow-x: hidden !important;
  }

  #proyectos-content [style*="min-width:160px"] {
    min-width: 100% !important;
    width: 100% !important;
  }

  /* --- Formato WA preview: stack --- */
  #rutina-tab-content [style*="display:flex"][style*="gap:16px"][style*="align-items:start"] {
    flex-direction: column !important;
  }

  #rutina-tab-content [style*="width:320px"] {
    width: 100% !important;
  }

  /* --- Large gaps: reduce --- */
  [style*="gap:40px"] {
    gap: 12px !important;
  }

  [style*="gap:20px"] {
    gap: 10px !important;
  }

  /* --- Tareas agentes cards: columna en movil --- */
  .tareas-cards-grid {
    grid-template-columns: 1fr !important;
  }

  /* --- Esferas estado actual: columna en movil --- */
  .esferas-estado-grid {
    flex-direction: column !important;
  }

  .esferas-estado-grid > div {
    flex: none !important;
    width: 100% !important;
  }

  /* --- Esferas detalle: columna en movil --- */
  #esferas-content [style*="display:grid"][style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Large fonts: scale down for mobile --- */
  [style*="font-size:120px"] {
    font-size: 60px !important;
  }

  [style*="font-size:100px"] {
    font-size: 48px !important;
  }

  [style*="font-size:64px"] {
    font-size: 36px !important;
  }

  /* font-size:56px kept as-is on mobile */

  [style*="font-size:52px"] {
    font-size: 30px !important;
  }

  [style*="font-size:42px"] {
    font-size: 28px !important;
  }

  /* --- Mood emoji buttons: wrap --- */
  [style*="font-size:100px"] {
    font-size: 48px !important;
  }

  .modal-card [style*="display:flex"][style*="justify-content:center"] {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  /* --- Dashboard esferas widget: compact on mobile --- */
  #section-dashboard [style*="gap:40px"] {
    gap: 10px !important;
  }

  /* --- Familia section: 2-col layouts --- */
  #section-familia [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Memoria section: 2-col layouts --- */
  #section-memoria [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Config section --- */
  #config-layout {
    flex-direction: column !important;
    height: auto !important;
  }

  #config-file-list {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    max-height: 250px;
  }

  #config-editor-area .code-editor {
    min-height: 300px !important;
  }

    #section-config [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* --- Alertas section --- */
  #section-alertas [style*="display:flex"][style*="align-items:baseline"] {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  /* --- All sections: prevent horizontal overflow --- */
  .section {
    overflow-x: hidden !important;
  }

  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  thead, tbody, tr {
    display: revert;
  }

}

/* Extra small (phones < 400px) */
@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .stat-value {
    font-size: 20px !important;
  }

  .content {
    padding: 8px;
    padding-top: 44px;
  }

  .mi-dia-row {
    grid-template-columns: 1fr !important;
    gap: 2px !important;
  }

  .mi-dia-time,
  .mi-dia-agent {
    display: inline !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   ENHANCED COMPONENTS — Neo-Futurista v2
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── 1. Stat Cards ─── */

.stat-card {
  background: linear-gradient(135deg, var(--card) 0%, rgba(0, 212, 170, 0.03) 100%);
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: scale(1.02);
  border-color: rgba(0, 212, 170, 0.2);
  box-shadow: 0 4px 24px rgba(0, 212, 170, 0.08);
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.stat-label {
  letter-spacing: 1.2px;
  font-size: 10px;
  margin-top: 6px;
}

.stat-subtitle {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  font-family: var(--mono);
}

/* ─── 2. Agent Cards ─── */

.agent-card-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.agent-cron-info {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
}

.agent-cron-info::before {
  content: '\23F1\FE0E ';
}

/* ─── 3. Tables Enhanced ─── */

thead tr {
  background: rgba(0, 212, 170, 0.04);
}

[data-theme="light"] thead tr {
  background: rgba(0, 168, 138, 0.05);
}

th {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(0, 212, 170, 0.15);
}

td {
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
}

tr:hover td {
  background: rgba(0, 212, 170, 0.04);
  border-left-color: transparent;
}

tr:hover td:first-child {
  border-left: 2px solid var(--accent);
}

tr:hover td:not(:first-child) {
  border-left: none;
}

/* Monospace for numeric data in tables */
td .mono-data {
  font-family: var(--mono);
  font-size: 12px;
}

/* ─── 4. Panels Enhanced ─── */

.panel {
  background: linear-gradient(135deg, var(--card) 0%, rgba(255, 255, 255, 0.01) 100%);
  transition: all 0.2s ease;
}

.panel:hover {
  border-color: rgba(0, 212, 170, 0.15);
  box-shadow: 0 0 16px rgba(0, 212, 170, 0.06);
}

/* ─── 5. Sidebar Nav Enhanced ─── */

.sidebar-nav-item {
  position: relative;
  padding: 9px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-right: 8px;
}

.sidebar-nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-left-color: rgba(0, 212, 170, 0.3);
}

[data-theme="light"] .sidebar-nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.sidebar-nav-item.active {
  background: linear-gradient(90deg, var(--accent-dim) 0%, transparent 100%);
  border-left-color: var(--accent);
  box-shadow: inset 3px 0 8px rgba(0, 212, 170, 0.1);
}

.sidebar-separator {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border) 30%, var(--border) 70%, transparent 100%);
  margin: 10px 16px;
}

/* ─── 6. Esferas Progress Bars ─── */

.esfera-bar {
  height: 8px;
  border-radius: 4px;
  position: relative;
}

.esfera-fill {
  background: linear-gradient(90deg, var(--purple) 0%, var(--accent) 100%);
  border-radius: 4px;
  position: relative;
  min-width: 0;
  transition: width 0.4s ease;
}

.esfera-fill-label {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8px;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--bg);
  line-height: 1;
  pointer-events: none;
}

.esfera-item {
  padding: 6px 0;
  transition: all 0.2s ease;
  border-radius: var(--radius-sm);
}

.esfera-item:hover {
  background: rgba(139, 92, 246, 0.04);
}

/* ─── 7. Routine Cards ─── */

.routine-card {
  transition: all 0.2s ease;
}

.routine-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}

.routine-badge-fija {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.25);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 9px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.5px;
}

.routine-badge-sesion {
  background: rgba(139, 92, 246, 0.12);
  color: var(--purple);
  border: 1px solid rgba(139, 92, 246, 0.2);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 9px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.5px;
}

/* Routine panel hover in list */
.routine-panel {
  transition: all 0.2s ease;
}

.routine-panel:hover {
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ─── 8. Modal Enhanced ─── */

.modal-overlay {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.modal-card {
  border: 1px solid rgba(0, 212, 170, 0.12);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5), 0 0 32px rgba(0, 212, 170, 0.06);
}

.modal-card .section-title,
.modal-card .panel-title,
#modal-title {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 212, 170, 0.15);
  margin-bottom: 16px;
}

/* ─── 9. Reminders Enhanced ─── */

.reminder-item {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: start;
  gap: 10px;
  transition: all 0.2s ease;
  border-radius: var(--radius-sm);
}

.reminder-item:hover {
  background: rgba(0, 212, 170, 0.03);
}

.reminder-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-hover);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 10px;
  color: transparent;
}

.reminder-checkbox:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.reminder-checkbox.done {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.reminder-overdue {
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.15), 0 0 8px rgba(248, 113, 113, 0.08);
}

.reminder-list-count {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--mono);
  line-height: 1;
}

/* ─── 10. Code Editor Enhanced ─── */

.code-editor {
  padding: 12px 12px 12px 48px;
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 100% 1.6em;
  background-position: 0 12px;
  tab-size: 2;
}

.code-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-glow), 0 0 4px rgba(0, 212, 170, 0.15);
}

.code-editor-wrapper {
  position: relative;
}

.code-editor-wrapper::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius) 0 0 var(--radius);
  border-right: 1px solid var(--border);
  pointer-events: none;
  z-index: 1;
}

/* ─── Buttons Enhanced ─── */

.btn {
  border-radius: var(--radius);
  font-weight: 500;
  letter-spacing: 0.2px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

/* Agent action buttons */
.btn-group .btn {
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 11px;
  font-family: var(--mono);
}

.btn-group .btn:hover {
  box-shadow: 0 0 16px var(--accent-glow);
}

.btn-group .btn-deny:hover {
  box-shadow: 0 0 16px rgba(248, 113, 113, 0.3);
}

/* ─── Status Dot Enhanced ─── */

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-dot.ok {
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.6), 0 0 4px rgba(52, 211, 153, 0.8);
}

.status-dot.fail {
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.6), 0 0 4px rgba(248, 113, 113, 0.8);
}

.status-dot.warn {
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.6), 0 0 4px rgba(251, 191, 36, 0.8);
}

/* ─── Progress Bar General ─── */

.progress-fill {
  background: linear-gradient(90deg, var(--accent) 0%, var(--purple) 100%);
  transition: width 0.4s ease;
}

/* ─── Timeline Enhanced ─── */

.timeline-item {
  border-radius: var(--radius-sm);
  padding: 8px 6px;
}

.timeline-item:hover {
  background: rgba(0, 212, 170, 0.04);
  box-shadow: inset 2px 0 0 var(--accent);
}

/* ─── Badges polish ─── */

.badge-ok {
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.1);
}

.badge-fail {
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.1);
}

.badge-pending {
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════
   VISUAL REFINEMENTS — Neo-Futurista v3
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── 1. Stats Cards: numeros con mas presencia ─── */

.stat-value {
  text-shadow: 0 0 16px var(--accent-glow), 0 0 32px rgba(91, 156, 246, 0.15);
  line-height: 1;
}

.stat-label {
  letter-spacing: 1.5px;
  margin-top: 10px;
  opacity: 0.7;
}

.stat-card {
  background: linear-gradient(135deg, var(--card) 0%, rgba(91, 156, 246, 0.04) 100%);
}

.stat-card:hover {
  border-color: rgba(91, 156, 246, 0.25);
  box-shadow: 0 4px 24px rgba(91, 156, 246, 0.1);
}

/* ─── 2. Agent Cards: separacion nombre/datos, botones redondeados ─── */

.card-grid .panel {
  padding: 18px;
}

.card-grid .panel .agent-card-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
  display: block;
  width: 100%;
}

.card-grid .panel .btn-group {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.card-grid .panel .btn-group .btn {
  border-radius: 16px;
  padding: 5px 14px;
  font-size: 11px;
  transition: all 0.2s ease;
}

.card-grid .panel .btn-group .btn:hover {
  box-shadow: 0 0 14px var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.card-grid .panel .btn-group .btn-deny:hover {
  box-shadow: 0 0 14px rgba(248, 113, 113, 0.35);
  border-color: var(--error);
  color: var(--error);
}

/* ─── 3. Servicios: tabla compacta, dots visibles, Online verde ─── */

#dashboard-health table {
  font-size: 12px;
}

#dashboard-health table th {
  padding: 6px 10px;
  font-size: 10px;
}

#dashboard-health table td {
  padding: 6px 10px;
  white-space: nowrap;
}

#dashboard-health .status-dot {
  width: 8px;
  height: 8px;
  vertical-align: middle;
  margin-right: 6px;
}

#dashboard-health .status-dot.ok {
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.7), 0 0 4px rgba(52, 211, 153, 0.9);
}

/* ─── 4. Alertas y Por aprobar: bordes sutiles, hover, separacion ─── */

#dashboard-alerts,
#dashboard-approvals-wrap {
  min-height: 60px;
}

#dashboard-alerts .timeline-item,
#dashboard-approvals-wrap .timeline-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 6px;
  transition: all 0.2s ease;
}

#dashboard-alerts .timeline-item:hover,
#dashboard-approvals-wrap .timeline-item:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 12px rgba(91, 156, 246, 0.06);
}

#dashboard-alerts .timeline-item + .timeline-item,
#dashboard-approvals-wrap .timeline-item + .timeline-item {
  border-top: 1px solid var(--border);
}

#dashboard-approvals-wrap .panel {
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

#dashboard-approvals-wrap .panel:hover {
  border-color: rgba(251, 191, 36, 0.25);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.08);
}

/* ─── 5. Esferas mini: gradiente por esfera, score mono bold ─── */

#section-dashboard .esfera-fill {
  background: linear-gradient(90deg, var(--esfera-color, var(--purple)) 0%, var(--accent) 100%) !important;
  border-radius: var(--radius-sm);
}

#section-dashboard .esfera-bar {
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] #section-dashboard .esfera-bar {
  background: rgba(0, 0, 0, 0.05);
}

/* Score numerico en esferas mini */
#section-dashboard [style*="font-family:var(--mono)"][style*="text-align:right"] {
  font-weight: 700;
  color: var(--text);
}

/* ─── 6. Subsection titles: linea decorativa izquierda, mas espacio ─── */

.subsection-title {
  margin-top: 28px;
  margin-bottom: 14px;
  padding-left: 10px;
  border-left: 2px solid var(--accent);
  line-height: 1.2;
}

/* ─── 7. General: breathing room, scrollbar, hover states ─── */

/* Mas espacio entre secciones del dashboard */
#section-dashboard > div {
  margin-bottom: 24px;
}

#section-dashboard > div:last-child {
  margin-bottom: 0;
}

/* Scrollbar mas fino */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.15);
}

/* Clickable areas */
.stat-card[style*="cursor"],
.panel[style*="cursor"],
[onclick] {
  cursor: pointer;
}

/* Panel hover con transicion de border-color */
.panel {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.panel:hover {
  border-color: rgba(91, 156, 246, 0.18);
}

/* Links y areas clickables con hover visible */
.sidebar-nav-item,
.tab-item,
.btn,
.routine-card,
.tree-item {
  cursor: pointer;
}

/* Empty state mejorado */
.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--muted);
  font-size: 12px;
}

/* ─── Utility: Agent Cards ──────────────────────────────────────────── */

/* Panel compacto — subagentes, servicios */
.compact-panel {
  padding: 10px 12px;
  margin-bottom: 6px;
}

/* Etiqueta de rol (9px mono uppercase coloreada) */
.agent-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-family: var(--mono);
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* Lineas de meta-info (ultimo/sig) en fichas de agente */
.agent-meta {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--mono);
  line-height: 1.8;
  margin-bottom: 10px;
}

/* Dot verde pulsante — Main online */
@keyframes agent-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.agent-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  animation: agent-pulse 2s ease-in-out infinite;
  display: inline-block;
  flex-shrink: 0;
  margin-left: 5px;
  vertical-align: middle;
}

/* Dots de estado para servicios */
.svc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.svc-dot-ok   { background: var(--success); }
.svc-dot-warn { background: var(--warning); }
.svc-dot-fail { background: var(--error); }

/* Nombre de subagente */
.subagent-name {
  font-size: 12px;
  font-weight: 600;
}

/* Texto secundario en fichas compactas */
.compact-detail {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--mono);
  line-height: 1.7;
}

/* ─── Contactos ─── */

.ctc-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.ctc-search {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--mono);
  width: 160px;
  transition: border-color 0.2s;
  outline: none;
}
.ctc-search:focus {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.ctc-search::placeholder { color: var(--muted); }

.ctc-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.ctc-chip {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: .06em;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: var(--transition);
}
.ctc-chip:hover {
  border-color: var(--border-hover);
  color: var(--text);
}
.ctc-chip.active {
  background: var(--chip-color, var(--accent-dim));
  border-color: var(--chip-color, var(--accent));
  color: var(--chip-color, var(--accent));
}

.ctc-fav-toggle {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: .06em;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  transition: var(--transition);
}
.ctc-fav-toggle.active {
  background: rgba(251,191,36,0.12);
  border-color: var(--warning);
  color: var(--warning);
}

.ctc-count {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted);
  margin-left: 4px;
}

.ctc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.ctc-card {
  border-left: 3px solid var(--card-color, var(--accent));
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, box-shadow 0.2s;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ctc-card:hover {
  background: var(--card);
  box-shadow: 0 0 0 1px var(--card-color, var(--accent)),
              0 4px 24px var(--card-glow, var(--accent-glow));
}

.ctc-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 6px;
}

.ctc-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.ctc-fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--border-hover);
  padding: 0;
  flex-shrink: 0;
  transition: color 0.15s, transform 0.15s;
  line-height: 1;
}
.ctc-fav-btn:hover { transform: scale(1.2); }
.ctc-fav-btn.active { color: var(--warning); }

.ctc-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.ctc-badge {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--card-color, var(--accent));
  background: var(--card-color-dim, var(--accent-dim));
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  letter-spacing: .05em;
  flex-shrink: 0;
}

.ctc-ultima {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--mono);
}

.ctc-relacion {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctc-tono {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 10px;
  font-family: var(--mono);
}

.ctc-tono-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ctc-tono-dot.positivo { background: var(--success); }
.ctc-tono-dot.tension  { background: var(--error); animation: ctc-pulse 1.5s ease-in-out infinite; }
.ctc-tono-dot.frio     { background: var(--warning); }
.ctc-tono-dot.neutro   { background: var(--muted); }

@keyframes ctc-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.7); }
}

/* Modal tabs para contactos */
.ctc-modal-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.ctc-modal-tab {
  padding: 4px 14px;
  border-radius: 4px 4px 0 0;
  font-size: 11px;
  font-family: var(--mono);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  letter-spacing: .05em;
  transition: var(--transition);
}
.ctc-modal-tab:hover { color: var(--text); }
.ctc-modal-tab.active {
  background: var(--tab-color-dim, var(--accent-dim));
  color: var(--tab-color, var(--accent));
}

/* Historial DB items */
.ctc-interaction-item {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.ctc-interaction-item:last-child { border-bottom: none; }

.ctc-interaction-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.ctc-interaction-date {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted);
}

.ctc-interaction-temas {
  font-size: 10px;
  color: var(--accent);
  font-family: var(--mono);
}

.ctc-interaction-content {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}

.ctc-interaction-pending {
  font-size: 11px;
  color: var(--warning);
  margin-top: 4px;
}

/* ─── Contactos — Layout master-detail ─── */

.ctc-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - 220px);
  min-height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.ctc-list-panel {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--surface);
}

.ctc-detail-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg);
}

.ctc-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-left: 3px solid var(--card-color, var(--border));
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.ctc-list-item:hover {
  background: rgba(255,255,255,0.04);
}
.ctc-list-item.active {
  background: var(--card, rgba(28,32,40,0.9));
  border-left-width: 3px;
}

.ctc-list-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.ctc-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.ctc-detail-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.ctc-detail-meta {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
}

/* ─── Contactos — Perfil visual ─── */

.ctc-profile-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ctc-profile-section {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--card-color, var(--accent));
  border-radius: var(--radius);
}

.ctc-profile-section-title {
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: .08em;
  color: var(--card-color, var(--accent));
  text-transform: uppercase;
  margin-bottom: 8px;
  font-weight: 500;
}

.ctc-profile-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.6;
}

.ctc-profile-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ctc-profile-list li {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  padding-left: 14px;
  position: relative;
}

.ctc-profile-list li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--card-color, var(--accent));
  font-weight: 700;
}

.ctc-profile-edit-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.ctc-editable:focus {
  outline: 1px solid var(--card-color, var(--accent));
  outline-offset: 2px;
  border-radius: 2px;
  background: rgba(255,255,255,0.03);
}

.ctc-editable:hover {
  background: rgba(255,255,255,0.02);
  border-radius: 2px;
}

.ctc-profile-save-bar {
  align-items: center;
}

/* ─── Contactos — Edición rápida ─── */

.ctc-quick-edit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.ctc-quick-edit-old {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  bottom: 0;
}

.ctc-cmd-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  transition: border-color .15s;
}

.ctc-cmd-input:focus {
  border-color: var(--accent);
}

.ctc-cmd-input::placeholder {
  color: var(--muted);
}

.ctc-cmd-send {
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-size: 11px;
  padding: 6px 14px;
  cursor: pointer;
  font-family: var(--mono);
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.ctc-cmd-send:hover {
  background: var(--accent);
  color: var(--bg);
}

.ctc-cmd-status {
  font-size: 11px;
  color: var(--muted);
  min-width: 80px;
}

.ctc-quick-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}

.ctc-quick-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 10px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  transition: border-color .15s;
  min-width: 0;
}

.ctc-quick-input:focus {
  border-color: var(--accent);
}

.ctc-quick-input::placeholder {
  color: var(--muted);
}

.ctc-quick-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.ctc-quick-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-size: 11px;
  padding: 5px 12px;
  cursor: pointer;
  font-family: var(--mono);
  transition: border-color .15s, color .15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.ctc-quick-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ctc-quick-status {
  font-size: 10px;
  color: var(--success);
  font-family: var(--mono);
  min-width: 40px;
  text-align: right;
}

/* =======================================================================
   MI DIA - Timeline styles (moved from inline)
   ======================================================================= */

/* --- Mi Dia Layout --- */
.mi-dia-timeline { position: relative; padding-left: 0; }
.mi-dia-block { position: relative; margin-bottom: 2px; border-radius: var(--radius); overflow: hidden; transition: var(--transition); }
.mi-dia-block:hover { transform: translateX(2px); }
.mi-dia-header { display: flex; align-items: center; gap: 10px; padding: 12px 18px; cursor: pointer; user-select: none; }
.mi-dia-header .mi-dia-icon { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.mi-dia-header .mi-dia-title { font-family: 'Outfit', sans-serif; font-size: 13px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; }
.mi-dia-header .mi-dia-hours { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-left: auto; }
.mi-dia-header .mi-dia-chevron { font-size: 10px; color: var(--muted); transition: transform 0.2s; margin-left: 8px; }
.mi-dia-block.open .mi-dia-chevron { transform: rotate(90deg); }
.mi-dia-body { display: none; padding: 0 18px 14px 56px; }
.mi-dia-block.open .mi-dia-body { display: block; }

/* --- Mi Dia Row --- */
.mi-dia-row { display: grid; grid-template-columns: 46px 90px 1fr auto; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.03); align-items: baseline; }
.mi-dia-row:last-child { border-bottom: none; }

/* --- Mi Dia Status - uses badge pattern --- */
.mi-dia-row .mi-dia-status { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: var(--radius-sm); font-family: var(--mono); letter-spacing: 0.3px; flex-shrink: 0; text-align: center; min-width: 42px; }
.mi-dia-status-ok { background: rgba(52,211,153,0.12); color: var(--success); }
.mi-dia-status-fail { background: rgba(248,113,113,0.12); color: var(--error); }
.mi-dia-status-warn { background: rgba(251,191,36,0.12); color: var(--warning); }
.mi-dia-status-skip { background: rgba(255,255,255,0.05); color: var(--muted); border: 1px solid var(--border); }

/* --- Mi Dia Elements --- */
.mi-dia-time { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.mi-dia-agent { font-size: 11px; font-weight: 600; }
.mi-dia-desc { font-size: 11px; color: var(--muted); }
.mi-dia-desc em { font-style: normal; opacity: 0.6; }
.mi-dia-bar { height: 3px; border-radius: 2px; margin: 0 18px; }

/* --- Agent Color Classes --- */
.agent-crm { color: #34d399; }
.agent-conciencia { color: #a78bfa; }
.agent-proyectos { color: #60a5fa; }
.agent-rutina { color: #f59e0b; }
.agent-check { color: #94a3b8; }
.agent-infra { color: var(--muted); }

/* --- Mi Dia Light Theme --- */
[data-theme="light"] .mi-dia-block { background: rgba(0,0,0,0.02) !important; }
[data-theme="light"] .mi-dia-block:hover { background: rgba(0,0,0,0.04) !important; }
[data-theme="light"] .mi-dia-row { border-bottom-color: rgba(0,0,0,0.06); }
[data-theme="light"] .mi-dia-desc { color: rgba(0,0,0,0.5); }
[data-theme="light"] .mi-dia-time { color: rgba(0,0,0,0.4); }
[data-theme="light"] .mi-dia-hours { color: rgba(0,0,0,0.35); }
[data-theme="light"] .mi-dia-chevron { color: rgba(0,0,0,0.3); }
[data-theme="light"] .mi-dia-status-ok { background: rgba(5,150,105,0.1); color: #059669; }
[data-theme="light"] .mi-dia-status-fail { background: rgba(220,38,38,0.1); color: #dc2626; }
[data-theme="light"] .mi-dia-status-warn { background: rgba(217,119,6,0.1); color: #d97706; }
[data-theme="light"] .mi-dia-status-skip { background: rgba(0,0,0,0.04); color: rgba(0,0,0,0.35); }
[data-theme="light"] .agent-crm { color: #059669; }
[data-theme="light"] .agent-conciencia { color: #7c3aed; }
[data-theme="light"] .agent-proyectos { color: #2563eb; }
[data-theme="light"] .agent-check { color: #64748b; }
[data-theme="light"] .agent-rutina { color: #d97706; }
[data-theme="light"] .agent-infra { color: #64748b; }

/* --- Routine Type Badges (unified) --- */
.routine-badge-n8n {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  letter-spacing: 0.5px;
  background: rgba(232, 93, 4, 0.15);
  color: #e85d04;
  border: 1px solid rgba(232, 93, 4, 0.25);
}

.routine-badge-inactivo {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  letter-spacing: 0.5px;
  background: var(--border);
  color: var(--muted);
}

.routine-badge-systemd {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  letter-spacing: 0.5px;
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

/* Note: .routine-badge-sesion already exists - but adding unified version */

/* --- Agent Label Inline (historial table) --- */
.agent-label-inline {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.05em;
}

/* --- Config master-detail --- */
.config-file-item:hover {
  background: rgba(255,255,255,0.04);
}

.config-file-item[style*="border-left:3px solid var(--accent)"] {
  background: var(--card);
}

/* --- Hoy panel (agenda diaria 2 columnas) ----------------------------- */
.hoy-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  max-width: 1400px;
  align-items: start;
}
.hoy-col-left { min-width: 0; }
.hoy-col-right {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.hoy-section {
  background: transparent;
  border: none;
  padding: 0;
}
.hoy-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.hoy-section-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text);
}
.hoy-section-icon {
  font-size: 16px;
}
.hoy-section-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
}

.hoy-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 8px 4px;
  border-bottom: 1px dashed rgba(255,255,255,0.04);
  font-size: 13px;
  min-width: 0;
}
.hoy-item:last-child {
  border-bottom: none;
}
.hoy-item.hoy-past {
  opacity: 0.45;
}
.hoy-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 110px;
  flex-shrink: 0;
}
.hoy-item-main {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}
.hoy-item-main strong {
  font-weight: 600;
}
.hoy-cal {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  padding: 1px 6px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  white-space: nowrap;
}
.hoy-loc {
  color: var(--muted);
  font-size: 12px;
}
.hoy-prio {
  color: #f87171;
  margin-right: 4px;
}

.hoy-chip {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--mono);
  white-space: nowrap;
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  letter-spacing: 0.3px;
}
.hoy-chip.urgent { background: rgba(248,113,113,0.15); color: var(--error); }
.hoy-chip.warn   { background: rgba(251,191,36,0.15); color: var(--warning); }
.hoy-chip.ok     { background: rgba(52,211,153,0.15); color: var(--success); }

.hoy-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 10px 4px;
  font-style: italic;
}
.hoy-more {
  font-size: 11px;
  color: var(--muted);
  padding: 8px 4px;
  cursor: pointer;
}
.hoy-more:hover { color: var(--text); }
.hoy-foot {
  margin-top: 10px;
  padding-top: 6px;
  font-size: 11px;
  color: var(--muted);
}
.hoy-foot a {
  color: var(--accent, var(--text));
  cursor: pointer;
  text-decoration: none;
}
.hoy-foot a:hover { text-decoration: underline; }

/* Agenda timeline 08:00 - 22:00 */
.hoy-agenda-allday {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.hoy-allday-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-left-width: 3px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.hoy-agenda-timeline {
  position: relative;
  margin-left: 4px;
  padding-left: 0;
}
.hoy-hour-row {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.hoy-hour-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  width: 42px;
  text-align: right;
  flex-shrink: 0;
}
.hoy-hour-line {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.05);
}
.hoy-agenda-event {
  position: absolute;
  left: 58px;
  right: 10px;
  border-left: 3px solid #60a5fa;
  background: #60a5fa;
  color: #fff;
  border-radius: 4px;
  padding: 5px 10px;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12px;
  min-height: 28px;
  cursor: default;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.hoy-agenda-event.hoy-past { opacity: 0.55; }
.hoy-ev-hour {
  font-family: var(--mono);
  font-size: 10px;
  color: inherit;
  opacity: 0.75;
  line-height: 1.2;
}
.hoy-ev-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  color: inherit;
}
.hoy-loc {
  color: inherit;
  opacity: 0.7;
  font-weight: 400;
  font-size: 11px;
}
.hoy-agenda-event.hoy-ev-scheduled {
  background-image: repeating-linear-gradient(135deg, rgba(0,0,0,0.08), rgba(0,0,0,0.08) 4px, transparent 4px, transparent 10px);
}
.hoy-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px solid var(--accent, #60a5fa);
  pointer-events: none;
  display: flex;
  align-items: center;
}
.hoy-now-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent, #60a5fa);
  margin-left: 42px;
  transform: translate(-4px, 0);
}
.hoy-now-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--accent, #60a5fa);
  margin-left: 4px;
  background: var(--bg);
  padding: 0 4px;
}
.hoy-agenda-empty {
  position: absolute;
  left: 58px;
  top: 40%;
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
}

/* Sugerencias logicas */
.hoy-section-sugg {
  background: rgba(96,165,250,0.04);
  border-left: 3px solid var(--accent, #60a5fa);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.hoy-sugg-gap {
  margin-bottom: 12px;
}
.hoy-sugg-gap:last-child { margin-bottom: 0; }
.hoy-sugg-head {
  font-size: 12px;
  color: var(--text);
  margin-bottom: 6px;
}
.hoy-sugg-head em {
  color: var(--muted);
  font-style: italic;
}
.hoy-sugg-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 4px;
}
.hoy-sugg-list li {
  font-size: 12px;
  padding: 3px 0;
  color: var(--text);
}
.hoy-sugg-list li a {
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px dotted var(--muted);
}
.hoy-sugg-list li a:hover { border-bottom-style: solid; }
.hoy-sugg-mins {
  display: inline-block;
  min-width: 44px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  margin-right: 6px;
}

@media (max-width: 1100px) {
  .hoy-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .hoy-item { flex-wrap: wrap; }
  .hoy-time { min-width: 80px; }
}

/* Legacy grid-based layout elements (ahora ocultos, el panel usa secciones) */
.hoy-block {
  background: var(--surface, var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  min-height: 120px;
  min-width: 0;
  overflow: hidden;
}
.hoy-block h3 {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hoy-block h3 .hoy-count {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
  letter-spacing: 0;
}
.hoy-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 6px 0 10px;
  flex: 1;
}
.hoy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 12px;
}
.hoy-row:last-child { border-bottom: none; }
.hoy-row {
  min-width: 0;
}
.hoy-row-main {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hoy-tag {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--mono);
  background: rgba(255,255,255,0.04);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.hoy-actions { display: flex; gap: 4px; }
.hoy-chip {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-family: var(--mono);
  white-space: nowrap;
  background: rgba(255,255,255,0.05);
  color: var(--muted);
}
.hoy-chip.urgent { background: rgba(248,113,113,0.15); color: var(--error); }
.hoy-chip.warn   { background: rgba(251,191,36,0.15); color: var(--warning); }
.hoy-chip.ok     { background: rgba(52,211,153,0.15); color: var(--success); }
.hoy-more {
  font-size: 11px;
  color: var(--muted);
  padding: 6px 0 0;
  cursor: pointer;
}
.hoy-more:hover { color: var(--text); }
.hoy-foot {
  margin-top: auto;
  padding-top: 10px;
  font-size: 11px;
}
.hoy-foot a {
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}
.hoy-foot a:hover { color: var(--text); }

/* Bloque rutinas compacto */
.hoy-rutina-group {
  margin-bottom: 10px;
}
.hoy-rutina-title {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
}
.hoy-rutina-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.hoy-rutina-chip {
  font-size: 9px !important;
  padding: 2px 5px !important;
}

/* Bloque esferas */
.hoy-esferas {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.hoy-esfera {
  cursor: pointer;
}
.hoy-esfera-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}
.hoy-esfera-bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}
.hoy-esfera-bar > div {
  height: 100%;
  transition: width 0.4s ease;
}

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

/* ═══ HOY — Rediseño refinado (reticula de cards) ═══ */
#hoy-grid.hoy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: none;
  width: 100%;
  align-items: stretch;         /* que las celdas se estiren a la altura de la fila */
  grid-auto-rows: 1fr;          /* filas (de las 2 no-hero) todas con la misma altura */
}
.hoy-cell {
  min-width: 0;
  display: flex;
}
.hoy-cell > .hoy-section {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

/* Todas las tarjetas no-hero con altura uniforme + scroll interno si hace falta */
.hoy-cell:not(:has(.hoy-morn-esferas)) > .hoy-section {
  height: 360px;
  overflow: hidden;
}
.hoy-cell:not(:has(.hoy-morn-esferas)) > .hoy-section > .hoy-section-head { flex: 0 0 auto; }
.hoy-cell:not(:has(.hoy-morn-esferas)) > .hoy-section > *:not(.hoy-section-head) {
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
}
.hoy-cell > .hoy-section:hover { border-color: var(--border-hover); }

/* Unificar heads */
.hoy-cell .hoy-section-head {
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.hoy-cell .hoy-section-head h3 {
  font-size: 12px;
  letter-spacing: 1.2px;
}

/* Títulos de items: multi-linea por defecto dentro de la reticula */
.hoy-cell .hoy-item-main {
  white-space: normal;
  text-overflow: clip;
  overflow: visible;
}
/* Separador uniforme para items (sin dashed) */
.hoy-cell .hoy-item {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.hoy-cell .hoy-item:last-child { border-bottom: none; }

/* ── Esferas card (hero) ── */
.hoy-cell:has(.hoy-morn-esferas) { grid-column: 1 / -1; }
.hoy-morn-esferas {
  background: linear-gradient(135deg, rgba(91,156,246,0.06), rgba(139,92,246,0.04)) !important;
  border-color: var(--accent-dim) !important;
}
.hoy-morn-esf-scores {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 4px 0 16px;
}
.hoy-morn-esf-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: 1px solid var(--border);
  border-top: 2px solid var(--muted);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  position: relative;
}
.hoy-morn-esf-icon { font-size: 18px; }
.hoy-morn-esf-score {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.5px;
}
.hoy-morn-esf-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.hoy-morn-esf-action {
  font-size: 12px;
  color: var(--text);
  line-height: 1.45;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hoy-morn-esf-action .hoy-morn-esf-icon {
  font-size: 14px;
  opacity: 0.65;
  width: auto;
}

.hoy-morn-cal { border-left-width: 3px; border-left-style: solid; }
.hoy-morn-task a { cursor: pointer; text-decoration: none; color: var(--accent, #5b9cf6); }
.hoy-morn-task a:hover { text-decoration: underline; }
.hoy-morn-approval {
  background: rgba(251,191,36,0.05);
  border-left: 3px solid var(--warning, #fbbf24);
}
.hoy-morn-urgent { border-left: 3px solid var(--error, #f87171); }
.hoy-morn-urgent .hoy-section-head h3 { color: var(--error, #f87171); }

@media (max-width: 1200px) {
  #hoy-grid.hoy-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  #hoy-grid.hoy-grid { grid-template-columns: 1fr; }
  /* En movil, altura libre en las cards no-hero (no forzar 360px con scroll interno) */
  .hoy-cell:not(:has(.hoy-morn-esferas)) > .hoy-section {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .hoy-cell:not(:has(.hoy-morn-esferas)) > .hoy-section > *:not(.hoy-section-head) {
    overflow: visible;
  }
}
@media (max-width: 700px) {
  /* Pills compactos pero aun en 5 columnas (iconos+numero caben) */
  .hoy-morn-esf-scores { gap: 6px; }
  .hoy-morn-esf-pill { min-width: 0; padding: 6px 4px; }
  .hoy-morn-esf-icon { font-size: 14px; }
  .hoy-morn-esf-score { font-size: 18px; }

  /* Acciones: de 5 columnas apretadas a lista vertical con icon inline */
  .hoy-morn-esf-actions {
    grid-template-columns: 1fr;
    gap: 10px;
    padding-top: 14px;
  }
  .hoy-morn-esf-action {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    padding: 0;
  }
  .hoy-morn-esf-action .hoy-morn-esf-icon {
    font-size: 16px;
    min-width: 22px;
    text-align: center;
    opacity: 0.85;
    flex-shrink: 0;
  }
  .hoy-morn-esf-action > span:last-child {
    font-size: 13px;
    line-height: 1.45;
    flex: 1;
    min-width: 0;
    word-wrap: break-word;
  }
}

/* Ficha tareas simple */
.hoy-approvals-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(251,191,36,0.08);
  border-left: 3px solid var(--warning, #fbbf24);
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 10px;
}
.hoy-approvals-banner a { color: var(--accent, #5b9cf6); cursor: pointer; text-decoration: none; }
.hoy-approvals-banner a:hover { text-decoration: underline; }
.hoy-task-row {
  display: grid;
  grid-template-columns: 18px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
}
.hoy-task-row:last-child { border-bottom: none; }
.hoy-task-row:hover { background: rgba(91,156,246,0.05); }
.hoy-task-check {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}
.hoy-task-row.overdue .hoy-task-check { color: var(--error, #f87171); }
.hoy-task-text {
  color: var(--text, #e4e4e7);
  line-height: 1.4;
  min-width: 0;
  overflow-wrap: anywhere;
}
.hoy-task-date {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.03);
  white-space: nowrap;
}
.hoy-task-date.overdue { color: var(--error, #f87171); background: rgba(248,113,113,0.08); }
.hoy-task-date.today { color: var(--accent, #5b9cf6); background: rgba(91,156,246,0.1); }
.hoy-task-list {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  padding: 2px 6px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 3px;
  white-space: nowrap;
}
