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

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --text-primary: #eee;
    --text-secondary: #aaa;
    --accent: #e94560;
    --accent-hover: #ff6b6b;
    --error: #ef4444;
    --success: #22c55e;
    --border: #2a2a4a;
}

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

.hidden {
    display: none !important;
}

/* Login Screen */
.screen {
    min-height: 100vh;
}

#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.login-container {
    background: var(--bg-secondary);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--accent);
    color: white;
    width: 100%;
}

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

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

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

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

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

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

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

.error-message {
    color: var(--error);
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
}

.text-muted {
    color: var(--text-secondary);
    padding: 1rem 0;
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem 0;
}

/* Home Screen */
.home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.home-header h1 {
    font-size: 1.25rem;
    color: var(--accent);
}

.home-content {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Repos List */
.repos-content {
    text-align: left;
}

.repos-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.repo-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

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

.repo-header h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.repo-branch {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.issues-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.issue-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background-color 0.2s;
}

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

.issue-id {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 3rem;
}

.issue-title {
    flex: 1;
    font-size: 0.95rem;
}

/* Status Badges */
.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.status-not_started {
    background: #374151;
    color: #9ca3af;
}

.status-starting {
    background: #854d0e;
    color: #fbbf24;
}

.status-running {
    background: #065f46;
    color: #34d399;
}

.status-awaiting_response {
    background: #3b1f7e;
    color: #c4b5fd;
}

.status-awaiting_review {
    background: #713f12;
    color: #fbbf24;
}

.status-committing {
    background: #1e3a5f;
    color: #60a5fa;
}

.status-completed {
    background: #14532d;
    color: #4ade80;
}

.status-failed {
    background: #7f1d1d;
    color: #fca5a5;
}

/* Issue Detail Page */
.issue-content {
    text-align: left;
}

.issue-header-block {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.issue-header-block h2 {
    font-size: 1.4rem;
    flex: 1;
}

.issue-description {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Issue Comments */
.issue-comment {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}

.comment-meta {
    margin-bottom: 0.35rem;
}

.comment-body {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

#issue-comments {
    margin-bottom: 1.5rem;
}

.issue-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.issue-actions .btn {
    width: auto;
}

.error-block {
    background: #7f1d1d;
    border: 1px solid var(--error);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    color: #fca5a5;
}

/* Terminal Output */
.terminal-output {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 1rem;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

.terminal-msg {
    padding: 0.5rem 0;
    border-bottom: 1px solid #1c2333;
}

.terminal-msg:last-child {
    border-bottom: none;
}

.msg-role {
    display: inline-block;
    font-weight: 700;
    min-width: 3rem;
    margin-right: 0.75rem;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.msg-content {
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-assistant .msg-role {
    color: #58a6ff;
}

.msg-user .msg-role {
    color: #3fb950;
}

.msg-tool .msg-role {
    color: #d2a8ff;
}

.msg-unknown .msg-role {
    color: #8b949e;
}

/* Tool call messages */
.msg-tool {
    background: #161b22;
    border-left: 3px solid #d2a8ff;
    padding-left: 0.75rem;
    margin: 0.25rem 0;
}

.tool-header {
    display: block;
    margin-bottom: 0.25rem;
}

.tool-header strong {
    color: #d2a8ff;
}

.tool-status-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-left: 0.5rem;
}

.tool-completed .tool-status-label { color: #3fb950; }
.tool-error .tool-status-label { color: #f85149; }
.tool-running .tool-status-label { color: #d29922; }

.tool-input {
    margin-top: 0.35rem;
    padding: 0.35rem 0.5rem;
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #c9d1d9;
}

.tool-input code {
    white-space: pre-wrap;
    word-break: break-all;
}

.tool-output {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 4px;
    padding: 0.5rem;
    margin-top: 0.35rem;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.8rem;
    color: #8b949e;
}

/* Subtask / agent messages */
.msg-subtask {
    border-left-color: #f0883e;
}

.msg-subtask .msg-role {
    color: #f0883e;
}

.msg-subtask .tool-header strong {
    color: #f0883e;
}

/* Patch / diff messages */
.msg-patch {
    background: #0d2818;
    border-left: 3px solid #3fb950;
    padding-left: 0.75rem;
    margin: 0.25rem 0;
}

.msg-patch .msg-role {
    color: #3fb950;
}

.patch-header {
    display: block;
    color: #3fb950;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.patch-files {
    margin-top: 0.25rem;
}

.patch-file {
    color: #8b949e;
    font-size: 0.8rem;
    padding: 0.1rem 0;
}

.patch-file::before {
    content: "\00b7 ";
    color: #3fb950;
}

/* Review Section */
.review-section {
    background: var(--bg-secondary);
    border: 1px solid #713f12;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.review-section h3 {
    color: #fbbf24;
    margin-bottom: 1rem;
}

.review-instructions {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.review-pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
}

.feedback-textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    margin-bottom: 0.75rem;
}

.feedback-textarea:focus {
    outline: none;
    border-color: #fbbf24;
}

.feedback-actions {
    display: flex;
    gap: 0.75rem;
}

/* Artifacts */
.artifacts-heading {
    color: #fbbf24;
    margin: 1rem 0 0.5rem;
    font-size: 0.95rem;
}

.artifacts-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.artifact-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 6px;
}

.artifact-link {
    color: #58a6ff;
    text-decoration: none;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
}

.artifact-link:hover {
    text-decoration: underline;
    color: #79c0ff;
}

.artifact-group-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.5rem;
    margin-bottom: 0.2rem;
}

.artifact-group-label:first-child {
    margin-top: 0;
}

.artifact-size {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-left: 1rem;
    white-space: nowrap;
}

.btn-amber {
    background: #854d0e;
    color: #fbbf24;
    border: 1px solid #713f12;
}

.btn-amber:hover {
    background: #713f12;
}

/* Header actions */
.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Admin Page */
.admin-title {
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.admin-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-card h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.admin-form-row {
    display: flex;
    gap: 1rem;
}

.admin-form-row .form-group {
    flex: 1;
}

.role-checkboxes {
    display: flex;
    gap: 1.25rem;
    padding: 0.5rem 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

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

.admin-table th {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-table td {
    color: var(--text-primary);
}

.action-cell {
    display: flex;
    gap: 0.5rem;
}

.role-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 0.25rem;
}

.role-admin {
    background: #7f1d1d;
    color: #fca5a5;
}

.role-developer {
    background: #065f46;
    color: #34d399;
}

.role-tester {
    background: #1e3a5f;
    color: #60a5fa;
}

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.modal h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* Answer Section (AWAITING_RESPONSE) */
.answer-section {
    background: var(--bg-secondary);
    border: 1px solid #3b1f7e;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.answer-section h3 {
    color: #c4b5fd;
    margin-bottom: 0.5rem;
}

.answer-section p {
    margin-bottom: 1rem;
}

/* Testing Page */
.testing-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.testing-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.testing-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.testing-card-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
}

.testing-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.testing-plan-container {
    padding-top: 0.5rem;
}

.test-environment {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.test-environment:last-child {
    margin-bottom: 0;
}

.test-env-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.loader-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.loader-fabric {
    background: #4a2a0a;
    color: #dbb586;
}

.loader-forge {
    background: #1a1a4a;
    color: #8888cc;
}

.loader-neoforge {
    background: #2a1a3a;
    color: #cc88cc;
}

.loader-quilt {
    background: #1a3a2a;
    color: #88ccaa;
}

.game-version {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.mode-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mode-singleplayer {
    background: #065f46;
    color: #34d399;
}

.mode-multiplayer {
    background: #854d0e;
    color: #fbbf24;
}

.mod-list {
    margin-bottom: 1rem;
}

.mod-list h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.5rem;
}

.mod-item {
    padding: 0.4rem 0.75rem;
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 6px;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.mod-link {
    color: #58a6ff;
    text-decoration: none;
}

.mod-link:hover {
    text-decoration: underline;
    color: #79c0ff;
}

.mod-build {
    color: #3fb950;
}

.mod-build:hover {
    color: #56d364;
}

.test-steps {
    margin-top: 0.5rem;
}

.test-steps h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.5rem;
}

.test-steps ol {
    padding-left: 1.5rem;
    color: var(--text-primary);
}

.test-steps li {
    padding: 0.25rem 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Test Scenarios */
.test-scenario {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-top: 1rem;
}

.test-scenario:first-child {
    margin-top: 0.75rem;
}

.test-scenario-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.test-scenario-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.instance-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.instance-singleplayer {
    background: #065f46;
    color: #34d399;
}

.instance-client {
    background: #1e3a5f;
    color: #60a5fa;
}

.instance-server {
    background: #854d0e;
    color: #fbbf24;
}

.step-instance-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-right: 0.4rem;
    vertical-align: baseline;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.step-instance-label-server {
    background: #854d0e;
    color: #fbbf24;
}

.step-instance-label-client {
    background: #1e3a5f;
    color: #60a5fa;
}

/* Responsive */
@media (max-width: 768px) {
    .login-container {
        margin: 1rem;
        padding: 1.5rem;
    }

    .home-content {
        padding: 0 1rem;
    }

    .issue-header-block {
        flex-direction: column;
    }
}
