/* ═══════════ VARIABLES ═══════════ */
:root {
    --bg-primary: #0f0f13;
    --bg-secondary: #16161d;
    --bg-tertiary: #1e1e28;
    --bg-elevated: #252532;
    --bg-hover: #2a2a3a;
    --border: #2e2e3e;
    --border-light: #383848;
    --text-primary: #e4e4ef;
    --text-secondary: #9090a8;
    --text-muted: #606078;
    --accent: #6366f1;
    --accent-hover: #5558e6;
    --accent-bg: rgba(99, 102, 241, 0.12);
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-sm: 6px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --topbar-h: 56px;
    --sidebar-w: 220px;
    --font: 'Inter', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --transition: 0.2s ease;
}

/* ═══════════ RESET ═══════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ═══════════ SCREENS ═══════════ */
.screen { width: 100%; height: 100%; }
.hidden { display: none !important; }

/* ═══════════ LOGIN ═══════════ */
.login-container {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
}
.login-logo {
    text-align: center;
    margin-bottom: 40px;
}
.logo-icon {
    width: 72px; height: 72px;
    background: var(--accent-bg);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--accent);
}
.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}
.login-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    outline: none;
    transition: border var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
}
.form-check {
    margin-bottom: 20px;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    user-select: none;
}
.checkbox-label input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}
.error-msg {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: var(--error);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-top: 12px;
}

/* ═══════════ BUTTONS ═══════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-danger { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: var(--error); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ═══════════ TOP BAR ═══════════ */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
    gap: 12px;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 15px;
}
.topbar-brand svg { color: var(--accent); }
.topbar-left { position: relative; }
.version-badge {
    font-size: 10px;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 1px 6px;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
    transition: color .15s, background .15s;
}
.version-badge:hover {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 15%, transparent);
}
.version-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 340px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    z-index: 999;
    padding: 0;
}
.version-dropdown-header {
    padding: 12px 16px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border);
}
.version-dropdown-list { padding: 6px 0; }
.version-entry {
    padding: 10px 16px;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
}
.version-entry:last-child { border-bottom: none; }
.version-entry-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.version-entry-tag {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
}
.version-entry-date {
    font-size: 11px;
    color: var(--text-tertiary);
}
.version-entry-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.version-entry-changes {
    list-style: none;
    padding: 0;
    margin: 0;
}
.version-entry-changes li {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 1px 0 1px 12px;
    position: relative;
    line-height: 1.5;
}
.version-entry-changes li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-tertiary);
}
.version-entry.current {
    background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.topbar-center { flex: 1; display: flex; justify-content: center; }
.project-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all var(--transition);
    max-width: 240px;
}
.project-selector:hover { border-color: var(--accent); color: var(--text-primary); }
.project-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}
#current-project-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-right { position: relative; }
.user-menu { cursor: pointer; }
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
}
.avatar.has-photo { background: transparent; }
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.user-dropdown {
    position: absolute;
    top: 44px;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
}
.dropdown-header {
    padding: 12px 16px 4px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
}
.dropdown-account {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px 10px;
    font-size: 11px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.user-dropdown a {
    display: block;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 13px;
    transition: background var(--transition);
}
.user-dropdown a:hover { background: var(--bg-hover); }

/* ═══════════ SIDEBAR ═══════════ */
.sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    z-index: 90;
    transition: transform 0.3s ease;
    overflow-y: auto;
}
.sidebar.collapsed {
    transform: translateX(-100%);
}
.sidebar.collapsed + .main-content,
.main-content.sidebar-collapsed {
    left: 0;
}
.sidebar-nav {
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); }
.nav-item svg { flex-shrink: 0; }
.badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ═══════════ MAIN CONTENT ═══════════ */
.main-content {
    position: fixed;
    top: var(--topbar-h);
    left: var(--sidebar-w);
    right: 0;
    bottom: 0;
    transition: left 0.3s ease;
    overflow: hidden;
}
.view {
    display: none;
    height: 100%;
    overflow-y: auto;
}
.view.active { display: flex; flex-direction: column; }
#view-workspace.active { overflow: hidden; }
.view-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}
.view-header h2 {
    font-size: 18px;
    font-weight: 600;
}

/* ═══════════ WORKSPACE ═══════════ */
.mobile-tabs {
    display: none;
    padding: 8px;
    gap: 4px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.tab-btn {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}
.tab-btn.active {
    background: var(--accent-bg);
    color: var(--accent);
}
.workspace-split {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.prompt-panel {
    width: 35%;
    min-width: 300px;
    max-width: 420px;
    border-right: 1px solid var(--border);
}
.terminal-panel {
    flex: 1;
    min-width: 0;
}
.panel-header {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 12px;
}
.panel-header h2 {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
.model-selector select {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}
.prompt-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
/* Preview link */
.preview-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--accent-bg);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius);
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    text-decoration: none;
}
.preview-link:hover {
    background: rgba(99, 102, 241, 0.18);
    border-color: var(--accent);
}
.preview-link svg { flex-shrink: 0; }

.dir-selector label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: block;
}
.dir-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: var(--mono);
    transition: border var(--transition);
}
.dir-input:hover { border-color: var(--accent); }
.prompt-area {
    flex: 1;
}
.prompt-area textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
    color: var(--text-primary);
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border var(--transition);
}
.prompt-area textarea:focus {
    border-color: var(--accent);
}
.prompt-area textarea:focus ~ .prompt-toolbar {
    border-color: var(--accent);
}
/* Indicador discreto de rascunho salvo/restaurado (v1.5.4) */
.prompt-draft-status {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 0 4px;
    height: 0;
    overflow: hidden;
    transition: height 0.2s, opacity 0.2s, padding 0.2s;
    opacity: 0;
}
.prompt-draft-status.visible {
    height: 18px;
    padding: 2px 4px;
    opacity: 1;
}
.prompt-draft-status.saved::before { content: '💾 '; }
.prompt-draft-status.restored {
    color: #c084fc;
}
.prompt-draft-status.restored::before { content: '↺ '; }
.attachments-area { display: flex; flex-direction: column; gap: 8px; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; }
.attachment-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}
.attachment-item .remove-att {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
}
.attachment-item .remove-att:hover { color: var(--error); }
.pin-att {
    cursor: pointer;
    font-size: 12px;
    opacity: 0.35;
    filter: grayscale(1);
    transition: opacity 0.15s, filter 0.15s;
    user-select: none;
}
.pin-att:hover { opacity: 0.7; }
.pin-att.pinned { opacity: 1; filter: none; }
.attach-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
    align-self: flex-start;
}
.attach-btn:hover { border-color: var(--accent); color: var(--accent); }
.panel-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.panel-footer-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.panel-footer-row .btn-full {
    flex: 1;
}

