:root {
    --primary: #087f5b;
    --ink: #17352c;
    --muted: #657871;
    --line: #dce7e2;
    --surface: #ffffff;
    --soft: #f2f7f5;
    --danger: #b42318;
    --danger-soft: #fff1f0;
    --success: #067647;
    --success-soft: #ecfdf3;
    --warning: #b54708;
    --warning-soft: #fffaeb;
    --shadow: 0 24px 70px rgba(24, 53, 45, 0.12);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f7faf8;
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.public-page {
    background:
        radial-gradient(circle at 5% 8%, color-mix(in srgb, var(--primary) 13%, transparent), transparent 28rem),
        linear-gradient(135deg, #eef6f2 0%, #fbfdfc 48%, #f2f7f5 100%);
}

a {
    color: inherit;
}

button,
input,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.container {
    width: min(1180px, calc(100% - 40px));
    margin-inline: auto;
}

.narrow-container {
    width: min(920px, calc(100% - 40px));
}

.site-header {
    position: relative;
    z-index: 20;
    min-height: 78px;
    border-bottom: 1px solid rgba(23, 53, 44, 0.08);
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(18px);
}

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

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand > span:last-child {
    display: grid;
}

.brand strong {
    font-size: 17px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.brand small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.13em;
}

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

.brand-mark {
    width: 44px;
    height: 44px;
    padding: 9px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    border-radius: 13px;
    color: white;
    background: var(--primary);
    box-shadow: 0 9px 22px color-mix(in srgb, var(--primary) 28%, transparent);
}

.brand-mark span {
    width: 6px;
    border-radius: 2px 2px 0 0;
    background: currentColor;
}

.brand-mark span:nth-child(1) {
    height: 13px;
}

.brand-mark span:nth-child(2) {
    height: 23px;
}

.brand-mark span:nth-child(3) {
    height: 18px;
}

.brand-mark.large {
    width: 72px;
    height: 72px;
    padding: 15px;
    gap: 5px;
    border-radius: 20px;
}

.brand-mark.large span {
    width: 9px;
}

.brand-mark.large span:nth-child(1) {
    height: 22px;
}

.brand-mark.large span:nth-child(2) {
    height: 38px;
}

.brand-mark.large span:nth-child(3) {
    height: 30px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: 14px;
    font-weight: 650;
}

.main-nav a,
.link-button {
    border: 0;
    padding: 8px 0;
    color: #52665f;
    background: none;
    text-decoration: none;
    cursor: pointer;
}

.main-nav a:hover,
.link-button:hover {
    color: var(--primary);
}

.main-nav form {
    margin: 0;
}

.main-nav .nav-admin {
    padding: 10px 15px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: white;
}

.flash-wrap {
    position: relative;
    z-index: 30;
    margin-top: 18px;
    margin-bottom: -6px;
}

.flash {
    padding: 13px 16px;
    border: 1px solid;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 650;
    box-shadow: 0 8px 24px rgba(23, 53, 44, 0.06);
}

.flash-success {
    border-color: #abefc6;
    color: var(--success);
    background: var(--success-soft);
}

.flash-error {
    border-color: #fecdca;
    color: var(--danger);
    background: var(--danger-soft);
}

.hero {
    min-height: calc(100vh - 146px);
    padding: 72px 0 84px;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.82fr) minmax(580px, 1.18fr);
    gap: clamp(44px, 7vw, 90px);
    align-items: start;
}

.hero-copy {
    position: sticky;
    top: 36px;
    padding: 34px 0;
}

.eyebrow {
    display: block;
    margin-bottom: 12px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.hero-copy h1,
.page-heading h1,
.success-card h1,
.login-card h1 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(38px, 5vw, 62px);
    line-height: 1.02;
    letter-spacing: -0.05em;
}

.hero-copy h1 {
    max-width: 620px;
}

.hero-lead {
    max-width: 560px;
    margin: 24px 0 34px;
    color: #536b63;
    font-size: 18px;
    line-height: 1.7;
}

.benefit-list {
    display: grid;
    gap: 18px;
    margin: 34px 0;
}

.benefit {
    display: flex;
    align-items: center;
    gap: 14px;
}

.benefit-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, white);
    font-weight: 900;
}

