/* ==========================================================================
   CENTRO DE MANDO — THE ZARO TIMES
   Design System: Apple / Linear Light Minimalist High-End Interface
   ========================================================================== */

:root {
  /* Fondo y Superficies */
  --bg-page: #F7F8FA;
  --surface-card: #FFFFFF;
  --surface-subtle: #F8FAFC;
  --surface-subtle-hover: #F1F5F9;
  --surface-border: rgba(0, 0, 0, 0.06);
  --surface-border-subtle: #F1F5F9;
  --surface-border-hover: rgba(0, 0, 0, 0.12);

  /* Texto y Jerarquía */
  --text-title: #0F172A;
  --text-primary: #1E293B;
  --text-secondary: #475569;
  --text-tertiary: #64748B;
  --text-muted: #94A3B8;

  /* Semáforos Píldoras Apple */
  --ok-bg: #ECFDF5;
  --ok-text: #059669;
  --ok-dot: #10B981;
  --ok-border: rgba(5, 150, 105, 0.16);

  --warn-bg: #FFFBEB;
  --warn-text: #D97706;
  --warn-dot: #F59E0B;
  --warn-border: rgba(217, 119, 6, 0.18);

  --err-bg: #FEF2F2;
  --err-text: #DC2626;
  --err-dot: #EF4444;
  --err-border: rgba(220, 38, 38, 0.18);

  /* Tipografía */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Monaco, Consolas, monospace;

  /* Sombras Multicapa Apple */
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 24px -4px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 2px 4px rgba(0, 0, 0, 0.04), 0 12px 30px -4px rgba(0, 0, 0, 0.06);
  --shadow-btn: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-btn-hover: 0 2px 6px rgba(0, 0, 0, 0.07);

  /* Curvaturas */
  --radius-card: 20px;
  --radius-metric: 14px;
  --radius-pill: 9999px;
  --radius-sm: 8px;

  /* Transiciones */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-fast: 0.15s ease;
}

/* Reset Global */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 15px;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  padding-bottom: env(safe-area-inset-bottom, 32px);
}

/* Contenedor Principal (Limpio, centrado, mobile-first) */
.shell {
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  padding: 24px 16px 40px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 560px) {
  .shell {
    padding: 36px 20px 56px 20px;
    gap: 20px;
  }
}

/* ==========================================================================
   CABECERA DEL PANEL (Limpia y aireada, sin cajas pesadas)
   ========================================================================== */
.app-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 4px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  animation: pulse-live 2.2s infinite ease-in-out;
}

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

.kicker-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

.brand-title {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

@media (min-width: 480px) {
  .brand-title {
    font-size: 1.75rem;
  }
}

/* Botón Actualizar (Píldora blanca refinada estilo Apple) */
.btn-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #FFFFFF;
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-btn);
  cursor: pointer;
  transition: all var(--ease-fast);
  white-space: nowrap;
  user-select: none;
}

.btn-refresh:hover {
  background: #FAFAFA;
  border-color: var(--surface-border-hover);
  box-shadow: var(--shadow-btn-hover);
  transform: translateY(-0.5px);
}

.btn-refresh:active {
  transform: translateY(0.5px);
  background: #F1F5F9;
}

.refresh-icon {
  width: 14px;
  height: 14px;
  color: var(--text-secondary);
  transition: transform 0.25s var(--ease-spring);
}

.btn-refresh.is-loading .refresh-icon {
  animation: spin 0.75s linear infinite;
  color: #2563EB;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Fila de subtítulo: resumen semáforo + última sincronización */
.header-sub {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (min-width: 500px) {
  .header-sub {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.summary-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}

.summary-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.pill-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-color: var(--ok-border);
}
.pill-ok .dot { background-color: var(--ok-dot); }

.pill-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}
.pill-warn .dot { background-color: var(--warn-dot); }

.pill-err {
  background: var(--err-bg);
  color: var(--err-text);
  border-color: var(--err-border);
}
.pill-err .dot { background-color: var(--err-dot); }

.last-sync {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   STACK DE TARJETAS (Blanco puro, bordes ultra-finos, sombras Apple)
   ========================================================================== */
.cards-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease-spring), border-color 0.2s var(--ease-spring);
}

