/* GreenPower Cabinet Dashboard — Brand-Compliant */
/* Source: BrandBook 2026 v1.4 | Skill: brand/greenpower */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500&family=Space+Grotesk:wght@500;600&display=swap');

:root {
    /* GP Primary Palette */
    --bg: #0B2B21;              /* Deep Forest — ultra-dark background */
    --surface: #173F35;          /* Pine Teal — cards, header, panels */
    --surface-2: #1C4A3E;       /* Pine Teal lighter — hover states, inputs */
    --border: rgba(255, 255, 255, 0.10);  /* Dark section rule: 10% white */
    --border-strong: rgba(255, 255, 255, 0.18);

    /* GP Text */
    --text: #FFFFFF;             /* White on dark */
    --text-dim: #B5BFD5;        /* Powder Blue — muted */
    --text-secondary: #7C878E;  /* Slate Grey — captions */

    /* GP Accent */
    --accent: #00AD50;           /* Medium Jungle — CTAs, highlights */
    --accent-dim: #008C40;       /* Darker green for hover/pressed */
    --accent-glow: rgba(0, 173, 80, 0.25);

    /* GP Status */
    --green: #7EC845;            /* Fresh Lime — success alt */
    --red: #EF4444;              /* Danger */
    --orange: #D4A03C;           /* Warm Amber — warning */

    /* GP Brand */
    --brand: #00AD50;            /* Medium Jungle for primary actions */
    --brand-dark: #173F35;       /* Pine Teal for brand identity */

    /* Spacing */
    --radius: 8px;
    --radius-lg: 12px;

    /* Typography */
    --font-heading: 'Gilroy', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-data: 'Space Grotesk', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ═══════════════════════════════════ */
/* HEADER                              */
/* ═══════════════════════════════════ */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.header-left {
    display: flex; align-items: center; gap: 12px;
}
.header-logo {
    width: 36px; height: 36px; border-radius: 6px;
    object-fit: contain; flex-shrink: 0;
}
.header-left h1 {
    font-family: var(--font-heading);
    font-size: 18px; font-weight: 700; letter-spacing: -0.5px;
    color: var(--text);
}
.header-left .subtitle {
    font-family: var(--font-data);
    font-size: 12px; color: var(--accent);
    text-transform: uppercase; letter-spacing: 0.06em;
    margin-left: 4px;
}
.header-right { display: flex; align-items: center; gap: 12px; }

/* Language Switcher */
.lang-switcher {
    display: flex; gap: 2px;
    background: var(--surface-2); border-radius: 6px;
    padding: 2px; border: 1px solid var(--border);
}
.lang-btn {
    padding: 3px 8px; border: none; border-radius: 4px;
    background: transparent; color: var(--text-dim);
    font-family: var(--font-data); font-size: 11px; font-weight: 600;
    cursor: pointer; transition: all 0.15s ease;
    letter-spacing: 0.02em;
}
.lang-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.lang-btn.active {
    background: var(--accent); color: #fff;
    box-shadow: 0 1px 4px rgba(0, 173, 80, 0.3);
}

/* ═══ Monitor Mode ═══ */
.monitor-panel { min-height: 400px; }
.monitor-body { padding: 16px; }
.monitor-loading { text-align: center; color: var(--text-dim); padding: 40px 0; font-style: italic; }
.monitor-error { text-align: center; color: var(--red); padding: 24px 0; }
.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.monitor-card {
    background: var(--surface-2);
    border-radius: 10px;
    padding: 16px;
    border: 1px solid var(--border);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.monitor-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.monitor-card-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 12px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.monitor-card-icon { font-size: 20px; }
.monitor-card-name {
    font-family: var(--font-head);
    font-size: 15px; font-weight: 600; color: var(--text);
}
.monitor-stats {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 8px; margin-bottom: 12px;
}
.monitor-stat { text-align: center; padding: 8px 0; }
.monitor-stat-value {
    display: block;
    font-family: var(--font-data);
    font-size: 24px; font-weight: 600; color: var(--accent);
    line-height: 1.2;
}
.monitor-stat-label {
    font-size: 11px; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.05em;
}
.monitor-details { border-top: 1px solid var(--border); padding-top: 8px; }
.monitor-detail-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 0; font-size: 12px; color: var(--text-dim);
}
.monitor-detail-val { color: var(--text); font-weight: 500; font-family: var(--font-data); }
.monitor-time { font-size: 11px; }
.mode-banner-monitor { background: linear-gradient(90deg, rgba(139,92,246,0.15), rgba(212,160,60,0.1)); border-color: rgba(139,92,246,0.3); }

.status-badge {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px;
    font-family: var(--font-data);
    font-size: 12px; font-weight: 500;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-badge.online .status-dot {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
}
.status-badge.offline .status-dot { background: var(--red); }

/* ═══════════════════════════════════ */
/* MAIN LAYOUT                         */
/* ═══════════════════════════════════ */

main { padding: 20px 24px; height: calc(100vh - 100px); overflow: hidden; }
.main-row {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 16px;
    height: 100%;
}

/* ═══════════════════════════════════ */
/* CARDS                               */
/* ═══════════════════════════════════ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 {
    font-family: var(--font-data);
    font-size: 13px; font-weight: 600; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 0.5px;
}
.card-body { padding: 16px; }

/* ═══════════════════════════════════ */
/* CHAT                                */
/* ═══════════════════════════════════ */

.chat-card { display: flex; flex-direction: column; }
.chat-messages {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
}

.msg {
    max-width: 85%; padding: 10px 14px; border-radius: var(--radius);
    font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.msg.user {
    align-self: flex-end;
    background: var(--accent-dim);
    color: #fff;
}
.msg.agent {
    align-self: flex-start;
    background: var(--surface-2);
}
.msg.system {
    align-self: center; color: var(--text-dim);
    font-size: 12px; font-style: italic;
}
.msg.streaming {
    border-left: 2px solid var(--accent);
}

.chat-input-row {
    display: flex; gap: 8px; padding: 12px 16px;
    border-top: 1px solid var(--border); align-items: flex-end;
}
#chat-input {
    flex: 1; background: var(--surface-2);
    border: 1px solid var(--border); color: var(--text);
    border-radius: 6px; padding: 10px 14px;
    font-family: var(--font-body); font-size: 14px; resize: none;
}
#chat-input:focus { outline: none; border-color: var(--accent); }
#chat-input::placeholder { color: var(--text-secondary); }

.btn-send {
    padding: 10px 24px; background: var(--brand); color: #fff; border: none;
    border-radius: 6px; font-family: var(--font-data); font-weight: 600;
    cursor: pointer; font-size: 14px;
    transition: background 0.2s ease;
}
.btn-send:hover { background: var(--accent-dim); }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-small {
    font-family: var(--font-data);
    font-size: 11px; padding: 2px 8px; background: transparent;
    color: var(--text-dim); border: 1px solid var(--border);
    border-radius: 4px; cursor: pointer;
}
.btn-small:hover { color: var(--text); border-color: var(--text-dim); }

/* Attach button */
.btn-attach {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 6px;
    color: var(--text-dim); cursor: pointer; flex-shrink: 0;
}
.btn-attach:hover { color: var(--text); border-color: var(--accent); }

/* Mic button */
.btn-mic {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 6px;
    color: var(--text-dim); cursor: pointer; flex-shrink: 0;
}
.btn-mic:hover { color: var(--text); border-color: var(--accent); }
.btn-mic.recording {
    color: var(--red); border-color: var(--red);
    animation: mic-pulse 1.5s infinite;
}
.btn-mic.unsupported { opacity: 0.3; cursor: not-allowed; }
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* Attachment preview */
.attachment-preview {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 8px 16px 0;
}
.attachment-card {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 12px; color: var(--text);
}
.attachment-card .file-icon { font-size: 16px; }
.attachment-card .file-name {
    max-width: 160px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.attachment-card .file-size { color: var(--text-dim); font-size: 10px; }
.attachment-card .remove-btn {
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 14px; padding: 0 2px; line-height: 1;
}
.attachment-card .remove-btn:hover { color: var(--red); }

/* ═══════════════════════════════════ */
/* TOOL CALL MESSAGES                  */
/* ═══════════════════════════════════ */

.msg.tool-call {
    align-self: flex-start;
    background: rgba(0, 173, 80, 0.08);
    border: 1px solid rgba(0, 173, 80, 0.15);
    border-left: 3px solid var(--accent);
    padding: 8px 12px; font-size: 12px;
    display: flex; align-items: center; gap: 8px; max-width: 90%;
}
.msg.tool-call.tool-ok { border-left-color: var(--green); }
.msg.tool-call.tool-err { border-left-color: var(--red); }

.tool-icon { font-size: 16px; flex-shrink: 0; }
.tool-name {
    font-family: var(--font-data);
    color: var(--accent); font-weight: 600; white-space: nowrap;
}
.tool-args {
    color: var(--text-dim); font-size: 11px; margin-left: 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px;
}
.tool-args::before { content: '('; }
.tool-args::after { content: ')'; }

.tool-spinner {
    width: 12px; height: 12px; border: 2px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: tool-spin 0.8s linear infinite; flex-shrink: 0;
}
@keyframes tool-spin { to { transform: rotate(360deg); } }

.tool-badge {
    font-family: var(--font-data);
    font-size: 10px; padding: 1px 8px; border-radius: 3px;
    font-weight: 600; white-space: nowrap; margin-left: auto;
}
.tool-badge.ok { background: rgba(126, 200, 69, 0.15); color: var(--green); }
.tool-badge.err { background: rgba(239, 68, 68, 0.15); color: var(--red); }

/* ═══════════════════════════════════ */
/* THINKING INDICATOR                  */
/* ═══════════════════════════════════ */

.msg.thinking {
    align-self: flex-start; background: var(--surface-2);
    border-left: 2px solid var(--accent);
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; border-radius: var(--radius);
}
.thinking-dots { display: flex; gap: 4px; }
.thinking-dots span {
    width: 6px; height: 6px; background: var(--accent);
    border-radius: 50%; animation: thinking-bounce 1.4s infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking-bounce {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}
.thinking-label { font-size: 12px; color: var(--text-dim); font-style: italic; }

/* ═══════════════════════════════════ */
/* SIDEBAR                             */
/* ═══════════════════════════════════ */

.sidebar { display: flex; flex-direction: column; gap: 16px; }

.sources-card { flex: 1; display: flex; flex-direction: column; }
.sources-list { flex: 1; overflow-y: auto; padding: 8px; }
.source-count {
    font-family: var(--font-data);
    font-size: 11px; color: var(--text-dim);
}

.source-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px; border-radius: 4px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.source-item:hover { background: var(--surface-2); }
.source-icon { font-size: 16px; flex-shrink: 0; }
.source-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-chunks {
    font-family: var(--font-data);
    color: var(--text-dim); font-size: 10px;
}

.empty-state {
    color: var(--text-dim); font-size: 13px; text-align: center; padding: 24px;
}

/* KB Toolbar */
.kb-toolbar { display: flex; align-items: center; gap: 8px; }

/* Category tree */
.cat-folder { margin: 0; }
.cat-folder > .cat-children { padding-left: 16px; }
.cat-summary {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 8px; border-radius: 4px;
    font-size: 12px; cursor: pointer;
    list-style: none; user-select: none;
}
.cat-summary::-webkit-details-marker { display: none; }
.cat-summary::before {
    content: '\25B6'; font-size: 8px; color: var(--text-dim);
    transition: transform 0.15s; flex-shrink: 0;
}
details[open] > .cat-summary::before { transform: rotate(90deg); }
.cat-summary:hover { background: var(--surface-2); }
.cat-icon { font-size: 13px; flex-shrink: 0; }
.cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.cat-count {
    font-family: var(--font-data);
    font-size: 9px; color: var(--text-dim);
    background: var(--surface-2); padding: 1px 6px; border-radius: 8px;
}

/* Tag chips */
.tag-chip {
    font-family: var(--font-data);
    font-size: 9px; padding: 1px 5px; border-radius: 3px;
    background: color-mix(in srgb, var(--tag-color, var(--accent)) 20%, transparent);
    color: var(--tag-color, var(--accent));
    white-space: nowrap; flex-shrink: 0;
}

/* ═══════════════════════════════════ */
/* UPLOAD                              */
/* ═══════════════════════════════════ */

.upload-card .card-body { padding: 12px 16px; }
.upload-select {
    width: 100%; padding: 6px 10px; margin-bottom: 8px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); border-radius: 4px; font-size: 12px;
    font-family: var(--font-body);
}
.upload-select:focus { outline: none; border-color: var(--accent); }
.upload-status { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.progress-bar {
    height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden;
}
.progress-fill {
    height: 100%; background: var(--accent); border-radius: 2px;
    width: 0%; transition: width 0.3s ease;
}

/* ═══════════════════════════════════ */
/* SCROLLBAR                           */
/* ═══════════════════════════════════ */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ═══════════════════════════════════ */
/* USER BADGE & AUTH                   */
/* ═══════════════════════════════════ */

.user-badge {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 10px; border-radius: 20px;
    background: var(--surface-2); border: 1px solid var(--border);
    font-size: 12px;
}
.user-avatar {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700; font-size: 11px; flex-shrink: 0;
}
.user-name {
    max-width: 120px; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; color: var(--text);
}
.user-logout {
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px;
}
.user-logout:hover { color: var(--red); }

.btn-login {
    background: var(--accent) !important; color: #fff !important;
    border-color: var(--accent) !important; padding: 4px 14px !important;
    font-family: var(--font-data);
    font-weight: 600;
}
.btn-login:hover { background: var(--accent-dim) !important; }

/* ═══════════════════════════════════ */
/* AUTH MODAL                          */
/* ═══════════════════════════════════ */

.auth-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(11, 43, 33, 0.85);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    animation: auth-fade-in 0.2s ease;
}
.auth-overlay.auth-fade-out { animation: auth-fade-out 0.3s ease forwards; }
@keyframes auth-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes auth-fade-out { from { opacity: 1; } to { opacity: 0; } }

.auth-modal {
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg); padding: 32px; width: 380px; max-width: 90vw;
    position: relative;
}
.auth-title {
    font-family: var(--font-heading);
    font-size: 20px; font-weight: 700; color: var(--text);
    margin-bottom: 6px; text-align: center;
}
.auth-subtitle {
    font-size: 13px; color: var(--text-dim); text-align: center;
    margin-bottom: 24px;
}
.auth-step { display: flex; flex-direction: column; gap: 12px; }
.auth-input {
    width: 100%; padding: 10px 14px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 6px;
    color: var(--text); font-family: var(--font-body); font-size: 14px;
}
.auth-input:focus { outline: none; border-color: var(--accent); }
.auth-btn {
    padding: 10px 20px; border-radius: 6px; border: none;
    font-family: var(--font-data); font-size: 14px; font-weight: 600; cursor: pointer;
}
.auth-btn-primary { background: var(--accent); color: #fff; }
.auth-btn-primary:hover { background: var(--accent-dim); }
.auth-btn-ghost {
    background: transparent; color: var(--text-dim);
    border: 1px solid var(--border);
}
.auth-btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }
.auth-btn-link {
    background: none; color: var(--text-dim); padding: 4px;
    font-size: 12px;
}
.auth-btn-link:hover { color: var(--text); }
.auth-error { color: var(--red); font-size: 12px; min-height: 16px; }
.auth-hint { font-size: 13px; color: var(--text-dim); }
.auth-hint strong { color: var(--text); }
.auth-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 20px 0; color: var(--text-dim); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-success-icon {
    width: 48px; height: 48px; border-radius: 50%;
    background: rgba(0, 173, 80, 0.15); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 700; margin: 0 auto 12px;
}
.auth-success-text { text-align: center; color: var(--accent); font-weight: 600; }
.auth-loading {
    position: absolute; inset: 0; background: rgba(11, 43, 33, 0.85);
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-lg);
}
.auth-spinner {
    width: 28px; height: 28px; border: 3px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: tool-spin 0.8s linear infinite;
}

/* ═══════════════════════════════════ */
/* MODE SWITCHER                       */
/* ═══════════════════════════════════ */

.mode-switcher {
    display: flex; gap: 2px;
    background: var(--surface-2); border-radius: 8px;
    padding: 3px; border: 1px solid var(--border);
}

.mode-pill {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; border: none; border-radius: 6px;
    background: transparent; color: var(--text-dim);
    font-family: var(--font-data); font-size: 12px; font-weight: 600;
    cursor: pointer; transition: all 0.2s ease;
    white-space: nowrap;
}
.mode-pill:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.mode-pill.active {
    background: var(--accent); color: #fff;
    box-shadow: 0 2px 8px rgba(0, 173, 80, 0.3);
}
.mode-pill svg { flex-shrink: 0; }

/* Mode Banner */
.mode-banner {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 24px;
    font-family: var(--font-data); font-size: 12px; font-weight: 500;
    border-bottom: 1px solid var(--border);
    transition: all 0.2s ease;
}
.mode-banner-upload { background: rgba(0, 173, 80, 0.08); color: var(--accent); }
.mode-banner-test { background: rgba(212, 160, 60, 0.08); color: var(--orange); }
.mode-banner-chat { background: rgba(255, 255, 255, 0.03); color: var(--text-dim); }

/* ═══════════════════════════════════ */
/* UPLOAD MODE                         */
/* ═══════════════════════════════════ */

.mode-panel { display: flex; flex-direction: column; }

.upload-mode-badge {
    font-family: var(--font-data); font-size: 10px; font-weight: 700;
    padding: 2px 8px; border-radius: 4px;
    background: rgba(212, 160, 60, 0.15); color: var(--orange);
    letter-spacing: 0.05em;
}

.upload-panel-body {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 16px;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--border-strong); border-radius: var(--radius);
    padding: 32px; text-align: center;
    transition: all 0.2s ease; cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(0, 173, 80, 0.04);
}
.drop-zone-content { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.drop-zone-text { font-size: 14px; color: var(--text-dim); }
.drop-zone-browse {
    background: none; border: none; color: var(--accent);
    font-weight: 600; cursor: pointer; text-decoration: underline;
    font-size: 14px; font-family: var(--font-body);
}
.drop-zone-hint { font-size: 11px; color: var(--text-secondary); }

/* Voice/text row */
.upload-voice-row {
    display: flex; align-items: center; gap: 12px; justify-content: center;
}
.btn-voice-upload, .btn-text-upload {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 6px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-dim); font-family: var(--font-data);
    font-size: 12px; font-weight: 500; cursor: pointer;
}
.btn-voice-upload:hover, .btn-text-upload:hover { color: var(--text); border-color: var(--accent); }
.upload-or { font-size: 11px; color: var(--text-secondary); }

