/* ═══════════════════════════════════════════════════════ */
/* Kyroon Lite PWA — Redesenho Telas Internas (pwa-10)    */
/* Autoria: Juliana Vasconcelos — Designer UX/UI Senior   */
/* ═══════════════════════════════════════════════════════ */

:root {
  /* Surfaces — charcoal neutro (saturação zero), spec §2.4 */
  --bg-base: #0D0D0D;
  --bg-surface: #111111;
  --bg-card: #141414;
  --bg-input: #171717;
  --bg-elevated: #1C1C1C;
  --bg-elevated-2: #222222;

  /* Primary — azul Kyron #4DA3FF, spec §2.1 */
  --accent: #4DA3FF;
  --accent-light: #5CC8FF;
  --accent-dim: #0D2A4A;
  --accent-glow: rgba(77, 163, 255, 0.35);

  /* Secondary — roxo Kyron (complementar ao azul primário) */
  --secondary: #6B5BFF;
  --secondary-dim: #1E1854;

  /* Text */
  --text-primary: #E0E0E0;
  --text-muted: #A0A0A0;
  --text-caption: #707070;

  /* Border */
  --border: #2A2A2A;
  --border-light: #363636;

  /* Semantic */
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  /* Status — alinhado ao enum TaskStatus do banco */
  --status-pending: #9E9E9E;        /* Planejada   = 1 */
  --status-refinamento: #64B5F6;   /* Refinamento = 2 */
  --status-running: #FF9800;        /* EmExecucao  = 3 */
  --status-done: #4CAF50;           /* Finalizada  = 4 */
  --status-failed: #F44336;         /* Falhou      = 5 */
  --status-cancelled: #78909C;      /* Cancelada   = 6 */
  --status-gate: #FFB300;           /* AguardAprov = 7 */

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  /* Shadows */
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-fab: 0 8px 24px rgba(77, 163, 255, 0.4);
}

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

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  position: relative;
  overflow: hidden;
}

/* ── Screen ── */
.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  animation: screen-enter 220ms ease;
}
.screen.active { display: flex; }

@keyframes screen-enter {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes loadingPulse {
  0%,100% { opacity: 1; }
  50%      { opacity: .4; }
}

/* ═══════════════════════════════════════════════════════ */
/* HEADER                                                  */
/* ═══════════════════════════════════════════════════════ */

.app-header {
  flex-shrink: 0;
  position: relative;
  padding: 16px 16px 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.app-header.gradient-header {
  background:
    radial-gradient(ellipse at top left, rgba(77, 163, 255, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse at top right, rgba(107, 91, 255, 0.07) 0%, transparent 45%),
    var(--bg-surface);
}

.app-header.detail-header {
  padding-bottom: 18px;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.header-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.screen-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  font-family: var(--font-heading);
}

.project-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  width: fit-content;
  cursor: pointer;
  transition: all 150ms;
}
.project-pill:active { transform: scale(0.97); background: var(--bg-elevated-2); }
.project-dot {
  width: 8px; height: 8px; border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}
.project-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.chevron { font-size: 16px !important; color: var(--text-caption); }

.tenant-line {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.tenant-line .material-symbols-rounded { font-size: 13px !important; }

.header-title-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}
.header-eyebrow { font-size: 11px; font-weight: 700; color: var(--accent-light); letter-spacing: 0.8px; text-transform: uppercase; }
.header-tenant { font-size: 12px; color: var(--text-muted); }

/* ── Avatar ── */
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #FFFFFF;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(77, 163, 255, 0.4);
  border: none;
  cursor: pointer;
}
.avatar-btn { transition: transform 150ms; }
.avatar-btn:active { transform: scale(0.93); }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 150ms;
}
.icon-btn:active { background: var(--bg-elevated-2); }
.icon-btn .material-symbols-rounded { font-size: 20px !important; }

/* ── Search ── */
.brand-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}
.brand-bar-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  opacity: 0.65;
}
.brand-bar-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-caption);
}

.search-row { margin-top: 0; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 6px 0 12px;
  height: 44px;
  transition: border-color 150ms, box-shadow 150ms;
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-icon {
  color: var(--text-muted);
  font-size: 20px !important;
}
.search-input {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 0 10px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
}
.search-input::placeholder { color: var(--text-muted); }

.search-filter-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-light);
  cursor: pointer;
  transition: background 150ms;
}
.search-filter-btn:active { background: var(--accent-dim); }
.search-filter-btn .material-symbols-rounded { font-size: 18px !important; }

/* ── Filter DDLs ── */
.filter-row {
  display: flex; gap: 8px;
  padding: 10px 0 14px;
}
.filter-select-wrap {
  flex: 1; position: relative; display: flex; align-items: center;
}
.filter-sel-icon {
  position: absolute; left: 10px; font-size: 17px;
  color: var(--text-muted); pointer-events: none; z-index: 1;
}
.filter-chevron {
  position: absolute; right: 8px; font-size: 17px;
  color: var(--text-muted); pointer-events: none; z-index: 1;
}
.filter-select {
  width: 100%; height: 38px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 30px 0 32px;
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  cursor: pointer; outline: none; appearance: none; -webkit-appearance: none;
  font-family: inherit; transition: border-color 0.15s;
}
.filter-select:focus { border-color: var(--accent); }
.filter-select option { background: var(--bg-elevated); color: var(--text-primary); }
.filter-pin-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  padding: 6px 9px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  height: 36px;
}
.filter-pin-btn:hover { color: var(--accent); border-color: var(--accent); }
.filter-pin-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(124,58,237,0.12);
}
.filter-pin-btn .material-symbols-rounded { font-size: 18px; }

/* ── Filter Chips (Notifications) ── */
.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 14px 0 14px;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
}
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chips.small { padding-top: 12px; padding-bottom: 10px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-caption);
  cursor: pointer;
  transition: all 150ms;
  white-space: nowrap;
  font-family: inherit;
}
.chip:active { transform: scale(0.96); }
.chip.active {
  background: linear-gradient(135deg, var(--accent-dim), rgba(77, 163, 255, 0.15));
  border-color: var(--accent);
  color: var(--accent-light);
  box-shadow: 0 0 0 1px var(--accent-glow);
}
.chip-dot {
  width: 6px; height: 6px; border-radius: 50%;
}
.chip-count {
  background: var(--bg-input);
  border-radius: 8px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-caption);
  min-width: 18px;
  text-align: center;
}
.chip.active .chip-count {
  background: rgba(77, 163, 255, 0.22);
  color: var(--accent-light);
}

/* ═══════════════════════════════════════════════════════ */
/* SCROLL AREA                                             */
/* ═══════════════════════════════════════════════════════ */

.scroll-area {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px 0;
}
.scroll-area::-webkit-scrollbar { width: 3px; }
.scroll-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.scroll-spacer { height: 88px; }
.scroll-spacer-lg { height: 68px; }

/* ── Section Header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 10px;
}
.section-header:first-child { margin-top: 8px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title h2 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-caption);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.section-title .material-symbols-rounded {
  font-size: 16px !important;
  color: var(--text-muted);
}
.section-title .warn-icon { color: var(--status-failed); }

.section-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px 8px;
  color: var(--text-caption);
}

.live-section .section-title h2 { color: var(--status-running); }
.log-tag.refinamento { background: rgba(100, 181, 246, 0.18); color: var(--status-refinamento); }
.attention-section .section-title h2 { color: var(--status-failed); }
.notif-section { margin: 16px 0 10px; }
.notif-section h2 { font-size: 12px; font-weight: 700; color: var(--text-caption); text-transform: uppercase; letter-spacing: 0.8px; }

.live-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-running);
  position: relative;
  box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.7);
  animation: live-ping 1.6s infinite;
}
@keyframes live-ping {
  0% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(255, 152, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); }
}

/* ═══════════════════════════════════════════════════════ */
/* TASK CARD                                               */
/* ═══════════════════════════════════════════════════════ */

.task-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 180ms;
  overflow: hidden;
  display: flex;
}
.task-card:active {
  background: var(--bg-elevated);
  transform: scale(0.99);
}
.task-card.muted { opacity: 0.65; }

.card-status-strip {
  width: 4px;
  flex-shrink: 0;
  background: var(--border);
  position: relative;
}
.task-card.status-refinamento .card-status-strip { background: var(--status-refinamento); }
.task-card.status-running .card-status-strip { background: var(--status-running); }
.task-card.status-done .card-status-strip { background: var(--status-done); }
.task-card.status-failed .card-status-strip { background: var(--status-failed); }
.task-card.status-cancelled .card-status-strip { background: var(--status-cancelled); }
.task-card.status-gate .card-status-strip { background: var(--status-gate); }

