/* ==========================================================================
   Octopoda Agent Runtime Dashboard
   Light Theme — Anthropic-inspired
   ========================================================================== */

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

/* --------------------------------------------------------------------------
   1. Custom Properties — Light, warm, Anthropic-inspired
   -------------------------------------------------------------------------- */
:root {
  /* Backgrounds */
  --bg-page:           #F8F7F4;
  --bg-sidebar:        #FFFFFF;
  --bg-surface:        #FFFFFF;
  --bg-card:           #FFFFFF;
  --bg-elevated:       #F3F2EE;
  --bg-hover:          rgba(0, 0, 0, 0.03);
  --bg-code:           #F5F4F0;

  /* Borders */
  --border-default:    #E8E5DE;
  --border-subtle:     #F0EDE6;
  --border-focus:      #D4612C;

  /* Accent — warm orange (matches the octopus) */
  --accent-primary:    #D4612C;
  --accent-primary-rgb: 212, 97, 44;
  --accent-hover:      #BF5526;
  --accent-muted:      rgba(212, 97, 44, 0.08);
  --accent-light:      rgba(212, 97, 44, 0.05);

  /* Semantic colors */
  --color-success:     #16A34A;
  --color-success-rgb: 22, 163, 74;
  --color-warning:     #CA8A04;
  --color-warning-rgb: 202, 138, 4;
  --color-danger:      #DC2626;
  --color-danger-rgb:  220, 38, 38;
  --color-recovery:    #2563EB;
  --color-recovery-rgb: 37, 99, 235;

  /* Typography */
  --text-primary:      #1A1A1A;
  --text-secondary:    #5C5C5C;
  --text-muted:        #9CA3AF;

  --font-display:      'JetBrains Mono', monospace;
  --font-body:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Sizing */
  --radius-sm:         6px;
  --radius-md:         10px;
  --radius-lg:         14px;
  --radius-xl:         16px;

  --sidebar-width:     248px;
  --header-height:     64px;

  /* Shadows */
  --shadow-sm:         0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md:         0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg:         0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-card:       0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);

  /* Transitions */
  --ease-smooth:       cubic-bezier(0.4, 0, 0.2, 1);
  --duration:          200ms;
}

/* --------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* --------------------------------------------------------------------------
   3. Scrollbar
   -------------------------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D5D3CC; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #B8B5AD; }

/* --------------------------------------------------------------------------
   4. Keyframe Animations
   -------------------------------------------------------------------------- */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

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

/* --------------------------------------------------------------------------
   5. Dashboard Layout
   -------------------------------------------------------------------------- */
.dashboard {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   6. Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 8px;
}

.sidebar__logo-img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar__logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #D4612C, #E8874A);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
}

.sidebar__logo-text {
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar__version {
  padding: 0 20px 16px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-display);
}

.sidebar__nav {
  flex: 1;
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease-smooth);
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item--active {
  background: var(--accent-muted);
  color: var(--accent-primary);
  font-weight: 600;
}

.nav-item--active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent-primary);
  border-radius: 0 3px 3px 0;
}

.nav-item__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-width: 1.75;
}

.sidebar__divider {
  height: 1px;
  background: var(--border-default);
  margin: 8px 20px;
}

.sidebar__bottom-nav {
  padding: 0 12px 8px;
}

.sidebar__status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-default);
  font-size: 12px;
  color: var(--text-secondary);
}

.sidebar__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulse-dot 2s ease infinite;
  flex-shrink: 0;
}

.sidebar__status-dot--disconnected {
  background: var(--color-danger);
  animation: none;
}

/* --------------------------------------------------------------------------
   7. Main Area
   -------------------------------------------------------------------------- */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-page);
}

/* --------------------------------------------------------------------------
   8. Header Bar
   -------------------------------------------------------------------------- */
.header-bar {
  height: var(--header-height);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-surface);
}

.header-bar__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.header-bar__right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-bar__metrics {
  display: flex;
  gap: 20px;
}

.header-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.header-metric__value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-display);
}

.header-metric__value--accent { color: var(--accent-primary); }
.header-metric__value--danger { color: var(--color-danger); }
.header-metric__value--success { color: var(--color-success); }

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

.header-bar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4612C, #E8874A);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: white;
}

/* --------------------------------------------------------------------------
   9. Content Area
   -------------------------------------------------------------------------- */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  animation: fadeIn 0.3s ease;
}

