/* ============================================================
   Mission Control — Design System
   Task Enterprise LLC · 2026
   ============================================================ */

/* --- Tokens --- */
:root {
  color-scheme: dark;

  /* Backgrounds */
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-raised: #1a1a1a;
  --surface-hover: rgba(255, 255, 255, 0.03);
  --surface-active: rgba(255, 255, 255, 0.05);

  /* Borders */
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(255, 255, 255, 0.20);

  /* Text */
  --text-1: #ececec;
  --text-2: #888;
  --text-3: #555;

  /* Accent — Task Enterprise Red */
  --accent: #dc3545;
  --accent-hover: #e84855;
  --accent-muted: rgba(220, 53, 69, 0.10);
  --accent-text: #ff6b78;

  /* Semantic */
  --green: #22c55e;
  --green-muted: rgba(34, 197, 94, 0.12);
  --yellow: #eab308;
  --yellow-muted: rgba(234, 179, 8, 0.12);
  --red: #ef4444;
  --red-muted: rgba(239, 68, 68, 0.12);
  --blue: #3b82f6;
  --blue-muted: rgba(59, 130, 246, 0.12);
  --purple: #8b5cf6;
  --purple-muted: rgba(139, 92, 246, 0.12);

  /* Layout */
  --sidebar-w: 240px;
  --rail-w: 320px;

  /* Radius */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;

  /* Typography */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Consolas", monospace;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; width: 100%; overflow-x: hidden; }

body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea { border: 0; outline: none; background: none; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, h4 { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.14); }
::-webkit-scrollbar-track { background: transparent; }


/* ============================================================
   Shell — App Frame
   ============================================================ */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

.app-shell.has-rail {
  grid-template-columns: var(--sidebar-w) 1fr var(--rail-w);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 1fr;
}

.app-shell.sidebar-collapsed.has-rail {
  grid-template-columns: 1fr var(--rail-w);
}

.app-shell.sidebar-collapsed > .sidebar {
  display: none;
}


/* --- Sidebar --- */

.sidebar {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px 14px;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 200px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
  filter: brightness(1.02);
}

.sidebar-brand-title {
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(224,53,53,.34);
  white-space: normal;
  text-align: center;
  line-height: 1.3;
}

.lock-logo {
  width: 360px;
  max-width: min(72vw, 360px);
  max-height: min(28vh, 180px);
  height: auto;
  display: block;
  object-fit: contain;
  margin: 0 auto 12px;
}

.sidebar-brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.01em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}

.sidebar-section {
  margin-bottom: 4px;
}

.sidebar-section-label {
  padding: 8px 8px 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 450;
  color: var(--text-2);
  transition: background 100ms, color 100ms;
  position: relative;
}

.sidebar-item:hover {
  background: var(--surface-hover);
  color: var(--text-1);
}

.sidebar-item-active {
  background: var(--accent-muted);
  color: var(--text-1);
}

.sidebar-item-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 1px;
  background: var(--accent);
}

.sidebar-item-icon {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--text-3);
  flex-shrink: 0;
}

.sidebar-item-active .sidebar-item-icon {
  color: var(--accent-text);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-footer-label {
  font-size: 11px;
  color: var(--text-3);
}

.sidebar-footer-value {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
}


/* --- Main Workspace --- */

.workspace {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: transparent;
  min-width: 0;
}

.workspace-header {
  flex-shrink: 0;
  padding: 24px 32px 0;
}

.workspace-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.workspace-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.02em;
}

.workspace-subtitle {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-2);
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.workspace-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 32px 32px;
}

.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.mobile-sidebar-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(86vw, 320px);
  transform: translateX(-100%);
  transition: transform 170ms ease;
  z-index: 100;
}

.mobile-sidebar-drawer.open {
  transform: translateX(0);
}


/* --- Right Rail --- */

.rail {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--surface);
  border-left: 1px solid var(--border);
}

.rail-header {
  flex-shrink: 0;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.rail-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}

.rail-subtitle {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}

.rail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.rail-section {
  margin-bottom: 24px;
}

.rail-section-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}


/* ============================================================
   Components
   ============================================================ */

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 100ms, color 100ms, border-color 100ms;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
}
.btn-secondary:hover {
  border-color: var(--border-strong);
  color: var(--text-1);
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text-1);
}

.btn-danger {
  background: var(--red-muted);
  color: var(--red);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.18); }

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-icon {
  width: 32px;
  padding: 0;
}


/* --- Fields --- */

.field {
  display: block;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-1);
  font-size: 13px;
  transition: border-color 120ms;
}

.field:focus { border-color: var(--border-focus); }
.field::placeholder { color: var(--text-3); }

.field-sm {
  height: 28px;
  font-size: 12px;
}

select.field, select.field-sm {
  background: #1a1a1a;
  color: var(--text-1);
}

select.field option, select.field-sm option {
  background: #1a1a1a;
  color: var(--text-1);
}

.field-area {
  height: auto;
  min-height: 80px;
  padding: 8px 10px;
  resize: vertical;
}

.field-label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.field-group {
  margin-bottom: 12px;
}


/* --- Status --- */

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-online { background: var(--green); }
.dot-active { background: var(--accent); }
.dot-warning { background: var(--yellow); }
.dot-error { background: var(--red); }
.dot-standby { background: var(--text-3); }
.dot-info { background: var(--blue); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 500;
  line-height: 18px;
}

.badge-green { background: var(--green-muted); color: var(--green); }
.badge-yellow { background: var(--yellow-muted); color: var(--yellow); }
.badge-red { background: var(--red-muted); color: var(--red); }
.badge-blue { background: var(--blue-muted); color: var(--blue); }
.badge-purple { background: var(--purple-muted); color: var(--purple); }
.badge-neutral { background: rgba(255, 255, 255, 0.06); color: var(--text-2); }


/* --- Tags --- */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: var(--r-sm);
  font-size: 11px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.04);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}


/* --- Tables --- */

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 10px 12px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
}

.table tr:hover td {
  background: var(--surface-hover);
}

.table td:first-child { color: var(--text-1); font-weight: 500; }


/* --- Cards --- */

.card {
  padding: 14px 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  transition: border-color 120ms;
}

.card:hover { border-color: var(--border-strong); }

.card-active {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.card-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-3);
}


/* --- Metric --- */

.metric {
  padding: 12px 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface-raised);
}

.metric-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.02em;
}

.metric-label {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
}

.metric-note {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-3);
}


/* --- Segmented Control --- */

.segmented {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.segmented-btn {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  transition: background 100ms, color 100ms;
}

.segmented-btn:hover { color: var(--text-2); background: var(--surface-hover); }
.segmented-btn-active { color: var(--text-1); background: var(--surface-active); }

.segmented-btn + .segmented-btn {
  border-left: 1px solid var(--border);
}


/* --- List Items --- */

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  transition: background 80ms;
  width: 100%;
  text-align: left;
}

.list-item:hover { background: var(--surface-hover); }
.list-item-active { background: var(--surface-active); }

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-sub {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}


/* --- Empty State --- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.empty-text {
  font-size: 13px;
  color: var(--text-3);
}


/* --- Sections & Panels --- */

.section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}

.section-subtitle {
  font-size: 12px;
  color: var(--text-3);
}

.panel {
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.panel-subtitle {
  font-size: 12px;
  color: var(--text-3);
}

.panel-body {
  padding: 16px;
}

.panel-body-flush {
  padding: 0;
}


/* ============================================================
   Layout Helpers
   ============================================================ */

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.split { display: grid; gap: 24px; }
.split-7-5 { grid-template-columns: 7fr 5fr; }
.split-8-4 { grid-template-columns: 2fr 1fr; }
.split-3-9 { grid-template-columns: 260px 1fr; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.stack { display: flex; flex-direction: column; gap: 2px; }

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Text utilities */
.text-1 { color: var(--text-1); }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-accent { color: var(--accent-text); }
.text-green { color: var(--green); }
.text-yellow { color: var(--yellow); }
.text-red { color: var(--red); }

.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 13px; }
.text-md { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

.mono { font-family: var(--font-mono); }


/* ============================================================
   Kanban Board
   ============================================================ */

.board-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  min-width: 0;
}

.lane {
  min-width: 0;
  background: var(--surface, #111);
  border-radius: var(--r-lg);
  padding: 12px 10px 14px;
  border: 1px solid var(--border);
}

.lane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
  margin-bottom: 12px;
}

.lane-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-2);
}

.lane-count {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 400;
  background: var(--surface-raised);
  border-radius: 9px;
  padding: 1px 6px;
  letter-spacing: 0;
  text-transform: none;
}

.lane-add {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  color: var(--text-3);
  font-size: 16px;
  display: grid;
  place-items: center;
}

.lane-add:hover { background: var(--surface-hover); color: var(--text-2); }

.lane-stack { display: flex; flex-direction: column; gap: 7px; }

.lane-empty {
  height: 60px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  font-size: 11px;
  color: var(--text-3);
}

.lane-card {
  padding: 10px 11px 9px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  width: 100%;
  text-align: left;
  transition: border-color 120ms, background 120ms, box-shadow 120ms;
  cursor: pointer;
}

.lane-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover, var(--surface-raised));
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.lane-card-active {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 1px var(--accent);
}

.lane-card-expanded {
  border-color: var(--accent) !important;
  border-radius: var(--r-md) var(--r-md) 0 0 !important;
  background: var(--surface-active);
}

.lane-card-title {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-bottom: 0;
}

.lane-card-title strong {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lane-card p {
  margin: 5px 0 0;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lane-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
}

.lane-card-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}


/* ============================================================
   Activity Feed
   ============================================================ */

.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.activity-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.activity-stack { display: flex; flex-direction: column; gap: 4px; }

@keyframes slide-in-feed {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

.activity-item {
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  width: 100%;
  text-align: left;
  transition: border-color 120ms, opacity 400ms ease, transform 400ms ease;
}

.activity-item-fresh {
  animation: slide-in-feed 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  border-color: var(--accent);
}

.activity-item:hover { border-color: var(--border-strong); }

.activity-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.activity-actor {
  font-size: 12px;
  font-weight: 600;
}

.activity-time {
  font-size: 11px;
  color: var(--text-3);
}

.activity-item strong {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-1);
  display: block;
  line-height: 1.35;
}

.activity-item p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.4;
}

/* ── Agent Office ───────────────────────────────────────────────────────── */

@keyframes agent-ring-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