.status-pulse {
  position: absolute;
  inset: 0;
  background: inherit;
}
.running-pulse { animation: strip-pulse 2s ease-in-out infinite; }
.gate-pulse { animation: strip-pulse 1.8s ease-in-out infinite; }
@keyframes strip-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.card-body {
  flex: 1;
  padding: 11px 12px 10px;
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 8px;
}

.card-title-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.35;
  letter-spacing: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.priority-flag {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.priority-flag .material-symbols-rounded { font-size: 16px !important; }
.priority-flag.low { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }
.priority-flag.medium { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.priority-flag.high { background: rgba(245, 158, 11, 0.18); color: var(--warning); }
.priority-flag.critical { background: rgba(239, 68, 68, 0.2); color: var(--danger); animation: critical-pulse 1.5s ease-in-out infinite; }
@keyframes critical-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

/* ── Status Badge ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  width: fit-content;
  border: 1px solid transparent;
}
.status-badge.large { padding: 3px 9px; font-size: 10px; }
.status-badge .material-symbols-rounded { font-size: 11px !important; }
.status-badge .dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.status-badge .dot.pulsing { animation: dot-pulse 1.4s ease-in-out infinite; }
@keyframes dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

.status-badge.pending      { background: rgba(158, 158, 158, 0.12); color: var(--status-pending);      border-color: rgba(158, 158, 158, 0.25); }
.status-badge.refinamento  { background: rgba(100, 181, 246, 0.15); color: var(--status-refinamento); border-color: rgba(100, 181, 246, 0.3); }
.status-badge.running      { background: rgba(255, 152, 0, 0.15);   color: var(--status-running);      border-color: rgba(255, 152, 0, 0.3); }
.status-badge.done     { background: rgba(16, 185, 129, 0.15); color: var(--status-done); border-color: rgba(16, 185, 129, 0.3); }
.status-badge.failed   { background: rgba(239, 68, 68, 0.15); color: var(--status-failed); border-color: rgba(239, 68, 68, 0.3); }
.status-badge.cancelled{ background: rgba(100, 116, 139, 0.12); color: var(--status-cancelled); border-color: rgba(100, 116, 139, 0.25); }
.status-badge.gate     { background: rgba(245, 158, 11, 0.15); color: var(--status-gate); border-color: rgba(245, 158, 11, 0.35); }

/* ── Agent Chip ── */
.agent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.agent-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.agent-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #FFFFFF;
  flex-shrink: 0;
}

.agent-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.agent-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.agent-role { font-size: 10px; color: var(--text-muted); }

/* ── Progress block (dots) ── */
.progress-block {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.step-dots {
  display: flex;
  gap: 4px;
  flex: 1;
}
.step-dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-elevated);
}
.step-dot.done { background: var(--accent); }
.step-dot.current {
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  position: relative;
  overflow: hidden;
}
.step-dot.current::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: dot-shimmer 1.6s linear infinite;
}
@keyframes dot-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.step-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Gate context ── */
.gate-context {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}
.gate-context .material-symbols-rounded {
  font-size: 16px !important;
  color: var(--status-gate);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Quick actions ── */
.quick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.qa-btn {
  flex: 1;
  height: 30px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms;
  border: 1px solid transparent;
  font-family: inherit;
}
.qa-btn .material-symbols-rounded { font-size: 16px !important; }
.qa-btn.approve {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-done);
  border-color: rgba(16, 185, 129, 0.35);
}
.qa-btn.approve:active { background: rgba(16, 185, 129, 0.28); }
.qa-btn.reject {
  background: rgba(239, 68, 68, 0.12);
  color: var(--status-failed);
  border-color: rgba(239, 68, 68, 0.3);
}
.qa-btn.reject:active { background: rgba(239, 68, 68, 0.22); }

/* ── Error snippet ── */
.error-snippet {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  margin-bottom: 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--status-failed);
}
.error-snippet .material-symbols-rounded { font-size: 14px !important; flex-shrink: 0; }
.error-snippet code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Card footer ── */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.card-footer.slim { margin-top: 4px; }

.footer-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.footer-pill.ghost { color: var(--text-caption); }
.task-id-ref { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px; letter-spacing: 0.3px; }
.footer-pill .material-symbols-rounded { font-size: 13px !important; }
.footer-pill.warn-pill { color: var(--status-gate); font-weight: 600; }
.footer-pill.error-pill {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--status-failed);
  font-weight: 700;
}
.footer-time {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text-caption);
  font-weight: 500;
  flex-shrink: 0;
}
.footer-time .material-symbols-rounded { font-size: 12px !important; }

/* ═══════════════════════════════════════════════════════ */
/* EMPTY STATE                                             */
/* ═══════════════════════════════════════════════════════ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
  gap: 14px;
}

.empty-icon {
  width: 72px;
  height: 72px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-icon .material-symbols-rounded {
  font-size: 36px !important;
  color: var(--text-muted);
}

.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-heading);
}
.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 280px;
}
.empty-action {
  margin-top: 8px;
  height: 40px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent-light);
  border: 1px solid var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 150ms;
}
.empty-action:active { background: var(--accent); color: #FFFFFF; }

/* ═══════════════════════════════════════════════════════ */
/* FAB                                                     */
/* ═══════════════════════════════════════════════════════ */

.fab {
  position: absolute;
  right: 18px;
  bottom: 78px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  cursor: pointer;
  box-shadow: var(--shadow-fab);
  z-index: 20;
  transition: transform 180ms;
}
.fab:active { transform: scale(0.92); }
.fab .material-symbols-rounded { font-size: 22px !important; }

.brand-refresh-btn {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  cursor: pointer;
  transition: color 150ms, background 150ms;
}
.brand-refresh-btn:hover  { color: var(--accent-light); background: var(--bg-elevated); }
.brand-refresh-btn:active { transform: scale(0.9); }
.brand-refresh-btn .material-symbols-rounded { font-size: 17px !important; }
.brand-refresh-btn.spinning .material-symbols-rounded {
  animation: fab-spin 600ms linear;
}
@keyframes fab-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════ */
/* BOTTOM NAV                                              */
/* ═══════════════════════════════════════════════════════ */

.bottom-nav {
  height: 68px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding-top: 8px;
  cursor: pointer;
  position: relative;
  background: transparent;
  border: none;
  color: var(--text-muted);
  transition: color 150ms;
  font-family: inherit;
}
.nav-item:active { background: var(--bg-elevated); }
.nav-item.active { color: var(--accent-light); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 36px; height: 3px;
  background: var(--accent-light);
  border-radius: 0 0 4px 4px;
}

.nav-icon {
  font-size: 20px !important;
  color: inherit;
}
.nav-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.nav-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: linear-gradient(135deg, var(--danger), #F87171);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
}

/* ═══════════════════════════════════════════════════════ */
/* DETAIL — Hero                                           */
/* ═══════════════════════════════════════════════════════ */

.detail-hero {
  margin-top: 8px;
}
.detail-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.detail-title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  letter-spacing: -0.1px;
  font-family: var(--font-heading);
}
.detail-title-row .status-badge {
  flex-shrink: 0;
  margin-top: 2px;
}
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-caption);
}
.meta-chip .material-symbols-rounded {
  font-size: 13px !important;
  color: var(--text-muted);
}

/* ── Slug ── */
.detail-slug {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text-muted);
  background: var(--bg-input); border-radius: 4px;
  padding: 3px 8px; display: inline-block;
  letter-spacing: 0.2px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Exec buttons row ── */
.exec-btns-row {
  display: flex; gap: 8px; margin-top: 12px;
}
.exec-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; border: 1px solid transparent;
  touch-action: manipulation; transition: all 150ms;
}
.exec-btn .material-symbols-rounded { font-size: 16px !important; }
.exec-btn.dispatch  { background: var(--accent); color: #fff; border-color: var(--accent); }
.exec-btn.interrupt { background: rgba(239,68,68,0.12); color: var(--status-failed); border-color: rgba(239,68,68,0.3); }
.exec-btn.retry     { background: rgba(245,158,11,0.12); color: var(--status-gate); border-color: rgba(245,158,11,0.3); }
.exec-btn:active { transform: scale(0.97); }

/* ── Detail Tab bar ── */
.detail-tabs {
  display: flex; gap: 0;
  margin-top: 14px; border-bottom: 1px solid var(--border);
}
.detail-tab-btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); background: transparent;
  border: none; border-bottom: 2px solid transparent;
  margin-bottom: -1px; cursor: pointer; font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
  touch-action: manipulation;
}
.detail-tab-btn .material-symbols-rounded { font-size: 16px !important; }
.detail-tab-btn:hover { color: var(--text-primary); }
.detail-tab-btn.active { color: var(--accent-light); border-bottom-color: var(--accent-light); }

