/*
 * Tema compartilhado para páginas administrativas do Prometeu RAG.
 * Centraliza estilos base de layout, tipografia e componentes.
 */

:root {
    --admin-font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --admin-gradient-start: #667eea;
    --admin-gradient-end: #764ba2;
    --admin-surface: #ffffff;
    --admin-surface-alt: #f8f9fb;
    --admin-border: #e0e0e0;
    --admin-border-strong: #e0e5ff;
    --admin-border-dashed: #ced6ff;
    --admin-radius-sm: 6px;
    --admin-radius-md: 8px;
    --admin-radius-lg: 12px;
    --admin-shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.2);
    --admin-shadow-strong: 0 20px 50px rgba(0, 0, 0, 0.25);
    --admin-primary: #667eea;
    --admin-primary-dark: #5568d3;
    --admin-primary-soft: #f1f4ff;
    --admin-danger: #dc3545;
    --admin-danger-dark: #c82333;
    --admin-success: #28a745;
    --admin-success-dark: #218838;
    --admin-info: #17a2b8;
    --admin-warning: #ffc107;
    --admin-text-strong: #333333;
    --admin-text: #444444;
    --admin-text-muted: #6c757d;
    --admin-background-dark: #1e1f2c;
}

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

body.admin-page {
    font-family: var(--admin-font-family);
    background: #f4f6fb;
    color: #1f2937;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: #1f2937;
    color: #ffffff;
    padding: 24px 32px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.admin-header__title {
    font-size: 24px;
    margin-bottom: 8px;
}

.admin-header__subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.72);
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px 32px 40px 32px;
}

.admin-navigation {
    display: flex;
    justify-content: flex-end;
}

