/* ============================================================================
   Instituto Umanizzare � Design System
   Fonte �nica de tokens e classes reutiliz�veis (extra�do dos prot�tipos
   aprovados 11_usuarios_lista, 12_usuarios_form, 13_meu_perfil).

   Uso (Blazor WASM + MudBlazor):
   - Salvar em: src/Umanizzare.Client/wwwroot/css/design-system.css
   - Linkar no index.html DEPOIS do app.css:
       <link rel="stylesheet" href="css/design-system.css" />

   Observa��es:
   - A fonte Nunito j� � carregada no index.html (Sprint 3).
   - O grid externo do app (sidebar fixa, topbar, �rea de conte�do) � tratado
     pelo MudLayout/MudDrawer/MudAppBar + overrides em MainLayout.razor.css.
     Por isso este arquivo N�O define .app-shell / .sidebar(grid) / .main /
     .topbar � s� o CONTE�DO que vai dentro deles e as classes de p�gina.
   - Assume box-sizing: border-box (j� definido globalmente pelo MudBlazor).
   ========================================================================== */

/* ----------------------------------------------------------------------------
   1. TOKENS
   -------------------------------------------------------------------------- */
:root {
    /* Cor-assinatura */
    --vinho: #A31040;
    --vinho-hover: #8A0D35;
    --vinho-dark: #8A0A20;
    --vinho-darker: #7A0818;
    --vinho-light: rgba(163, 16, 64, 0.08);
    --vinho-soft: rgba(163, 16, 64, 0.04);
    /* Acentos */
    --rosa: #C94070;
    --laranja: #E8855A;
    --rosa-claro: #F5D0CC;
    --terracota: #C96030;
    --azul: #6A9AA8;
    --azul-dark: #4A7A88;
    --verde: #8A9868;
    --verde-dark: #4A6030;
    --amarelo: #D4C050;
    --amarelo-dark: #7A6A10;
    --vermelho: #CC1030;
    --offwhite: #F0EBE0;
    /* Superf�cies e fundo */
    --bg: #F7F5F1;
    --surface: #FFFFFF;
    /* Texto */
    --text-main: #1A1A1A;
    --text-body: #3D3D3A;
    --text-muted: #6B6B6B;
    --text-hint: #9E9E9E;
    /* Linhas */
    --border: #E8E2DA;
    --border-soft: #F0EBE0;
    /* Tipografia */
    --font-family: "Nunito", sans-serif;
    /* Raios */
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    /* Dimens�es de layout */
    --topbar-h: 60px;
    --sidebar-w: 240px;
    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(26, 26, 26, 0.04);
    --shadow-md: 0 4px 16px rgba(26, 26, 26, 0.06);
    --shadow-lg: 0 12px 40px rgba(26, 26, 26, 0.14);
}

/* ----------------------------------------------------------------------------
   2. MARCA / SIDEBAR (conte�do do MudDrawer)
   -------------------------------------------------------------------------- */
.sidebar-header {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-soft);
}

.logo-mark {
    width: 40px;
    height: 40px;
    background: var(--vinho);
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

    .logo-mark svg {
        width: 32px;
        height: 32px;
    }

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

    .logo-text .eyebrow {
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        color: var(--text-muted);
    }

    .logo-text .name {
        font-size: 15px;
        font-weight: 700;
        color: var(--text-main);
    }

/* Navega��o */
.nav-section {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-hint);
    padding: 0 12px;
    margin-bottom: 8px;
    margin-top: 12px;
}

    .nav-label:first-child {
        margin-top: 0;
    }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-body);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    min-height: 44px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

    .nav-item:hover {
        background: var(--bg);
        color: var(--text-main);
    }
    /* .is-active = prot�tipo; .active = classe que o <NavLink> do Blazor injeta */
    .nav-item.is-active,
    .nav-item.active {
        background: var(--vinho-light);
        color: var(--vinho);
        font-weight: 600;
    }

    .nav-item svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }

    .nav-item .nav-badge {
        margin-left: auto;
        font-size: 11px;
        font-weight: 700;
        padding: 2px 8px;
        border-radius: 999px;
        background: var(--amarelo);
        color: var(--amarelo-dark);
    }

