/**
 * CELESTE OCR 7B — ESTILOS VISUALES (EDICIÓN MULTIMODAL CON VISIÓN & RAG)
 * ai.spsuy.com · SPS (Sovereign Platform System) · UDE 2026
 */

:root {
    --bg-main: #070d18;
    --bg-surface: #0e1726;
    --bg-surface-elevated: #142136;
    --bg-input: #0a1120;
    --border-color: #1e2f4d;
    --border-subtle: #16243b;
    --border-focus: #38bdf8;
    
    --celeste-primary: #0284c7;
    --celeste-hover: #0369a1;
    --celeste-glow: rgba(56, 189, 248, 0.25);
    --celeste-light: #38bdf8;
    --celeste-soft: #e0f2fe;

    --purple-accent: #8b5cf6;
    --purple-hover: #7c3aed;
    --purple-glow: rgba(139, 92, 246, 0.35);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --status-online: #10b981;
    --status-warning: #f59e0b;
    --status-error: #ef4444;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(2, 132, 199, 0.2);
    --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    height: 100dvh;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* PANTALLA LOGIN */
.auth-body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 20%, #161c36 0%, #070d18 70%);
    padding: 16px;
    overflow-y: auto;
}

.auth-container {
    width: 100%;
    max-width: 460px;
    margin: auto;
}

.auth-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px 26px;
    box-shadow: var(--shadow-card), var(--shadow-glow);
    backdrop-filter: blur(10px);
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.35);
    color: #c4b5fd;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.logo-box {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff;
    margin-bottom: 6px;
}

.logo-accent {
    color: var(--celeste-light);
    text-shadow: 0 0 16px rgba(56, 189, 248, 0.5);
}

.auth-tagline {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.hardware-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.74rem;
    color: var(--text-muted);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--status-online);
    box-shadow: 0 0 8px var(--status-online);
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.field-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
    font-family: inherit;
    user-select: none;
}

.btn-primary {
    background-color: var(--celeste-primary);
    color: #ffffff;
    padding: 11px 18px;
    font-size: 0.92rem;
}

.btn-primary:hover {
    background-color: var(--celeste-hover);
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 13px 20px;
    font-size: 0.96rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-surface-elevated);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.78rem;
}

.btn-secondary {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
    color: #fff;
}

/* BOTÓN NARANJA DESTACADO */
.btn-warning {
    background-color: #ea580c !important;
    border: 1px solid #f97316 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 10px rgba(234, 88, 12, 0.4) !important;
}

