/* ELIDA Dashboard - Enterprise UI */

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

:root {
  /* Enterprise Indigo/Slate - Gateway Infrastructure */
  --bg-primary: #0a0e1a;
  --bg-secondary: #131a2e;
  --bg-tertiary: #1e2942;
  --bg-hover: #263352;
  --border-color: #2a3654;
  --border-light: #3d4a6a;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #8892a8;
  --text-dim: #5c6478;
  /* Indigo accent - authoritative, modern */
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-subtle: rgba(99, 102, 241, 0.15);
  /* Status colors - slightly muted for enterprise feel */
  --color-success: #10b981;
  --color-success-bg: #064e3b;
  --color-success-text: #a7f3d0;
  --color-warning: #f59e0b;
  --color-warning-bg: #78350f;
  --color-warning-text: #fde68a;
  --color-error: #ef4444;
  --color-error-bg: #7f1d1d;
  --color-error-text: #fecaca;
  --color-info-bg: #312e81;
  --color-info-text: #c7d2fe;
  /* Layout */
  --topnav-height: 52px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-secondary);
  min-height: 100vh;
}

/* App Layout */
.app-layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: var(--topnav-height) 1fr;
  grid-template-areas:
    "topnav"
    "main";
  min-height: 100vh;
}

/* TopNav */
.topnav {
  grid-area: topnav;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
}

.topnav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
}

.topnav-logo svg {
  width: 28px;
  height: 28px;
}

.topnav-logo-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1px;
}

.topnav-items {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  margin: 0 auto;
}

.topnav-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.topnav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.topnav-item.active {
  background: var(--accent);
  color: var(--text-primary);
}

