:root {
    --blue: #164d80;
    --blue-dark: #0c365e;
    --blue-soft: #eef5fb;
    --orange: #ef7d18;
    --green: #5cb947;
    --yellow: #f3c33f;
    --text: #243447;
    --muted: #6b7785;
    --border: #dfe7ef;
    --bg: #f4f7fa;
    --white: #ffffff;
    --danger: #b42318;
    --danger-bg: #fef3f2;
    --success: #027a48;
    --success-bg: #ecfdf3;
    --shadow: 0 18px 45px rgba(19, 55, 88, .12);
}

* {
    box-sizing: border-box;
}

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

body {
    min-height: 100vh;
}

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

button, input {
    font: inherit;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
    background:
        radial-gradient(circle at 10% 10%, rgba(92, 185, 71, .13), transparent 28%),
        radial-gradient(circle at 90% 90%, rgba(239, 125, 24, .13), transparent 30%),
        linear-gradient(135deg, #f8fbfd 0%, #edf4f9 100%);
}

.login-wrap {
    width: min(1050px, 100%);
    min-height: 570px;
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    background: var(--white);
    border: 1px solid rgba(22, 77, 128, .08);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.login-brand-panel {
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: var(--white);
    background:
        linear-gradient(150deg, rgba(12, 54, 94, .98), rgba(22, 77, 128, .94)),
        var(--blue-dark);
    position: relative;
}

.login-brand-panel::after {
    content: "";
    width: 220px;
    height: 220px;
    border: 30px solid rgba(243, 195, 63, .12);
    border-radius: 50%;
    position: absolute;
    right: -70px;
    bottom: -70px;
}

.login-brand-panel img {
    width: 230px;
    max-width: 70%;
    background: var(--white);
    padding: 12px 16px;
    border-radius: 16px;
}

.login-brand-panel h1 {
    font-size: clamp(32px, 4vw, 50px);
    line-height: 1.05;
    margin: 16px 0;
    max-width: 650px;
}

.login-brand-panel p {
    max-width: 570px;
    line-height: 1.65;
    color: rgba(255, 255, 255, .82);
    font-size: 17px;
}

.system-badge,
.eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--orange);
}

.login-card {
    padding: 70px 55px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-card-header h2,
.simple-auth-card h1 {
    margin: 0 0 8px;
    color: var(--blue-dark);
}

.login-card-header p,
.simple-auth-card p {
    margin: 0 0 28px;
    color: var(--muted);
    line-height: 1.55;
}

.form-label {
    display: block;
    margin: 18px 0 8px;
    font-size: 14px;
    font-weight: 700;
}

.form-control {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    color: var(--text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.form-control:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(22, 77, 128, .11);
}

.btn {
    border: 0;
    border-radius: 10px;
    min-height: 42px;
    padding: 10px 16px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--blue);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--blue-dark);
}

.btn-light {
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--blue-dark);
}

.btn-sm {
    min-height: 36px;
    padding: 7px 12px;
}

.btn-block {
    width: 100%;
    margin-top: 24px;
    min-height: 50px;
}

