/* ===== CSS Custom Properties — Estilo NotebookLM Dark ===== */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1b1b1b;
    --bg-surface: #252525;
    --bg-surface-hover: #2f2f2f;
    --bg-surface-active: #383838;
    --bg-input: #1a1a1a;
    --bg-card: #28292a;
    --bg-card-hover: #33342f;

    --text-primary: #e3e3e3;
    --text-secondary: #a8a8a8;
    --text-muted: #6e6e6e;
    --text-on-accent: #1b1b1b;

    --accent: #a8c7fa;
    --accent-hover: #c2d7fc;
    --accent-subtle: rgba(168, 199, 250, 0.08);
    --accent-muted: rgba(168, 199, 250, 0.15);
    --accent-purple: #d3b8ff;

    --border: #2e2e2e;
    --border-light: #3a3a3a;
    --success: #81c995;
    --warning: #fdd663;
    --error: #f28b82;

    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 100px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

    --font-sans: 'Google Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    --navbar-h: 56px;
    --panel-sources-w: 380px;
    --panel-skills-w: 340px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Navbar (top bar) ===== */
.navbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    height: var(--navbar-h);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-logo {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}
.navbar-logo svg { width: 28px; height: 28px; color: var(--accent); }
.navbar-title {
    flex: 1;
    min-width: 0;
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.navbar-user {
    font-size: 0.8rem;
    color: var(--text-secondary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.navbar-cond {
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.navbar-cond:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    background: transparent;
    color: var(--text-primary);
}
.btn:hover { background: var(--bg-surface-hover); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: transparent;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-outlined {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}
.btn-outlined:hover:not(:disabled) { background: var(--bg-surface); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 8px;
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-surface); color: var(--text-primary); }

.btn-danger { color: var(--error); }
.btn-danger:hover:not(:disabled) { background: rgba(242, 139, 130, 0.1); }
.btn-danger-outline { color: var(--error); border-color: var(--error); }
.btn-danger-outline:hover:not(:disabled) { background: rgba(242, 139, 130, 0.12); }

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    border: none;
}
.btn-icon svg { width: 20px; height: 20px; }

/* ===== Inputs ===== */
.input, textarea.input, select.input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-muted); }
select.input { appearance: auto; cursor: pointer; }

/* ===== Modal / Dialog ===== */
dialog.modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    color: var(--text-primary);
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog.modal h2 { margin-bottom: 16px; font-size: 1.15rem; font-weight: 500; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ===========================================================
   DASHBOARD — Grid de cards estilo NotebookLM
   =========================================================== */
.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}
.dashboard-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 28px;
}
.dashboard-tab {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-sans);
    transition: all 0.15s;
}
.dashboard-tab:hover { background: var(--bg-surface); color: var(--text-primary); }
.dashboard-tab.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 500;
}
/* Search bar */
.dashboard-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    margin-bottom: 16px;
}
.dashboard-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-sans);
}
.dashboard-search-input::placeholder { color: var(--text-muted); }

/* Condomínio / notebook list */
.cond-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cond-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}
.cond-row:hover {
    background: var(--bg-card-hover);
}
.cond-codigo {
    font-size: 0.85rem;
    color: var(--text-muted);
    min-width: 50px;
    font-variant-numeric: tabular-nums;
}
.cond-nome {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cond-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    color: var(--text-muted);
}
.cond-badge.active {
    background: rgba(129, 201, 149, 0.15);
    color: var(--success);
}
.cond-arrow {
    opacity: 0.3;
    flex-shrink: 0;
}
.cond-row:hover .cond-arrow { opacity: 0.7; }

/* Notebook row extras */
.notebook-periodo {
    font-size: 0.8rem;
    color: var(--accent);
    min-width: 70px;
}
.notebook-fontes {
    font-size: 0.8rem;
    color: var(--text-muted);
    min-width: 70px;
}
.notebook-data {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 90px;
}

/* Tab content */
.tab-content { }
.tab-content.hidden { display: none; }

/* Loading state */
.loading-state {
    text-align: center;
    padding: 40px;
}

/* ===========================================================
   NOTEBOOK VIEW — Layout 2 colunas (Etapas | Skills)
   =========================================================== */
.notebook-view {
    display: grid;
    grid-template-columns: 1fr var(--panel-skills-w);
    height: calc(100vh - var(--navbar-h));
    overflow: hidden;
}