@keyframes blink-warn {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

@keyframes wait-dot {
  0%, 100% { transform: translateY(0);    opacity: 0.4; }
  50%       { transform: translateY(-3px); opacity: 1; }
}

@keyframes panel-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.agent-ring {
  animation: agent-ring-pulse 2.2s ease-in-out infinite;
}

.blink-warn {
  animation: blink-warn 1.4s ease-in-out infinite;
}

.wait-dot-0 { animation: wait-dot 1.1s 0s   ease-in-out infinite; }
.wait-dot-1 { animation: wait-dot 1.1s .18s  ease-in-out infinite; }
.wait-dot-2 { animation: wait-dot 1.1s .36s  ease-in-out infinite; }

.office-panel {
  animation: panel-slide-in 0.28s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Agent thinking — slow glow pulse while waiting for Claude API response */
@keyframes thinking-pulse {
  0%, 100% { box-shadow: inset -4px -4px 0 rgba(0,0,0,.2), 0 0 8px var(--c, #74d697)40; }
  50%       { box-shadow: inset -4px -4px 0 rgba(0,0,0,.2), 0 0 24px var(--c, #74d697)90; }
}

.agent-thinking {
  animation: thinking-pulse 1.5s ease-in-out infinite;
}

/* Task complete flash — bright burst on the agent head */
@keyframes task-flash {
  0%   { opacity: 0.85; transform: scale(1); }
  25%  { opacity: 1;    transform: scale(1.15); }
  100% { opacity: 0;    transform: scale(1.4); }
}

/* Monitor typing — bars pulse width to simulate code/text being written */
@keyframes monitor-type {
  0%, 100% { opacity: 0.55; }
  50%       { opacity: 1; }
}

@keyframes station-scan {
  0%   { transform: translateY(-50%) scaleX(0.2); opacity: 0; }
  30%  { opacity: 1; }
  60%  { transform: translateY(-50%) scaleX(1); opacity: 0.9; }
  100% { transform: translateY(-50%) scaleX(0.2); opacity: 0; }
}

@keyframes burst-ring {
  0%   { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes bubble-float {
  0%   { transform: translateY(4px); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translateY(-6px); opacity: 0.85; }
}

@keyframes ctx-appear {
  from { transform: scale(0.92) translateY(-4px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

@keyframes char-walk-bob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-2px); }
}

@keyframes foot-l-step {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%       { transform: translateY(-3px) rotate(-12deg); }
}

@keyframes foot-r-step {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%       { transform: translateY(-3px) rotate(12deg); }
}

.char-walking {
  animation: char-walk-bob 0.36s ease-in-out infinite;
}

.foot-l {
  animation: foot-l-step 0.36s ease-in-out infinite;
}

.foot-r {
  animation: foot-r-step 0.36s 0.18s ease-in-out infinite;
}

/* Agents page needs full height for the office scene */
.page-agents {
  height: calc(100vh - 96px);
  min-height: 520px;
}

/* Agent tones */
.tone-task { color: var(--green); }
.tone-abdi { color: #74d697; }
.tone-ahmed { color: #8bd7ff; }
.tone-dame { color: #ff4d4d; }
.tone-rex { color: #f0b24c; }
.tone-prime { color: #8b8fff; }
.tone-atlas { color: #8bd7ff; }
.tone-ayub { color: #8b8fff; }
.tone-sygma { color: #8bd7ff; }


/* ============================================================
   Lock Screen
   ============================================================ */

.lock-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--bg);
}

.lock-card {
  width: 100%;
  max-width: 380px;
  padding: 40px;
}

.lock-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.lock-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--r-lg);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.lock-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
}

.lock-subtitle {
  font-size: 12px;
  color: var(--text-3);
}

.lock-form { margin-top: 24px; }

.lock-form .field { margin-bottom: 12px; }

.lock-error {
  font-size: 12px;
  color: var(--red);
  margin-bottom: 8px;
}

.lock-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  font-size: 11px;
  color: var(--text-3);
}


/* ============================================================
   Loading Shell
   ============================================================ */

.loading-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
}

.loading-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px;
}

.loading-main { padding: 32px; }

.loading-block {
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.03);
  animation: pulse 1.8s ease-in-out infinite;
}

.loading-block-lg { height: 24px; width: 160px; margin-bottom: 24px; }
.loading-block-md { height: 16px; width: 120px; margin-bottom: 8px; }
.loading-block-sm { height: 12px; width: 80px; margin-bottom: 8px; }

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}


/* ============================================================
   Error Shell
   ============================================================ */

.error-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--bg);
}

.error-content {
  max-width: 420px;
  text-align: center;
}

.error-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 8px;
}

.error-detail {
  font-size: 13px;
  color: var(--text-2);
}


/* ============================================================
   Page-specific: Kanban (Tasks / Home)
   ============================================================ */

.stats-strip {
  display: flex;
  align-items: baseline;
  gap: 24px;
  margin-bottom: 16px;
}

.stat-item strong {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-1);
  margin-right: 4px;
  letter-spacing: -0.02em;
}

.stat-item span {
  font-size: 12px;
  color: var(--text-3);
}

.stat-accent strong { color: var(--accent-text); }
.stat-green strong { color: var(--green); }

.controls-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}


/* ============================================================
   Page-specific: Chat / Voice
   ============================================================ */

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 720px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--r-lg);
  font-size: 13px;
  line-height: 1.5;
}

.chat-bubble-agent {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  align-self: flex-start;
}

.chat-bubble-user {
  background: var(--accent-muted);
  border: 1px solid rgba(220, 53, 69, 0.15);
  align-self: flex-end;
  color: var(--text-1);
}

.chat-bubble-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.chat-input-row .field { flex: 1; }


/* ============================================================
   Page-specific: Notes / Editor
   ============================================================ */

.notes-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  height: calc(100vh - 140px);
}

.notes-sidebar {
  overflow-y: auto;
}

.notes-editor {
  display: flex;
  flex-direction: column;
}

.notes-editor-area {
  flex: 1;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.7;
  resize: none;
  padding: 0;
}

.notes-editor-area::placeholder { color: var(--text-3); }


/* ============================================================
   Page-specific: Calendar
   ============================================================ */

.agenda-list { display: flex; flex-direction: column; gap: 2px; }

.agenda-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  width: 100%;
  text-align: left;
}

.agenda-item:hover { background: var(--surface-hover); }

.agenda-time {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.agenda-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
}

.agenda-sub {
  font-size: 12px;
  color: var(--text-3);
}


/* ============================================================
   Page-specific: Logs
   ============================================================ */

.log-stream { display: flex; flex-direction: column; gap: 1px; }

.log-row {
  display: grid;
  grid-template-columns: 6px 1fr auto 100px;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  width: 100%;
  text-align: left;
  transition: background 80ms;
}

.log-row:hover { background: var(--surface-hover); }
.log-row-active { background: var(--surface-active); }

.log-row-summary {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-row-stream {
  font-size: 12px;
  color: var(--text-3);
}

.log-row-time {
  font-size: 11px;
  color: var(--text-3);
  text-align: right;
  font-family: var(--font-mono);
}

.log-detail-card {
  padding: 16px;
}

.log-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.log-detail-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-detail-fact span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.log-detail-fact strong {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
}

.log-detail-body {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}


/* ============================================================
   Page-specific: MCP / Tools
   ============================================================ */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.tool-card {
  padding: 14px 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  width: 100%;
  text-align: left;
  transition: border-color 120ms;
}

.tool-card:hover { border-color: var(--border-strong); }
.tool-card-active { border-color: var(--accent); }

.tool-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tool-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.tool-card-vendor {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 4px;
}

.tool-card-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}


/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1400px) {
  .app-shell.has-rail {
    grid-template-columns: var(--sidebar-w) 1fr;
  }
  .rail { display: none; }
  .board-layout { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  :root { --sidebar-w: 200px; }
  .board { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .app-shell, .app-shell.has-rail {
    grid-template-columns: 1fr;
  }
  .sidebar { display: none; }
  .mobile-sidebar-drawer .sidebar { display: flex !important; }
  .workspace { height: 100dvh; }
  .workspace-body { padding: 12px; }
  .workspace-header { padding: 12px 12px 0; }
  .workspace-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .workspace-title { font-size: 18px; line-height: 1.2; }
  .workspace-subtitle { font-size: 12px; }
  .workspace-actions {
    width: 100%;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .workspace-actions .field.field-sm {
    width: 100% !important;
    min-width: 0;
  }
  .workspace-actions > .text-xs.text-3 {
    margin-left: auto;
  }
  .split {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .board {
    grid-template-columns: 1fr !important;
  }
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .voice-agents-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  input, textarea, select {
    font-size: 16px !important;
  }
}


/* ============================================================
   Voice Page — Agent Cards + Live Conversation
   ============================================================ */

.voice-agents-row {
  display: flex;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* 4-per-row grid layout for voice agent picker */
.voice-agents-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-y: auto;
}

.voice-agent-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 18px 12px 14px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  cursor: pointer;
  transition: border-color 150ms, box-shadow 150ms, background 150ms;
  width: 100%;
}

.voice-agent-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.voice-agent-card-active {
  background: rgba(255,255,255,0.04);
}

.voice-agent-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  transition: background 200ms, color 200ms;
}

.voice-agent-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
}

.voice-agent-role {
  font-size: 11px;
  color: var(--text-3);
}

.voice-agent-status {
  font-size: 11px;
  font-weight: 500;
}

/* Waveform animation */
.voice-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 16px;
}

.voice-bar {
  width: 3px;
  border-radius: 2px;
  background: currentColor;
  animation: voiceBarIdle 1s ease-in-out infinite;
}

.voice-bar-listen {
  background: var(--blue);
  animation: voiceBarListen 0.6s ease-in-out infinite;
}

.voice-bar-speak {
  background: var(--green);
  animation: voiceBarSpeak 0.5s ease-in-out infinite;
}

@keyframes voiceBarIdle {
  0%, 100% { height: 4px; }
  50% { height: 12px; }
}

@keyframes voiceBarListen {
  0%, 100% { height: 4px; opacity: 0.5; }
  50% { height: 16px; opacity: 1; }
}

@keyframes voiceBarSpeak {
  0%, 100% { height: 6px; opacity: 0.7; }
  50% { height: 20px; opacity: 1; }
}

/* Status bar */
.voice-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.voice-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.voice-status-dot-idle { background: var(--text-3); }
.voice-status-dot-listen { background: var(--blue); animation: pulse-dot 1s ease-in-out infinite; }
.voice-status-dot-speak  { background: var(--green); animation: pulse-dot 0.6s ease-in-out infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* Transcript */
.voice-transcript {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 16px;
}

.voice-msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.voice-msg-user { align-items: flex-end; }
.voice-msg-agent { align-items: flex-start; }

.voice-msg-name {
  font-size: 11px;
  color: var(--text-3);
  padding: 0 4px;
}

.voice-msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: var(--r-lg);
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid var(--border);
}

.voice-msg-user .voice-msg-bubble {
  background: var(--accent-muted);
  border-color: rgba(220,53,69,0.2);
}