.login-security {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.alert {
    border-radius: 10px;
    padding: 12px 14px;
    margin: 16px 0;
    font-size: 14px;
}

.alert-danger {
    color: var(--danger);
    background: var(--danger-bg);
    border: 1px solid #fecdca;
}

.alert-success {
    color: var(--success);
    background: var(--success-bg);
    border: 1px solid #abefc6;
}

.simple-auth-card {
    width: min(470px, 100%);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 42px;
    box-shadow: var(--shadow);
}

.auth-logo {
    width: 190px;
    margin-bottom: 28px;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 260px;
    flex: 0 0 260px;
    min-height: 100vh;
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    background: var(--blue-dark);
    color: var(--white);
    z-index: 10;
}

.sidebar-logo {
    padding: 24px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.sidebar-logo img {
    width: 190px;
    max-width: 100%;
    background: var(--white);
    padding: 8px 10px;
    border-radius: 11px;
}

.sidebar-nav {
    padding: 22px 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-nav a {
    padding: 12px 14px;
    border-radius: 9px;
    color: rgba(255, 255, 255, .80);
    font-size: 14px;
    font-weight: 650;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: var(--white);
    background: rgba(255, 255, 255, .10);
}

.sidebar-nav a.active {
    box-shadow: inset 3px 0 0 var(--orange);
}

.nav-section {
    padding: 20px 14px 7px;
    color: rgba(255, 255, 255, .42);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: .14em;
    font-weight: 800;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, .1);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-footer span {
    color: rgba(255, 255, 255, .55);
    font-size: 12px;
}

.app-main {
    min-width: 0;
    width: calc(100% - 260px);
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    min-height: 78px;
    padding: 12px 30px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar-brand,
.topbar-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-brand img {
    width: 110px;
    display: none;
}

.topbar-brand div,
.topbar-user div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.topbar-brand strong {
    color: var(--blue-dark);
}

.topbar-brand span,
.topbar-user span {
    color: var(--muted);
    font-size: 12px;
}

.content {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 30px;
    flex: 1;
}

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

.page-heading h1 {
    margin: 5px 0 5px;
    color: var(--blue-dark);
    font-size: 29px;
}

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

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 22px;
    box-shadow: 0 7px 22px rgba(27, 63, 94, .05);
    border-top: 4px solid var(--blue);
}

.metric-card:nth-child(2) {
    border-top-color: var(--green);
}

.metric-card:nth-child(3) {
    border-top-color: var(--orange);
}

.metric-card:nth-child(4) {
    border-top-color: var(--yellow);
}

.metric-card:nth-child(5) {
    border-top-color: var(--green);
}

.metric-card.warning {
    border-top-color: var(--orange);
}

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

.metric-card strong {
    display: block;
    margin-top: 10px;
    color: var(--blue-dark);
    font-size: 34px;
    letter-spacing: -.03em;
}

.panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 7px 22px rgba(27, 63, 94, .05);
}

.panel h1,
.panel h2 {
    color: var(--blue-dark);
    margin-top: 7px;
}

.panel p {
    color: var(--muted);
    line-height: 1.65;
}

.footer {
    padding: 20px 30px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

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

    .login-brand-panel {
        padding: 36px;
        min-height: 300px;
    }

    .login-card {
        padding: 40px 32px;
    }

    .sidebar {
        width: 210px;
        flex-basis: 210px;
    }

    .app-main {
        width: calc(100% - 210px);
        margin-left: 210px;
    }

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

@media (max-width: 680px) {
    .login-body {
        padding: 14px;
    }

    .login-wrap {
        border-radius: 18px;
    }

    .login-brand-panel {
        padding: 28px;
    }

    .sidebar {
        position: static;
        width: 100%;
        min-height: auto;
    }

    .sidebar-logo,
    .sidebar-footer {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        padding: 10px;
    }

    .sidebar-nav a {
        white-space: nowrap;
    }

    .nav-section {
        display: none;
    }

    .app-shell {
        display: block;
    }

    .app-main {
        width: 100%;
        margin-left: 0;
    }

    .topbar {
        padding: 12px 16px;
    }

    .topbar-brand span {
        display: none;
    }

    .content {
        padding: 20px 15px;
    }

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


/* =========================
   Módulo de usuários
   ========================= */

.search-bar {
    display: flex;
    align-items: end;
    gap: 10px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.search-field {
    flex: 1 1 320px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.data-table th,
.data-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table th {
    color: var(--blue-dark);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: #f8fafc;
}

.data-table tbody tr:hover {
    background: #fbfdff;
}

.table-subtitle {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}

.actions-col {
    min-width: 300px;
}

.actions-cell {
    white-space: nowrap;
}

.inline-form {
    display: inline-block;
    margin: 2px 2px 2px 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    margin: 2px 3px 2px 0;
}

.status-active {
    color: #027a48;
    background: #ecfdf3;
}

.status-inactive {
    color: #b42318;
    background: #fef3f2;
}

.status-warning {
    color: #93370d;
    background: #fffaeb;
}

.status-neutral {
    color: #344054;
    background: #f2f4f7;
}

.btn-danger-soft {
    color: #b42318;
    background: #fef3f2;
    border: 1px solid #fecdca;
}

.btn-success-soft {
    color: #027a48;
    background: #ecfdf3;
    border: 1px solid #abefc6;
}

.protected-account {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.temporary-password-card {
    margin-bottom: 24px;
    padding: 24px;
    border: 1px solid #fedf89;
    border-left: 5px solid var(--orange);
    border-radius: 15px;
    background: #fffcf5;
    box-shadow: 0 7px 22px rgba(27, 63, 94, .05);
}

.temporary-password-card h2 {
    color: var(--blue-dark);
    margin: 7px 0;
}

.temporary-password-card p {
    color: var(--muted);
    line-height: 1.55;
}

.temporary-password-value {
    display: inline-block;
    margin: 10px 0;
    padding: 13px 18px;
    border: 1px dashed #f79009;
    border-radius: 10px;
    background: var(--white);
    color: var(--blue-dark);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: .04em;
}

.security-note {
    margin-bottom: 0 !important;
    font-size: 12px;
}

.form-panel {
    max-width: 900px;
}

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

.form-group-wide {
    grid-column: 1 / -1;
}

.form-group .form-label {
    margin-top: 0;
}

.field-help {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

.info-box {
    margin-top: 24px;
    padding: 16px 18px;
    background: var(--blue-soft);
    border: 1px solid #d6e7f5;
    border-radius: 10px;
}

.info-box strong {
    color: var(--blue-dark);
}

.info-box p {
    margin: 5px 0 0;
    font-size: 13px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.empty-cell {
    text-align: center !important;
    color: var(--muted);
    padding: 35px !important;
}

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

    .form-group-wide {
        grid-column: auto;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }
}


/* =========================
   V3 — Cadastro de Famílias
   ========================= */

.page-actions,
.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-field {
    flex: 0 1 220px;
}

.result-summary {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    margin: 4px 0 14px;
}

.family-code {
    display: block;
    width: fit-content;
    margin-bottom: 4px;
    color: var(--orange);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
}

.family-form {
    display: grid;
    gap: 20px;
}

.form-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 26px;
    box-shadow: 0 7px 22px rgba(27, 63, 94, .05);
}

.form-section-heading {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.form-section-heading h2 {
    margin: 1px 0 5px;
    color: var(--blue-dark);
    font-size: 20px;
}

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

.section-number {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: var(--white);
    background: var(--blue);
    font-weight: 900;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}

.check-card {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    min-height: 48px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfdff;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.35;
}

.check-card:hover {
    border-color: #b9d4e8;
    background: var(--blue-soft);
}

.check-card input {
    margin-top: 2px;
    accent-color: var(--blue);
}

.conditional-block {
    margin-top: 20px;
    padding: 18px;
    border: 1px solid #d6e7f5;
    border-radius: 12px;
    background: var(--blue-soft);
}

.conditional-block[hidden] {
    display: none !important;
}

.compact-top {
    margin-top: 18px;
}

.interest-group {
    margin-top: 22px;
}

.interest-group:first-of-type {
    margin-top: 0;
}

.interest-group h3 {
    margin: 0 0 10px;
    color: var(--blue-dark);
    font-size: 14px;
}

.textarea-control {
    resize: vertical;
    min-height: 105px;
}

.declaration-card {
    margin-top: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px;
    border: 1px solid #d6e7f5;
    border-radius: 12px;
    background: var(--blue-soft);
    cursor: pointer;
    line-height: 1.55;
    font-size: 13px;
}

.declaration-card input {
    margin-top: 4px;
    accent-color: var(--blue);
}

.declaration-card strong {
    display: block;
    color: var(--blue-dark);
    margin-bottom: 3px;
}

.sticky-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 -6px 22px rgba(27, 63, 94, .08);
    backdrop-filter: blur(8px);
}

.family-status-strip {
    display: flex;
    align-items: center;
    gap: 8px 18px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--white);
    color: var(--muted);
    font-size: 12px;
}

.family-status-strip strong {
    color: var(--blue-dark);
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

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

.detail-card h2 {
    margin: 7px 0 12px;
    font-size: 19px;
}

.detail-list {
    margin: 18px 0;
}

.detail-list > div {
    display: grid;
    grid-template-columns: minmax(110px, .8fr) minmax(0, 1.2fr);
    gap: 15px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}

.detail-list dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
}

.text-link {
    color: var(--blue);
    font-size: 13px;
    font-weight: 800;
}

.text-link:hover {
    text-decoration: underline;
}

.section-gap {
    margin-top: 20px;
}

.panel-header h2 {
    margin-bottom: 0;
}

.interest-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.interest-summary > div {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fbfdff;
}

.interest-summary h3 {
    color: var(--blue-dark);
    margin: 0 0 9px;
    font-size: 14px;
}

.interest-summary ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.65;
    font-size: 13px;
}

.admin-status-panel {
    border-left: 4px solid var(--orange);
}

.inline-status-form {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 650px;
}

.inline-status-form .form-control {
    flex: 1;
}

@media (max-width: 1100px) {
    .checkbox-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .interest-summary {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 680px) {
    .checkbox-grid,
    .detail-grid,
    .interest-summary {
        grid-template-columns: 1fr;
    }

    .form-section {
        padding: 18px;
    }

    .sticky-form-actions {
        flex-direction: column-reverse;
    }

    .sticky-form-actions .btn {
        width: 100%;
    }

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

    .detail-list > div {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn {
        flex: 1;
    }
}


/* =========================
   V4 — Dashboard e Relatórios
   ========================= */

.report-filter-panel {
    margin-bottom: 22px;
}

.report-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.report-filters .form-label {
    margin-top: 0;
}

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

.filter-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    padding-top: 5px;
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0 0 20px;
}

.active-filters span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid #d6e7f5;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue-dark);
    font-size: 11px;
    font-weight: 750;
}

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

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

.chart-panel h2 {
    margin: 7px 0 18px;
    font-size: 18px;
}

.bar-chart {
    display: grid;
    gap: 13px;
}

.bar-row {
    display: grid;
    gap: 6px;
}

.bar-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
}

.bar-meta span {
    color: var(--text);
}

.bar-meta strong {
    color: var(--blue-dark);
    font-size: 13px;
}

.bar-track {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #eaf0f5;
}

.bar-fill {
    height: 100%;
    min-width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), var(--green));
}

.report-summary-line {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--white);
    color: var(--muted);
    font-size: 13px;
}

.report-summary-line strong {
    color: var(--blue-dark);
    font-size: 19px;
}

.nominal-table {
    min-width: 1280px;
}

.nominal-table td {
    font-size: 12px;
}

.privacy-footer {
    margin-top: 16px;
    padding: 12px 15px;
    border-radius: 9px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 11px;
    font-weight: 650;
}

.print-report-header {
    display: none;
}

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

.dashboard-alerts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-alert {
    padding: 17px 19px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--green);
    border-radius: 12px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

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

.dashboard-alert strong {
    color: var(--blue-dark);
    font-size: 23px;
}

.dashboard-alert.needs-attention {
    border-left-color: var(--orange);
}

.dashboard-charts {
    margin-top: 0;
}

.dashboard-use-cases {
    margin-top: 20px;
}

.use-case-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.use-case-grid a {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfdff;
    color: var(--blue-dark);
    font-size: 13px;
    font-weight: 750;
}

.use-case-grid a:hover {
    border-color: #b9d4e8;
    background: var(--blue-soft);
}

@media (max-width: 1100px) {
    .report-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 760px) {
    .report-filters,
    .report-grid,
    .dashboard-alerts,
    .use-case-grid {
        grid-template-columns: 1fr;
    }

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

    .dashboard-metric-grid,
    .report-metrics {
        grid-template-columns: 1fr;
    }
}

@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    body {
        background: #fff !important;
        font-size: 10px;
    }

    .sidebar,
    .topbar,
    .footer,
    .no-print {
        display: none !important;
    }

    .app-main {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .content {
        max-width: none !important;
        padding: 0 !important;
    }

    .print-report-header {
        display: flex;
        align-items: center;
        gap: 14px;
        margin-bottom: 15px;
        padding-bottom: 12px;
        border-bottom: 2px solid #164d80;
    }

    .print-report-header img {
        width: 115px;
    }

    .print-report-header strong {
        color: #164d80;
        font-size: 11px;
    }

    .print-report-header h1 {
        margin: 2px 0;
        color: #0c365e;
        font-size: 20px;
    }

    .print-report-header span {
        color: #6b7785;
        font-size: 9px;
    }

    .active-filters {
        margin-bottom: 10px;
    }

    .active-filters span {
        padding: 3px 7px;
        font-size: 8px;
        min-height: 0;
    }

    .metric-grid,
    .report-metrics,
    .dashboard-metric-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 7px;
    }

    .metric-card {
        padding: 9px !important;
        box-shadow: none !important;
        break-inside: avoid;
    }

    .metric-card strong {
        font-size: 20px !important;
    }

    .report-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 9px;
    }

    .panel {
        box-shadow: none !important;
        padding: 10px !important;
        break-inside: avoid;
    }

    .chart-panel h2 {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .bar-chart {
        gap: 5px;
    }

    .bar-meta {
        font-size: 8px;
    }

    .bar-track {
        height: 5px;
    }

    .nominal-table-panel {
        border: 0 !important;
        padding: 0 !important;
    }

    .table-responsive {
        overflow: visible !important;
    }

    .nominal-table {
        min-width: 0 !important;
        font-size: 7px;
    }

    .nominal-table th,
    .nominal-table td {
        padding: 4px 3px !important;
        font-size: 7px !important;
    }

    .family-code,
    .table-subtitle {
        font-size: 6px !important;
    }

    .privacy-footer {
        margin-top: 8px;
        font-size: 7px;
    }
}


