/* Cortex Overview — Lumme brand surface (orange / black). Standalone Cortex keeps its own theme. */
.cortex-overview {
  --cx-ink: #130600;
  --cx-accent: #ff5300;
  --cx-accent-600: #c43d00;
  --cx-accent-soft: #f9c4ae;
  --cx-blue: var(--cx-accent);
  --cx-blue-600: var(--cx-accent-600);
  --cx-gray-25: #fbf6f3;
  --cx-gray-50: #f4ebe4;
  --cx-gray-100: #eadfd6;
  --cx-fg-2: #7a6a60;
  --cx-radius: 20px;
  --cx-pill: 999px;
  --cx-grad-accent: radial-gradient(120% 140% at 85% 110%, #9a2c00 0%, rgba(154, 44, 0, 0) 55%),
    linear-gradient(120deg, #ff7a33 0%, #ff5300 45%, #c43d00 100%);
  --cx-grad-glass: radial-gradient(70% 70% at 55% 60%, #ff5300 0%, rgba(255, 83, 0, 0) 70%),
    linear-gradient(140deg, #ffb48a 0%, #ff7a33 55%, #ffd8c2 100%);
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--cx-ink);
  margin: -0.5rem -0.25rem 0;
  padding: 0.25rem 0.25rem 1.5rem;
}

.cortex-overview * {
  box-sizing: border-box;
}

.cortex-overview__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.cortex-overview__head h1 {
  margin: 0;
  font-weight: 300;
  font-size: clamp(1.75rem, 3vw, 2.125rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.cortex-overview__head p {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--cx-fg-2);
}

.cortex-overview__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.cx-add-agent {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.cx-btn-plus {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1.5px solid var(--cx-ink);
  background: #fff;
  color: var(--cx-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font: 500 1.15rem/1 "Outfit", system-ui, sans-serif;
  transition: background 0.2s ease, transform 0.15s ease;
}

.cx-btn-plus:hover {
  background: var(--cx-gray-25);
  transform: scale(1.04);
}

.cx-btn-plus .material-symbols-outlined {
  font-size: 1.15rem;
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

.cx-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(11, 13, 18, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.cx-modal-backdrop[hidden] {
  display: none !important;
}

.cx-modal {
  width: min(440px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 1.25rem 1.25rem 1.1rem;
  box-shadow: 0 24px 60px rgba(11, 13, 18, 0.22);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cx-modal--intake {
  width: min(520px, 100%);
  max-height: min(88vh, 720px);
}

.cx-intake-brain {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.55rem;
  padding: 0.28rem 0.55rem;
  border-radius: var(--cx-pill);
  background: var(--cx-gray-50);
  font-size: 0.68rem;
  color: var(--cx-fg-2);
  max-width: 100%;
}

.cx-intake-brain i {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #9aa3b2;
  flex: none;
}

.cx-intake-brain span {
  color: var(--cx-ink);
  font-weight: 500;
  white-space: nowrap;
}

.cx-intake-brain small {
  color: var(--cx-fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cx-intake-brain.is-wait i {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
  animation: cx-intake-pulse 1.1s ease-in-out infinite;
}

.cx-intake__msg--thinking {
  opacity: 0.95;
}

.cx-intake__bubble--thinking {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.4rem;
}

.cx-intake__thinking-label {
  font-size: 0.75rem;
  color: var(--cx-fg-2);
}

.cx-intake__dots {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.cx-intake__dots i {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--cx-ink);
  opacity: 0.35;
  animation: cx-intake-dot 1.2s ease-in-out infinite;
}

.cx-intake__dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.cx-intake__dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes cx-intake-dot {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes cx-intake-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.28);
  }
}

.cx-intake-brain.is-llm i {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.cx-intake-brain.is-scripted i {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.cx-intake-brain.is-offline i {
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.cx-intake__log {
  flex: 1;
  min-height: 280px;
  max-height: 48vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.35rem 0.15rem;
}

.cx-intake__msg {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: 92%;
}

.cx-intake__msg--assistant {
  align-self: flex-start;
}

.cx-intake__msg--user {
  align-self: flex-end;
}

.cx-intake__bubble {
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: normal;
  background: var(--cx-gray-25);
  color: var(--cx-ink);
}

.cx-intake__msg--user .cx-intake__bubble {
  background: var(--cx-ink);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.cx-intake__msg--assistant .cx-intake__bubble {
  border-bottom-left-radius: 6px;
}

.cx-intake__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.cx-intake__choice {
  height: 1.9rem;
  padding: 0 0.75rem;
  font-size: 0.7rem;
}

.cx-intake__composer {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.cx-intake__composer input {
  flex: 1;
  border: 1px solid var(--cx-gray-100);
  border-radius: 12px;
  background: var(--cx-gray-25);
  color: var(--cx-ink);
  font: 450 0.8125rem/1.3 "Outfit", system-ui, sans-serif;
  padding: 0.7rem 0.85rem;
  outline: none;
}

.cx-intake__composer input:focus {
  border-color: var(--cx-accent-soft);
  box-shadow: 0 0 0 3px rgba(255, 83, 0, 0.16);
  background: #fff;
}

.cx-intake__composer .cx-btn {
  width: 2.4rem;
  padding: 0;
}

.cx-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.cx-modal__head h2 {
  margin: 0;
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.cx-modal__head p {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
  color: var(--cx-fg-2);
  line-height: 1.35;
}

.cx-modal__close {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: var(--cx-gray-50);
  color: var(--cx-ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cx-modal__close .material-symbols-outlined {
  font-size: 1.1rem;
}

.cx-form {
  display: grid;
  gap: 0.7rem;
}

.cx-form label {
  display: grid;
  gap: 0.28rem;
  font-size: 0.68rem;
  color: var(--cx-fg-2);
}

.cx-form label span b {
  color: var(--cx-ink);
  font-weight: 500;
  font-size: 0.75rem;
}

.cx-form input,
.cx-form select,
.cx-form textarea {
  width: 100%;
  border: 1px solid var(--cx-gray-100);
  border-radius: 12px;
  background: var(--cx-gray-25);
  color: var(--cx-ink);
  font: 450 0.8125rem/1.3 "Outfit", system-ui, sans-serif;
  padding: 0.65rem 0.75rem;
  outline: none;
}

.cx-form textarea {
  min-height: 4.25rem;
  resize: vertical;
}

.cx-form input:focus,
.cx-form select:focus,
.cx-form textarea:focus {
  border-color: var(--cx-accent-soft);
  box-shadow: 0 0 0 3px rgba(255, 83, 0, 0.16);
  background: #fff;
}

.cx-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.cx-form__hint {
  margin: 0;
  font-size: 0.65rem;
  color: var(--cx-fg-2);
  line-height: 1.35;
}

.cx-form__hint code {
  font-size: 0.62rem;
  background: var(--cx-gray-50);
  padding: 0.05rem 0.3rem;
  border-radius: 6px;
}

.cx-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.cx-agent-name__meta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cx-pill-local {
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.35rem;
  border-radius: var(--cx-pill);
  background: #fff0e8;
  color: var(--cx-accent-600);
}

.cx-agent-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.cx-agent-row:hover td,
.cx-agent-row.is-balloon-open td {
  background: #fff7f2;
}

.cx-agent-row:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--cx-accent, #ff5300) 45%, transparent);
  outline-offset: 2px;
}

.cx-agent-balloon {
  position: fixed;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow:
    0 10px 30px rgba(15, 23, 42, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.8) inset;
  animation: cx-balloon-in 0.16s ease-out;
}

.cx-agent-balloon::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-right: 1px solid rgba(15, 23, 42, 0.08);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  transform: translateX(-50%) rotate(45deg);
}

.cx-agent-balloon__label {
  font-size: 0.72rem;
  font-weight: 700;
  font-style: italic;
  color: var(--cx-accent, #ff5300);
  padding: 0 0.35rem 0 0.2rem;
  white-space: nowrap;
}

.cx-agent-remove,
.cx-agent-runtime {
  border: none;
  background: transparent;
  color: #5b6472;
  cursor: pointer;
  padding: 0.28rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.cx-agent-remove:hover {
  color: #dc2626;
  background: #fef2f2;
}

.cx-agent-runtime:hover {
  color: var(--cx-accent, #f97316);
  background: color-mix(in srgb, var(--cx-accent, #f97316) 12%, transparent);
}

.cx-agent-remove .material-symbols-outlined,
.cx-agent-runtime .material-symbols-outlined {
  font-size: 1.05rem;
}

@keyframes cx-balloon-in {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.cx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 2.25rem;
  padding: 0 1.1rem;
  border-radius: var(--cx-pill);
  border: 1px solid transparent;
  font: 500 0.8125rem/1 "Outfit", system-ui, sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.cx-btn:hover {
  text-decoration: none;
}

.cx-btn--primary {
  background: var(--cx-ink);
  color: #fff;
  border-color: var(--cx-ink);
}

.cx-btn--primary:hover {
  background: #2a1408;
  color: #fff;
}

.cx-btn--accent {
  background: var(--cx-accent);
  color: #fff;
  border-color: var(--cx-accent);
}

.cx-btn--accent:hover {
  background: var(--cx-accent-600);
  color: #fff;
}

.cx-btn--secondary {
  background: #fff;
  color: var(--cx-ink);
  border-color: var(--cx-gray-100);
}

.cx-btn--secondary:hover {
  background: var(--cx-gray-25);
  color: var(--cx-ink);
}

.cx-btn--ghost {
  background: transparent;
  color: var(--cx-accent-600);
  border-color: transparent;
  height: auto;
  padding: 0.35rem 0.25rem;
  font-size: 0.75rem;
}

.cx-btn .material-symbols-outlined {
  font-size: 1.05rem;
}

.cx-grid-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}

.cx-card {
  background: #fff;
  border-radius: 16px;
  padding: 0.7rem 0.85rem;
  min-height: 5rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(11, 13, 18, 0.04);
}

.cx-card--accent {
  background: var(--cx-grad-accent);
  color: #fff;
}

.cx-card--glass {
  background: var(--cx-grad-glass);
  color: #fff;
}

.cx-card__label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.65rem;
  margin-bottom: 0.35rem;
}

.cx-card--accent .cx-card__label,
.cx-card--glass .cx-card__label {
  color: rgba(255, 255, 255, 0.85);
}

.cx-card__icon {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff0e8;
  color: var(--cx-accent);
}

.cx-card--accent .cx-card__icon,
.cx-card--glass .cx-card__icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.cx-card__icon .material-symbols-outlined {
  font-size: 0.85rem;
}

.cx-amount {
  font-weight: 300;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-top: auto;
}

.cx-amount small {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-left: 0.2rem;
}

.cx-card__foot {
  margin-top: 0.45rem;
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cx-ticks {
  flex: 1;
  height: 0.35rem;
  border-radius: 0.2rem;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.55) 0 2px,
    transparent 2px 5px
  );
  overflow: hidden;
  position: relative;
}

.cx-ticks > i {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p, 25%);
  background: #fff;
  border-radius: inherit;
  opacity: 0.95;
}

.cx-badge {
  display: inline-flex;
  align-items: center;
  height: 1rem;
  padding: 0 0.45rem;
  border-radius: var(--cx-pill);
  background: #fff;
  color: var(--cx-ink);
  font-size: 0.6rem;
  font-weight: 500;
}

.cx-segments {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.45rem;
}

.cx-segments > i {
  flex: 1;
  height: 0.35rem;
  border-radius: var(--cx-pill);
  background: var(--cx-gray-100);
}

.cx-segments > i.is-on {
  background: var(--cx-accent);
}

.cx-grid-main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.65rem;
}

.cx-panel {
  background: #fff;
  border-radius: var(--cx-radius);
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(11, 13, 18, 0.04);
}

.cx-panel__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.cx-panel__head > span:last-of-type,
.cx-panel__title {
  flex: 1;
  font-size: 0.75rem;
  font-weight: 500;
}

.cx-office {
  overflow: hidden;
  border-radius: 14px;
  background: #12151d;
  min-height: 320px;
  height: min(52vh, 420px);
  position: relative;
}

.cx-office iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #12151d;
}

.cx-side-stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.cx-panel--tokens {
  background: linear-gradient(180deg, #fff0e8, #fff);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 100%;
  align-self: start;
  position: sticky;
  top: 0.75rem;
}

.cx-spend--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
  min-height: 0;
}

.cx-spend--stack .cx-spend__metric {
  min-width: 0;
}

.cx-spend--stack .cx-spend__chart {
  width: 100%;
  height: 8.5rem;
  min-height: 8.5rem;
}

.cx-provider-row--stack {
  flex-direction: column;
  align-items: stretch;
}

.cx-provider-row--stack .cx-provider-chip {
  justify-content: flex-start;
}

.cx-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.25rem;
  font-size: 0.7rem;
}

.cx-table th {
  text-align: left;
  font-weight: 400;
  color: var(--cx-fg-2);
  font-size: 0.6rem;
  padding: 0 0.5rem 0.35rem;
}

.cx-table td {
  padding: 0.55rem 0.5rem;
  background: var(--cx-gray-25);
}

.cx-table tr td:first-child {
  border-radius: 10px 0 0 10px;
}

.cx-table tr td:last-child {
  border-radius: 0 10px 10px 0;
}

.cx-agent-name {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
}

.cx-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  display: inline-block;
}

.cx-dot--ok {
  background: #22c55e;
}

.cx-dot--warn {
  background: #f59e0b;
}

.cx-dot--off {
  background: #9aa3b2;
}

.cx-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--cx-pill);
  background: #e8f8ee;
  color: #16a34a;
  font-size: 0.6rem;
}

.cx-status--warn {
  background: #fef3e1;
  color: #d97706;
}

.cx-status--off {
  background: var(--cx-gray-100);
  color: var(--cx-fg-2);
}

.cx-status-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.7rem;
  color: var(--cx-fg-2);
}

.cx-status-line i {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #9aa3b2;
}

.cx-status-line.is-online i {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.cx-spend {
  display: flex;
  gap: 1.25rem;
  align-items: flex-end;
  min-height: 7.5rem;
}

.cx-spend__metric {
  min-width: 7.5rem;
}

.cx-spend__metric .cx-amount {
  font-size: 1.85rem;
  margin-top: 0;
}

.cx-spend__metric small {
  display: block;
  margin-top: 0.35rem;
  color: var(--cx-fg-2);
  font-size: 0.65rem;
}

.cx-spend__chart {
  flex: 1;
  min-width: 0;
  height: 8.5rem;
  min-height: 8.5rem;
  display: flex;
  align-items: stretch;
  gap: 0.2rem;
  position: relative;
}

.cx-spend__chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.28rem;
  width: 100%;
  height: 100%;
  padding: 1.1rem 0.15rem 1.1rem;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 83, 0, 0.05), transparent 42%),
    repeating-linear-gradient(
      to top,
      transparent 0,
      transparent calc(25% - 1px),
      rgba(15, 23, 42, 0.06) calc(25% - 1px),
      rgba(15, 23, 42, 0.06) 25%
    );
  box-sizing: border-box;
}

.cx-spend__empty {
  font-size: 0.72rem;
  color: var(--cx-fg-2);
  align-self: center;
}

.cx-spend__bar {
  flex: 1;
  min-width: 0.32rem;
  border-radius: 0.28rem 0.28rem 0.12rem 0.12rem;
  background: #ffd0b5;
  position: relative;
  align-self: flex-end;
}

.cx-spend__bar.is-zero {
  background: rgba(15, 23, 42, 0.08);
}

.cx-spend__bar.is-peak {
  background: var(--cx-accent);
}

.cx-spend__bar em {
  position: absolute;
  left: 50%;
  bottom: -1.05rem;
  transform: translateX(-50%);
  font-style: normal;
  font-size: 0.55rem;
  color: var(--cx-fg-2);
  pointer-events: none;
}

.cx-spend__tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.35rem);
  transform: translateX(-50%);
  background: var(--cx-ink);
  color: #fff;
  font-size: 0.58rem;
  padding: 0.2rem 0.45rem;
  border-radius: var(--cx-pill);
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}

.cx-provider-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.cx-provider-chip {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  background: var(--cx-gray-25);
  font-size: 0.65rem;
}

.cx-provider-chip__bar {
  display: block;
  flex: 1 1 100%;
  width: 100%;
  height: 0.28rem;
  margin-top: 0.15rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.cx-provider-chip__bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.55;
}

.cx-provider-chip b {
  font-weight: 500;
}

.cx-provider-chip span {
  color: var(--cx-fg-2);
}

.cx-provider-chip i {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
}

.cx-provider-chip--claude { color: #d97757; }
.cx-provider-chip--gemini { color: #4285f4; }
.cx-provider-chip--codex { color: #10a37f; }
.cx-provider-chip--claude i { background: #d97757; }
.cx-provider-chip--gemini i { background: #4285f4; }
.cx-provider-chip--codex i { background: #10a37f; }

.cx-activity-list {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.cx-activity-item {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  gap: 0.55rem;
  align-items: start;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  background: var(--cx-gray-25);
  font-size: 0.7rem;
}

.cx-activity-item time {
  color: var(--cx-fg-2);
  font-size: 0.6rem;
  white-space: nowrap;
}

.cx-activity-item b {
  display: block;
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.cx-activity-item small {
  color: var(--cx-fg-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cx-activity-item em {
  font-style: normal;
  color: var(--cx-accent-600);
  font-size: 0.6rem;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .cx-grid-top {
    grid-template-columns: 1fr 1fr;
  }
  .cx-grid-top .cx-card--accent {
    grid-column: 1 / -1;
  }
  .cx-grid-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .cortex-overview__head {
    flex-direction: column;
  }
  .cortex-overview__actions {
    width: 100%;
  }
  .cortex-overview__actions .cx-btn--primary {
    flex: 1;
  }
  .cx-grid-top {
    grid-template-columns: 1fr;
  }
  .cx-office {
    min-height: 260px;
    height: 280px;
  }
}

.cx-agent-detail-btn {
  gap: 0.2rem;
}

.cx-agent-detail-btn__label {
  font-size: 0.62rem;
  font-weight: 500;
}

.cx-agent-detail {
  display: grid;
  gap: 1rem;
  padding-bottom: 2rem;
}

.cx-agent-detail__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.cx-agent-detail__head h1 {
  margin: 0.55rem 0 0.25rem;
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.cx-agent-detail__head p {
  margin: 0;
  color: var(--cx-fg-2);
  font-size: 0.85rem;
}

.cx-agent-detail__toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.cx-agent-detail__metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.cx-agent-detail__metrics article {
  background: var(--cx-panel, #fff);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.cx-agent-detail__metrics b {
  display: block;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.cx-agent-detail__metrics span {
  color: var(--cx-fg-2);
  font-size: 0.72rem;
}

.cx-agent-detail__metrics .is-ok b { color: #16a34a; }
.cx-agent-detail__metrics .is-bad b { color: #dc2626; }

.cx-agent-detail__logs {
  padding: 1rem 1.1rem;
}

.cx-log-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}

.cx-log-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #f8fafc;
  color: var(--cx-fg-2, #7a6a60);
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
}

.cx-log-filter em {
  font-style: normal;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--cx-ink, #130600);
}

.cx-log-filter.is-on {
  background: #fff0e8;
  border-color: rgba(255, 83, 0, 0.35);
  color: var(--cx-accent-600, #c43d00);
}

.cx-log-filter.is-on em {
  color: var(--cx-accent-600, #c43d00);
}

.cx-log-empty {
  margin: 0.5rem 0 0;
  color: var(--cx-fg-2, #7a6a60);
  font-size: 0.8rem;
}

.cx-evidence-loading {
  color: var(--cx-fg-2, #7a6a60);
  font-size: 0.72rem;
}

.cx-agent-detail__rules {
  padding: 1rem 1.1rem;
  background: var(--cx-panel, #fff);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 14px;
}

.cx-rule-summary {
  margin: 0 0 0.9rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: #fff7f2;
  border: 1px solid rgba(255, 83, 0, 0.14);
  color: var(--cx-ink, #130600);
  font-size: 0.86rem;
  line-height: 1.4;
}

.cx-rule-grid {
  display: grid;
  gap: 0.9rem;
}

.cx-rule-field {
  display: grid;
  gap: 0.45rem;
}

.cx-rule-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--cx-fg-2, #7a6a60);
}

.cx-rule-days,
.cx-rule-times,
.cx-rule-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cx-rule-field--full {
  grid-column: 1 / -1;
}

.cx-rule-tool {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  font-size: 0.72rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #344054;
}

.cx-rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 2.1rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #f8fafc;
  cursor: pointer;
  font-size: 0.78rem;
  user-select: none;
}

.cx-rule-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cx-rule-chip.is-on {
  background: #fff0e8;
  border-color: rgba(255, 83, 0, 0.35);
  color: var(--cx-accent-600, #c43d00);
  font-weight: 600;
}

.cx-rule-time {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2.1rem;
  padding: 0.25rem 0.35rem 0.25rem 0.7rem;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.cx-rule-time button {
  border: 0;
  background: transparent;
  color: #667085;
  cursor: pointer;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
}

.cx-rule-time button:hover {
  background: #fee2e2;
  color: #dc2626;
}

.cx-rule-empty {
  color: var(--cx-fg-2, #7a6a60);
  font-size: 0.78rem;
}

.cx-rule-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.cx-rule-add-row input[type="time"],
.cx-rule-add-row input[type="text"],
.cx-rule-field input[type="url"],
.cx-rule-field select {
  min-height: 2.25rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  padding: 0.4rem 0.65rem;
  font: inherit;
  font-size: 0.82rem;
  background: #fff;
  color: inherit;
}

.cx-rule-add-row input[type="text"],
.cx-rule-field input[type="url"] {
  flex: 1 1 160px;
  min-width: 140px;
}

.cx-rule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 1rem;
}

.cx-rule-actions small {
  color: var(--cx-fg-2, #7a6a60);
  font-size: 0.72rem;
}

.cx-agent-detail__table-wrap {
  overflow: auto;
}

.cx-exec-error {
  opacity: 0.72;
  font-size: 0.72rem;
  margin-top: 0.2rem;
}

.cx-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
}

.cx-evidence-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.cx-evidence-thumb {
  position: relative;
  width: 52px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  cursor: zoom-in;
}

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

.cx-evidence-thumb span {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font-size: 0.55rem;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  border-radius: 4px;
  padding: 0 3px;
  line-height: 1.3;
}

.cx-evidence-empty {
  color: var(--cx-fg-2);
  font-size: 0.75rem;
}

.cx-evidence-lightbox {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(10, 14, 20, 0.82);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.cx-evidence-lightbox[hidden] {
  display: none !important;
}

.cx-evidence-lightbox img {
  max-width: min(96vw, 1100px);
  max-height: 82vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  background: #111;
}

.cx-evidence-lightbox p {
  color: #fff;
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
}

.cx-evidence-lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

/* Página de detalhes: mesma informação no tablet/celular. */
.cortex-overview[data-cx-view="detail"] [data-cx-agent-detail] {
  display: block;
  width: 100%;
  min-height: 60vh;
  padding: 0 0 5.5rem;
}

.cortex-overview[data-cx-view="detail"] [data-cx-overview-main][hidden] {
  display: none !important;
}

@media (max-width: 1024px) {
  .cx-agent-detail__head {
    flex-direction: column;
    align-items: stretch;
  }

  .cx-agent-detail__toggle {
    width: 100%;
  }

  .cx-agent-detail__toggle .cx-btn {
    min-height: 2.5rem;
    padding: 0.55rem 0.95rem;
  }

  .cx-agent-detail__metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cx-agent-detail__logs {
    padding: 0.85rem 0.75rem;
  }

  .cx-agent-detail__table-wrap {
    overflow: visible;
  }

  .cx-agent-detail__table-wrap .cx-table thead {
    display: none;
  }

  .cx-agent-detail__table-wrap .cx-table,
  .cx-agent-detail__table-wrap .cx-table tbody {
    display: block;
    width: 100%;
  }

  .cx-agent-detail__table-wrap .cx-table tr.cx-exec-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem 0.75rem;
    margin: 0 0 0.75rem;
    padding: 0.85rem 0.9rem;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 14px;
  }

  .cx-agent-detail__table-wrap .cx-table td {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0;
    background: transparent;
    border-radius: 0;
  }

  .cx-agent-detail__table-wrap .cx-table td::before {
    content: attr(data-label);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--cx-fg-2, #7a6a60);
  }

  .cx-agent-detail__table-wrap .cx-table td[data-label="Resultado"],
  .cx-agent-detail__table-wrap .cx-table td[data-label="Evidência"] {
    grid-column: 1 / -1;
  }

  .cx-evidence-thumb {
    width: 72px;
    height: 54px;
  }

  .cx-agent-detail-btn__label {
    display: inline;
  }

  .cx-agent-balloon {
    flex-wrap: wrap;
    max-width: min(92vw, 420px);
    border-radius: 16px;
    padding: 0.45rem 0.55rem;
    gap: 0.25rem;
  }

  .cx-agent-balloon::after {
    display: none;
  }
}

@media (max-width: 720px) {
  .cx-agent-detail__metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