/* ═══════════ TERMINAL ═══════════ */
.terminal-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.terminal-status {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}
.terminal-status.running {
    color: var(--success);
}
.terminal-status.running::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--success);
    margin-right: 6px;
    animation: pulse 1.5s infinite;
}
.terminal-status.warning {
    color: #f59e0b;
    font-weight: 600;
}
.terminal-status.warning::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #f59e0b;
    margin-right: 6px;
    animation: pulse 0.8s infinite;
}
.terminal-status.timeout {
    color: #ef4444;
    font-weight: 700;
}
.terminal-status.timeout::before {
    content: '';
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #ef4444;
    margin-right: 6px;
    animation: pulse 0.5s infinite;
}
.btn-reconnect {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    color: var(--primary);
    background: transparent;
    border: 1px solid var(--primary);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    margin-right: 6px;
}
.btn-reconnect:hover {
    background: var(--primary);
    color: #fff;
}
.btn-reconnect:active {
    opacity: 0.8;
}
.btn-reconnect.hidden {
    display: none;
}
.extend-time-control {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 8px;
}
.extend-time-control.hidden {
    display: none !important;
}
.extend-time-input {
    width: 42px;
    padding: 2px 4px;
    font-size: 12px;
    font-family: inherit;
    text-align: center;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 3px 0 0 3px;
    outline: none;
    -moz-appearance: textfield;
}
.extend-time-input::-webkit-inner-spin-button,
.extend-time-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.extend-time-input:focus {
    border-color: var(--accent);
}
.btn-extend-time {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 3px 3px 0;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-extend-time:hover {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    border-color: var(--accent);
}
.btn-extend-time:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.terminal-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
/* Painel de resposta rápida (abaixo do terminal, acima do input) */
.question-panel {
    background: linear-gradient(180deg, rgba(99,102,241,0.08), rgba(99,102,241,0.03));
    border-top: 1px solid rgba(99, 102, 241, 0.35);
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.question-panel.hidden {
    display: none;
}
.question-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.question-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.2px;
    text-transform: uppercase;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.question-dismiss {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.question-dismiss:hover {
    color: var(--text);
    background: rgba(255,255,255,0.06);
}
.question-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: stretch;
}
.qbtn {
    padding: 8px 14px;
    background: var(--accent-bg);
    color: var(--accent);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.qbtn .qbtn-num {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.qbtn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.qbtn:hover .qbtn-num {
    background: #fff;
    color: var(--accent);
}

/* Botão de modo mouse/scroll no terminal */
.terminal-mouse-btn {
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.terminal-mouse-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

/* Toggle de auto-aprovação (ao lado do botão Enviar) */
.auto-approve-btn {
    position: relative;
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: all var(--transition);
}
.auto-approve-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-light);
}
.auto-approve-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25), 0 0 12px rgba(99, 102, 241, 0.45);
}
.auto-approve-btn.active:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.auto-approve-btn.active::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    background: var(--success);
    border: 2px solid var(--bg-primary);
    border-radius: 50%;
}
.auto-approve-btn.active .auto-approve-icon {
    animation: auto-approve-spin 2s linear infinite;
}
@keyframes auto-approve-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.terminal-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #0d0d0d;
    min-height: 0;
}
.terminal-placeholder {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
}
.terminal-placeholder svg { margin-bottom: 12px; opacity: 0.3; }
.terminal-placeholder p { font-size: 13px; }
.terminal-container .xterm {
    height: 100%;
    padding: 8px;
}
/* Scrollbar do xterm.js */
.terminal-container .xterm-viewport {
    overflow-y: auto !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.25) transparent;
}
.terminal-container .xterm-viewport::-webkit-scrollbar { width: 10px; }
.terminal-container .xterm-viewport::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
.terminal-container .xterm-viewport::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.terminal-container .xterm-viewport::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.35);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* ═══════════ FULLSCREEN TERMINAL ═══════════ */
/* v1.4.5: classe no <body> esconde topbar/sidebar globais — antes ficavam
   visíveis em alguns layouts mesmo com z-index 9999 do panel, por causa
   de stacking-context isolado em ancestrais. Garantia direta. */
body.terminal-fs .topbar,
body.terminal-fs .sidebar { display: none !important; }
body.terminal-fs .main-content { left: 0 !important; top: 0 !important; }

.terminal-panel.fullscreen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    background: var(--bg-primary);
    width: 100% !important;
    max-width: none !important;
    border: none !important;
}
.terminal-panel.fullscreen .panel-header {
    background: var(--bg-secondary);
    padding: 10px 20px;
}
.terminal-panel.fullscreen .terminal-container {
    height: calc(100vh - 50px - 42px);
}
/* v1.4.4: o botão fullscreen permanece visível em fullscreen e vira toggle —
   alterna entre os dois SVGs (expandir / restaurar) sem JS, via CSS puro. */
#btn-fullscreen .fs-icon-restore { display: none; }
.terminal-panel.fullscreen #btn-fullscreen .fs-icon-expand { display: none; }
.terminal-panel.fullscreen #btn-fullscreen .fs-icon-restore { display: inline; }

/* Botão "Sair (ESC)" — só visível em fullscreen.
   v1.4.3: vira pílula flutuante no canto superior direito em QUALQUER
   tamanho de tela (antes só ficava flutuante no mobile; no desktop ficava
   camuflado entre os outros botões da toolbar e usuários reportavam
   "não consigo voltar"). Posição fixa garante que sempre aparece. */
.btn-exit-fs {
    display: none !important;
}
.terminal-panel.fullscreen .btn-exit-fs {
    display: inline-flex !important;
    position: fixed !important;
    top: max(12px, env(safe-area-inset-top));
    right: 16px;
    z-index: 10000;
    align-items: center;
    gap: 6px;
    background: var(--error);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    transition: opacity 0.2s, transform 0.15s;
}
.terminal-panel.fullscreen .btn-exit-fs:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}
.terminal-input-bar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
}
.terminal-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.terminal-input-bar input[type="text"] {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--mono);
    font-size: 13px;
    outline: none;
}
.terminal-input-bar input[type="text"]:focus { border-color: var(--accent); }
.terminal-attach-btn {
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.15s;
    flex-shrink: 0;
}
.terminal-attach-btn:hover { color: var(--accent); }
.terminal-input-attachments:empty { display: none; }
.terminal-input-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.terminal-input-attachments .ti-file {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--text-secondary);
}
.terminal-input-attachments .ti-file .ti-remove {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
}
.terminal-input-attachments .ti-file .ti-remove:hover { color: var(--error); }

/* ═══════════ SESSIONS LIST ═══════════ */
.session-list, .project-list, .history-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}
.session-card, .project-card, .history-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 12px;
    transition: border var(--transition);
    cursor: pointer;
}
.session-card:hover, .project-card:hover, .history-card:hover {
    border-color: var(--border-light);
}
.session-card-header, .project-card-header, .history-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.session-card-title, .project-card-title {
    font-weight: 600;
    font-size: 14px;
}
.session-card-meta, .project-card-meta, .history-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 6px;
}
.session-card-prompt {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: var(--mono);
    line-height: 1.5;
}
.session-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.status-running { background: rgba(16,185,129,0.12); color: var(--success); }
.status-success { background: rgba(59,130,246,0.12); color: var(--info); }
.status-error { background: rgba(239,68,68,0.12); color: var(--error); }
.status-cancelled { background: rgba(96,96,120,0.12); color: var(--text-muted); }
.status-completed { background: rgba(96,96,120,0.12); color: var(--text-secondary); }
.status-shared { background: rgba(168,85,247,0.14); color: #c084fc; }

/* ═══════════ MODAL DE COMPARTILHAMENTO DE PROJETO ═══════════ */
.share-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.4px;
    margin: 14px 0 8px;
}
.share-collaborators {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}
.share-collab-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-tertiary, rgba(255,255,255,0.03));
    border-radius: var(--radius-sm);
}
.share-collab-owner {
    background: rgba(99,102,241,0.10);
    border: 1px solid rgba(99,102,241,0.25);
}
.share-collab-info { min-width: 0; flex: 1; }
.share-collab-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.share-collab-email {
    font-size: 11px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.share-collab-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    background: rgba(99,102,241,0.25);
    color: #a5a8ff;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.share-add-section {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.share-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.share-user-select {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}
.share-hint {
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.empty-state-sm {
    padding: 12px 10px;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
}

/* ═══════════ MODAL DE LEITURAS TRATADAS ═══════════ */
.readings-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding-bottom: 12px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
}
.readings-status {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
/* Ponto pulsante vermelho ao lado do texto "Processando..." */
.readings-status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 0 0 rgba(239,68,68,0.7);
    animation: readingsDot 1.1s infinite;
}
@keyframes readingsDot {
    0%   { box-shadow: 0 0 0 0   rgba(239,68,68,0.7); transform: scale(1); }
    70%  { box-shadow: 0 0 0 10px rgba(239,68,68,0);   transform: scale(1.15); }
    100% { box-shadow: 0 0 0 0   rgba(239,68,68,0);   transform: scale(1); }
}

/* Botão principal pulsando enquanto gera */
@keyframes btnPulseRed {
    0%, 100% { background: #ef4444; box-shadow: 0 0 0 0 rgba(239,68,68,0.65); }
    50%      { background: #dc2626; box-shadow: 0 0 0 6px rgba(239,68,68,0);   }
}
.btn-generating {
    animation: btnPulseRed 1.2s infinite;
    color: #fff !important;
    border-color: transparent !important;
    cursor: wait !important;
}
.btn-generating-light {
    opacity: 0.55;
    pointer-events: none;
}

/* Banner: "há uma nova resposta ainda não tratada" */
.readings-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 12px 0 0;
    background: rgba(245, 158, 11, 0.10);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-left-width: 3px;
    border-radius: var(--radius-sm);
}
.readings-banner.hidden { display: none; }
.readings-banner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    flex-shrink: 0;
    animation: readingsDot 1.4s infinite;
    box-shadow: 0 0 0 0 rgba(245,158,11,0.7);
}
.readings-banner-text {
    flex: 1;
    font-size: 13px;
    color: #fde68a;
    line-height: 1.4;
}

/* Linha da busca */
.readings-search-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
}
.readings-search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-secondary);
    pointer-events: none;
}
.readings-search-input {
    flex: 1;
    padding: 8px 10px 8px 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}