/* ===== Panels ===== */
.panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.panel-sources {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
}
.panel-chat {
    background: var(--bg-primary);
}
.panel-skills {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.panel-header h2 {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}
.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

/* ===========================================================
   PANEL ESQUERDO — Fontes
   =========================================================== */
.add-source-btn {
    width: 100%;
    padding: 12px;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
    margin-bottom: 16px;
}
.add-source-btn:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
    color: var(--accent);
}

.source-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.12s;
    cursor: default;
}
.source-item:hover { background: var(--bg-surface-hover); }
.source-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: var(--accent-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    color: var(--accent);
}
.source-name {
    flex: 1;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.source-delete {
    opacity: 0;
    transition: opacity 0.12s;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px;
    border-radius: 50%;
}
.source-item:hover .source-delete { opacity: 1; }
.source-delete:hover { color: var(--error); }

.source-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}
.source-empty-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.5;
}
.source-empty p { font-size: 0.85rem; line-height: 1.5; }

/* GoSATI section */
.gosati-section {
    border-top: 1px solid var(--border);
    margin-top: 16px;
    padding-top: 16px;
}
.panel-subheader {
    padding: 0 0 12px;
}
.panel-subheader h3 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.gosati-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.form-group label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}
.form-row {
    display: flex;
    gap: 8px;
}
.form-group-half { flex: 1; }

/* ===== Upload Dropzone ===== */
.upload-dropzone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-secondary);
}
.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}
.upload-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 8px; }

/* ===========================================================
   PANEL CENTRAL — Chat / Conversa
   =========================================================== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
    gap: 12px;
    padding: 40px;
}
.chat-welcome-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent-subtle), rgba(211, 184, 255, 0.1));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.chat-welcome-icon svg { width: 40px; height: 40px; color: var(--accent-purple); }
.chat-welcome h2 {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-primary);
}
.chat-welcome p {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 400px;
}

.chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.7;
    word-wrap: break-word;
}
.chat-bubble-user {
    align-self: flex-end;
    background: var(--accent-muted);
    color: var(--text-primary);
    border-bottom-right-radius: var(--radius-xs);
}
.chat-bubble-model {
    align-self: flex-start;
    background: var(--bg-surface);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-xs);
}

/* Chat Input */
.chat-input-area {
    padding: 12px 24px 16px;
    flex-shrink: 0;
}
.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 6px 6px 6px 18px;
    transition: border-color 0.15s;
}
.chat-input-wrapper:focus-within { border-color: var(--accent); }
.chat-input-wrapper textarea {
    flex: 1;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    padding: 8px 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    outline: none;
    overflow-y: auto;
    line-height: 1.5;
}
.chat-input-wrapper textarea::placeholder { color: var(--text-muted); }
.chat-input-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 8px 0;
    white-space: nowrap;
}
.btn-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--text-on-accent);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.btn-send:hover { background: var(--accent-hover); }
.btn-send:disabled { opacity: 0.3; }
.btn-send svg { width: 18px; height: 18px; }

/* ===========================================================
   COVERAGE DASHBOARD
   =========================================================== */
.coverage-dashboard {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.coverage-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.coverage-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.5s ease;
}
.coverage-stats {
    display: flex;
    gap: 24px;
    justify-content: center;
}
.coverage-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.coverage-num {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}
.coverage-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-ok .coverage-num { color: var(--success); }
.stat-pending .coverage-num { color: var(--warning); }

/* ===========================================================
   PANEL CENTRAL — Etapas
   =========================================================== */
.etapas-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.etapas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
    gap: 12px;
    padding: 40px;
}
.etapas-empty-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--accent-subtle), rgba(211, 184, 255, 0.1));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.etapas-empty-icon svg { width: 40px; height: 40px; color: var(--accent-purple); }
.etapas-empty h2 {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-primary);
}
.etapas-empty p {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 400px;
}

.etapa-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.15s;
}
.etapa-card.running {
    border-color: var(--accent);
}
.etapa-card.done {
    border-color: var(--success);
}
.etapa-card.error {
    border-color: var(--error);
}