/* ── Tab panes ── */
.detail-tab-pane { display: none; }
.detail-tab-pane.active { display: block; }

/* ── Gate Banner ── */
.gate-banner {
  margin: 0 0 8px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.35);
  border-left: 4px solid var(--status-gate);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--status-gate) transparent;
}
.gate-banner::-webkit-scrollbar { width: 4px; }
.gate-banner::-webkit-scrollbar-thumb { background: var(--status-gate); border-radius: 4px; }
.gate-banner::-webkit-scrollbar-track { background: transparent; }
.gate-banner-header { display: flex; gap: 10px; align-items: flex-start; }
.gate-banner-header .material-symbols-rounded { color: var(--status-gate); font-size: 22px !important; flex-shrink: 0; margin-top: 2px; }
.gate-title { font-size: 14px; font-weight: 700; color: var(--status-gate); }
.gate-subtype { font-size: 11px; color: var(--text-muted); margin-top: 1px; text-transform: uppercase; letter-spacing: 0.4px; }
.gate-context-text { margin-top: 10px; }
/* Remove o frame do description-card quando dentro do gate banner */
.gate-banner .description-card {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--text-caption);
}
.gate-input {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 13px; color: var(--text-primary); resize: none;
  font-family: inherit; outline: none;
}
.gate-input:focus { border-color: var(--status-gate); }
.gate-input::placeholder { color: var(--text-muted); }
.gate-quick-actions { display: flex; gap: 8px; }
.gate-quick-actions .qa-btn { flex: 1; justify-content: center; height: 40px; }

/* ═══════════════════════════════════════════════════════════════════════════
   Approval Gate Bottom Sheet
   ═══════════════════════════════════════════════════════════════════════════ */

.gate-sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(7, 7, 12, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1200;
}
.gate-sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.gate-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
  transform: translateY(110%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 1201;
  padding-bottom: env(safe-area-inset-bottom);
}
.gate-sheet.open { transform: translateY(0); }
.gate-sheet-handle {
  width: 36px; height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  margin: 10px auto 0;
}
.gate-sheet-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}
.gate-sheet-close:active { color: var(--text-primary); }
.gate-sheet-close .material-symbols-rounded { font-size: 22px !important; }

.gate-sheet-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px 14px 20px;
}
.gate-sheet-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--status-gate);
  flex-shrink: 0;
}
.gate-sheet-icon .material-symbols-rounded { font-size: 22px !important; }
.gate-sheet-icon::before {
  content: '';
  position: absolute;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 2px solid var(--status-gate);
  opacity: 0.35;
  animation: gatePulse 2.4s ease-out infinite;
}
@keyframes gatePulse {
  0%   { transform: scale(1);   opacity: 0.35; }
  100% { transform: scale(1.5); opacity: 0;    }
}
.gate-sheet-titles { flex: 1; min-width: 0; }
.gate-sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.gate-sheet-subtype {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--status-gate);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 3px;
}

.gate-sheet-divider {
  height: 1px;
  margin: 0 20px;
  background: rgba(255, 255, 255, 0.08);
}

.gate-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px 8px 20px;
}
.gate-sheet-body::-webkit-scrollbar { width: 3px; }
.gate-sheet-body::-webkit-scrollbar-thumb { background: rgba(245, 158, 11, 0.5); border-radius: 2px; }

/* Markdown do contexto usa .description-card (mesma classe da descricao da task) */

.gate-sheet-contention {
  margin-top: 14px;
}
.gate-sheet-contention-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--status-gate);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
/* O .gate-sheet-contention-text usa .description-card — sem regras proprias */

.gate-sheet-footer {
  padding: 14px 20px 18px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}
.gate-sheet-field-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.gate-sheet-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.15s ease;
}
.gate-sheet-input:focus { border-color: var(--status-gate); }
.gate-sheet-input::placeholder { color: var(--text-caption); font-size: 12.5px; }

.gate-sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.gate-sheet-btn {
  flex: 1;
  height: 46px;
  border-radius: 12px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
.gate-sheet-btn .material-symbols-rounded { font-size: 18px !important; }
.gate-sheet-btn:active { transform: scale(0.97); }
.gate-sheet-btn.approve {
  background: linear-gradient(180deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}
.gate-sheet-btn.approve:active { background: linear-gradient(180deg, #059669, #047857); }
.gate-sheet-btn.reject {
  background: rgba(239, 68, 68, 0.1);
  color: var(--status-failed);
  border-color: rgba(239, 68, 68, 0.35);
}
.gate-sheet-btn.reject:active { background: rgba(239, 68, 68, 0.2); }

/* ── Floating "gates pendentes" — aparece em qualquer tela ── */
.pending-gates-chip {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  right: 16px;
  z-index: 1100;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 12px;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.92), rgba(217, 119, 6, 0.92));
  color: #1a1108;
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(245, 158, 11, 0.32), 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  max-width: calc(100vw - 32px);
  animation: pendingChipPop 0.3s cubic-bezier(0.32, 0.72, 0, 1.4);
}
.pending-gates-chip.open { display: inline-flex; }
.pending-gates-chip:active { transform: translateY(1px); box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4); }
@keyframes pendingChipPop {
  0%   { transform: scale(0.6) translateY(20px); opacity: 0; }
  100% { transform: scale(1)   translateY(0);    opacity: 1; }
}
.pending-gates-chip-icon {
  background: #fff8;
  color: #5a3a00;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 18px !important;
  flex-shrink: 0;
}
.pending-gates-chip-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.pending-gates-chip-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  opacity: 0.7;
}
.pending-gates-chip-title {
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100vw - 130px);
}
.pending-gates-chip-chev { font-size: 18px !important; opacity: 0.85; }

/* Pill compacto na action-bar quando o sheet está fechado */
.gate-reopen-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 12px;
  color: var(--status-gate);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.gate-reopen-pill:active { background: rgba(245, 158, 11, 0.25); }
.gate-reopen-pill .material-symbols-rounded { font-size: 18px !important; }

/* ── Log category chips ── */
.log-category-chips {
  display: flex; gap: 4px; overflow-x: auto;
  padding: 6px 0 10px; scrollbar-width: none;
}
.log-category-chips::-webkit-scrollbar { display: none; }
.log-category-chips .chip {
  height: 22px !important; min-height: 22px !important;
  padding: 0 7px; font-size: 10px; border-radius: 4px;
  gap: 3px; letter-spacing: 0.3px;
}

/* ── Description card (Markdown viewer) ── */
.description-card {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
  font-size: 13px; color: var(--text-primary); line-height: 1.7;
}
.description-card h1,.description-card h2,.description-card h3,
.description-card h4,.description-card h5,.description-card h6 {
  color: var(--text-primary); font-weight: 600; margin: 14px 0 6px; line-height: 1.3;
}
.description-card h1 { font-size: 16px; }
.description-card h2 { font-size: 14px; }
.description-card h3 { font-size: 13px; }
.description-card p { margin: 0 0 8px; }
.description-card p:last-child { margin-bottom: 0; }
.description-card strong { color: var(--text-primary); font-weight: 600; }
.description-card em { color: var(--text-caption); }
.description-card ul,.description-card ol { padding-left: 20px; margin: 0 0 8px; }
.description-card li { margin-bottom: 3px; }
.description-card li:last-child { margin-bottom: 0; }
.description-card code {
  background: rgba(124,58,237,.15); color: var(--accent-light);
  border-radius: 4px; padding: 1px 5px; font-size: 12px;
  font-family: 'Consolas','Fira Code',monospace;
}
.description-card pre {
  background: #0d0d1a; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  overflow-x: auto; margin: 8px 0;
}
.description-card pre code {
  background: none; color: #c4b5fd; padding: 0; font-size: 12px; white-space: pre;
}
.description-card blockquote {
  border-left: 3px solid var(--accent); margin: 8px 0; padding: 4px 12px;
  color: var(--text-caption); background: rgba(124,58,237,.07); border-radius: 0 4px 4px 0;
}
.description-card blockquote p { margin: 0; }
.description-card a { color: var(--accent-light); text-decoration: underline; }
.description-card hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.description-card table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 8px 0; }
.description-card th,.description-card td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; }
.description-card th { background: rgba(124,58,237,.12); color: var(--text-primary); font-weight: 600; }