.readings-search-input:focus { border-color: var(--accent); }
.readings-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--text-secondary);
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3'><line x1='18' y1='6' x2='6' y2='18'/><line x1='6' y1='6' x2='18' y2='18'/></svg>") center/contain no-repeat;
    cursor: pointer;
}
.readings-count {
    font-size: 11px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* ═══════════ MODAL DE TRATAMENTO EM LOTE ═══════════ */
.batch-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.batch-check-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    user-select: none;
}
.batch-check-all input[type=checkbox] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
}
.batch-counter {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
}
.batch-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 50vh;
    overflow-y: auto;
}
.batch-row {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary, rgba(255,255,255,0.03));
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid transparent;
}
.batch-row:hover {
    background: rgba(99,102,241,0.06);
    border-color: rgba(99,102,241,0.2);
}
.batch-row input[type=checkbox] {
    width: 16px;
    height: 16px;
    margin-top: 3px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--accent);
}
.batch-row-body { flex: 1; min-width: 0; }
.batch-row-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}
.batch-row-num {
    font-weight: 600;
    color: var(--accent);
}
.batch-row-time { color: var(--text-secondary); }
.batch-row-preview {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
@keyframes batchRowPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.5); }
    50%      { box-shadow: 0 0 0 4px rgba(245,158,11,0);  }
}
.batch-row-processing {
    border-color: rgba(245,158,11,0.6) !important;
    background: rgba(245,158,11,0.10) !important;
    animation: batchRowPulse 1.2s infinite;
}
.batch-row-done {
    background: rgba(16,185,129,0.10);
    border-color: rgba(16,185,129,0.35);
    opacity: 0.7;
}
.batch-row-failed {
    background: rgba(239,68,68,0.10);
    border-color: rgba(239,68,68,0.4);
}

/* Barra de progresso */
.batch-progress {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.batch-progress.hidden { display: none; }
.batch-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
}
.batch-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #8b5cf6);
    transition: width 0.3s ease;
    border-radius: 999px;
}
.batch-progress-text {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}
.readings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 60vh;
    overflow-y: auto;
}
.reading-card {
    padding: 12px 14px;
    background: var(--bg-tertiary, rgba(255,255,255,0.03));
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
    border: 1px solid transparent;
}
.reading-card:hover {
    background: rgba(99,102,241,0.08);
    border-color: rgba(99,102,241,0.25);
}
.reading-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.reading-fallback-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    background: rgba(245,158,11,0.18);
    color: #fbbf24;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.reading-card-resumo {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 6px;
}
.reading-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Toolbar do header do modal de leitura */
.reading-toolbar {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}
/* Toggle de ícone do botão maximizar/restaurar */
#btn-reading-maximize .reading-icon-restore { display: none; }
.modal-content.maximized #btn-reading-maximize .reading-icon-max { display: none; }
.modal-content.maximized #btn-reading-maximize .reading-icon-restore { display: inline; }

/* ═══════════ PAINEL DE TTS DA LEITURA ═══════════ */
.reading-tts-panel {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: ttsPanelSlide 0.18s ease-out;
}
@keyframes ttsPanelSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.tts-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}
.tts-status-icon {
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}
.reading-tts-panel.tts-state-loading .tts-status-icon {
    animation: ttsPulse 1.2s ease-in-out infinite;
}
@keyframes ttsPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%      { opacity: 1;   transform: scale(1.12); }
}
.tts-status-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
}
.reading-tts-panel.tts-state-ready .tts-status-text { color: var(--success); }
.reading-tts-panel.tts-state-error .tts-status-text { color: var(--error); }
.tts-close-btn { margin-left: auto; }
.tts-progress {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
}
.tts-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    transition: width 0.3s ease;
}
.reading-tts-panel.tts-state-ready .tts-progress-fill { background: var(--success); }
.reading-tts-panel.tts-state-error .tts-progress-fill { background: var(--error); }
.tts-player-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.tts-player-row audio {
    width: 100%;
    height: 36px;
    border-radius: var(--radius-sm);
}
.tts-speed-select {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    font-size: 12px;
    cursor: pointer;
}
.tts-speed-select:hover { border-color: var(--border-light); }

/* ═══════════ TIPOGRAFIA DE LEITURA (modal de leitura) ═══════════ */
.reading-body {
    /* fonte serif maior — UX de "ler texto longo" e não "olhar dashboard" */
    font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
    max-height: 70vh;
    overflow-y: auto;
}
.reading-resumo {
    font-style: italic;
    color: var(--text-secondary);
    border-left: 3px solid var(--accent);
    padding: 4px 0 4px 14px;
    margin-bottom: 18px;
}
.reading-h {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.reading-p {
    margin: 0 0 14px;
}
.reading-list {
    margin: 0 0 14px;
    padding-left: 24px;
}
.reading-list li {
    margin-bottom: 6px;
}
.reading-code {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
    background: #0d0d0d;
    color: #e4e4ef;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 0 0 14px;
}
.reading-callout {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin: 0 0 14px;
    border-left: 3px solid;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
}
.reading-callout-info    { background: rgba(59,130,246,0.10);  border-color: #3b82f6; color: #bfdbfe; }
.reading-callout-aviso   { background: rgba(245,158,11,0.10);  border-color: #f59e0b; color: #fde68a; }
.reading-callout-sucesso { background: rgba(16,185,129,0.10);  border-color: #10b981; color: #a7f3d0; }
.reading-callout-erro    { background: rgba(239,68,68,0.10);   border-color: #ef4444; color: #fecaca; }
.reading-table-wrap {
    overflow-x: auto;
    margin: 0 0 14px;
}
.reading-table {
    width: 100%;
    border-collapse: collapse;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
}
.reading-table th, .reading-table td {
    padding: 8px 12px;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
.reading-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
}
.reading-table tr:nth-child(even) td {
    background: rgba(255,255,255,0.02);
}

/* ═══════════ ENDEREÇOS PÚBLICOS — input do form + modal de seleção ═══════════ */
.address-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.address-input-row input[type=url] { flex: 1; min-width: 0; }
.address-input-row .btn { flex-shrink: 0; }
.form-hint {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

.address-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}
.address-new-form {
    padding: 12px;
    margin-bottom: 12px;
    background: rgba(99,102,241,0.06);
    border: 1px solid rgba(99,102,241,0.25);
    border-radius: var(--radius-sm);
}
.address-new-form.hidden { display: none; }
.address-summary {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.address-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 60vh;
    overflow-y: auto;
}
.address-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-tertiary, rgba(255,255,255,0.03));
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.address-row:hover {
    background: rgba(99,102,241,0.06);
    border-color: rgba(99,102,241,0.2);
}
.address-row-used {
    opacity: 0.65;
}
.address-row-used:hover {
    background: var(--bg-tertiary, rgba(255,255,255,0.03));
    border-color: transparent;
}
.address-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.address-dot-free {
    background: transparent;
    border: 2px solid var(--success, #10b981);
    width: 8px;
    height: 8px;
}
.address-info { flex: 1; min-width: 0; }
.address-url {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.address-meta { margin-top: 2px; }
.address-status {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 500;
}
.address-status.free { color: var(--success, #10b981); }
.address-status.used { color: var(--text-secondary); text-transform: none; letter-spacing: normal; font-weight: normal; }
.address-action-disabled {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
    flex-shrink: 0;
}
.address-del {
    color: var(--text-secondary);
    flex-shrink: 0;
}
.address-del:hover { color: var(--error, #ef4444); }

/* ═══════════ MODAL DE PERFIL DO USUÁRIO ═══════════ */
.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}
.profile-avatar-wrap {
    position: relative;
}
.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 36px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.profile-avatar.has-photo { background: transparent; }
.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.profile-avatar-actions {
    display: flex;
    gap: 8px;
}
.profile-avatar-hint {
    font-size: 11px;
    color: var(--text-secondary);
}
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

.profile-section + .profile-section {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}
.profile-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px;
}
.profile-hint {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}
.profile-color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s, border-color 0.15s;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 4px var(--accent);
}
/* Form helpers genéricos (caso ainda não existam — fallback seguro) */
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.form-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.form-input:focus {
    border-color: var(--accent);
}
.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ═══════════ PROJECT CARDS ═══════════ */
.project-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.project-card-color {
    width: 4px;
    border-radius: 4px;
    align-self: stretch;
    flex-shrink: 0;
}
.project-card-body { flex: 1; min-width: 0; }
.project-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.project-card-path {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--mono);
    margin-top: 4px;
}
.project-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.project-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--accent);
    transition: all var(--transition);
}
.project-link:hover { border-color: var(--accent); background: var(--accent-bg); }

/* Project modal items */
.project-modal-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
}
.project-modal-item:hover { background: var(--bg-hover); }
.project-modal-item.active { background: var(--accent-bg); }
.project-modal-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.project-modal-info { flex: 1; }
.project-modal-name { font-weight: 500; font-size: 14px; }
.project-modal-path { font-size: 12px; color: var(--text-muted); font-family: var(--mono); }

/* ═══════════ FILE BROWSER ═══════════ */
.filebrowser-path {
    padding: 8px 20px;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--accent);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}
.filebrowser-body {
    max-height: 400px;
    overflow-y: auto;
}
.filebrowser-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background var(--transition);
    font-size: 14px;
}
.filebrowser-item:hover { background: var(--bg-hover); }
.filebrowser-item svg { flex-shrink: 0; color: var(--text-muted); }
.filebrowser-item.is-dir svg { color: var(--warning); }
.filebrowser-item .fb-name { flex: 1; }
.filebrowser-item .fb-meta { font-size: 12px; color: var(--text-muted); }

/* ═══════════ MODALS ═══════════ */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    /* Centraliza o modal-content. Antes da v1.4.2 só o filebrowser tinha
       isso — o resto ficava encostado no canto superior esquerdo. */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}
