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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f1117;
  color: #e0e0e0;
  min-height: 100vh;
}

.hidden { display: none !important; }
.subtle { color: #888; font-size: 0.85em; }
.error { color: #ef4444; margin-top: 8px; }

/* Login */
#login-screen {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.login-box {
  background: #1a1d28; padding: 40px; border-radius: 12px; text-align: center; width: 340px;
}
.login-box h1 { margin-bottom: 24px; font-size: 1.5em; }
.login-box input {
  width: 100%; padding: 10px 14px; border: 1px solid #333; border-radius: 6px;
  background: #0f1117; color: #e0e0e0; font-size: 1em; margin-bottom: 12px;
}
.login-box button {
  width: 100%; padding: 10px; border: none; border-radius: 6px;
  background: #3b82f6; color: white; font-size: 1em; cursor: pointer;
}
.login-box button:hover { background: #2563eb; }

/* Header */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: #1a1d28; border-bottom: 1px solid #2a2d38;
}
header h1 { font-size: 1.2em; }
.header-right { display: flex; align-items: center; gap: 12px; }
.status-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.status-dot.connected { background: #22c55e; }
.status-dot.disconnected { background: #ef4444; }
#logout-btn {
  padding: 6px 14px; border: 1px solid #444; border-radius: 6px;
  background: transparent; color: #ccc; cursor: pointer; font-size: 0.85em;
}
#logout-btn:hover { background: #2a2d38; }

/* LLM Strip */
#llm-strip {
  display: flex; gap: 16px; padding: 16px 24px; background: #13151e;
  border-bottom: 1px solid #2a2d38;
}
.llm-panel {
  flex: 1; background: #1a1d28; border-radius: 8px; padding: 16px;
}
.llm-panel h3 {
  margin-bottom: 8px; font-size: 1em;
  display: flex; align-items: center; gap: 8px;
}

.load-bar-container {
  position: relative; height: 24px; background: #2a2d38; border-radius: 4px;
  overflow: hidden; margin: 8px 0;
}
.load-bar {
  height: 100%; width: 0%; transition: width 0.5s, background-color 0.5s;
  border-radius: 4px;
}
.load-label {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 0.8em; font-weight: 600; color: #e0e0e0;
}

.slots-row { display: flex; gap: 6px; margin: 8px 0; }
.slot-dot {
  width: 14px; height: 14px; border-radius: 3px; border: 1px solid #444;
}
.slot-dot.idle { background: #374151; }
.slot-dot.processing { background: #22c55e; animation: pulse 1.5s infinite; }

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

.chip {
  font-size: 0.75em; padding: 2px 10px; border-radius: 12px; font-weight: 600;
}
.chip-offline { background: #374151; color: #888; }
.chip-idle { background: #1e3a2f; color: #4ade80; }
.chip-compacting { background: #3b2f1e; color: #fbbf24; animation: pulse 1.5s infinite; }

.gpu-stats {
  font-size: 0.85em; color: #aaa; margin-top: 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.gpu-card {
  background: #13151e; border-radius: 4px; padding: 8px 12px;
}
.gpu-name {
  font-weight: 600; color: #ccc; margin-bottom: 4px; font-size: 0.9em;
}
.gpu-metrics { display: flex; flex-wrap: wrap; gap: 12px; }
.gpu-stat { display: flex; gap: 4px; }
.gpu-stat .label { color: #666; }

/* PR Table */
#pr-section { padding: 24px; }
#pr-section h2 { margin-bottom: 16px; }
#pr-table, #merged-table { width: 100%; border-collapse: collapse; }
#pr-table th, #merged-table th {
  text-align: left; padding: 10px 12px; border-bottom: 2px solid #2a2d38;
  color: #888; font-size: 0.85em; text-transform: uppercase;
}
#pr-table td, #merged-table td { padding: 10px 12px; border-bottom: 1px solid #1e2030; }
#merged-table tr:hover { background: #1a1d28; }
#pr-table tr:hover, #merged-table tr:hover { background: #1a1d28; }
.pr-link { color: #60a5fa; text-decoration: none; }
.pr-link:hover { text-decoration: underline; }

.badge {
  font-size: 0.75em; padding: 3px 10px; border-radius: 12px; font-weight: 600;
  white-space: nowrap; display: inline-block;
}
.badge-open { background: #1e3a5f; color: #60a5fa; }
.badge-in-review { background: #3b2f1e; color: #fbbf24; }
.badge-reviewed { background: #1e3a2f; color: #4ade80; }
.badge-draft { background: #2a2d38; color: #888; }
.badge-merged { background: #2d1f5e; color: #a78bfa; }

.merged-toggle {
  margin-top: 24px; padding: 10px 16px; background: #1a1d28; border: 1px solid #2a2d38;
  border-radius: 6px; color: #888; cursor: pointer; font-size: 0.9em; width: 100%;
  text-align: left;
}
.merged-toggle:hover { background: #22253a; color: #ccc; }
#merged-section { margin-top: 8px; }

.btn {
  padding: 5px 12px; border: none; border-radius: 4px; cursor: pointer;
  font-size: 0.85em; margin-right: 6px;
}
.btn-review { background: #3b82f6; color: white; }
.btn-review:hover { background: #2563eb; }
.btn-review:disabled { background: #374151; color: #666; cursor: not-allowed; }
.btn-view { background: #22c55e; color: white; }
.btn-view:hover { background: #16a34a; }
.btn-rereview { background: #f59e0b; color: white; }
.btn-rereview:hover { background: #d97706; }
.btn-rereview:disabled { background: #374151; color: #666; cursor: not-allowed; }

/* Modal */
.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8); z-index: 100; display: flex;
  align-items: center; justify-content: center;
}
.modal-content {
  background: #fff; color: #1a1a1a; border-radius: 8px; padding: 32px;
  max-width: 800px; width: 95%; max-height: 90vh; overflow-y: auto; position: relative;
}
.modal-close {
  position: absolute; top: 12px; right: 16px; background: none; border: none;
  font-size: 1.5em; cursor: pointer; color: #666;
}
.modal-close:hover { color: #333; }

.outdated-banner {
  background: #fef2f2; border: 1px solid #fca5a5; border-left: 4px solid #dc2626;
  color: #991b1b; padding: 12px 16px; border-radius: 6px; margin-bottom: 16px;
  font-weight: 600; font-size: 0.95em;
}
.modal-dark { background: #1a1d28; color: #e0e0e0; }
.modal-dark .modal-close { color: #888; }
.modal-dark .modal-close:hover { color: #e0e0e0; }

.progress-section { margin: 16px 0; }
.progress-section h4 { color: #888; font-size: 0.85em; text-transform: uppercase; margin-bottom: 8px; }

.step-item {
  display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 0.9em;
}
.step-check { width: 18px; text-align: center; }
.step-done { color: #22c55e; }
.step-pending { color: #444; }
.step-active { color: #fbbf24; animation: pulse 1.5s infinite; }

.file-bar-container {
  background: #2a2d38; border-radius: 4px; height: 20px; overflow: hidden; margin-bottom: 8px;
  position: relative;
}
.file-bar { height: 100%; background: #22c55e; transition: width 0.5s; border-radius: 4px; }
.file-bar-label {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 0.75em; font-weight: 600; color: #e0e0e0;
}

.file-list { max-height: 200px; overflow-y: auto; font-size: 0.85em; }
.file-list-item { padding: 2px 0; display: flex; align-items: center; gap: 6px; }
.file-list-item .check { width: 14px; text-align: center; }

.current-file {
  background: #2a2d38; border-left: 3px solid #fbbf24; padding: 8px 12px;
  border-radius: 4px; font-size: 0.9em; color: #fbbf24;
}

.llm-indicator {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-radius: 6px; margin-bottom: 16px; font-size: 0.9em;
}
.llm-indicator.generating {
  background: #1e2d1e; border: 1px solid #22c55e;
  color: #4ade80;
}
.llm-indicator.idle {
  background: #2a2d38; border: 1px solid #444;
  color: #888;
}
.llm-dots { display: inline-flex; gap: 3px; }
.llm-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: #4ade80;
  animation: llmDot 1.4s infinite;
}
.llm-dots span:nth-child(2) { animation-delay: 0.2s; }
.llm-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes llmDot {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

.notes-feed { margin-top: 12px; }
.note-card {
  background: #13151e; border-left: 3px solid #3b82f6; padding: 8px 12px;
  border-radius: 4px; margin-bottom: 8px; font-size: 0.85em;
}
.note-card-file { color: #60a5fa; font-weight: 600; margin-bottom: 4px; font-size: 0.8em; }
.note-card-line { color: #aaa; line-height: 1.4; }
.note-card-fresh { border-left-color: #22c55e; }

.btn-cancel { background: #dc2626; color: white; }
.btn-cancel:hover { background: #b91c1c; }

.btn-progress {
  background: #6366f1; color: white; padding: 5px 12px; border: none;
  border-radius: 4px; cursor: pointer; font-size: 0.85em;
}
.btn-progress:hover { background: #4f46e5; }
