/* ==========================================================================
   DataServer Batuk — management UI (Areas/Identity)
   Loaded after Bootstrap 5.1 and DataTables. Restyles both the new shell and
   the legacy markup used by the management pages (bare inputs, table forms,
   .btn_voltar, grey section bars, BS4-style modals).
   ========================================================================== */

:root {
    --brand: #3b5bdb;
    --brand-600: #3049c0;
    --brand-700: #263b9e;
    --brand-50: #eef2ff;
    --brand-100: #dfe6ff;
    --accent: #12b886;
    --danger: #e03131;
    --warning: #f59f00;

    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --border: #e3e7ef;
    --border-strong: #cfd5e1;
    --text: #1f2937;
    --text-muted: #6b7280;
    --text-faint: #9aa3b2;

    --sidebar-bg: #111827;
    --sidebar-text: #aeb6c6;
    --sidebar-hover: #1f2937;
    --sidebar-active: #ffffff;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
    --ring: 0 0 0 3px rgba(59, 91, 219, .18);

    --sidebar-w: 256px;
    --topbar-h: 64px;
}

/* ---------- Base ---------------------------------------------------------- */
html { font-size: 15px; }
body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; }

h1, h2, h3, h4, h5 { color: var(--text); font-weight: 700; letter-spacing: -.01em; }
.app-content h1 { font-size: 1.6rem; margin-bottom: 1.25rem; }
.app-content h2 { font-size: 1.35rem; margin-bottom: 1rem; }
.app-content h3 { font-size: 1.15rem; margin-bottom: .85rem; }
.app-content h4, .app-content h5 { font-size: 1rem; }
hr { border-color: var(--border); opacity: 1; }

/* ---------- Shell --------------------------------------------------------- */
.app-sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex; flex-direction: column;
    z-index: 1040;
    transition: transform .2s ease;
}
.app-brand {
    display: flex; align-items: center; gap: .7rem;
    height: var(--topbar-h);
    padding: 0 1.25rem;
    color: #fff; font-weight: 700; font-size: 1.05rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.app-brand:hover { color: #fff; text-decoration: none; }
.app-brand-logo {
    width: 34px; height: 34px; border-radius: 9px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand), #7048e8);
    color: #fff; font-size: .95rem;
}
.app-brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--sidebar-text); letter-spacing: .04em; }

.app-nav { flex: 1; overflow-y: auto; padding: 1rem .75rem 1.5rem; }
.app-nav-label {
    font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
    color: #6b7383; padding: 1rem .75rem .4rem;
}
.app-nav a {
    display: flex; align-items: center; gap: .75rem;
    padding: .55rem .75rem; margin-bottom: 2px;
    border-radius: 8px;
    color: var(--sidebar-text); font-weight: 500; font-size: .92rem;
}
.app-nav a i { width: 18px; text-align: center; font-size: .95rem; opacity: .85; }
.app-nav a:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.app-nav a.active { background: var(--brand); color: var(--sidebar-active); box-shadow: 0 4px 12px rgba(59, 91, 219, .35); }
.app-nav a.active i { opacity: 1; }

.app-sidebar-footer {
    padding: .9rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .06);
    font-size: .75rem; color: #6b7383;
}

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.app-topbar {
    position: sticky; top: 0; z-index: 1030;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.5rem;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
}
.app-topbar-title { font-size: 1.05rem; font-weight: 600; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-menu-toggle {
    display: none; border: 1px solid var(--border); background: var(--surface);
    width: 38px; height: 38px; border-radius: 8px; color: var(--text);
}
.store-chip {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .35rem .5rem .35rem .75rem;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface-2); font-size: .85rem; color: var(--text);
    white-space: nowrap;
}
.store-chip i { color: var(--brand); }
.store-chip a {
    font-size: .78rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px;
    background: var(--brand-50); color: var(--brand);
}
.store-chip a:hover { background: var(--brand-100); text-decoration: none; }

