:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --line: #dbe4f2;
    --text: #071936;
    --muted: #5d6f8f;
    --primary: #655cf6;
    --primary-dark: #3b42d6;
    --aqua: #18c7d8;
    --success: #17b978;
    --warning: #f4b400;
    --danger: #ef4444;
    --shadow: 0 16px 38px rgba(31, 45, 79, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 18px;
    align-items: center;
    padding: 14px max(24px, calc((100vw - 1200px) / 2));
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.brand {
    display: inline-flex;
    align-items: center;
    width: fit-content;
}

.brand-logo {
    display: block;
    width: auto;
    height: 42px;
    object-fit: contain;
}

.brand-logo-large {
    height: 58px;
}

.nav {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.nav a,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: #263552;
    background: #fff;
    font-size: 14px;
    font-weight: 700;
}

.nav a.active,
.nav a:hover,
.btn-primary {
    color: #fff;
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.btn-light {
    color: #e11d48;
    border-color: #fecdd3;
}

.btn-muted {
    color: var(--primary-dark);
    background: #eef2ff;
}

.userbox {
    text-align: right;
    line-height: 1.2;
}

.userbox small {
    display: block;
    color: var(--muted);
}

.shell {
    width: min(1200px, calc(100vw - 32px));
    margin: 26px auto 60px;
}

.login-page,
.public-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 24% 16%, rgba(101, 92, 246, 0.22), transparent 28%),
        radial-gradient(circle at 78% 12%, rgba(24, 199, 216, 0.20), transparent 26%),
        var(--bg);
}

.login-card,
.public-card {
    width: min(1120px, 100%);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
}

.split {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 26px;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.12;
}

h1 {
    font-size: clamp(30px, 5vw, 54px);
}

h2 {
    font-size: 24px;
}

h3 {
    font-size: 17px;
}

p {
    color: var(--muted);
    line-height: 1.6;
}

.grid {
    display: grid;
    gap: 18px;
}

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

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

.card {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metric span {
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    font-size: 30px;
}

.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.filter-grid {
    display: grid;
    grid-template-columns: minmax(180px, .9fr) minmax(160px, .8fr) minmax(160px, .8fr) minmax(160px, .8fr);
    gap: 14px;
    align-items: end;
}

.compact-filter {
    padding: 18px 22px;
}

.field {
    display: grid;
    gap: 6px;
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.field.full {
    grid-column: 1 / -1;
}

label {
    color: #263552;
    font-size: 13px;
    font-weight: 800;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: #fff;
    font: inherit;
}

.money-field {
    position: relative;
}

.money-field::before {
    position: absolute;
    left: 12px;
    top: 50%;
    z-index: 1;
    color: var(--muted);
    font-weight: 800;
    content: "R$";
    transform: translateY(-50%);
}

.money-field input {
    padding-left: 42px;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 16px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid #edf1f7;
    text-align: left;
    vertical-align: top;
}

th {
    color: #536783;
    background: #f8fafc;
    font-size: 13px;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    color: var(--primary-dark);
    background: #eef2ff;
    font-size: 12px;
    font-weight: 800;
}

.badge.success {
    color: #047857;
    background: #dcfce7;
}

.badge.danger {
    color: #be123c;
    background: #ffe4e6;
}

.alert {
    margin-bottom: 18px;
    padding: 13px 16px;
    border-radius: 8px;
    color: #075985;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
}

.alert.error {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fecaca;
}

.lead-success {
    padding: 18px;
    border-radius: 8px;
    color: #075985;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
}

.copy-url {
    display: block;
    width: 100%;
    padding: 10px;
    border: 1px dashed var(--primary);
    border-radius: 8px;
    color: var(--primary-dark);
    background: #f5f3ff;
    overflow-wrap: anywhere;
    font-weight: 700;
}

.docs article {
    display: grid;
    gap: 16px;
}

.docs ul {
    color: var(--muted);
    line-height: 1.7;
}

.bar-chart {
    display: grid;
    grid-template-columns: repeat(12, minmax(38px, 1fr));
    gap: 10px;
    align-items: end;
    min-height: 240px;
    margin-top: 18px;
}

.bar-item {
    display: grid;
    gap: 7px;
    align-items: end;
    min-width: 0;
    text-align: center;
}

.bar-track {
    display: flex;
    align-items: end;
    height: 140px;
    border-radius: 8px;
    background: #f1f5fb;
    overflow: hidden;
}

.bar-track span {
    display: block;
    width: 100%;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
}

.bar-item strong {
    min-height: 18px;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.bar-item small {
    color: var(--muted);
    font-size: 11px;
}

.contract-doc {
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.contract-doc h2 {
    margin-bottom: 22px;
    text-align: center;
}

.contract-doc h3 {
    margin-top: 24px;
    color: var(--primary-dark);
    font-size: 15px;
}

.contract-doc p {
    color: #263552;
    text-align: justify;
}

.signature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 44px;
    margin-top: 52px;
}

.signature-grid span {
    display: block;
    height: 1px;
    margin-bottom: 10px;
    background: #263552;
}

.signature-grid strong,
.signature-grid small {
    display: block;
    text-align: center;
}

.signature-grid small {
    color: var(--muted);
}

@media (max-width: 800px) {
    .topbar {
        grid-template-columns: 1fr;
        justify-items: stretch;
    }

    .nav {
        justify-content: flex-start;
        overflow-x: auto;
    }

    .userbox {
        text-align: left;
    }

    .split,
    .grid-2,
    .grid-3,
    .form-grid,
    .filter-grid,
    .signature-grid {
        grid-template-columns: 1fr;
    }

    .bar-chart {
        overflow-x: auto;
        grid-template-columns: repeat(12, 48px);
        padding-bottom: 6px;
    }
}