.voice-msg-agent .voice-msg-bubble {
  background: var(--surface-raised);
}

.voice-msg-interim {
  opacity: 0.55;
  font-style: italic;
}

.voice-msg-time {
  font-size: 10px;
  color: var(--text-3);
  padding: 0 4px;
}

/* ============================================================
   Voice Call Zone — orb, strip, hold button
   ============================================================ */

.voice-call-zone {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  padding-bottom: 4px;
}

/* Identity strip row */
.voice-call-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 8px;
}

/* Hold-to-talk button — transparent ghost, sits left of agent name */
.voice-hold-btn {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.14);
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
  transition: border-color 120ms, color 120ms, background 120ms;
}
.voice-hold-btn:active,
.voice-hold-btn-active {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(59,130,246,0.08);
}

/* Orb zone — centers the ball */
.voice-orb-zone {
  display: flex;
  justify-content: center;
  padding: 10px 0 14px;
}

/* The orb itself */
.voice-orb {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  display: grid;
  place-items: center;
  position: relative;
  transition: box-shadow 400ms ease, transform 300ms ease;
}

/* Agent speaking — glows in agent color */
.voice-orb-speaking {
  animation: orb-speak 1.6s ease-in-out infinite;
  border-color: rgba(255,255,255,0.12);
}

@keyframes orb-speak {
  0%, 100% {
    box-shadow:
      0 0 14px 3px var(--orb-glow, var(--accent)),
      0 0 36px 8px var(--orb-glow-dim, rgba(100,180,255,0.15));
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 0 26px 8px var(--orb-glow, var(--accent)),
      0 0 60px 18px var(--orb-glow-dim, rgba(100,180,255,0.15));
    transform: scale(1.05);
  }
}

/* Thinking — slow dim pulse */
.voice-orb-thinking {
  animation: orb-think 2s ease-in-out infinite;
}

@keyframes orb-think {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.75; }
}

/* Listening (user talking) — blue accent border */
.voice-orb-listening {
  border-color: var(--blue);
  background: rgba(59,130,246,0.04);
  overflow: visible;
}

/* Ripple rings — expand outward when user is talking */
.voice-ripple-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid var(--blue);
  width: 82px;
  height: 82px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  opacity: 0;
  animation: ripple-expand 1.4s ease-out infinite;
  pointer-events: none;
}

@keyframes ripple-expand {
  0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 0.7; }
  100% { transform: translate(-50%, -50%) scale(2);   opacity: 0; }
}

/* ============================================================
   Voice Conversation Log Cards (Logs tab)
   ============================================================ */

/* Agent overview grid in Logs tab */
.vc-agent-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.vc-agent-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 10px 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  border-top: 3px solid transparent;
  background: var(--surface-raised);
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
  text-align: center;
}

.vc-agent-tile:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  border-top-color: inherit;
}

.vc-agent-tile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

.vc-agent-tile-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.vc-agent-tile-role {
  font-size: 10px;
  color: var(--text-3);
  line-height: 1;
}

.vc-agent-tile-stats {
  display: flex;
  gap: 6px;
  font-size: 10px;
  color: var(--text-3);
  margin-top: 2px;
}

.vc-agent-tile-stats span:first-child {
  font-weight: 600;
  color: var(--text-2);
}

.vc-log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vc-log-card {
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  background: var(--surface-raised);
  overflow: hidden;
  transition: border-color 150ms;
}

.vc-log-card:hover {
  border-color: var(--border-strong);
  border-left-color: inherit;
}

.vc-log-card-open {
  border-color: var(--border-strong);
}

.vc-log-header {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  gap: 0;
  text-align: left;
}

.vc-log-header:hover {
  background: rgba(255,255,255,0.03);
}

.vc-log-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.vc-log-agent {
  font-size: 13px;
  font-weight: 600;
}

.vc-log-pin-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(251,191,36,0.15);
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,0.3);
}

.vc-log-count {
  font-size: 11px;
  color: var(--text-3);
  background: rgba(255,255,255,0.06);
  padding: 1px 7px;
  border-radius: 10px;
}

.vc-log-chevron {
  font-size: 10px;
  color: var(--text-3);
}

.vc-log-preview {
  padding: 0 16px 12px;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.vc-log-preview-role {
  font-weight: 600;
  color: var(--text-2);
}

.vc-log-body {
  border-top: 1px solid var(--border);
  padding: 12px 16px;
}

.vc-log-messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 4px;
}

.vc-log-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vc-log-msg-user {
  align-items: flex-end;
}

.vc-log-msg-agent {
  align-items: flex-start;
}

.vc-log-msg-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vc-log-msg-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 10px;
  max-width: 80%;
}

.vc-log-msg-user .vc-log-msg-text {
  background: var(--accent-muted, rgba(220,53,69,0.12));
}

.vc-log-msg-time {
  font-size: 10px;
  color: var(--text-3);
}

.vc-log-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}


/* ============================================================
   Live indicator
   ============================================================ */

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--green);
  font-weight: 500;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 1.5s ease-in-out infinite;
}


/* ============================================================
   Calendar — Agent Colors + Filters
   ============================================================ */

.cal-filter-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cal-chip {
  height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-3);
  transition: border-color 100ms, color 100ms;
  text-transform: capitalize;
}

.cal-chip:hover { border-color: var(--border-strong); color: var(--text-2); }
.cal-chip-active { border-color: var(--border-strong); color: var(--text-1); background: var(--surface-active); }

/* ============================================================
   Leads & Revenue Dashboard
   ============================================================ */