/* Rodap� com chip do usu�rio logado */
.sidebar-footer {
    border-top: 1px solid var(--border-soft);
    padding: 12px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s;
}

    .user-chip:hover {
        background: var(--bg);
    }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rosa), var(--vinho));
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}

    .user-info .user-name {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-main);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .user-info .user-role {
        font-size: 11px;
        color: var(--text-muted);
    }

.user-chip .chevron {
    width: 16px;
    height: 16px;
    color: var(--text-hint);
}

/* ----------------------------------------------------------------------------
   3. �REA DE CONTE�DO / CABE�ALHO DE P�GINA
   -------------------------------------------------------------------------- */
.content {
    padding: 24px;
    max-width: 1600px;
    width: 100%;
}
/* P�ginas de formul�rio/perfil usam cont�iner mais estreito e centralizado: */
.content--narrow {
    max-width: 880px;
    margin: 0 auto;
}

.breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

    .breadcrumb a {
        color: var(--text-muted);
        text-decoration: none;
    }

        .breadcrumb a:hover {
            color: var(--vinho);
        }

    .breadcrumb svg {
        width: 12px;
        height: 12px;
        color: var(--text-hint);
    }

    .breadcrumb .current {
        color: var(--text-body);
        font-weight: 600;
    }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

    .page-header h1 {
        font-size: 24px;
        font-weight: 700;
        color: var(--text-main);
        letter-spacing: -0.01em;
        line-height: 1.2;
        margin-bottom: 4px;
    }

    .page-header .page-meta {
        font-size: 13px;
        color: var(--text-muted);
    }

/* ----------------------------------------------------------------------------
   4. BOT�ES
   -------------------------------------------------------------------------- */
.btn-primary {
    height: 42px;
    padding: 0 22px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--vinho);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

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

    .btn-primary svg {
        width: 16px;
        height: 16px;
    }

.btn-secondary {
    height: 42px;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-body);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

    .btn-secondary:hover {
        background: var(--bg);
    }

.btn-danger {
    height: 42px;
    padding: 0 18px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--vermelho);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

    .btn-danger:hover {
        background: #AA0D28;
    }

/* ----------------------------------------------------------------------------
   5. BARRA DE FILTROS
   -------------------------------------------------------------------------- */
.filters-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
}

.filter-search {
    position: relative;
}

    .filter-search input {
        width: 100%;
        height: 40px;
        padding: 0 14px 0 40px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--surface);
        font-family: inherit;
        font-size: 13px;
        color: var(--text-main);
    }

        .filter-search input:focus {
            outline: none;
            border-color: var(--vinho);
            box-shadow: 0 0 0 3px var(--vinho-light);
        }

    .filter-search svg {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 18px;
        height: 18px;
        color: var(--text-muted);
    }

.filter-select {
    position: relative;
    min-width: 170px;
}

    .filter-select select {
        appearance: none;
        width: 100%;
        height: 40px;
        padding: 0 36px 0 14px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: var(--surface);
        font-family: inherit;
        font-size: 13px;
        font-weight: 500;
        color: var(--text-body);
        cursor: pointer;
    }

        .filter-select select:hover {
            border-color: var(--text-muted);
        }

        .filter-select select:focus {
            outline: none;
            border-color: var(--vinho);
            box-shadow: 0 0 0 3px var(--vinho-light);
        }

    .filter-select svg {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 14px;
        height: 14px;
        color: var(--text-muted);
        pointer-events: none;
    }