/* =========================
   V5 — Refinamentos
   ========================= */

.dashboard-alert-link {
    color: inherit;
    transition: transform .15s, border-color .15s, box-shadow .15s;
}

.dashboard-alert-link:hover {
    transform: translateY(-1px);
    border-color: #b9d4e8;
    box-shadow: 0 7px 22px rgba(27, 63, 94, .07);
}

.audit-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.audit-metrics article {
    padding: 17px 19px;
    border: 1px solid var(--border);
    border-top: 4px solid var(--blue);
    border-radius: 12px;
    background: var(--white);
}

.audit-metrics article:nth-child(2) {
    border-top-color: var(--green);
}

.audit-metrics article:nth-child(3) {
    border-top-color: var(--yellow);
}

.audit-metrics article.audit-warning {
    border-top-color: var(--orange);
}

.audit-metrics span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.audit-metrics strong {
    display: block;
    margin-top: 8px;
    color: var(--blue-dark);
    font-size: 26px;
}

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

.audit-filters .form-label {
    margin-top: 0;
}

.audit-filter-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.audit-table {
    min-width: 1250px;
}

.audit-action {
    display: inline-flex;
    padding: 5px 8px;
    border-radius: 7px;
    background: var(--blue-soft);
    color: var(--blue-dark);
    font-size: 10px;
    font-weight: 800;
}

