/* ═══════════════════════════════════════════════════
   Hermes Control Center — Design System
   Dark theme, glassmorphism, Telegram Mini App native
   ═══════════════════════════════════════════════════ */

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

/* ── CSS Variables ── */
:root {
  /* Colors */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-terminal: #0d1117;

  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-accent: #60a5fa;

  --border: rgba(255, 255, 255, 0.08);
  --border-active: rgba(96, 165, 250, 0.3);

  /* Role colors */
  --role-sysadmin: #2ecc71;
  --role-personal: #f39c12;
  --role-hypervisor: #9b59b6;
  --role-default: #60a5fa;

  /* Status colors */
  --status-online: #22c55e;
  --status-working: #eab308;
  --status-idle: #6b7280;
  --status-error: #ef4444;
  --status-approve: #f59e0b;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(96, 165, 250, 0.15);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Background gradient ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 60% at 20% 10%, rgba(96, 165, 250, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 80% 90%, rgba(139, 92, 246, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
}

/* ── App container ── */
.app {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-md);
  padding-bottom: calc(var(--space-xl) + env(safe-area-inset-bottom, 0px));
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  margin-bottom: var(--space-lg);
}

.header__logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-md), 0 0 16px rgba(59, 130, 246, 0.2);
}

.header__title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header__subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.header__status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.header__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-online);
  animation: pulse 2s ease-in-out infinite;
}

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

/* ── Sections ── */
.section {
  margin-bottom: var(--space-lg);
}

.section__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-sm);
}

/* ── Quick Actions ── */
.quick-actions {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.quick-actions::-webkit-scrollbar { display: none; }

.quick-action {
  flex: 0 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.quick-action:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.quick-action:active {
  transform: scale(0.96);
}

/* ── Dashboard Widgets ── */
.widgets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.widget-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
  position: relative;
}

.widget-card:hover {
  border-color: var(--border-active);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.widget-card__header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.widget-card__icon {
  font-size: 16px;
}

.widget-card__title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.widget-card__age {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
}

.widget-card__body {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.widget-card--empty .widget-card__body {
  color: var(--text-muted);
  font-style: italic;
}

/* ── Role cards ── */
.roles-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.role-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.role-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.role-card:active {
  transform: scale(0.98);
}

.role-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.role-card__info {
  flex: 1;
  min-width: 0;
}

.role-card__name {
  font-size: 15px;
  font-weight: 600;
}

.role-card__desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-card__status {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.role-card__status--idle {
  background: rgba(107, 114, 128, 0.15);
  color: var(--status-idle);
}

.role-card__status--working {
  background: rgba(234, 179, 8, 0.15);
  color: var(--status-working);
  animation: pulse-status 1.5s ease-in-out infinite;
}

@keyframes pulse-status {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.role-card__status--online {
  background: rgba(34, 197, 94, 0.15);
  color: var(--status-online);
}

/* ── Task view ── */
.task-view {
  display: none;
}

.task-view.active {
  display: block;
}

.task-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-md);
}

.task-header__back {
  background: none;
  border: none;
  color: var(--text-accent);
  font-size: 14px;
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  gap: 4px;
}

.task-header__back:hover {
  background: var(--bg-hover);
}

.task-header__role {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.task-header__timer {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ── Terminal ── */
.terminal {
  background: var(--bg-terminal);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  min-height: 280px;
  max-height: 50vh;
  overflow-y: auto;
  color: #c9d1d9;
  white-space: pre-wrap;
  word-break: break-all;
  scroll-behavior: smooth;
}

.terminal::-webkit-scrollbar {
  width: 4px;
}

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

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

.terminal__line {
  padding: 1px 0;
}

.terminal__line--command {
  color: #58a6ff;
}

.terminal__line--success {
  color: #3fb950;
}

.terminal__line--error {
  color: #f85149;
}

.terminal__line--warning {
  color: #d29922;
}

.terminal__cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: #58a6ff;
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ── Agent Response (Markdown) ── */
.agent-response {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-top: var(--space-sm);
  font-family: var(--font-primary);
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-primary);
  max-height: 55vh;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.agent-response::-webkit-scrollbar { width: 4px; }
.agent-response::-webkit-scrollbar-track { background: transparent; }
.agent-response::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.agent-response h1, .agent-response h2, .agent-response h3 {
  color: #60a5fa;
  margin: 0.8em 0 0.4em;
  font-weight: 600;
}
.agent-response h1 { font-size: 16px; }
.agent-response h2 { font-size: 14px; }
.agent-response h3 { font-size: 13px; }

.agent-response p {
  margin: 0.4em 0;
}

.agent-response a {
  color: #58a6ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.agent-response ul, .agent-response ol {
  padding-left: 1.4em;
  margin: 0.4em 0;
}

.agent-response li {
  margin: 0.2em 0;
}

.agent-response code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #f0c674;
}

.agent-response pre {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  overflow-x: auto;
  margin: 0.5em 0;
}

.agent-response pre code {
  background: transparent;
  padding: 0;
  color: #c9d1d9;
}

.agent-response blockquote {
  border-left: 3px solid #58a6ff;
  margin: 0.5em 0;
  padding: 0.3em 0.8em;
  color: var(--text-secondary);
  background: rgba(88, 166, 255, 0.05);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.agent-response table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5em 0;
  font-size: 12px;
}

.agent-response th, .agent-response td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}

.agent-response th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
  color: var(--text-accent);
}

.agent-response strong { color: #e5e7eb; font-weight: 600; }
.agent-response em { color: var(--text-secondary); }
.agent-response hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.8em 0;
}

.agent-response img {
  max-width: 100%;
  border-radius: var(--radius-sm);
}

/* ── Chat ── */
.chat {
  margin-top: var(--space-md);
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
}

.chat__messages {
  max-height: 140px;
  overflow-y: auto;
  margin-bottom: var(--space-sm);
}

.chat__message {
  padding: var(--space-xs) 0;
  font-size: 13px;
}

.chat__message--user {
  color: var(--text-accent);
}

.chat__message--role {
  color: var(--text-primary);
}

.chat__input-row {
  display: flex;
  gap: var(--space-sm);
}

.chat__input {
  flex: 1;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--duration-fast);
}

.chat__input:focus {
  border-color: var(--border-active);
}

.chat__input::placeholder {
  color: var(--text-muted);
}

.chat__send {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast);
  font-family: var(--font-sans);
}

