:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --panel-soft: #f0f3f7;
    --text: #17202c;
    --muted: #647084;
    --line: #dfe4ea;
    --accent: #176b87;
    --accent-strong: #0d4e63;
    --success: #147a50;
    --warning: #9a5b00;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(20, 31, 46, 0.10);
}

* {
    box-sizing: border-box;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

code {
    color: var(--accent-strong);
    font-size: 0.94em;
}

.is-hidden {
    display: none !important;
}

.login-view {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(23, 107, 135, 0.14), rgba(255, 255, 255, 0) 38%),
        var(--bg);
}

.login-panel {
    width: min(100%, 430px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 34px;
    box-shadow: var(--shadow);
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 800;
}

.eyebrow {
    margin: 18px 0 8px;
    color: var(--accent-strong);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

.login-panel h1,
.topbar h1 {
    margin-bottom: 8px;
}

.muted {
    color: var(--muted);
}

.login-form {
    display: grid;
    gap: 10px;
    margin-top: 28px;
}

.login-form label,
.search-field span,
.filter-field span {
    color: #354154;
    font-size: 0.9rem;
    font-weight: 700;
}

.login-form input,
.search-field input,
.filter-field select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 10px 12px;
    background: #ffffff;
    color: var(--text);
    outline: none;
}

.login-form input:focus,
.search-field input:focus,
.filter-field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.15);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button {
    min-height: 42px;
    border-radius: 7px;
    border: 1px solid transparent;
    padding: 10px 14px;
    font-weight: 800;
}

.primary-button {
    margin-top: 10px;
    background: var(--accent);
    color: #ffffff;
}

.primary-button:hover {
    background: var(--accent-strong);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.secondary-button {
    background: #ffffff;
    border-color: var(--line);
    color: var(--text);
}

.secondary-button small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
}

.link-button {
    min-height: auto;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--accent-strong);
    font-weight: 800;
}

.ghost-button {
    width: 100%;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.16);
    color: #dce7ee;
}

.danger-button {
    min-height: 38px;
    background: var(--danger);
    color: #ffffff;
}

.icon-button {
    min-width: 40px;
    background: #ffffff;
    border-color: var(--line);
    color: var(--text);
    font-size: 1.2rem;
}

.form-message,
.global-message {
    min-height: 22px;
    margin: 10px 0 0;
    color: var(--danger);
    font-weight: 700;
}

.form-message[data-type="info"] {
    color: var(--accent-strong);
}

.global-message[data-type="success"],
.form-message[data-type="success"] {
    color: var(--success);
}

.admin-view {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 22px;
    background: #132330;
    color: #ffffff;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand span {
    display: block;
    color: #9fb3c1;
    font-size: 0.88rem;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
    margin-top: 8px;
}

.nav-item {
    min-height: 40px;
    border: 0;
    border-radius: 7px;
    padding: 0 12px;
    background: transparent;
    color: #c8d6df;
    text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
}

.nav-item:disabled {
    cursor: not-allowed;
    color: #718797;
}

.sidebar .ghost-button {
    margin-top: auto;
}

.main-content {
    min-width: 0;
    padding: 28px;
}

.topbar,
.section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.topbar {
    margin-bottom: 22px;
}

.topbar .eyebrow {
    margin-top: 0;
}

.global-message {
    min-height: 0;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #f3b4ae;
    border-radius: 7px;
    background: #fff2f0;
}

.global-message[data-type="success"] {
    border-color: #a8dec5;
    background: #effaf5;
}

.content-section {
    display: grid;
    gap: 18px;
}

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

.stat-card,
.state-box,
.table-wrap {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(20, 31, 46, 0.06);
}

.stat-card {
    padding: 20px;
}

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

.stat-card strong {
    display: block;
    margin-top: 12px;
    font-size: 2.15rem;
}

.section-toolbar {
    align-items: end;
}

.section-toolbar h2 {
    margin-bottom: 6px;
}

.section-toolbar p {
    margin-bottom: 0;
}

.search-field {
    width: min(100%, 300px);
    display: grid;
    gap: 7px;
}