.audit-details {
    min-width: 105px;
}

.audit-details summary {
    color: var(--blue);
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
}

.audit-details pre {
    max-width: 420px;
    max-height: 250px;
    overflow: auto;
    padding: 10px;
    border-radius: 8px;
    background: #111827;
    color: #e5e7eb;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 10px;
    line-height: 1.45;
}

.audit-details strong {
    display: block;
    margin: 9px 0 4px;
    font-size: 10px;
}

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

.quick-report-card {
    display: flex;
    flex-direction: column;
    min-height: 230px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--white);
    box-shadow: 0 7px 22px rgba(27, 63, 94, .05);
}

.quick-tag {
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.quick-report-card h2 {
    margin: 14px 0 7px;
    color: var(--blue-dark);
    font-size: 18px;
}

.quick-report-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 20px;
}

.recadastro-filter .inline-status-form {
    max-width: 520px;
}

@media (max-width: 1100px) {
    .audit-metrics,
    .quick-report-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 680px) {
    .audit-metrics,
    .quick-report-grid,
    .audit-filters {
        grid-template-columns: 1fr;
    }

    .audit-filter-actions {
        flex-direction: column-reverse;
    }

    .audit-filter-actions .btn {
        width: 100%;
    }
}


/* =========================
   V6 — Pré-produção
   ========================= */