.revenue-page { display: flex; flex-direction: column; gap: 20px; }
.revenue-hero {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; padding: 24px;
  border: 1px solid rgba(255,255,255,0.07); border-radius: 20px;
  background:
    radial-gradient(circle at top left, rgba(220,53,69,0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(255,184,0,0.08), transparent 26%),
    linear-gradient(180deg, rgba(19,19,22,0.95), rgba(12,12,16,0.96));
  box-shadow: 0 18px 48px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.03);
}
.revenue-eyebrow {
  display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 999px;
  background: rgba(131,33,44,0.35); color: #f3c4c8; font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.revenue-title { margin-top: 16px; font-size: 42px; line-height: 1.02; letter-spacing: -0.04em; }
.revenue-subtitle { margin-top: 10px; max-width: 760px; color: #a3a3aa; font-size: 15px; line-height: 1.7; }
.revenue-live-strip {
  margin-top: 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  color: #9da0ab; font-size: 12px;
}
.revenue-live-badge {
  display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px;
  border: 1px solid rgba(101,210,144,0.22); background: rgba(33,80,52,0.28); color: #b8f0ce; font-weight: 600;
}
.revenue-live-warning {
  margin-top: 12px; padding: 11px 14px; border-radius: 14px;
  border: 1px solid rgba(240,186,93,0.18); background: rgba(84,63,23,0.22); color: #f0d29f; font-size: 12px; line-height: 1.55;
}
.revenue-toolbar { display: flex; flex-direction: column; gap: 14px; }
.revenue-range-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.revenue-chip {
  padding: 9px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.025); color: #b8b8bf; transition: all .18s ease;
}
.revenue-chip:hover, .revenue-chip-active {
  background: rgba(220,53,69,0.14); border-color: rgba(255,107,120,0.45); color: #fff;
}
.revenue-filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.revenue-filter { display: flex; flex-direction: column; gap: 7px; }
.revenue-filter span, .revenue-kpi-label, .metric-blip-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #6e6e77;
}
.revenue-filter select, .revenue-search {
  width: 100%; height: 40px; padding: 0 13px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); color: #f1f1f4;
}
.revenue-kpi-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 12px; }
.revenue-kpi-card {
  display: flex; flex-direction: column; gap: 12px; min-height: 152px; padding: 16px; text-align: left;
  border-radius: 18px; border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(24,24,28,0.92), rgba(17,17,20,0.94));
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.revenue-kpi-card:hover { transform: translateY(-2px); border-color: rgba(255,107,120,0.32); box-shadow: 0 14px 34px rgba(0,0,0,0.24); }
.revenue-kpi-top, .funnel-stage-top, .pipeline-stage-row, .source-breakdown-row, .activity-feed-row, .revenue-table-toolbar, .revenue-pagination, .revenue-list-row, .roi-channel-top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.revenue-kpi-change { font-size: 11px; font-weight: 700; }
.revenue-kpi-change-up, .tone-green { color: #63d18f; }
.revenue-kpi-change-down, .tone-red { color: #ff7575; }
.revenue-kpi-change-flat { color: #d3c06d; }
.revenue-kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.04em; }
.revenue-kpi-detail, .metric-blip-note, .pipeline-stage-sub, .source-breakdown-sub, .activity-feed-detail, .insight-detail, .revenue-list-sub, .revenue-list-empty, .detail-fact span, .revenue-contact-stack span, .revenue-notes-preview, .lead-detail-subtitle, .revenue-table-meta {
  color: #8b8b94; font-size: 12px; line-height: 1.55;
}
.revenue-unavailable-note {
  margin-top: auto; color: #f0c48f; font-size: 12px; line-height: 1.5;
}
.revenue-sparkline, .trend-chart { width: 100%; height: 34px; }
.revenue-loading-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.revenue-loading-card {
  min-height: 112px; border-radius: 18px; border: 1px solid rgba(255,255,255,0.05);
  background: linear-gradient(90deg, rgba(24,24,28,0.9), rgba(34,34,40,0.9), rgba(24,24,28,0.9));
  background-size: 220% 100%;
  animation: revenueSkeleton 1.4s ease infinite;
}
.revenue-primary-grid, .revenue-secondary-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(320px,.85fr); gap: 16px; }
.revenue-side-stack { display: flex; flex-direction: column; gap: 16px; }
.revenue-panel.panel {
  border-radius: 20px; border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(18,18,22,0.96), rgba(13,13,16,0.97));
  box-shadow: 0 16px 38px rgba(0,0,0,0.24);
}
.revenue-tight-panel .panel-body { padding-top: 4px; }
.revenue-funnel-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.funnel-stage-card, .roi-channel-card, .revenue-list-card, .lead-detail-drawer, .trend-card, .metric-blip {
  border: 1px solid rgba(255,255,255,0.08); border-radius: 18px; background: rgba(255,255,255,0.02);
}
.funnel-stage-card, .metric-blip { padding: 14px; }
.funnel-stage-index {
  padding: 6px 10px; border-radius: 999px; background: #eef1fb; color: #232733; font-size: 11px; font-weight: 700;
}
.funnel-stage-name, .pipeline-stage-name, .source-breakdown-name, .revenue-list-title, .trend-card-title, .lead-detail-title, .insight-title { font-weight: 700; letter-spacing: -0.02em; }
.funnel-stage-count { font-size: 26px; font-weight: 700; }
.funnel-stage-stats { display: flex; flex-wrap: wrap; gap: 10px; color: #a7a7b0; font-size: 12px; }
.funnel-stage-unavailable {
  min-height: 84px; display: flex; align-items: center; color: #e1b784; font-size: 12px; line-height: 1.6;
}
.funnel-stage-bar, .roi-channel-bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.06); overflow: hidden; }
.funnel-stage-bar div, .roi-channel-bar div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, rgba(255,124,137,0.88), rgba(255,198,128,0.9)); }
.pipeline-health-metrics, .revenue-mini-columns, .roi-channel-grid, .lead-detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.metric-blip-value { margin-top: 8px; font-size: 22px; font-weight: 700; }
.pipeline-stage-list, .source-breakdown-list, .activity-feed-list, .insights-list { display: flex; flex-direction: column; gap: 10px; }
.pipeline-stage-row, .source-breakdown-row, .activity-feed-row, .revenue-list-row {
  padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,0.025); border: 1px solid rgba(255,255,255,0.06);
}
.pipeline-stage-count {
  min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px;
  background: rgba(255,255,255,0.06); font-weight: 700;
}
.activity-feed-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.activity-feed-dot-info { background: #7a8599; }
.activity-feed-dot-warning { background: #f0ba5d; }
.activity-feed-dot-success { background: #63d18f; }
.activity-feed-side { min-width: 96px; display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: #8c8c96; text-align: right; }
.insight-card { padding: 14px 16px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.06); }
.insight-card-positive { background: rgba(37,88,59,0.18); }
.insight-card-warning { background: rgba(105,78,29,0.22); }
.insight-card-critical { background: rgba(105,34,41,0.28); }
.revenue-table-chip, .status-pill, .tag-chip { display: inline-flex; align-items: center; border-radius: 999px; }
.revenue-table-chip { padding: 8px 10px; background: rgba(255,255,255,0.04); color: #bbbcc4; font-size: 12px; }
.revenue-table-wrap { max-height: 580px; }
.revenue-table .revenue-row-active td { background: rgba(220,53,69,0.07); }
.revenue-sort-head { display: inline-flex; align-items: center; gap: 6px; color: inherit; }
.status-pill { padding: 6px 10px; font-size: 11px; border: 1px solid transparent; }
.status-pill-green { color: #aef0c9; background: rgba(42,104,66,0.28); border-color: rgba(99,209,143,0.24); }
.status-pill-amber { color: #f4d58d; background: rgba(116,90,36,0.25); border-color: rgba(240,186,93,0.24); }
.status-pill-red { color: #ffb0b0; background: rgba(118,43,43,0.24); border-color: rgba(255,117,117,0.24); }
.status-pill-neutral { color: #ced3dc; background: rgba(83,88,101,0.24); border-color: rgba(161,167,181,0.18); }
.status-pill-subtle { opacity: .88; }
.tag-cluster { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-chip { padding: 5px 9px; background: rgba(255,255,255,0.05); color: #cfcfd6; font-size: 11px; }
.revenue-contact-stack, .detail-fact { display: flex; flex-direction: column; gap: 3px; }
.revenue-page-dots { display: flex; gap: 8px; }
.revenue-page-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.12); }
.revenue-page-dot-active { background: var(--accent); box-shadow: 0 0 0 4px rgba(220,53,69,0.16); }
.lead-detail-drawer { margin-top: 16px; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.lead-detail-note { padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.06); color: #c8c8cf; line-height: 1.6; }
.detail-fact strong, .revenue-list-value { font-weight: 700; }
.revenue-data-banner {
  padding: 14px 16px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}
.revenue-data-banner-warning { border-color: rgba(240,186,93,0.2); background: rgba(88,67,26,0.18); }
.revenue-data-banner-critical { border-color: rgba(255,117,117,0.18); background: rgba(86,29,34,0.22); }
.revenue-data-banner-title { font-size: 13px; font-weight: 700; color: #f3f4f7; }
.revenue-data-banner-detail { margin-top: 6px; color: #bbbcc5; font-size: 12px; line-height: 1.6; }

@keyframes revenueSkeleton {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (max-width: 1680px) {
  .revenue-kpi-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .pipeline-health-metrics, .revenue-mini-columns, .roi-channel-grid, .lead-detail-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 1360px) {
  .revenue-hero, .revenue-primary-grid, .revenue-secondary-grid { grid-template-columns: 1fr; }
  .revenue-funnel-grid, .revenue-filter-grid, .revenue-kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .revenue-loading-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
/* CORTEX — Task Enterprise Intelligence System
   Same C2 color tokens. Different format: data-dense system UI.
   ============================================================ */

/* ── Shell ─────────────────────────────────────────────────── */

.cx-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

.cx-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.cx-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* ── HQ Bar ────────────────────────────────────────────────── */

.cx-hq-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 40px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.cx-hq-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.cx-hq-logo {
  font-size: 13px;
  color: var(--accent);
}

.cx-hq-name {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--text-1);
}

.cx-hq-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.cx-hq-metric {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.cx-hq-metric-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.02em;
}

.cx-hq-metric-label {
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.04em;
}

.cx-hq-sep {
  color: var(--text-3);
  font-size: 12px;
}

.cx-hq-offline {
  font-size: 11px;
  color: var(--text-3);
}

.cx-hq-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.cx-hq-live {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--green);
}

.cx-hq-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.4;
  transition: opacity 0.6s;
}

.cx-hq-pulse.cx-hq-pulse-on {
  opacity: 1;
}

.cx-hq-dead {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.cx-hq-dead-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
}

/* ── Agent Rail ────────────────────────────────────────────── */

.cx-rail {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  background: var(--surface);
}

.cx-rail-agent {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 0 8px;
  padding: 7px 10px 7px 12px;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  transition: background 0.1s;
  width: 100%;
  position: relative;
}

.cx-rail-agent:hover { background: var(--surface-hover); }
.cx-rail-active { background: var(--surface-active) !important; }
.cx-rail-active::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
}

.cx-rail-all { border-bottom: 1px solid var(--border); margin-bottom: 4px; }

.cx-rail-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  grid-row: 1;
  flex-shrink: 0;
}

.cx-rail-name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-2);
  grid-row: 1;
  grid-column: 2;
  transition: color 0.15s;
}

.cx-rail-count {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-3);
  grid-row: 1;
  grid-column: 3;
}

.cx-rail-last {
  font-size: 9px;
  color: var(--text-3);
  grid-row: 2;
  grid-column: 2 / 4;
  margin-top: 1px;
}

.cx-rail-live-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--green);
  position: absolute;
  right: 8px;
  top: 8px;
  animation: cx-blink 1.4s ease-in-out infinite;
}

@keyframes cx-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

.cx-rail-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 10px;
}

.cx-rail-feed-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-3);
  padding: 6px 12px 4px;
}

.cx-rail-feed {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 8px;
}

.cx-rail-feed-empty {
  font-size: 10px;
  color: var(--text-3);
  padding: 6px 12px;
  font-style: italic;
}

.cx-rail-feed-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 10px 4px 12px;
  border-bottom: 1px solid var(--border);
}

.cx-rail-feed-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.cx-rail-feed-content {
  font-size: 10px;
  color: var(--text-2);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── Filter Bar ─────────────────────────────────────────────── */

.cx-filterbar {
  padding: 10px 14px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface);
}

.cx-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  flex-wrap: wrap;
}

.cx-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 200px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  transition: border-color 0.15s;
}

.cx-search-wrap:focus-within {
  border-color: var(--accent);
}

.cx-search-icon {
  padding: 0 8px;
  font-size: 14px;
  color: var(--text-3);
  flex-shrink: 0;
}

.cx-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text-1);
  padding: 7px 0;
  font-family: var(--font);
}

.cx-search-input::placeholder { color: var(--text-3); }

.cx-search-clear {
  padding: 0 10px;
  font-size: 16px;
  color: var(--text-3);
  flex-shrink: 0;
  transition: color 0.1s;
}
.cx-search-clear:hover { color: var(--text-1); }

.cx-search-btn {
  padding: 7px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
}
.cx-search-btn:hover { background: var(--accent-hover); }
.cx-search-btn:disabled { opacity: 0.5; }

.cx-filter-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 11px;
  color: var(--text-2);
  background: var(--bg);
  transition: all 0.15s;
  flex-shrink: 0;
  white-space: nowrap;
}
.cx-filter-toggle:hover { border-color: var(--border-focus); color: var(--text-1); }
.cx-filter-toggle-on { border-color: var(--accent); color: var(--accent); }
.cx-filter-toggle-active .cx-filter-badge { color: var(--accent); font-size: 8px; }

.cx-clear-all {
  font-size: 11px;
  color: var(--text-3);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: color 0.1s;
}
.cx-clear-all:hover { color: var(--accent); }

.cx-result-meta {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ── Filter Panel ───────────────────────────────────────────── */

.cx-filter-panel {
  padding: 10px 0 12px;
  border-top: 1px solid var(--border);
}

.cx-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px 12px;
}

.cx-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cx-filter-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-3);
  text-transform: uppercase;
}

.cx-filter-select,
.cx-filter-input {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.cx-filter-select:focus,
.cx-filter-input:focus {
  border-color: var(--accent);
}

.cx-filter-input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5);
  cursor: pointer;
}

.cx-level-btns {
  display: flex;
  gap: 4px;
}

.cx-level-btn {
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--text-3);
  background: var(--bg);
  transition: all 0.15s;
}

.cx-level-btn:hover { border-color: var(--border-focus); color: var(--text-1); }
.cx-level-info.cx-level-active    { border-color: var(--blue);   color: var(--blue);   background: var(--blue-muted); }
.cx-level-warning.cx-level-active { border-color: var(--yellow); color: var(--yellow); background: var(--yellow-muted); }
.cx-level-error.cx-level-active   { border-color: var(--red);    color: var(--red);    background: var(--red-muted); }

/* ── Toolbar ─────────────────────────────────────────────────── */

.cx-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cx-toolbar-btn {
  font-size: 11px;
  color: var(--text-3);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: all 0.15s;
}
.cx-toolbar-btn:hover { color: var(--text-1); border-color: var(--border); }
.cx-toolbar-btn-active { color: var(--accent); border-color: var(--accent-muted); background: var(--accent-muted); }

.cx-toolbar-info {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-left: auto;
}

/* ── Stats Panel ─────────────────────────────────────────────── */

.cx-stats-panel {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.cx-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.cx-stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
}

.cx-stat-val {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-1);
  letter-spacing: -0.02em;
}

