/* ==========================================================================
   OCR VISION // MODERN CLEAN DESIGN SYSTEM
   Sistema de Extracción de Documentos con IA Multi-Rubro
   ========================================================================== */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --bg-subtle: #f1f5f9;
    --bg-subtle-hover: #e2e8f0;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-focus: #3b82f6;
    
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace, Consolas;
}

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

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    padding: 18px 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 1400px;
    width: 96%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.app-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px 20px;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 24px;
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

.brand-logo h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.header-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 600;
}

.status-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 2px var(--success-bg);
}

/* ==========================================================================
   MAIN CARD & SHARED STYLES
   ========================================================================== */

.main-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Inputs & Form Elements */
.field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    display: block;
    margin-bottom: 6px;
}

.field-label-sm {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.input-text {
    width: 100%;
    padding: 9px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-main);
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-text:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.input-xs {
    padding: 5px 8px;
    font-size: 12px;
}

.input-textarea {
    width: 100%;
    padding: 8px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-main);
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.input-textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-hint {
    font-size: 11px;
    color: var(--text-subtle);
    margin-top: 4px;
    display: block;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(37, 99, 235, 0.35);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--bg-subtle);
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-subtle-hover);
    border-color: #cbd5e1;
}

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border-color);
}

.btn-outline:hover {
    color: var(--text-main);
    background: var(--bg-subtle);
    border-color: #cbd5e1;
}

.btn-subtle {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-weight: 500;
}

.btn-subtle:hover {
    text-decoration: underline;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}

/* ==========================================================================
   CONFIGURACIÓN DEL RUBRO Y PROMPT
   ========================================================================== */

.section-config {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.25s ease;
}

.config-header {
    padding: 10px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #ffffff;
    user-select: none;
    border-bottom: 1px solid transparent;
    transition: background 0.2s;
}

.config-header:hover {
    background: #f8fafc;
}

.section-config.expanded .config-header {
    border-bottom-color: var(--border-color);
}

.config-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.config-icon {
    font-size: 18px;
    width: 32px;
    height: 32px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.config-title-group h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-active-pill {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: 9999px;
}

.config-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.config-collapse-btn {
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--primary-light);
    border-radius: 9999px;
    border: 1px solid var(--primary-border);
}

.toggle-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.config-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #fdfdfd;
}

/* Rubro Pills */
.rubro-selector-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rubro-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rubro-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.rubro-pill:hover {
    border-color: var(--primary-border);
    background: var(--primary-light);
    color: var(--primary);
    transform: translateY(-1px);
}

.rubro-pill.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* Config Tabs */
.config-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

.tab-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Visual Builder Grid */
.visual-builder-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.builder-section {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-sub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sub-header-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Field Groups */
.fields-groups-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.field-group-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.field-group-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.group-remove-btn {
    background: none;
    border: none;
    color: var(--text-subtle);
    cursor: pointer;
    font-size: 13px;
    padding: 2px;
}

.group-remove-btn:hover {
    color: var(--danger);
}

/* Chips */
.chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 3px 10px;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-main);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.chip-remove {
    cursor: pointer;
    color: var(--text-subtle);
    font-weight: bold;
    font-size: 13px;
    line-height: 1;
}

.chip-remove:hover {
    color: var(--danger);
}

.add-chip-inline {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.add-chip-inline input {
    max-width: 200px;
}

/* Toggle Switch */
.toggle-switch-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch-label input {
    display: none;
}

.toggle-switch {
    width: 38px;
    height: 20px;
    background: #cbd5e1;
    border-radius: 9999px;
    position: relative;
    transition: background 0.2s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.toggle-switch-label input:checked + .toggle-switch {
    background: var(--primary);
}

.toggle-switch-label input:checked + .toggle-switch::after {
    transform: translateX(18px);
}

.table-config-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 6px;
}

.inline-field-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inline-field-row input {
    max-width: 220px;
}

/* Rules & Checkboxes */
.rules-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--text-main);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    cursor: pointer;
}