/* Modais que abrem por cima de outros precisam de z-index maior */
#modal-filebrowser,
#modal-address-picker,
#modal-readings-batch,
#modal-confirm { z-index: 1100; }
.modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}
.modal-content {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.2s ease;
}
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 1100px; }
/* Modal maximizado — ocupa quase a tela inteira (toggle no header) */
.modal-content.maximized {
    max-width: none !important;
    max-height: none !important;
    width: 100%;
    height: 100%;
}
/* Mobile: modal sempre ocupa a tela toda */
@media (max-width: 768px) {
    .modal { padding: 0; }
    .modal-content,
    .modal-content.modal-lg,
    .modal-content.modal-xl {
        max-width: 100% !important;
        max-height: 100% !important;
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
    }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

/* ═══════════ COLOR OPTIONS ═══════════ */
.color-options { display: flex; gap: 8px; flex-wrap: wrap; }
.color-opt {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}
.color-opt:hover { transform: scale(1.15); }
.color-opt.active { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }

/* ═══════════ SETTINGS ═══════════ */
.settings-content { padding: 24px; max-width: 500px; }
.settings-section {
    margin-bottom: 32px;
}
.settings-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.settings-field {
    margin-bottom: 14px;
}
.settings-field label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.settings-field input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
}
.settings-field input:disabled {
    opacity: 0.6;
}
.settings-field input[type="number"] {
    max-width: 120px;
}
.field-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.7;
}

/* ═══════════ USAGE / CONSUMO ═══════════ */
.usage-content { padding: 20px; max-width: 900px; }
.usage-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.usage-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.usage-card-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.usage-card-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}
.usage-card-value.accent { color: var(--accent); }

/* Weekly usage */
.weekly-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(99,102,241,0.15);
    color: var(--accent);
}
.model-limit-bar {
    margin-bottom: 12px;
}
.model-limit-bar .bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 4px;
    color: var(--text-secondary);
}
.model-limit-bar .bar-label strong {
    color: var(--text-primary);
}
.model-limit-bar .bar-track {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}
.model-limit-bar .bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.model-limit-bar .bar-fill.green { background: #10b981; }
.model-limit-bar .bar-fill.yellow { background: #f59e0b; }
.model-limit-bar .bar-fill.red { background: #ef4444; }
.model-limit-bar .bar-pct {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    text-align: right;
}

.usage-section { margin-bottom: 24px; }
.usage-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}
.usage-table-wrap { overflow-x: auto; }
.usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.usage-table th {
    text-align: left;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.usage-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}
.usage-table td:not(:first-child) {
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    font-size: 12px;
}
.usage-table th:not(:first-child) { text-align: right; }
.usage-table tr:hover td { background: var(--bg-hover); }
.usage-table.pricing td { color: var(--text-secondary); }

/* ═══════════ EMPTY STATE ═══════════ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state p { font-size: 14px; }

/* ═══════════ FILTER BAR ═══════════ */
.filter-bar select {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

/* ═══════════ SESSION INFO BAR ═══════════ */
.session-info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    flex-shrink: 0;
}
.session-info-left {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    min-width: 0;
}
.session-info-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}
.session-info-dot.active {
    background: var(--success);
    animation: pulse 1.5s infinite;
}
.session-preview-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.session-preview-btn:hover {
    background: var(--accent-bg);
}

.session-info-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Cost indicator */
.cost-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--success);
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(16, 185, 129, 0.1);
    transition: color 0.3s, background 0.3s;
}
.cost-indicator svg { opacity: 0.7; }
.cost-indicator.cost-medium {
    color: var(--warning, #f59e0b);
    background: rgba(245, 158, 11, 0.1);
}
.cost-indicator.cost-high {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

/* Context meter */
.context-meter {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}
.context-meter-bar {
    width: 60px;
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: hidden;
}
.context-meter-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--success);
    transition: width 0.5s, background 0.5s;
    width: 0%;
}
.context-meter-fill.warning { background: var(--warning, #f59e0b); }
.context-meter-fill.critical { background: var(--error); }

/* Prompt history */
.prompt-history {
    border-bottom: 1px solid var(--border);
}
.prompt-history-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 20px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.prompt-history-toggle:hover { background: var(--bg-hover); }
.prompt-count {
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.prompt-history-chevron {
    margin-left: auto;
    transition: transform 0.2s;
}
.prompt-history.expanded .prompt-history-chevron {
    transform: rotate(180deg);
}
.prompt-history-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 0 20px 8px;
}
.prompt-history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    /* v1.5.3: clicável para restaurar texto no textarea */
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.prompt-history-item:hover {
    background: rgba(99,102,241,0.08);
}
.prompt-history-item:hover .ph-restore { opacity: 1; }
.prompt-history-item:last-child { border-bottom: none; }
.prompt-history-item .ph-restore {
    color: var(--accent);
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.15s;
    display: inline-flex;
    align-items: center;
}
.prompt-history-item .ph-time {
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 45px;
}
.prompt-history-item .ph-type {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    font-weight: 500;
}
.prompt-history-item .ph-type.initial {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
}
.prompt-history-item .ph-type.followup {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}
.prompt-history-item .ph-text {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.prompt-history-item .ph-files {
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
}

.project-info-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 20px;
    background: var(--accent-bg);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--accent);
    flex-shrink: 0;
}
.project-info-bar svg { opacity: 0.7; stroke: var(--accent); }
#project-info-name { font-weight: 600; }
.project-info-sep { opacity: 0.3; }
.project-info-path { color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; font-size: 11px; }

/* ═══════════ NEW SESSION MODAL ═══════════ */
.new-session-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
    margin-bottom: 4px;
}
.new-session-item:hover {
    background: var(--bg-hover);
}
.new-session-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.new-session-info {
    flex: 1;
    min-width: 0;
}
.new-session-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}
.new-session-path {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--mono);
}

/* ═══════════ HIDE MOBILE ═══════════ */
@media (max-width: 480px) {
    .hide-mobile { display: none !important; }
}

/* ═══════════ SHOW MOBILE ═══════════ */
.show-mobile { display: none !important; }
@media (max-width: 768px) {
    .show-mobile { display: inline-flex !important; }
}

/* Botões de rolagem do terminal — visíveis só em mobile, ativam scrollback do
   tmux mesmo quando o gesto de arrasto não funciona no device. */
.terminal-scroll-btn {
    background: var(--bg-tertiary, rgba(255,255,255,0.05));
}
.terminal-scroll-btn:hover {
    background: rgba(99,102,241,0.18);
}