.topnav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.topnav-active-badge {
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.refresh-indicator {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.refresh-indicator svg {
  width: 14px;
  height: 14px;
}

.refresh-indicator.refreshing svg {
  animation: spin 1s linear infinite;
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-dot.connected {
  background: var(--color-success);
  animation: pulse 2s infinite;
}

.status-dot.disconnected {
  background: var(--color-error);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.env-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

/* Main Content */
.main-content {
  grid-area: main;
  padding: 1.5rem;
  overflow-y: auto;
}

/* Metric Cards */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--bg-secondary);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.metric-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.metric-value.success { color: var(--color-success); }
.metric-value.warning { color: var(--color-warning); }
.metric-value.error { color: var(--color-error); }

.metric-change {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.metric-sparkline {
  width: 80px;
  height: 32px;
}

/* Sparkline */
.sparkline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline-area {
  fill: url(#sparkline-gradient);
  stroke: none;
}

/* Panels */
.panel {
  background: var(--bg-secondary);
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-actions {
  display: flex;
  gap: 0.5rem;
}

.panel-body {
  padding: 1rem 1.25rem;
}

.panel-body.no-padding {
  padding: 0;
}

/* Search Input */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper svg {
  position: absolute;
  left: 0.75rem;
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 240px;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  transition: border-color 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

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

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--bg-primary);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table tbody tr {
  transition: background-color 0.1s ease;
}

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

.data-table tbody tr.clickable {
  cursor: pointer;
}

.data-table td {
  font-size: 0.8125rem;
}

.table-container {
  overflow-x: auto;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
}

/* State Badges */
.state-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.state-active { background: var(--color-success-bg); color: var(--color-success-text); }
.state-killed { background: var(--color-error-bg); color: var(--color-error-text); }
.state-timeout { background: var(--color-warning-bg); color: var(--color-warning-text); }
.state-completed { background: var(--color-info-bg); color: var(--color-info-text); }
.state-terminated { background: var(--color-error-bg); color: var(--color-error-text); }
.state-inviting { background: #4338ca; color: #c7d2fe; }
.state-held { background: #6d28d9; color: #ddd6fe; }

/* Severity Badges */
.severity-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
}

.severity-info { background: var(--color-info-bg); color: var(--color-info-text); }
.severity-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.severity-critical { background: var(--color-error-bg); color: var(--color-error-text); }

/* Protocol Badge */
.protocol-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 500;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

/* Violation Tags */
.violation-tag {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  margin: 0.125rem;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

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

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

.btn-danger {
  background: #dc2626;
  color: var(--text-primary);
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-danger:disabled {
  background: var(--bg-tertiary);
  color: var(--text-dim);
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

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

.btn-sm {
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
}

.btn-icon {
  padding: 0.5rem;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
}

.modal {
  background: var(--bg-secondary);
  border-radius: 0.5rem;
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 10;
}

.modal-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.modal-body h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-body h3:first-child {
  margin-top: 0;
}

/* Session Metrics Grid */
.session-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  background: var(--bg-primary);
  border-radius: 0.375rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
}

@media (max-width: 640px) {
  .session-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.session-metric {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.session-metric-label {
  font-size: 0.6875rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.session-metric-value {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Violations List */
.violations-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.violation-item {
  background: var(--bg-primary);
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
}

.violation-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.violation-header strong {
  font-size: 0.875rem;
}

.violation-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.violation-match {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.violation-match.clickable {
  cursor: pointer;
}

.violation-match code {
  background: var(--bg-primary);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  color: var(--color-warning);
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 0.75rem;
  word-break: break-all;
}

.violation-match code.expanded {
  white-space: pre-wrap;
  display: block;
  padding: 0.5rem;
  margin-top: 0.25rem;
}

.violation-match .expand-hint,
.policy-violation-snippet.clickable {
  cursor: pointer;
}

.policy-violation-snippet.expanded {
  white-space: pre-wrap;
  word-break: break-all;
}

.expand-hint {
  font-size: 0.625rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
  opacity: 0.6;
}

.violation-stats {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

/* Source role badges — shows where in the request the violation was found */
.source-role-badge {
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-left: auto;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.source-role-user {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.source-role-assistant {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.source-role-system {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}

.source-role-tool {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

/* Framework reference tag */
.framework-ref {
  display: inline-block;
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  font-weight: 600;
  margin-right: 6px;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  vertical-align: middle;
}

/* Captured Requests */
.captured-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.captured-item {
  background: var(--bg-primary);
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
}

.captured-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.captured-body strong {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.captured-body pre {
  background: #020617;
  padding: 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin-bottom: 0.75rem;
}

.captured-body pre:last-child {
  margin-bottom: 0;
}

/* Transcript */
.transcript-container {
  background: var(--bg-primary);
  border-radius: 0.375rem;
  border: 1px solid var(--border-color);
  max-height: 400px;
  overflow-y: auto;
}

.transcript-entry {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.transcript-entry:last-child {
  border-bottom: none;
}

.transcript-speaker {
  min-width: 80px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.transcript-speaker.user {
  color: var(--accent);
}

.transcript-speaker.assistant {
  color: var(--color-success);
}

.transcript-text {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.transcript-meta {
  font-size: 0.6875rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Flagged Summary */
.flagged-summary {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.flagged-stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
}

.flagged-stat.critical {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

.flagged-stat.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-warning);
}

.flagged-stat.info {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  color: var(--text-dim);
  text-align: center;
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.875rem;
}

/* Utility Classes */
.mono {
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 0.8rem;
}

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

.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

/* Voice Session Specific */
.voice-info {
  display: flex;
  gap: 2rem;
  margin-bottom: 1rem;
}

.voice-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.voice-info-label {
  font-size: 0.6875rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.voice-info-value {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Refresh Info */
.refresh-info {
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Duration formatting */
.duration {
  font-variant-numeric: tabular-nums;
}

/* Settings Page */
.settings-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.settings-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-actions .btn svg {
  width: 1rem;
  height: 1rem;
}

.settings-diff-count {
  margin-left: auto;
  font-size: 0.8125rem;
  color: var(--color-warning);
  font-weight: 500;
}

.settings-message {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.settings-message.success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.settings-message.error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.settings-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-item.modified {
  position: relative;
}

.settings-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.modified-badge {
  font-size: 0.6875rem;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  background: rgba(234, 179, 8, 0.2);
  color: var(--color-warning);
  font-weight: 500;
}

.settings-select,
.settings-input {
  padding: 0.625rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: border-color 0.15s ease;
}

.settings-select:focus,
.settings-input:focus {
  outline: none;
  border-color: var(--accent);
}

.settings-select {
  cursor: pointer;
}

.settings-input {
  width: 100%;
}

.settings-input[type="number"] {
  width: 120px;
}

.settings-textarea {
  padding: 0.625rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: 'SF Mono', 'Menlo', monospace;
  width: 100%;
  resize: vertical;
  transition: border-color 0.15s ease;
}

.settings-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Custom Rules */
.custom-rules-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.custom-rule-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
}

.custom-rule-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.rule-name-input {
  flex: 1;
  font-weight: 600;
  font-size: 0.9375rem;
}

.custom-rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.custom-rule-grid .settings-item.full-width {
  grid-column: 1 / -1;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-sm {
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
}

.settings-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg-tertiary);
  border-radius: 0.375rem;
  border-left: 3px solid var(--accent);
}

.settings-hint strong {
  color: var(--text-secondary);
}

.settings-hint a {
  color: var(--accent);
  text-decoration: none;
}

.settings-hint a:hover {
  text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .metrics-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .topnav-item span {
    display: none;
  }

  .topnav-logo-text {
    display: none;
  }

  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .search-input {
    width: 180px;
  }
}

/* Login */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-primary);
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.login-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.login-input:focus {
  border-color: var(--accent);
}

.login-error {
  color: var(--color-error);
  font-size: 13px;
  margin-top: 8px;
}

.login-btn {
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  font-size: 14px;
}

/* Sessions Page */
.sessions-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}

.sessions-filters {
  display: flex;
  gap: 0.375rem;
}

.filter-chip {
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-chip:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-primary);
}

.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Session Row */
.session-row-wrapper {
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.session-row-wrapper:hover {
  border-color: var(--border-light);
}

.session-row-wrapper.expanded {
  border-color: var(--accent);
}

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  cursor: pointer;
  gap: 1rem;
  transition: background 0.1s ease;
}

.session-row:hover {
  background: var(--bg-hover);
}

.session-row.risk-high {
  border-left: 3px solid var(--color-error);
}

.session-row.risk-med {
  border-left: 3px solid var(--color-warning);
}

.session-row-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.session-row-expand {
  color: var(--text-dim);
  font-size: 0.75rem;
  width: 1rem;
  flex-shrink: 0;
}

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

.session-row-id {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.session-row-center {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.session-row-backends {
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.session-row-reqs {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.session-row-bytes {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.session-row-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.session-row-risk {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.session-row-risk.risk-high {
  background: var(--color-error-bg);
  color: var(--color-error-text);
}

.session-row-risk.risk-med {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

.session-row-detail {
  border-top: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  background: var(--bg-primary);
}

/* Session Turns */
.session-turns {
  display: flex;
  flex-direction: column;
  padding: 0.125rem 0 0.25rem 1rem;
}

.session-turns-empty {
  font-size: 0.8125rem;
  color: var(--text-dim);
  padding: 0.5rem 0;
}

.session-turn {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.2rem 0;
  font-size: 0.8125rem;
  line-height: 1.4;
}

.turn-tree {
  flex-shrink: 0;
  width: 1.25rem;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--border-color);
  user-select: none;
}

.turn-time {
  flex-shrink: 0;
  width: 5rem;
  font-size: 0.6875rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.turn-pill {
  flex-shrink: 0;
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  border: 1px solid;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.turn-meta {
  flex-shrink: 0;
  font-size: 0.6875rem;
  color: var(--text-dim);
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.turn-content {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.turn-detail {
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.turn-violation-row .turn-pill {
  font-weight: 700;
}

.turn-summary-text {
  font-style: italic;
}

/* ============================================================================
   Session Detail Modal
   ============================================================================ */

.detail-modal {
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 10;
  gap: 0.75rem;
}

.detail-header-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  flex-wrap: wrap;
}

.detail-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.detail-session-id {
  font-size: 0.8125rem;
  color: var(--text-primary);
  font-weight: 500;
}

.detail-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.detail-risk {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 3px;
  background: rgba(234, 179, 8, 0.15);
  color: #fde68a;
}

.detail-risk.risk-high {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.detail-risk.risk-med {
  background: rgba(234, 179, 8, 0.15);
  color: #fde68a;
}

.detail-action-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 3px;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  text-transform: uppercase;
}

/* Timeline Band */
.timeline-band {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  overflow-x: auto;
  min-height: 1.5rem;
}

.timeline-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  opacity: 0.8;
}

.timeline-dot:hover {
  opacity: 1;
  transform: scale(1.5);
}

/* Metrics Strip */
.detail-metrics {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
  flex-wrap: wrap;
}

.detail-metric {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.detail-metric-label {
  font-size: 0.625rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-metric-value {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Detail Body */
.detail-body {
  overflow-y: auto;
  flex: 1;
  padding: 0.5rem 0;
}

.detail-loading {
  padding: 1rem;
  color: var(--text-dim);
  font-size: 0.8125rem;
}

.risk-chart {
  width: 100%;
  height: auto;
  display: block;
}

/* Behavior Radar */
.behavior-container {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
}

.behavior-radar {
  width: 200px;
  height: 200px;
  flex-shrink: 0;
}

.behavior-features {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.behavior-feature-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  font-size: 0.8125rem;
}

.behavior-feature-name {
  color: var(--text-muted);
}

.behavior-feature-value {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .behavior-container { flex-direction: column; align-items: center; }
  .behavior-radar { width: 180px; height: 180px; }
}

/* Collapsible Sections */
.detail-section {
  border-bottom: 1px solid var(--border-color);
}

.detail-section:last-child {
  border-bottom: none;
}

.detail-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 1.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.detail-section-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.detail-section-toggle {
  font-size: 0.75rem;
  width: 1rem;
  color: var(--text-dim);
}

.detail-section-title {
  flex: 1;
  text-align: left;
}

.detail-section-badge {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
}

.detail-section-body {
  padding: 0 1.25rem 0.75rem;
}

/* Tool Grid */
.detail-tool-grid {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-tool-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8125rem;
}

.detail-tool-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.detail-tool-count {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Violations */
.detail-violations {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-violation {
  padding: 0.5rem 0.625rem;
  background: rgba(239, 68, 68, 0.05);
  border-left: 2px solid #ef4444;
  border-radius: 0 3px 3px 0;
  font-size: 0.8125rem;
}

.detail-violation-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-violation-time {
  margin-left: auto;
  font-size: 0.6875rem;
  color: var(--text-dim);
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.detail-violation-desc {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.detail-violation-match {
  margin-top: 0.25rem;
}

.detail-violation-match.expandable {
  cursor: pointer;
}

.detail-violation-match code {
  font-size: 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  color: #fca5a5;
  word-break: break-all;
}

.detail-violation-match code.expanded {
  white-space: pre-wrap;
  display: block;
  padding: 0.5rem;
  margin-top: 0.25rem;
}

.detail-violation-match .expand-hint {
  display: block;
  font-size: 0.625rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
  opacity: 0.6;
}

.detail-violation-ref {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.625rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
}

/* Backend Routing */
.detail-backend-grid {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-backend-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
}

.detail-backend-count {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.detail-backend-failed {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.15);
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
}

.detail-failover-note {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--color-warning);
  font-style: italic;
}

/* Metadata */
.detail-metadata {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.detail-metadata-row {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8125rem;
  padding: 0.125rem 0;
}

.detail-metadata-key {
  color: var(--text-dim);
  min-width: 8rem;
  flex-shrink: 0;
}

.detail-metadata-val {
  color: var(--text-secondary);
  word-break: break-all;
}

/* ============================================================================
   Dashboard Page
   ============================================================================ */

.dashboard-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* KPI Row */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

.kpi-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.kpi-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.kpi-sub {
  font-size: 0.6875rem;
  color: var(--text-dim);
}

.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.kpi-sparkline {
  flex-shrink: 0;
  opacity: 0.7;
}

.kpi-accent .kpi-value { color: var(--color-success); }
.kpi-danger .kpi-value { color: var(--color-error); }

/* Chart Panel */
.dashboard-chart-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  overflow: hidden;
}

.dashboard-chart-header {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.dashboard-chart-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.requests-chart {
  width: 100%;
  height: auto;
  display: block;
  padding: 0.5rem;
}

.chart-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8125rem;
}

/* Two-column grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.75rem;
}

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

.dashboard-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  overflow: hidden;
}

.dashboard-panel-header {
  padding: 0.75rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.dashboard-panel-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8125rem;
}

/* Dashboard tables */
.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.dashboard-table th {
  text-align: left;
  padding: 0.5rem 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-color);
}

.dashboard-table td {
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

.dashboard-session-row {
  cursor: pointer;
}

.dashboard-session-row:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.btn-xs {
  padding: 0.125rem 0.375rem;
  font-size: 0.625rem;
}

/* ============================================================================
   Tool Use Page
   ============================================================================ */

.tooluse-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Scorecard row */
.scorecard-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .scorecard-row { grid-template-columns: repeat(2, 1fr); }
}

.scorecard {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
}

.scorecard-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.scorecard-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.scorecard-sub {
  font-size: 0.6875rem;
  color: var(--text-dim);
  margin-top: 0.125rem;
}

.scorecard-warn .scorecard-value {
  color: var(--color-warning);
}

/* Tool bar chart */
.tooluse-chart-panel,
.tooluse-table-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  overflow: hidden;
}

.tooluse-chart-header,
.tooluse-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.tooluse-chart-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.tooluse-legend {
  display: flex;
  gap: 0.75rem;
}

.tooluse-legend-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  color: var(--text-dim);
}

.tooluse-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.tooluse-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8125rem;
}

/* Horizontal bar chart */
.tool-bar-chart {
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.tool-bar-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.tool-bar-name {
  flex-shrink: 0;
  width: 7rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-align: right;
}

.tool-bar-track {
  flex: 1;
  height: 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 2px;
  overflow: hidden;
}

.tool-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
  min-width: 2px;
}

.tool-bar-count {
  flex-shrink: 0;
  width: 3rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Tool pills in table */
.tool-pills-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.tool-pill {
  display: inline-block;
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
  border: 1px solid;
  font-size: 0.6875rem;
  font-weight: 500;
  white-space: nowrap;
}

.tool-pill-more {
  font-size: 0.6875rem;
  color: var(--text-dim);
  padding: 0.0625rem 0.25rem;
}

/* ============================================================================
   Policy Page
   ============================================================================ */

.policy-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Preset cards */
.policy-preset-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .policy-preset-row { grid-template-columns: repeat(2, 1fr); }
}

.policy-preset-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
}

.policy-preset-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.policy-preset-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: capitalize;
}

.policy-preset-value.enforce { color: var(--color-success); }
.policy-preset-value.audit { color: var(--color-warning); }

.policy-critical-count {
  font-size: 0.75rem;
  color: var(--color-error);
  font-weight: 500;
}

/* Policy panels */
.policy-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  overflow: hidden;
}

.policy-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.policy-panel-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.policy-panel-count {
  font-size: 0.6875rem;
  color: var(--text-dim);
}

.policy-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8125rem;
}

/* Rules table */
.policy-rules-table-wrap {
  overflow-x: auto;
}

.policy-rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.policy-rules-table th {
  text-align: left;
  padding: 0.5rem 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.policy-rules-table td {
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: top;
}

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

.policy-rule-matched td {
  background: rgba(239, 68, 68, 0.03);
}

.policy-rule-name {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.8125rem;
}

.policy-rule-desc {
  font-size: 0.6875rem;
  color: var(--text-dim);
  margin-top: 0.125rem;
}

.policy-action-badge {
  display: inline-block;
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
  font-size: 0.6875rem;
  font-weight: 600;
}

.action-flag {
  background: rgba(234, 179, 8, 0.15);
  color: #fde68a;
}

.action-block {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.action-terminate {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.policy-match-count {
  display: inline-block;
  min-width: 1.25rem;
  text-align: center;
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.policy-no-matches {
  color: var(--text-dim);
}

/* Recent violations list */
.policy-violations-list {
  display: flex;
  flex-direction: column;
}

.policy-violation-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 1.25rem;
  font-size: 0.8125rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.policy-violation-row:last-child {
  border-bottom: none;
}

.policy-violation-time {
  flex-shrink: 0;
  width: 5rem;
  font-size: 0.6875rem;
  color: var(--text-dim);
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
}

.policy-violation-session {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.policy-violation-rule {
  color: var(--text-secondary);
  font-weight: 500;
}

.policy-violation-snippet {
  font-size: 0.6875rem;
  background: rgba(239, 68, 68, 0.08);
  padding: 0.0625rem 0.375rem;
  border-radius: 3px;
  color: #fca5a5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