.user-menu-btn {
    display: inline-flex; align-items: center; gap: .6rem;
    border: 0; background: transparent; padding: .25rem .4rem; border-radius: 999px; color: var(--text);
}
.user-menu-btn:hover { background: var(--surface-2); }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--brand-50); color: var(--brand); font-weight: 700; font-size: .9rem;
}
.user-menu-name { font-size: .88rem; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-content { flex: 1; padding: 1.75rem 1.75rem 2.5rem; width: 100%; max-width: 1600px; }
.app-footer { padding: 1rem 1.75rem; font-size: .8rem; color: var(--text-faint); border-top: 1px solid var(--border); background: var(--surface); }
.app-footer a { color: var(--text-muted); }

.app-backdrop { display: none; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    body.sidebar-open .app-sidebar { transform: none; }
    body.sidebar-open .app-backdrop { display: block; position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 1035; }
    .app-main { margin-left: 0; }
    .app-menu-toggle { display: inline-grid; place-items: center; }
    .app-content { padding: 1.25rem 1rem 2rem; }
    .app-topbar { padding: 0 1rem; }
    .user-menu-name, .store-chip .store-chip-label { display: none; }
}

/* ---------- Page header / building blocks --------------------------------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header h1 { margin: 0; }
.page-header p { margin: .25rem 0 0; color: var(--text-muted); }

.card, .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: 1rem 1.25rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.panel { padding: 1.25rem; margin-bottom: 1.25rem; }

/* legacy "white box" wrapper and grey header bars (see .section-card/.section-bar in pages) */
.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 0 1.25rem 1rem;
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.section-bar {
    display: flex; align-items: center; justify-content: space-between;
    margin: 0 -1.25rem 1rem !important;
    width: auto !important;
    padding: .8rem 1.25rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-weight: 600; font-size: .95rem; color: var(--text);
    text-align: left;
}
.section-bar::before { content: ""; width: 4px; height: 1.1em; border-radius: 4px; background: var(--brand); margin-right: .6rem; flex: none; }
.section-bar.row { --bs-gutter-x: 0; }
.section-bar.row::before { display: none; }
.section-bar.row > * { padding: 0; line-height: 1.5 !important; }
:not(.section-card) > .section-bar { margin: 1rem 0 !important; border: 1px solid var(--border); border-radius: var(--radius); }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.tile {
    display: flex; flex-direction: column; gap: .75rem;
    padding: 1.15rem 1.2rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); color: var(--text);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--brand-100); color: var(--text); text-decoration: none; }