.cx-stat-label {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cx-stats-section {
  margin-top: 10px;
}

.cx-stats-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.cx-stat-bar-row {
  display: grid;
  grid-template-columns: 72px 1fr 48px;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.cx-stat-bar-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cx-stat-bar-track {
  height: 4px;
  background: var(--surface-raised);
  border-radius: 2px;
  overflow: hidden;
}

.cx-stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s;
}

.cx-stat-bar-count {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-3);
  text-align: right;
}

.cx-stats-range {
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── Results ─────────────────────────────────────────────────── */

.cx-results {
  flex: 1;
  overflow: hidden;
  display: flex;
  min-height: 0;
}

.cx-results-split .cx-result-list {
  border-right: 1px solid var(--border);
}

.cx-result-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  min-width: 0;
}

/* ── Result Card ─────────────────────────────────────────────── */

.cx-card {
  display: flex;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  padding: 0;
}

.cx-card:hover  { background: var(--surface-hover); }
.cx-card-selected { background: var(--surface-active); }

.cx-card-stripe {
  width: 2px;
  flex-shrink: 0;
  align-self: stretch;
}

.cx-card-body {
  flex: 1;
  padding: 9px 12px 9px 10px;
  min-width: 0;
}

.cx-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.cx-card-agent {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

.cx-card-chip {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 1px solid;
  border-radius: 3px;
  padding: 1px 5px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.cx-card-tool {
  font-size: 10px;
  color: var(--purple);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.cx-card-time {
  font-size: 10px;
  color: var(--text-3);
  margin-left: auto;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.cx-card-content {
  font-size: 12px;
  color: var(--text-1);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.cx-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.cx-card-src {
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.cx-card-session {
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.cx-card-rank {
  font-size: 10px;
  color: var(--accent);
  font-family: var(--font-mono);
}

/* ── Load More ───────────────────────────────────────────────── */

.cx-load-more {
  width: 100%;
  padding: 12px;
  font-size: 12px;
  color: var(--text-3);
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  text-align: center;
}
.cx-load-more:hover { color: var(--text-1); background: var(--surface-hover); }
.cx-load-more:disabled { opacity: 0.4; }

/* ============================================================
   Monitoring Embed
   ============================================================ */

.monitor-embed-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
}

.monitor-embed-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.monitor-embed-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.monitor-embed-title {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-1);
}

.monitor-embed-subtitle {
  margin-top: 8px;
  max-width: 760px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
}

.monitor-embed-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.monitor-embed-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.monitor-embed-card {
  display: flex;
  flex-direction: column;
  min-height: 70vh;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(220, 53, 69, 0.08) 0%, rgba(220, 53, 69, 0) 18%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}

.monitor-embed-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 12, 12, 0.82);
}

.monitor-embed-link {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--accent-text);
}

.monitor-embed-link:hover {
  color: #fff;
}

.monitor-embed-frame {
  width: 100%;
  flex: 1;
  min-height: 720px;
  border: 0;
  background: #050505;
}

.monitor-embed-footer {
  padding: 12px 20px 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.02);
}

/* ── Detail Pane ─────────────────────────────────────────────── */

.cx-detail {
  width: 360px;
  min-width: 300px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.cx-detail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.cx-detail-agent {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.cx-detail-event {
  font-size: 10px;
  color: var(--text-3);
  background: var(--surface-raised);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.cx-detail-close {
  margin-left: auto;
  font-size: 16px;
  color: var(--text-3);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  transition: color 0.1s, background 0.1s;
}
.cx-detail-close:hover { color: var(--text-1); background: var(--surface-hover); }

.cx-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.cx-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.cx-detail-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cx-detail-fact-key {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-3);
  text-transform: uppercase;
}

.cx-detail-fact-val {
  font-size: 11px;
  color: var(--text-1);
  font-family: var(--font-mono);
  word-break: break-all;
}

.cx-detail-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 6px;
  margin-top: 12px;
}

.cx-detail-content {
  font-size: 12px;
  color: var(--text-1);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
}

.cx-detail-raw {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-2);
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin: 0;
}

.cx-detail-id {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-3);
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  word-break: break-all;
}

/* ── Empty + Skeleton ────────────────────────────────────────── */

.cx-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 200px;
  color: var(--text-3);
}

.cx-empty-icon {
  font-size: 24px;
  opacity: 0.4;
}

.cx-empty-text {
  font-size: 12px;
  color: var(--text-3);
}

.cx-skeleton {
  padding: 8px 0;
}

.cx-skel-row {
  display: grid;
  grid-template-columns: 8px 1fr 52px 60px;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.cx-skel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface-raised);
  animation: cx-pulse 1.4s ease-in-out infinite;
}

.cx-skel-line {
  height: 10px;
  border-radius: 4px;
  background: var(--surface-raised);
  animation: cx-pulse 1.4s ease-in-out infinite;
}

.cx-skel-tag {
  height: 16px;
  width: 44px;
  border-radius: 4px;
  background: var(--surface-raised);
  animation: cx-pulse 1.4s ease-in-out infinite;
}

.cx-skel-time {
  height: 10px;
  border-radius: 4px;
  background: var(--surface-raised);
  animation: cx-pulse 1.4s ease-in-out infinite;
}

@keyframes cx-pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.9; }
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 900px) {
  .cx-body { grid-template-columns: 160px 1fr; }
  .cx-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .cx-detail { width: 280px; min-width: 240px; }
}

@media (max-width: 640px) {
  .cx-body { grid-template-columns: 1fr; }
  .cx-rail { display: none; }
  .cx-detail { width: 100%; position: fixed; inset: 0; z-index: 100; }
}




/* ============================================================
   Rex Command Center — Network Persistence Monitor  2026
   ============================================================ */

/* ── Page shell ── */
.mon-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}

/* Dot-grid background — subtle, futuristic */
.mon-page::before {
  content: '';
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(circle, rgba(220,53,69,.09) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
}
.mon-page > * { position: relative; z-index: 1; }

/* ── Top bar ── */
.mon-topbar {
  height: 58px;
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,10,.85);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
  position: relative;
}
/* Glowing red scanner line at top */
.mon-topbar::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 30%, #ff6b78 50%, var(--accent) 70%, transparent 100%);
  opacity: .7;
  box-shadow: 0 0 16px 2px rgba(220,53,69,.4);
}
/* Animated scan shimmer */
.mon-topbar::after {
  content: '';
  position: absolute; top: 0; left: -100%; width: 60%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,107,120,.8), transparent);
  animation: mon-scan 4s linear infinite;
}
@keyframes mon-scan { 0%{left:-60%} 100%{left:160%} }

.mon-topbar-brand { display: flex; align-items: center; gap: 14px; }
.mon-brand-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, rgba(220,53,69,.2), rgba(220,53,69,.08));
  border: 1px solid rgba(220,53,69,.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 900; color: var(--accent-text);
  box-shadow: 0 0 18px rgba(220,53,69,.25), inset 0 1px 0 rgba(255,255,255,.05);
}
.mon-brand-kicker {
  font-size: 9px; font-weight: 700; letter-spacing: .22em;
  text-transform: uppercase; color: var(--accent-text); margin-bottom: 2px; opacity: .8;
}
.mon-brand-title {
  font-size: 14px; font-weight: 800; color: var(--text-1); letter-spacing: -.02em;
}
.mon-topbar-right { display: flex; align-items: center; gap: 6px; }

/* Pill badges */
.mon-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid;
  backdrop-filter: blur(8px);
}
.mon-pill-live    { background: rgba(34,197,94,.07); color: var(--green); border-color: rgba(34,197,94,.25); }
.mon-pill-critical{ background: rgba(220,53,69,.1); color: var(--accent-text); border-color: rgba(220,53,69,.3); box-shadow: 0 0 10px rgba(220,53,69,.15); }
.mon-pill-warn    { background: rgba(234,179,8,.07); color: var(--yellow); border-color: rgba(234,179,8,.25); }
.mon-live-dot {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: mon-pulse 1.8s ease-in-out infinite;
}
@keyframes mon-pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.35;transform:scale(.75)} }

/* ── KPI strip ── */
.mon-kpi-strip {
  display: flex; border-bottom: 1px solid var(--border);
  background: rgba(10,10,10,.6);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.mon-kpi {
  flex: 1; padding: 14px 22px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
  transition: background .2s;
}
.mon-kpi:last-child { border-right: none; }
.mon-kpi:hover { background: var(--surface-hover); }

/* Glowing accent line at bottom */
.mon-kpi-accent {
  position: absolute; bottom: 0; left: 16px; right: 16px; height: 2px; border-radius: 1px;
}
.mon-kpi-accent-green  { background: var(--green); opacity: .5; box-shadow: 0 0 8px var(--green); }
.mon-kpi-accent-red    { background: var(--accent-text); opacity: .6; box-shadow: 0 0 8px var(--accent); }
.mon-kpi-accent-amber  { background: var(--yellow); opacity: .5; box-shadow: 0 0 8px var(--yellow); }
.mon-kpi-accent-blue   { background: var(--blue); opacity: .4; box-shadow: 0 0 8px var(--blue); }

.mon-kpi-label { font-size: 9px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); }
.mon-kpi-value { font-size: 26px; font-weight: 900; line-height: 1; letter-spacing: -.03em; }
.mon-kpi-green  { color: var(--green); text-shadow: 0 0 20px rgba(34,197,94,.3); }
.mon-kpi-red    { color: var(--accent-text); text-shadow: 0 0 20px rgba(220,53,69,.3); }
.mon-kpi-amber  { color: var(--yellow); text-shadow: 0 0 20px rgba(234,179,8,.25); }
.mon-kpi-white  { color: var(--text-1); }
.mon-kpi-sub { font-size: 10px; color: var(--text-3); }

/* ── Controls ── */
.mon-controls {
  padding: 8px 20px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,10,.5);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.mon-search-wrap { position: relative; flex: 1; max-width: 340px; }
.mon-search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 13px; pointer-events: none;
}
.mon-search {
  width: 100%;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); padding: 7px 12px 7px 32px;
  color: var(--text-1); font-size: 12px; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.mon-search:focus {
  background: rgba(255,255,255,.05);
  border-color: rgba(220,53,69,.4);
  box-shadow: 0 0 0 3px rgba(220,53,69,.08), 0 0 16px rgba(220,53,69,.1);
}
.mon-search::placeholder { color: var(--text-3); }

.mon-seg {
  display: flex; background: rgba(255,255,255,.03); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 2px; gap: 2px;
}
.mon-seg-btn {
  padding: 5px 14px; border-radius: var(--r-md); border: none;
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  cursor: pointer; transition: all .15s; color: var(--text-3); background: transparent;
}
.mon-seg-active { background: rgba(255,255,255,.07); color: var(--text-1); box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.mon-seg-red { background: rgba(220,53,69,.14) !important; color: var(--accent-text) !important; box-shadow: 0 0 8px rgba(220,53,69,.15) !important; }

/* ── Table ── */
.mon-table-wrap { flex: 1; overflow-y: auto; min-height: 0; }
.mon-table-wrap::-webkit-scrollbar { width: 4px; }
.mon-table-wrap::-webkit-scrollbar-track { background: transparent; }
.mon-table-wrap::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }
.mon-table-wrap::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); }