/* Ícone que substitui o título "Terminal" no header da pane direita.
   Libera espaço para botões adicionais, especialmente no mobile. */
.terminal-title-icon {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary, #b4b4c8);
    flex-shrink: 0;
}

/* Toggle de leitura de tela — alterna entre "olho aberto" (lendo) e
   "olho cortado" (pausado). Default ligado (active). */
#btn-toggle-screen-read .screen-read-off { display: none; }
#btn-toggle-screen-read.off .screen-read-on { display: none; }
#btn-toggle-screen-read.off .screen-read-off { display: inline; }
#btn-toggle-screen-read.off { color: var(--text-tertiary, #707088); opacity: 0.7; }

/* ═══════════ ANIMATIONS ═══════════ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading::after {
    content: '';
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
}

/* ═══════════ TOAST ═══════════ */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 13px;
    animation: modalIn 0.3s ease;
    max-width: 320px;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); color: var(--error); }

/* ═══════════ 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(--border-light); }

/* ═══════════ ADMIN CARDS ═══════════ */
.admin-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
}
.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.admin-card-body {
    margin-top: 10px;
}
.admin-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-size: 12px;
    color: var(--text-muted);
}
.admin-card-meta code {
    font-size: 11px;
    background: var(--bg-tertiary);
    padding: 1px 4px;
    border-radius: 3px;
}
.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}
.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 12px;
}

/* ═══════════ RESPONSIVE ═══════════ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow);
    }
    .main-content {
        left: 0;
    }
    .topbar-brand span:not(.version-badge) { display: none; }
    .version-dropdown { width: 280px; }
    .mobile-tabs {
        display: flex;
    }
    .workspace-split {
        flex-direction: column;
        min-height: 0;
    }
    .prompt-panel {
        width: 100%;
        min-width: 0;
        max-width: none;
        border-right: none;
        flex: 1;
        min-height: 0;
    }
    .terminal-panel {
        display: none;
    }
    .prompt-panel.hidden-mobile { display: none; }
    .terminal-panel.visible-mobile {
        display: flex;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }
    .terminal-panel.visible-mobile .terminal-container {
        flex: 1;
        min-height: 0;
    }
    .session-list, .project-list, .history-list {
        padding: 12px 16px;
    }
    .view-header {
        padding: 14px 16px;
    }
    .settings-content {
        padding: 16px;
    }
    .project-selector {
        max-width: 160px;
    }
    /* Painel de pergunta compacto no mobile */
    .question-panel {
        padding: 8px 10px;
        flex-shrink: 0;
    }
    .question-title {
        font-size: 11px;
    }
    .qbtn {
        font-size: 12px;
        padding: 6px 10px;
        max-width: 100%;
    }
    /* Header do terminal compacto no mobile */
    .terminal-panel .panel-header {
        padding: 6px 10px;
        flex-wrap: wrap;
        gap: 4px;
    }
    /* Mobile: o botão flutuante já vem do estilo base (v1.4.3). Aqui só
       trocamos o texto "Sair (ESC)" por "Sair" — celular não tem tecla ESC. */
    .terminal-panel.fullscreen .btn-exit-fs span {
        font-size: 0;
    }
    .terminal-panel.fullscreen .btn-exit-fs span::before {
        content: 'Sair';
        font-size: 13px;
    }
    .terminal-header-left {
        min-width: 0;
        flex: 1;
        gap: 6px;
    }
    .terminal-actions {
        gap: 2px;
    }
    /* Controle de estender tempo compacto */
    .extend-time-control {
        margin-left: 4px;
    }
    /* Input bar sempre visível na parte inferior */
    .terminal-input-bar {
        padding: 8px 10px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        flex-shrink: 0;
        border-top: 1px solid var(--border);
    }
    .terminal-input-row {
        gap: 6px;
    }
    .terminal-input-bar input[type="text"] {
        min-width: 0;
        font-size: 14px;
        padding: 8px 10px;
    }
    .terminal-input-bar .btn {
        flex-shrink: 0;
        padding: 8px 14px;
        font-size: 13px;
    }
    .auto-approve-btn {
        flex-shrink: 0;
        width: 40px;
        height: 40px;
    }
    /* Footer do prompt com safe-area no mobile */
    .panel-footer {
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
    .panel-footer-row {
        gap: 8px;
    }
    #btn-auto-approve-prompt {
        width: 44px;
        height: 44px;
    }
    /* Scrollbar visível e touch-friendly no mobile */
    .terminal-container .xterm-viewport {
        -webkit-overflow-scrolling: touch;
    }
    .terminal-container .xterm-viewport::-webkit-scrollbar {
        width: 16px;
    }
    .terminal-container .xterm-viewport::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.4);
        border-radius: 8px;
        border: 3px solid transparent;
        background-clip: content-box;
    }
    .terminal-container .xterm-viewport::-webkit-scrollbar-thumb:hover {
        background: rgba(255,255,255,0.55);
        border: 3px solid transparent;
        background-clip: content-box;
    }
    .terminal-container .xterm-viewport::-webkit-scrollbar-track {
        background: rgba(255,255,255,0.06);
    }
    .terminal-container {
        touch-action: none;
    }
    .terminal-container .xterm-screen {
        touch-action: none;
    }
    .prompt-body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
    .toast { max-width: 100%; }
    /* Editor mobile */
    .editor-mobile-tabs {
        display: flex;
    }
    .editor-split {
        flex-direction: column;
    }
    .editor-files-panel {
        width: 100%;
        max-width: none;
        min-width: 0;
        border-right: none;
        flex: 1;
        min-height: 0;
    }
    .editor-files-panel.hidden-mobile { display: none; }
    .editor-code-panel { display: none; }
    .editor-code-panel.visible-mobile {
        display: flex;
        flex: 1;
        min-height: 0;
    }
    .editor-code-header {
        padding: 8px 12px;
    }
    .editor-status-bar {
        padding-bottom: max(4px, env(safe-area-inset-bottom));
    }
}

@media (max-width: 480px) {
    .prompt-panel .panel-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    /* Terminal header compacto em telas pequenas */
    .terminal-panel .panel-header {
        padding: 4px 8px;
    }
    .terminal-panel .panel-header h2 {
        font-size: 13px;
    }
    .terminal-status {
        font-size: 10px;
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .btn-reconnect {
        padding: 2px;
        margin-right: 4px;
    }
    .btn-reconnect svg {
        width: 11px;
        height: 11px;
    }
    /* Botão de modo mouse compacto */
    #btn-workspace-terminal-mouse {
        width: 32px;
        height: 32px;
    }
    /* Controle de estender tempo compacto em telas pequenas */
    .extend-time-control {
        margin-left: 2px;
    }
    .extend-time-input {
        width: 34px;
        padding: 2px 2px;
        font-size: 11px;
    }
    .btn-extend-time {
        padding: 2px 4px;
        font-size: 10px;
    }
    .btn-extend-time span {
        display: none;
    }
    /* Input bar em telas pequenas */
    .terminal-input-row {
        gap: 4px;
    }
    .terminal-input-bar .btn {
        padding: 8px 10px;
        font-size: 12px;
    }
    /* Botão attach menor */
    .terminal-attach-btn {
        display: none;
    }
}

/* ═══ EDITOR DE ARQUIVOS ═══ */
#view-editor.active { overflow: hidden; }
.editor-mobile-tabs {
    display: none;
    padding: 8px;
    gap: 4px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.editor-split {
    display: flex;
    flex: 1;
    overflow: hidden;
}
.editor-files-panel {
    width: 280px;
    min-width: 200px;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
}
.editor-files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.editor-files-header h2 {
    font-size: 14px;
    font-weight: 600;
}
.editor-breadcrumb {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    overflow-x: auto;
    white-space: nowrap;
    font-size: 12px;
    font-family: var(--mono);
    scrollbar-width: none;
}
.editor-breadcrumb::-webkit-scrollbar { display: none; }
.editor-crumb {
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.15s;
    flex-shrink: 0;
}
.editor-crumb:hover {
    color: var(--accent);
    background: var(--accent-bg);
}
.editor-crumb-sep {
    color: var(--text-muted);
    opacity: 0.4;
    flex-shrink: 0;
}
.editor-file-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.editor-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.editor-file-item:hover {
    background: var(--bg-hover);
}
.editor-file-item:active {
    background: var(--accent-bg);
}
.editor-file-item.active {
    background: var(--accent-bg);
    color: var(--accent);
}
.editor-file-item svg {
    flex-shrink: 0;
    color: var(--text-muted);
}
.editor-file-item.is-dir svg {
    color: var(--warning);
}
.editor-file-item .ef-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.editor-file-item .ef-meta {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.editor-code-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.editor-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 8px;
}
.editor-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}
.editor-filename {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--mono);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.editor-filesize {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.editor-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.editor-code-body {
    flex: 1;
    overflow: hidden;
    background: #0d0d0d;
    position: relative;
    min-height: 0;
}
.editor-code-body .cm-editor {
    height: 100%;
}
.editor-code-body .cm-scroller {
    -webkit-overflow-scrolling: touch;
}
.editor-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
}
.editor-placeholder svg { margin-bottom: 12px; opacity: 0.3; }
.editor-placeholder p { font-size: 13px; }
.editor-status-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 4px 16px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.editor-status-bar .editing {
    color: var(--accent);
    font-weight: 600;
}