.result-count {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

    .result-count strong {
        color: var(--text-body);
        font-weight: 700;
    }

/* ----------------------------------------------------------------------------
   6. TABELA DE DADOS
   -------------------------------------------------------------------------- */
.table-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

    .data-table thead {
        background: var(--bg);
        border-bottom: 1px solid var(--border);
    }

    .data-table th {
        padding: 14px 16px;
        text-align: left;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        color: var(--text-muted);
        white-space: nowrap;
    }

        .data-table th .sort {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            cursor: pointer;
        }

            .data-table th .sort svg {
                width: 12px;
                height: 12px;
                opacity: 0.5;
            }

    .data-table td {
        padding: 14px 16px;
        font-size: 14px;
        color: var(--text-body);
        border-bottom: 1px solid var(--border-soft);
        vertical-align: middle;
    }

    .data-table tbody tr {
        transition: background 0.1s;
    }

        .data-table tbody tr:hover {
            background: var(--vinho-soft);
        }

        .data-table tbody tr.is-inactive {
            opacity: 0.62;
        }

        .data-table tbody tr:last-child td {
            border-bottom: none;
        }

.cell-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cell-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.cell-name strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.cell-email {
    color: var(--text-muted);
    font-weight: 500;
}

.cpf-masked {
    font-family: ui-monospace, monospace;
    letter-spacing: 0.5px;
    font-weight: 500;
    color: var(--text-body);
}

.phone-cell {
    color: var(--text-muted);
    font-weight: 500;
}

/* A��es por linha */
.row-actions {
    display: flex;
    gap: 2px;
    justify-content: flex-end;
}

.cell-action {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.15s;
}

    .cell-action:hover {
        background: var(--vinho-light);
        color: var(--vinho);
    }

    .cell-action.danger:hover {
        background: rgba(204, 16, 48, 0.10);
        color: var(--vermelho);
    }

    .cell-action svg {
        width: 16px;
        height: 16px;
    }

/* Pagina��o */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-top: 1px solid var(--border-soft);
    background: var(--bg);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    gap: 4px;
    align-items: center;
}

.page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-body);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.15s;
}

    .page-btn:hover:not(:disabled):not(.is-active) {
        border-color: var(--vinho);
        color: var(--vinho);
    }

    .page-btn.is-active {
        background: var(--vinho);
        border-color: var(--vinho);
        color: #fff;
    }

    .page-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

    .page-btn svg {
        width: 14px;
        height: 14px;
    }

/* ----------------------------------------------------------------------------
   7. BADGES (perfil e status)
   -------------------------------------------------------------------------- */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

    .role-badge.gestora {
        background: rgba(163, 16, 64, 0.10);
        color: var(--vinho);
    }

    .role-badge.secretaria {
        background: rgba(106, 154, 168, 0.18);
        color: var(--azul-dark);
    }

    .role-badge.psicologa {
        background: rgba(138, 152, 104, 0.18);
        color: var(--verde-dark);
    }

    .role-badge.advogada {
        background: rgba(201, 96, 48, 0.15);
        color: var(--terracota);
    }

    .role-badge.estagiaria {
        background: rgba(212, 192, 80, 0.22);
        color: var(--amarelo-dark);
    }

    .role-badge.voluntaria {
        background: rgba(107, 107, 107, 0.10);
        color: var(--text-muted);
    }

/* Status � o ponto (::before) garante diferencia��o sem depender s� de cor */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

    .status-badge::before {
        content: "";
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
    }

    .status-badge.ativa {
        background: rgba(138, 152, 104, 0.15);
        color: var(--verde-dark);
    }

    .status-badge.inativa {
        background: rgba(107, 107, 107, 0.10);
        color: var(--text-muted);
    }
    /* Status adicionais reaproveit�veis (assistidas etc.) */
    .status-badge.em-acolhimento {
        background: rgba(163, 16, 64, 0.10);
        color: var(--vinho);
    }

    .status-badge.fila-espera {
        background: rgba(212, 192, 80, 0.20);
        color: var(--amarelo-dark);
    }

    .status-badge.alta {
        background: rgba(107, 107, 107, 0.10);
        color: var(--text-muted);
    }

    .status-badge.encerrada {
        background: rgba(204, 16, 48, 0.10);
        color: #AA3030;
    }

    /* Badges de status de agendamento */
    .status-badge.badge-agendado {
        background: rgba(60, 130, 190, 0.12);
        color: #1a5f8a;
    }

    .status-badge.badge-compareceu {
        background: rgba(138, 152, 104, 0.15);
        color: var(--verde-dark);
    }

    .status-badge.badge-faltou {
        background: rgba(204, 16, 48, 0.10);
        color: #AA3030;
    }

    .status-badge.badge-remarcado {
        background: rgba(183, 94, 56, 0.12);
        color: #8B4513;
    }

    .status-badge.badge-cancelado {
        background: rgba(107, 107, 107, 0.10);
        color: var(--text-muted);
    }

