/* Reset básico */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body.tw-cadastro {
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #eef5fb 0%, #f6f9fc 100%);
    color: #1f2937;
    min-height: 100vh;
}

/* Container */
.tw-cad-container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.tw-cad-header {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 20;
}

.tw-cad-header-content {
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.tw-cad-logo {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
}

.tw-cad-logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1f74e8 0%, #0e5fd1 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(31, 116, 232, 0.18);
}

/* Identidade SistemaExtintor */
body.tw-cadastro {
    font-family: "DM Sans", Arial, Helvetica, sans-serif;
    color: #172027;
    background:
        radial-gradient(circle at 8% 0, rgba(185, 28, 28, .09), transparent 28%),
        linear-gradient(180deg, #fffdf9 0%, #f7f4ef 100%);
}

.tw-cad-header { border-color: #e6e8e9; }

.tw-cad-logo-icon {
    background: #b91c1c;
    border-radius: 18px 18px 18px 4px;
    font: 800 12px Manrope, sans-serif;
    box-shadow: 0 8px 22px rgba(185, 28, 28, .22);
}

.tw-cad-logo strong {
    color: #172027;
    font-family: Manrope, sans-serif;
    font-weight: 800;
}

.tw-cad-logo strong .se-red { display: inline; color: #b91c1c; font-size: inherit; }
.tw-cad-login { color: #7f1d1d; background: #fff1f1; border-radius: 12px; }
.tw-cad-login:hover { background: #fee2e2; }
.tw-cad-card { border-color: #e6e8e9; box-shadow: 0 20px 55px rgba(23, 32, 39, .09); }
.tw-cad-title span { color: #b91c1c; }
.tw-cad-title h1 { color: #172027; font-family: Manrope, sans-serif; letter-spacing: -.035em; }
.tw-cad-title p { color: #637078; }
.tw-cad-section-label { color: #7f1d1d; border-color: #eee8e4; }
.tw-cad-field label { color: #29343a; }
.tw-cad-field input,
.tw-cad-field select,
.tw-cad-field textarea { color: #172027; border-color: #d9dddf; background: #fffdfb; border-radius: 12px; }
.tw-cad-field input:focus,
.tw-cad-field select:focus,
.tw-cad-field textarea:focus { border-color: #b91c1c; box-shadow: 0 0 0 4px rgba(185, 28, 28, .10); }
.tw-cad-btn-primary { background: #b91c1c; box-shadow: 0 12px 26px rgba(185, 28, 28, .20); }
.tw-cad-btn-primary:hover { background: #7f1d1d; }
.tw-cad-btn-secondary { color: #7f1d1d; border-color: #e7bbbb; background: #fff7f7; }
.tw-cad-btn-secondary:hover { background: #fee2e2; border-color: #d99b9b; }
.tw-cad-subdomain span { color: #7f1d1d; background: #fff1f1; border-color: #e7bbbb; }

.tw-cad-logo-image {
    display: block;
    width: 190px;
    max-width: 46vw;
    height: 52px;
    object-fit: contain;
    object-position: left center;
}

.tw-cad-logo strong {
    display: block;
    font-size: 20px;
    line-height: 1.1;
    color: #18489b;
}

.tw-cad-logo span {
    display: block;
    font-size: 14px;
    color: #5b6b82;
    line-height: 1.2;
}

.tw-cad-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 14px;
    background: #eef4ff;
    color: #1762d1;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tw-cad-login:hover {
    background: #dfeaff;
}

/* Main */
.tw-cad-main {
    padding: 48px 0 64px;
}

/* Card */
.tw-cad-card {
    background: #ffffff;
    border: 1px solid #e6edf5;
    border-radius: 28px;
    padding: 38px 38px 34px;
    box-shadow: 0 18px 45px rgba(15, 44, 91, 0.08);
}

.tw-cad-title {
    margin-bottom: 28px;
}

.tw-cad-title span {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #1762d1;
}

.tw-cad-title h1 {
    margin: 0 0 12px;
    font-size: clamp(34px, 4vw, 54px);
    line-height: 1.05;
    font-weight: 800;
    color: #0f274f;
}

.tw-cad-title p {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: #55657d;
    max-width: 760px;
}

/* Alerts */
.tw-cad-alert {
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 22px;
    font-size: 15px;
    line-height: 1.5;
    font-weight: 600;
}

.tw-cad-alert-success {
    background: #eaf8ee;
    border: 1px solid #b9e3c3;
    color: #1f6b35;
}

.tw-cad-alert-error {
    background: #fff0f0;
    border: 1px solid #f0c3c3;
    color: #b42318;
}

/* Form */
.tw-cad-form {
    width: 100%;
}

.tw-cad-section-label {
    margin: 28px 0 16px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #6a7b92;
    border-top: 1px solid #edf2f7;
    padding-top: 18px;
}

/* Grids */
.tw-cad-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
    margin-bottom: 18px;
}

.tw-cad-grid-cnpj {
    grid-template-columns: minmax(0, 1.35fr) auto;
    align-items: end;
}

.tw-cad-grid-address {
    grid-template-columns: 180px minmax(0, 1fr) 160px;
}

.tw-cad-grid-city {
    grid-template-columns: minmax(0, 1fr) 120px;
}

/* Fields */
.tw-cad-field {
    width: 100%;
    min-width: 0;
}

.tw-cad-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 700;
    color: #24364d;
}

.tw-cad-field input,
.tw-cad-field select,
.tw-cad-field textarea {
    width: 100%;
    min-width: 0;
    height: 54px;
    border: 1px solid #cfd9e6;
    border-radius: 16px;
    background: #f8fbff;
    padding: 0 16px;
    font-size: 16px;
    color: #14263f;
    outline: none;
    transition: all 0.2s ease;
}

.tw-cad-field textarea {
    min-height: 120px;
    height: auto;
    padding: 14px 16px;
    resize: vertical;
}

.tw-cad-field input::placeholder,
.tw-cad-field textarea::placeholder {
    color: #97a6ba;
}

.tw-cad-field input:focus,
.tw-cad-field select:focus,
.tw-cad-field textarea:focus {
    border-color: #1f74e8;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(31, 116, 232, 0.12);
}

/* Botões */
.tw-cad-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    border: 0;
    border-radius: 16px;
    padding: 0 22px;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.tw-cad-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.tw-cad-btn-primary {
    width: 100%;
    margin-top: 8px;
    background: linear-gradient(135deg, #1f74e8 0%, #0e5fd1 100%);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(31, 116, 232, 0.22);
}

.tw-cad-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(31, 116, 232, 0.26);
}

.tw-cad-btn-secondary {
    background: #eaf2ff;
    color: #1762d1;
    min-width: 190px;
}

.tw-cad-btn-secondary:hover {
    background: #dce9ff;
}

.tw-cadastro-sistemaextintor {
    background: linear-gradient(180deg, #eaf5f4 0%, #f6f9fc 100%);
}

.tw-cadastro-sistemaextintor .tw-cad-login,
.tw-cadastro-sistemaextintor .tw-cad-btn-secondary {
    background: #e5f4f3;
    color: #007b80;
}

.tw-cadastro-sistemaextintor .tw-cad-login:hover,
.tw-cadastro-sistemaextintor .tw-cad-btn-secondary:hover {
    background: #d4ebe9;
}

.tw-cadastro-sistemaextintor .tw-cad-title span {
    color: #008b91;
}

.tw-cadastro-sistemaextintor .tw-cad-field input:focus,
.tw-cadastro-sistemaextintor .tw-cad-field select:focus,
.tw-cadastro-sistemaextintor .tw-cad-field textarea:focus {
    border-color: #008b91;
    box-shadow: 0 0 0 4px rgba(0, 139, 145, 0.12);
}

.tw-cadastro-sistemaextintor .tw-cad-btn-primary {
    background: linear-gradient(135deg, #12323a 0%, #008b91 100%);
    box-shadow: 0 10px 24px rgba(0, 139, 145, 0.22);
}

.tw-cadastro-sistemaextintor .tw-cad-btn-primary:hover {
    box-shadow: 0 14px 26px rgba(0, 139, 145, 0.26);
}

.tw-cad-field-button {
    display: flex;
}

.tw-cad-field-button .tw-cad-btn {
    width: 100%;
}

/* Subdomínio */
.tw-cad-subdomain {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tw-cad-subdomain input {
    flex: 1;
}

.tw-cad-subdomain span {
    white-space: nowrap;
    font-size: 15px;
    font-weight: 700;
    color: #586a82;
}

/* Status da consulta */
.tw-cad-status {
    margin-top: -4px;
    margin-bottom: 18px;
    min-height: 24px;
    font-size: 14px;
    font-weight: 600;
    color: #66778f;
}

.tw-cad-status-success {
    color: #1f7a38;
}

.tw-cad-status-error {
    color: #b42318;
}

/* Honeypot */
.tw-cad-honeypot {
    position: absolute !important;
    left: -99999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Responsividade */
@media (max-width: 1024px) {
    .tw-cad-main {
        padding: 36px 0 54px;
    }

    .tw-cad-card {
        padding: 30px 26px 26px;
        border-radius: 24px;
    }

    .tw-cad-grid-address {
        grid-template-columns: 160px minmax(0, 1fr) 140px;
    }
}

@media (max-width: 860px) {
    .tw-cad-grid,
    .tw-cad-grid-cnpj,
    .tw-cad-grid-address,
    .tw-cad-grid-city {
        grid-template-columns: 1fr;
    }

    .tw-cad-field-button {
        width: 100%;
    }

    .tw-cad-btn-secondary {
        min-width: 0;
        width: 100%;
    }

    .tw-cad-subdomain {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .tw-cad-subdomain span {
        white-space: normal;
    }
}

@media (max-width: 640px) {
    .tw-cad-container {
        padding: 0 16px;
    }

    .tw-cad-header-content {
        min-height: auto;
        padding: 14px 0;
        flex-direction: column;
        align-items: stretch;
    }

    .tw-cad-login {
        width: 100%;
    }

    .tw-cad-main {
        padding: 22px 0 32px;
    }

    .tw-cad-card {
        padding: 22px 18px 20px;
        border-radius: 20px;
    }

    .tw-cad-title h1 {
        font-size: 38px;
    }

    .tw-cad-title p {
        font-size: 15px;
    }

    .tw-cad-field label {
        font-size: 14px;
    }

    .tw-cad-field input,
    .tw-cad-field select,
    .tw-cad-field textarea,
    .tw-cad-btn {
        height: 50px;
        font-size: 15px;
        border-radius: 14px;
    }

    .tw-cad-btn-primary {
        margin-top: 6px;
    }
}

/* Tema final SistemaExtintor (mantido ao fim para prevalecer sobre o legado). */
body.tw-cadastro { font-family: "DM Sans", Arial, Helvetica, sans-serif; color: #172027; background: radial-gradient(circle at 8% 0, rgba(185, 28, 28, .09), transparent 28%), linear-gradient(180deg, #fffdf9 0%, #f7f4ef 100%); }
.tw-cad-header { border-color: #e6e8e9; }
.tw-cad-logo-icon { width: 42px; height: 50px; background: transparent; border-radius: 0; box-shadow: none; }
.tw-cad-logo-icon img { display: block; width: 42px; height: 50px; object-fit: contain; }
.se-extinguisher { position: relative; width: 28px; height: 38px; display: block; }
.se-extinguisher i { position: absolute; left: 5px; bottom: 2px; width: 18px; height: 27px; background: linear-gradient(90deg,#dc2626,#b91c1c 72%); border: 1px solid #991b1b; border-radius: 6px 6px 8px 8px; box-shadow: 2px 3px 7px rgba(185,28,28,.18); }
.se-extinguisher i::before { content: ""; position: absolute; left: 2px; top: -8px; width: 15px; height: 7px; border: 2px solid #4b555a; border-right-width: 5px; border-radius: 4px 7px 2px 2px; }
.se-extinguisher i::after { content: ""; position: absolute; left: 4px; top: 9px; width: 8px; height: 7px; border-radius: 2px; background: #fff7ed; border: 1px solid #f3d4ba; }
.se-extinguisher::after { content: ""; position: absolute; right: 0; top: 7px; width: 9px; height: 16px; border-right: 2px solid #4b555a; border-bottom: 2px solid #4b555a; border-radius: 0 0 8px 0; }
.tw-cad-logo strong { color: #172027; font-family: Manrope, sans-serif; font-weight: 800; }
.tw-cad-logo strong .se-red { display: inline; color: #b91c1c; font-size: inherit; }
.tw-cad-login { color: #7f1d1d; background: #fff1f1; border-radius: 12px; }
.tw-cad-login:hover { background: #fee2e2; }
.tw-cad-card { border-color: #e6e8e9; box-shadow: 0 20px 55px rgba(23, 32, 39, .09); }
.tw-cad-title span { color: #b91c1c; }
.tw-cad-title h1 { color: #172027; font-family: Manrope, sans-serif; letter-spacing: -.035em; }
.tw-cad-title p { color: #637078; }
.tw-cad-section-label { color: #7f1d1d; border-color: #eee8e4; }
.tw-cad-field label { color: #29343a; }
.tw-cad-field input, .tw-cad-field select, .tw-cad-field textarea { color: #172027; border-color: #d9dddf; background: #fffdfb; border-radius: 12px; }
.tw-cad-field input:focus, .tw-cad-field select:focus, .tw-cad-field textarea:focus { border-color: #b91c1c; box-shadow: 0 0 0 4px rgba(185, 28, 28, .10); }
.tw-cad-btn-primary { background: #b91c1c; box-shadow: 0 12px 26px rgba(185, 28, 28, .20); }
.tw-cad-btn-primary:hover { background: #7f1d1d; }
.tw-cad-btn-secondary { color: #7f1d1d; border-color: #e7bbbb; background: #fff7f7; }
.tw-cad-btn-secondary:hover { background: #fee2e2; border-color: #d99b9b; }
.tw-cad-subdomain span { color: #7f1d1d; background: #fff1f1; border-color: #e7bbbb; }