/* ── Info grid ── */
.info-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px;
}
.info-item { display: flex; flex-direction: column; gap: 3px; }
.info-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }
.info-value { font-size: 13px; color: var(--text-primary); }
.info-value.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--info); }

/* ── Run list (histórico de execuções) ── */
.run-list { display: flex; flex-direction: column; gap: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.run-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.run-item:last-child { border-bottom: none; }
.run-item.current-run { background: rgba(77,163,255,0.06); }
.run-step { font-size: 12px; font-weight: 700; color: var(--accent-light); font-family: 'JetBrains Mono', monospace; min-width: 24px; }
.run-info { flex: 1; min-width: 0; }
.run-agent { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.run-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.run-item .status-badge { flex-shrink: 0; }

/* ── Detail Sections ── */
.detail-section { margin-bottom: 8px; padding: 18px 0 8px; }
.detail-section + .detail-section { border-top: 1px solid var(--border); }
.detail-section:first-of-type { padding-top: 8px; }

/* ── Pipeline Steps ── */
.pipeline-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.step-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  position: relative;
}
.step-row + .step-row {
  border-top: 1px dashed var(--border);
}

.step-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-marker .material-symbols-rounded {
  font-size: 16px !important;
  color: var(--text-muted);
}
.step-row.done .step-marker {
  background: var(--status-done);
  border-color: var(--status-done);
}
.step-row.done .step-marker .material-symbols-rounded { color: #FFFFFF; }
.step-row.current .step-marker {
  background: rgba(255, 152, 0, 0.18);
  border-color: var(--status-running);
}
.step-row.current .step-marker .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--status-running);
}

.step-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.step-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.step-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.step-row.done .step-name { color: var(--text-caption); }
.step-row.current .step-name { color: var(--status-running); }

/* ── Active Agent Card ── */
.active-agent-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(77, 163, 255, 0.12), rgba(92, 200, 255, 0.04));
  border: 1px solid rgba(77, 163, 255, 0.25);
  border-radius: var(--radius-md);
  padding: 14px;
}

.active-agent-avatar {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #FFFFFF;
  flex-shrink: 0;
}
.agent-status-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--status-running);
  animation: ring-pulse 1.8s ease-in-out infinite;
}
@keyframes ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.08); opacity: 0.3; }
}

.active-agent-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.active-agent-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.active-agent-role {
  font-size: 12px;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}
.active-agent-action {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-caption);
}

.thinking-dots {
  display: inline-flex;
  gap: 3px;
}
.thinking-dots span {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent-light);
  animation: thinking 1.2s infinite ease-in-out;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes thinking {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Log Block ── */
.log-block {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.7;
  max-height: 180px;
  overflow-y: auto;
}
.log-block::-webkit-scrollbar { width: 3px; }
.log-block::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Terminal ── */
.terminal-wrap {
  display: flex;
  flex-direction: column;
  height: min(480px, calc(100vh - 260px));
  min-height: 260px;
  background: #0d0d14;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.terminal-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  background: transparent;
  flex-shrink: 0;
  width: fit-content;
  align-self: flex-end;
}
.terminal-tool-btn,
.tv-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #444;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 5px;
  transition: color 0.15s;
}
.terminal-tool-btn:hover,
.tv-toggle-btn:hover { color: #aaa; }
.terminal-tool-btn .material-symbols-rounded,
.tv-toggle-btn .material-symbols-rounded { font-size: 16px; }
.tv-toggle-btn.active { color: #888; }

/* ── Terminal view visibility ── */
.terminal-wrap.view-moderno #exec-view    { max-height: none; flex: 1; }
.terminal-wrap.view-moderno #terminal-output { display: none !important; }
.terminal-wrap.view-console  #exec-view   { display: none !important; }
.terminal-wrap.view-console  #terminal-output { flex: 1; }
.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  font-family: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;
  font-size: 11.5px;
  line-height: 1.7;
  color: #c9d1d9;
  word-break: break-word;
  white-space: pre-wrap;
}
.terminal-output::-webkit-scrollbar { width: 4px; }
.terminal-output::-webkit-scrollbar-track { background: transparent; }
.terminal-output::-webkit-scrollbar-thumb { background: #2d2d3a; border-radius: 2px; }
.t-line { min-height: 1em; margin-bottom: 2px; padding: 1px 0; }
.t-line:empty::after { content: '\00a0'; }
.t-empty { color: #555; font-style: italic; }

/* Hierarquia visual por tipo (definida pelo task-detail.js via dataset.kind) */
.t-line[data-kind="agent"] {        /* ● mensagem do agente */
  color: #c9b3ff;
  font-weight: 500;
  margin-top: 8px;
  padding-left: 2px;
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}
.t-line[data-kind="tool"] {         /* ● Tool(args) */
  color: #79c0ff;
  margin-top: 6px;
  padding-left: 8px;
  border-left: 2px solid #79c0ff;
}
.t-line[data-kind="result"] {       /* ⎿ resultado / task item */
  color: #8b949e;
  padding-left: 14px;
  font-size: 11px;
}
.t-line[data-kind="diff-add"] {     /* "N + content" */
  color: #7ee787;
  background: rgba(46, 160, 67, 0.08);
  padding-left: 8px;
}
.t-line[data-kind="diff-del"] {     /* "N - content" */
  color: #ff7b72;
  background: rgba(248, 81, 73, 0.08);
  padding-left: 8px;
}
.t-line[data-kind="diff-ctx"] {     /* "N content" linha de contexto do diff */
  color: #7d8590;
  padding-left: 8px;
  font-size: 10.5px;
}
.t-line[data-kind="status"] {       /* ✻ Spinning… (status bucket) */
  color: #7d8590;
  font-style: italic;
  font-size: 10.5px;
}
.t-line[data-kind="meta"] {         /* Searched for X, Read Y, Done (...), Agent(...) */
  color: #6e7681;
  font-size: 10.5px;
  padding-left: 6px;
}
.t-line[data-kind="envelope-result"] {   /* ⮕ {"type":"result"} */
  color: #d2a8ff;
  margin-top: 8px;
  padding-left: 8px;
  border-left: 2px solid #d2a8ff;
}
.t-line[data-kind="envelope-system"] {   /* ⓘ {"type":"system"} */
  color: #ffa657;
  margin-top: 6px;
  padding-left: 8px;
  border-left: 2px solid #ffa657;
}
.terminal-input-row {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid #1e1e2e;
  background: #0d0d14;
}
.terminal-prompt {
  color: var(--accent);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  flex-shrink: 0;
  user-select: none;
}
.terminal-input-field {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e6edf3;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  caret-color: var(--accent);
}
.terminal-input-field::placeholder { color: #444; }
.terminal-send-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
  transition: background 150ms;
}
.terminal-send-btn:hover { background: rgba(124,58,237,0.15); }

.log-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text-caption);
}
.log-line.muted { color: var(--text-muted); }
.log-line.current-line { color: var(--text-primary); }
.log-line.current-line::before {
  content: '▶';
  color: var(--status-running);
  font-size: 9px;
  margin-right: -4px;
}

.log-ts {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 10px;
}
.log-tag {
  font-weight: 700;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
.log-tag.analyst { background: rgba(59, 130, 246, 0.18); color: var(--info); }
.log-tag.architect { background: rgba(236, 72, 153, 0.18); color: #EC4899; }
.log-tag.developer { background: rgba(107, 91, 255, 0.18); color: var(--secondary); }
.log-tag.tool { background: rgba(245, 158, 11, 0.18); color: var(--status-gate); }

.ghost-btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-caption);
  cursor: pointer;
  font-family: inherit;
}
.ghost-btn-sm:active { background: var(--bg-elevated); }
.ghost-btn-sm .material-symbols-rounded { font-size: 13px !important; }

/* ═══════════════════════════════════════════════════════ */
/* ACTION BAR (Detail)                                     */
/* ═══════════════════════════════════════════════════════ */

.action-bar {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 4px 10px calc(4px + env(safe-area-inset-bottom));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}
.action-bar--gate {
  flex-direction: column;
  gap: 0;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}

/* ── Accordion ── */
.accordion-header {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
  border-radius: var(--radius-sm);
  padding: 4px 2px;
  margin: 0 -2px;
}
.accordion-header:hover { background: var(--bg-elevated); }
.accordion-right {
  display: flex; align-items: center; gap: 6px;
}
.accordion-chevron {
  font-size: 18px !important;
  color: var(--text-muted);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}
.task-section.collapsed .accordion-chevron {
  transform: rotate(-90deg);
}
.accordion-body {
  overflow: hidden;
  transition: none;
}
.task-section.collapsed .accordion-body {
  display: none;
}

/* ── Status Navigator ── */
.status-nav-row {
  display: flex; align-items: center; gap: 6px;
}
.snav-arrow {
  width: 30px; height: 30px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); color: var(--text-primary);
  cursor: pointer; font-family: inherit;
  transition: all 150ms; flex-shrink: 0; touch-action: manipulation;
}
.snav-arrow:hover:not(:disabled) { background: var(--bg-elevated-2); border-color: var(--accent); }
.snav-arrow:active:not(:disabled) { transform: scale(0.97); }
.snav-arrow:disabled { opacity: 0.35; cursor: not-allowed; }
.snav-arrow .material-symbols-rounded { font-size: 16px !important; }
.snav-arrow-labeled {
  width: auto !important;
  padding: 0 8px;
  gap: 3px;
  min-width: 30px;
}
.snav-nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1px;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-caption);
}
.snav-arrow-labeled:not(:disabled) .snav-nav-label { color: var(--text-primary); }
.snav-status {
  flex: 1; display: flex; align-items: center; justify-content: center;
}
.snav-pill {
  display: flex; flex-direction: row; align-items: center;
  gap: 6px; flex: 1; justify-content: center;
  padding: 3px 8px; border-radius: var(--radius-md);
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.snav-pill-dot {
  width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0;
}
.snav-pill-dot.pulsing { animation: dot-pulse 1.4s ease-in-out infinite; }
.snav-pill-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.3px; color: currentColor;
  white-space: nowrap;
}
.snav-pill.pending      { color: var(--status-pending); }
.snav-pill.refinamento  { color: var(--status-refinamento); }
.snav-pill.running      { color: var(--status-running); }
.snav-pill.done     { color: var(--status-done); }
.snav-pill.failed   { color: var(--status-failed); }
.snav-pill.cancelled{ color: var(--status-cancelled); }
.snav-pill.gate     { color: var(--status-gate); }
.snav-finish-icon {
  width: 30px; height: 30px; padding: 0; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(76, 175, 80, 0.12); border: 1px solid rgba(76, 175, 80, 0.35);
  border-radius: var(--radius-md); color: var(--status-done);
  cursor: pointer; transition: all 150ms; touch-action: manipulation;
}
.snav-finish-icon:hover { background: rgba(76, 175, 80, 0.22); }
.snav-finish-icon:active { transform: scale(0.97); }
.snav-finish-icon .material-symbols-rounded { font-size: 15px !important; }
.snav-interrupt-icon {
  width: 30px; height: 30px; padding: 0; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius-md); color: var(--status-gate);
  cursor: pointer; transition: all 150ms; touch-action: manipulation;
}
.snav-interrupt-icon:hover { background: rgba(245,158,11,0.2); }
.snav-interrupt-icon:active { transform: scale(0.97); }
.snav-interrupt-icon .material-symbols-rounded { font-size: 15px !important; }
.snav-cancel-icon {
  width: 30px; height: 30px; padding: 0; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-md); color: var(--status-failed);
  cursor: pointer; transition: all 150ms; touch-action: manipulation;
}
.snav-cancel-icon:hover { background: rgba(239,68,68,0.2); }
.snav-cancel-icon:active { transform: scale(0.97); }
.snav-cancel-icon .material-symbols-rounded { font-size: 15px !important; }
.icon-btn-edit {
  width: 30px !important; height: 30px !important;
  background: rgba(77,163,255,0.12) !important;
  border: 1px solid rgba(77,163,255,0.35) !important;
  border-radius: var(--radius-md) !important;
  color: var(--accent) !important;
  transition: all 150ms;
}
.icon-btn-edit:hover { background: rgba(77,163,255,0.22) !important; }
.icon-btn-edit:active { transform: scale(0.97); }
.icon-btn-edit .material-symbols-rounded { font-size: 16px !important; }
.compact-bar {
  flex-direction: row !important;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  padding: 4px 12px calc(4px + env(safe-area-inset-bottom)) !important;
}
.snav-nav-group {
  display: flex; align-items: center; gap: 6px;
}
.snav-action-group {
  display: flex; align-items: center; gap: 6px;
  padding-left: 12px;
  border-left: 1px solid var(--border-light);
}
.snav-spacer { flex: 1; min-width: 20px; }
.snav-cancel { margin-top: 0; }