.admin-navigation__link {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.admin-navigation__link:hover {
    color: #312e81;
}

.admin-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.admin-card h2 {
    font-size: 18px;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-card__description {
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
}

.admin-message {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-message--success {
    background: #dcfce7;
    color: #166534;
    border-left: 4px solid #22c55e;
}

.admin-message--error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.admin-message--info {
    background: #dbeafe;
    color: #1d4ed8;
    border-left: 4px solid #3b82f6;
}

.admin-message--warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.admin-btn {
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.admin-btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.admin-btn--small {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.admin-btn--primary {
    background: #4f46e5;
    color: #ffffff;
}

.admin-btn--primary:hover {
    background: #4338ca;
    box-shadow: 0 12px 26px rgba(79, 70, 229, 0.35);
}

.admin-btn--success {
    background: #16a34a;
    color: #ffffff;
}

.admin-btn--success:hover {
    background: #15803d;
    box-shadow: 0 10px 22px rgba(22, 163, 74, 0.36);
}

.admin-btn--warning {
    background: #f97316;
    color: #ffffff;
}

.admin-btn--warning:hover {
    background: #ea580c;
    box-shadow: 0 10px 22px rgba(249, 115, 22, 0.36);
}

.admin-btn--secondary {
    background: #0ea5e9;
    color: #ffffff;
}

.admin-btn--secondary:hover {
    background: #0284c7;
    box-shadow: 0 10px 22px rgba(14, 165, 233, 0.36);
}

.admin-btn--neutral {
    background: #e5e7eb;
    color: #1f2937;
}

.admin-btn--neutral:hover {
    background: #d1d5db;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
}

.admin-btn--danger {
    background: #dc2626;
    color: #ffffff;
}

.admin-btn--danger:hover {
    background: #b91c1c;
    box-shadow: 0 10px 22px rgba(220, 38, 38, 0.36);
}

.admin-btn--ghost {
    background: transparent;
    color: #4f46e5;
}

.admin-btn--ghost:hover {
    background: rgba(79, 70, 229, 0.08);
}

@media (max-width: 768px) {
    .admin-header {
        padding: 22px;
    }

    .admin-main {
        padding: 20px;
    }
}

body {
    font-family: var(--admin-font-family);
    background: linear-gradient(135deg,
            var(--admin-gradient-start) 0%,
            var(--admin-gradient-end) 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    background: var(--admin-surface);
    border-radius: 14px;
    box-shadow: var(--admin-shadow-strong);
    overflow: hidden;
}

.navigation-bar {
    display: flex;
    justify-content: flex-end;
    padding: 18px 32px 0 32px;
}

.back-link {
    color: var(--admin-primary);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.back-link:hover {
    color: var(--admin-primary-dark);
    transform: translateX(-4px);
}

.header {
    background: linear-gradient(135deg,
            var(--admin-gradient-start) 0%,
            var(--admin-gradient-end) 100%);
    color: white;
    padding: 36px 32px;
}

.header h1 {
    font-size: 2.4em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header p {
    font-size: 1.1em;
    opacity: 0.95;
    line-height: 1.6;
    max-width: 840px;
}

.description {
    background: var(--admin-surface-alt);
    padding: 26px 32px;
    border-left: 4px solid var(--admin-primary);
    margin: 26px 32px;
    border-radius: 10px;
}

.description h2 {
    color: var(--admin-text-strong);
    margin-bottom: 14px;
    font-size: 1.25em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.description ul {
    list-style: none;
    display: grid;
    gap: 10px;
}

.description li {
    color: #555555;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.description li span {
    color: var(--admin-primary);
    font-size: 1.2em;
}

.config-section,
.operations-section,
.progress-section,
.history-section,
.results-section {
    padding: 30px 32px;
    border-top: 1px solid rgba(0, 0, 0, 0.07);
    background: var(--admin-surface);
}

.config-section h2,
.operations-section h2,
.progress-section h2,
.history-section h2,
.results-section h2 {
    color: var(--admin-text-strong);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.input-group label {
    font-weight: 600;
    color: #444444;
    margin-bottom: 8px;
}

.input-group input,
.input-group textarea,
.input-group select {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.98em;
    transition: all 0.3s ease;
    width: 100%;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.input-group input.input-error,
.input-group textarea.input-error,
.input-group select.input-error {
    border-color: var(--admin-danger);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
    background: #fff5f5;
}

.field-helper {
    margin-top: 6px;
    font-size: 0.85em;
    color: var(--admin-text-muted);
    line-height: 1.4;
}

.field-helper.field-helper-error {
    color: var(--admin-danger);
    font-weight: 600;
}

.api-key-container {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.api-key-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 11px 22px;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary {
    background: var(--admin-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--admin-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(102, 126, 234, 0.35);
}

.btn-secondary {
    background: #f1f4ff;
    color: #444444;
    border: 1px solid #cfd7ff;
}

.btn-secondary:hover {
    background: #e5ebff;
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 2px dashed var(--admin-primary);
    color: var(--admin-primary);
}

.btn-outline:hover {
    background: rgba(102, 126, 234, 0.08);
}

.btn-danger {
    background: var(--admin-danger);
    color: white;
}

.btn-danger:hover {
    background: var(--admin-danger-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(220, 53, 69, 0.35);
}

.btn-success {
    background: var(--admin-success);
    color: white;
}

.btn-success:hover {
    background: var(--admin-success-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-info {
    background: var(--admin-info);
    color: white;
}

.btn-info:hover {
    background: #138496;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

.btn-warning {
    background: var(--admin-warning);
    color: #333333;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

.editors-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
}

.editor-card {
    border: 2px solid #e5e7fb;
    border-radius: 12px;
    background: #fdfdff;
    display: flex;
    flex-direction: column;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid #e0e5ff;
    gap: 16px;
}

.editor-title {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.editor-header h3 {
    color: #333333;
    font-size: 1.05em;
}

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

.editor-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 0.78em;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.12);
    color: #31407a;
    border: 1px solid rgba(102, 126, 234, 0.25);
    white-space: nowrap;
}

.editor-badge::before {
    content: "📄";
    font-size: 0.9em;
}

.editor-badge[data-status="empty"] {
    background: rgba(108, 117, 125, 0.12);
    color: #485160;
    border-color: rgba(108, 117, 125, 0.18);
}

.editor-badge[data-status="sample"] {
    background: rgba(40, 167, 69, 0.12);
    color: #226136;
    border-color: rgba(40, 167, 69, 0.25);
}

.editor-badge[data-status="file"],
.editor-badge[data-status="storage"] {
    background: rgba(102, 126, 234, 0.16);
    color: #23316d;
    border-color: rgba(102, 126, 234, 0.35);
}

.editor-badge[data-status="typing"] {
    background: rgba(255, 193, 7, 0.15);
    color: #785b04;
    border-color: rgba(255, 193, 7, 0.25);
}

.editor-actions input[type="file"] {
    display: none;
}

.editor-textarea {
    flex: 1;
    border: none;
    border-radius: 0;
    padding: 0;
    min-height: 260px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.92em;
    line-height: 1.5;
    background: transparent;
    resize: none;
}

.hidden-textarea {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
}

.codemirror-surface {
    position: relative;
    border: 2px solid #d9deff;
    border-radius: 12px;
    background: linear-gradient(135deg, #fbfcff 0%, #eef1ff 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    min-height: 280px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.codemirror-surface::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 12px;
    box-shadow: inset 0 0 0 1px rgba(102, 126, 234, 0.12);
}

.codemirror-surface .cm-editor {
    background: transparent;
    height: auto;
    min-height: 280px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.92em;
    color: #20254f;
}

.codemirror-surface .cm-scroller {
    padding: 18px 20px 18px 16px;
    line-height: 1.55;
}

.codemirror-surface .cm-gutters {
    background: rgba(102, 126, 234, 0.08);
    border-right: 1px solid rgba(102, 126, 234, 0.15);
    color: #5b6285;
}

.codemirror-surface .cm-activeLine {
    background: rgba(102, 126, 234, 0.12);
}

.codemirror-surface .cm-activeLineGutter {
    background: rgba(102, 126, 234, 0.18);
}

.codemirror-surface .cm-selectionBackground,
.codemirror-surface .cm-content ::selection {
    background: rgba(118, 75, 162, 0.22);
}

.codemirror-surface .cm-cursor {
    border-left: 2px solid #667eea;
}

.yaml-editor {
    position: relative;
    display: flex;
    border: 2px solid #d9deff;
    border-radius: 12px;
    background: linear-gradient(135deg, #fbfcff 0%, #eef1ff 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    min-height: 280px;
    overflow: hidden;
}

.yaml-editor--focus {
    border-color: rgba(102, 126, 234, 0.9);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.18);
}

.yaml-editor__gutter {
    width: 52px;
    background: rgba(102, 126, 234, 0.08);
    border-right: 1px solid rgba(102, 126, 234, 0.15);
    color: #5b6285;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.82em;
    line-height: 1.55;
    padding: 18px 8px 18px 12px;
    user-select: none;
    text-align: right;
    overflow: hidden;
    will-change: transform;
}

.yaml-editor__gutter div {
    padding-right: 4px;
}

.yaml-editor__body {
    position: relative;
    flex: 1;
}

.yaml-editor__highlight {
    position: absolute;
    inset: 0;
    padding: 18px 20px 18px 18px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.92em;
    line-height: 1.55;
    white-space: pre;
    color: #20254f;
    pointer-events: none;
    overflow: hidden;
    transform-origin: top left;
    will-change: transform;
}

.yaml-editor__highlight[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: rgba(85, 97, 125, 0.8);
    font-style: italic;
}

.yaml-editor__textarea {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    color: transparent;
    caret-color: #424fcf;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.92em;
    line-height: 1.55;
    padding: 18px 20px 18px 18px;
    resize: none;
    white-space: pre;
}

.yaml-editor__textarea:focus {
    outline: none;
}

.yaml-editor__textarea::selection {
    background: rgba(118, 75, 162, 0.22);
}

.yaml-editor__textarea::-webkit-scrollbar {
    width: 10px;
}

.yaml-editor__textarea::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
}

.yaml-editor__textarea::-webkit-scrollbar-track {
    background: transparent;
}

.yaml-editor__highlight .token-key {
    color: #3942c2;
    font-weight: 600;
}

.yaml-editor__highlight .token-string {
    color: #0e7c86;
}

.yaml-editor__highlight .token-number {
    color: #b66d1f;
}

.yaml-editor__highlight .token-boolean {
    color: #8e44ad;
    font-weight: 600;
}

.yaml-editor__highlight .token-comment {
    color: #6c757d;
    font-style: italic;
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: rgba(102, 126, 234, 0.06);
    border-top: 1px solid #e0e5ff;
    font-size: 0.85em;
    color: #55617d;
}

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

.summary-card {
    background: #f7f8ff;
    border: 2px solid #e1e5ff;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.25s ease;
}

.summary-card:hover {
    border-color: var(--admin-primary);
    box-shadow: 0 12px 24px rgba(102, 126, 234, 0.25);
    transform: translateY(-4px);
}

.summary-card h3 {
    font-size: 0.95em;
    color: #4a4e69;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.summary-card strong {
    font-size: 1.4em;
    color: #2d2f44;
    display: block;
}

.summary-card small {
    color: #6c6f85;
    display: block;
    margin-top: 6px;
    line-height: 1.5;
}

.sources-list {
    margin-top: 24px;
    border: 1px dashed #cfd3ff;
    border-radius: 10px;
    padding: 16px 18px;
    background: #fafbff;
}

.sources-list h3 {
    font-size: 0.95em;
    color: #4a4e69;
    margin-bottom: 10px;
}

.sources-list ul {
    list-style: none;
    display: grid;
    gap: 8px;
}

.sources-list li {
    padding: 10px 12px;
    border-radius: 8px;
    background: white;
    border: 1px solid #e5e7ff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #455065;
}

.input-inline-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-inline-group input {
    flex: 1;
}

.tag {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.12);
    color: #4f5dd0;
    font-size: 0.78em;
    font-weight: 600;
}

.history-item-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.operations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.operation-card {
    background: #f8f9ff;
    border: 2px solid #e2e6ff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s ease;
}

.operation-card .btn {
    align-self: center;
    min-width: 200px;
    justify-content: center;
    text-align: center;
}

.operation-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.operation-actions .btn {
    flex: 1 1 200px;
    max-width: 220px;
}

.operation-card:hover {
    border-color: var(--admin-primary);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-4px);
}

.operation-card h3 {
    color: #32324d;
    font-size: 1.05em;
}

.operation-card ul {
    list-style: none;
    display: grid;
    gap: 8px;
}

.operation-card li {
    color: #59617d;
    display: flex;
    align-items: center;
    gap: 8px;
}

.operation-card li span {
    font-size: 1.2em;
    color: var(--admin-primary);
}

.btn-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.progress-container {
    background: #fefefe;
    border: 2px dashed var(--admin-border-dashed);
    border-radius: 12px;
    padding: 20px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
}

.progress-container.empty {
    justify-content: center;
    align-items: center;
    color: #7a819d;
    font-style: italic;
}

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

.status-badge {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-running {
    background: rgba(23, 162, 184, 0.15);
    color: #0f7687;
}

.status-completed {
    background: rgba(40, 167, 69, 0.18);
    color: #1c7c36;
}

.status-failed {
    background: rgba(220, 53, 69, 0.18);
    color: #8a1c29;
}

.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(102, 126, 234, 0.12);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    transition: width 0.4s ease;
}

.progress-meta {
    display: flex;
    gap: 16px;
    color: #4d5470;
    font-size: 0.85em;
    flex-wrap: wrap;
}

.progress-timeline {
    list-style: none;
    border-left: 2px solid rgba(102, 126, 234, 0.25);
    margin-top: 12px;
    padding-left: 18px;
    display: grid;
    gap: 12px;
}

.progress-timeline li {
    position: relative;
    color: #505774;
    line-height: 1.5;
}

.progress-timeline li::before {
    content: '';
    position: absolute;
    left: -29px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--admin-primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

.history-empty {
    color: #7a819d;
    font-style: italic;
}

.history-list {
    list-style: none;
    display: grid;
    gap: 12px;
}

.history-item {
    background: #f9faff;
    border: 1px solid #d9deff;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    color: #424969;
}

.history-item-body {
    font-size: 0.9em;
    color: #5a627f;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-ok {
    background: var(--admin-success);
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.6);
}

.status-error {
    background: var(--admin-danger);
    box-shadow: 0 0 8px rgba(220, 53, 69, 0.6);
}

.results-container {
    background: var(--admin-background-dark);
    color: #f8f8ff;
    border-radius: 12px;
    padding: 20px;
    min-height: 220px;
    max-height: 420px;
    overflow-y: auto;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.88em;
}

.results-container pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    color: inherit;
}

.results-container.empty {
    background: #f7f8ff;
    color: #737aa0;
    border: 2px dashed #cfd4ff;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-container::-webkit-scrollbar {
    width: 10px;
}

.results-container::-webkit-scrollbar-track {
    background: #1d1d1d;
}

.results-container::-webkit-scrollbar-thumb {
    background: var(--admin-primary);
    border-radius: 5px;
}

.results-container::-webkit-scrollbar-thumb:hover {
    background: var(--admin-primary-dark);
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: grid;
    gap: 12px;
    z-index: 9999;
}

.toast {
    min-width: 240px;
    padding: 14px 18px;
    border-radius: 10px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
    animation: slideIn 0.4s ease;
}

.toast-success {
    background: linear-gradient(135deg, #28a745, #34ce57);
}

.toast-error {
    background: linear-gradient(135deg, #dc3545, #f45c67);
}

.toast-info {
    background: linear-gradient(135deg, #17a2b8, #1fc8d8);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Componentes adicionais compartilhados entre páginas admin */
.stats-section {
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 1px solid var(--admin-border);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border: 2px solid var(--admin-border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--admin-primary);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-4px);
}

.stat-card .stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--admin-primary);
    margin-bottom: 5px;
}

.stat-card .stat-label {
    font-size: 0.9em;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.message {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
}

.message-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--admin-success);
}

.message-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--admin-danger);
}

.message-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid var(--admin-info);
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--admin-primary);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.tab-navigation {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid #cfd7ff;
    background: #f1f4ff;
    color: #444444;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.tab-button.active,
.tab-button:hover {
    background: var(--admin-primary);
    color: white;
    border-color: var(--admin-primary);
    transform: translateY(-2px);
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    background: white;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.admin-table thead {
    background: #f5f7ff;
}

.admin-table th,
.admin-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #e6e9ff;
}

.admin-table tbody tr:hover {
    background: #f9faff;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 600;
}

.badge-info {
    background: rgba(23, 162, 184, 0.15);
    color: #0f7687;
}

.badge-success {
    background: rgba(40, 167, 69, 0.18);
    color: #1c7c36;
}

.badge-warning {
    background: rgba(255, 193, 7, 0.2);
    color: #9f6a00;
}

.badge-danger {
    background: rgba(220, 53, 69, 0.18);
    color: #8a1c29;
}

.remote-validation-summary {
    border: 1px solid #d9deff;
    background: #f8f9ff;
    border-radius: 10px;
    padding: 16px;
    margin-top: 10px;
    display: none;
}

.remote-validation-summary.visible {
    display: block;
}

.remote-validation-summary h4 {
    margin-bottom: 10px;
    color: #32324d;
}

.remote-validation-summary ul {
    list-style: none;
    display: grid;
    gap: 6px;
}

.remote-validation-summary li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #4d5470;
    line-height: 1.4;
}

.remote-validation-summary li::before {
    content: "•";
    color: var(--admin-primary);
    font-weight: bold;
}

.validation-flags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.validation-flags .badge {
    font-size: 0.75em;
}

.refresh-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

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

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(26px);
}

@media (max-width: 1024px) {
    .header h1 {
        font-size: 2em;
    }

    .header p {
        font-size: 1em;
    }

    .editor-textarea {
        min-height: 220px;
    }
}

@media (max-width: 640px) {
    body {
        padding: 12px;
    }

    .container {
        border-radius: 10px;
    }

    .config-section,
    .operations-section,
    .progress-section,
    .history-section,
    .results-section {
        padding: 22px;
    }

    .description {
        margin: 18px 22px;
    }
}

@media (max-width: 768px) {
    .api-key-container {
        flex-direction: column;
        align-items: stretch;
    }

    .operations-grid {
        grid-template-columns: 1fr;
    }
}