.chat__send:hover {
  transform: scale(1.03);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.chat__send:active {
  transform: scale(0.97);
}

/* ── Approval banner ── */
.approval {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-md) 0;
  animation: slideIn var(--duration-normal) var(--ease-out);
}

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

.approval__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--status-approve);
  margin-bottom: var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.approval__text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  font-family: var(--font-mono);
}

.approval__actions {
  display: flex;
  gap: var(--space-sm);
}

.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast);
  font-family: var(--font-sans);
}

.btn--approve {
  background: #16a34a;
  color: white;
}

.btn--approve:hover {
  background: #15803d;
  box-shadow: 0 0 12px rgba(22, 163, 74, 0.3);
}

.btn--reject {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn--reject:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn--cancel {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-secondary);
}

.btn--cancel:hover {
  background: rgba(107, 114, 128, 0.25);
}

/* ── Task actions bar ── */
.task-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* ── Stats row ── */
.stats {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.stat-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.stat-card__value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-card__label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Task list ── */
.task-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.task-item {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--duration-fast);
}

.task-item:hover {
  background: var(--bg-hover);
}

.task-item__icon {
  font-size: 16px;
  flex-shrink: 0;
}

.task-item__query {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-item__time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.task-item__badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 500;
  flex-shrink: 0;
}

.task-item__badge--completed {
  background: rgba(34, 197, 94, 0.15);
  color: var(--status-online);
}

.task-item__badge--error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-error);
}

.task-item__badge--running {
  background: rgba(234, 179, 8, 0.15);
  color: var(--status-working);
  animation: pulse-status 1.5s ease-in-out infinite;
}

.task-item__badge--todo {
  background: rgba(96, 165, 250, 0.12);
  color: var(--text-accent);
}

.task-item__badge--ready {
  background: rgba(34, 197, 94, 0.15);
  color: var(--status-online);
}

.task-item__badge--blocked {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-error);
  animation: pulse-status 1s ease-in-out infinite;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state__text {
  font-size: 14px;
}

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn var(--duration-fast) ease-out;
}

.modal__card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  width: min(90vw, 400px);
  box-shadow: var(--shadow-lg);
  animation: slideIn var(--duration-normal) var(--ease-out);
}