.tile-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 1.1rem; background: var(--brand-50); color: var(--brand); }
.tile-title { font-weight: 600; font-size: .98rem; }
.tile-desc { font-size: .82rem; color: var(--text-muted); margin-top: -.45rem; }
.tile.t-green .tile-icon { background: #e6fcf5; color: #0ca678; }
.tile.t-orange .tile-icon { background: #fff4e6; color: #e8590c; }
.tile.t-purple .tile-icon { background: #f3f0ff; color: #7048e8; }
.tile.t-pink .tile-icon { background: #fff0f6; color: #d6336c; }
.tile.t-cyan .tile-icon { background: #e3fafc; color: #1098ad; }
.tile.t-gray .tile-icon { background: #f1f3f5; color: #495057; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { padding: 1.15rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); display: flex; gap: 1rem; align-items: center; }
.stat-card .tile-icon { flex: none; }
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.2; }

.info-list { display: grid; grid-template-columns: max-content 1fr; gap: .6rem 1.5rem; margin: 0; }
.info-list dt { color: var(--text-muted); font-weight: 500; font-size: .88rem; }
.info-list dd { margin: 0; font-weight: 500; word-break: break-all; }
.chip { display: inline-block; padding: .15rem .6rem; border-radius: 999px; background: var(--brand-50); color: var(--brand-700); font-size: .78rem; font-weight: 600; margin: 0 .25rem .25rem 0; }

/* ---------- Buttons ------------------------------------------------------- */
.btn { border-radius: 8px; font-weight: 500; padding: .5rem 1rem; transition: all .15s ease; }
.btn:focus { box-shadow: var(--ring); }
.btn-lg { padding: .7rem 1.25rem; font-size: 1rem; }
.btn-sm { padding: .3rem .65rem; font-size: .82rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-secondary { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-secondary:hover, .btn-secondary:focus, .btn-secondary:active { background: var(--surface-2); border-color: var(--text-faint); color: var(--text); }
.btn-success { background: var(--accent); border-color: var(--accent); }
.btn-success:hover { background: #0ca678; border-color: #0ca678; }
.btn-link { font-weight: 500; }

/* legacy link-buttons used across pages */
.btn_voltar, .btn_import, .btn_nova_loja, .btn_salvar {
    display: inline-flex !important; align-items: center; justify-content: center; gap: .5rem;
    min-width: 150px; width: auto !important; height: auto !important;
    padding: .55rem 1.1rem; margin: .25rem;
    border-radius: 8px; font-weight: 600; font-size: .92rem; line-height: 1.4 !important;
    text-decoration: none !important; cursor: pointer;
    transition: all .15s ease;
}
.btn_voltar { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border-strong) !important; box-shadow: var(--shadow-sm); }
.btn_voltar::before { content: "\f060"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: .85em; }
/* Save buttons share the .btn_voltar look but show a floppy disk (fa-floppy-disk) instead of the back arrow. */
.btn_voltar.btn_gravar::before { content: "\f0c7"; }
.btn_voltar:hover { background: var(--surface-2) !important; border-color: var(--text-faint) !important; }
.btn_import, .btn_nova_loja, .btn_salvar { background: var(--brand) !important; color: #fff !important; border: 1px solid var(--brand) !important; }
.btn_import:hover, .btn_nova_loja:hover, .btn_salvar:hover { background: var(--brand-600) !important; }

/* legacy layout tables holding the action buttons ("Voltar", "Novo ...") */
.app-content table[width="100%"]:not(.table):not(.dataTable) { margin-top: 1.25rem; }
.app-content table[width="100%"]:not(.table):not(.dataTable) td { padding: .25rem; }

/* ---------- Forms --------------------------------------------------------- */
.app-content input:not([type]),
.app-content input[type=text], .app-content input[type=email], .app-content input[type=password],
.app-content input[type=number], .app-content input[type=tel], .app-content input[type=url],
.app-content input[type=date], .app-content input[type=datetime-local], .app-content input[type=time],
.app-content input[type=search], .app-content select, .app-content textarea,
.modal input:not([type]), .modal input[type=text], .modal input[type=email], .modal input[type=password],
.modal input[type=number], .modal input[type=tel], .modal input[type=url], .modal input[type=date],
.modal input[type=datetime-local], .modal input[type=time], .modal select, .modal textarea,
.auth-shell .form-control {
    display: block;
    width: 100%;
    padding: .5rem .75rem;
    font-size: .92rem; line-height: 1.5;
    color: var(--text);
    background-color: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.app-content select, .modal select { padding-right: 2.25rem; }
.app-content textarea, .modal textarea { min-height: 90px; }
.app-content input:focus, .app-content select:focus, .app-content textarea:focus,
.modal input:focus, .modal select:focus, .modal textarea:focus, .form-control:focus, .form-select:focus {
    outline: 0; border-color: var(--brand); box-shadow: var(--ring);
}
.app-content input[readonly], .modal input[readonly],
.app-content input:disabled, .app-content select:disabled, .app-content textarea:disabled {
    background-color: var(--surface-2); color: var(--text-muted);
}
.form-floating > .form-control { padding: 1rem .75rem; height: calc(3.5rem + 2px); }
.form-floating > .form-control:focus, .form-floating > .form-control:not(:placeholder-shown) { padding-top: 1.625rem; padding-bottom: .625rem; }
.form-floating > label { color: var(--text-muted); }
.form-label, label { font-weight: 500; }
.app-content form label, .modal label { font-size: .88rem; }

.app-content input[type=checkbox], .app-content input[type=radio], .modal input[type=checkbox], .modal input[type=radio] {
    width: 1.1rem; height: 1.1rem; accent-color: var(--brand); cursor: pointer; vertical-align: middle;
}
input.form-check { display: inline-block; padding: 0; min-height: 0; margin: .35rem auto 0; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* labels rendered as <span class="text-black"> above inputs in modals / forms */
.modal-body span.text-black, .section-card span.text-black {
    display: block; margin: .6rem 0 .3rem;
    font-size: .8rem; font-weight: 600; color: var(--text-muted);
}
.modal-body .row + .row { margin-top: .35rem; }

.text-danger.field-validation-error, span.text-danger { font-size: .82rem; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
div[asp-validation-summary], .validation-summary-errors { border-radius: var(--radius); }
.validation-summary-errors { background: #fff5f5; border: 1px solid #ffc9c9; padding: .75rem 1rem; margin-bottom: 1rem; }

/* ---------- Tables -------------------------------------------------------- */
.table { color: var(--text); margin-bottom: 0; --bs-table-hover-bg: var(--surface-2); }
.table > :not(caption) > * > * { padding: .7rem .75rem; border-bottom-color: var(--border); vertical-align: middle; }
.table > thead th, .table > thead td {
    font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-muted); background: var(--surface-2); border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table > :not(:first-child) { border-top: 0; }
.section-card .table { margin-bottom: 1rem; }
.section-card .table > thead th:first-child { border-top-left-radius: 8px; }
.section-card .table > thead th:last-child { border-top-right-radius: 8px; }

/* DataTables */
.dataTables_wrapper {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow); padding: 1rem 1.25rem; margin-bottom: 1rem;
    overflow-x: auto;
}
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter { margin-bottom: 1rem; color: var(--text-muted); font-size: .88rem; }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    display: inline-block !important; width: auto !important;
    padding: .4rem .7rem !important; margin: 0 .35rem;
    border: 1px solid var(--border-strong) !important; border-radius: 8px !important; background: var(--surface);
}
.dataTables_wrapper .dataTables_length select { padding-right: 2rem !important; }
.dataTables_wrapper .dataTables_filter input { min-width: 240px; }
table.dataTable { border-collapse: separate !important; border-spacing: 0; width: 100% !important; }
table.dataTable thead th, table.dataTable thead td {
    font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-muted); background-color: var(--surface-2);
    border-bottom: 1px solid var(--border) !important; padding: .75rem .75rem !important;
}
table.dataTable thead th:first-child { border-top-left-radius: 8px; }
table.dataTable thead th:last-child { border-top-right-radius: 8px; }
table.dataTable tbody td { padding: .7rem .75rem !important; border-top: 1px solid var(--border) !important; vertical-align: middle; font-size: .92rem; }
table.dataTable tbody tr:first-child td { border-top: 0 !important; }
table.dataTable tbody tr, table.dataTable.display tbody tr.odd, table.dataTable.display tbody tr.even { background-color: var(--surface) !important; }
table.dataTable.display tbody tr > .sorting_1, table.dataTable.display tbody tr.odd > .sorting_1,
table.dataTable.display tbody tr.even > .sorting_1 { background-color: transparent !important; }
table.dataTable tbody tr:hover, table.dataTable.display tbody tr:hover > * { background-color: var(--brand-50) !important; box-shadow: none !important; }
table.dataTable.display > tbody > tr > * { box-shadow: none !important; }
table.dataTable.no-footer { border-bottom: 1px solid var(--border) !important; }
table.dataTable tbody td a:not(.btn) {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .6rem; border-radius: 6px; font-size: .82rem; font-weight: 600;
    background: var(--brand-50); color: var(--brand);
}
table.dataTable tbody td a:not(.btn):hover { background: var(--brand-100); text-decoration: none; }
.dataTables_wrapper .dataTables_info { color: var(--text-muted) !important; font-size: .85rem; padding-top: 1rem !important; }
.dataTables_wrapper .dataTables_paginate { padding-top: .75rem !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 8px !important; border: 1px solid transparent !important;
    padding: .35rem .75rem !important; margin-left: 3px !important; color: var(--text) !important;
    font-size: .85rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover { background: var(--surface-2) !important; border-color: var(--border) !important; color: var(--text) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--brand) !important; border-color: var(--brand) !important; color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover { color: var(--text-faint) !important; background: transparent !important; border-color: transparent !important; }

/* ---------- Tabs, pills --------------------------------------------------- */
.nav-tabs {
    border-bottom: 1px solid var(--border); gap: .25rem; flex-wrap: nowrap;
    overflow-x: auto; overflow-y: hidden; margin-bottom: 1.25rem; scrollbar-width: thin;
}
.nav-tabs .nav-link {
    border: 0; border-bottom: 2px solid transparent; border-radius: 0;
    color: var(--text-muted); font-weight: 500; padding: .7rem 1rem; white-space: nowrap;
    margin-bottom: -1px;
}
.nav-tabs .nav-link:hover { color: var(--text); border-bottom-color: var(--border-strong); text-decoration: none; }
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link { color: var(--brand); background: transparent; border-bottom-color: var(--brand); }
.tab-content > .tab-pane { padding-top: .25rem; }

.nav-pills .nav-link { color: var(--text-muted); border-radius: 8px; font-weight: 500; padding: .55rem .85rem; display: flex; gap: .6rem; align-items: center; }
.nav-pills .nav-link i { width: 16px; text-align: center; }
.nav-pills .nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background: var(--brand-50); color: var(--brand-700); }

/* ---------- Modals -------------------------------------------------------- */
.modal-content { border: 0; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-title { font-weight: 700; font-size: 1.1rem; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: .9rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal-footer > .row { margin: 0; }
.modal-footer > .row > [class*=col] { padding: 0; }
.modal-header .close {
    margin-left: auto; border: 0; background: transparent; width: 34px; height: 34px; border-radius: 8px;
    font-size: 1.5rem; line-height: 1; color: var(--text-muted);
}
.modal-header .close:hover { background: var(--surface-2); color: var(--text); }
.modal-backdrop.show { opacity: .45; }

/* ---------- Misc components ---------------------------------------------- */
.alert { border-radius: var(--radius); border-width: 1px; padding: .85rem 1rem; }
.alert-info { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.badge { font-weight: 600; border-radius: 999px; padding: .3em .65em; }
.dropdown-menu { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .4rem; }
.dropdown-item { border-radius: 6px; padding: .5rem .75rem; font-size: .9rem; display: flex; gap: .6rem; align-items: center; }
.dropdown-item i { width: 16px; color: var(--text-muted); }
.dropdown-item:active { background: var(--brand); }
.readonly-banner { display: flex; align-items: center; gap: .6rem; }
fieldset.management-readonly { min-width: 0; }

/* ---------- Auth pages (anonymous) --------------------------------------- */
.auth-shell {
    min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(112, 72, 232, .18), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(59, 91, 219, .20), transparent 60%),
        var(--bg);
}
.auth-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.5rem; font-weight: 700; font-size: 1.2rem; color: var(--text); }
.auth-brand:hover { color: var(--text); text-decoration: none; }
.auth-card {
    width: 100%; max-width: 440px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
    box-shadow: var(--shadow-lg); padding: 2rem 2rem 1.75rem;
}
.auth-card.wide { max-width: 560px; }
.auth-card h1 { font-size: 1.45rem; margin-bottom: .35rem; }
.auth-card .auth-sub { color: var(--text-muted); margin-bottom: 1.5rem; font-size: .92rem; }
.auth-card .form-floating { margin-bottom: 1rem; }
.auth-links { display: flex; flex-direction: column; gap: .4rem; margin-top: 1.25rem; font-size: .88rem; text-align: center; }
.auth-divider { display: flex; align-items: center; gap: .75rem; margin: 1.5rem 0 1rem; color: var(--text-faint); font-size: .8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-footer { margin-top: 1.5rem; font-size: .8rem; color: var(--text-faint); }
.auth-shell main > h1:first-child, .auth-shell main > h2:first-child { font-size: 1.45rem; }

/* "Não existem ..." placeholders */
.empty-state {
    display: flex; align-items: center; justify-content: center; gap: .6rem;
    padding: 1.75rem 1rem; margin: .5rem 0 1rem;
    border: 1px dashed var(--border-strong); border-radius: var(--radius);
    background: var(--surface-2); color: var(--text-muted); font-size: .92rem; text-align: center;
}
.empty-state::before { content: "\f07b"; font-family: "Font Awesome 6 Free"; font-weight: 400; font-size: 1.2rem; color: var(--text-faint); }

/* stock Identity pages (col-md-4 etc.) rendered inside the narrow auth card */
.auth-card .row > [class*="col-"] { flex: 0 0 100%; max-width: 100%; margin-left: 0; }
.auth-card h2 { font-size: 1.1rem; }
.auth-card h3 { font-size: 1rem; }
.auth-card section + section, .auth-card .col-md-6 section { margin-top: 1rem; }
.tile-icon.t-green { background: #e6fcf5; color: #0ca678; }
.tile-icon.t-orange { background: #fff4e6; color: #e8590c; }
.tile-icon.t-purple { background: #f3f0ff; color: #7048e8; }
.tile-icon.t-pink { background: #fff0f6; color: #d6336c; }
.tile-icon.t-cyan { background: #e3fafc; color: #1098ad; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.page-actions form { margin: 0; }

/* Bootstrap 5.1 draws a 2px currentColor rule between thead/tbody */
.table > :not(:first-child) { border-top: 0 !important; }

/* primary actions on legacy pages (save / new buttons are btn-secondary in markup) */
.modal-footer [id^="btnSalvar"], .modal-footer [class*="save"],
.app-content [id^="btnNovo"], .app-content [id^="btnNova"] {
    background: var(--brand); border-color: var(--brand); color: #fff;
}
.modal-footer [id^="btnSalvar"]:hover, .modal-footer [class*="save"]:hover,
.app-content [id^="btnNovo"]:hover, .app-content [id^="btnNova"]:hover {
    background: var(--brand-600); border-color: var(--brand-600); color: #fff;
}
.app-content [id^="btnNovo"]::before, .app-content [id^="btnNova"]::before {
    content: "\2b"; font-family: "Font Awesome 6 Free"; font-weight: 900; margin-right: .45rem; font-size: .85em;
}

/* wide legacy table-forms scroll inside their container instead of widening the page */
.app-main { min-width: 0; overflow-x: clip; }
.section-card, .tab-content > .tab-pane { overflow-x: auto; }
.section-card > .table, .tab-pane > form > .table { min-width: 720px; }
@media (max-width: 767.98px) {
    .section-bar.row > * { width: auto; flex: 1 1 auto; }
    .dataTables_wrapper .dataTables_filter input { min-width: 0; width: 100% !important; margin: .35rem 0 0; }
    .page-header { align-items: stretch; }
}