.mon-table { width: 100%; border-collapse: collapse; }

.mon-table thead th {
  position: sticky; top: 0; z-index: 3;
  background: rgba(10,10,10,.92);
  backdrop-filter: blur(16px);
  padding: 8px 16px;
  font-size: 9px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-3); text-align: left;
  border-bottom: 1px solid var(--border);
}
.mon-th-status { width: 90px; }
.mon-th-uptime { width: 72px; }
.mon-th-resp   { width: 72px; }
.mon-th-hb     { width: 260px; }
.mon-th-act    { width: 100px; }

/* ── Group header rows ── */
.mon-grp-row { background: transparent; }
.mon-grp-row td {
  padding: 0;
  border-bottom: 1px solid var(--border);
}
.mon-grp-inner {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 20px;
  background: linear-gradient(90deg, rgba(220,53,69,.06) 0%, transparent 60%);
  border-left: 2px solid rgba(220,53,69,.4);
}
.mon-grp-icon  { font-size: 11px; opacity: .7; }
.mon-grp-name  {
  font-size: 9px; font-weight: 900; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent-text);
}
.mon-grp-stats { font-size: 10px; color: var(--text-3); }
.mon-grp-bar   {
  flex: 1; height: 3px; background: rgba(255,255,255,.06); border-radius: 2px;
  max-width: 160px; overflow: hidden;
}
.mon-grp-bar-fill { height: 100%; border-radius: 2px; transition: width .4s ease; }

/* ── Connection rows ── */
.mon-conn-row {
  border-bottom: 1px solid rgba(255,255,255,.04);
  cursor: pointer; transition: background .12s, box-shadow .12s;
  position: relative;
}
.mon-conn-row:hover {
  background: rgba(255,255,255,.025);
}
.mon-conn-row:hover .mon-conn-name { color: #fff; }
.mon-conn-open {
  background: rgba(220,53,69,.04);
}
.mon-conn-open > td {
  border-left: 2px solid rgba(220,53,69,.5);
}
.mon-conn-main { display: flex; align-items: center; padding: 10px 16px; gap: 0; }

/* Left health indicator */
.mon-ind {
  width: 3px; min-width: 3px; height: 32px; border-radius: 3px; margin-right: 14px;
  flex-shrink: 0; transition: all .2s;
}
.mon-ind-optimal { background: var(--green); box-shadow: 0 0 8px rgba(34,197,94,.5); }
.mon-ind-stable  { background: var(--blue);  box-shadow: 0 0 6px rgba(59,130,246,.4); }
.mon-ind-watch   { background: var(--yellow); box-shadow: 0 0 8px rgba(234,179,8,.5); }
.mon-ind-degraded{ background: var(--red);   box-shadow: 0 0 8px rgba(239,68,68,.5); }
.mon-ind-critical{
  background: var(--accent-text);
  box-shadow: 0 0 12px rgba(220,53,69,.7);
  animation: mon-critblink 1s ease-in-out infinite;
}
@keyframes mon-critblink { 0%,100%{opacity:1;box-shadow:0 0 12px rgba(220,53,69,.7)} 50%{opacity:.4;box-shadow:0 0 4px rgba(220,53,69,.3)} }

/* Name column */
.mon-name-col { flex: 1; min-width: 0; }
.mon-conn-name {
  font-size: 12.5px; font-weight: 600; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .12s;
}
.mon-conn-meta { display: flex; align-items: center; gap: 5px; margin-top: 2px; flex-wrap: nowrap; overflow: hidden; }
.mon-conn-endpoint {
  font-size: 10px; color: var(--text-3); font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}
.mon-tag {
  padding: 1px 5px; border-radius: 3px; flex-shrink: 0;
  font-size: 8px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid rgba(255,255,255,.08); color: var(--text-3);
  background: rgba(255,255,255,.04);
  white-space: nowrap;
}

/* Status column */
.mon-status-col { width: 90px; padding: 0 6px; }
.mon-status-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
  border: 1px solid;
}
.mon-sdot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

/* Optimal */
.mon-status-optimal { color: var(--green); border-color: rgba(34,197,94,.2); background: rgba(34,197,94,.07); }
.mon-sdot-optimal { background: var(--green); box-shadow: 0 0 5px var(--green); animation: mon-pulse 2.5s ease-in-out infinite; }
/* Stable */
.mon-status-stable { color: var(--blue); border-color: rgba(59,130,246,.2); background: rgba(59,130,246,.07); }
.mon-sdot-stable { background: var(--blue); box-shadow: 0 0 5px var(--blue); }
/* Watch */
.mon-status-watch { color: var(--yellow); border-color: rgba(234,179,8,.25); background: rgba(234,179,8,.07); }
.mon-sdot-watch { background: var(--yellow); box-shadow: 0 0 5px var(--yellow); animation: mon-pulse 1.5s ease-in-out infinite; }
/* Degraded */
.mon-status-degraded { color: var(--red); border-color: rgba(239,68,68,.25); background: rgba(239,68,68,.07); }
.mon-sdot-degraded { background: var(--red); box-shadow: 0 0 6px var(--red); animation: mon-pulse 1.2s ease-in-out infinite; }
/* Critical */
.mon-status-critical { color: var(--accent-text); border-color: rgba(220,53,69,.3); background: rgba(220,53,69,.1); box-shadow: 0 0 8px rgba(220,53,69,.1); }
.mon-sdot-critical { background: var(--accent-text); box-shadow: 0 0 8px var(--accent-text); animation: mon-pulse .8s ease-in-out infinite; }

/* Uptime col */
.mon-uptime-col { width: 72px; padding: 0 6px; }
.mon-uptime-val { font-size: 12px; font-weight: 800; font-family: var(--font-mono); }

/* Response col */
.mon-resp-col { width: 72px; padding: 0 6px; }
.mon-resp-val { font-size: 11px; font-family: var(--font-mono); color: var(--text-2); }

/* ── Uptime Meter ── */
.mon-hb-col { width: 260px; padding: 0 8px; }

.mon-meter-wrap {
  display: flex; align-items: center; gap: 8px;
}
.mon-meter-track {
  flex: 1; height: 8px; border-radius: 4px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
  position: relative; overflow: hidden;
}
.mon-meter-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  border-radius: 4px 0 0 4px;
  transition: width .4s cubic-bezier(.4,0,.2,1);
}
.mon-meter-fail {
  position: absolute; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(220,53,69,.4), rgba(220,53,69,.7));
  border-radius: 0 4px 4px 0;
}
.mon-meter-split {
  position: absolute; top: -2px; bottom: -2px; width: 2px;
  background: rgba(0,0,0,.8);
  transform: translateX(-50%);
  box-shadow: 0 0 6px rgba(0,0,0,.8);
}
.mon-meter-blip {
  position: absolute; top: 1px; bottom: 1px; width: 2px;
  background: var(--accent-text);
  border-radius: 1px;
  transform: translateX(-50%);
  opacity: .9;
  box-shadow: 0 0 4px var(--accent);
}
.mon-meter-label {
  font-size: 10px; font-weight: 800; font-family: var(--font-mono);
  flex-shrink: 0; min-width: 40px; text-align: right;
  letter-spacing: -.01em;
}

/* Actions */
.mon-act-col { width: 100px; padding: 0 14px 0 6px; text-align: right; }
.mon-act-row { display: flex; gap: 4px; justify-content: flex-end; }
.mon-iact {
  width: 27px; height: 27px; border-radius: var(--r-md); border: 1px solid;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; cursor: pointer; transition: all .15s;
}
.mon-iact          { border-color: var(--border-strong); background: rgba(255,255,255,.03); color: var(--text-3); }
.mon-iact:hover    { background: rgba(255,255,255,.07); color: var(--text-1); border-color: rgba(255,255,255,.2); }
.mon-iact-rex      { border-color: rgba(220,53,69,.3); color: var(--accent-text); background: rgba(220,53,69,.07); }
.mon-iact-rex:hover{ background: rgba(220,53,69,.18); box-shadow: 0 0 12px rgba(220,53,69,.25); border-color: rgba(220,53,69,.5); }
.mon-iact-restart  { border-color: rgba(59,130,246,.3); color: var(--blue); background: rgba(59,130,246,.07); }
.mon-iact-restart:hover { background: rgba(59,130,246,.18); border-color: rgba(59,130,246,.5); }

/* ── Expanded detail row ── */
.mon-exp-row { background: rgba(10,10,10,.6); border-bottom: 1px solid var(--border); }
.mon-exp-row > td { padding: 18px 18px 18px 53px; }
.mon-exp-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.mon-exp-card {
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r-xl); padding: 14px 16px;
  backdrop-filter: blur(8px);
  position: relative; overflow: hidden;
}
.mon-exp-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
}
.mon-exp-card-title {
  font-size: 9px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 12px; display: flex; align-items: center; gap: 6px;
}
.mon-exp-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.mon-exp-field { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.mon-exp-key { font-size: 11px; color: var(--text-3); }
.mon-exp-val { font-size: 11px; font-weight: 700; font-family: var(--font-mono); color: var(--text-1); }
.mon-exp-failure-note {
  margin-top: 10px; padding: 8px 10px; border-radius: var(--r-md);
  background: rgba(220,53,69,.08); border: 1px solid rgba(220,53,69,.18);
  font-size: 10px; color: var(--accent-text); line-height: 1.55;
}

/* Diagnostics terminal */
.mon-diag-term {
  background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.07); border-radius: var(--r-lg);
  padding: 10px 12px; font-family: var(--font-mono); font-size: 10px;
  line-height: 2; max-height: 120px; overflow-y: auto;
}
.mon-diag-line { display: flex; gap: 6px; }
.mon-diag-icon { flex-shrink: 0; width: 12px; text-align: center; }
.mon-diag-check { color: var(--text-2); min-width: 110px; flex-shrink: 0; }
.mon-diag-detail { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mon-diag-pass .mon-diag-icon { color: var(--green); }
.mon-diag-pass .mon-diag-check { color: var(--text-1); }
.mon-diag-fail .mon-diag-icon { color: var(--accent-text); }
.mon-diag-fail .mon-diag-check { color: var(--accent-text); }
.mon-diag-warn .mon-diag-icon { color: var(--yellow); }
.mon-diag-warn .mon-diag-check { color: var(--yellow); }

/* Expand action buttons */
.mon-exp-actions-grid { display: flex; flex-direction: column; gap: 7px; }
.mon-xbtn {
  width: 100%; padding: 8px 12px; border-radius: var(--r-md); border: 1px solid;
  font-size: 11px; font-weight: 700; cursor: pointer; transition: all .15s;
  text-align: left; letter-spacing: .01em;
}
.mon-xbtn-ghost    { border-color: var(--border-strong); background: rgba(255,255,255,.03); color: var(--text-2); }
.mon-xbtn-ghost:hover { background: rgba(255,255,255,.07); color: var(--text-1); }
.mon-xbtn-restart  { border-color: rgba(59,130,246,.3); background: rgba(59,130,246,.08); color: var(--blue); }
.mon-xbtn-restart:hover { background: rgba(59,130,246,.16); box-shadow: 0 0 12px rgba(59,130,246,.2); }
.mon-xbtn-running  { border-color: var(--border); background: rgba(255,255,255,.03); color: var(--text-3); cursor: not-allowed; }
.mon-xbtn-rex      { border-color: rgba(220,53,69,.3); background: rgba(220,53,69,.08); color: var(--accent-text); }
.mon-xbtn-rex:hover{ background: rgba(220,53,69,.16); box-shadow: 0 0 12px rgba(220,53,69,.2); border-color: rgba(220,53,69,.5); }

/* Empty state */
.mon-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 13px; padding: 60px; text-align: center;
}