.upload-text-area {
    width: 100%; background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); border-radius: 6px; padding: 10px 14px;
    font-family: var(--font-body); font-size: 14px; resize: vertical;
}
.upload-text-area:focus { outline: none; border-color: var(--accent); }

/* Metadata */
.upload-metadata { display: flex; flex-direction: column; gap: 10px; }
.meta-field { display: flex; flex-direction: column; gap: 4px; }
.meta-field label {
    font-family: var(--font-data); font-size: 11px; font-weight: 600;
    color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em;
}
.meta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meta-select, .meta-input {
    padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); border-radius: 6px; font-family: var(--font-body); font-size: 13px;
}
.meta-select:focus, .meta-input:focus { outline: none; border-color: var(--accent); }

/* Files list */
.upload-file-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; background: var(--surface-2); border-radius: 6px;
    margin-bottom: 4px; font-size: 12px;
}
.upload-file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-file-item .file-size { color: var(--text-dim); font-family: var(--font-data); font-size: 10px; }
.upload-file-item .file-remove {
    background: none; border: none; color: var(--text-dim); cursor: pointer;
    font-size: 16px; padding: 0 4px; line-height: 1;
}
.upload-file-item .file-remove:hover { color: var(--red); }

/* Upload button */
.btn-upload-start {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; border-radius: 8px; border: none;
    background: var(--accent); color: #fff;
    font-family: var(--font-data); font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background 0.2s ease;
}
.btn-upload-start:hover { background: var(--accent-dim); }
.btn-upload-start:disabled { opacity: 0.4; cursor: not-allowed; }

