/* AI Analysis Workbench — simple, functional styling */

:root {
    --navy: #1e2761;
    --navy-light: #2e3a82;
    --ice: #cadcfc;
    --bg: #f4f5f7;
    --panel-bg: #ffffff;
    --border: #d8dce3;
    --text: #212121;
    --muted: #5a5a5a;
    --ok: #1f7a3d;
    --warn: #946c00;
    --error: #b3261e;
    --radius: 6px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.45;
}

.topbar {
    background: var(--navy);
    color: #fff;
    padding: 14px 0;
}

.topbar-inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.brand {
    font-size: 20px;
    font-weight: 700;
}

.brand-sub {
    font-size: 13px;
    color: var(--ice);
}

.page {
    max-width: 1300px;
    margin: 24px auto;
    padding: 0 20px;
}

.grid {
    display: grid;
    grid-template-columns: 320px 1fr 380px;
    gap: 18px;
    align-items: start;
}

@media (max-width: 1100px) {
    .grid {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.panel h2 {
    margin-top: 0;
    font-size: 17px;
    color: var(--navy);
}

.panel h3 {
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.hint {
    font-size: 13px;
    color: var(--muted);
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 18px 0;
}

/* ---------- Buttons & forms ---------- */

.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--navy);
    color: #fff;
}

.btn-primary:hover {
    background: var(--navy-light);
}

.btn-secondary {
    background: #fff;
    color: var(--navy);
    border: 1px solid var(--navy);
}

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

.btn-danger {
    background: #fff;
    color: var(--error);
    border: 1px solid var(--error);
}

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

#upload-form, #clear-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#file-input {
    font-size: 13px;
}

.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-status {
    min-height: 18px;
    font-size: 13px;
    color: var(--muted);
    margin-top: 6px;
}

/* ---------- File list ---------- */

.file-list {
    list-style: none;
    padding: 0;
    margin: 0 0 8px 0;
    max-height: 220px;
    overflow-y: auto;
}

.file-item, .file-item-empty {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 6px;
    font-size: 13px;
}

.file-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-name {
    font-weight: 600;
}

.file-meta {
    color: var(--muted);
    text-transform: capitalize;
}

.file-ok .file-meta { color: var(--ok); }
.file-warning .file-meta { color: var(--warn); }
.file-error .file-meta,
.file-rejected .file-meta { color: var(--error); }

.file-item-empty {
    color: var(--muted);
    border-style: dashed;
}

/* ---------- Chat panel ---------- */

.panel-chat {
    display: flex;
    flex-direction: column;
    min-height: 560px;
}

.model-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

.model-row select {
    flex: 1;
    padding: 6px 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.chat-window {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    background: #fafbfc;
    margin-bottom: 12px;
    min-height: 360px;
}

.chat-empty {
    color: var(--muted);
    font-size: 13px;
}

.chat-msg {
    margin-bottom: 12px;
    padding: 8px 10px;
    border-radius: var(--radius);
}

.chat-msg p {
    margin: 4px 0 0 0;
    white-space: pre-wrap;
}

.chat-role {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
}

.chat-msg-user {
    background: #eef1fb;
}

.chat-msg-assistant {
    background: #f1f8f1;
}

.chat-form {
    display: flex;
    gap: 8px;
}

.chat-form textarea {
    flex: 1;
    resize: vertical;
    padding: 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 14px;
}

/* ---------- IO panel ---------- */

.panel-io {
    padding: 0;
    overflow: hidden;
}

.io-toggle {
    width: 100%;
    text-align: left;
    background: var(--navy);
    color: #fff;
    border: none;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chevron {
    font-size: 12px;
}

.io-panel-container {
    padding: 14px 18px;
    max-height: 640px;
    overflow-y: auto;
}

.io-panel-container.collapsed {
    display: none;
}

.io-empty {
    color: var(--muted);
    font-size: 13px;
}

.io-entry {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    padding: 10px;
    font-size: 13px;
}

.io-entry-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.io-model {
    font-weight: 700;
    color: var(--navy);
}

.io-block summary {
    cursor: pointer;
    font-weight: 600;
    padding: 4px 0;
}

.io-block pre {
    white-space: pre-wrap;
    word-break: break-word;
    background: #fafbfc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    max-height: 260px;
    overflow-y: auto;
    font-size: 12px;
}

/* ---------- Footer ---------- */

.footer {
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    padding: 20px;
}