/* ── Rex bar ── */
.mon-rex-bar {
  flex-shrink: 0; position: relative;
  border-top: 1px solid var(--border);
  background: rgba(10,10,10,.8);
  backdrop-filter: blur(20px);
  transition: max-height .35s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
/* Red glow top border */
.mon-rex-bar::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 25%, var(--accent-text) 50%, var(--accent) 75%, transparent 100%);
  opacity: .55;
  box-shadow: 0 0 12px rgba(220,53,69,.3);
}
.mon-rex-collapsed { max-height: 52px; }
.mon-rex-expanded  { max-height: 360px; }

.mon-rex-header {
  height: 52px; padding: 0 20px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; flex-shrink: 0; user-select: none;
}
.mon-rex-icon {
  width: 28px; height: 28px; border-radius: var(--r-md); flex-shrink: 0;
  background: linear-gradient(135deg, rgba(220,53,69,.18), rgba(220,53,69,.06));
  border: 1px solid rgba(220,53,69,.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; color: var(--accent-text);
  box-shadow: 0 0 12px rgba(220,53,69,.2);
}
.mon-rex-label {
  font-size: 11px; font-weight: 900; color: var(--accent-text);
  letter-spacing: .14em; flex-shrink: 0; text-transform: uppercase;
}
.mon-rex-status-msg {
  flex: 1; font-size: 11px; color: var(--text-3);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.mon-rex-hl  { color: var(--yellow); font-weight: 700; }
.mon-rex-ok  { color: var(--green); font-weight: 700; }

.mon-rex-quick { display: flex; gap: 4px; flex-shrink: 0; }
.mon-rqb {
  padding: 4px 9px; border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,.09);
  background: rgba(255,255,255,.03); color: var(--text-3);
  font-size: 10px; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.mon-rqb:hover {
  background: rgba(220,53,69,.1); color: var(--accent-text);
  border-color: rgba(220,53,69,.25);
}
.mon-rex-chevron { color: var(--text-3); font-size: 10px; flex-shrink: 0; transition: transform .3s; }

.mon-rex-body {
  display: flex; flex-direction: column;
  padding: 0 20px 14px; height: 308px;
  border-top: 1px solid var(--border);
}
.mon-rex-msgs {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 12px 0 6px;
}
.mon-rex-msgs::-webkit-scrollbar { width: 3px; }
.mon-rex-msgs::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.mon-rmsg { display: flex; gap: 8px; align-items: flex-start; }
.mon-rmsg-user { flex-direction: row-reverse; }
.mon-rmsg-av {
  width: 24px; height: 24px; border-radius: var(--r-md); flex-shrink: 0; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 900;
}
.mon-av-rex  {
  background: linear-gradient(135deg, rgba(220,53,69,.2), rgba(220,53,69,.06));
  color: var(--accent-text); border: 1px solid rgba(220,53,69,.3);
  box-shadow: 0 0 8px rgba(220,53,69,.15);
}
.mon-av-user { background: rgba(255,255,255,.05); color: var(--text-2); border: 1px solid var(--border-strong); }

.mon-rmsg-bubble {
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.07); border-radius: 10px;
  padding: 8px 12px; font-size: 11.5px; line-height: 1.65; color: var(--text-2);
  max-width: 680px;
}
.mon-rmsg-user .mon-rmsg-bubble {
  background: rgba(220,53,69,.07); border-color: rgba(220,53,69,.15); color: var(--text-1);
}

.mon-rmsg-thinking { display: flex; gap: 5px; align-items: center; padding: 10px 14px; }
.mon-think-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent-text); opacity: .5;
  animation: mon-think 1.2s ease-in-out infinite;
}
.mon-think-dot:nth-child(2) { animation-delay: .2s; }
.mon-think-dot:nth-child(3) { animation-delay: .4s; }
@keyframes mon-think { 0%,80%,100%{transform:scale(.6);opacity:.3} 40%{transform:scale(1.1);opacity:1} }

.mon-rex-input-row { display: flex; flex-direction: column; gap: 7px; padding-top: 10px; border-top: 1px solid var(--border); }
.mon-rex-quick-row { display: flex; gap: 4px; flex-wrap: wrap; }
.mon-rex-input-wrap { display: flex; gap: 6px; }
.mon-rex-input {
  flex: 1; background: rgba(255,255,255,.04); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); padding: 8px 14px;
  color: var(--text-1); font-size: 12px; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.mon-rex-input:focus {
  border-color: rgba(220,53,69,.45);
  box-shadow: 0 0 0 3px rgba(220,53,69,.08), 0 0 16px rgba(220,53,69,.1);
}
.mon-rex-input::placeholder { color: var(--text-3); }
.mon-rex-send {
  padding: 8px 20px; border-radius: var(--r-lg);
  border: 1px solid rgba(220,53,69,.35);
  background: linear-gradient(135deg, rgba(220,53,69,.15), rgba(220,53,69,.07));
  color: var(--accent-text); font-size: 11px; font-weight: 800;
  letter-spacing: .06em; cursor: pointer; transition: all .15s;
}
.mon-rex-send:hover {
  background: rgba(220,53,69,.25);
  box-shadow: 0 0 18px rgba(220,53,69,.25);
  border-color: rgba(220,53,69,.55);
}
.mon-rex-send:disabled { opacity: .3; cursor: not-allowed; }

/* Mono util */
.mono { font-family: var(--font-mono); }

/* ============================================================
   TOP NAV — replaces sidebar
   ============================================================ */

@keyframes topnav-glow-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--accent); }
  50%       { opacity: 0.6; box-shadow: 0 0 14px var(--accent), 0 0 22px var(--accent-muted); }
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  transition: background 0.2s, border-color 0.2s, backdrop-filter 0.2s;
  flex-shrink: 0;
}
.topnav.topnav-scrolled {
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(16px);
  border-bottom-color: var(--border-strong);
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.topnav-brand-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.topnav-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.topnav-links::-webkit-scrollbar { display: none; }

.topnav-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.topnav-pill:hover {
  color: var(--text-1);
  background: var(--surface-hover);
}
.topnav-pill-active {
  color: var(--text-1);
  background: var(--accent-muted);
  border-color: rgba(220,53,69,0.25);
}

.topnav-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 6px 0;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.topnav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-2);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s, color 0.1s;
}
.topnav-dropdown-item:hover,
.topnav-dropdown-item.active {
  color: var(--text-1);
  background: var(--surface-hover);
}
.topnav-dropdown-item.active {
  color: var(--text-1);
  font-weight: 600;
}

.topnav-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.topnav-health {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-2);
}
.topnav-clock {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.topnav-btn {
  font-size: 11px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border) !important;
  border-radius: 5px;
  padding: 3px 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.topnav-btn:hover { color: var(--text-1); background: var(--surface-raised); }

.topnav-proof-bar {
  height: 24px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  font-size: 10px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  overflow: hidden;
}

/* Shell layout — column flex, topnav stays visible so dropdowns can escape */
.app-shell {
  display: flex !important;
  flex-direction: column !important;
  height: 100vh;
  overflow: visible !important; /* must NOT clip — topnav dropdowns are position:absolute */
  background:
    radial-gradient(ellipse 120% 80% at 50% 100%, rgba(220,53,69,0.28) 0%, rgba(220,53,69,0.08) 40%, transparent 70%),
    radial-gradient(ellipse 80% 60% at 15% 60%, rgba(180,20,35,0.15) 0%, transparent 55%),
    #050505;
}
.app-shell-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.app-workspace {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  background: transparent;
}

/* Deep Space hero bg */
.hero-bg {
  background: transparent;
}

/* Glass card */
.glass-card {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
}

/* ============================================================
   LLM World — Universe View
   ============================================================ */

.llmw-page { display: flex; flex-direction: column; gap: 16px; }

.llmw-hero-title { font-size: 36px; line-height: 1; font-weight: 900; color: var(--text-1); letter-spacing: -0.05em; }
.llmw-hero-sub { font-size: 13px; color: var(--text-2); line-height: 1.6; max-width: 920px; }

.llmw-repo-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), var(--surface-raised));
  backdrop-filter: blur(12px);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.llmw-repo-root { font-size: 11px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }

.llmw-stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1280px) { .llmw-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Sector map */
.llmw-sector-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.llmw-sector-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, rgba(255,255,255,0.025), var(--surface-raised));
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, background 120ms ease;
}
.llmw-sector-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.llmw-sector-card-active { border-color: var(--accent); background: linear-gradient(160deg, rgba(220,53,69,0.12), var(--surface-raised)); }
.llmw-sector-head { display: flex; align-items: center; justify-content: space-between; }
.llmw-sector-label { font-size: 13px; font-weight: 700; color: var(--text-1); }
.llmw-sector-count { font-size: 18px; font-weight: 800; color: var(--accent-text); }
.llmw-sector-meta { display: flex; gap: 6px; font-size: 11px; color: var(--text-3); }
.llmw-sector-readiness { display: flex; justify-content: space-between; font-size: 11px; padding-top: 6px; border-top: 1px solid var(--border); }
.llmw-sector-ready { color: var(--green); }
.llmw-sector-attention { color: var(--yellow); }