.modal__title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.modal__input {
  width: 100%;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-sans);
  outline: none;
  margin-bottom: var(--space-md);
  transition: border-color var(--duration-fast);
  box-sizing: border-box;
}

.modal__input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.1);
}

.modal__input::placeholder {
  color: var(--text-muted);
}

.modal__actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* ── Utilities ── */
.hidden { display: none !important; }
.fade-in { animation: fadeIn var(--duration-normal) var(--ease-out); }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Responsive (Telegram Mini App can be narrow) ── */
@media (max-width: 360px) {
  .app { padding: var(--space-sm); }
  .stats { flex-wrap: wrap; }
  .stat-card { min-width: calc(50% - var(--space-xs)); }
}

/* ═══════════════════════════════════════════════════
   Role Inspector — Profile Deep Dive
   ═══════════════════════════════════════════════════ */

.role-inspector {
  display: none;
  padding: var(--space-md);
  padding-bottom: 60px;
  animation: fadeIn 0.3s ease;
}

.role-inspector.active {
  display: block;
}

.role-inspector__loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl) 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--text-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Identity Card */
.role-section--identity {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  backdrop-filter: blur(12px);
}

.role-identity__header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.role-identity__icon {
  font-size: 40px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.role-identity__info {
  flex: 1;
  min-width: 0;
}

.role-identity__name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.role-identity__soul-title {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.role-identity__model {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-accent);
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 6px;
  padding: 2px 8px;
  margin-top: 6px;
}

.role-identity__meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

.role-meta-item {
  text-align: center;
  padding: var(--space-sm);
  background: var(--bg-glass);
  border-radius: var(--radius-md);
}

.role-meta-item__value {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.role-meta-item__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Accordion */
.role-accordion {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.role-acc-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s;
}

.role-acc-section:hover {
  border-color: var(--border-active);
}

.role-acc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.role-acc-header:hover {
  background: var(--bg-hover);
}

.role-acc-header__left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.role-acc-header__count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  background: var(--bg-glass);
  padding: 1px 6px;
  border-radius: 8px;
}

.role-acc-header__chevron {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.3s;
}

.role-acc-section.open .role-acc-header__chevron {
  transform: rotate(180deg);
}

.role-acc-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.role-acc-section.open .role-acc-body {
  max-height: 800px;
}

.role-acc-body__inner {
  padding: 0 var(--space-md) var(--space-md);
}

/* Skills list */
.role-skill-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.role-skill-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-glass);
  border-radius: 6px;
}

.role-skill-item__name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-accent);
  white-space: nowrap;
}

.role-skill-item__desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
}

/* Cron table */
.role-cron-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.role-cron-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm);
  background: var(--bg-glass);
  border-radius: 6px;
  gap: var(--space-sm);
}

