/* ========================================
   ADMIN DASHBOARD STYLES
   ======================================== */

:root {
    --primary: #4e73df;
    --secondary: #858796;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --dark: #5a5c69;
    --light: #f8f9fc;
    --border: #e3e6f0;
    --shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Layout */
.admin-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    flex-direction: row;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #224abe;
    color: white;
    overflow-y: auto;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.sidebar-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.admin-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}

/* Menu Toggle (Mobile) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }

    .menu-toggle {
        display: flex !important;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        padding: 0;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        position: relative;
        flex-shrink: 0;
        flex-basis: auto;
    }

    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.5rem;
        border-bottom: none;
        margin-bottom: 0;
        gap: 1rem;
        width: 100%;
    }

    .sidebar-header > div {
        flex: 1;
    }

    .sidebar-header h1 {
        font-size: 1.2rem;
        margin-bottom: 0.2rem;
    }

    .sidebar-header p {
        font-size: 0.8rem;
        opacity: 0.9;
        margin: 0;
    }

    .sidebar-menu {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        width: 100%;
        flex-direction: column;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        z-index: 999;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        padding: 0;
        margin: 0;
    }

    .sidebar-menu.active {
        display: flex;
    }

    .sidebar-menu li {
        margin: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        list-style: none;
        padding: 0;
    }

    .sidebar-menu li[style*="margin-top"] {
        margin-top: 0 !important;
        padding-top: 1rem !important;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    .sidebar-menu button {
        padding: 1rem 1.5rem;
        color: rgba(255, 255, 255, 0.9);
        text-decoration: none;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        font-size: 0.95rem;
        border: none;
        transition: all 0.3s ease;
        white-space: nowrap;
        width: 100%;
        box-sizing: border-box;
        background: none;
        cursor: pointer;
    }

    .sidebar-menu button:hover {
        background: rgba(0, 0, 0, 0.15);
        color: white;
    }

    .sidebar-menu a {
        padding: 1rem 1.5rem;
        color: rgba(255, 255, 255, 0.9);
        text-decoration: none;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        font-size: 0.95rem;
        border: none;
        border-left: none;
        transition: all 0.3s ease;
        white-space: nowrap;
        width: 100%;
        box-sizing: border-box;
    }

    .sidebar-menu a:hover {
        background: rgba(0, 0, 0, 0.15);
        color: white;
    }

    .sidebar-menu a.active {
        background-color: rgba(0, 0, 0, 0.25);
        color: white;
        border-left: none;
    }

    .logout-btn {
        background: none;
        border: none;
        color: white;
        width: 100%;
        text-align: left;
        padding: 1rem 1.5rem;
        cursor: pointer;
        font-size: 1rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        transition: all 0.3s ease;
    }

    .logout-btn:hover {
        background: rgba(0, 0, 0, 0.15);
        color: white;
    }

    .admin-main {
        width: 100%;
        margin-left: 0;
        padding: 1.25rem 1rem;
        overflow-y: auto;
        flex: 1;
        position: relative;
        z-index: 1;
    }
}

.nav-link {
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.nav-link:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: white;
}

.nav-link.active {
    background-color: rgba(0, 0, 0, 0.2);
    color: white;
    border-left-color: white;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-logout {
    display: block;
    text-align: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Main Content */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-header {
    padding: 1.25rem 2rem;
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    font-size: 0.9rem;
    color: var(--dark);
}

.btn-logout-header {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-logout-header:hover {
    background: #da4f3c;
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-left: 4px solid var(--primary);
    color: var(--dark);
    padding: 1.5rem;
    border-radius: 6px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.3rem 2.25rem 0 rgba(58, 59, 69, 0.25);
}

.stat-card.secondary {
    border-left-color: var(--secondary);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.info {
    border-left-color: var(--info);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.5;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: #b8b9be;
    margin: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--dark);
    line-height: 1;
    margin: 0;
}

/* Cards Section */
.card {
    background: white;
    padding: 1.5rem;
    border-radius: 6px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

/* Chart Section */
.chart-section {
    background: white;
    padding: 1.5rem;
    border-radius: 6px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.chart-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
}

.chart-placeholder {
    width: 100%;
    height: auto;
    background: var(--light);
    border-radius: 6px;
    padding: 1.5rem;
    color: #9ca3af;
}

.chart-placeholder > div:last-child {
    margin-bottom: 0 !important;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h3 {
    font-size: 1.5rem;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--light);
    border-bottom: 2px solid var(--border);
}

th {
    padding: 8px 5px !important;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.85rem;
}

td {
    padding: 5px !important;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

tbody tr:hover {
    background: var(--light);
}

.text-center {
    text-align: center;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.95rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(78, 115, 223, 0.1);
}

.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.filters input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
}

#vendas-page .filters {
    display: block;
}

#vendas-page .filters > div {
    width: 100%;
}

