body { background: #0a0a0a; color: #e5e5e5; font-family: 'JetBrains Mono', monospace; }
h1, h2, h3 { font-family: 'EB Garamond', serif; }

.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.status-idle { background: #22c55e; }
.status-busy { background: #f59e0b; }
.status-error { background: #ef4444; animation: pulse-red 1.5s infinite; }
.status-offline { background: #6b7280; }

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

.card { background: #111; border: 1px solid #222; border-radius: 8px; }
.card:hover { border-color: #333; }

#plan-modal, #config-modal { display: none; position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; }
.plan-modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); }
.plan-modal-content { position: relative; z-index: 1; background: #111; border: 1px solid #333; border-radius: 10px; width: 90vw; max-width: 900px; max-height: 85vh; display: flex; flex-direction: column; }
.plan-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid #333; font-size: 16px; color: #e5e5e5; font-family: 'EB Garamond', serif; font-weight: 600; }
.plan-modal-close { cursor: pointer; font-size: 20px; color: #666; line-height: 1; padding: 0 4px; }
.plan-modal-close:hover { color: #ccc; }
.plan-modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }

.stage-pill { padding: 2px 8px; border-radius: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.stage-done { background: #166534; color: #86efac; }
.stage-paper { background: #166534; color: #86efac; border: 1px solid #4ade80; box-shadow: 0 0 6px rgba(74, 222, 128, 0.35); font-weight: 600; }
.stage-pending { background: #1a1a1a; color: #555; }

.step-row { border-bottom: 1px solid #1a1a1a; }
.step-row:last-child { border-bottom: none; }

.expand-btn { cursor: pointer; user-select: none; }
.expand-btn:hover { color: #aaa; }

.cost-badge { font-size: 11px; padding: 1px 6px; border-radius: 3px; background: #1a1a2e; color: #8b8bcd; }
.time-badge { font-size: 11px; padding: 1px 6px; border-radius: 3px; background: #1a2e1a; color: #8bcd8b; }
.config-badge { font-size: 10px; padding: 1px 5px; border-radius: 3px; background: #1a1a2e; color: #9b9bdd; font-family: 'JetBrains Mono', monospace; }
.param-badge { font-size: 10px; padding: 1px 5px; border-radius: 3px; background: #1a1a1a; color: #777; border: 1px solid #2a2a2a; }

.best-iter-badge { font-size: 11px; padding: 1px 6px; border-radius: 3px; background: #1a2e1a; color: #8bcd8b; }

.data-desc-link { font-size: 11px; padding: 2px 8px; border-radius: 3px; background: #1a1a1a; color: #999; border: 1px solid #2a2a2a; cursor: pointer; user-select: none; display: inline-block; }
.data-desc-link:hover { color: #ddd; border-color: #444; background: #222; }

.repo-chip { display: inline-block; padding: 4px 10px; border: 1px solid #333; border-radius: 4px; font-size: 12px; margin: 3px; }
.repo-chip:hover { border-color: #555; background: #1a1a1a; }

a { color: #93c5fd; text-decoration: none; }
a:hover { text-decoration: underline; }

.progress-bar { display: flex; gap: 2px; }
.progress-segment { height: 6px; flex: 1; border-radius: 2px; }

.usage-bar { height: 4px; border-radius: 2px; background: #1a1a1a; overflow: hidden; }
.usage-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }

.feed-item { border-left: 2px solid #222; padding-left: 12px; }

.hidden { display: none; }
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* Card iteration navigation */
.iter-nav { display: inline-flex; align-items: center; gap: 6px; }
.iter-arrow { cursor: pointer; padding: 2px 6px; color: #aaa; user-select: none; font-size: 14px; border-radius: 3px; }
.iter-arrow:hover { color: #fff; background: #333; }

/* Clickable stage pills */
.stage-clickable { cursor: pointer; }
.stage-clickable:hover { filter: brightness(1.3); }

/* Stage content modal */
#stage-modal {
    display: none;
    position: fixed; inset: 0; z-index: 1000;
    align-items: center; justify-content: center;
}
.stage-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.75);
}
.stage-modal-content {
    position: relative; z-index: 1;
    background: #fff; border-radius: 10px;
    width: 90vw; max-width: 800px; max-height: 85vh;
    display: flex; flex-direction: column;
}
.stage-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 18px; color: #222;
    font-family: 'EB Garamond', serif; font-weight: 600;
}
.stage-modal-nav {
    display: flex; align-items: center; gap: 12px;
}
.stage-modal-arrow {
    cursor: pointer; font-size: 18px; color: #999;
    user-select: none; padding: 2px 6px; border-radius: 4px;
}
.stage-modal-arrow:hover { color: #333; background: #f0f0f0; }
.stage-modal-close {
    cursor: pointer; font-size: 20px; color: #999;
    line-height: 1; padding: 0 4px;
}
.stage-modal-close:hover { color: #333; }
.stage-modal-body {
    padding: 20px 24px; overflow-y: auto; flex: 1;
}

/* Markdown rendered content (light theme for modal) */
.stage-md-content { font-family: 'EB Garamond', serif; font-size: 18px; line-height: 1.8; color: #1a1a1a; }
.stage-md-content h1, .stage-md-content h2, .stage-md-content h3 { color: #111; margin-top: 1.4em; margin-bottom: 0.5em; font-weight: 600; }
.stage-md-content h1 { font-size: 1.6em; }
.stage-md-content h2 { font-size: 1.35em; }
.stage-md-content h3 { font-size: 1.15em; }
.stage-md-content p { margin: 0.7em 0; }
.stage-md-content ul, .stage-md-content ol { margin: 0.7em 0; padding-left: 1.5em; }
.stage-md-content li { margin: 0.35em 0; }
.stage-md-content code { font-family: 'JetBrains Mono', monospace; font-size: 0.8em; background: #f3f3f3; padding: 2px 6px; border-radius: 3px; color: #333; }
.stage-md-content pre { background: #f7f7f7; border: 1px solid #e0e0e0; border-radius: 6px; padding: 14px; overflow-x: auto; margin: 1em 0; }
.stage-md-content pre code { background: none; padding: 0; font-size: 0.85em; }
.stage-md-content strong { color: #000; font-weight: 600; }
.stage-md-content em { color: #444; }
.stage-md-content blockquote { border-left: 3px solid #ccc; padding-left: 14px; color: #555; margin: 1em 0; font-style: italic; }
.stage-md-content a { color: #2563eb; }
.stage-md-content table { border-collapse: collapse; margin: 1em 0; width: 100%; }
.stage-md-content th, .stage-md-content td { border: 1px solid #ddd; padding: 8px 12px; font-size: 0.9em; }
.stage-md-content th { background: #f3f3f3; color: #333; }
.stage-md-content .katex { font-size: 1.05em; }

/* LaTeX preformatted */
.stage-tex-content { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #333; white-space: pre-wrap; word-break: break-word; }