.project-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--surface-border-hover);
}

/* Trigger clickeable de la tarjeta */
.card-trigger {
  padding: 20px 20px 14px 20px;
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 480px) {
  .card-trigger {
    padding: 22px 24px 16px 24px;
  }
}

/* Fila superior: Nombre + Dominio + Badge Píldora Apple */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-identity {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.project-name {
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--text-title);
  letter-spacing: -0.018em;
  line-height: 1.25;
}

.domain-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-subtle);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: all var(--ease-fast);
}

.domain-link:hover {
  color: #2563EB;
  background: #EFF6FF;
  border-color: rgba(37, 99, 235, 0.2);
}

/* Badge Píldora Apple */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}

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

.status-pill-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-color: var(--ok-border);
}
.status-pill-ok .status-dot { background-color: var(--ok-dot); }

.status-pill-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}
.status-pill-warn .status-dot { background-color: var(--warn-dot); }

.status-pill-err {
  background: var(--err-bg);
  color: var(--err-text);
  border-color: var(--err-border);
}
.status-pill-err .status-dot { background-color: var(--err-dot); }

/* Banda/Alerta Compacta para Fallo en GitHub Actions (Rojo suave Apple) */
.compact-alert {
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--err-bg);
  border: 1px solid var(--err-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.78rem;
  color: var(--err-text);
}

.compact-alert.is-visible {
  display: flex;
}

.alert-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--err-text);
  flex-shrink: 0;
}

.alert-content {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.alert-headline {
  font-weight: 600;
  color: #B91C1C;
}

.alert-detail {
  font-size: 0.74rem;
  color: #DC2626;
  font-variant-numeric: tabular-nums;
}

.alert-action-link {
  font-size: 0.72rem;
  font-weight: 600;
  color: #991B1B;
  text-decoration: underline;
  text-underline-offset: 2px;
  flex-shrink: 0;
}

.alert-action-link:hover {
  color: #7F1D1D;
}

/* Líneas de Estado Concisas */
.status-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.81rem;
}

.line-label {
  color: var(--text-tertiary);
  font-weight: 500;
  font-size: 0.77rem;
}

.line-value {
  color: var(--text-primary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.line-val-ok { color: var(--ok-text); font-weight: 600; }
.line-val-warn { color: var(--warn-text); font-weight: 600; }
.line-val-err { color: var(--err-text); font-weight: 600; }

/* 2 Cifras Clave en Bloques Limpios (2 columnas simétricas con fondo #F8FAFC) */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (min-width: 480px) {
  .metrics-grid {
    gap: 14px;
  }
}

.metric-card {
  background: var(--surface-subtle);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-metric);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: background 0.15s ease;
}

@media (min-width: 480px) {
  .metric-card {
    padding: 14px 16px;
  }
}

.project-card:hover .metric-card {
  background: #F4F6F9;
}

.metric-top-label {
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.metric-big-num {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

@media (min-width: 480px) {
  .metric-big-num {
    font-size: 1.85rem;
  }
}

.metric-unit {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0;
  margin-left: 2px;
}

.metric-subtext {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pie de Tarjeta con Barra de Pendientes y Resumen Minimalista */
.card-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
}

.todos-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-weight: 500;
  min-height: 22px;
  flex-wrap: wrap;
}

.todos-summary-pill:empty {
  display: none;
}

.todos-count-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-tertiary);
}