/* ═══ Terminal (abas shell) ═══ */
.terminals-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    background: #0d0d0d;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #2a2a3a;
}
.terminal-tabs {
    display: flex;
    gap: 2px;
    background: #1a1a24;
    padding: 4px 4px 0 4px;
    overflow-x: auto;
    min-height: 34px;
    border-bottom: 1px solid #2a2a3a;
}
.terminal-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #23232f;
    color: #a0a0b0;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    border: 1px solid transparent;
    user-select: none;
}
.terminal-tab.active {
    background: #0d0d0d;
    color: #e4e4ef;
    border-color: #2a2a3a;
    border-bottom-color: #0d0d0d;
}
.terminal-tab .tab-close {
    opacity: 0.5;
    cursor: pointer;
    padding: 0 2px;
    border-radius: 2px;
}
.terminal-tab .tab-close:hover {
    opacity: 1;
    background: #ef4444;
    color: white;
}
.terminal-frames {
    flex: 1;
    position: relative;
}
.terminal-frames iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: none;
    background: #0d0d0d;
}
.terminal-frames iframe.active {
    display: block;
}
.terminal-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #606078;
    font-size: 14px;
}

/* ═══ GLOBAL LOADING OVERLAY ═══ */
.global-loading {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 20, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}
.global-loading.hidden { display: none; }
.global-loading-box {
    background: #1a1a2e;
    border: 1px solid #2a2a40;
    border-radius: 10px;
    padding: 28px 36px;
    min-width: 280px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.global-loading .spinner {
    width: 42px;
    height: 42px;
    margin: 0 auto 14px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.global-loading-text {
    color: #e4e4f0;
    font-size: 15px;
    font-weight: 500;
}
.global-loading-hint {
    color: #808098;
    font-size: 12px;
    margin-top: 6px;
    min-height: 16px;
}

/* ═══ BACKUPS ═══ */
.backup-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.backup-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid #2a2a40;
    border-radius: 6px;
}
.backup-item .meta {
    flex: 1;
    min-width: 0;
    font-size: 13px;
}
.backup-item .filename {
    font-family: ui-monospace, monospace;
    color: #e4e4f0;
    word-break: break-all;
}
.backup-item .note {
    color: #a0a0b8;
    font-size: 12px;
    margin-top: 2px;
    white-space: pre-wrap;
}
.backup-item .sub {
    color: #707088;
    font-size: 11px;
    margin-top: 4px;
}
.backup-item .actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.backup-item .actions .btn {
    padding: 5px 10px;
    font-size: 12px;
}

/* ═══ VOICE MIC BUTTON (barra inferior do textarea) ═══ */
.prompt-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
}
.voice-mic-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    height: 28px;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #818cf8;
    cursor: pointer;
    font-size: 12px;
    font-family: var(--sans);
    transition: all 0.2s;
}
.voice-mic-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
}
.prompt-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.prompt-tool-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
}
.prompt-tool-btn.loading {
    opacity: 0.5;
    pointer-events: none;
    animation: pulse 1s infinite;
}

/* ═══ VOICE MODAL ═══ */
.voice-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.voice-modal.hidden { display: none; }
.voice-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 20, 0.75);
    backdrop-filter: blur(3px);
}
.voice-dialog {
    position: relative;
    width: 560px;
    max-width: 95vw;
    max-height: 90vh;
    background: #1a1a2e;
    border: 1px solid #2a2a40;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.voice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #2a2a40;
}
.voice-header h3 {
    margin: 0;
    font-size: 16px;
    color: #e4e4f0;
}
.voice-close-btn {
    background: none;
    border: none;
    color: #808098;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
}
.voice-close-btn:hover { color: #e4e4f0; }

/* Record area */
.voice-record-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 18px 16px;
    gap: 8px;
}
.voice-rec-ring {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid rgba(99,102,241,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    color: #818cf8;
    background: rgba(99,102,241,0.08);
}
.voice-rec-ring:hover { border-color: #818cf8; background: rgba(99,102,241,0.15); }
.voice-rec-ring.recording {
    border-color: #ef4444;
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    animation: pulse-ring 1.5s infinite;
}
@keyframes pulse-ring {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    50% { box-shadow: 0 0 0 12px rgba(239,68,68,0); }
}
.voice-rec-status {
    font-size: 13px;
    color: #a0a0b8;
}
.voice-rec-timer {
    font-family: ui-monospace, monospace;
    font-size: 20px;
    color: #e4e4f0;
}

/* Waveform animation */
.voice-waveform {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 28px;
}
.voice-waveform span {
    width: 4px;
    border-radius: 2px;
    background: #ef4444;
    animation: wave 0.8s ease-in-out infinite;
}
.voice-waveform span:nth-child(1) { height: 8px; animation-delay: 0s; }
.voice-waveform span:nth-child(2) { height: 16px; animation-delay: 0.1s; }
.voice-waveform span:nth-child(3) { height: 24px; animation-delay: 0.2s; }
.voice-waveform span:nth-child(4) { height: 16px; animation-delay: 0.3s; }
.voice-waveform span:nth-child(5) { height: 8px; animation-delay: 0.4s; }
@keyframes wave {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
}

/* Transcription area */
.voice-transcription {
    padding: 0 18px 12px;
    flex: 1;
    overflow-y: auto;
}
.voice-transcription textarea {
    width: 100%;
    background: #12121e;
    border: 1px solid #2a2a40;
    border-radius: 6px;
    color: #e4e4f0;
    font-family: inherit;
    font-size: 13px;
    padding: 8px;
    resize: vertical;
    min-height: 60px;
}

/* Correction bar */
.voice-correction-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 0;
}
.voice-radio {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #a0a0b8;
}
.voice-radio input { accent-color: #6366f1; }

/* Corrected area */
.voice-corrected textarea {
    width: 100%;
    background: #12121e;
    border: 1px solid #2a2a40;
    border-radius: 6px;
    color: #e4e4f0;
    font-family: inherit;
    font-size: 13px;
    padding: 8px;
    resize: vertical;
    min-height: 60px;
    margin-top: 4px;
}

/* Player bar */
.voice-player-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0 0;
    flex-wrap: wrap;
}

/* Loading inside modal */
.voice-loading {
    position: absolute;
    inset: 0;
    background: rgba(26,26,46,0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 12px;
}
.voice-loading.hidden { display: none; }
.voice-loading .spinner {
    width: 36px;
    height: 36px;
    margin-bottom: 10px;
    border: 3px solid rgba(255,255,255,0.15);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
.voice-loading-text {
    color: #e4e4f0;
    font-size: 14px;
    font-weight: 500;
}
.voice-loading-hint {
    color: #808098;
    font-size: 12px;
    margin-top: 4px;
    min-height: 14px;
}

/* Footer */
.voice-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid #2a2a40;
}

/* ═══ DASHBOARD ═══ */
.dashboard-container {
    padding: 24px;
    max-width: 1100px;
    margin: 0 auto;
    overflow-y: auto;
    height: 100%;
}
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.dashboard-title {
    font-size: 22px;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0;
}
.dashboard-date {
    font-size: 13px;
    color: #808098;
    text-transform: capitalize;
}
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.dash-card {
    background: #1e1e2e;
    border: 1px solid #2a2a40;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.2s;
}
.dash-card:hover {
    border-color: #3a3a55;
}
.dash-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dash-card-sessions .dash-card-icon { background: rgba(99,102,241,0.15); color: #818cf8; }
.dash-card-projects .dash-card-icon { background: rgba(34,197,94,0.15); color: #4ade80; }
.dash-card-tokens .dash-card-icon  { background: rgba(251,191,36,0.15); color: #fbbf24; }
.dash-card-cost .dash-card-icon    { background: rgba(244,114,182,0.15); color: #f472b6; }
.dash-card-info {
    display: flex;
    flex-direction: column;
}
.dash-card-value {
    font-size: 26px;
    font-weight: 700;
    color: #e2e8f0;
    line-height: 1.1;
}
.dash-card-label {
    font-size: 12px;
    color: #808098;
    margin-top: 4px;
}
.dashboard-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
.dash-section {
    background: #1e1e2e;
    border: 1px solid #2a2a40;
    border-radius: 12px;
    padding: 18px;
}
.dash-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.dash-section-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0;
}
.dash-link {
    font-size: 12px;
    color: #818cf8;
    text-decoration: none;
}
.dash-link:hover { text-decoration: underline; }
.dash-recent-list, .dash-project-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dash-recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.dash-recent-item:hover { background: #252540; }
.dash-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dash-status.status-running { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.4); }
.dash-status.status-closed  { background: #64748b; }
.dash-recent-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.dash-recent-project {
    font-size: 13px;
    color: #e2e8f0;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-recent-time {
    font-size: 11px;
    color: #808098;
}
.dash-project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}
.dash-project-item:hover { background: #252540; }
.dash-proj-name {
    font-size: 13px;
    color: #e2e8f0;
    font-weight: 500;
}
.dash-proj-badge {
    font-size: 11px;
    color: #4ade80;
    background: rgba(74,222,128,0.12);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}
.dash-empty {
    font-size: 13px;
    color: #64748b;
    text-align: center;
    padding: 16px;
}
.dash-quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.dash-quick-actions .btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 768px) {
    .dashboard-container { padding: 16px; }
    .dashboard-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .dash-card { padding: 14px; gap: 10px; }
    .dash-card-value { font-size: 20px; }
    .dash-card-icon { width: 40px; height: 40px; }
    .dashboard-sections { grid-template-columns: 1fr; }
    .dashboard-header { flex-direction: column; align-items: flex-start; gap: 4px; }
}
@media (max-width: 480px) {
    .dashboard-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
    .dash-card { padding: 12px; }
    .dash-card-value { font-size: 18px; }
    .dash-card-label { font-size: 11px; }
    .dash-quick-actions { flex-direction: column; }
    .dash-quick-actions .btn { justify-content: center; }
}

/* ═══════════ CONTAS CLAUDE - MELHORIAS ═══════════ */
.accounts-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(245,158,11,0.08);
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}
.accounts-warning-icon { color: var(--warning); flex-shrink: 0; margin-top: 1px; }
.accounts-warning strong { color: var(--warning); display: block; margin-bottom: 2px; }

.account-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}
.account-card.auth-ok { border-left-color: var(--success); }
.account-card.auth-pending { border-left-color: var(--error); }
.account-card.inactive { opacity: 0.55; }

.account-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.account-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.account-card-title strong { font-size: 14px; }

.account-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

.account-card-body { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }

.account-session-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
}
.session-progress {
    flex: 1;
    height: 5px;
    background: var(--bg-tertiary);
    border-radius: 99px;
    overflow: hidden;
}
.session-progress-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.3s;
    background: var(--success);
}
.session-progress-fill.warn { background: var(--warning); }
.session-progress-fill.full { background: var(--error); }

.account-users-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
}
.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2px 10px 2px 6px;
    font-size: 12px;
    color: var(--text-secondary);
}
.user-pill-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.account-notes {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border-left: 2px solid var(--border);
}

