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

:root {
    --bg: #0d1117;
    --surface: #161b22;
    --border: #30363d;
    --text: #c9d1d9;
    --text-dim: #8b949e;
    --accent: #58a6ff;
    --green: #3fb950;
    --red: #f85149;
    --yellow: #d29922;
    --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

body {
    font-family: var(--mono);
    font-size: 13px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    padding: 16px;
}

header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

header h1 { font-size: 16px; font-weight: 600; }

.status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}
.status.connected { background: var(--green); color: #000; }
.status.disconnected { background: var(--red); color: #000; }

header #api-key-status { margin-left: auto; }

.banner {
    background: var(--surface);
    border: 1px solid var(--red);
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--red);
}

h2 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

section { margin-bottom: 24px; }

.info-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
}

.btn-small {
    font-family: var(--mono);
    font-size: 11px;
    background: var(--surface);
    color: var(--accent);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 10px;
    cursor: pointer;
}
.btn-small:hover { border-color: var(--accent); }

.hidden { display: none !important; }

/* Queue list */
.queue-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 12px;
    margin-bottom: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.queue-item:hover { border-color: var(--accent); }
.queue-item .qi-id { color: var(--accent); }
.queue-item .qi-stats { color: var(--text-dim); font-size: 11px; }

/* Enqueue form */
#enqueue-form {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
#enqueue-form select, #enqueue-form input {
    font-family: var(--mono);
    font-size: 12px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 8px;
}

/* Entry list */
.entry {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 4px;
}
.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
.entry-cmd { font-weight: 600; }
.badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    text-transform: uppercase;
}
.badge.enqueued { background: var(--border); color: var(--text-dim); }
.badge.started { background: var(--yellow); color: #000; }
.badge.result { background: var(--green); color: #000; }
.badge.error { background: var(--red); color: #000; }

.entry-history {
    display: none;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-dim);
}
.entry.expanded .entry-history { display: block; }

.history-item { padding: 2px 0; }

/* Files */
.file-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px 12px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.file-item a { color: var(--accent); text-decoration: none; }
.file-item a.file-download:hover { text-decoration: underline; }
.file-actions { display: flex; align-items: center; gap: 6px; }
/* analyze link is an <a> styled as a button — keep it button-like */
a.btn-analyze { text-decoration: none; }
a.btn-analyze:hover { text-decoration: none; border-color: var(--accent); }

/* Exports */
.export-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 4px;
}
.export-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.export-hash { color: var(--accent); }
.export-meta { display: flex; align-items: center; gap: 8px; }
.export-attempts { color: var(--text-dim); font-size: 11px; }
.export-error { color: var(--red); font-size: 11px; margin-top: 4px; }
.export-time { color: var(--text-dim); font-size: 11px; margin-top: 2px; }
/* Action buttons mirror the file row (.file-actions) */
.export-actions { display: flex; align-items: center; gap: 6px; }

.badge.export-pending { background: var(--border); color: var(--text-dim); }
.badge.export-completed { background: var(--green); color: #000; }
.badge.export-failed { background: var(--red); color: #000; }