.users-toolbar {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-field {
    width: min(100%, 170px);
    display: grid;
    gap: 7px;
}

.result-count {
    margin: -8px 0 0;
    color: var(--muted);
    font-weight: 800;
}

.state-box {
    padding: 22px;
    color: var(--muted);
    font-weight: 700;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
}

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: #445166;
    font-size: 0.78rem;
    text-transform: uppercase;
}

td {
    color: #263243;
}

td strong,
td span {
    display: block;
}

td span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.82rem;
}

tbody tr {
    background: #ffffff;
}

tbody tr:hover,
tbody tr:focus {
    background: #f7fafc;
    outline: none;
}

tbody tr {
    cursor: pointer;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 0.84rem;
    font-weight: 800;
}

.status-active {
    background: #e5f7ef;
    color: var(--success);
}

.status-muted {
    background: #eef1f5;
    color: #5f6c7b;
}

.status-warning {
    background: #fff4db;
    color: var(--warning);
}

.status-danger {
    background: #fff0ee;
    color: var(--danger);
}

.detail-panel {
    display: grid;
    gap: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.detail-header,
.admin-actions,
.record-head,
.modal-header,
.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.detail-header {
    align-items: flex-start;
}

.detail-header .eyebrow {
    margin-top: 0;
}

.detail-header h2,
.admin-actions h3,
.history-section h3,
.info-card h3,
.modal-header h2 {
    margin-bottom: 6px;
}

.detail-content,
.history-section {
    display: grid;
    gap: 16px;
}

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

.info-card,
.admin-actions,
.record-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 18px;
}

dl {
    display: grid;
    gap: 10px;
    margin: 0;
}

dl div {
    min-width: 0;
}

dt {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

dd {
    margin: 3px 0 0;
    overflow-wrap: anywhere;
    color: var(--text);
}

.record-list {
    display: grid;
    gap: 12px;
}

.contextual-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: center;
    width: min(100%, 460px);
}

.contextual-actions:has(> button:only-child) {
    grid-template-columns: 1fr;
    width: min(100%, 225px);
}

.contextual-actions button {
    margin: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 42px !important;
    min-height: 42px !important;
    padding: 10px 14px !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    font-weight: 800;
    border-radius: 7px;
}

#register-payment-button {
    background: var(--success);
    color: #ffffff;
    border: 1px solid transparent;
}

#register-payment-button:hover {
    background: #0f6340;
}

#grant-access-button {
    background: #e6f4f8;
    color: var(--accent-strong);
    border: 1px solid #bce1ec;
}

#grant-access-button:hover {
    background: #d4ecf3;
    border-color: #a4d5e4;
}

.revoke-entitlement-button {
    background: var(--accent);
    color: #ffffff;
    border: 1px solid transparent;
}

.revoke-entitlement-button:hover {
    background: var(--accent-strong);
}

.revoke-entitlement-button:focus,
.revoke-entitlement-button:active {
    background: var(--accent-strong);
    box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.25);
    outline: none;
}

.soon-button {
    text-align: center;
}

.record-card {
    display: grid;
    gap: 14px;
}

.record-head span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.record-card dl,
.technical-box {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 4vh, 32px);
    overflow-y: auto;
    background: rgba(12, 22, 32, 0.58);
}