.profile-grid {
    display: grid;
    grid-template-columns: .9fr 1.1fr;
    gap: 20px;
}

.error-reference {
    margin: 20px 0;
    padding: 12px;
    border: 1px dashed var(--orange);
    border-radius: 9px;
    background: #fffcf5;
    color: var(--blue-dark);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.maintenance-summary {
    margin-bottom: 20px;
    padding: 17px 20px;
    border: 1px solid var(--border);
    border-left: 5px solid var(--green);
    border-radius: 12px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.maintenance-summary.maintenance-attention {
    border-left-color: var(--orange);
}

.maintenance-summary div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.maintenance-summary span {
    color: var(--muted);
    font-size: 12px;
}

.maintenance-summary strong {
    color: var(--blue-dark);
    font-size: 19px;
}

.check-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
    margin-top: 20px;
}

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfdff;
}

.check-icon {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--white);
    font-weight: 900;
}

.check-ok .check-icon {
    background: var(--green);
}

.check-warning .check-icon {
    background: var(--orange);
}

.check-item div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.check-item strong {
    color: var(--blue-dark);
    font-size: 13px;
}

.check-item span:not(.check-icon) {
    color: var(--text);
    font-size: 12px;
    font-weight: 750;
}

.check-item small {
    color: var(--muted);
    line-height: 1.4;
}

.backup-panel {
    border-left: 4px solid var(--blue);
}

.production-checklist {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.production-checklist label {
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fbfdff;
    color: var(--text);
    font-size: 13px;
}

.production-checklist input {
    margin-right: 8px;
}

@media (max-width: 850px) {
    .profile-grid,
    .check-list {
        grid-template-columns: 1fr;
    }

    .topbar-user > div {
        display: none;
    }
}