.benefit div {
    display: grid;
    gap: 2px;
}

.benefit strong {
    font-size: 15px;
}

.benefit small {
    color: var(--muted);
    font-size: 13px;
}

.privacy-note {
    max-width: 520px;
    display: flex;
    gap: 13px;
    margin-top: 38px;
    padding: 18px 20px;
    border: 1px solid color-mix(in srgb, var(--primary) 16%, white);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.58);
}

.privacy-note > span {
    color: var(--primary);
    font-size: 21px;
}

.privacy-note p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.privacy-note strong {
    color: var(--ink);
}

.form-card,
.panel,
.login-card,
.success-card {
    border: 1px solid rgba(23, 53, 44, 0.08);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.form-card {
    overflow: hidden;
}

.form-card-head {
    padding: 30px 34px 26px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--line);
}

.form-card-head h2 {
    margin: 0;
    font-size: 27px;
    letter-spacing: -0.035em;
}

.form-card-head .eyebrow {
    margin-bottom: 7px;
}

.required-note {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.registration-form {
    padding: 8px 34px 34px;
}

.form-section {
    padding: 28px 0;
    border-bottom: 1px solid var(--line);
}

.section-heading {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    margin-bottom: 22px;
}

.section-heading h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.3;
}

.section-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.step-number {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: white;
    background: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

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

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

.field {
    min-width: 0;
    display: grid;
    gap: 7px;
    color: #314c43;
    font-size: 13px;
    font-weight: 700;
}

.field input,
.field select,
.filter-bar input,
.filter-bar select {
    width: 100%;
    min-height: 46px;
    border: 1px solid #cbdad4;
    border-radius: 10px;
    outline: none;
    color: var(--ink);
    background: #fff;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field input,
.field select {
    padding: 11px 13px;
}

.field input::placeholder,
.filter-bar input::placeholder {
    color: #93a49e;
}

.field input:focus,
.field select:focus,
.filter-bar input:focus,
.filter-bar select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 13%, transparent);
}

.field input[readonly] {
    background: #f7faf8;
}

.field.has-error input,
.field.has-error select {
    border-color: var(--danger);
    background: var(--danger-soft);
}

.field-help {
    color: #768982;
    font-size: 11px;
    font-weight: 500;
}

.field-error {
    display: block;
    color: var(--danger);
    font-size: 11px;
    font-weight: 700;
}

.rent-input {
    font-size: 19px !important;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.input-with-status {
    position: relative;
    display: block;
}

.input-with-status input {
    padding-right: 42px;
}

.cep-spinner {
    position: absolute;
    top: 50%;
    right: 14px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    display: none;
    border: 2px solid #cbdad4;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

.is-loading .cep-spinner {
    display: block;
}

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

.consent-field {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin: 24px 0;
    color: #5e726b;
    font-size: 12px;
    line-height: 1.55;
    cursor: pointer;
}

.consent-field input {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    margin-top: 2px;
    accent-color: var(--primary);
}

.consent-field.has-error {
    padding: 12px;
    border-radius: 10px;
    color: var(--danger);
    background: var(--danger-soft);
}

.button {
    min-height: 44px;
    padding: 11px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
}

.button-primary {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 22%, transparent);
}

.button-primary:hover {
    background: color-mix(in srgb, var(--primary) 88%, black);
}

.button-secondary {
    border-color: color-mix(in srgb, var(--primary) 30%, white);
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 7%, white);
}

.button-ghost {
    border-color: var(--line);
    color: #50665e;
    background: white;
}

.button-large {
    width: 100%;
    min-height: 51px;
    font-size: 15px;
}

.submit-note {
    margin: 10px 0 0;
    color: var(--muted);
    text-align: center;
    font-size: 11px;
}

.error-summary {
    margin: 24px 34px 0;
    padding: 14px 16px;
    display: grid;
    gap: 3px;
    border: 1px solid #fecdca;
    border-radius: 11px;
    color: var(--danger);
    background: var(--danger-soft);
    font-size: 13px;
}

.error-summary span {
    font-size: 12px;
}