.modal {
    width: min(100%, 560px);
    max-height: calc(100dvh - clamp(24px, 8vh, 64px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.modal-form {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.modal-header,
.modal-body,
.modal-footer {
    padding: 18px 22px;
}

.modal-header,
.modal-footer {
    flex: 0 0 auto;
}

.modal-header {
    border-bottom: 1px solid var(--line);
}

.modal-body {
    min-height: 0;
    display: grid;
    gap: 13px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal-footer {
    border-top: 1px solid var(--line);
    background: #ffffff;
}

.modal-form label:not(.confirm-check) {
    color: #354154;
    font-size: 0.9rem;
    font-weight: 800;
}

.modal-form input:not([type="checkbox"]):not([type="radio"]),
.modal-form textarea,
.modal-form select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 10px 12px;
    outline: none;
    background: #ffffff;
    color: var(--text);
}

.modal-fields {
    display: grid;
    gap: 13px;
}

.technical-box-single {
    grid-template-columns: 1fr !important;
    margin-top: 4px;
}

.amount-box {
    grid-template-columns: 1fr !important;
    font-size: 1.15rem;
    font-weight: 800;
    margin-top: 4px;
    color: var(--accent-strong);
}

.muted-label {
    color: var(--muted);
    font-weight: 400;
    font-size: 0.84rem;
}

.preset-field {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    border: 0;
    padding: 0;
}

.preset-field legend {
    width: 100%;
    margin-bottom: 4px;
    color: #354154;
    font-size: 0.9rem;
    font-weight: 800;
}

.preset-field label {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 8px 14px;
    background: #ffffff;
    font-weight: 800;
    cursor: pointer;
    box-sizing: border-box;
    flex: 1 1 auto;
}

.preset-field input[type="radio"] {
    margin: 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--accent);
}

.preset-field span {
    white-space: nowrap;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 800;
}

.preset-field label:has(input[type="radio"]:checked) {
    border-color: var(--accent);
    background: #f0f8fa;
}

.confirmation-box {
    display: grid;
    gap: 10px;
    border: 1px solid #c8dde5;
    border-radius: 8px;
    background: #f3fafc;
    padding: 14px;
}

.modal-form textarea {
    resize: vertical;
}

.modal-form input:focus,
.modal-form textarea:focus,
.modal-form select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.15);
}

.confirm-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #354154;
    font-weight: 700;
}

.technical-box {
    display: grid;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    padding: 14px;
}

.danger-zone-section {
    margin-top: 10px;
}

.danger-zone-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid #f3b4ae;
    border-radius: 8px;
    background: #fff8f7;
    padding: 18px;
}

.danger-zone-card h3 {
    margin-bottom: 4px;
    color: var(--danger);
}