/* ----------------------------------------------------------------------------
   8. FORMUL�RIO (cart�es de se��o + campos)
   -------------------------------------------------------------------------- */
.form-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
}

    .form-section.is-hidden {
        display: none;
    }

.section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.section-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--vinho-light);
    color: var(--vinho);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

    .section-title .section-sub {
        display: block;
        font-size: 12px;
        color: var(--text-muted);
        font-weight: 400;
        margin-top: 2px;
    }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    margin-bottom: 14px;
}

    .field:last-child {
        margin-bottom: 0;
    }

    .field.is-hidden {
        display: none;
    }

.field-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

    .field-label .required {
        color: var(--vinho);
        font-weight: 700;
    }

.field-input,
.field-select,
.field-textarea {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-main);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field-textarea {
    height: auto;
    padding: 12px 14px;
    resize: vertical;
    min-height: 88px;
    line-height: 1.45;
}

    .field-input:focus,
    .field-select:focus,
    .field-textarea:focus {
        outline: none;
        border-color: var(--vinho);
        box-shadow: 0 0 0 3px var(--vinho-light);
    }

    .field-input::placeholder,
    .field-textarea::placeholder {
        color: var(--text-hint);
    }

.field-input:disabled {
    background: var(--bg);
    color: var(--text-muted);
    cursor: not-allowed;
}

.field-hint {
    font-size: 11.5px;
    color: var(--text-hint);
}

    .field-hint.lock-note {
        display: inline-flex;
        align-items: center;
        gap: 5px;
    }

        .field-hint.lock-note svg {
            width: 12px;
            height: 12px;
        }

.field-select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px;
    cursor: pointer;
}

/* Toggle (switch) */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
}

    .toggle-row .toggle-text .toggle-title {
        font-size: 14px;
        font-weight: 600;
        color: var(--text-main);
    }

    .toggle-row .toggle-text .toggle-desc {
        font-size: 12px;
        color: var(--text-muted);
        margin-top: 2px;
    }

.toggle-switch {
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #CFC7BC;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s;
}

    .toggle-switch::after {
        content: "";
        position: absolute;
        top: 2px;
        left: 2px;
        width: 20px;
        height: 20px;
        border-radius: 50%;
        background: #fff;
        box-shadow: var(--shadow-sm);
        transition: transform 0.2s;
    }

    .toggle-switch.is-on {
        background: var(--vinho);
    }

        .toggle-switch.is-on::after {
            transform: translateX(20px);
        }

/* Rodap� de a��es do formul�rio */
.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 18px 0;
    margin-top: 8px;
}

    .form-actions.is-sticky {
        position: sticky;
        bottom: 0;
        background: linear-gradient(180deg, transparent 0%, var(--bg) 30%);
    }

/* ----------------------------------------------------------------------------
   9. MEU PERFIL (hero + for�a de senha)
   -------------------------------------------------------------------------- */
.profile-hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 16px;
}

    .profile-hero .hero-avatar {
        width: 72px;
        height: 72px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--rosa), var(--vinho));
        display: grid;
        place-items: center;
        color: #fff;
        font-size: 26px;
        font-weight: 700;
        flex-shrink: 0;
    }

    .profile-hero .hero-text {
        min-width: 0;
    }

    .profile-hero .hero-name {
        font-size: 20px;
        font-weight: 700;
        color: var(--text-main);
    }

    .profile-hero .hero-meta {
        font-size: 13px;
        color: var(--text-muted);
        margin-top: 2px;
    }

    .profile-hero .role-badge {
        margin-top: 8px;
    }

