:root {
    --surface: #FFFFFF;
    --primary-tint: #E4EDE9;
    --line: #DBE2DE;
    --danger: #B3453A;
    --font-display: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius: 10px;
    --shadow-card: 0 1px 2px rgba(22, 35, 58, .04), 0 8px 24px -12px rgba(22, 35, 58, .12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

/* =========================================================
LAYOUT
========================================================= */
.page {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--primary-dark);
    color: #EDF3F0;
    padding: 36px 28px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    overflow-y: auto;
}

.sidebar-top .logo {
    max-width: 168px;
    max-height: 64px;
    object-fit: contain;
    display: block;
}

.main {
    padding: 56px 64px 100px;
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
}

/* =========================================================
SIDEBAR / STEPPER
========================================================= */
.stepper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    text-align: left;
    background: none;
    border: none;
    color: inherit;
    padding: 12px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-body);
    opacity: .55;
    transition: opacity .2s ease, background .2s ease;
}

.step:hover {
    opacity: .85;
    background: rgba(255, 255, 255, .05);
}

.step.active {
    opacity: 1;
}

.step.done .step-num {
    background: var(--accent);
    color: var(--primary-dark);
}

.step-num {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(237, 243, 240, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .2s ease, color .2s ease;
}

.step-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 2px;
}

.step-title {
    font-size: 14px;
    font-weight: 600;
}

.step-sub {
    font-size: 11.5px;
    color: rgba(237, 243, 240, .6);
}

.seal-wrap {
    margin-top: auto;
    display: flex;
    justify-content: center;
}

.seal {
    width: 132px;
    height: 132px;
}

.seal-track {
    fill: none;
    stroke: rgba(237, 243, 240, .14);
    stroke-width: 6;
}

.seal-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 326.7;
    stroke-dashoffset: 326.7;
    transform: rotate(-90deg);
    transform-origin: 60px 60px;
    transition: stroke-dashoffset .5s ease;
}

.seal-percent {
    fill: #EDF3F0;
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 600;
}

.seal-label {
    fill: rgba(237, 243, 240, .55);
    font-family: var(--font-body);
    font-size: 9px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* =========================================================
MAIN HEADER
========================================================= */
.eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 10px;
}

.main-header h1 {
    font-family: var(--font-display);
    font-size: 38px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0 0 14px;
    color: var(--ink);
}

.lead {
    font-size: 15.5px;
    color: var(--text-muted);
    max-width: 52ch;
    line-height: 1.6;
    margin: 0 0 44px;
}

/* =========================================================
CARDS / SECTIONS
========================================================= */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 32px 32px 30px;
    margin-bottom: 24px;
    scroll-margin-top: 24px;
}

.card-head {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 26px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.card-num {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.card-head h2 {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0 0 4px;
    color: var(--ink);
}

.card-head p {
    font-size: 13.5px;
    color: var(--text-muted);
    margin: 0;
}

#s2.card.minor-required .card-head p {
    color: var(--danger);
    font-weight: 600;
}

#s2.card.disabled {
    opacity: .55;
}

/* =========================================================
FORM GRID / FIELDS
========================================================= */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    position: relative;
}

.span-2 {
    grid-column: span 2;
}

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.optional {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 12px;
}

input,
select {
    font-family: var(--font-body);
    font-size: 14.5px;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 8px;
    padding: 11px 13px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    width: 100%;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235C6B66' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

input::placeholder {
    color: #A6B0AC;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-tint);
}

input:disabled,
select:disabled {
    background: #F4F6F5;
    color: #9CA6A1;
    cursor: not-allowed;
}

.field.invalid input,
.field.invalid select {
    border-color: var(--danger);
}

.field.valid input,
.field.valid select {
    border-color: #7FA88C;
}

.error-msg {
    font-size: 12px;
    color: var(--danger);
    min-height: 14px;
    display: block;
}

.cep-status {
    position: absolute;
    right: 13px;
    top: 34px;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

textarea{
    font-family: var(--font-body);
    font-size: 14.5px;
    color: var(--ink);
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 8px;
    padding: 11px 13px;
    outline: none;
    width: 100%;
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
    transition: border-color .15s ease, box-shadow .15s ease;
}

textarea::placeholder{ color: #A6B0AC; }

textarea:focus{
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-tint);
}

textarea:disabled{
    background: #F4F6F5;
    color: #9CA6A1;
    cursor: not-allowed;
}

.field.invalid textarea{ border-color: var(--danger); }
.field.valid textarea{ border-color: #7FA88C; }

/* =========================================================
SUBMIT
========================================================= */
.submit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 8px;
}

.submit-note {
    font-size: 12.5px;
    color: var(--danger);
    margin: 0;
    min-height: 16px;
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--primary);
    color: #EDF3F0;
    border: none;
    border-radius: 999px;
    padding: 14px 26px;
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
    flex-shrink: 0;
}

.btn-submit:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit svg {
    transition: transform .18s ease;
}

.btn-submit:hover svg {
    transform: translateX(3px);
}

/* =========================================================
TOAST
========================================================= */
.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: var(--primary-dark);
    color: #EDF3F0;
    padding: 16px 22px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .4);
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform .25s ease, opacity .25s ease;
    z-index: 50;
    max-width: 320px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: var(--danger);
}

.sucesso {
    position: fixed;
    inset: 0;
    background: #000000ed;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: #fff;
    text-align: center;
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .4s ease, visibility .4s ease;
}

.sucesso.mostrar {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sucesso_a {
    font-size: 30px;
    font-weight: bold;
    font-family: 'Inter';
    color: #63cd63;
}

.sucesso_b {
    font-family: 'Inter';
    color: #c3c3c3;
}
/* =========================================================
RESPONSIVE
========================================================= */
@media (max-width: 980px) {
    .page {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 20px 24px;
        gap: 20px;
        justify-content: center;
        align-items: center;
    }

    .stepper {
        display: none;
    }

    .step-info {
        display: none;
    }

    .seal-wrap {
        display: none;
    }

    .seal {
        width: 64px;
        height: 64px;
    }

    .seal-percent {
        font-size: 16px;
    }

    .seal-label {
        display: none;
    }

    .main {
        padding: 36px 20px 80px;
    }

    .main-header h1 {
        font-size: 30px;
    }
}

@media (max-width: 600px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }

    .submit-row {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-submit {
        justify-content: center;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    * {
        transition: none !important;
    }
}