/* Raw Editor */
.raw-prompt-editor-container {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.override-checkbox {
    color: var(--primary);
}

.editor-actions {
    display: flex;
    gap: 8px;
}

.code-textarea {
    width: 100%;
    background: #0f172a;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid #1e293b;
    outline: none;
    white-space: pre;
    tab-size: 2;
    resize: vertical;
}

.code-textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.prompt-length-badge {
    background: var(--bg-subtle);
    padding: 2px 8px;
    border-radius: 9999px;
    font-family: var(--font-mono);
}

/* Config Footer Bar */
.config-footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.config-status-msg {
    font-size: 12px;
    font-weight: 500;
    color: var(--success);
}

.config-buttons {
    display: flex;
    gap: 8px;
}

/* ==========================================================================
   DROPZONE & UPLOAD
   ========================================================================== */

.section-upload {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.upload-dropzone {
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.upload-icon-wrapper {
    width: 60px;
    height: 60px;
    background: var(--bg-subtle);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.upload-svg {
    width: 30px;
    height: 30px;
}

.upload-dropzone h2 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-main);
}

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

.clipboard-hint {
    font-size: 12px;
    color: var(--text-subtle);
}

.clipboard-hint strong {
    color: var(--text-muted);
}

/* Preview */
.preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.preview-image-box {
    max-height: 280px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    box-shadow: var(--shadow-sm);
}

.preview-image-box img {
    max-height: 280px;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.preview-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.preview-file-details {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.file-status-badge {
    background: var(--success-bg);
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 9999px;
}

.preview-actions {
    display: flex;
    gap: 10px;
}

/* Samples Picker */
.samples-picker {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.samples-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.samples-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sample-chip {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 4px 10px;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.sample-chip:hover {
    background: var(--primary-light);
    border-color: var(--primary-border);
    color: var(--primary);
}

/* ==========================================================================
   PROGRESS BAR
   ========================================================================== */

.section-progress {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
}

.progress-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.spinner-inline {
    width: 24px;
    height: 24px;
    border: 3px solid var(--primary-light);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-texts {
    display: flex;
    flex-direction: column;
}

.progress-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.progress-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--bg-subtle);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa, var(--primary));
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 9999px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   RESULTS SECTION (ADAPTIVE & DYNAMIC)
   ========================================================================== */

.section-results {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.results-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.results-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.results-heading h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.time-badge {
    background: var(--success-bg);
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 9999px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.rubro-applied-badge {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 9999px;
    border: 1px solid var(--primary-border);
}

.results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.info-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.card-title {
    background: #ffffff;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-content {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.info-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.info-value {
    font-size: 13px;
    color: var(--text-main);
    font-weight: 500;
    word-break: break-word;
}

.font-mono {
    font-family: var(--font-mono);
}

/* Dynamic Table Card */
.table-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table-card-header {
    background: #ffffff;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.items-count-badge {
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    background: var(--bg-subtle);
    color: var(--text-muted);
    padding: 10px 14px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--bg-subtle);
}

/* Totales & Summary Badges */
.totals-and-raw {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.totals-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.total-badge-box {
    background: var(--bg-card);
    border: 2px solid var(--primary-border);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.total-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.total-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    font-family: var(--font-mono);
    word-break: break-all;
}

.raw-json-details {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    background: var(--bg-subtle);
    font-size: 13px;
    cursor: pointer;
}

.raw-json-details summary {
    font-weight: 600;
    color: var(--text-muted);
    outline: none;
}

.raw-json-code {
    margin-top: 10px;
    background: #0f172a;
    color: #38bdf8;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    overflow-x: auto;
    max-height: 280px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.app-footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-subtle);
    padding: 10px;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 640px) {
    body {
        padding: 12px 8px;
    }
    
    .app-header {
        padding: 16px;
    }
    
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .config-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .config-header-actions {
        align-self: flex-end;
    }
    
    .results-top-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .results-actions {
        width: 100%;
    }
    
    .results-actions button {
        flex: 1;
    }
}

/* ==========================================================================
   GESTIÓN DE BASE DE DATOS MYSQL Y PLANTILLAS DE PROMPTS
   ========================================================================== */

.header-badges-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.db-badge {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
    transition: all 0.2s ease;
    cursor: default;
}

.db-badge.connected {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.db-badge.disconnected {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.db-dot {
    background: #94a3b8;
}

.db-dot.connected {
    background: var(--success);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.db-dot.disconnected {
    background: var(--warning);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
}

.rubro-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 2px;
}

.prompt-manage-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-danger-subtle {
    color: #dc2626;
    border-color: #fecaca;
    background: #fff5f5;
}

.btn-danger-subtle:hover {
    background: #fee2e2;
    border-color: #f87171;
    color: #b91c1c;
}

.btn-save-db {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
    font-weight: 600;
}

.btn-save-db:hover {
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

.rubro-pill .pill-tag {
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.06);
    font-weight: 600;
    margin-left: 2px;
}

.rubro-pill.active .pill-tag {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.custom-pill-tag {
    background: #fef3c7 !important;
    color: #92400e !important;
}

.rubro-pill.active .custom-pill-tag {
    background: #fbbf24 !important;
    color: #78350f !important;
}

/* Modal Dialog Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: fadeInModal 0.15s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    overflow: hidden;
    animation: scaleUpModal 0.15s ease-out;
}

@keyframes scaleUpModal {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 6px;
}

.modal-close-btn:hover {
    color: var(--text-main);
    background: var(--bg-subtle);
}

.modal-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--bg-subtle);
    flex-shrink: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-select {
    width: 100%;
    padding: 9px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-main);
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    cursor: pointer;
}

.input-select:focus {
    border-color: var(--border-focus);
}

.emoji-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-icon-preview {
    width: 50px !important;
    text-align: center;
    font-size: 20px;
    padding: 4px;
}

.emoji-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.emoji-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.emoji-chip:hover {
    background: var(--primary-light);
    border-color: var(--primary-border);
    transform: scale(1.1);
}

/* ==========================================================================
   MODO OPERACIÓN: INDIVIDUAL VS LOTE EN PARALELO (guia_tecnica.md)
   ========================================================================== */

.operation-mode-bar {
    display: flex;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.mode-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.mode-tab-btn:hover {
    background: var(--bg-subtle);
}

.mode-tab-btn.active {
    background: #ffffff;
    border-color: var(--primary-border);
    box-shadow: var(--shadow-md);
}

.mode-icon {
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
}

.mode-tab-btn.active .mode-icon {
    background: var(--primary-light);
}

.mode-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    display: block;
}

.mode-desc {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
}

.mode-badge-pill {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    padding: 4px 10px;
    border-radius: 999px;
}

/* ==========================================================================
   PANEL UNIFICADO DE AUDITORÍA EN LOTE (COMPACT & MODERN)
   ========================================================================== */

.section-batch {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.batch-control-panel {
    background: var(--bg-card);
    border: 1px dashed var(--primary-border);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.batch-control-panel.drag-over {
    border-color: var(--primary);
    background: #f0f7ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.batch-panel-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.concurrency-selector-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.concurrency-selector-inline .concurrency-icon {
    font-size: 18px;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.concurrency-texts {
    display: flex;
    align-items: center;
    gap: 8px;
}

.concurrency-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
}

.concurrency-select {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    cursor: pointer;
}

.concurrency-select:focus {
    border-color: var(--primary);
}

.batch-panel-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.batch-prompt-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.batch-drag-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.batch-summary-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.batch-files-badge {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    padding: 4px 10px;
    border-radius: 9999px;
}

.batch-size-badge {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-subtle);
    padding: 4px 10px;
    border-radius: 9999px;
}

.concurrency-tier-badge {
    font-size: 12px;
    color: var(--text-muted);
    background: #fafbfe;
    border: 1px solid #f1f5f9;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
}

/* Resultados y Métricas Integradas */
.batch-results-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.batch-results-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.toolbar-heading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-heading h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.items-count-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    padding: 2px 10px;
    border-radius: 9999px;
}

.results-actions {
    display: flex;
    gap: 8px;
}

/* Progreso Compacto Inline */
.batch-progress-inline {
    background: #fafbfe;
    border: 1px solid #eef2f6;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.batch-metrics-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.metric-pill {
    font-size: 12px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.metric-pill strong {
    font-weight: 700;
}

.metric-success {
    background: #ecfdf5 !important;
    color: #065f46 !important;
    border-color: #a7f3d0 !important;
}

.metric-warning {
    background: #fffbeb !important;
    color: #92400e !important;
    border-color: #fde68a !important;
}

.metric-danger {
    background: #fef2f2 !important;
    color: #991b1b !important;
    border-color: #fecaca !important;
}

.spinner-inline {
    width: 12px;
    height: 12px;
    border: 2px solid #94a3b8;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tabla de Resultados */
.batch-table-wrapper {
    max-height: 560px;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.batch-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.batch-data-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    z-index: 2;
}

.batch-data-table tbody tr {
    border-bottom: 1px solid #edf2f7;
    transition: background 0.15s ease;
}

.batch-data-table tbody tr:hover {
    background: #f8fafc;
}

.batch-data-table td {
    padding: 10px 14px;
    color: var(--text-main);
    vertical-align: middle;
}

.batch-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-approved {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.badge-observed {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.badge-error {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.modal-lg {
    max-width: 1100px !important;
    width: 95% !important;
    max-height: 88vh !important;
}

.modal-xl {
    max-width: 1750px !important;
    width: 98% !important;
    max-height: 94vh !important;
    height: 92vh !important;
}

#historyModal {
    z-index: 1050;
}

#detailModal {
    z-index: 1200;
}

.modal-lg .details-grid,
.modal-xl .details-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.modal-lg .info-card,
.modal-xl .info-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.modal-xl .info-card.card-wide {
    grid-column: span 2;
}

@media (max-width: 1250px) {
    .modal-xl .info-card.card-wide {
        grid-column: span 1;
    }
}

.modal-lg .card-title,
.modal-xl .card-title {
    padding: 8px 14px;
    font-size: 13px;
    background: #fafbfe;
}

.modal-lg .card-content,
.modal-xl .card-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    padding: 10px 14px;
    gap: 8px 14px;
}

/* Visor Dividido (Split View): Archivo Original + Resultados */
.split-modal-body {
    display: grid;
    grid-template-columns: minmax(320px, 390px) 1fr;
    gap: 16px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 14px 18px;
    transition: grid-template-columns 0.2s ease;
}

.split-modal-body.split-mode-balanced {
    grid-template-columns: 1fr 1.2fr !important;
}

@media (max-width: 980px) {
    .split-modal-body,
    .split-modal-body.split-mode-balanced {
        grid-template-columns: 1fr !important;
        overflow-y: auto;
    }
}

.modal-split-doc {
    background: #0f172a;
    border-radius: var(--radius-md);
    border: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.doc-viewer-header {
    background: #1e293b;
    padding: 8px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #f8fafc;
    flex-shrink: 0;
}

.doc-viewer-title {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.doc-viewer-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.doc-viewer-actions .btn-outline {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.doc-viewer-actions .btn-outline:hover {
    background: rgba(255, 255, 255, 0.25);
}

.doc-image-viewport {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #0b1120;
    position: relative;
}

.doc-preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    transform-origin: center center;
}

.doc-no-preview {
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
    padding: 40px 20px;
}

.modal-split-results {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Miniaturas en Tablas */
.table-doc-thumb {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    background: var(--bg-subtle);
    display: inline-block;
}

.table-doc-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
    position: relative;
}

.table-thumb-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Historial Modal */
.history-filter-bar {
    width: 100%;
}

.modal-body::-webkit-scrollbar,
.modal-split-results::-webkit-scrollbar,
.doc-image-viewport::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.modal-body::-webkit-scrollbar-track,
.modal-split-results::-webkit-scrollbar-track,
.doc-image-viewport::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.modal-body::-webkit-scrollbar-thumb,
.modal-split-results::-webkit-scrollbar-thumb,
.doc-image-viewport::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.modal-body::-webkit-scrollbar-thumb:hover,
.modal-split-results::-webkit-scrollbar-thumb:hover,
.doc-image-viewport::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================================================
   SISTEMA DE NOTIFICACIONES TOAST & CONFIRMACIÓN IN-APP
   ========================================================================== */

/* Contenedor de Toasts */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 420px;
    width: calc(100% - 40px);
    pointer-events: none;
}

.toast-item {
    pointer-events: auto;
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.2s ease, transform 0.2s ease;
    overflow: hidden;
    position: relative;
}

.toast-item.toast-hiding {
    opacity: 0;
    transform: translateX(30px);
}

.toast-item.toast-success {
    border-left: 4px solid var(--success);
}

.toast-item.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-item.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-item.toast-info {
    border-left: 4px solid var(--primary);
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1.2;
    margin-top: 1px;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.toast-message {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.4;
    word-break: break-word;
}

.toast-close-btn {
    background: none;
    border: none;
    color: var(--text-subtle);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    margin-left: -4px;
}

.toast-close-btn:hover {
    color: var(--text-main);
    background: var(--bg-subtle);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal de Confirmación */
.modal-confirm-card {
    max-width: 460px !important;
    width: 92% !important;
    padding: 0 !important;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 25px 35px -10px rgba(0, 0, 0, 0.25);
}

.modal-confirm-body {
    display: flex;
    gap: 16px;
    padding: 22px 24px 18px;
    align-items: flex-start;
}

.modal-confirm-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
    background: #fef2f2;
    color: #ef4444;
}

.modal-confirm-icon-box.icon-warning {
    background: #fffbeb;
    color: #f59e0b;
}

.modal-confirm-icon-box.icon-info {
    background: #eff6ff;
    color: #2563eb;
}

.modal-confirm-content {
    flex: 1;
}

.modal-confirm-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 6px 0;
}

.modal-confirm-message {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.modal-confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px;
    background: var(--bg-subtle);
    border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   ESTILOS PARA USUARIOS, ROLES Y AUTENTICACIÓN (RBAC)
   ========================================================================== */
.user-badge {
    background: #f8fafc;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
}

.user-badge:hover {
    background: #f1f5f9;
}

.role-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.role-pill.role-admin {
    background: #fef3c7;
    color: #b45309;
    border-color: #fde68a;
}

.prompt-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #334155;
    margin: 2px;
}

.prompt-tag.prompt-all {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
    font-weight: 600;
}

.prompt-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s, border-color 0.15s;
}

.prompt-checkbox-label:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.status-active-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: #ecfdf5;
    color: #059669;
}

.status-inactive-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: #fef2f2;
    color: #dc2626;
}

/* Pantalla Completa de Autenticación / Login */
.auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    padding: 20px;
    box-sizing: border-box;
}

.auth-card {
    background: #ffffff;
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
    width: 100%;
    max-width: 400px;
    padding: 36px 30px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo {
    font-size: 40px;
    display: inline-block;
    margin-bottom: 10px;
}

.auth-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    margin: 0 0 6px 0;
}

.auth-header p {
    font-size: 13.5px;
    color: var(--text-muted, #64748b);
    margin: 0;
}

/* Barra de Selección de Rubro para Operadores / No Administradores */
.section-non-admin-rubros {
    background: #ffffff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    padding: 12px 18px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.operator-rubro-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.operator-rubro-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main, #1e293b);
}

.operator-rubro-icon {
    font-size: 18px;
}

/* ==========================================================================
   Barra de Gestión de Períodos y Lotes de Lectura
   ========================================================================== */
.periodo-lote-strip {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md, 10px);
    padding: 12px 18px;
    margin-bottom: 20px;
    gap: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.strip-item {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 240px;
}

.strip-badge-icon {
    font-size: 24px;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.strip-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.strip-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted, #64748b);
}

.strip-data-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.strip-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main, #0f172a);
}

.strip-status-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
}

.strip-status-pill.status-open {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.strip-status-pill.status-closed {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.strip-stats-pill {
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.strip-separator {
    width: 1px;
    height: 38px;
    background: #cbd5e1;
}

.strip-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 768px) {
    .periodo-lote-strip {
        flex-direction: column;
        align-items: stretch;
    }
    .strip-separator {
        width: 100%;
        height: 1px;
    }
}