/* Medidor de for�a de senha */
.pwd-strength {
    display: flex;
    gap: 4px;
    margin-top: 2px;
}

    .pwd-strength span {
        flex: 1;
        height: 4px;
        border-radius: 999px;
        background: var(--border);
        transition: background 0.2s;
    }

    .pwd-strength.s1 span:nth-child(1) {
        background: var(--vermelho);
    }

    .pwd-strength.s2 span:nth-child(-n+2) {
        background: var(--amarelo-dark);
    }

    .pwd-strength.s3 span:nth-child(-n+3) {
        background: var(--verde-dark);
    }

.pwd-rules {
    font-size: 11.5px;
    color: var(--text-hint);
    margin-top: 2px;
}

/* ----------------------------------------------------------------------------
   10. MODAIS / DI�LOGOS
   (Com MudDialog, o backdrop/abre-fecha � do Mud; estas classes estilizam o
   CONTE�DO interno. .modal-backdrop/.modal servem se optar por modal pr�prio.)
   -------------------------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}

    .modal-backdrop.is-open {
        display: flex;
    }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--border-soft);
}

    .modal-header .modal-eyebrow {
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        color: var(--vinho);
        margin-bottom: 6px;
    }

    .modal-header h3 {
        font-size: 18px;
        font-weight: 700;
        color: var(--text-main);
    }

    .modal-header p {
        font-size: 13px;
        color: var(--text-muted);
        margin-top: 4px;
        line-height: 1.5;
    }

.modal-body {
    padding: 22px 24px;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
}

    .modal-icon svg {
        width: 24px;
        height: 24px;
    }

    .modal-icon.success {
        background: rgba(138, 152, 104, 0.18);
        color: var(--verde-dark);
    }

    .modal-icon.warn {
        background: rgba(204, 16, 48, 0.10);
        color: var(--vermelho);
    }

    .modal-icon.key {
        background: var(--vinho-light);
        color: var(--vinho);
    }

/* Caixa de senha gerada */
.pwd-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin: 4px 0 12px;
}

    .pwd-box code {
        flex: 1;
        font-family: ui-monospace, monospace;
        font-size: 18px;
        font-weight: 700;
        letter-spacing: 1px;
        color: var(--text-main);
    }

.pwd-copy {
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--vinho);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

    .pwd-copy:hover {
        background: var(--vinho-light);
    }

    .pwd-copy svg {
        width: 14px;
        height: 14px;
    }

/* Aviso amarelo dentro do modal */
.modal-note {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-muted);
    background: rgba(212, 192, 80, 0.14);
    border-left: 3px solid var(--amarelo-dark);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

    .modal-note strong {
        color: var(--amarelo-dark);
    }

/* ----------------------------------------------------------------------------
   11. ACESSIBILIDADE
   -------------------------------------------------------------------------- */
*:focus-visible {
    outline: 2px solid var(--vinho);
    outline-offset: 2px;
}

/* ----------------------------------------------------------------------------
   12. RESPONSIVO
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
    .filters-bar {
        grid-template-columns: 1fr;
    }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    /* Tabela vira cards no mobile */
    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

        .data-table tr {
            border: 1px solid var(--border-soft);
            border-radius: var(--radius-md);
            margin-bottom: 10px;
            padding: 12px;
        }

        .data-table td {
            border: none;
            padding: 4px 0;
        }

            .data-table td::before {
                content: attr(data-label);
                font-size: 11px;
                font-weight: 700;
                letter-spacing: 0.5px;
                text-transform: uppercase;
                color: var(--text-muted);
                display: block;
                margin-bottom: 2px;
            }

    .cell-name {
        margin-bottom: 8px;
    }

    .row-actions {
        justify-content: flex-start;
        margin-top: 6px;
    }

    .profile-hero {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 600px) {
    .content {
        padding: 16px;
    }

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

        .form-actions .btn-primary,
        .form-actions .btn-secondary {
            width: 100%;
            justify-content: center;
        }
}