.role-cron-item__name {
  font-size: 12px;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-cron-item__schedule {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-accent);
  background: rgba(96, 165, 250, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

/* Projects */
.role-project-card {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-glass);
  border-radius: 6px;
  margin-bottom: 6px;
}

.role-project-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.role-project-card__desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.role-project-card__path {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Routing table */
.role-routing-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px var(--space-sm);
  background: var(--bg-glass);
  border-radius: 6px;
  margin-bottom: 4px;
}

.role-routing-row__patterns {
  font-size: 11px;
  color: var(--text-secondary);
  flex: 1;
}

.role-routing-row__target {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(96, 165, 250, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Triggers */
.role-triggers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.role-trigger-chip {
  font-size: 10px;
  color: var(--text-secondary);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Sessions */
.role-session-item {
  padding: 6px var(--space-sm);
  background: var(--bg-glass);
  border-radius: 6px;
  margin-bottom: 4px;
}

.role-session-item__title {
  font-size: 12px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-session-item__date {
  font-size: 10px;
  color: var(--text-muted);
}

/* Role card inspect button */
.role-card__inspect {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.role-card__inspect:hover {
  background: var(--bg-hover);
  color: var(--text-accent);
  border-color: var(--border-active);
}

/* Lock badge */
.role-badge--locked { color: #22c55e; }
.role-badge--unlocked { color: #ef4444; }

/* ═══ Direct Response Screen (Hypervisor) ═══ */
.direct-view { display: none; padding: var(--space-md); padding-bottom: 60px; animation: fadeIn 0.3s ease; }
.direct-view.active { display: block; }

.direct-query {
  font-size: 13px; color: var(--text-secondary);
  margin-bottom: var(--space-md); padding: var(--space-sm) var(--space-md);
  background: var(--bg-glass); border-radius: var(--radius-md);
  border-left: 3px solid #9b59b6;
}

.thinking {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: var(--space-xl) 0; gap: var(--space-md);
}
.thinking__dots { display: flex; gap: 6px; }
.thinking__dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: #9b59b6; animation: thinking-pulse 1.4s ease-in-out infinite;
}
.thinking__dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking__dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking-pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
.thinking__label { font-size: 13px; color: var(--text-muted); }

.direct-response {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-lg);
  font-size: 14px; line-height: 1.6; color: var(--text-primary);
  max-height: 60vh; overflow-y: auto; opacity: 0;
  transform: translateY(8px); transition: opacity 0.3s, transform 0.3s;
}
.direct-response.visible { opacity: 1; transform: translateY(0); }
.direct-response h1,.direct-response h2,.direct-response h3 { margin: 0.8em 0 0.4em; color: var(--text-accent); }
.direct-response p { margin: 0.5em 0; }
.direct-response ul,.direct-response ol { padding-left: 1.4em; margin: 0.5em 0; }
.direct-response li { margin: 0.3em 0; }
.direct-response code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-glass); padding: 2px 6px; border-radius: 4px; }
.direct-response pre { background: var(--bg-glass); padding: var(--space-md); border-radius: var(--radius-md); overflow-x: auto; margin: 0.5em 0; }
.direct-response strong { color: var(--text-primary); }
.direct-response em { color: var(--text-secondary); }

.direct-followup {
  display: flex; gap: var(--space-sm); margin-top: var(--space-md);
}
.direct-followup__input {
  flex: 1; background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 14px;
  color: var(--text-primary); font-size: 14px; font-family: var(--font-sans);
  outline: none; transition: border-color var(--duration-fast);
}
.direct-followup__input:focus { border-color: var(--border-active); }
.direct-followup__input::placeholder { color: var(--text-muted); }
.direct-followup__send {
  width: 44px; background: #9b59b6; border: none; border-radius: var(--radius-md);
  color: white; font-size: 18px; cursor: pointer; transition: background 0.2s;
}
.direct-followup__send:hover { background: #8e44ad; }

/* ═══ Kanban Widget ═══ */
.kanban-widget { display: flex; flex-direction: column; gap: var(--space-xs); }
.kanban-widget__item {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-glass); border: 1px solid var(--border);
  border-radius: var(--radius-md); cursor: pointer;
  font-size: 13px; transition: background var(--duration-fast);
}
.kanban-widget__item:hover { background: var(--bg-hover); }
.kanban-widget__icon { font-size: 16px; flex-shrink: 0; }
.kanban-widget__query { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-widget__badge { font-size: 14px; flex-shrink: 0; }
.kanban-widget__badge--running { animation: pulse-status 1.5s ease-in-out infinite; }
.kanban-widget__badge--blocked { animation: pulse-status 1s ease-in-out infinite; }

/* ═══ Quick Action Variants ═══ */
.quick-action--direct { border-left: 3px solid #9b59b6; }
.quick-action--kanban { border-left: 3px solid #2ecc71; }

/* ═══ Activity Feed ═══ */
.activity-feed {
  background: rgba(15, 20, 35, 0.6);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.activity-feed__header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.activity-feed__list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.activity-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  padding: 3px 0;
  font-size: 12.5px;
  line-height: 1.4;
  animation: activitySlideIn 0.3s ease-out;
}
.activity-item__time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  min-width: 36px;
  flex-shrink: 0;
}
.activity-item__icon {
  font-size: 13px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}
.activity-item__text {
  color: var(--text-secondary);
  word-break: break-word;
}
.activity-item--result .activity-item__text {
  color: var(--text-primary);
  font-weight: 500;
}

@keyframes activitySlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══ Widget Refresh Button ═══ */
.widget-card__refresh {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.4;
  transition: opacity 0.2s, background 0.2s;
}
.widget-card__refresh:hover {
  opacity: 1;
  background: rgba(255,255,255,0.1);
}
.widget-card { cursor: pointer; }

