  :root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #475569;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --risk-low: #22c55e;
    --risk-medium: #eab308;
    --risk-high: #ef4444;
  }

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

  body {
    font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
  }

  .container {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }

  .header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .header-stats {
    display: flex;
    gap: 20px;
    font-size: 13px;
  }

  .stat { display: flex; align-items: center; gap: 6px; }
  .stat-low { color: var(--risk-low); }
  .stat-medium { color: var(--risk-medium); }
  .stat-high { color: var(--risk-high); }

  .main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
  }

  .sidebar {
    width: 350px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }

  .sidebar-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .sidebar-content {
    flex: 1;
    overflow-y: auto;
  }

  .repo-group {
    border-bottom: 1px solid var(--border-color);
  }

  .repo-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
    font-weight: 500;
  }

  .repo-header:hover {
    background: var(--bg-tertiary);
  }

  .repo-header.expanded {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--accent-blue);
  }

  .repo-icon { color: var(--text-muted); }
  .repo-name { flex: 1; }
  .repo-count {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-secondary);
  }

  .pr-list {
    background: var(--bg-primary);
  }

  .pr-item {
    padding: 10px 16px 10px 32px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
  }

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

  .pr-item.selected {
    background: rgba(59, 130, 246, 0.15);
    border-left: 3px solid var(--accent-blue);
    padding-left: 29px;
  }

  .pr-risk-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .pr-risk-low { background: var(--risk-low); }
  .pr-risk-medium { background: var(--risk-medium); }
  .pr-risk-high { background: var(--risk-high); }

  .pr-number {
    color: var(--text-muted);
    font-size: 13px;
    width: 45px;
  }

  .pr-title {
    flex: 1;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .detail-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }

  .detail-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
  }

  .detail-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .detail-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-secondary);
  }

  .detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
  }

  .section {
    margin-bottom: 24px;
  }

  .section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-cyan);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
  }

  .risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
  }

  .risk-badge.low {
    background: rgba(34, 197, 94, 0.15);
    color: var(--risk-low);
  }

  .risk-badge.medium {
    background: rgba(234, 179, 8, 0.15);
    color: var(--risk-medium);
  }

  .risk-badge.high {
    background: rgba(239, 68, 68, 0.15);
    color: var(--risk-high);
  }

  .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
  }

  .stat-card {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
  }

  .stat-card-value {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
  }

  .stat-card-label {
    font-size: 12px;
    color: var(--text-secondary);
  }

  .actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    font-family: inherit;
  }

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

  .btn-primary:hover {
    background: #2563eb;
  }

  .btn-success {
    background: var(--risk-low);
    color: white;
  }

  .btn-success:hover {
    background: #16a34a;
  }

  .btn-danger {
    background: var(--risk-high);
    color: white;
  }

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

  .btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
  }

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

  /* Button loading states */
  .btn.htmx-request {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
  }

  .btn.htmx-request::after {
    content: "\⏳";
    margin-left: 8px;
    animation: spin 1s linear infinite;
  }

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

  /* htmx indicators */
  .htmx-indicator {
    display: none;
  }

  .htmx-request .htmx-indicator {
    display: inline-block;
  }

  .htmx-request.htmx-indicator {
    display: inline-block;
  }

  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
  }

  .empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
  }

  .toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
    z-index: 1000;
  }

  .toast-success {
    background: var(--risk-low);
    color: white;
  }

  .toast-error {
    background: var(--risk-high);
    color: white;
  }

  @keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }

  .loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
  }

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

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

  .htmx-request .loading { display: flex; }
  .htmx-request .loaded { display: none; }

  .keyboard-hints {
    padding: 8px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 20px;
  }

  .keyboard-hints kbd {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 4px;
  }

  /* Status indicator */
  .status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
  }

  .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
  }

  .status-healthy { background: rgba(34, 197, 94, 0.15); color: var(--risk-low); }
  .status-healthy .status-dot { background: var(--risk-low); }

  .status-degraded { background: rgba(234, 179, 8, 0.15); color: var(--risk-medium); }
  .status-degraded .status-dot { background: var(--risk-medium); }

  .status-error { background: rgba(239, 68, 68, 0.15); color: var(--risk-high); }
  .status-error .status-dot { background: var(--risk-high); }

  .status-warning { background: rgba(234, 179, 8, 0.15); color: var(--risk-medium); }
  .status-warning .status-dot { background: var(--risk-medium); }

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

  /* Chat panel */
  .chat-section {
    margin-top: 24px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
  }

  .chat-header {
    background: var(--bg-tertiary);
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
  }

  .chat-messages {
    max-height: 300px;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-primary);
  }

  .chat-message {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
  }

  .chat-message.user {
    background: var(--accent-blue);
    color: white;
    margin-left: 40px;
  }

  .chat-message.assistant {
    background: var(--bg-secondary);
    margin-right: 40px;
    border: 1px solid var(--border-color);
  }

  .chat-message pre {
    background: var(--bg-primary);
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    margin-top: 8px;
    font-size: 12px;
  }

  .chat-input-container {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
  }

  .chat-input {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
  }

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

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

  .quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
  }

  .quick-question {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
  }

  .quick-question:hover {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
  }

  /* Fleet summary banner */
  .fleet-summary {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 20px;
    margin: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .fleet-summary-icon {
    font-size: 24px;
  }

  .fleet-summary-content {
    flex: 1;
  }

  .fleet-summary-title {
    font-weight: 600;
    margin-bottom: 4px;
  }

  .fleet-summary-recommendation {
    color: var(--text-secondary);
    font-size: 14px;
  }

  .fleet-summary-actions {
    display: flex;
    gap: 8px;
  }

  /* AI Summary in PR detail */
  .ai-summary {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
  }

  .ai-summary-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-bottom: 8px;
  }

  .ai-summary-content {
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
  }

  .ai-summary-loading {
    color: var(--text-muted);
    font-style: italic;
  }

  .generate-summary-btn {
    background: transparent;
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    text-align: center;
    margin-top: 16px;
    transition: all 0.15s;
  }

  .generate-summary-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.05);
  }

  /* Workflow status widget */
  .workflow-status {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin: 16px;
  }

  .workflow-status-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-primary);
  }

  .workflow-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
  }

  .workflow-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
  }

  .workflow-stat-running { color: var(--accent-cyan); }
  .workflow-stat-failed { color: var(--risk-high); }
  .workflow-stat-passed { color: var(--risk-low); }

  .workflow-runs {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .workflow-run {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    font-size: 12px;
  }

  .workflow-run-status {
    flex-shrink: 0;
    font-size: 14px;
  }

  .workflow-run-name {
    flex: 1;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .workflow-run-time {
    color: var(--text-muted);
    font-size: 11px;
  }