.etapa-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.etapa-card-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}
.etapa-card-title {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.etapa-card-status {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 500;
    flex-shrink: 0;
}
.etapa-card-status.pending {
    background: var(--bg-surface-active);
    color: var(--text-secondary);
}
.etapa-card-status.running {
    background: var(--accent-subtle);
    color: var(--accent);
}
.etapa-card-status.done {
    background: rgba(129, 201, 149, 0.15);
    color: var(--success);
}
.etapa-card-status.error {
    background: rgba(242, 139, 130, 0.15);
    color: var(--error);
}

.etapa-card-body {
    padding: 16px;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-primary);
    max-height: 500px;
    overflow-y: auto;
}
.etapa-card-body.collapsed {
    max-height: 200px;
}
.etapa-card-body:empty {
    display: none;
}
.etapa-card-body p { margin-bottom: 8px; }
.etapa-card-body h1, .etapa-card-body h2, .etapa-card-body h3 {
    margin: 16px 0 8px;
    color: var(--text-primary);
}
.etapa-card-body h1 { font-size: 1.1rem; }
.etapa-card-body h2 { font-size: 1rem; }
.etapa-card-body h3 { font-size: 0.9rem; }
.etapa-card-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 0.8rem;
}
.etapa-card-body th, .etapa-card-body td {
    padding: 6px 10px;
    border: 1px solid var(--border);
    text-align: left;
}
.etapa-card-body th {
    background: var(--bg-surface-hover);
    font-weight: 500;
}
.etapa-card-body ul, .etapa-card-body ol {
    padding-left: 20px;
    margin: 8px 0;
}
.etapa-card-body code {
    background: var(--bg-surface-hover);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}
.etapa-card-body strong { color: var(--accent); }

/* === Lançamentos list === */
.lanc-summary {
    padding: 8px 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}
.lanc-empty {
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}
.lanc-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.lanc-item {
    border-radius: 6px;
    overflow: hidden;
}
.lanc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}
.lanc-row:hover {
    background: var(--bg-surface-hover);
}
.lanc-chevron {
    font-size: 10px;
    color: var(--text-muted);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.lanc-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.lanc-historico {
    font-size: 0.82rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lanc-meta {
    display: flex;
    gap: 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.lanc-num {
    font-family: var(--font-mono, monospace);
}
.lanc-valor {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}
.lanc-doc-badge {
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    flex-shrink: 0;
    font-weight: 500;
}
.lanc-doc-badge.none {
    background: var(--bg-surface-hover);
    color: var(--text-muted);
}

/* Documentos expandidos */
.lanc-docs {
    padding: 8px 8px 12px 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
}
.lanc-docs.hidden {
    display: none;
}
.lanc-docs-empty {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 4px 0;
}
.lanc-doc-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.lanc-doc-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}
.lanc-doc-thumb {
    display: inline-block;
    max-width: 100%;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: border-color 0.15s;
}
.lanc-doc-thumb:hover {
    border-color: var(--accent);
}
.lanc-doc-thumb img {
    display: block;
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    background: #fff;
}
.lanc-doc-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--accent);
    text-decoration: none;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: background 0.15s;
}
.lanc-doc-link:hover {
    background: var(--bg-surface-hover);
}

/* === Collapsible lançamentos section === */
.lanc-section {
    margin-top: 4px;
}
.lanc-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
    user-select: none;
}
.lanc-section-header:hover {
    background: var(--bg-surface-hover);
}
.lanc-section-chevron {
    font-size: 10px;
    color: var(--text-muted);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}
.lanc-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}
.lanc-section-count {
    font-size: 0.68rem;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    font-weight: 500;
}
.lanc-section-body {
    padding: 4px 0;
}
.lanc-section-body.hidden {
    display: none;
}