/* Pipeline steps */
.upload-pipeline {
    display: flex; gap: 4px; padding: 12px; background: var(--surface-2);
    border-radius: var(--radius); border: 1px solid var(--border);
}
.pipeline-step {
    flex: 1; display: flex; align-items: center; gap: 6px;
    padding: 6px 8px; border-radius: 4px;
    font-family: var(--font-data); font-size: 11px; color: var(--text-dim);
}
.pipeline-step.active { color: var(--accent); background: rgba(0,173,80,0.08); }
.pipeline-step.done { color: var(--green); }
.pipeline-step.error { color: var(--red); }
.step-indicator {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-secondary); flex-shrink: 0;
}
.pipeline-step.active .step-indicator { background: var(--accent); animation: mic-pulse 1.5s infinite; }
.pipeline-step.done .step-indicator { background: var(--green); }
.pipeline-step.error .step-indicator { background: var(--red); }

/* Verify result */
.verify-result {
    padding: 16px; border-radius: var(--radius);
    border: 1px solid var(--border);
}
.verify-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.verify-badge {
    font-family: var(--font-data); font-size: 11px; font-weight: 700;
    padding: 3px 10px; border-radius: 4px; letter-spacing: 0.04em;
}
.verify-badge.verify-pass, .verify-badge.pass { background: rgba(126,200,69,0.15); color: var(--green); }
.verify-badge.verify-warn, .verify-badge.warn { background: rgba(212,160,60,0.15); color: var(--orange); }
.verify-badge.verify-fail, .verify-badge.fail { background: rgba(239,68,68,0.15); color: var(--red); }
.verify-score { font-family: var(--font-data); font-size: 13px; color: var(--text-dim); }
.verify-details { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

/* Verify score bars */
.verify-scores { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.score-row { display: flex; align-items: center; gap: 8px; }
.score-label {
    font-family: var(--font-data); font-size: 11px; font-weight: 600;
    color: var(--text-dim); width: 70px; flex-shrink: 0;
}
.score-bar {
    flex: 1; height: 6px; border-radius: 3px;
    background: rgba(255,255,255,0.08); overflow: hidden;
}
.score-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.score-fill.score-good { background: var(--green); }
.score-fill.score-warn { background: var(--orange); }
.score-fill.score-bad { background: var(--red); }
.score-value {
    font-family: var(--font-data); font-size: 11px;
    color: var(--text-dim); width: 36px; text-align: right; flex-shrink: 0;
}
.verify-summary { margin-top: 8px; font-style: italic; color: var(--text-dim); }
.verify-issues { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.verify-issue { padding: 4px 8px; border-radius: 4px; background: rgba(255,255,255,0.04); font-size: 12px; }

/* ═══════════════════════════════════ */
/* TEST MODE                           */
/* ═══════════════════════════════════ */

.test-panel-body {
    flex: 1; display: flex; flex-direction: column;
    overflow: hidden;
}

.test-file-select {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.test-file-select label {
    font-family: var(--font-data); font-size: 11px; font-weight: 600;
    color: var(--text-dim); text-transform: uppercase; white-space: nowrap;
}

.test-session-summary {
    display: flex; gap: 8px; align-items: center;
}
.test-stat {
    font-family: var(--font-data); font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 4px;
    background: var(--surface-2); color: var(--text-dim);
}
.test-stat.test-ok { background: rgba(126,200,69,0.12); color: var(--green); }
.test-stat.test-fix { background: rgba(212,160,60,0.12); color: var(--orange); }

.test-qa-area {
    flex: 1; overflow-y: auto; padding: 12px 16px;
    display: flex; flex-direction: column; gap: 8px;
}

.test-messages { display: flex; flex-direction: column; gap: 8px; flex: 1; overflow-y: auto; }
.test-q-bubble {
    align-self: flex-end; max-width: 85%;
    padding: 8px 12px; border-radius: var(--radius);
    background: var(--accent-dim); color: #fff; font-size: 13px;
}
.test-verdict-bubble {
    align-self: center; padding: 4px 12px; border-radius: 12px;
    font-family: var(--font-data); font-size: 11px; font-weight: 600;
}
.test-verdict-bubble.verdict-ok { background: rgba(126,200,69,0.12); color: var(--green); }
.test-verdict-bubble.verdict-fix { background: rgba(212,160,60,0.12); color: var(--orange); }

/* Answer card */
.test-answer-card {
    padding: 12px; border-radius: var(--radius);
    background: var(--surface-2); border: 1px solid var(--border);
}
.test-answer-label {
    font-family: var(--font-data); font-size: 10px; font-weight: 600;
    text-transform: uppercase; color: var(--text-dim); margin-bottom: 6px;
}
.test-answer-text { font-size: 13px; line-height: 1.6; color: var(--text); margin-bottom: 10px; }
.test-verdict-row { display: flex; gap: 8px; }
.btn-verdict {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 6px; border: 1px solid var(--border);
    background: transparent; font-family: var(--font-data);
    font-size: 12px; font-weight: 600; cursor: pointer;
}
.btn-verdict-ok { color: var(--green); }
.btn-verdict-ok:hover { background: rgba(126,200,69,0.1); border-color: var(--green); }
.btn-verdict-fix { color: var(--orange); }
.btn-verdict-fix:hover { background: rgba(212,160,60,0.1); border-color: var(--orange); }

/* Correction */
.test-correction {
    padding: 12px; border-radius: var(--radius);
    background: var(--surface-2); border: 1px solid var(--orange);
}
.test-correction label {
    font-family: var(--font-data); font-size: 11px; font-weight: 600;
    color: var(--orange); text-transform: uppercase; display: block; margin-bottom: 6px;
}
.correction-textarea {
    width: 100%; background: var(--bg); border: 1px solid var(--border);
    color: var(--text); border-radius: 6px; padding: 8px 12px;
    font-family: var(--font-body); font-size: 13px; resize: vertical;
    margin-bottom: 8px;
}
.correction-textarea:focus { outline: none; border-color: var(--orange); }
.correction-actions { display: flex; gap: 8px; }
.btn-correction-apply {
    padding: 6px 14px; border-radius: 6px; border: none;
    background: var(--orange); color: var(--bg);
    font-family: var(--font-data); font-size: 12px; font-weight: 600; cursor: pointer;
}
.btn-correction-apply:hover { opacity: 0.9; }
.btn-correction-cancel {
    padding: 6px 14px; border-radius: 6px; border: 1px solid var(--border);
    background: transparent; color: var(--text-dim);
    font-family: var(--font-data); font-size: 12px; cursor: pointer;
}

/* Approve bar */
.test-approve-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; gap: 12px;
    background: rgba(126, 200, 69, 0.06);
    border-top: 1px solid rgba(126, 200, 69, 0.2);
    animation: msg-fade 0.3s ease;
}
.approve-label {
    font-family: var(--font-data); font-size: 12px; font-weight: 600;
    color: var(--green);
}
.btn-approve {
    padding: 8px 18px; border-radius: 6px; border: none;
    background: var(--green); color: var(--bg);
    font-family: var(--font-data); font-size: 12px; font-weight: 700;
    cursor: pointer; white-space: nowrap; transition: all 0.2s;
}
.btn-approve:hover { opacity: 0.9; transform: scale(1.02); }
.btn-approve:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Test input */
.test-input-row {
    display: flex; gap: 8px; padding: 12px 16px;
    border-top: 1px solid var(--border); align-items: flex-end;
}
#test-input {
    flex: 1; background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); border-radius: 6px; padding: 10px 14px;
    font-family: var(--font-body); font-size: 14px; resize: none;
}
#test-input:focus { outline: none; border-color: var(--orange); }

/* ═══════════════════════════════════ */
/* ASSISTANT WIDGET                    */
/* ═══════════════════════════════════ */

.assistant-widget {
    position: fixed; bottom: 24px; right: 24px;
    z-index: 9999; font-family: var(--font-body);
}

/* FAB Button */
.assistant-fab {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--accent); color: #fff;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(0,173,80,0.4), 0 0 0 0 rgba(0,173,80,0.3);
    transition: all 0.3s ease;
    position: relative;
    animation: fab-pulse 3s ease-in-out infinite;
}
@keyframes fab-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(0,173,80,0.4), 0 0 0 0 rgba(0,173,80,0.3); }
    50% { box-shadow: 0 4px 20px rgba(0,173,80,0.4), 0 0 0 8px rgba(0,173,80,0); }
}
.assistant-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0,173,80,0.5);
    animation: none;
}
.fab-badge {
    position: absolute; top: -2px; right: -2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--orange); color: var(--bg);
    font-family: var(--font-data); font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