.danger-box {
    grid-template-columns: 1fr !important;
    border-color: #f3b4ae !important;
    background: #fff8f7 !important;
}

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

    .sidebar {
        min-height: auto;
    }

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

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

    .topbar,
    .section-toolbar,
    .detail-header,
    .admin-actions,
    .danger-zone-card {
        align-items: stretch;
        flex-direction: column;
    }

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

    .search-field {
        width: 100%;
    }

    .users-toolbar,
    .filter-field {
        width: 100%;
    }

    .detail-grid,
    .record-card dl,
    .technical-box {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .login-panel,
    .main-content,
    .sidebar {
        padding: 18px;
    }

    .sidebar-nav {
        grid-template-columns: 1fr;
    }

    .modal-backdrop {
        align-items: stretch;
        padding: 10px;
    }

    .modal {
        width: 100%;
        max-height: calc(100dvh - 20px);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }

    .preset-field label {
        width: 100%;
    }

    .contextual-actions {
        grid-template-columns: 1fr;
        width: 100%;
        max-width: none;
    }

    .contextual-actions button {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
}

/* Ação de prorrogação: feedback visual de interatividade */
.extend-courtesy-button { cursor: pointer; width: 100%; margin-top: 10px; }
.extend-courtesy-button:hover { filter: brightness(1.12); }
.extend-courtesy-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Prorrogação de cortesia: formulário integrado ao Admin */
.extend-modal-fields { display: flex; flex-direction: column; gap: 12px; }
.extend-modal-fields label { font-weight: 650; }
.extend-modal-fields input, .extend-modal-fields textarea { width: 100%; box-sizing: border-box; }
.extend-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; border: 1px solid var(--border, #d6e0e8); border-radius: 12px; background: var(--surface-soft, rgba(100,130,160,.06)); }
.extend-preview div { display: flex; flex-direction: column; gap: 5px; }
.extend-preview span { font-size: .82rem; opacity: .75; }
.extend-preview strong { overflow-wrap: anywhere; }
@media(max-width:520px) { .extend-preview { grid-template-columns: 1fr; } }

/* Fila de acessos pagos */
.paid-queue-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:14px; }
.paid-queue-heading h3 { margin-bottom:5px; }
.paid-queue-heading p { margin:0; font-size:.88rem; line-height:1.5; }
.paid-queue-card { border-left:3px solid var(--accent); }
.paid-queue-card .record-head { gap:12px; }
@media(max-width:600px) { .paid-queue-card .record-head { flex-wrap:wrap; } }

/* Valor recebido: símbolo fixo do mercado, fora do campo editável. */
.payment-currency-input { display: flex; align-items: stretch; width: 100%; }
.payment-currency-prefix { display: flex; align-items: center; padding: 0 14px; border: 1px solid var(--border, #cbd5e1); border-right: 0; border-radius: 10px 0 0 10px; font-weight: 700; white-space: nowrap; background: var(--surface, #f8fafc); }
.payment-currency-input input { flex: 1; min-width: 0; border-radius: 0 10px 10px 0 !important; }

/* Ficha de usuários: informações cadastrais e cupons */
.admin-privacy-note { margin: 14px 0 0; font-size: 12px; line-height: 1.5; }
#personal-data-list dd, #user-coupons-list dd { overflow-wrap: anywhere; }
#user-coupons-list .record-card { padding: 12px; margin-top: 10px; }


/* SIMUNUS ADMIN — Fase 1 / interface de usuários (dados reais, sem métricas fictícias) */
:root {             }
.admin-view {  }
.sidebar {   }
.sidebar-brand strong { font-size:1.05rem; letter-spacing:.07em; text-transform:uppercase; }
.brand-mark {  border-radius:13px; }
.nav-item { border-radius:10px;  }
.nav-item:hover,.nav-item.is-active {   }
.main-content { padding:28px 30px; }
.topbar h1 { font-size:1.8rem; letter-spacing:-.025em; }
.section-toolbar { align-items:flex-start; }
#users-section .section-toolbar { flex-wrap:wrap; }
#users-section .section-toolbar > div:first-child h2 { font-size:1.45rem; }
#users-section .section-toolbar > div:first-child p { max-width:520px; font-size:.85rem; }
#users-section .users-toolbar { flex:1; gap:10px; justify-content:flex-end; }
#users-section .users-toolbar label {  font-size:.8rem; }
#users-section input,#users-section select {    border-radius:9px; }
#users-section select option {   }
#users-section input::placeholder {  }
#users-section .search-field { min-width:210px; }
.users-summary { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; }
.user-metric { position:relative; display:flex; flex-direction:column; min-height:118px; padding:17px 15px;  border-radius:14px;  }
.user-metric>span:nth-child(2) { padding-left:39px;  font-size:.76rem; }
.user-metric strong { display:block; margin:8px 0 0 39px; font-size:1.72rem; letter-spacing:-.03em; }
.user-metric-icon { position:absolute; top:15px; left:13px; display:grid; place-items:center; width:32px; height:32px; border-radius:9px;   font-size:1.35rem; }
.user-metric:nth-child(2) .user-metric-icon {   }
.user-metric:nth-child(4) .user-metric-icon {   }
.users-workspace { display:grid; grid-template-columns:minmax(0,1.7fr) minmax(280px,.82fr); align-items:start; gap:15px; }
#users-section .table-wrap { border-radius:14px; min-width:0; overflow:auto; }
#users-section table { min-width:800px; font-size:.82rem; }
#users-section th { font-size:.68rem; text-transform:uppercase; letter-spacing:.055em;   }
#users-section td { padding:12px 13px; }
#users-section tbody tr { cursor:pointer; transition:background .15s; }
#users-section tbody tr:hover,#users-section tbody tr.is-selected {  }
#users-section tbody tr.is-selected td:first-child {  }
.user-name-cell { display:flex; gap:10px; align-items:center; min-width:155px; }
.user-name-cell>div { min-width:0; }
.user-name-cell strong { display:block; overflow:hidden; text-overflow:ellipsis; max-width:185px; white-space:nowrap; }
.user-name-cell span:last-child { overflow:hidden; text-overflow:ellipsis; max-width:185px; white-space:nowrap; }
.user-avatar,.preview-avatar { display:grid; place-items:center; flex:0 0 auto; width:34px; height:34px; border-radius:50%;   font-size:.72rem; font-weight:750; }
.user-preview { min-width:0; padding:18px;  border-radius:14px;   }
.user-preview-empty { min-height:290px; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center;  }
.user-preview-empty h3 {  margin:17px 0 6px; }
.user-preview-empty p { font-size:.83rem; line-height:1.55; }
.preview-profile { display:flex; gap:12px; align-items:flex-start; padding-bottom:17px;  }
.preview-profile .preview-avatar { width:54px; height:54px; font-size:1.12rem; }
.preview-profile h3 { margin:1px 0 4px; font-size:1.05rem; overflow-wrap:anywhere; }
.preview-profile p { margin:0 0 10px;  font-size:.82rem; overflow-wrap:anywhere; }
.user-preview h4 { margin:18px 0 12px; }
.preview-details { display:grid; gap:12px; margin:0 0 20px; }
.preview-details div { display:grid; grid-template-columns:42% minmax(0,1fr); gap:10px; align-items:start; }
.preview-details dt {  font-size:.76rem; }
.preview-details dd { margin:0; text-align:right;  overflow-wrap:anywhere; font-size:.81rem; }
.preview-open-detail { width:100%; }
.preview-help { margin:12px 0 0;  font-size:.75rem; line-height:1.55; }
#user-detail-section .detail-panel,#user-detail-section .info-card,#user-detail-section .record-card { border-radius:13px; }
#user-detail-section #personal-data-list dd { overflow-wrap:anywhere; }
input,select,textarea {  }
@media(max-width:1440px) { .users-summary { grid-template-columns:repeat(3,minmax(0,1fr)); } .users-workspace { grid-template-columns:minmax(0,1fr) 295px; } }
@media(max-width:1130px) { .users-workspace { grid-template-columns:minmax(0,1fr); } .user-preview { order:-1; } .users-summary { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:650px) { .users-summary { grid-template-columns:1fr 1fr; } .user-metric { min-height:100px; padding:12px; } .user-metric strong { font-size:1.35rem; } .main-content { padding:18px; } }


/* FASE 1 — correção estrutural para layout responsivo, sem alterar dados ou RPCs. */
#users-section { min-width:0; gap:18px; }
#users-section .section-toolbar { display:flex; flex-direction:column; align-items:stretch; gap:16px; }
#users-section .section-toolbar > div:first-child { width:100%; }
#users-section .section-toolbar > div:first-child h2 { margin:0 0 5px; }
#users-section .users-toolbar {
  display:grid; width:100%; flex:none; grid-template-columns:minmax(205px, 1.65fr) repeat(4,minmax(120px,1fr));
  gap:10px; align-items:end; justify-content:stretch;
  padding:14px;  border-radius:13px; 
}
#users-section .users-toolbar .search-field,
#users-section .users-toolbar .filter-field { width:auto; min-width:0; max-width:none; display:grid; gap:6px; }
#users-section .users-toolbar label span {  font-size:.73rem; font-weight:650; }
#users-section .users-toolbar input,
#users-section .users-toolbar select { width:100%; min-width:0; min-height:40px; padding:8px 10px; font-size:.8rem; }
#users-section .users-summary { grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }
#users-section .user-metric { min-height:102px; padding:13px 12px 13px 50px; justify-content:center; }
#users-section .user-metric-icon { width:30px; height:30px; top:14px; left:12px; font-size:1.13rem; }
#users-section .user-metric>span:nth-child(2) { padding-left:0; font-size:.72rem; line-height:1.25; }
#users-section .user-metric strong { margin:5px 0 0; font-size:1.52rem; }
#users-section .users-workspace { grid-template-columns:minmax(0,1fr) minmax(265px,300px); gap:14px; align-items:start; min-width:0; }
#users-section .table-wrap { width:100%; max-width:100%; min-width:0; overflow-x:auto; overflow-y:hidden;  scrollbar-color:#446887 transparent; }
#users-section table { width:100%; min-width:610px; table-layout:auto; border-collapse:collapse; font-size:.8rem; }
#users-section th {   white-space:nowrap; padding:13px 12px; }
#users-section td {   padding:13px 12px;  }
#users-section tbody tr {   }
#users-section tbody tr:nth-child(even) {  }
#users-section tbody tr:hover,
#users-section tbody tr:focus,
#users-section tbody tr.is-selected {  outline:none; }
#users-section tbody tr:hover td,
#users-section tbody tr:focus td,
#users-section tbody tr.is-selected td {   }
#users-section .user-name-cell { min-width:190px; gap:9px; }
#users-section .user-name-cell strong {  max-width:170px; font-size:.8rem; }
#users-section .user-name-cell span:last-child {  max-width:170px; margin-top:3px; font-size:.72rem; }
#users-section .user-plan-cell strong { display:block;  font-size:.79rem; }
#users-section .user-plan-cell small { display:block;  font-size:.7rem; margin-top:3px; }
#users-section .status-badge { max-width:115px; padding:5px 9px; min-height:26px; font-size:.73rem; font-weight:700; white-space:normal; line-height:1.2; }
#users-section .user-preview { width:100%; max-width:100%; position:sticky; top:18px; }
#users-section .user-preview-empty { min-height:260px; }
#users-section .result-count { margin:0; font-size:.9rem; }
/* Não deixa o painel lateral comprimir a tabela em larguras médias. */
@media(max-width:1450px) {
  #users-section .users-toolbar { grid-template-columns:minmax(210px, 1.7fr) repeat(2,minmax(140px,1fr)); }
  #users-section .users-summary { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media(max-width:1190px) {
  #users-section .users-workspace { grid-template-columns:minmax(0,1fr); }
  #users-section .user-preview { position:static; order:2; }
  #users-section .users-summary { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media(max-width:870px) {
  #users-section .users-toolbar { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #users-section .users-toolbar .search-field { grid-column:1 / -1; }
  #users-section .users-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(max-width:520px) {
  #users-section .users-toolbar { padding:11px; gap:9px; }
  #users-section .users-toolbar .filter-field:last-child { grid-column:1 / -1; }
  #users-section .users-summary { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  #users-section .user-metric { min-height:94px; padding:12px 10px 12px 43px; }
  #users-section .user-metric-icon { left:9px; width:26px; height:26px; }
  #users-section .user-metric strong { font-size:1.25rem; }
  #users-section .user-metric>span:nth-child(2) { font-size:.68rem; }
  #users-section .table-wrap { border-radius:11px; }
  #users-section .user-preview { padding:13px; }
}

/* ============================================================
   FASE 1 — Ficha de usuário: consistência do tema escuro
   Corrige cartões herdados do antigo tema claro e contraste.
   ============================================================ */
.topbar #refresh-button {
  min-height: 40px;
  margin: 0;
  
  
  
  border-radius: 10px;
  padding: 8px 18px;
  
  font-weight: 650;
}
.topbar #refresh-button:hover {   }
.topbar #refresh-button:focus-visible { outline: 2px solid #71baff; outline-offset: 3px; }

#user-detail-section { min-width: 0; }
#user-detail-section .detail-panel {
  min-width: 0;
  
  
  
  padding: clamp(16px,2.5vw,28px);
  gap: 22px;
  
}
#user-detail-section .detail-header { align-items: flex-start; flex-wrap:wrap; gap:16px; padding-bottom: 20px;  }
#user-detail-section .detail-header > div:first-child { min-width:0; }
#user-detail-section .detail-header h2 {  font-size:clamp(1.25rem,2.2vw,1.7rem); overflow-wrap:anywhere; margin:7px 0 4px; }
#user-detail-section .detail-header .eyebrow { margin: 13px 0 2px; font-size:.73rem;  letter-spacing:.08em; }
#user-detail-section .detail-header .muted {  font-size:.8rem; overflow-wrap:anywhere; }
#user-detail-section .link-button {  font-size:.88rem; }
#user-detail-section .link-button:hover {  text-decoration:underline; }
#user-detail-section .detail-content { min-width:0; gap:18px; }
#user-detail-section .detail-grid { min-width:0; gap:14px; align-items:stretch; }
#user-detail-section .detail-grid > * { min-width:0; }
#user-detail-section .info-card,
#user-detail-section .admin-actions,
#user-detail-section .record-card,
#user-detail-section .technical-box {
  
  
  
  border-radius: 13px;
  
}
#user-detail-section .info-card { padding:clamp(15px,1.75vw,22px); }
#user-detail-section .info-card h3,
#user-detail-section .admin-actions h3,
#user-detail-section .history-section h3 {  font-size:1rem; margin:0 0 16px; }
#user-detail-section .info-card dl { gap:13px; }
#user-detail-section dt { font-size:.7rem; line-height:1.35;  letter-spacing:.055em; }
#user-detail-section dd {  font-size:.88rem; line-height:1.5; margin:4px 0 0; overflow-wrap:anywhere; }
#user-detail-section .muted {  }
#user-detail-section .admin-privacy-note { padding-top:12px;   }
#user-detail-section .record-list { min-width:0; }
#user-detail-section .record-card { padding:16px; }
#user-detail-section .record-head { flex-wrap:wrap; }
#user-detail-section .record-head span {  }
#user-detail-section .admin-actions { gap:18px; padding:20px; flex-wrap:wrap; }
#user-detail-section .admin-actions > div:first-child { min-width:0; }
#user-detail-section .contextual-actions { max-width:100%; }
#user-detail-section .contextual-actions .secondary-button,
#user-detail-section .secondary-button {
  
  
  
}
#user-detail-section .contextual-actions .secondary-button:hover,
#user-detail-section .secondary-button:hover {  }
#user-detail-section .danger-zone-card,
#user-detail-section .danger-box {   border-radius:13px;  }
#user-detail-section .danger-zone-card h3 {  }
#user-detail-section .history-section { min-width:0; }
#user-detail-section .history-section > h3 { padding-bottom:10px;  }
#user-detail-section .status-active {  }
#user-detail-section .status-warning {  }
#user-detail-section .status-danger {  }