/* --------------------------------------------------------------------------
   10. Stat Cards
   -------------------------------------------------------------------------- */
.stat-cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--duration) var(--ease-smooth), transform var(--duration) var(--ease-smooth);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card__icon svg {
  width: 18px;
  height: 18px;
}

.stat-card__icon--indigo { background: rgba(99, 102, 241, 0.10); color: #6366f1; }
.stat-card__icon--green  { background: rgba(22, 163, 74, 0.10);  color: #16A34A; }
.stat-card__icon--orange { background: rgba(212, 97, 44, 0.10);  color: #D4612C; }
.stat-card__icon--blue   { background: rgba(37, 99, 235, 0.10);  color: #2563EB; }

.stat-card__label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-card__value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-card__sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   11. Cards (generic)
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--duration) var(--ease-smooth);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.card__subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   12. Overview Page Layout
   -------------------------------------------------------------------------- */
.overview-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.overview-chart-card {
  min-height: 340px;
}

.overview-agents-card {
  max-height: 400px;
  overflow: hidden;
}

.chart-container {
  padding: 16px 20px;
  flex: 1;
}

/* --------------------------------------------------------------------------
   13. Agent Status List
   -------------------------------------------------------------------------- */
.agent-status-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.agent-status-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration) var(--ease-smooth);
  cursor: default;
}

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

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

.agent-status-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.agent-status-item__name {
  flex: 1;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-display);
}

.agent-status-item__score {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  font-variant-numeric: tabular-nums;
}