/* === Análise IA content === */
.analise-content {
    padding: 8px 12px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-primary);
}
.analise-content h1,
.analise-content h2,
.analise-content h3 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-size: 1em;
    font-weight: 600;
}
.analise-content h1 { font-size: 1.1em; }
.analise-content ul, .analise-content ol {
    padding-left: 1.5em;
    margin: 0.5em 0;
}
.analise-content p {
    margin: 0.5em 0;
}
.analise-content strong {
    color: var(--text-secondary);
}
.analise-content code {
    background: var(--bg-surface-hover);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* === Critérios Estruturados === */
.criterios-resumo {
    display: flex;
    gap: 12px;
    padding: 12px;
    margin-bottom: 4px;
}
.criterio-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    min-width: 80px;
}
.criterio-stat.aprovado {
    background: rgba(129, 201, 149, 0.12);
    color: var(--success);
}
.criterio-stat.divergencia {
    background: rgba(242, 139, 130, 0.12);
    color: var(--error);
}
.criterio-stat.ausente {
    background: rgba(253, 214, 99, 0.12);
    color: var(--warning);
}
.criterio-stat-num {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
}
.criterio-stat-label {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

/* --- Historico Panel (dados brutos para comparação) --- */
.historico-panel {
    margin: 0 8px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.historico-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    background: var(--bg-surface);
    user-select: none;
    border-bottom: 1px solid transparent;
}
.historico-panel-header:hover {
    background: var(--bg-surface-hover);
}
.historico-panel-chevron {
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 14px;
    flex-shrink: 0;
}
.historico-panel-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex: 1;
}
.historico-panel-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 10px;
}
.hist-open-file {
    font-size: 0.7rem !important;
    padding: 2px 8px !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent) !important;
    margin-left: 4px;
}
.historico-panel-body {
    border-top: 1px solid var(--border);
    max-height: 400px;
    overflow-y: auto;
}
.historico-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}
.historico-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}
.historico-table th {
    background: var(--bg-surface);
    padding: 6px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.historico-table td {
    padding: 5px 8px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}
.historico-table tr:last-child td {
    border-bottom: none;
}
.historico-table tr:hover td {
    background: var(--bg-surface-hover);
}
.hist-col-lanc {
    width: 70px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.hist-col-hist {
    min-width: 180px;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}
.hist-col-valor {
    width: 90px;
    font-family: var(--font-mono);
    text-align: right;
    white-space: nowrap;
    color: var(--text-secondary);
}
.hist-col-conta {
    width: 120px;
    font-size: 0.7rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hist-col-docs {
    width: 50px;
    text-align: center;
    font-size: 0.72rem;
    white-space: nowrap;
}
.hist-doc-flag {
    font-size: 0.7rem;
}
.hist-doc-flag.has {
    color: var(--success);
}
.hist-doc-flag.none {
    color: var(--error);
    opacity: 0.6;
}
mark.hist-nf-ref {
    background: rgba(129, 201, 149, 0.2);
    color: var(--success);
    padding: 0 2px;
    border-radius: 2px;
}
mark.hist-sem-nf {
    background: rgba(242, 139, 130, 0.2);
    color: var(--error);
    padding: 0 2px;
    border-radius: 2px;
}

/* --- Criterion group (collapsible) --- */
.criterio-grupo {
    margin: 0 8px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.criterio-grupo.has-problems {
    border-color: rgba(242, 139, 130, 0.3);
}
.criterio-grupo.all-ok {
    border-color: rgba(129, 201, 149, 0.2);
}
.criterio-grupo-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    background: var(--bg-surface);
    user-select: none;
}
.criterio-grupo-header:hover {
    background: var(--bg-surface-hover);
}
.criterio-grupo-chevron {
    font-size: 0.7rem;
    color: var(--text-muted);
    width: 14px;
    flex-shrink: 0;
}
.criterio-grupo-nome {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}
.criterio-grupo-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.criterio-grupo-body {
    border-top: 1px solid var(--border);
}

/* --- Items table inside group --- */
.criterio-itens-table {
    font-size: 0.8rem;
}
.criterio-item-header {
    display: grid;
    grid-template-columns: 75px 1fr 90px 70px 1fr;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}
.criterio-item-row {
    display: grid;
    grid-template-columns: 75px 1fr 90px 70px 1fr;
    gap: 6px;
    padding: 6px 12px;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
}
.criterio-item-row:last-child {
    border-bottom: none;
}
.criterio-item-row.divergencia {
    background: rgba(242, 139, 130, 0.04);
}
.criterio-item-row.ausente {
    background: rgba(253, 214, 99, 0.04);
}

.ci-col-lanc {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}
.ci-col-hist {
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ci-col-valor {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
}
.ci-col-result {
    text-align: center;
}
.ci-col-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.ci-val {
    font-family: var(--font-mono);
    font-size: 0.7rem;
}
.ci-val-sep {
    color: var(--text-muted);
    margin: 0 2px;
}

/* Badges */
.criterio-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.criterio-badge.aprovado {
    background: rgba(129, 201, 149, 0.15);
    color: var(--success);
}
.criterio-badge.divergencia {
    background: rgba(242, 139, 130, 0.15);
    color: var(--error);
}
.criterio-badge.ausente {
    background: rgba(253, 214, 99, 0.15);
    color: var(--warning);
}

/* === Document icon grid === */
.lanc-docs-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.lanc-doc-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.lanc-doc-icon:hover {
    background: var(--bg-surface-hover);
    opacity: 0.85;
}
.lanc-doc-icon.pdf {
    color: #e74c3c;
    border-color: rgba(231, 76, 60, 0.3);
}
.lanc-doc-icon.pdf:hover {
    border-color: #e74c3c;
}
.lanc-doc-icon.image {
    color: #3498db;
    border-color: rgba(52, 152, 219, 0.3);
}
.lanc-doc-icon.image:hover {
    border-color: #3498db;
}
.lanc-doc-icon.other {
    color: #95a5a6;
    border-color: rgba(149, 165, 166, 0.3);
}
.lanc-doc-icon.other:hover {
    border-color: #95a5a6;
}

/* === Document viewer modal === */
.doc-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
}
.doc-viewer-overlay.hidden {
    display: none;
}
.doc-viewer-modal {
    background: var(--bg-surface);
    border-radius: var(--radius-lg, 12px);
    width: 90vw;
    max-width: 900px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.doc-viewer-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.doc-viewer-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-viewer-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.doc-viewer-close:hover {
    color: var(--text-primary);
}
.doc-viewer-body {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}
.doc-viewer-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.doc-viewer-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.etapa-card-loading {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.etapa-card-loading .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-stop {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--error);
    color: var(--error);
    width: 26px;
    height: 26px;
    border-radius: var(--radius-xs, 4px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    transition: background 0.15s;
    flex-shrink: 0;
}
.btn-stop:hover {
    background: rgba(242, 139, 130, 0.2);
}
.etapa-card.cancelled {
    border-left-color: var(--warning, #fdd663) !important;
}

.etapa-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
}
.etapa-card-actions .btn-sm {
    font-size: 0.8rem;
}
.etapa-card-expand {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    padding: 4px 0;
}
.etapa-card-expand:hover { color: var(--accent); }

/* ===========================================================
   PANEL DIREITO — Skills (Estúdio)
   =========================================================== */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.skill-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.skill-card:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-light);
    transform: translateY(-1px);
}
.skill-card.active {
    border-color: var(--accent);
    background: var(--accent-subtle);
}
.skill-card.selected {
    border-color: var(--accent);
    background: var(--accent-subtle);
    position: relative;
}
.skill-card-check {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 700;
}
.skills-execute-btn {
    width: 100%;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.skill-card-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.skill-card-icon svg { width: 22px; height: 22px; color: var(--text-secondary); }
.skill-card-name {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.skills-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}
.skills-empty-icon { margin-bottom: 12px; }
.skills-empty-icon svg { width: 40px; height: 40px; opacity: 0.5; }
.skills-empty p { font-size: 0.85rem; line-height: 1.5; }

.skills-separator {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

.skills-hint {
    text-align: center;
    padding: 12px 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.skills-hint-icon {
    display: block;
    margin: 0 auto 8px;
}
.skills-hint-icon svg { width: 32px; height: 32px; color: var(--accent-purple); opacity: 0.6; }

.skills-hint-icon.thinking svg {
    opacity: 1;
    animation: brain-glow 1.5s ease-in-out infinite;
}
@keyframes brain-glow {
    0%, 100% { color: var(--accent-purple); filter: drop-shadow(0 0 4px var(--accent-purple)); }
    33%      { color: var(--accent); filter: drop-shadow(0 0 8px var(--accent)); }
    66%      { color: var(--success); filter: drop-shadow(0 0 8px var(--success)); }
}

/* Loading dots animation for buttons */
.btn-loading {
    animation: btn-color-cycle 2s ease-in-out infinite;
    pointer-events: none;
}
@keyframes btn-color-cycle {
    0%, 100% { border-color: var(--accent); color: var(--accent); }
    33%      { border-color: var(--accent-purple); color: var(--accent-purple); }
    66%      { border-color: var(--success); color: var(--success); }
}
.btn-loading-dots {
    display: inline-flex;
    gap: 3px;
    vertical-align: middle;
    margin-right: 4px;
}
.btn-loading-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    animation: dot-bounce 1.2s ease-in-out infinite;
}
.btn-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.btn-loading-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot-bounce {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.2); }
}

/* ===========================================================
   ADMIN — Skills Management
   =========================================================== */
.admin-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px;
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}
.admin-header h1 {
    font-size: 1.4rem;
    font-weight: 500;
}

.skill-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.skill-admin-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.skill-admin-card:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-light);
}
.skill-admin-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.skill-admin-card-icon { font-size: 1.5rem; }
.skill-admin-card-name { font-size: 1rem; font-weight: 500; flex: 1; }
.skill-admin-delete {
    opacity: 0;
    color: var(--text-muted);
    transition: opacity 0.15s, color 0.15s;
    margin-left: auto;
}
.skill-admin-card:hover .skill-admin-delete { opacity: 1; }
.skill-admin-delete:hover { color: var(--error, #e74c3c); }
.skill-admin-card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.skill-admin-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.skill-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 500;
}
.skill-status-badge.active { background: rgba(129, 201, 149, 0.15); color: var(--success); }
.skill-status-badge.inactive { background: rgba(110, 110, 110, 0.15); color: var(--text-muted); }

/* Skill Editor */
.skill-editor {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.skill-editor-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
}
.skill-editor-section h3 {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--text-primary);
}
.step-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    align-items: flex-start;
}
.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}
.step-content { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.step-actions { flex-shrink: 0; }

.example-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}
.example-icon { font-size: 1.2rem; }
.example-info { flex: 1; }
.example-name { font-size: 0.85rem; font-weight: 500; }
.example-desc { font-size: 0.78rem; color: var(--text-muted); }