/* ── Compact action buttons — detail footer single-row ── */
.act-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; height: 36px; padding: 0 12px;
  border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: 12px; font-weight: 600; font-family: inherit;
  cursor: pointer; flex-shrink: 0;
  transition: all 150ms; touch-action: manipulation; white-space: nowrap;
}
.act-btn .material-symbols-rounded { font-size: 15px !important; }
.act-btn:active { transform: scale(0.97); }
.act-btn--icon { width: 36px; padding: 0; }
.act-btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff; box-shadow: 0 2px 8px rgba(77, 163, 255, 0.25);
}
.act-btn--primary:active { box-shadow: none; }
.act-btn--warning {
  background: rgba(245, 158, 11, 0.15); color: var(--status-gate);
  border-color: rgba(245, 158, 11, 0.35);
}
.act-btn--warning:active { background: rgba(245, 158, 11, 0.25); }
.act-btn--danger {
  background: rgba(239, 68, 68, 0.15); color: var(--status-failed);
  border-color: rgba(239, 68, 68, 0.35);
}
.act-btn--danger:active { background: rgba(239, 68, 68, 0.25); }
.act-btn--neutral {
  background: var(--bg-elevated); color: var(--text-primary);
  border-color: var(--border-light);
}
.act-btn--neutral:active { background: var(--bg-elevated-2); }

.act-group {
  display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0;
}
.act-group .act-btn:not(.act-btn--icon) { flex: 1; }

.action-btn {
  flex: 1;
  height: 46px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 150ms;
}
.action-btn .material-symbols-rounded { font-size: 18px !important; }
.action-btn:active { transform: scale(0.97); }

.action-btn.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-gate);
  border-color: rgba(245, 158, 11, 0.35);
}
.action-btn.warning:active { background: rgba(245, 158, 11, 0.25); }
.action-btn.neutral {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-light);
}
.action-btn.neutral:active { background: var(--bg-elevated-2); }
.action-btn.danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-failed);
  border-color: rgba(239, 68, 68, 0.35);
}
.action-btn.danger:active { background: rgba(239, 68, 68, 0.25); }
.action-btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(77, 163, 255, 0.3);
}
.action-btn.ghost {
  background: transparent;
  color: var(--text-caption);
  border-color: var(--border);
}

/* ═══════════════════════════════════════════════════════ */
/* NOTIFICATIONS                                           */
/* ═══════════════════════════════════════════════════════ */

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notif-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 180ms;
  overflow: hidden;
}
.notif-card:active { background: var(--bg-elevated); transform: scale(0.99); }
.notif-card.unread { border-color: var(--border-light); background: linear-gradient(135deg, rgba(77, 163, 255, 0.05), var(--bg-card)); }

.swipe-hint {
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 3px;
  background: linear-gradient(180deg, transparent, var(--accent), transparent);
  opacity: 0.35;
}

.notif-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notif-icon-wrap .material-symbols-rounded { font-size: 20px !important; }
.gate-bg    { background: rgba(245, 158,  11, 0.15); color: var(--status-gate);    }
.error-bg   { background: rgba(239,  68,  68, 0.15); color: var(--status-failed);  }
.success-bg { background: rgba( 16, 185, 129, 0.15); color: var(--status-done);    }
.running-bg { background: rgba(255, 152,   0, 0.15); color: var(--status-running); }
.muted-bg   { background: rgba(120, 144, 156, 0.15); color: var(--status-cancelled); }
.info-bg    { background: rgba( 59, 130, 246, 0.15); color: var(--info);           }