/* ----------------------------------------------------------------------------
   13. LISTAS / GRID DE ASSISTIDAS
   -------------------------------------------------------------------------- */
.umz-grid {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.cell-meta {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 1px;
}

/* Status badges para Assistidas (alias para as classes do design system) */
.status-acolhimento { background: rgba(163,16,64,0.10); color: var(--vinho); }
.status-ativa       { background: rgba(138,152,104,0.15); color: var(--verde-dark); }
.status-fila        { background: rgba(212,192,80,0.20); color: var(--amarelo-dark); }
.status-alta        { background: rgba(107,107,107,0.10); color: var(--text-muted); }
.status-encerrada   { background: rgba(204,16,48,0.10); color: #AA3030; }

/* ----------------------------------------------------------------------------
   14. ESTADO VAZIO
   -------------------------------------------------------------------------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-icon {
    font-size: 48px !important;
    width: 48px !important;
    height: 48px !important;
    color: var(--text-hint);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-body);
    margin-bottom: 6px;
}

.empty-sub {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 360px;
    line-height: 1.5;
}

/* ----------------------------------------------------------------------------
   15. BOTÃO SMALL
   -------------------------------------------------------------------------- */
.btn-sm {
    height: 34px !important;
    padding: 0 14px !important;
    font-size: 12px !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ----------------------------------------------------------------------------
   16. PERFIL 360°
   -------------------------------------------------------------------------- */

/* Hero da assistida */
.profile-hero .hero-actions {
    margin-left: auto;
    flex-shrink: 0;
}

/* Seletor de pastas/serviços */
.service-selector-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

.service-btn {
    height: 36px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-body);
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.service-btn:hover { background: var(--bg); border-color: var(--text-muted); }

.service-btn.active {
    background: var(--vinho-light);
    border-color: var(--vinho);
    color: var(--vinho);
    font-weight: 700;
}

.service-btn.servico-psicologia.active  { background: rgba(138,152,104,0.12); border-color: var(--verde-dark); color: var(--verde-dark); }
.service-btn.servico-juridico.active    { background: rgba(106,154,168,0.12); border-color: var(--azul-dark); color: var(--azul-dark); }
.service-btn.servico-acolhimento.active { background: var(--vinho-light); border-color: var(--vinho); color: var(--vinho); }
.service-btn.servico-oficinas.active    { background: rgba(212,192,80,0.14); border-color: var(--amarelo-dark); color: var(--amarelo-dark); }

.service-encerrado {
    font-size: 10px;
    opacity: 0.65;
    margin-left: 2px;
}

.service-empty-hint {
    font-size: 12px;
    color: var(--text-hint);
    font-style: italic;
    padding: 0 8px;
}

/* Conteúdo do perfil */
.profile-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.profile-content .form-section {
    border: none;
    border-radius: 0;
}

/* Sub-tabs do caso */
.case-sub-tabs {
    border: none !important;
}

.sub-tab-active {
    color: var(--vinho) !important;
    font-weight: 700 !important;
}

/* Cabeçalho das sub-abas */
.sub-aba-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Lista genérica de itens */
.list-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--bg);
}

.list-item-body {
    flex: 1;
    min-width: 0;
}

/* Lista de documentos */
.doc-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.doc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--bg);
}

.doc-icon {
    color: var(--vinho);
    flex-shrink: 0;
}

.doc-info { flex: 1; min-width: 0; }

.doc-actions { display: flex; gap: 2px; flex-shrink: 0; }

/* Lista de agendamentos (sub-aba 360°) */
.agenda-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.agenda-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
    border-radius: var(--radius);
    flex-wrap: wrap;
}

.agenda-item:last-child { border-bottom: none; }

.agenda-date-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 36px;
    flex-shrink: 0;
}

.agenda-date-day {
    font-size: 20px;
    font-weight: 700;
    color: var(--vinho);
    line-height: 1;
}

.agenda-date-mon {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.agenda-info { flex: 1; min-width: 0; }

/* Utilidades */
.opacity-50 { opacity: 0.5; }
.mt-4 { margin-top: 16px; }