/* ===========================================================
   Markdown Content
   =========================================================== */
.markdown-content h1, .markdown-content h2, .markdown-content h3,
.markdown-content h4, .markdown-content h5, .markdown-content h6 {
    margin-top: 16px; margin-bottom: 8px; font-weight: 500;
}
.markdown-content h1 { font-size: 1.3rem; }
.markdown-content h2 { font-size: 1.15rem; }
.markdown-content h3 { font-size: 1.02rem; }
.markdown-content p { margin-bottom: 8px; }
.markdown-content ul, .markdown-content ol { margin-left: 20px; margin-bottom: 8px; }
.markdown-content li { margin-bottom: 4px; }
.markdown-content table {
    width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 0.85rem;
}
.markdown-content th, .markdown-content td {
    padding: 8px 10px; border: 1px solid var(--border); text-align: left;
}
.markdown-content th { background: var(--bg-surface); font-weight: 500; }
.markdown-content code {
    background: var(--bg-surface); padding: 2px 6px; border-radius: 3px;
    font-family: var(--font-mono); font-size: 0.85em;
}
.markdown-content pre {
    background: var(--bg-input); padding: 12px; border-radius: var(--radius-sm);
    overflow-x: auto; margin-bottom: 12px;
}
.markdown-content pre code { background: none; padding: 0; }
.markdown-content blockquote {
    border-left: 3px solid var(--accent); padding-left: 12px;
    color: var(--text-secondary); margin-bottom: 8px;
}