.account-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 12px;
    color: var(--text-muted);
}
.account-meta-row code {
    font-size: 11px;
    background: var(--bg-tertiary);
    padding: 1px 4px;
    border-radius: 3px;
}

.view-header-actions { display: flex; gap: 8px; align-items: center; }

/* ═══════════ DASHBOARD - CONTA CLAUDE ═══════════ */
.dash-account-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--success);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.dash-account-card.dash-account-pending { border-left-color: var(--error); }
.dash-account-card.dash-account-none    { border-left-color: var(--error); }

.dash-account-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(99,102,241,0.12);
    color: #818cf8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dash-account-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dash-account-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.dash-account-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
.dash-account-sub {
    font-size: 12px;
    color: var(--text-muted);
}
.dash-account-sub code {
    font-size: 11px;
    background: var(--bg-tertiary);
    padding: 1px 4px;
    border-radius: 3px;
}
.dash-account-sessions {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 160px;
}
.dash-account-sessions-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

/* ═══════════ PROJECT TABS (abas de projetos na workspace) ═══════════ */
.project-tabs-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 6px 8px 0 8px;
    min-height: 38px;
    flex-shrink: 0;
}
.project-tabs-scroll {
    display: flex;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}
.project-tabs-scroll::-webkit-scrollbar { height: 4px; }
.project-tabs-scroll::-webkit-scrollbar-track { background: transparent; }
.project-tabs-scroll::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.project-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid transparent;
    border-bottom: none;
    user-select: none;
    max-width: 220px;
    transition: background var(--transition), color var(--transition);
}
.project-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.project-tab.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border);
}
.project-tab.project-tab-dragging { opacity: 0.4; }

.project-tab-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.project-tab-status {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
}
.project-tab-status.running {
    background: var(--success);
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.6);
}
.project-tab-status.idle { background: var(--warning); }
.project-tab-status.empty { background: var(--text-muted); opacity: 0.5; }

.project-tab-name {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.project-tab-close {
    opacity: 0.5;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 14px;
    line-height: 1;
    margin-left: 2px;
}
.project-tab-close:hover {
    opacity: 1;
    background: var(--error);
    color: white;
}

.project-tab-add,
.project-tab-overflow {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px dashed var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all var(--transition);
    flex-shrink: 0;
}
.project-tab-add:hover,
.project-tab-overflow:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-style: solid;
}
.project-tab-overflow {
    border-style: solid;
    border-color: var(--border);
}
.project-tabs-count {
    background: var(--accent-bg);
    color: var(--accent);
    padding: 0 5px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

/* Menu de contexto das abas */
.project-tab-context-menu {
    position: fixed;
    z-index: 2000;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 220px;
    padding: 4px;
    animation: modalIn 0.15s ease;
}
.project-tab-context-menu .ctx-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.project-tab-context-menu .ctx-menu-item:hover { background: var(--bg-hover); }
.project-tab-context-menu .ctx-menu-item.active {
    background: var(--accent-bg);
    color: var(--accent);
}
.project-tab-context-menu .ctx-menu-sep {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}
.project-tabs-overflow-menu { max-height: 60vh; overflow-y: auto; }

/* Mobile */
@media (max-width: 768px) {
    .project-tabs-bar {
        padding: 4px 6px 0 6px;
        min-height: 34px;
    }
    .project-tab {
        padding: 5px 8px;
        max-width: 140px;
    }
    .project-tab-name { max-width: 80px; }
}

/* ═══════════ CONFIRM / ALERT MODAL (App.confirm / App.alert) ═══════════ */
#modal-confirm {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 1200;
}
#modal-confirm.hidden { display: none; }
.modal-confirm-content {
    max-width: 420px;
}
.modal-confirm-message {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}
#modal-confirm .modal-footer .btn {
    min-width: 92px;
}