#vendas-page .filters > div > div {
    width: 100%;
    min-width: 0;
}

.edicoes-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: clamp(10px, 2vw, 16px);
    width: 100%;
}

.edicao-card {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
}

.edicao-card:hover {
    background: #f0f8ff;
    border-color: #4a90e2;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.edicao-card-title {
    font-weight: 700;
    color: #333;
}

.edicao-card-meta {
    color: #666;
}

.edicao-card-values {
    color: #059669;
    font-weight: 600;
}

.edicao-card-balance {
    color: #10b981;
    font-weight: 700;
}

@media (max-width: 480px) {
    .edicoes-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Buttons */
.btn {
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: 3px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    display: inline-block;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
}

.btn-primary:hover {
    background: #3d5cc7;
    border-color: #3d5cc7;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
    border: 1px solid var(--secondary);
}

.btn-secondary:hover {
    background: #6c757d;
    border-color: #6c757d;
}

.btn-success {
    background: var(--success);
    color: white;
    border: 1px solid var(--success);
}

.btn-success:hover {
    background: #1aa179;
    border-color: #1aa179;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: #da4f3c;
    border-color: #da4f3c;
}

.btn-warning {
    background: var(--warning);
    color: #333;
    border: 1px solid var(--warning);
}

.btn-warning:hover {
    background: #dba828;
    border-color: #dba828;
}

.btn-info {
    background: var(--info);
    color: white;
    border: 1px solid var(--info);
}

.btn-info:hover {
    background: #2d9aad;
    border-color: #2d9aad;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.button-group button {
    flex: 1;
}

/* Integrations */
.integrations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.integration-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary);
}

.integration-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.integration-card h3 {
    margin: 0.5rem 0;
}