.agent-status-item__score--good { background: rgba(22, 163, 74, 0.10); color: #16A34A; }
.agent-status-item__score--warn { background: rgba(202, 138, 4, 0.10); color: #CA8A04; }
.agent-status-item__score--bad  { background: rgba(220, 38, 38, 0.10); color: #DC2626; }

.agent-status-item__time {
  font-size: 12px;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   14. Memory Stream & Events Log
   -------------------------------------------------------------------------- */
.memory-stream__list,
.events-log__list {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px 0;
}

.stream-entry,
.event-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration) var(--ease-smooth);
}

.stream-entry:hover,
.event-entry:hover {
  background: var(--bg-hover);
}

.stream-entry__key {
  flex: 1;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-entry__latency {
  font-size: 12px;
  color: var(--accent-primary);
  font-family: var(--font-display);
  white-space: nowrap;
}

.stream-entry__time,
.event-entry__time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.event-entry__type {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.event-entry__msg {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Event type badge colors — light mode */
.badge-anomaly   { background: rgba(202, 138, 4, 0.10);  color: #CA8A04; }
.badge-recovery  { background: rgba(22, 163, 74, 0.10);  color: #16A34A; }
.badge-crash     { background: rgba(220, 38, 38, 0.10);  color: #DC2626; }
.badge-decision  { background: rgba(99, 102, 241, 0.10); color: #6366f1; }
.badge-handoff   { background: rgba(37, 99, 235, 0.10);  color: #2563EB; }
.badge-snapshot  { background: rgba(139, 92, 246, 0.10); color: #7C3AED; }
.badge-info      { background: rgba(99, 102, 241, 0.10); color: #6366f1; }

/* --------------------------------------------------------------------------
   15. Data Tables
   -------------------------------------------------------------------------- */
.filters-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-default);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.data-table thead th:hover {
  color: var(--text-secondary);
}

.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   16. Form Inputs
   -------------------------------------------------------------------------- */
.search-input,
.select-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--duration) var(--ease-smooth);
}

.search-input:focus,
.select-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.1);
}

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

.select-input {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.select-input option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   17. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--duration) var(--ease-smooth);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.08);
  color: #DC2626;
  border-color: rgba(220, 38, 38, 0.15);
}

.btn-danger:hover { background: rgba(220, 38, 38, 0.14); }

.btn-success {
  background: rgba(22, 163, 74, 0.08);
  color: #16A34A;
  border-color: rgba(22, 163, 74, 0.15);
}

.btn-success:hover { background: rgba(22, 163, 74, 0.14); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  line-height: 1;
}
.btn-icon:hover { color: var(--text-primary); }

/* --------------------------------------------------------------------------
   18. Status Dots & Badges
   -------------------------------------------------------------------------- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-active, .status-running   { background: var(--color-success); }
.status-idle                       { background: var(--color-warning); }
.status-error, .status-crashed     { background: var(--color-danger); }
.status-recovering                 { background: var(--color-recovery); }
.status-unknown, .status-deregistered { background: var(--text-muted); }

.status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge-active    { background: rgba(22, 163, 74, 0.10); color: #16A34A; }
.status-badge-idle      { background: rgba(202, 138, 4, 0.10); color: #CA8A04; }
.status-badge-error     { background: rgba(220, 38, 38, 0.10); color: #DC2626; }
.status-badge-recovering { background: rgba(37, 99, 235, 0.10); color: #2563EB; }

/* --------------------------------------------------------------------------
   19. Performance Grid
   -------------------------------------------------------------------------- */
.perf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.perf-grid .card {
  min-height: 320px;
}

/* --------------------------------------------------------------------------
   20. Memory Layout
   -------------------------------------------------------------------------- */
.memory-layout {
  display: flex;
  gap: 16px;
  height: calc(100vh - 160px);
}

.memory-layout__tree {
  width: 220px;
  flex-shrink: 0;
}

.memory-layout__tree .card { height: 100%; }
.memory-layout__content { flex: 1; }
.memory-layout__content .card { height: 100%; }

.tree-view { padding: 8px 12px; }

.tree-item {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--duration) var(--ease-smooth);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tree-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.tree-item--active { background: var(--accent-muted); color: var(--accent-primary); font-weight: 500; }

/* --------------------------------------------------------------------------
   21. Agent Map
   -------------------------------------------------------------------------- */
.agent-map-legend {
  display: flex;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-default);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot--active     { background: var(--color-success); }
.legend-dot--idle       { background: var(--color-warning); }
.legend-dot--error      { background: var(--color-danger); }
.legend-dot--recovering { background: var(--color-recovery); }

/* --------------------------------------------------------------------------
   22. Modal
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-default);
}

.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-default);
}

/* --------------------------------------------------------------------------
   23. Toast
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   24. JSON Content
   -------------------------------------------------------------------------- */
.json-content {
  background: var(--bg-code);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-secondary);
  overflow-x: auto;
  max-height: 300px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* --------------------------------------------------------------------------
   25. Event List
   -------------------------------------------------------------------------- */
.event-list {
  list-style: none;
  padding: 0;
}

.event-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
}

.event-list li:last-child { border-bottom: none; }

/* --------------------------------------------------------------------------
   26. Empty State
   -------------------------------------------------------------------------- */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   27. Agent Cards
   -------------------------------------------------------------------------- */
.agent-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 8px;
}

.agent-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.agent-name {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.agent-card-body {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.agent-stat { display: flex; flex-direction: column; gap: 2px; }

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

.agent-stat .value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.agent-card-actions { display: flex; gap: 8px; }

/* --------------------------------------------------------------------------
   28. Audit & Replay
   -------------------------------------------------------------------------- */
.timeline-entry {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.timeline-entry__time {
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 12px;
  white-space: nowrap;
  min-width: 70px;
}

.timeline-entry__agent {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--accent-primary);
  min-width: 100px;
}

.timeline-entry__content { flex: 1; color: var(--text-secondary); }

.replay-speed-btn.active {
  background: var(--accent-muted);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* --------------------------------------------------------------------------
   29. Recovery & Shared
   -------------------------------------------------------------------------- */
.recovery-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.recovery-entry__agent { font-family: var(--font-display); font-size: 12px; color: var(--accent-primary); min-width: 100px; }
.recovery-entry__strategy { color: var(--text-secondary); flex: 1; }
.recovery-entry__time { color: var(--text-muted); font-size: 12px; }

.shared-space-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--duration) var(--ease-smooth);
}

.shared-space-item:hover { background: var(--bg-hover); }
.shared-space-item__name { font-weight: 500; color: var(--text-primary); font-family: var(--font-display); font-size: 13px; }
.shared-space-item__meta { font-size: 12px; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   30. Chart.js
   -------------------------------------------------------------------------- */
canvas { max-width: 100%; }

/* --------------------------------------------------------------------------
   31. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .stat-cards-row { grid-template-columns: repeat(2, 1fr); }
  .overview-row { grid-template-columns: 1fr; }
  .perf-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .stat-cards-row { grid-template-columns: 1fr; }
  .header-bar__metrics { display: none; }
  .memory-layout { flex-direction: column; height: auto; }
  .memory-layout__tree { width: 100%; }
}