/* ===========================================================
   Toast Notifications
   =========================================================== */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: white;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.2s ease;
    max-width: 350px;
}
.toast-info { background: #3b82f6; }
.toast-success { background: var(--success); color: var(--text-on-accent); }
.toast-error { background: var(--error); }
.toast-warning { background: var(--warning); color: var(--text-on-accent); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===========================================================
   Autocomplete
   =========================================================== */
.autocomplete-list {
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--bg-surface); border: 1px solid var(--border-light);
    border-radius: var(--radius-sm); max-height: 200px; overflow-y: auto;
    z-index: 50; box-shadow: var(--shadow-md);
}
.autocomplete-item {
    padding: 8px 12px; cursor: pointer; font-size: 0.82rem;
    display: flex; justify-content: space-between; align-items: center;
}
.autocomplete-item:hover, .autocomplete-item.active {
    background: var(--bg-surface-hover);
}
.autocomplete-item .ac-code {
    color: var(--accent); font-weight: 600; font-size: 0.78rem; white-space: nowrap;
}
.autocomplete-item .ac-name {
    color: var(--text-secondary); flex: 1; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; margin-left: 8px;
}
.autocomplete-empty {
    padding: 8px 12px; font-size: 0.8rem; color: var(--text-muted); text-align: center;
}

/* ===========================================================
   Utility
   =========================================================== */
.hidden { display: none !important; }
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
.spinner-sm { width: 14px; height: 14px; border-width: 1.5px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-indicator {
    display: flex; align-items: center; gap: 10px;
    padding: 12px; font-size: 0.85rem; color: var(--text-secondary);
}
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 32px; color: var(--text-muted); font-size: 0.9rem; text-align: center;
}

.badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: var(--radius-full);
    background: var(--accent-muted); color: var(--accent);
    font-size: 0.72rem; font-weight: 600;
}