.notif-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.notif-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}
.notif-text {
  font-size: 12.5px;
  color: var(--text-caption);
  line-height: 1.4;
}
.notif-text code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  background: var(--bg-input);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--status-failed);
}
.notif-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.notif-meta .material-symbols-rounded { font-size: 12px !important; }
.meta-dot { color: var(--border-light); margin: 0 2px; }

.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  top: 14px;
  right: 14px;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ═══════════════════════════════════════════════════════ */
/* PROFILE                                                 */
/* ═══════════════════════════════════════════════════════ */

.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 24px 24px;
}

.profile-avatar-lg {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  color: #FFFFFF;
  box-shadow:
    0 8px 24px rgba(77, 163, 255, 0.4),
    0 0 0 4px var(--bg-surface),
    0 0 0 5px rgba(77, 163, 255, 0.25);
  margin-bottom: 4px;
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  font-family: var(--font-heading);
}
.profile-email {
  font-size: 13px;
  color: var(--text-muted);
}

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding: 5px 12px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.role-pill .material-symbols-rounded { font-size: 13px !important; }

/* ── Profile sections ── */
.profile-section {
  margin-bottom: 20px;
}

.profile-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0 2px;
}
.profile-section-header h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-caption);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.profile-section-header .material-symbols-rounded {
  font-size: 15px !important;
  color: var(--text-muted);
}

/* ── Tenant card ── */
.tenant-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}
.tenant-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  flex-shrink: 0;
}
.tenant-icon .material-symbols-rounded { font-size: 22px !important; }
.tenant-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.tenant-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.tenant-detail {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.tenant-detail .material-symbols-rounded { font-size: 13px !important; }

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}
.stat-icon .material-symbols-rounded { font-size: 18px !important; }
.stat-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1;
  font-family: var(--font-heading);
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ── Menu list ── */
.menu-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 150ms;
}
.menu-item:active { background: var(--bg-elevated); }
.menu-item + .menu-item { border-top: 1px solid var(--border); }

.menu-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-light);
  flex-shrink: 0;
}
.menu-icon .material-symbols-rounded { font-size: 18px !important; }

.menu-label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.menu-value {
  font-size: 12px;
  color: var(--text-muted);
}
.menu-item .chevron {
  font-size: 18px !important;
  color: var(--text-muted);
}

/* ── Logout button ── */
.logout-btn {
  width: 100%;
  height: 48px;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  color: var(--status-failed);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 150ms;
}
.logout-btn:active { background: rgba(239, 68, 68, 0.12); }
.logout-btn .material-symbols-rounded { font-size: 18px !important; }

/* ═══════════════════════════════════════════════════════ */
/* MODAL                                                   */
/* ═══════════════════════════════════════════════════════ */

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: backdrop-fade 180ms;
}
.modal-backdrop.active { display: flex; }
@keyframes backdrop-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: 100%;
  max-width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  box-shadow: var(--shadow-elevated);
  animation: modal-pop 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}
.modal-icon .material-symbols-rounded { font-size: 28px !important; }
.modal-icon.warn { background: rgba(245, 158, 11, 0.18); color: var(--status-gate); }
.modal-icon.danger { background: rgba(239, 68, 68, 0.18); color: var(--status-failed); }

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-heading);
}
.modal-text {
  font-size: 13px;
  color: var(--text-caption);
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}
.modal-actions .action-btn { height: 44px; }

/* ═══════════════════════════════════════════════════════ */
/* TOAST                                                   */
/* ═══════════════════════════════════════════════════════ */

.toast {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border-light);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: var(--shadow-elevated);
  opacity: 0;
  pointer-events: none;
  transition: all 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 90;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast .material-symbols-rounded {
  font-size: 18px !important;
  color: var(--status-done);
}

/* ═══════════════════════════════════════════════════════ */
/* SKELETON / ACCESSIBILITY                                */
/* ═══════════════════════════════════════════════════════ */

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

/* Larger touch targets */
button, .nav-item, .chip, .task-card, .notif-card {
  min-height: 44px;
}
.qa-btn, .footer-pill { min-height: 30px; }

/* ═══════════════════════════════════════════════════════ */
/* SCREEN 5 — NOVA TAREFA (FORM)                           */
/* ═══════════════════════════════════════════════════════ */

/* Header simples da tela de formulário */
.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 4px;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-back {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none;
  color: var(--text-primary); cursor: pointer;
  border-radius: var(--radius-md);
  touch-action: manipulation;
  transition: background 150ms;
}
.header-back:hover { background: var(--bg-elevated); }
.header-back .material-symbols-rounded { font-size: 22px !important; }

/* Scroll container do formulário */
.form-scroll {
  padding: 16px;
  gap: 12px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
}

/* Card de seção */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Cabeçalho da seção */
.form-section-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--border);
}

/* Acordeão — Time do Projeto */
button.form-section-header.accordion-trigger {
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  width: 100%;
  cursor: pointer;
  padding: 0 0 11px 0;
  text-align: left;
}
button.form-section-header.accordion-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.accordion-chevron {
  margin-left: auto;
  font-size: 18px !important;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 220ms ease;
}
.accordion.open .accordion-chevron {
  transform: rotate(180deg);
}
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 280ms ease;
}
.accordion.open .accordion-body {
  max-height: 1200px;
}
.form-accordion-body {
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-section-icon {
  font-size: 16px !important;
  color: var(--accent);
  flex-shrink: 0;
}
.form-section-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.1px;
  flex: 1;
}
.form-section-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
}

/* Campo genérico */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.form-required { color: var(--danger); margin-left: 2px; }

/* Validação de campos obrigatórios */
.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger);
}
.form-select-wrap.is-invalid .form-select { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.field-error-msg {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--danger);
  margin-top: 4px;
  animation: shakeIn 0.25s ease-out;
}
.field-error-msg .material-symbols-rounded { font-size: 14px !important; }
@keyframes shakeIn {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-3px); }
  50%  { transform: translateX(3px); }
  75%  { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

/* Inputs e textarea */
.form-input,
.form-select,
.form-textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 150ms;
}
.form-input { height: 40px; padding: 0 12px; }
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-caption); }

.form-textarea { padding: 10px 12px; resize: vertical; min-height: 96px; line-height: 1.5; }
.form-textarea:focus { border-color: var(--accent); }
.form-textarea::placeholder { color: var(--text-caption); }

/* Descrição expande até a submit-bar — aproveita espaço vertical em vez de scroll desnecessário */
.form-section--grow  { flex: 1 1 auto; min-height: 240px; }
.form-group--grow    { flex: 1; display: flex; flex-direction: column; min-height: 120px; }
.form-textarea--grow { flex: 1; width: 100%; min-height: 120px; resize: none; }

/* Select customizado */
.form-select-wrap { position: relative; }
.form-select {
  height: 40px;
  padding: 0 32px 0 12px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.form-select:focus { border-color: var(--accent); }
.form-sel-icon {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  font-size: 18px !important;
  color: var(--text-caption);
  pointer-events: none;
}

/* 2 colunas */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Projeto + Pipeline (esquerda) / Prioridade vertical (direita) */
.project-prio-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.form-col-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-col-prio {
  flex-shrink: 0;
  width: 68px;
  display: flex;
  flex-direction: column;
}
.form-col-prio .form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.priority-seg--vert {
  flex-direction: column;
  height: auto;
  flex: 1;
}
.priority-seg--vert .priority-btn {
  flex: 1;
}
.priority-seg--vert .priority-btn:not(:last-child) {
  border-right: none;
  border-bottom: 1px solid var(--border);
}

/* Segmented control de prioridade */
.priority-seg {
  display: flex;
  height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.priority-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms;
  touch-action: manipulation;
  min-height: unset;
}
.priority-btn:not(:last-child) { border-right: 1px solid var(--border); }
.priority-btn.active[data-priority="alta"]  { background: rgba(239,68,68,0.14); color: var(--danger); font-weight: 600; }
.priority-btn.active[data-priority="media"] { background: rgba(245,158,11,0.12); color: var(--warning); font-weight: 600; }
.priority-btn.active[data-priority="baixa"] { background: rgba(34,197,94,0.11); color: var(--success); font-weight: 600; }

/* Botão Aprimorar com IA */
.ai-enhance-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  background: rgba(77,163,255,0.08);
  border: 1px solid rgba(77,163,255,0.28);
  border-radius: 999px;
  color: var(--accent);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms;
  touch-action: manipulation;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: unset;
}
.ai-enhance-btn:hover { background: rgba(77,163,255,0.16); }
.ai-enhance-btn .material-symbols-rounded { font-size: 14px !important; }
.ai-enhance-btn.loading { opacity: 0.6; pointer-events: none; }

