:root {
            --background: #f3f6fb;
            --surface: #ffffff;
            --surface-soft: #f8fafc;
            --border: #dbe3ee;
            --text: #172033;
            --text-soft: #64748b;
            --primary: #FF7811;
            --primary-dark: #d93600;
            --success: #15803d;
            --success-soft: #dcfce7;
            --warning: #a16207;
            --warning-soft: #fef3c7;
            --danger: #b91c1c;
            --danger-soft: #fee2e2;
            --info: #c2410c;
            --info-soft: #ffedd5;
            --shadow: 0 10px 28px rgba(15, 23, 42, 0.07);
            --radius: 12px;
        }

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

        body {
            margin: 0;
            min-width: 320px;
            min-height: 100vh;
            font-family: Arial, Helvetica, sans-serif;
            color: var(--text);
            background:
                radial-gradient(circle at top left, rgba(255, 69, 0, 0.10), transparent 22rem),
                var(--background);
            padding-bottom: 36px;
        }

        button,
        input,
        select {
            font: inherit;
        }

        button {
            cursor: pointer;
        }

        /* Header Page - Reduzido (~20%) */
        .page-header {
            color: #ffffff;
            background: #FF7811;
            box-shadow: 0 6px 20px rgba(15, 23, 42, 0.18);
        }

        .header-content {
            width: min(1150px, calc(100% - 28px));
            margin: 0 auto;
            padding: 20px 0;
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 50px;
        }

        .header-title {
            margin: 0;
            font-size: clamp(1.25rem, 2.2vw, 1.8rem);
        }

        .header-subtitle {
            margin: 5px 0 0;
            color: #e5e5e5;
            font-size: 0.88rem;
            line-height: 1.4;
        }

        .header-logo-svg {
            height: 48px;
            width: auto;
            display: block;
        }

        /* Container Principal - Reduzido para ~1150px (20% menor que 1440px) */
        .container {
            width: min(1150px, calc(100% - 28px));
            margin: 22px auto 36px;
        }

        /* Toolbar de Filtros */
        .toolbar {
            margin-bottom: 16px;
            padding: 14px;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            background: var(--surface);
            box-shadow: var(--shadow);
        }

        .toolbar-form {
            display: flex;
            flex-wrap: wrap;
            align-items: flex-end;
            gap: 10px;
            width: 100%;
        }

        .filter-group {
            display: flex;
            flex-direction: column;
            gap: 5px;
        }

        .filter-group-type {
            flex: 1;
            min-width: 130px;
        }

        .filter-label {
            color: var(--text-soft);
            font-size: 0.70rem;
            font-weight: 700;
            letter-spacing: 0.04em;
        }

        .filter-input {
            min-height: 38px;
            padding: 0 10px;
            border: 1px solid var(--border);
            border-radius: 8px;
            outline: none;
            color: var(--text);
            background: var(--surface-soft);
            transition: border 0.2s ease, box-shadow 0.2s ease;
            font-size: 0.82rem;
        }

        .filter-input:focus {
            background-color: #ffffff;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(255, 69, 0, 0.16);
        }

        .filter-select {
            min-width: 125px;
            cursor: pointer;
        }

        .filter-input-package {
            min-width: 210px;
        }

        .filter-actions {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-top: 2px;
        }

        .filter-button {
            min-height: 38px;
            padding: 0 14px;
            border: 0;
            border-radius: 8px;
            color: #ffffff;
            background: var(--primary);
            font-size: 0.85rem;
            font-weight: 700;
            transition: background 0.2s ease;
        }

        .filter-button:hover {
            background: var(--primary-dark);
        }

        .clear-filter-button {
            min-height: 38px;
            padding: 0 12px;
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text);
            background: var(--surface-soft);
            font-size: 0.85rem;
            font-weight: 700;
            transition: background 0.2s ease;
        }

        .clear-filter-button:hover {
            background: #e2e8f0;
        }

        /* KPI Cards Grid */
        .summary-grid {
            margin-bottom: 16px;
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 10px;
        }

        .summary-card {
            padding: 14px;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            background: var(--surface);
            box-shadow: var(--shadow);
        }

        .summary-label {
            margin: 0;
            color: var(--text-soft);
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.05em;
            text-transform: uppercase;
        }

        .summary-value {
            margin: 6px 0 0;
            font-size: 1.40rem;
            font-weight: 800;
            color: var(--text);
            line-height: 1;
        }

        /* Seção da Tabela */
        .card-section {
            padding: 18px;
            border: 1px solid var(--border);
            border-radius: var(--radius);
            background: var(--surface);
            box-shadow: var(--shadow);
        }

        .catalog-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 14px;
            padding-bottom: 10px;
            border-bottom: 1px solid var(--border);
        }

        .catalog-title {
            margin: 0;
            font-size: 0.98rem;
            font-weight: 700;
            letter-spacing: -0.01em;
        }

        .record-count {
            font-size: 0.78rem;
            color: var(--text-soft);
            font-weight: 600;
        }

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

        table {
            width: 100%;
            min-width: 680px;
            border-collapse: separate;
            border-spacing: 0;
            border: 1px solid var(--border);
            border-radius: 10px;
            overflow: hidden;
            background: var(--surface);
        }

        th, td {
            padding: 10px 10px;
            border-bottom: 1px solid var(--border);
            text-align: left;
            vertical-align: top;
            font-size: 0.80rem;
        }

        th {
            color: #475569;
            background: #eef2f7;
            font-size: 0.70rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

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

        tbody tr:hover td {
            background: #f8fafc;
        }

        .btn-detalhes {
            min-height: 28px;
            padding: 0 10px;
            border: 1px solid #ffb199;
            border-radius: 6px;
            color: var(--primary-dark);
            background: #fff4ef;
            font-size: 0.75rem;
            font-weight: 700;
            white-space: nowrap;
            transition: background 0.2s ease, border-color 0.2s ease;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            cursor: pointer;
        }

        .btn-detalhes:hover {
            border-color: #ff8a65;
            background: #ffede6;
        }

        /* Painel de Estado (Loading / Erro / Vazio) */
        .state-panel {
            padding: 34px 18px;
            border: 1px dashed #b8c5d6;
            border-radius: var(--radius);
            text-align: center;
            color: var(--text-soft);
            font-size: 0.85rem;
            background: rgba(255, 255, 255, 0.75);
        }

        .state-panel.error {
            border-color: #fecaca;
            color: var(--danger);
            background: #fff7f7;
        }

        .spinner {
            width: 30px;
            height: 30px;
            margin: 0 auto 12px;
            border: 3px solid #ffede6;
            border-top-color: var(--primary);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }

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

        /* Modal Overlay & Dialog - Reduzida para ~720px (20% menor que 900px) */
        .modal-overlay {
            position: fixed;
            inset: 0;
            z-index: 1000;
            padding: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(15, 23, 42, 0.66);
            backdrop-filter: blur(3px);
        }

        .modal-overlay[hidden] {
            display: none !important;
        }

        .modal-dialog {
            width: min(720px, 100%);
            max-height: calc(100vh - 36px);
            overflow: hidden;
            display: flex;
            flex-direction: column;
            border: 1px solid var(--border);
            border-radius: 12px;
            background: var(--surface);
            box-shadow: 0 22px 55px rgba(15, 23, 42, 0.28);
        }

        .modal-header {
            padding: 16px 18px;
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 16px;
            border-bottom: 1px solid var(--border);
        }

        .modal-eyebrow {
            display: block;
            margin-bottom: 4px;
            color: var(--text-soft);
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 0.05em;
            text-transform: uppercase;
        }

        .modal-title {
            margin: 0;
            font-size: 1.05rem;
            font-weight: 700;
        }

        .modal-close {
            width: 32px;
            height: 32px;
            flex: 0 0 auto;
            border: 1px solid var(--border);
            border-radius: 7px;
            color: var(--text);
            background: var(--surface-soft);
            font-size: 1.2rem;
            line-height: 1;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.2s ease;
        }

        .modal-close:hover {
            background: #e2e8f0;
        }

        .modal-body {
            padding: 18px;
            overflow-y: auto;
        }

        .log-details-grid {
            margin-bottom: 14px;
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 10px;
        }

        .log-detail {
            padding: 10px;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: var(--surface-soft);
        }

        .data-label {
            display: block;
            margin-bottom: 4px;
            color: var(--text-soft);
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

        .data-value {
            display: block;
            overflow-wrap: anywhere;
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--text);
        }

        .log-content-label {
            display: block;
            margin-bottom: 6px;
            color: var(--text-soft);
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

        .code-box {
            margin: 0;
            padding: 12px;
            overflow: auto;
            border: 1px solid var(--border);
            border-radius: 8px;
            color: #e2e8f0;
            background: #0f172a;
            font-family: Consolas, "Courier New", monospace;
            font-size: 0.78rem;
            line-height: 1.5;
            white-space: pre-wrap;
            overflow-wrap: anywhere;
        }

        .modal-footer {
            padding: 12px 18px;
            background: var(--surface);
            display: flex;
            justify-content: flex-end;
            border-top: 1px solid var(--border);
        }

        .badge-valid {
            background-color: var(--success-soft);
            color: var(--success);
            font-weight: 700;
            font-size: 0.70rem;
            padding: 2px 7px;
            border-radius: 20px;
            display: inline-block;
        }

        .badge-invalid {
            background-color: var(--danger-soft);
            color: var(--danger);
            font-weight: 700;
            font-size: 0.70rem;
            padding: 2px 7px;
            border-radius: 20px;
            display: inline-block;
        }

        body.modal-open {
            overflow: hidden;
        }

        /* Responsividade */
        @media (max-width: 900px) {
            .summary-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
        }

        @media (max-width: 680px) {
            .header-content {
                align-items: flex-start;
                flex-direction: column;
            }

            .toolbar-form {
                align-items: stretch;
                flex-direction: column;
            }

            .filter-group,
            .filter-input,
            .filter-select,
            .filter-button,
            .clear-filter-button,
            .filter-actions {
                width: 100%;
            }

            .filter-actions {
                flex-direction: column;
                align-items: stretch;
            }

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

            .log-details-grid {
                grid-template-columns: 1fr;
            }

            .modal-overlay {
                padding: 8px;
            }

            .modal-dialog {
                max-height: calc(100vh - 16px);
            }
        }

/* Classes extraidas dos estilos inline do HTML original */
.header-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}
.table-wrapper {
    display: none;
}
.actions-column,
td.actions-column {
    width: 100px;
    text-align: center;
}
.modal-code-section,
.modal-code-label {
    margin-top: 10px;
}

.state-message {
    margin-top: 4px;
}