/* ===========================================================
   Mobile Tab Bar (hidden on desktop)
   =========================================================== */
.mobile-tab-bar {
    display: none;
}

/* ===========================================================
   Responsive — Tablet (768px – 1024px)
   =========================================================== */
@media (max-width: 1024px) {
    .notebook-view {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    .panel-sources, .panel-skills {
        border: none;
        border-bottom: 1px solid var(--border);
        max-height: 280px;
    }
    .dashboard { padding: 24px 16px; }
    .notebook-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
    .navbar-actions .btn span.btn-label { display: none; }
}

/* ===========================================================
   Responsive — Mobile (< 768px)
   =========================================================== */
@media (max-width: 768px) {
    :root {
        --navbar-h: 48px;
        --mobile-tab-h: 56px;
    }

    /* --- Navbar --- */
    .navbar { padding: 0 12px; gap: 8px; }
    .navbar-logo { font-size: 0; gap: 0; }
    .navbar-logo svg { width: 26px; height: 26px; }
    .navbar-title { font-size: 0.95rem; }
    .navbar-actions .btn { padding: 6px 10px; font-size: 0.75rem; }
    .navbar-actions .btn svg { width: 14px; height: 14px; }
    .navbar-actions .btn-label-mobile-hide { display: none; }

    /* --- Notebook View: tab-based panel switching --- */
    .notebook-view {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        height: calc(100vh - var(--navbar-h) - var(--mobile-tab-h));
    }
    .notebook-view > .panel {
        display: none;
        height: 100%;
        max-height: none;
        border: none;
    }
    .notebook-view > .panel.mobile-active {
        display: flex;
    }

    /* --- Mobile Tab Bar --- */
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--mobile-tab-h);
        background: var(--bg-secondary);
        border-top: 1px solid var(--border);
        z-index: 100;
        padding: 0;
        justify-content: space-around;
        align-items: center;
    }
    .mobile-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 0;
        background: none;
        border: none;
        color: var(--text-muted);
        font-family: var(--font-sans);
        font-size: 0.68rem;
        cursor: pointer;
        transition: color 0.15s;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-tab svg { transition: color 0.15s; }
    .mobile-tab.active {
        color: var(--accent);
    }

    /* --- Panel adjustments for mobile --- */
    .panel-header { padding: 12px 16px; }
    .panel-header h2 { font-size: 0.9rem; }
    .panel-body { padding: 12px 16px; }
    .panel-sources { border-right: none; }
    .panel-skills { border-left: none; }

    /* --- Chat adjustments --- */
    .chat-messages { padding: 12px 12px; }
    .chat-bubble { max-width: 92%; padding: 10px 14px; font-size: 0.85rem; }
    .chat-input-area { padding: 8px 12px 12px; }
    .chat-input-wrapper { padding: 4px 4px 4px 14px; border-radius: var(--radius-lg); }
    .chat-input-wrapper textarea { font-size: 0.85rem; }
    .chat-input-meta { font-size: 0.7rem; padding: 6px 0; }
    .chat-welcome { padding: 24px 16px; }
    .chat-welcome h2 { font-size: 1.2rem; }
    .chat-welcome p { font-size: 0.82rem; }
    .chat-welcome-icon { width: 60px; height: 60px; }
    .chat-welcome-icon svg { width: 30px; height: 30px; }

    /* --- Sources panel mobile --- */
    .add-source-btn { padding: 10px; font-size: 0.82rem; }
    .source-item { padding: 10px; }
    .source-delete { opacity: 1; }

    /* --- Skills panel mobile --- */
    .skills-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .skill-card { padding: 12px 6px; }
    .skill-card-icon { width: 32px; height: 32px; font-size: 1.1rem; }
    .skill-card-name { font-size: 0.72rem; }

    /* --- Dashboard --- */
    .dashboard { padding: 16px 12px; }
    .dashboard-header { margin-bottom: 16px; }
    .dashboard-header h1 { font-size: 1.15rem; }
    .dashboard-tabs { margin-bottom: 16px; gap: 2px; overflow-x: auto; flex-wrap: nowrap; }
    .dashboard-tab { padding: 6px 12px; font-size: 0.8rem; white-space: nowrap; }
    .notebook-grid { grid-template-columns: 1fr; gap: 12px; }
    .notebook-card { min-height: 140px; padding: 16px 16px 12px; }
    .notebook-card-emoji { font-size: 2rem; margin-bottom: 10px; }
    .notebook-card-title { font-size: 0.95rem; }

    /* --- Modal --- */
    dialog.modal { width: 95%; padding: 20px 16px; max-width: none; }

    /* --- Buttons touch-friendly --- */
    .btn { min-height: 40px; padding: 8px 16px; }
    .btn-sm { min-height: 36px; padding: 6px 12px; }
    .btn-icon { width: 40px; height: 40px; }
    .btn-send { width: 38px; height: 38px; }

    /* --- Admin --- */
    .admin-page { padding: 16px 12px; }
    .admin-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .admin-header h1 { font-size: 1.2rem; }
    .skill-admin-grid { grid-template-columns: 1fr; gap: 12px; }

    /* --- Toast mobile --- */
    #toast-container { bottom: calc(var(--mobile-tab-h) + 12px); right: 12px; left: 12px; }
    .toast { max-width: none; width: 100%; }

    /* --- GoSATI form --- */
    .form-row { flex-direction: column; }

    /* --- Markdown content --- */
    .markdown-content table { font-size: 0.78rem; display: block; overflow-x: auto; }
    .markdown-content pre { font-size: 0.8rem; }

    /* --- Skill editor --- */
    .skill-editor-section { padding: 16px; }
    .step-item { flex-direction: column; gap: 8px; }
}