.site-footer {
    border-top: 1px solid rgba(23, 53, 44, 0.08);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.footer-inner {
    min-height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.login-section,
.success-section {
    min-height: calc(100vh - 145px);
    padding: 70px 0;
    display: grid;
    place-items: center;
}

.login-card,
.success-card {
    width: min(470px, calc(100% - 40px));
    padding: 38px;
    text-align: center;
}

.login-icon,
.success-icon {
    width: 62px;
    height: 62px;
    margin: 0 auto 20px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    color: white;
    background: var(--primary);
    font-size: 29px;
    font-weight: 900;
    box-shadow: 0 14px 30px color-mix(in srgb, var(--primary) 24%, transparent);
}

.success-icon {
    border-radius: 50%;
}

.login-card h1,
.success-card h1 {
    font-size: 34px;
}

.login-card > p,
.success-card > p {
    margin: 14px auto 28px;
    color: var(--muted);
}

.login-form {
    display: grid;
    gap: 18px;
    margin-top: 28px;
    text-align: left;
}

.protocol-box {
    margin: 24px 0;
    padding: 19px;
    display: grid;
    gap: 4px;
    border-radius: 13px;
    background: var(--soft);
}

.protocol-box small {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.protocol-box strong {
    color: var(--primary);
    font-size: 21px;
    letter-spacing: 0.04em;
}

.mail-result {
    padding: 13px;
    border-radius: 10px;
    background: var(--warning-soft);
    font-size: 13px !important;
}

.mail-result.mail-ok {
    color: var(--success);
    background: var(--success-soft);
}

.admin-page {
    background: #f3f7f5;
}

.admin-section {
    min-height: calc(100vh - 145px);
    padding: 44px 0 70px;
}

.page-heading {
    margin-bottom: 28px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.page-heading .eyebrow {
    margin-bottom: 8px;
}

.page-heading h1 {
    font-size: clamp(30px, 4vw, 42px);
}

.page-heading p {
    margin: 9px 0 0;
    color: var(--muted);
}

.back-link {
    display: inline-block;
    margin-bottom: 22px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.back-link:hover {
    color: var(--primary);
}

.stats-grid {
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.stat-card {
    min-width: 0;
    padding: 21px;
    display: grid;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 9px 28px rgba(23, 53, 44, 0.05);
}

.stat-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.stat-card strong {
    overflow: hidden;
    font-size: clamp(22px, 3vw, 29px);
    line-height: 1.2;
    letter-spacing: -0.04em;
    text-overflow: ellipsis;
}

.stat-card small {
    color: #8a9a94;
    font-size: 10px;
}

.panel {
    overflow: hidden;
    box-shadow: 0 15px 45px rgba(23, 53, 44, 0.07);
}

.filter-bar {
    padding: 18px;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 190px auto auto;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--line);
}

.filter-bar input,
.filter-bar select {
    min-height: 42px;
    padding: 9px 12px;
}

.clear-filter {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th,
td {
    padding: 15px 17px;
    border-bottom: 1px solid #e8efec;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #71847d;
    background: #fafcfb;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

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

tbody tr:hover {
    background: #fbfdfc;
}

td strong,
td span,
td small {
    display: block;
}

td small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.table-action {
    text-align: right;
}

.table-action a {
    color: var(--primary);
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.badge,
.mail-badge {
    width: max-content;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
}

.badge-pending {
    color: var(--warning);
    background: var(--warning-soft);
}

.badge-active {
    color: var(--success);
    background: var(--success-soft);
}

.badge-inactive {
    color: #475467;
    background: #f2f4f7;
}

.mail-enviado {
    color: var(--success);
    background: var(--success-soft);
}

.mail-falhou {
    color: var(--danger);
    background: var(--danger-soft);
}

.mail-pendente {
    color: var(--warning);
    background: var(--warning-soft);
}

.empty-state {
    padding: 45px 20px;
    display: grid;
    gap: 5px;
    color: var(--muted);
    text-align: center;
}

.empty-state strong {
    color: var(--ink);
}

.pagination {
    padding: 18px;
    display: flex;
    justify-content: center;
    gap: 7px;
    border-top: 1px solid var(--line);
}

.pagination a {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--muted);
    background: white;
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
}

.pagination a.active {
    border-color: var(--primary);
    color: white;
    background: var(--primary);
}

.edit-panel {
    padding: 0;
}

.edit-panel .registration-form {
    padding-top: 8px;
}

.edit-panel .error-summary {
    margin-bottom: 0;
}

.form-actions {
    padding-top: 24px;
    display: flex;
    gap: 11px;
    align-items: center;
}

.email-panel {
    margin-top: 20px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.email-panel .eyebrow {
    margin-bottom: 5px;
}

.email-panel h2 {
    margin: 0;
    font-size: 20px;
}

.email-panel p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.email-panel .technical-error {
    max-width: 580px;
    color: var(--danger);
    word-break: break-word;
}

.settings-panel {
    padding: 32px;
}

.settings-form {
    display: grid;
    gap: 22px;
}

.settings-preview {
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    border: 1px dashed #bfd0c9;
    border-radius: 15px;
    background: var(--soft);
}

.logo-preview {
    width: 78px;
    height: 78px;
    display: grid;
    place-items: center;
}

.logo-preview img {
    max-width: 78px;
    max-height: 78px;
    object-fit: contain;
}

.settings-preview > div:last-child {
    display: grid;
    gap: 4px;
}

.settings-preview strong {
    font-size: 18px;
}

.settings-preview small {
    color: var(--muted);
}

.color-control {
    display: flex;
    align-items: center;
    gap: 13px;
}

.color-control input[type="color"] {
    width: 64px;
    min-height: 48px;
    padding: 4px;
    cursor: pointer;
}

.color-control output {
    min-width: 94px;
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 14px;
}

.file-field input[type="file"] {
    height: auto;
    padding: 8px;
}

.file-field input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 8px 12px;
    border: 0;
    border-radius: 7px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, white);
    font-weight: 750;
    cursor: pointer;
}

.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;
}

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

    .hero-copy {
        position: static;
        padding: 0;
    }

    .hero-copy h1 {
        max-width: 700px;
    }

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

    .benefit {
        align-items: flex-start;
    }

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

@media (max-width: 760px) {
    .container,
    .narrow-container {
        width: min(100% - 24px, 680px);
    }

    .site-header,
    .header-inner {
        min-height: 68px;
    }

    .brand small {
        display: none;
    }

    .brand-mark {
        width: 39px;
        height: 39px;
    }

    .main-nav {
        gap: 12px;
        font-size: 12px;
    }

    .main-nav a:not(.nav-admin),
    .main-nav form {
        display: none;
    }

    .hero {
        padding: 42px 0 56px;
    }

    .hero-grid {
        gap: 35px;
    }

    .hero-copy h1 {
        font-size: 42px;
    }

    .hero-lead {
        margin: 18px 0 26px;
        font-size: 16px;
    }

    .benefit-list {
        grid-template-columns: 1fr;
        gap: 13px;
    }

    .privacy-note {
        margin-top: 26px;
    }

    .form-card-head,
    .registration-form,
    .settings-panel {
        padding-left: 20px;
        padding-right: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

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

    .error-summary {
        margin-left: 20px;
        margin-right: 20px;
    }

    .footer-inner {
        padding: 18px 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .admin-section {
        padding-top: 30px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }

    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
    }

    thead {
        display: none;
    }

    tbody tr {
        padding: 14px 17px;
        border-bottom: 1px solid var(--line);
    }

    tbody tr:last-child {
        border-bottom: 0;
    }

    td {
        padding: 7px 0;
        display: grid;
        grid-template-columns: 90px 1fr;
        gap: 12px;
        border: 0;
    }

    td::before {
        content: attr(data-label);
        color: #82938d;
        font-size: 10px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }

    td > * {
        min-width: 0;
    }

    td[colspan] {
        display: block;
    }

    td[colspan]::before,
    .table-action::before {
        display: none;
    }

    .table-action {
        display: block;
        padding-top: 10px;
        text-align: left;
    }

    .email-panel {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .brand strong {
        max-width: 135px;
        overflow: hidden;
        display: block;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .main-nav .nav-admin {
        padding: 8px 10px;
    }

    .hero-copy h1 {
        font-size: 36px;
    }

    .form-card-head {
        flex-direction: column;
        gap: 8px;
    }

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

    .login-card,
    .success-card {
        padding: 30px 22px;
    }

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