/* Explorer */
.llmw-filter-bar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.llmw-filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.llmw-filter-status { justify-content: space-between; }
.llmw-chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.llmw-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--text-2);
  font-size: 11px;
  border: 1px solid var(--border);
}
.llmw-chip-removable { cursor: pointer; }
.llmw-chip-removable:hover { border-color: var(--border-strong); color: var(--text-1); }
.llmw-chip-reset { cursor: pointer; color: var(--accent-text); border-color: rgba(220,53,69,0.35); }
.llmw-chip-kind { text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; }
.llmw-chip-env { color: var(--accent-text); border-color: rgba(220,53,69,0.3); background: var(--accent-muted); }
.llmw-chip-file { font-family: var(--font-mono); font-size: 10px; }

.llmw-explorer-scroll { max-height: 64vh; overflow: auto; padding-right: 4px; }
.llmw-explorer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }

.llmw-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-raised), rgba(255,255,255,0.015));
  min-height: 220px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.llmw-card:hover { border-color: var(--border-strong); box-shadow: 0 8px 28px rgba(0,0,0,0.35); }
.llmw-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.llmw-card-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.llmw-card-title { font-size: 13px; font-weight: 800; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.llmw-card-path { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); word-break: break-word; }
.llmw-card-desc { font-size: 12px; color: var(--text-2); line-height: 1.45; flex: 1; }
.llmw-card-badges { display: flex; flex-wrap: wrap; gap: 6px; }

.llmw-dependency-row { display: flex; flex-wrap: wrap; gap: 6px; }
.llmw-launch-actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; border-top: 1px solid var(--border); }

/* Badges */
.llmw-badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 10px; font-weight: 600; letter-spacing: 0.02em; border: 1px solid transparent; }
.llmw-badge-tone-green { color: var(--green); background: var(--green-muted); border-color: rgba(34,197,94,0.25); }
.llmw-badge-tone-yellow { color: var(--yellow); background: var(--yellow-muted); border-color: rgba(234,179,8,0.25); }
.llmw-badge-tone-red { color: var(--red); background: var(--red-muted); border-color: rgba(239,68,68,0.25); }
.llmw-badge-tone-neutral { color: var(--text-2); background: rgba(255,255,255,0.04); border-color: var(--border); }
.llmw-badge-runtime-python { color: var(--blue); background: var(--blue-muted); border-color: rgba(59,130,246,0.25); }
.llmw-badge-runtime-node { color: var(--green); background: var(--green-muted); border-color: rgba(34,197,94,0.25); }
.llmw-badge-runtime-mixed { color: var(--purple); background: var(--purple-muted); border-color: rgba(139,92,246,0.25); }
.llmw-badge-runtime-unknown { color: var(--text-2); background: rgba(255,255,255,0.04); border-color: var(--border); }

/* Empty / error / skeleton */
.llmw-state-block { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 48px 20px; text-align: center; }
.llmw-state-icon { font-size: 28px; color: var(--text-3); }
.llmw-state-title { font-size: 14px; font-weight: 700; color: var(--text-1); }
.llmw-state-detail { font-size: 12px; color: var(--text-2); max-width: 480px; }
.llmw-state-error .llmw-state-icon { color: var(--red); }
.llmw-state-error .llmw-state-title { color: var(--red); }

.llmw-skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.llmw-skeleton-card {
  height: 200px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: linear-gradient(100deg, var(--surface-raised) 30%, rgba(255,255,255,0.05) 50%, var(--surface-raised) 70%);
  background-size: 200% 100%;
  animation: llmw-shimmer 1.6s ease-in-out infinite;
}
@keyframes llmw-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Drawer */
.llmw-drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); z-index: 1000; display: flex; justify-content: flex-end; }
.llmw-drawer {
  width: min(560px, 92vw);
  height: 100%;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(20,20,20,0.98), rgba(10,10,10,0.99));
  border-left: 1px solid var(--border-strong);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
}
.llmw-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.llmw-drawer-title { font-size: 18px; font-weight: 800; color: var(--text-1); }
.llmw-drawer-path { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); margin-top: 2px; }
.llmw-drawer-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.llmw-drawer-section { display: flex; flex-direction: column; gap: 6px; }
.llmw-drawer-section-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.llmw-drawer-code { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--text-2); background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px 10px; white-space: pre-wrap; word-break: break-word; }
.llmw-drawer-launch-list { display: flex; flex-direction: column; gap: 6px; }
.llmw-drawer-readme { font-size: 11px; line-height: 1.6; color: var(--text-2); background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow-y: auto; font-family: var(--font-mono); }
.llmw-drawer-file-list { display: flex; flex-wrap: wrap; gap: 5px; max-height: 160px; overflow-y: auto; }
.llmw-drawer-error { font-size: 12px; color: var(--red); background: var(--red-muted); border: 1px solid rgba(239,68,68,0.25); border-radius: var(--r-md); padding: 8px 10px; }
.llmw-drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--border); }

/* Operational panel */
.llmw-ops-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.llmw-ops-block { display: flex; flex-direction: column; gap: 6px; }
.llmw-ops-health { font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: var(--r-md); display: inline-block; width: fit-content; }
.llmw-ops-health-ok { color: var(--green); background: var(--green-muted); }
.llmw-ops-health-down { color: var(--red); background: var(--red-muted); }
.llmw-ops-log-list { display: flex; flex-direction: column; gap: 6px; max-height: 140px; overflow-y: auto; }
.llmw-ops-log-row { display: flex; align-items: center; gap: 8px; }

@media (max-width: 1024px) {
  .llmw-explorer-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .llmw-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .llmw-filter-row { flex-direction: column; align-items: stretch; }
  .llmw-explorer-grid, .llmw-sector-grid, .llmw-skeleton-grid { grid-template-columns: 1fr; }
  .llmw-drawer { width: 100vw; }
}

/* Agent Runtime Fabric control surface */
.arf-page { display: flex; flex-direction: column; gap: 16px; }
.arf-hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(260px, .7fr); gap: 18px; align-items: stretch; }
.arf-hero h1 { margin: 0 0 8px; font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.045em; }
.arf-hero p { margin: 0; color: var(--text-2); line-height: 1.55; }
.arf-runtime-card, .arf-card, .arf-kpi { border: 1px solid var(--border); background: linear-gradient(180deg, var(--surface-raised), var(--surface)); border-radius: var(--r-lg); padding: 14px; }
.arf-runtime-card { display: flex; flex-direction: column; gap: 10px; }
.arf-runtime-card > div, .arf-mini { display: flex; justify-content: space-between; gap: 12px; color: var(--text-2); font-size: 12px; }
.arf-runtime-card b, .arf-mini b { color: var(--text-1); }
.arf-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.arf-badge, .arf-chip { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 700; border: 1px solid var(--border); background: var(--surface); }
.arf-badge.good { color: var(--green); background: var(--green-muted); }
.arf-badge.warn { color: var(--yellow); background: var(--yellow-muted); }
.arf-badge.bad { color: var(--red); background: var(--red-muted); }
.arf-badge.info { color: var(--blue); background: var(--blue-muted); }
.arf-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.arf-kpi b { display: block; font-size: 22px; color: var(--text-1); }
.arf-kpi span { display: block; margin-top: 4px; color: var(--text-3); font-size: 12px; }
.arf-tabs, .arf-detail-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.arf-tabs button, .arf-detail-tabs button { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 8px 12px; text-transform: capitalize; cursor: pointer; }
.arf-tabs button.active, .arf-detail-tabs button.active { color: var(--text-1); border-color: var(--accent); background: var(--accent-muted); }
.arf-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.arf-card-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.arf-card { display: flex; flex-direction: column; gap: 10px; }
.arf-card h3, .arf-card p { margin: 0; }
.arf-card p { color: var(--text-2); font-size: 12px; line-height: 1.45; }
.arf-card small, .arf-list-row small { color: var(--text-3); display: block; margin-top: 4px; }
.arf-card-head, .arf-list-row, .arf-row-actions, .arf-actions, .arf-run-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.arf-actions { align-items: center; justify-content: flex-start; flex-wrap: wrap; margin-top: auto; }
.arf-actions.right { justify-content: flex-end; }
.arf-list { display: flex; flex-direction: column; gap: 10px; }
.arf-list-row { border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-lg); padding: 12px; }
.arf-list-row.slim { align-items: center; }
.arf-list-row p { margin: 8px 0 0; color: var(--text-2); font-size: 12px; }
.arf-row-actions { align-items: center; flex-wrap: wrap; justify-content: flex-end; min-width: 220px; }
.arf-empty, .arf-alert { border: 1px dashed var(--border); border-radius: var(--r-lg); padding: 14px; color: var(--text-2); background: var(--surface); }
.arf-alert { margin-top: 12px; border-style: solid; }
.arf-alert.good { color: var(--green); background: var(--green-muted); }
.arf-alert.bad { color: var(--red); background: var(--red-muted); }
.arf-code { max-width: 100%; overflow: auto; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px; background: rgba(0,0,0,.18); color: var(--text-1); font-size: 12px; }
.arf-code.small { max-height: 180px; }
.arf-code.result { max-height: 55vh; }
.arf-modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.58); display: flex; align-items: center; justify-content: center; padding: 24px; }
.arf-modal { width: min(820px, 96vw); max-height: 92vh; overflow: auto; border: 1px solid var(--border-strong); border-radius: var(--r-xl); background: var(--surface-raised); box-shadow: var(--shadow-xl); padding: 18px; }
.arf-modal-head, .arf-drawer-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.arf-modal-head h2, .arf-drawer-head h2 { margin: 0; }
.arf-modal-head p, .arf-drawer-head p { margin: 6px 0 0; color: var(--text-3); }
.arf-icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text-1); border-radius: 10px; width: 34px; height: 34px; cursor: pointer; }
.arf-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.arf-field { display: flex; flex-direction: column; gap: 6px; color: var(--text-3); font-size: 12px; }
.arf-field input, .arf-field select, .arf-field textarea, .arf-search input { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); color: var(--text-1); padding: 10px; min-height: 38px; }
.arf-task, .arf-json-input { min-height: 130px; font-family: inherit; }
.arf-json-input { font-family: var(--font-mono); }
.arf-drawer { position: fixed; right: 18px; top: 18px; bottom: 18px; z-index: 70; width: min(720px, calc(100vw - 36px)); overflow: auto; border: 1px solid var(--border-strong); border-radius: var(--r-xl); background: var(--surface-raised); box-shadow: var(--shadow-xl); padding: 18px; }
.arf-drawer-body { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.arf-run-summary { align-items: center; justify-content: flex-start; color: var(--text-3); margin: 12px 0; }
.arf-search { display: flex; gap: 10px; margin-bottom: 12px; }
.arf-search input { flex: 1; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 1050px) { .arf-hero, .arf-card-grid, .arf-card-grid.compact { grid-template-columns: 1fr; } .arf-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .arf-list-row { flex-direction: column; } .arf-row-actions { justify-content: flex-start; min-width: 0; } }