/* ===========================================================
   Responsive — Small phones (< 380px)
   =========================================================== */
@media (max-width: 380px) {
    .notebook-card { min-height: 120px; }
    .skills-grid { grid-template-columns: 1fr; }
    .chat-bubble { max-width: 96%; }
    .navbar-title { font-size: 0.85rem; }
}

/* ===========================================================
   Pipeline — Executar Todas
   =========================================================== */
.pipeline-progress {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.pipeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.pipeline-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.pipeline-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.pipeline-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.pipeline-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.pipeline-skills-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pipeline-skill-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-xs);
    font-size: 0.82rem;
}

.pipeline-skill-status {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.pipeline-skill-status.pending { color: var(--text-muted); }
.pipeline-skill-status.running { color: var(--accent); }
.pipeline-skill-status.done { color: var(--success); }
.pipeline-skill-status.error { color: var(--error); }

.pipeline-skill-name {
    flex: 1;
    color: var(--text-primary);
}

.pipeline-skill-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Pipeline Summary --- */
.pipeline-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.pipeline-summary-skill {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.pipeline-summary-skill.has-pendencias {
    border-color: var(--error);
    border-opacity: 0.3;
}

.pipeline-summary-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.pipeline-summary-header:hover {
    background: var(--bg-surface-hover);
}

.pipeline-summary-icon {
    font-size: 1.1rem;
}

.pipeline-summary-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.pipeline-summary-lancto {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 2px 6px;
    background: var(--bg-surface);
    border-radius: var(--radius-xs);
}

.pipeline-summary-chevron {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.pipeline-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pipeline-badge.aprovado {
    background: rgba(129, 201, 149, 0.15);
    color: var(--success);
}

.pipeline-badge.divergencia {
    background: rgba(242, 139, 130, 0.15);
    color: var(--error);
}

.pipeline-badge.ausente {
    background: rgba(253, 214, 99, 0.15);
    color: var(--warning);
}

.pipeline-summary-body {
    padding: 0 12px 12px;
}

.pipeline-summary-ok {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 8px 0;
}

.pipeline-summary-compact {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.pipeline-summary-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.pipeline-summary-line.has-pendencias {
    border-color: rgba(242, 139, 130, 0.4);
}

.pipeline-pendencias-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.pipeline-pendencias-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: uppercase;
}

.pipeline-pendencias-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.pipeline-pendencias-table tr.divergencia td:first-child {
    border-left: 3px solid var(--error);
}

.pipeline-pendencias-table tr.ausente td:first-child {
    border-left: 3px solid var(--warning);
}

.pipeline-pendencias-table small {
    color: var(--text-muted);
}

/* Spinner extra small */
.spinner-xs {
    width: 14px;
    height: 14px;
    border-width: 2px;
}