.todos-badge-due {
  font-size: 0.67rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid rgba(217, 119, 6, 0.22);
  letter-spacing: -0.01em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.todos-badge-due.badge-blue {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.card-footer-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  padding-top: 0;
  color: var(--text-tertiary);
  font-size: 0.76rem;
  font-weight: 500;
  transition: color var(--ease-fast);
  flex-shrink: 0;
  margin-left: auto;
}

.card-trigger:hover .card-footer-toggle {
  color: var(--text-primary);
}

.toggle-chevron {
  transition: transform 0.25s var(--ease-spring);
  color: var(--text-muted);
}

.project-card.is-open .toggle-chevron {
  transform: rotate(180deg);
  color: var(--text-primary);
}

/* ==========================================================================
   DETALLE DESPLEGABLE ESTILO LINEAR (Separador fino #F1F5F9)
   ========================================================================== */
.card-accordion-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s var(--ease-spring);
  border-top: 1px solid transparent;
}

.project-card.is-open .card-accordion-wrapper {
  grid-template-rows: 1fr;
  border-top: 1px solid var(--surface-border-subtle);
}

.card-accordion-content {
  overflow: hidden;
}

.detail-container {
  padding: 18px 20px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #FCFDFE;
}

@media (min-width: 480px) {
  .detail-container {
    padding: 20px 24px 24px 24px;
    gap: 18px;
  }
}

/* Callouts Minimalistas Estilo Linear */
.linear-callout {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  line-height: 1.45;
}

.linear-callout code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.05);
}

.callout-badge {
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.callout-indigo {
  background: #EEF2FF;
  border: 1px solid #E0E7FF;
  color: #3730A3;
}
.callout-indigo .callout-badge {
  background: #4F46E5;
  color: #FFFFFF;
}

.callout-amber {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
}
.callout-amber .callout-badge {
  background: #D97706;
  color: #FFFFFF;
}

/* Fila de Tags Técnicos */
.tech-tags-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tech-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  border: 1px solid var(--surface-border-subtle);
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
}

/* Bloque Estilo Linear */
.linear-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.block-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.block-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-title);
  letter-spacing: -0.01em;
}

.block-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Tabla Estilo Linear para Ejecuciones GitHub Actions */
.linear-table {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--surface-border-subtle);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  overflow: hidden;
}

.table-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  font-size: 0.77rem;
  border-bottom: 1px solid var(--surface-border-subtle);
  transition: background var(--ease-fast);
}

.table-row:last-child {
  border-bottom: none;
}

.table-row:hover {
  background: #F8FAFC;
}

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

.row-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.row-pill-success { background: var(--ok-bg); color: var(--ok-text); }
.row-pill-failure { background: var(--err-bg); color: var(--err-text); }
.row-pill-progress { background: var(--warn-bg); color: var(--warn-text); }

.row-time {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.row-duration {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.row-link {
  font-size: 0.72rem;
  font-weight: 500;
  color: #2563EB;
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background var(--ease-fast);
}

.row-link:hover {
  background: #EFF6FF;
}

/* Feed Estilo Linear para Noticias / Artículos RSS */
.linear-feed {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--surface-border-subtle);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  overflow: hidden;
}

.feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  text-decoration: none;
  border-bottom: 1px solid var(--surface-border-subtle);
  transition: background var(--ease-fast);
}

.feed-item:last-child {
  border-bottom: none;
}

.feed-item:hover {
  background: #F8FAFC;
}

.feed-title {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.feed-item:hover .feed-title {
  color: #2563EB;
}

.feed-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.feed-cat {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-subtle);
  color: var(--text-tertiary);
  font-size: 0.68rem;
  font-weight: 500;
}

/* Propuestas Comerciales en Energelia (Importes alineados a la derecha) */
.proposals-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--surface-border-subtle);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  overflow: hidden;
}

.proposal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--surface-border-subtle);
}

.proposal-row:last-child {
  border-bottom: none;
}

.proposal-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.proposal-name {
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--text-title);
}

.proposal-desc {
  font-size: 0.73rem;
  color: var(--text-tertiary);
}

.proposal-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.proposal-amount {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-title);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.proposal-pill {
  font-size: 0.66rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: #EFF6FF;
  color: #2563EB;
}

.proposal-pill.pill-subtle {
  background: #F1F5F9;
  color: #64748B;
}