/* Modais: contraste coerente com o tema global escuro. */
#modal-backdrop .modal {    }
#modal-backdrop .modal-header,#modal-backdrop .modal-footer {   }
#modal-backdrop .modal-form label:not(.confirm-check),
#modal-backdrop .preset-field legend,#modal-backdrop .confirm-check {  }
#modal-backdrop .modal-form input:not([type="checkbox"]):not([type="radio"]),
#modal-backdrop .modal-form textarea,#modal-backdrop .modal-form select {    }
#modal-backdrop .preset-field label {    }
#modal-backdrop .preset-field span {  }
#modal-backdrop .preset-field label:has(input:checked) {   }
#modal-backdrop .confirmation-box {   }
#modal-backdrop .icon-button {    }
#modal-backdrop .modal-footer .secondary-button {    }

@media (max-width: 760px) {
  #user-detail-section .detail-grid { grid-template-columns:minmax(0,1fr); }
  #user-detail-section .admin-actions { align-items:stretch; flex-direction:column; }
  #user-detail-section .contextual-actions { width:100%; }
}
@media (max-width: 460px) {
  #user-detail-section .detail-header { flex-direction:column; }
  #user-detail-section .record-card dl { grid-template-columns:minmax(0,1fr); }
  #user-detail-section .contextual-actions { grid-template-columns:minmax(0,1fr); }
}
/* Question report queue follows the existing administrative surface. */
.reports-filters { display:flex; flex-wrap:wrap; align-items:end; gap:12px; margin-bottom:16px; }
.reports-filters label { flex:1 1 160px; min-width:0; display:grid; gap:6px; }
.reports-filters input,.reports-filters select,.reports-review select,.reports-review textarea { width:100%; min-width:0; min-height:42px; box-sizing:border-box; padding:10px 12px;    border-radius:7px; }
.reports-review textarea { resize:vertical; }
.reports-filters input:focus-visible,.reports-filters select:focus-visible,.reports-review select:focus-visible,.reports-review textarea:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
#reports-section .secondary-button {   }
.reports-list { display:grid; gap:0; }
.report-row { width:100%; text-align:left; display:grid; gap:5px; padding:14px 8px;     cursor:pointer; overflow-wrap:anywhere; }
.report-row:hover,.report-row:focus-visible {  }
.report-row span { font-size:13px; }
.reports-detail { margin-top:24px; padding-top:24px;  min-width:0; }
.reports-preserve { white-space:pre-wrap; overflow-wrap:anywhere; }
.reports-review { display:grid; gap:12px; max-width:760px; margin-top:20px; }
.reports-review label { display:grid; gap:6px; }
.reports-actions { display:flex; flex-wrap:wrap; gap:10px; }
#reports-content { overflow-wrap:anywhere; }
#reports-content figure { margin:12px 0; }
#reports-content img,#reports-content video { max-width:100%; max-height:420px; object-fit:contain; }