.form-group h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #666;
    font-size: 1rem;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.integration-card p {
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.integration-form {
    background: var(--light);
    padding: 1rem;
    border-radius: 6px;
}

.integration-form .form-group {
    margin-bottom: 0.75rem;
}

.status-badge {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.35rem 0.75rem;
    background: #fff3cd;
    color: #856404;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge.success {
    background: #d4edda;
    color: #155724;
}

.status-badge.danger {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Relatórios */
.relatorio-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.relatorio-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.relatorio-card h4 {
    margin-bottom: 1rem;
    color: var(--primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close-btn {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: #9ca3af;
}

.close-btn:hover {
    color: var(--dark);
}

/* Scrollbar */
.sidebar::-webkit-scrollbar,
.admin-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track,
.admin-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar-thumb,
.admin-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.admin-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

/* ========================================
   INTEGRATIONS STYLES
   ======================================== */

.integrations-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.overview-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    gap: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.overview-status,
.overview-configured {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.overview-status span:first-child,
.overview-configured span:first-child {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.overview-status span:last-child,
.overview-configured span:last-child {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Integration Card Full Width */
.integration-card-full {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.3s ease;
}

.integration-card-full:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.integration-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: rgba(99, 102, 241, 0.05);
}

.integration-icon-large {
    font-size: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 12px;
    border: 2px solid var(--border);
}

.integration-info {
    flex: 1;
}

.integration-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    color: var(--dark);
}

.integration-info p {
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.integration-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.success {
    background-color: var(--success);
}

.status-indicator.pending {
    background-color: var(--warning);
    animation: pulse 2s infinite;
}

.status-indicator.error {
    background-color: var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    color: #6b7280;
}

.integration-actions {
    display: flex;
    gap: 0.5rem;
}

.integration-body {
    padding: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.875rem;
}

.form-group input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group small {
    color: #9ca3af;
    font-size: 0.8rem;
}

.form-info {
    background-color: #f0f9ff;
    border-left: 4px solid var(--primary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.form-info p {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.form-info ol {
    margin-left: 1.5rem;
    color: #6b7280;
    font-size: 0.9rem;
}

.form-info li {
    margin-bottom: 0.5rem;
}

.form-info code {
    background-color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: var(--danger);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Certificado Status Box */
.cert-status-box {
    background: #f0f9ff;
    border: 2px dashed #0ea5e9;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.cert-status-text {
    font-size: 0.95rem;
    color: #0f766e;
    font-weight: 500;
}

.cert-status-box.uploaded .cert-status-text {
    color: var(--success);
}

.cert-upload-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.form-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background-color: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background-color: var(--primary);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Test Results */
.test-results {
    background-color: #f9fafb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.test-result-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.test-result-item:last-child {
    border-bottom: none;
}

.test-result-label {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.test-result-status {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-block;
}

.test-result-status.success {
    background-color: #d1fae5;
    color: var(--success);
}

.test-result-status.error {
    background-color: #fee2e2;
    color: var(--danger);
}

.test-result-message {
    color: #6b7280;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Modal Large */
.modal-large {
    width: 90%;
    max-width: 600px;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.page-header .subtitle {
    color: #6b7280;
    font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        padding: 1rem;
        position: relative;
    }

    .sidebar-brand {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0;
    }

    .sidebar-brand h2 {
        font-size: 1.2rem;
    }

    .menu-toggle {
        display: block;
    }

    .sidebar-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        padding: 0;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        z-index: 1000;
    }

    .sidebar-nav.active {
        display: flex;
    }

    .nav-link {
        padding: 1rem 1.5rem;
        border-left: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-link.active {
        border-left: none;
        background-color: rgba(0, 0, 0, 0.2);
    }

    .sidebar-footer {
        display: none;
    }

    .admin-content {
        padding: 1rem 0.5rem;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .page-header h3 {
        font-size: 1.2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .stat-card {
        padding: 1.5rem 1rem;
        gap: 0.75rem;
        min-height: 120px;
    }

    .stat-icon {
        font-size: 2rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    @media (max-width: 480px) {
        .stats-grid {
            grid-template-columns: 1fr;
            gap: 0.75rem;
        }
    }

    .integrations-grid,
    .relatorio-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .integration-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .integration-icon-large {
        margin: 0 auto;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.75rem 0.5rem;
    }

    .btn-group {
        flex-direction: column;
        gap: 0.25rem;
    }

    .btn-group .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Sidebar Submenu Styles */
.sidebar-submenu {
    background: rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    padding: 0;
    margin: 0;
    border-left: 2px solid white;
}

.sidebar-submenu a {
    padding: 0.75rem 1.5rem 0.75rem 2.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    font-size: 0.95rem;
}

.sidebar-submenu a:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: white;
}

.sidebar-submenu a.active {
    background-color: rgba(0, 0, 0, 0.3);
    color: white;
    border-left-color: white;
}

/* ========================================
   RESPONSIVE TABLE TO CARDS (MOBILE)
   ======================================== */

/* Estilos para tabelas em desktop */
.table-responsive,
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    background: white;
}

.table-responsive table,
.table-container table {
    width: 100%;
    border-collapse: collapse;
}

.table-responsive thead,
.table-container thead {
    background: #f3f4f6;
}

.table-responsive th,
.table-container th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    font-size: 0.9rem;
}

.table-responsive td,
.table-container td {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    color: #6b7280;
}

.table-responsive tbody tr,
.table-container tbody tr {
    transition: background-color 0.2s ease;
}

.table-responsive tbody tr:hover,
.table-container tbody tr:hover {
    background-color: #f9fafb;
}

/* MOBILE: Converter tabelas em cards */
@media (max-width: 768px) {
    .table-responsive,
    .table-container {
        overflow: visible;
        background: transparent;
    }

    .table-responsive table,
    .table-container table {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .table-responsive thead,
    .table-container thead {
        display: none;
    }

    .table-responsive tbody,
    .table-container tbody {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .table-responsive tbody tr,
    .table-container tbody tr {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 1rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }

    .table-responsive tbody tr:hover,
    .table-container tbody tr:hover {
        background-color: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
        transform: translateY(-2px);
    }

    .table-responsive td,
    .table-container td {
        display: grid;
        grid-template-columns: 120px 1fr;
        gap: 1rem;
        padding: 0.5rem 0;
        border: none;
        align-items: start;
        column-gap: 1rem;
    }

    .table-responsive td::before,
    .table-container td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #667eea;
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        grid-column: 1;
        padding-top: 0.25rem;
    }

    .table-responsive td > *,
    .table-container td > * {
        grid-column: 2;
    }

    /* Ações em full-width */
    .table-responsive td:has(.action-buttons),
    .table-responsive td:last-child,
    .table-container td:has(.action-buttons),
    .table-container td:last-child {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .table-responsive td:has(.action-buttons)::before,
    .table-responsive td:last-child::before,
    .table-container td:has(.action-buttons)::before,
    .table-container td:last-child::before {
        grid-column: 1;
    }

    .action-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        width: 100%;
    }

    .action-buttons .btn,
    .action-buttons .btn-icon {
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    /* Badges e valores destacados */
    .badge {
        display: inline-block;
        padding: 0.35rem 0.75rem;
        border-radius: 20px;
        font-size: 0.75rem;
        font-weight: 600;
    }
}

/* EXTRA SMALL: Otimizações para telas muito pequenas */
@media (max-width: 480px) {
    .table-responsive td,
    .table-container td {
        grid-template-columns: 1fr;
    }

    .table-responsive td::before,
    .table-container td::before {
        display: block;
        margin-bottom: 0.5rem;
    }

    .table-responsive td > *,
    .table-container td > * {
        grid-column: 1;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .card-title {
        font-size: 1rem;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }

    .admin-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .admin-header h2 {
        font-size: 1.3rem;
        margin: 0;
    }

    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .btn-block {
        width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-header h3 {
        font-size: 1.2rem;
        margin: 0;
    }
}

/* ========================================
   BADGE STYLES
   ======================================== */

.badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
}

.badge-primary {
    background-color: #e7f0ff;
    color: #004085;
}

.badge-secondary {
    background-color: #e8eaed;
    color: #383d41;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Gateway Configuration Styles */
.gateway-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0;
}

.gateway-option-card {
    display: block;
    position: relative;
    cursor: pointer;
    background: white;
    border: 2px solid #e3e6f0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.gateway-option-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(78, 115, 223, 0.15);
}

.gateway-option-card input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.gateway-option-card input[type="radio"]:checked + .gateway-card-content {
    border-left: 4px solid var(--success);
    background: rgba(28, 200, 138, 0.05);
}

.gateway-card-content {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding-left: 10px;
    transition: all 0.3s ease;
}

.gateway-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.gateway-details {
    flex: 1;
}

.gateway-details h4 {
    margin: 0 0 8px 0;
    color: var(--dark);
    font-size: 1.2rem;
}

.gateway-details p {
    margin: 0 0 12px 0;
    color: var(--secondary);
    font-size: 0.9rem;
}

.gateway-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.gateway-status .badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.form-actions {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
}

.info-box {
    background: #f8f9fa;
    border-left: 4px solid var(--info);
    border-radius: 8px;
    padding: 20px;
}

.info-box h4 {
    margin: 0 0 10px 0;
    color: var(--dark);
}

.info-box ul {
    margin: 10px 0;
    padding-left: 20px;
}

.info-box li {
    margin: 8px 0;
    color: var(--secondary);
}

.info-box code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}
/* ========================================
   PAGINAÇÃO
   ======================================== */

#paginacao {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding: 20px;
    text-align: center;
}

.btn-pagina {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-pagina:hover:not(.disabled) {
    background: #3d5bb9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(78, 115, 223, 0.3);
}

.btn-pagina.disabled {
    background: #cccccc;
    cursor: not-allowed;
    opacity: 0.5;
}

.pagina-info {
    font-weight: 600;
    color: var(--dark);
    min-width: 150px;
}

/* Grid de Cartelas */
#cartelasGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.cartela-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.cartela-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(78, 115, 223, 0.15);
    transform: translateY(-2px);
}

.cartela-card.selected {
    background: #e3f2fd;
    border-color: var(--primary);
}