:root {
    --bg: #edf3f6;
    --bg-strong: #dfe9ee;
    --surface: #ffffff;
    --surface-alt: #f6fafc;
    --text: #173042;
    --text-soft: #5b7281;
    --line: rgba(23, 48, 66, 0.12);
    --primary: #0d466b;
    --primary-strong: #082f48;
    --accent: #1d8a63;
    --warning: #d98b1f;
    --danger: #b84b4b;
    --shadow: 0 18px 48px rgba(18, 40, 55, 0.08);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --container: 1180px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Instrument Sans", system-ui, sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #eef4f7 0%, #e6eef2 38%, #edf3f6 100%);
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

form {
    margin: 0;
}

textarea {
    min-height: 140px;
    padding-top: 0.95rem;
    resize: vertical;
}

ul {
    padding-left: 1.15rem;
    line-height: 1.7;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    width: min(100% - 2rem, var(--container));
    margin: 0 auto;
}

.site-backdrop {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(13, 70, 107, 0.12), transparent 24%),
        radial-gradient(circle at top right, rgba(29, 138, 99, 0.1), transparent 18%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0));
    pointer-events: none;
    z-index: -1;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(18px);
    background: rgba(237, 243, 246, 0.78);
    border-bottom: 1px solid rgba(23, 48, 66, 0.08);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    min-height: 84px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-logo {
    width: 48px;
    height: 48px;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.brand-copy strong {
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.brand-copy small {
    color: var(--text-soft);
    font-size: 0.86rem;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.site-nav a {
    padding: 0.7rem 0.95rem;
    border-radius: 999px;
    color: var(--text-soft);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.site-nav a:hover,
.site-nav a.is-active {
    background: rgba(13, 70, 107, 0.1);
    color: var(--primary-strong);
}

.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 0;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 0.8rem;
}

.nav-toggle span {
    display: block;
    height: 2px;
    background: var(--text);
    margin: 5px 0;
}

.page-shell {
    padding: 2rem 0 4rem;
}

.hero {
    padding: 2rem 0 3rem;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
    align-items: stretch;
}

.hero-panel,
.card,
.stat-card,
.notice,
.panel {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(23, 48, 66, 0.08);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.hero-panel {
    padding: 2.25rem;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: rgba(13, 70, 107, 0.08);
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.hero h1,
.section-title h2,
.card h2,
.panel h2,
.stat-card h3 {
    font-family: "Literata", Georgia, serif;
    letter-spacing: -0.04em;
}

.hero h1 {
    margin: 1rem 0 1rem;
    font-size: clamp(2.4rem, 4vw, 4.4rem);
    line-height: 0.95;
}

.hero p.lead {
    font-size: 1.08rem;
    line-height: 1.7;
    color: var(--text-soft);
    margin: 0 0 1.4rem;
    max-width: 58ch;
}

.smart-search,
.filter-grid,
.form-grid,
.inline-form {
    display: grid;
    gap: 0.85rem;
}

.smart-search {
    grid-template-columns: 1fr auto;
    margin-top: 1.4rem;
}

.smart-search input,
.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 54px;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(23, 48, 66, 0.12);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.smart-search input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: rgba(13, 70, 107, 0.4);
    box-shadow: 0 0 0 4px rgba(13, 70, 107, 0.08);
}

.button,
button[type="submit"],
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 52px;
    padding: 0.95rem 1.2rem;
    border-radius: 16px;
    border: 0;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.button:hover,
button[type="submit"]:hover,
.button-link:hover {
    transform: translateY(-1px);
}

.button--primary,
button[type="submit"] {
    background: linear-gradient(135deg, var(--primary) 0%, #14618e 100%);
    color: #fff;
    box-shadow: 0 12px 28px rgba(13, 70, 107, 0.22);
}

.button--secondary {
    background: rgba(13, 70, 107, 0.08);
    color: var(--primary);
}

.button--ghost {
    background: transparent;
    border: 1px solid rgba(23, 48, 66, 0.12);
    color: var(--text);
}

.hero-metrics {
    display: grid;
    gap: 1rem;
}

.stat-card {
    padding: 1.45rem;
}

.stat-card strong {
    display: block;
    font-size: 2rem;
    color: var(--primary-strong);
    margin-bottom: 0.35rem;
}

.notice {
    padding: 1.15rem 1.25rem;
    border-left: 5px solid var(--warning);
    color: var(--text-soft);
    line-height: 1.6;
}

.section {
    padding: 1.25rem 0;
}

.section-title {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-title p {
    max-width: 65ch;
    color: var(--text-soft);
}

.cnpj-result-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.cnpj-result-copy {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
}

.cnpj-company-title {
    margin: 0;
    font-size: clamp(2rem, 3vw, 3rem);
    line-height: 1.05;
    word-break: break-word;
}

.cnpj-company-meta {
    margin: 0;
}

.cnpj-result-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 1rem;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
}

.card {
    padding: 1.4rem;
}

.card h2,
.card h3 {
    margin: 0 0 0.65rem;
    font-size: 1.3rem;
}

.card p,
.panel p,
.muted,
.list-table td,
.list-table th,
.footer-grid p {
    color: var(--text-soft);
    line-height: 1.65;
}

.card .tag-list,
.tag-list {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.tag-list form {
    margin: 0;
}

.tag {
    display: inline-flex;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    background: rgba(13, 70, 107, 0.08);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
}

.two-col,
.dashboard-grid,
.content-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.three-col {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.panel {
    padding: 1.5rem;
}

.field {
    display: grid;
    gap: 0.45rem;
}

.field label {
    font-weight: 600;
}

.field small {
    color: var(--text-soft);
}

.alert {
    margin-bottom: 1rem;
    border-radius: 18px;
    padding: 1rem 1.2rem;
    border: 1px solid rgba(23, 48, 66, 0.08);
}

.alert--success {
    background: rgba(29, 138, 99, 0.1);
    border-color: rgba(29, 138, 99, 0.2);
}

.alert--error {
    background: rgba(184, 75, 75, 0.1);
    border-color: rgba(184, 75, 75, 0.2);
}

.alert--warning {
    background: rgba(217, 139, 31, 0.12);
    border-color: rgba(217, 139, 31, 0.2);
}

.alert--info {
    background: rgba(13, 70, 107, 0.08);
    border-color: rgba(13, 70, 107, 0.14);
}

.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.metric {
    padding: 1.2rem;
    border-radius: 20px;
    background: var(--surface-alt);
    border: 1px solid rgba(23, 48, 66, 0.08);
}

.metric strong {
    display: block;
    font-size: 1.7rem;
    color: var(--primary-strong);
    line-height: 1.1;
}

.metrics-row--cnpj {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metrics-row--cnpj .metric--wide {
    grid-column: span 2;
}

.metric-strong--location {
    font-size: 1.35rem;
    word-break: break-word;
}

.cnpj-details-table {
    margin-top: 1rem;
}

.cnpj-details-table .list-table {
    min-width: 0;
    table-layout: fixed;
}

.cnpj-details-table th {
    width: 28%;
}

.cnpj-details-table td {
    overflow-wrap: anywhere;
}

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

.list-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

.list-table th,
.list-table td {
    text-align: left;
    padding: 0.9rem 0.75rem;
    border-bottom: 1px solid rgba(23, 48, 66, 0.08);
}

.list-table th {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text);
}

.chart-card {
    padding-bottom: 1rem;
}

.chart-wrapper {
    min-height: 320px;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 320px !important;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: rgba(13, 70, 107, 0.08);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
}

.badge--success {
    background: rgba(29, 138, 99, 0.12);
    color: var(--accent);
}

.badge--warning {
    background: rgba(217, 139, 31, 0.14);
    color: #925b06;
}

.badge--danger {
    background: rgba(184, 75, 75, 0.12);
    color: var(--danger);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-soft);
    background: rgba(13, 70, 107, 0.03);
    border-radius: 24px;
    border: 1px dashed rgba(13, 70, 107, 0.2);
}

.site-footer {
    padding: 1.5rem 0 3rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr 0.9fr;
    gap: 1rem;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.6rem;
}

.footer-links a {
    color: var(--text-soft);
}

.admin-body .site-header {
    background: rgba(8, 30, 45, 0.92);
}

.admin-body .brand-copy strong,
.admin-body .brand-copy small,
.admin-body .site-nav a {
    color: #f3f8fb;
}

.admin-body .site-nav a.is-active,
.admin-body .site-nav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.report-shell {
    background: #fff;
    padding: 2rem;
    border-radius: 28px;
    box-shadow: var(--shadow);
}

@media (max-width: 1080px) {
    .hero-grid,
    .cards-grid,
    .metrics-row,
    .footer-grid,
    .three-col,
    .two-col,
    .dashboard-grid,
    .content-grid {
        grid-template-columns: 1fr 1fr;
    }

    .cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cnpj-result-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 780px) {
    .header-inner {
        min-height: 76px;
    }

    .nav-toggle {
        display: inline-block;
    }

    .site-nav {
        position: absolute;
        top: calc(100% + 0.75rem);
        left: 1rem;
        right: 1rem;
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem;
        border-radius: 22px;
        background: rgba(255, 255, 255, 0.98);
        border: 1px solid rgba(23, 48, 66, 0.08);
        box-shadow: var(--shadow);
    }

    .site-nav.is-open {
        display: flex;
    }

    .admin-body .site-nav {
        background: rgba(11, 34, 49, 0.98);
    }

    .hero-grid,
    .cards-grid,
    .metrics-row,
    .footer-grid,
    .three-col,
    .two-col,
    .dashboard-grid,
    .content-grid,
    .smart-search {
        grid-template-columns: 1fr;
    }

    .hero-panel,
    .card,
    .panel,
    .stat-card {
        padding: 1.35rem;
        border-radius: 22px;
    }

    .hero h1 {
        font-size: 2.35rem;
    }

    .cnpj-result-head {
        flex-direction: column;
        align-items: stretch;
    }

    .metrics-row--cnpj {
        grid-template-columns: 1fr;
    }

    .metrics-row--cnpj .metric--wide {
        grid-column: span 1;
    }

    .cnpj-details-table th,
    .cnpj-details-table td {
        display: block;
        width: 100%;
    }

    .cnpj-details-table th {
        padding-bottom: 0.25rem;
        border-bottom: 0;
    }

    .cnpj-details-table td {
        padding-top: 0;
    }
}