/* ═══════════ PAINEL FLUTUANTE DE PREVIEW (workspace) ═══════════ */
.ws-preview-panel {
    position: fixed;
    top: 90px;
    right: 24px;
    width: 720px;
    height: 520px;
    min-width: 360px;
    min-height: 280px;
    max-width: 96vw;
    max-height: 92vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 18px 48px rgba(0,0,0,0.55), 0 4px 12px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    z-index: 1200;
    overflow: hidden;
    animation: wsPreviewIn 0.16s ease-out;
}
.ws-preview-panel.hidden { display: none; }
.ws-preview-panel.minimized {
    height: 44px !important;
    min-height: 44px;
    resize: none;
}
.ws-preview-panel.minimized .ws-preview-toolbar,
.ws-preview-panel.minimized .ws-preview-body,
.ws-preview-panel.minimized .ws-preview-statusbar { display: none; }
.ws-preview-panel.maximized {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
}
@keyframes wsPreviewIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ws-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px 8px 14px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}
.ws-preview-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 0;
    flex: 1;
}
.ws-preview-title svg { color: var(--accent); flex-shrink: 0; }
.ws-preview-current {
    color: var(--text-secondary);
    font-weight: 400;
    font-family: var(--mono);
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.ws-preview-header-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.ws-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.ws-preview-tabs { display: flex; gap: 4px; }
.ws-preview-tab {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}
.ws-preview-tab:hover { color: var(--text-primary); background: var(--bg-hover); }
.ws-preview-tab.active {
    color: var(--accent);
    background: var(--accent-bg);
    border-color: var(--accent);
}
.ws-preview-actions { display: flex; gap: 4px; align-items: center; }
.ws-preview-body {
    display: flex;
    flex: 1;
    min-height: 0;
    background: var(--bg-primary);
}
.ws-preview-files {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--bg-secondary);
    overflow: hidden;
}
.ws-preview-files.hidden { display: none; }
.ws-preview-files-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.ws-preview-path {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: rtl;
    text-align: left;
    flex: 1;
    min-width: 0;
}
.ws-preview-files-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}
.ws-preview-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12.5px;
    color: var(--text-primary);
    user-select: none;
}
.ws-preview-file-item:hover { background: var(--bg-hover); }
.ws-preview-file-item.active {
    background: var(--accent-bg);
    color: var(--accent);
}
.ws-preview-file-item svg { flex-shrink: 0; color: var(--text-muted); }
.ws-preview-file-item.is-dir svg { color: var(--accent); }
.ws-preview-file-item .wpf-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.ws-preview-file-item .wpf-meta {
    color: var(--text-muted);
    font-size: 10.5px;
    flex-shrink: 0;
}
.ws-preview-content {
    flex: 1;
    min-width: 0;
    position: relative;
    background: var(--bg-primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.ws-preview-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    padding: 24px;
    gap: 10px;
}
.ws-preview-empty svg { opacity: 0.45; }
.ws-preview-empty p { font-size: 13px; line-height: 1.55; max-width: 360px; }
.ws-preview-empty .ws-preview-hint { font-size: 11.5px; color: var(--text-muted); }
.ws-preview-iframe {
    flex: 1;
    border: 0;
    width: 100%;
    height: 100%;
    background: #fff;
}
.ws-preview-iframe.hidden { display: none; }
.ws-preview-editor {
    flex: 1;
    overflow: auto;
    min-height: 0;
}
.ws-preview-editor.hidden { display: none; }
.ws-preview-editor .cm-editor { height: 100%; }
.ws-preview-statusbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-secondary);
    position: relative;
    flex-shrink: 0;
}
.ws-preview-statusbar #ws-preview-status-mode.editing { color: var(--warning); font-weight: 600; }
.ws-preview-statusbar #ws-preview-status-mode.saved { color: var(--success); }
.ws-preview-resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    background:
        linear-gradient(135deg, transparent 50%, var(--text-muted) 50%, var(--text-muted) 60%, transparent 60%, transparent 70%, var(--text-muted) 70%, var(--text-muted) 80%, transparent 80%);
    opacity: 0.55;
}
.ws-preview-resize-handle:hover { opacity: 1; }
@media (max-width: 768px) {
    .ws-preview-panel {
        top: 8px;
        right: 8px;
        left: 8px;
        bottom: 8px;
        width: auto !important;
        height: auto !important;
        max-width: none;
        max-height: none;
    }
    .ws-preview-files { width: 160px; }
    .ws-preview-current { display: none; }
}

/* ═══ MARKDOWN VIEWER ═══ */
.md-viewer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 8, 14, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    animation: mdFadeIn 160ms ease-out;
}
.md-viewer-overlay.hidden { display: none; }
@keyframes mdFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.md-viewer {
    width: min(960px, 100%);
    height: min(86vh, 920px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55), 0 6px 18px rgba(0, 0, 0, 0.35);
    transition: width 180ms ease, height 180ms ease;
}
.md-viewer.maximized {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    max-width: none;
}
.md-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.md-viewer-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    min-width: 0;
}
.md-viewer-title svg { color: var(--accent); flex-shrink: 0; }
.md-viewer-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-weight: 500;
    color: var(--text-secondary);
}
.md-viewer-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.md-viewer-tts-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.md-viewer-tts-bar.hidden { display: none; }
.md-viewer-tts-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}
.md-viewer-tts-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: mdSpin 0.8s linear infinite;
}
.md-viewer-tts-bar.tts-ready .md-viewer-tts-spinner { display: none; }
.md-viewer-tts-bar.tts-error .md-viewer-tts-spinner { border-top-color: var(--error); }
.md-viewer-tts-bar.tts-ready #md-viewer-tts-status { color: var(--success); }
.md-viewer-tts-bar.tts-error #md-viewer-tts-status { color: var(--error); }
@keyframes mdSpin { to { transform: rotate(360deg); } }
.md-viewer-tts-progress {
    height: 3px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
}
.md-viewer-tts-progress > div {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    transition: width 200ms ease;
}
.md-viewer-tts-bar.tts-ready .md-viewer-tts-progress > div { background: var(--success); }
#md-viewer-audio {
    width: 100%;
    height: 36px;
    margin-top: 4px;
}
.md-viewer-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-primary);
    padding: 28px clamp(16px, 5vw, 56px);
}
.md-content {
    max-width: 760px;
    margin: 0 auto;
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    line-height: 1.72;
    word-wrap: break-word;
}
.md-content > *:first-child { margin-top: 0; }
.md-content > *:last-child { margin-bottom: 0; }
.md-content h1, .md-content h2, .md-content h3,
.md-content h4, .md-content h5, .md-content h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.3;
    margin: 1.6em 0 0.6em;
    letter-spacing: -0.01em;
}
.md-content h1 {
    font-size: 2em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.35em;
    margin-top: 0.4em;
}
.md-content h2 {
    font-size: 1.5em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.3em;
}
.md-content h3 { font-size: 1.22em; }
.md-content h4 { font-size: 1.06em; }
.md-content h5 { font-size: 0.96em; color: var(--text-secondary); }
.md-content h6 { font-size: 0.88em; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.md-content p { margin: 0 0 1em; }
.md-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(99, 102, 241, 0.4);
    transition: border-color 120ms;
}
.md-content a:hover { border-bottom-color: var(--accent); }
.md-content strong { color: var(--text-primary); font-weight: 600; }
.md-content em { color: var(--text-primary); }
.md-content ul, .md-content ol {
    margin: 0 0 1em;
    padding-left: 1.6em;
}
.md-content li { margin: 0.25em 0; }
.md-content li > p { margin: 0.4em 0; }
.md-content li::marker { color: var(--accent); }
.md-content blockquote {
    margin: 1em 0;
    padding: 0.6em 1em;
    border-left: 3px solid var(--accent);
    background: var(--accent-bg);
    color: var(--text-secondary);
    border-radius: 0 6px 6px 0;
}
.md-content blockquote > *:first-child { margin-top: 0; }
.md-content blockquote > *:last-child { margin-bottom: 0; }
.md-content code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.88em;
    background: var(--bg-elevated);
    color: #f3a86b;
    padding: 0.15em 0.42em;
    border-radius: 4px;
    border: 1px solid var(--border);
}
.md-content pre {
    margin: 1em 0;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.55;
}
.md-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-primary);
    font-size: inherit;
    border-radius: 0;
}
.md-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2em 0;
}
.md-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.95em;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.md-content thead { background: var(--bg-tertiary); }
.md-content th, .md-content td {
    padding: 8px 12px;
    border: 1px solid var(--border);
    text-align: left;
}
.md-content th { font-weight: 600; color: var(--text-primary); }
.md-content tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
.md-content img {
    max-width: 100%;
    border-radius: 6px;
    display: block;
    margin: 1em auto;
}
.md-content input[type="checkbox"] {
    margin-right: 6px;
    accent-color: var(--accent);
}
.md-content kbd {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.82em;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-bottom-width: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-primary);
}
@media (max-width: 768px) {
    .md-viewer-overlay { padding: 8px; }
    .md-viewer { width: 100%; height: 100%; max-height: none; }
    .md-viewer-body { padding: 16px; }
    .md-content { font-size: 14.5px; }
}