/* ==========================================================================
   PIE DE PÁGINA
   ========================================================================== */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.74rem;
  color: var(--text-muted);
  padding: 12px 0;
}

.footer-sep {
  opacity: 0.4;
}

/* Toast Flotante */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: #0F172A;
  color: #F8FAFC;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s var(--ease-spring);
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   SECCIÓN PENDIENTES Y APARCADOS (Estilo Apple Reminders / Linear)
   ========================================================================== */
.todos-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.todos-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.todos-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 1px;
}

.todos-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-title);
  letter-spacing: -0.01em;
}

.todos-subtitle {
  font-size: 0.69rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Formulario Rápido Inline (+ Añadir pendiente...) */
.todo-form-box {
  background: #F8FAFC;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.todo-form-box:focus-within {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.06);
}

.todo-form-inputs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.todo-input-title {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 0.81rem;
  font-family: var(--font-sans);
  color: var(--text-title);
  outline: none;
  transition: border-color 0.15s ease;
}

.todo-input-title::placeholder {
  color: #94A3B8;
}

.todo-input-title:focus {
  border-color: #2563EB;
}

.todo-input-note {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 0.74rem;
  font-family: var(--font-sans);
  color: #64748B;
  outline: none;
  transition: border-color 0.15s ease;
}

.todo-input-note::placeholder {
  color: #94A3B8;
}

.todo-input-note:focus {
  border-color: #2563EB;
}

.todo-form-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.todo-form-selectors {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.todo-select,
.todo-input-date {
  height: 27px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 0.71rem;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.todo-select:focus,
.todo-input-date:focus {
  border-color: #2563EB;
}

.todo-btn-save {
  height: 27px;
  background: #0F172A;
  color: #FFFFFF;
  border: none;
  border-radius: 6px;
  padding: 0 13px;
  font-size: 0.74rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: background 0.15s ease, transform 0.08s ease;
}

.todo-btn-save:hover {
  background: #1E293B;
}

.todo-btn-save:active {
  transform: scale(0.97);
}

/* Listas de Tareas */
.todos-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--surface-border-subtle);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  overflow: hidden;
}

.todo-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--surface-border-subtle);
  transition: background 0.12s ease;
}

.todo-row:last-child {
  border-bottom: none;
}

.todo-row:hover {
  background: #F8FAFC;
}

.todo-left {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  flex: 1;
  min-width: 0;
}

/* Checkbox circular estilo Apple Reminders / Linear */
.todo-circle-checkbox {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1.5px solid #94A3B8;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  margin-top: 2px;
  color: transparent;
  transition: all 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.todo-circle-checkbox:hover {
  border-color: #2563EB;
  background: rgba(37, 99, 235, 0.08);
}

.todo-circle-checkbox.is-checked {
  background: #10B981;
  border-color: #10B981;
  color: #FFFFFF;
}

.todo-circle-checkbox.is-checked:hover {
  background: #059669;
  border-color: #059669;
}

.todo-circle-checkbox svg {
  width: 9px;
  height: 9px;
  stroke: currentColor;
}

.todo-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.todo-title {
  font-size: 0.80rem;
  font-weight: 500;
  color: var(--text-title);
  line-height: 1.35;
  word-break: break-word;
}

.todo-note {
  font-size: 0.72rem;
  color: #64748B;
  line-height: 1.3;
  word-break: break-word;
}

.todo-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-top: 1px;
}