.btn-warning:hover {
    background-color: #c2410c !important;
    border-color: #fb923c !important;
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.6) !important;
    color: #ffffff !important;
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    margin-bottom: 16px;
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.preset-credentials-box {
    margin-top: 18px;
    padding: 14px;
    background: var(--bg-surface-elevated);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.preset-title {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--celeste-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.preset-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.preset-badge {
    background: rgba(2, 132, 199, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: var(--text-primary);
    padding: 5px 9px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.preset-badge:hover {
    background: rgba(2, 132, 199, 0.25);
    border-color: var(--celeste-light);
}

.auth-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.auth-meta-row {
    display: flex;
    justify-content: space-around;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.auth-meta-row strong {
    color: var(--text-secondary);
}

.auth-disclaimer {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ==========================================================================
   DASHBOARD SPLIT-SCREEN (APP)
   ========================================================================== */

.app-body {
    height: 100vh;
    height: 100dvh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-header {
    height: 56px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flag-pill {
    font-size: 1.15rem;
}

.brand-text h1 {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #fff;
    line-height: 1.1;
}

.brand-text .subtext {
    font-size: 0.68rem;
    color: var(--celeste-light);
    font-weight: 500;
}

.system-status-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-indicator.online {
    background-color: var(--status-online);
    box-shadow: 0 0 6px var(--status-online);
}

.status-indicator.pending {
    background-color: var(--status-warning);
    box-shadow: 0 0 6px var(--status-warning);
}

.status-indicator.offline {
    background-color: var(--status-error);
    box-shadow: 0 0 6px var(--status-error);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    padding: 3px 10px 3px 5px;
    border-radius: 999px;
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--celeste-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.user-chip.is-admin .user-avatar {
    background-color: var(--purple-accent);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
}

.user-role {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.mobile-tabs {
    display: none;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--celeste-light);
    border-bottom-color: var(--celeste-light);
    background: rgba(56, 189, 248, 0.05);
}

/* WORKSPACE SPLIT-SCREEN */
.split-workspace {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background-color: var(--border-color);
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.panel {
    background-color: var(--bg-main);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    min-height: 0;
}

/* ==========================================================================
   EL SWITCH DE MODOS: LIENZO RAG vs. OCR & VISIÓN
   ========================================================================== */
.mode-switch-bar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 6px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.mode-switch-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.mode-switch-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.mode-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface-elevated);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    color: var(--text-primary);
    border-color: var(--celeste-light);
}

.mode-btn.active {
    background: rgba(2, 132, 199, 0.25);
    border-color: var(--celeste-light);
    color: #fff;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.mode-view {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.mode-view.active {
    display: flex;
}

.panel-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

.panel-title-block h2 {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--text-primary);
}

.title-with-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.badge-accent {
    font-size: 0.65rem;
    background: rgba(2, 132, 199, 0.2);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: var(--celeste-light);
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 600;
}

.badge-ocr {
    font-size: 0.65rem;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: #c4b5fd;
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 600;
}

.badge-model {
    font-size: 0.65rem;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 600;
}

.panel-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.highlight-btn {
    background-color: var(--celeste-primary);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.35);
}

/* ÁREA DEL LIENZO */
.canvas-editor-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-surface);
    min-height: 0;
}

.canvas-textarea {
    width: 100%;
    height: 100%;
    border: none;
    padding: 16px;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    white-space: pre-wrap;
    word-break: break-word;
}

.canvas-footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 7px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.canvas-meta {
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.canvas-meta .separator {
    margin: 0 4px;
}

.save-status {
    color: var(--celeste-light);
    font-weight: 500;
}

/* ==========================================================================
   VISTA OCR Y FOTOGRAFÍA / PDF
   ========================================================================== */
.ocr-body-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: #09101d;
}

.ocr-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.ocr-dropzone:hover, .ocr-dropzone.dragover {
    border-color: var(--celeste-light);
    background: var(--bg-surface-elevated);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.15);
}

.dropzone-icon {
    font-size: 2.2rem;
}

.ocr-dropzone h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dropzone-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    max-width: 380px;
}

.dropzone-buttons {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.dropzone-limits {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* TARJETA DE VISTA PREVIA */
.document-preview-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeIn 0.2s ease-out;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.preview-type-badge {
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(139, 92, 246, 0.25);
    color: #c4b5fd;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.preview-filename {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-remove-file {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    line-height: 1;
}

.btn-remove-file:hover {
    color: var(--status-error);
}

.preview-content-box {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    max-height: 240px;
    overflow: hidden;
}

.preview-content-box img {
    max-width: 100%;
    max-height: 220px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.pdf-big-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 4px;
}

.pdf-info-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

.ocr-instruction-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ocr-instruction-box label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.ocr-instruction-box input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
}

.ocr-instruction-box input:focus {
    outline: none;
    border-color: var(--border-focus);
}

/* ==========================================================================
   ÁREA DEL CHAT
   ========================================================================== */
.panel-chat {
    background-color: #080f1d;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.quick-chips {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 7px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}

.chip-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.chip {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    font-family: inherit;
}

.chip:hover {
    background: var(--border-color);
    color: var(--celeste-light);
    border-color: var(--celeste-light);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    min-height: 0;
}

.message {
    display: flex;
    gap: 10px;
    max-width: 94%;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.message-user .message-avatar {
    background-color: var(--celeste-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: calc(100% - 38px);
}

.message-user .message-content {
    align-items: flex-end;
}

.message-author {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.time-stamp {
    opacity: 0.7;
    font-family: var(--font-mono);
}

.message-text {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.86rem;
    color: var(--text-primary);
    line-height: 1.55;
    word-break: break-word;
}

.message-user .message-text {
    background-color: var(--celeste-primary);
    border-color: var(--celeste-hover);
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.message-assistant .message-text {
    border-bottom-left-radius: 2px;
    background-color: var(--bg-surface-elevated);
}

.message-text p {
    margin-bottom: 6px;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text ul, .message-text ol {
    margin-left: 18px;
    margin-bottom: 6px;
}

.message-text strong {
    color: #fff;
    font-weight: 700;
}

.message-text pre {
    background: #050a12;
    padding: 10px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    margin: 8px 0;
    border: 1px solid var(--border-subtle);
}

.message-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: #38bdf8;
    background: rgba(14, 165, 233, 0.08);
    border: 1px solid rgba(14, 165, 233, 0.25);
    border-radius: 6px;
    padding: 3px 8px;
    font-family: var(--font-mono, monospace);
    margin-top: 6px;
    font-weight: 500;
}

/* BOTÓN PARA INYECTAR EXTRACCIÓN OCR AL LIENZO */
.inject-canvas-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.4);
    color: #c4b5fd;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.inject-canvas-btn:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: #a78bfa;
    color: #fff;
}

/* COLA / SPINNER */
.queue-indicator {
    padding: 10px 16px;
    background: rgba(139, 92, 246, 0.1);
    border-top: 1px solid rgba(139, 92, 246, 0.25);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.queue-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-top-color: #a78bfa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.queue-text {
    display: flex;
    flex-direction: column;
}

.queue-text strong {
    font-size: 0.78rem;
    color: #c4b5fd;
}

.queue-text span {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* CAJA DE ENTRADA DEL CHAT */
.chat-input-area {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 10px 14px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.chat-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.camera-shortcut-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    resize: none;
    max-height: 110px;
    outline: none;
    line-height: 1.4;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--border-focus);
}

.send-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
}

.input-hint {
    margin-top: 5px;
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* ==========================================================================
   RESPONSIVE DESIGN (MÓVILES)
   ========================================================================== */
@media (max-width: 900px) {
    .app-header {
        height: 50px;
        padding: 0 12px;
    }

    .brand-text h1 {
        font-size: 0.95rem;
    }

    .brand-text .subtext {
        display: none;
    }

    .system-status-chip {
        padding: 2px 7px;
    }

    .status-label {
        display: none;
    }

    .user-chip {
        padding: 2px 8px 2px 4px;
    }

    .user-role {
        display: none;
    }

    .mobile-tabs {
        display: flex;
    }

    .split-workspace {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }

    .panel {
        display: none;
        flex: 1;
        height: 100%;
        min-height: 0;
    }

    .panel.active-tab {
        display: flex;
    }

    .panel-header {
        padding: 8px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .panel-actions {
        width: 100%;
        justify-content: flex-start;
        gap: 6px;
    }

    .btn-sm {
        padding: 5px 8px;
        font-size: 0.74rem;
    }

    .chat-messages {
        padding: 12px;
        gap: 10px;
    }

    .message {
        max-width: 96%;
    }

    .input-hint {
        display: none;
    }

    .chat-input-area {
        padding: 8px 10px;
        padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
    }
}

/* ==========================================================================
   INPUT FORM, SPINNER Y HELPER PARA CHAT RAG Y OCR
   ========================================================================== */
.chat-input-form {
    background-color: var(--bg-surface, #0e1726);
    border-top: 1px solid var(--border-color, #1e2f4d);
    padding: 10px 14px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    width: 100%;
}

.chat-input {
    flex: 1;
    background-color: var(--bg-input, #0a1120);
    border: 1px solid var(--border-color, #1e2f4d);
    border-radius: var(--radius-sm, 6px);
    padding: 9px 12px;
    color: var(--text-primary, #f8fafc);
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    max-height: 110px;
    outline: none;
    line-height: 1.4;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--border-focus, #38bdf8);
}

.send-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    flex-shrink: 0;
    border-radius: var(--radius-sm, 6px);
    background: var(--celeste-primary, #0284c7);
    color: #fff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.send-btn:hover {
    background: var(--celeste-hover, #0369a1);
}

.input-helper {
    font-size: 0.72rem;
    color: var(--text-muted, #64748b);
    margin-top: 4px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(56, 189, 248, 0.2);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