/* Painel de comparação Original vs IA */
.comparison-panel {
  background: var(--bg-elevated);
  border: 1px solid rgba(77,163,255,0.28);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.comparison-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.comparison-col { display: flex; flex-direction: column; gap: 5px; }
.comparison-col-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.comparison-col-label.accent { color: var(--accent); }
.comparison-text {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
  min-height: 72px;
  word-break: break-word;
}
.comparison-text.accent-border { border-color: rgba(77,163,255,0.32); }
.comparison-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.action-btn.sm {
  flex: 0 0 auto !important;
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  min-height: unset;
}
.action-btn.sm .material-symbols-rounded { font-size: 14px !important; }

/* Lista de steps do pipeline */
.pipeline-steps-list {
  display: flex;
  flex-direction: column;
}
.pipeline-step-row {
  display: grid;
  grid-template-columns: 36px 88px 1fr 38px;
  align-items: center;
  gap: 8px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border);
  min-height: unset;
}
.pipeline-step-row:last-child { border-bottom: none; }
.step-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--accent);
  font-weight: 600;
}
.step-agent {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.step-instructions {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.step-time {
  font-size: 10px;
  color: var(--text-caption);
  text-align: right;
  white-space: nowrap;
}

/* Barra de ação inferior fixa — formulários (Nova/Editar Tarefa) */
.submit-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  z-index: 100;
}
.submit-bar .action-btn {
  height: 36px;
  font-size: 12.5px;
  border-radius: var(--radius-md);
  min-height: unset;
}
.submit-bar .action-btn.ghost {
  flex: 0 0 auto;
  padding: 0 14px;
  color: var(--text-muted);
  border-color: var(--border-light);
}
.submit-bar .action-btn.primary {
  flex: 1;
  justify-content: center;
  gap: 5px;
}
.submit-bar .action-btn.primary .material-symbols-rounded { font-size: 15px !important; }

/* ── Step row — not-escalated (agente não incluído no teamPlan) ── */
.step-row.not-escalated { opacity: 0.35; }
.step-row.not-escalated .step-marker { background: var(--bg-elevated); border-color: var(--border); border-style: dashed; }
.step-row.not-escalated .step-name { color: var(--text-muted); }
.step-row.not-escalated .step-meta::after { content: ' · não escalado'; color: var(--text-muted); font-style: italic; font-size: 10px; }

/* ═══════════════════════════════════════════════════════ */
/* SPLASH SCREEN                                           */
/* ═══════════════════════════════════════════════════════ */

.splash-screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  gap: 6px;
  overflow: hidden;
}
.splash-bg-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.splash-bg-orb--1 {
  width: 300px; height: 300px;
  top: -100px; left: -80px;
  background: radial-gradient(circle, rgba(77,163,255,0.14) 0%, transparent 70%);
}
.splash-bg-orb--2 {
  width: 250px; height: 250px;
  bottom: -80px; right: -60px;
  background: radial-gradient(circle, rgba(107,91,255,0.11) 0%, transparent 70%);
}
.splash-logo-wrap {
  position: relative;
  width: 88px; height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.splash-glow-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(77,163,255,0.25);
  animation: splash-ring-pulse 2s ease-in-out infinite;
}
.splash-glow-ring--1 { inset: 0; }
.splash-glow-ring--2 { inset: -12px; opacity: 0.5; animation-delay: 0.5s; }
@keyframes splash-ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0.25; }
  50% { transform: scale(1.06); opacity: 0.5; }
}
.splash-logo-img {
  width: 62px; height: 62px;
  object-fit: contain;
  border-radius: 14px;
}
.splash-title {
  font-family: var(--font-heading);
  font-size: 21px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.splash-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.splash-version {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-caption);
}

/* ═══════════════════════════════════════════════════════ */
/* LOGIN SCREEN                                            */
/* ═══════════════════════════════════════════════════════ */

.login-screen {
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  overflow: hidden;
  position: relative;
}
.login-bg-circle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.login-bg-circle--purple {
  width: 320px; height: 320px;
  top: -120px; right: -100px;
  background: radial-gradient(circle, rgba(107,91,255,0.11) 0%, transparent 65%);
}
.login-bg-circle--blue {
  width: 260px; height: 260px;
  bottom: -80px; left: -80px;
  background: radial-gradient(circle, rgba(77,163,255,0.09) 0%, transparent 65%);
}
.login-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  z-index: 1;
}
.login-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}
.login-logo-img {
  width: 52px; height: 52px;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 10px;
}
.login-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}
.login-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}
.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--danger);
  margin-bottom: 12px;
}
.login-link-disabled {
  font-size: 12px;
  color: var(--text-caption);
  cursor: default;
}
.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  margin-top: 4px;
}
.login-checkbox {
  accent-color: var(--accent);
  width: 15px; height: 15px;
  cursor: pointer;
}
.login-btn {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 44px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.15s;
}
.login-btn:active { opacity: 0.85; }
.login-btn.loading { background: var(--accent-dim); cursor: not-allowed; opacity: 0.8; }
.login-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.login-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border-radius: var(--radius-sm);
}
.login-version-badge {
  position: absolute;
  bottom: 16px;
  left: 0; right: 0;
  text-align: center;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-caption);
  z-index: 1;
}

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Form Field Groups (Login) ── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.field-label--caps {
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.field-input {
  height: 46px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.field-input:focus { border-color: var(--accent); }
.field-input::placeholder { color: var(--text-caption); }
.field-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.field-password-wrap .field-input { padding-right: 44px; flex: 1; }
.field-pwd-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

/* ═══════════════════════════════════════════════════════ */
/* MODAL OVERLAY                                           */
/* ═══════════════════════════════════════════════════════ */

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal-sheet {
  width: 100%;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-top: 1px solid var(--border-light);
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  animation: slide-up 0.28s cubic-bezier(.4,0,.2,1);
}
.modal-handle {
  width: 36px; height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Tenant Picker ── */
.tenant-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.tenant-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.tenant-option:active { opacity: 0.8; }
.tenant-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(77,163,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}
.tenant-info { flex: 1; }
.tenant-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.tenant-role { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tenant-arrow { color: var(--text-muted); }

/* ── Generic Buttons ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
  width: 100%;
}
.btn:active { opacity: 0.8; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--border-light); color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════ */
/* DETAIL — redesign fixes                                 */
/* ═══════════════════════════════════════════════════════ */

/* header-back inside app-header (detail screen) */
.app-header .header-back {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none;
  color: var(--text-primary); cursor: pointer;
  border-radius: var(--radius-sm);
  touch-action: manipulation;
  transition: background 150ms;
  flex-shrink: 0;
}
.app-header .header-back:active { background: var(--bg-elevated); }
.app-header .header-back .material-symbols-rounded { font-size: 22px !important; }

/* Tab pane — entry animation */
.detail-tab-pane.active {
  display: flex;
  flex-direction: column;
  animation: pane-enter 180ms ease;
}
@keyframes pane-enter {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Terminal fullscreen: hide header + footer, terminal fills entire screen */
#task-detail.terminal-fullscreen .app-header { display: none; }
#task-detail.terminal-fullscreen #action-bar { display: none; }
#task-detail.terminal-fullscreen .scroll-area {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}
#task-detail.terminal-fullscreen .detail-tab-pane[data-pane="logs"].active {
  flex: 1;
  min-height: 0;
}
#task-detail.terminal-fullscreen .terminal-wrap {
  flex: 1;
  height: auto;
  min-height: 0;
  border-radius: 0;
}
#task-detail.terminal-fullscreen .scroll-spacer-lg { display: none; }

/* Terminal tab: fill all available space (no gaps) */
#task-detail.detail--logs .scroll-area {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 8px;
}
#task-detail.detail--logs .detail-tab-pane[data-pane="logs"].active {
  flex: 1;
  min-height: 0;
}
#task-detail.detail--logs .terminal-wrap {
  flex: 1;
  height: auto;
  min-height: 0;
}
#task-detail.detail--logs .scroll-spacer-lg { display: none; }

/* Gate fullscreen: esconde header e scroll-area, gate banner preenche a tela.
   Definido APÓS detail--logs para ganhar no cascade (mesma especificidade). */