.todo-pill-date {
  font-size: 0.67rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid rgba(37, 99, 235, 0.16);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.todo-pill-date.date-amber {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid rgba(217, 119, 6, 0.22);
}

.todo-badge-author {
  font-size: 0.65rem;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 4px;
  background: #F1F5F9;
  color: #64748B;
  text-transform: capitalize;
}

.todo-action-icon-btn {
  width: 21px;
  height: 21px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  transition: background 0.12s, color 0.12s;
  line-height: 1;
}

.todo-action-icon-btn:hover {
  background: #F1F5F9;
  color: var(--text-primary);
}

.todo-action-icon-btn.btn-delete:hover {
  background: #FEF2F2;
  color: #DC2626;
}

/* Subsección de Aparcados */
.todo-subheading,
.todos-subheading {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  text-transform: uppercase;
  margin-top: 8px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.todo-row-parked {
  background: #FBFBFC;
}

.park-icon {
  font-size: 0.70rem;
  color: #D97706;
  line-height: 1;
  display: inline-flex;
}

.btn-reactivate {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #334155;
  font-size: 0.67rem;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}

.btn-reactivate:hover {
  background: #F1F5F9;
  border-color: #94A3B8;
  color: #0F172A;
}

/* Subsección Plegable de Completados */
.todos-completed-wrap {
  margin-top: 4px;
}

.todos-completed-details {
  border: 1px solid var(--surface-border-subtle);
  border-radius: var(--radius-sm);
  background: #FAFAFB;
  overflow: hidden;
}

.todos-completed-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 11px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: color 0.12s;
}

.todos-completed-summary:hover {
  color: var(--text-secondary);
}

.todos-completed-chevron {
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

.todos-completed-details[open] .todos-completed-chevron {
  transform: rotate(180deg);
}

.todo-title-done {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-row-done {
  opacity: 0.72;
}

.todo-row-done:hover {
  opacity: 1;
}

.todos-empty-state {
  padding: 12px;
  text-align: center;
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* ==========================================================================
   FASE 3 — AGENTE CEO Y ACCIONES (Diseño minimalista Apple / Linear)
   ========================================================================== */
.agents-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 2px;
}

.agent-section {
  background: #FFFFFF;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.agent-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 1px;
}

.agent-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-badge-pill {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: #EEF2FF;
  color: #4F46E5;
  border: 1px solid rgba(79, 70, 229, 0.2);
}

.agent-section-title {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.01em;
}

.agent-section-subtitle {
  font-size: 0.69rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Botón Destacado del CEO y Cuadrícula de Acciones */
.agent-actions-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-ceo {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid #0F172A;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.14);
  cursor: pointer;
  transition: all 0.16s var(--ease-spring);
  text-align: center;
  outline: none;
}

.btn-ceo:hover {
  background: #000000;
  border-color: #000000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

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

.btn-ceo.is-active {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
  border-color: #2563EB;
}

.btn-ceo-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.agent-action-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 7px;
}

.btn-agent-action {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 11px;
  border-radius: 9px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
  min-height: 38px;
  line-height: 1.3;
  outline: none;
}

.btn-agent-action:hover {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: var(--text-title);
  transform: translateY(-1px);
}

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

.btn-agent-action.is-active {
  background: #EFF6FF;
  border-color: #93C5FD;
  color: #1D4ED8;
  box-shadow: 0 0 0 2.5px rgba(59, 130, 246, 0.22);
}

/* Barra / Caja de Confirmación Inline Obligatoria */
.agent-confirm-box {
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: 11px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: agentSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

@keyframes agentSlideDown {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.confirm-header {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.confirm-prompt-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: #B45309;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.confirm-title {
  font-size: 0.81rem;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.01em;
}

.confirm-desc {
  font-size: 0.73rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.confirm-param-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.confirm-label {
  font-size: 0.70rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.confirm-input {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 7px;
  padding: 7px 11px;
  font-size: 0.78rem;
  font-family: var(--font-sans);
  color: var(--text-title);
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.confirm-input:focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.confirm-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.btn-agent-cancel {
  padding: 6px 13px;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  font-weight: 500;
  border-radius: 7px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
  outline: none;
}

.btn-agent-cancel:hover {
  background: #F1F5F9;
  color: var(--text-title);
}

.btn-agent-confirm {
  padding: 6px 14px;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  font-weight: 600;
  border-radius: 7px;
  background: #0071E3;
  border: 1px solid #0071E3;
  color: #FFFFFF;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0, 113, 227, 0.25);
  transition: all 0.14s ease;
  outline: none;
}

.btn-agent-confirm:hover {
  background: #0060C0;
  border-color: #0060C0;
}

.btn-agent-confirm.is-loading {
  opacity: 0.85;
  pointer-events: none;
  cursor: wait;
}

.btn-confirm-spinner {
  display: none;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: agentSpin 0.6s linear infinite;
}

.btn-agent-confirm.is-loading .btn-confirm-spinner {
  display: inline-block;
}

@keyframes agentSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Visor del Último Resultado del CEO / Agente */
.agent-viewer-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 11px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease;
}

.agent-viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid #EEF2F6;
}

.agent-viewer-badge-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.agent-viewer-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.01em;
}

.agent-status-pill {
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.02em;
}

.agent-status-pill.pill-ok {
  background: #ECFDF5;
  color: #059669;
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.agent-status-pill.pill-err {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.agent-meta-tag {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-copy-result {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text-secondary);
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
  margin-left: auto;
  outline: none;
}

.btn-copy-result:hover {
  background: #F1F5F9;
  color: var(--text-title);
  border-color: #94A3B8;
}

.btn-copy-result.is-copied {
  background: #ECFDF5;
  color: #059669;
  border-color: #A7F3D0;
}

.agent-viewer-content {
  font-size: 0.79rem;
  line-height: 1.6;
  color: var(--text-primary);
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.agent-formatted-output {
  white-space: pre-wrap;
  word-break: break-word;
}

.agent-bullet-list {
  list-style: none;
  margin: 6px 0;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.agent-bullet-item {
  position: relative;
  padding-left: 14px;
}

.agent-bullet-item::before {
  content: "•";
  position: absolute;
  left: 2px;
  color: #3B82F6;
  font-weight: bold;
}

.agent-output-heading {
  font-size: 0.81rem;
  font-weight: 700;
  color: var(--text-title);
  margin: 8px 0 4px 0;
}

.agent-output-sep {
  height: 8px;
}

.agent-viewer-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.agent-viewer-empty .empty-icon {
  font-size: 1.3rem;
  line-height: 1;
  opacity: 0.7;
}

/* Historial de Últimas Ejecuciones */
.agent-history-block {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 2px;
}

.agent-history-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 2px;
}

.agent-history-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.agent-history-subtitle {
  font-size: 0.69rem;
  color: var(--text-muted);
  font-weight: 500;
}

.agent-history-list {
  display: flex;
  flex-direction: column;
  border: 1px solid #E2E8F0;
  border-radius: 9px;
  overflow: hidden;
  background: #FFFFFF;
}

.agent-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  cursor: pointer;
  transition: background 0.12s ease;
  border-bottom: 1px solid #F1F5F9;
  user-select: none;
  outline: none;
}

.agent-history-row:last-child {
  border-bottom: none;
}

.agent-history-row:hover {
  background: #F8FAFC;
}

.agent-history-row.is-selected {
  background: #F1F5F9;
  box-shadow: inset 3px 0 0 #0071E3;
}

.agent-history-row-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.agent-history-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-title);
  white-space: nowrap;
}

.agent-history-summary {
  font-size: 0.71rem;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.agent-history-row-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  font-size: 0.69rem;
  color: var(--text-muted);
}

.agent-history-time {
  white-space: nowrap;
}

.agent-history-dur {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: #F1F5F9;
  color: var(--text-secondary);
  white-space: nowrap;
}

.agent-history-arrow {
  color: var(--text-muted);
  transition: transform 0.12s ease;
}

.agent-history-row:hover .agent-history-arrow {
  transform: translateX(2px);
  color: var(--text-primary);
}

.agent-history-empty {
  padding: 14px 12px;
  text-align: center;
  font-size: 0.73rem;
  color: var(--text-muted);
}

@media (max-width: 480px) {
  .agent-history-summary {
    max-width: 140px;
  }
  .agent-action-buttons-grid {
    grid-template-columns: 1fr;
  }
}