/* Panel */
.assistant-panel {
    position: absolute; bottom: 68px; right: 0;
    width: 380px; max-height: 520px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,173,80,0.08);
    display: flex; flex-direction: column;
    overflow: hidden;
    animation: panel-slide-up 0.25s ease-out;
}
@keyframes panel-slide-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.assistant-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--surface) 0%, rgba(0,173,80,0.06) 100%);
}
.assistant-header-left { display: flex; align-items: center; gap: 10px; }
.assistant-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(0,173,80,0.15); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
}
.assistant-name {
    font-family: var(--font-heading); font-size: 14px;
    font-weight: 600; color: var(--text);
}
.assistant-model {
    font-family: var(--font-data); font-size: 10px;
    color: var(--accent); letter-spacing: 0.02em;
}
.assistant-minimize {
    width: 28px; height: 28px; border-radius: 6px;
    border: none; background: transparent; color: var(--text-dim);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.assistant-minimize:hover { background: var(--surface-2); color: var(--text); }

/* Messages */
.assistant-messages {
    flex: 1; overflow-y: auto; padding: 12px 14px;
    display: flex; flex-direction: column; gap: 10px;
    min-height: 180px; max-height: 340px;
}
.assistant-msg { display: flex; gap: 8px; animation: msg-fade 0.2s ease; }
@keyframes msg-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.assistant-msg-user { justify-content: flex-end; }
.assistant-msg-user .msg-content {
    background: var(--accent-dim); color: #fff;
    padding: 8px 12px; border-radius: 12px 12px 2px 12px;
    font-size: 13px; line-height: 1.5; max-width: 85%;
}
.assistant-msg-assistant { justify-content: flex-start; }
.assistant-msg-assistant .msg-content {
    background: var(--surface-2); color: var(--text);
    padding: 10px 14px; border-radius: 2px 12px 12px 12px;
    font-size: 13px; line-height: 1.6; max-width: 90%;
}
.assistant-msg-assistant .msg-content strong { color: var(--accent); font-weight: 600; }
.msg-avatar-small {
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(0,173,80,0.12); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 2px;
}

/* Thinking */
.assistant-thinking {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; color: var(--text-dim); font-size: 12px;
}
.assistant-thinking .thinking-label { font-family: var(--font-data); font-style: italic; }

/* Input */
.assistant-input-row {
    display: flex; gap: 8px; padding: 10px 14px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.12);
}
#assistant-input {
    flex: 1; background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); border-radius: 10px; padding: 8px 12px;
    font-family: var(--font-body); font-size: 13px;
    resize: none; min-height: 18px; max-height: 80px;
    line-height: 1.4;
}
#assistant-input:focus { outline: none; border-color: var(--accent); }
#assistant-input::placeholder { color: var(--text-secondary); }
.assistant-send {
    width: 36px; height: 36px; border-radius: 10px;
    border: none; background: var(--accent); color: #fff;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.2s;
}
.assistant-send:hover { background: var(--accent-dim); transform: scale(1.05); }

/* ═══════════════════════════════════ */
/* RESPONSIVE                          */
/* ═══════════════════════════════════ */

@media (max-width: 768px) {
    .main-row { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .auth-modal { padding: 24px 20px; }
    .user-name { display: none; }
    .mode-switcher { gap: 1px; }
    .mode-pill { padding: 6px 10px; font-size: 11px; }
    .mode-pill span { display: none; }
    .meta-row { grid-template-columns: 1fr; }
    .assistant-panel { width: calc(100vw - 32px); right: -8px; max-height: 70vh; }
    .assistant-widget { bottom: 16px; right: 16px; }
}