#task-detail.gate-fullscreen .app-header  { display: none; }
#task-detail.gate-fullscreen .scroll-area { display: none; }
#task-detail.gate-fullscreen #action-bar  { flex: 1; min-height: 0; overflow-y: auto; }
#task-detail.gate-fullscreen .gate-banner { max-height: none; flex: 1; }

/* ═══════════════════════════════════════════════════════ */
/* FORM HEADER — fixes                                     */
/* ═══════════════════════════════════════════════════════ */

/* Slot placeholder balanceia o back-button à esquerda */
.header-slot {
  width: 44px; height: 44px;
  flex-shrink: 0;
}

/* Título do form-header — menor que screen-title (22px) */
.form-screen-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.1px;
  margin: 0;
  font-family: var(--font-heading);
}

/* Safe-area-inset-top no form-header (PWA standalone — notch iOS) */
.form-header {
  padding-top: env(safe-area-inset-top);
  min-height: calc(56px + env(safe-area-inset-top));
  height: auto;
}

/* submit-bar abaixo do modal-backdrop (z-index:100) */
.submit-bar { z-index: 5; }
.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 0;
  width: 100%;
  text-align: center;
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════ */
/* NAV HEADER (screens internos)                           */
/* ═══════════════════════════════════════════════════════ */

.nav-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 52px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.nav-header h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
  letter-spacing: -0.1px;
}
.nav-back {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-primary);
}
.nav-back:active { background: var(--bg-elevated); }
.nav-header-back { padding-left: 8px; }

/* ─ Sections inside detail / scroll areas ─ */
.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}
button.detail-accordion-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  gap: 4px;
}
button.detail-accordion-trigger .accordion-chevron {
  font-size: 14px !important;
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 220ms ease;
  flex-shrink: 0;
}
.detail-section.accordion.open button.detail-accordion-trigger .accordion-chevron {
  transform: rotate(180deg);
}
.steps-section { margin-bottom: 14px; }
.steps-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.info-row:last-of-type { border-bottom: none; }
.logs-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

/* ── Time do Projeto (form preview via SignalR) ── */
.team-member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.team-member-row:last-child { border-bottom: none; }
.team-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.team-info { flex: 1; min-width: 0; }
.team-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-role {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.team-loading, .team-offline {
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 0;
  font-style: italic;
}

/* ─ Profile screen ─ */
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid rgba(77,163,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  margin: 20px auto 10px;
  cursor: default;
}
.profile-role {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 16px;
}

/* ─ Back button (nav-header variant) ─ */
.back-btn {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  flex-shrink: 0;
}
.back-btn svg { fill: var(--text-primary); }
.back-btn:active { background: var(--bg-elevated); }

/* ─ Password wrap (form-input variant — my-account) ─ */
.form-pwd-wrap {
  position: relative;
}
.form-pwd-wrap .form-input {
  padding-right: 44px;
}
.form-pwd-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  touch-action: manipulation;
}
.form-pwd-toggle .material-symbols-rounded { font-size: 18px !important; }

/* ── Pipeline field dinâmico ──────────────────────────────────────────── */
.pipeline-field-display {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  background: var(--surface-2, #1A1A2E);
  border: 1px solid var(--border, #2A2A3E);
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
}
.pipeline-field-name {
  font-size: 14px;
  color: var(--text-secondary, #9CA3AF);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Execution View (Pipeline Parser) ──────────────────────────────── */
.exec-view {
  padding: 8px 16px 0;
  overflow-y: auto;
  max-height: 300px;
}
.exec-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px 0;
}
.exec-timeline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 8px;
}
.exec-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
  border-left: 2px solid transparent;
  padding-left: 8px;
}
.exec-icon { flex-shrink: 0; font-size: 14px; }
.exec-text { flex: 1; color: var(--text-primary); line-height: 1.4; }
.exec-meta {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.exec-agent  { border-left-color: var(--accent); }
.exec-file   { border-left-color: #4ade80; }
.exec-phase  { border-left-color: #f59e0b; }
.exec-verdict.verdict-ok   { border-left-color: #22c55e; }
.exec-verdict.verdict-fail { border-left-color: #ef4444; }
.exec-verdict.verdict-warn { border-left-color: #f59e0b; }

.exec-verdict-card,
.verdict-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 8px 0 12px;
}
.verdict-card-ok   { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3); }
.verdict-card-fail { background: rgba(239,68,68,.12);  border: 1px solid rgba(239,68,68,.3); }
.verdict-card-warn { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.3); }
.verdict-icon { font-size: 24px; }
.verdict-label {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}
.verdict-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Pipeline files */
.pipeline-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.pipeline-file-row:last-child { border-bottom: none; }
.pipeline-file-name { flex: 1; color: var(--text-primary); }
.pipeline-file-meta { font-size: 11px; color: var(--text-muted); }

/* ── Pipeline Report (state.json) ──────────────────────────────────── */
.pl-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.pl-empty { color: var(--text-muted); font-size: 13px; }
.pl-empty-small { font-size: 12px; color: var(--text-caption); padding: 6px 0; }
.pl-card-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-caption); margin-bottom: 8px;
}
.pl-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.pl-badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; background: var(--bg-elevated); border: 1px solid var(--border);
}
.pl-status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.pl-scope { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 6px; }
.pl-timestamps { font-size: 11px; color: var(--text-caption); display: flex; gap: 4px; flex-wrap: wrap; }
.pl-ts-sep { opacity: 0.5; }

.pl-active-card { border-color: var(--accent); background: var(--accent-dim); }
.pl-active-label { color: var(--accent) !important; }
.pl-active-row { display: flex; align-items: center; gap: 10px; }
.pl-agent-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.pl-agent-role { font-size: 12px; color: var(--text-muted); }
.pl-step-cur { font-size: 11px; color: var(--accent); margin-top: 5px; }

.pl-steps-list { display: flex; flex-direction: column; }
.pl-step-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.pl-step-row:last-child { border-bottom: none; }
.pl-step-icon { width: 22px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pl-step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-light); display: block; }
.pl-step-info { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pl-step-name { font-size: 12.5px; font-weight: 500; color: var(--text-primary); }
.pl-step-agent { font-size: 10px; color: var(--text-caption); }
.pl-step-dim .pl-step-name, .pl-step-dim .pl-step-agent { color: var(--text-muted); opacity: 0.6; }
.pl-step-active .pl-step-name { color: var(--accent); }
/* ── Step state icons ── */
.pl-icon-done    { font-size: 16px; color: var(--success); }
.pl-icon-failed  { font-size: 16px; color: var(--danger); }
.pl-icon-running { font-size: 16px; color: #F59E0B; animation: pl-icon-pulse 1.2s ease-in-out infinite; }
.pl-icon-pending { font-size: 16px; color: var(--text-muted); opacity: 0.35; }
@keyframes pl-icon-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(0.88); }
}
.pl-verdict-chip {
  font-size: 10px; font-weight: 600; padding: 2px 6px;
  border-radius: 4px; background: var(--bg-elevated); flex-shrink: 0;
}
.pl-not-escalated { font-size: 10px; color: var(--text-caption); flex-shrink: 0; }
.pl-divider { border-top: 1px dashed var(--border); margin: 4px 0; }

.pl-iter-list { display: flex; flex-direction: column; gap: 4px; }
.pl-iter-row { display: flex; justify-content: space-between; font-size: 12.5px; }
.pl-iter-label { color: var(--text-muted); }
.pl-iter-count { font-weight: 700; color: var(--warning); }
.pl-fast-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pl-fast-chip {
  font-size: 11px; color: var(--accent);
  background: var(--accent-dim); border: 1px solid rgba(77,163,255,.25);
  padding: 2px 8px; border-radius: 4px;
}
.pl-gate-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.pl-gate-row:last-child { border-bottom: none; }
.pl-gate-agent { color: var(--text-muted); }
.pl-gate-status { font-weight: 600; }

.pl-verdict-ok  { display: flex; align-items: center; gap: 12px; color: var(--success); border-color: rgba(34,197,94,.3);  background: rgba(34,197,94,.08);  }
.pl-verdict-fail{ display: flex; align-items: center; gap: 12px; color: var(--danger);  border-color: rgba(239,68,68,.3);  background: rgba(239,68,68,.08);  }
.pl-verdict-warn{ display: flex; align-items: center; gap: 12px; color: #f59e0b;        border-color: rgba(245,158,11,.3); background: rgba(245,158,11,.08); }
.pl-verdict-label { font-weight: 700; font-size: 14px; }
.pl-verdict-sub { font-size: 11px; opacity: 0.75; margin-top: 2px; }
