/* ── Modo escuro (v3-dark) ── */
body.v3-dark {
    background: radial-gradient(circle at top left, #0f172a 0%, #1e293b 60%, #0f172a 100%) !important;
    color: #e2e8f0;
}
body.v3-dark .sidebar-gradient {
    background: linear-gradient(180deg, #1e3a5f 0%, #162d4a 35%, #0f2034 65%, #091525 100%) !important;
    border-right: 1px solid rgba(96,165,250,.20);
    box-shadow: 0 0 30px rgba(15,23,42,.50);
}
body.v3-dark .app-content {
    background: rgba(15,23,42,.72);
    border-color: rgba(255,255,255,.08);
    box-shadow: 0 20px 55px rgba(0,0,0,.35);
}
body.v3-dark .app-toolbar {
    background: linear-gradient(135deg, rgba(30,41,59,.85), rgba(15,23,42,.80));
    border-color: rgba(255,255,255,.08);
}
body.v3-dark .card,
body.v3-dark .modal-content,
body.v3-dark .dropdown-menu {
    background: linear-gradient(180deg, rgba(30,41,59,.95), rgba(15,23,42,.97));
    border-color: rgba(255,255,255,.10);
    color: #e2e8f0;
}
body.v3-dark .table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255,255,255,.04);
    color: #e2e8f0;
}
body.v3-dark .table th,
body.v3-dark .table td { color: #e2e8f0; border-color: rgba(255,255,255,.08); }
body.v3-dark .form-control,
body.v3-dark .form-select {
    border-radius: 14px;
    border-color: rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    color: #e2e8f0;
}
body.v3-dark .form-control:focus,
body.v3-dark .form-select:focus {
    box-shadow: 0 0 0 .2rem rgba(96,165,250,.20);
    border-color: #60a5fa;
    background: rgba(255,255,255,.09);
}
body.v3-dark .text-muted { color: #94a3b8 !important; }
body.v3-dark .btn-outline-secondary { color: #94a3b8; border-color: rgba(255,255,255,.14); }
body.v3-dark .btn-outline-dark { color: #cbd5e1; border-color: rgba(255,255,255,.14); }

/* ── Temas ── */
body.theme-classic {
    background: radial-gradient(circle at top left, #dbeafe 0%, #c7d2fe 30%, #eef2ff 60%, #f8fafc 100%) !important;
}
body.theme-classic aside {
    background: linear-gradient(180deg,#2563eb 0%,#1d4ed8 45%,#1e3a8a 100%) !important;
}

body.theme-cyber {
    background: radial-gradient(circle at top right, #08121f 0%, #0b1b2b 45%, #03111c 100%) !important;
    color: #d7fff0;
}
body.theme-cyber aside {
    background: linear-gradient(180deg,#031821 0%,#052532 55%,#062c3a 100%) !important;
    border-right: 1px solid rgba(0,255,136,.25);
    box-shadow: 0 0 22px rgba(0,255,136,.14);
}
body.theme-cyber .card { background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.04)); border: 1px solid rgba(0,255,136,.2); color: #d7fff0; }
body.theme-cyber .btn-primary { background: linear-gradient(135deg,#00c57a,#00a965); border-color: transparent; }

body.theme-royal {
    background: radial-gradient(circle at top left, #5b21b6 0%, #312e81 40%, #0f172a 100%) !important;
    color: #eee8ff;
}
body.theme-royal aside {
    background: linear-gradient(180deg,#312e81 0%,#4c1d95 55%,#111827 100%) !important;
    border-right: 1px solid rgba(182,138,255,.28);
}
body.theme-royal .card { background: linear-gradient(180deg, rgba(255,255,255,.11), rgba(255,255,255,.04)); border: 1px solid rgba(182,138,255,.26); color: #eee8ff; }
body.theme-royal .btn-primary { background: linear-gradient(135deg,#9468ff,#7042d8); border-color: transparent; }

body.theme-sunset {
    background: radial-gradient(circle at top right, #fb923c 0%, #7c2d12 45%, #111827 100%) !important;
    color: #ffe8dc;
}
body.theme-sunset aside {
    background: linear-gradient(180deg,#9a3412 0%,#7c2d12 55%,#1f2937 100%) !important;
    border-right: 1px solid rgba(255,190,120,.3);
}
body.theme-sunset .card { background: linear-gradient(180deg, rgba(255,255,255,.11), rgba(255,255,255,.04)); border: 1px solid rgba(255,179,120,.26); color: #ffe8dc; }
body.theme-sunset .btn-primary { background: linear-gradient(135deg,#ff8a3d,#e45b13); border-color: transparent; }

body.theme-classic .btn,
body.theme-cyber .btn,
body.theme-royal .btn,
body.theme-sunset .btn {
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(0,0,0,.16);
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

body.theme-classic .btn:hover,
body.theme-cyber .btn:hover,
body.theme-royal .btn:hover,
body.theme-sunset .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(0,0,0,.22);
}

body.theme-classic .card,
body.theme-classic .modal-content,
body.theme-classic .dropdown-menu {
    background: linear-gradient(180deg, rgba(255,255,255,.95) 0%, rgba(248,250,255,.90) 100%);
    border: 1px solid rgba(255,255,255,.45);
    box-shadow: 0 18px 50px rgba(15,23,42,.10);
    backdrop-filter: blur(14px);
}
body.theme-classic .table { --bs-table-bg: transparent; --bs-table-striped-bg: rgba(13,110,253,.04); }
body.theme-classic .form-control,
body.theme-classic .form-select {
    border-radius: 14px;
    border-color: rgba(148,163,184,.35);
    background: rgba(255,255,255,.92);
}
body.theme-classic .form-control:focus,
body.theme-classic .form-select:focus {
    box-shadow: 0 0 0 .2rem rgba(99,102,241,.15);
    border-color: #6366f1;
}

body.theme-cyber .modal-content,
body.theme-cyber .dropdown-menu { background: linear-gradient(180deg, rgba(8,31,45,.98), rgba(5,21,31,.97)); border: 1px solid rgba(0,255,136,.26); color: #d7fff0; box-shadow: 0 12px 24px rgba(0,255,136,.16); }
body.theme-cyber .table { --bs-table-bg: transparent; --bs-table-striped-bg: rgba(0,255,136,.05); color: #d7fff0; }
body.theme-cyber .table th, body.theme-cyber .table td { color: #d7fff0; border-color: rgba(0,255,136,.16); }
body.theme-cyber .form-control,
body.theme-cyber .form-select { border-radius: 14px; border-color: rgba(0,255,136,.26); background: rgba(255,255,255,.04); color: #d7fff0; }
body.theme-cyber .form-control:focus,
body.theme-cyber .form-select:focus { box-shadow: 0 0 0 .2rem rgba(0,255,136,.18); border-color: #00d98a; background: rgba(255,255,255,.07); }

body.theme-royal .modal-content,
body.theme-royal .dropdown-menu { background: linear-gradient(180deg, rgba(65,44,104,.97), rgba(38,26,61,.97)); border: 1px solid rgba(182,138,255,.28); color: #eee8ff; box-shadow: 0 12px 24px rgba(182,138,255,.16); }
body.theme-royal .table { --bs-table-bg: transparent; --bs-table-striped-bg: rgba(182,138,255,.06); color: #eee8ff; }
body.theme-royal .table th, body.theme-royal .table td { color: #eee8ff; border-color: rgba(182,138,255,.16); }
body.theme-royal .form-control,
body.theme-royal .form-select { border-radius: 14px; border-color: rgba(182,138,255,.26); background: rgba(255,255,255,.05); color: #eee8ff; }
body.theme-royal .form-control:focus,
body.theme-royal .form-select:focus { box-shadow: 0 0 0 .2rem rgba(182,138,255,.18); border-color: #a678ff; background: rgba(255,255,255,.08); }

body.theme-sunset .modal-content,
body.theme-sunset .dropdown-menu { background: linear-gradient(180deg, rgba(115,55,28,.96), rgba(60,27,15,.97)); border: 1px solid rgba(255,190,120,.3); color: #ffe8dc; box-shadow: 0 12px 24px rgba(255,143,71,.17); }
body.theme-sunset .table { --bs-table-bg: transparent; --bs-table-striped-bg: rgba(255,179,120,.08); color: #ffe8dc; }
body.theme-sunset .table th, body.theme-sunset .table td { color: #ffe8dc; border-color: rgba(255,190,120,.16); }
body.theme-sunset .form-control,
body.theme-sunset .form-select { border-radius: 14px; border-color: rgba(255,190,120,.28); background: rgba(255,255,255,.06); color: #ffe8dc; }
body.theme-sunset .form-control:focus,
body.theme-sunset .form-select:focus { box-shadow: 0 0 0 .2rem rgba(255,143,71,.2); border-color: #ff9d55; background: rgba(255,255,255,.08); }

body.theme-cyber .nav-pills .nav-link.active,
body.theme-royal .nav-pills .nav-link.active,
body.theme-sunset .nav-pills .nav-link.active,
body.theme-classic .nav-pills .nav-link.active {
    border-radius: 14px;
}

/* ── Sidebar ── */
.sidebar-gradient {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 35%, #1e40af 65%, #1e3a8a 100%) !important;
    border-right: 1px solid rgba(147,197,253,.30);
    box-shadow: 0 0 30px rgba(37,99,235,.28);
    position: relative;
    overflow: hidden;
}
.sidebar-gradient::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, rgba(255,255,255,.10), transparent 35%, transparent 60%, rgba(191,219,254,.08));
    pointer-events: none;
}
.sidebar-gradient::after {
    content: '';
    position: absolute;
    top: -20%;
    left: -35%;
    width: 70%;
    height: 140%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.14), transparent);
    transform: rotate(12deg);
    filter: blur(8px);
    animation: sidebarGlowSweep 7s linear infinite;
    pointer-events: none;
    opacity: .7;
}

/* ── Logo ── */
.app-logo-wrap {
    position: relative;
    display: inline-block;
}
.app-logo-wrap::before {
    content: '';
    position: absolute;
    inset: -10px -18px;
    border-radius: 24px;
    background: radial-gradient(circle, rgba(191,219,254,.30), rgba(96,165,250,.16), transparent 72%);
    filter: blur(12px);
    animation: logoPulseGlow 3.6s ease-in-out infinite;
    pointer-events: none;
}

/* ── App Shell ── */
.app-shell {
    position: relative;
    overflow: hidden;
}
.app-shell::before,
.app-shell::after {
    content: '';
    position: fixed;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .28;
    pointer-events: none;
    z-index: 0;
}
.app-shell::before { top: -100px; right: -80px; background: #60a5fa; }
.app-shell::after { bottom: -120px; left: -80px; background: #a78bfa; }

.app-sidebar {
    width: 280px;
    padding: 22px 18px;
    position: relative;
    z-index: 2;
    transition: width .22s ease, padding .22s ease;
}

/* ── Sidebar collapsed ── */
.app-shell.sidebar-collapsed .app-sidebar {
    width: 68px;
    padding-left: 8px;
    padding-right: 8px;
}
.app-shell.sidebar-collapsed .app-sidebar .sidebar-section-label,
.app-shell.sidebar-collapsed .app-sidebar .app-brand-badge,
.app-shell.sidebar-collapsed .app-sidebar .btn span,
.app-shell.sidebar-collapsed .app-sidebar .sidebar-user-name,
.app-shell.sidebar-collapsed .app-sidebar .sidebar-user-role,
.app-shell.sidebar-collapsed .app-sidebar .fw-bold.fs-5 {
    display: none !important;
}
.app-shell.sidebar-collapsed .app-sidebar .sidebar-user-info {
    justify-content: center;
    padding: 8px;
}
.app-shell.sidebar-collapsed .app-sidebar .btn {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    gap: 0;
    position: relative;
}
.app-shell.sidebar-collapsed .app-sidebar .nav-ico {
    margin-right: 0;
}
.app-shell.sidebar-collapsed .app-sidebar .btn.active-nav::after {
    display: none;
}
.app-shell.sidebar-collapsed .app-sidebar form .btn {
    display: inline-flex !important;
}
.app-shell.sidebar-collapsed .app-main {
    padding-left: 12px;
}
/* Tooltip nos itens colapsados */
.app-shell.sidebar-collapsed .app-sidebar .btn[data-tippy] {
    overflow: visible;
}

/* ── Main / Content ── */
.app-main {
    position: relative;
    z-index: 1;
    padding: 20px;
}
.app-content {
    background: rgba(255,255,255,.42);
    border: 1px solid rgba(255,255,255,.28);
    backdrop-filter: blur(18px);
    border-radius: 28px;
    padding: 24px;
    box-shadow: 0 20px 55px rgba(15,23,42,.12);
    transition: opacity .24s ease, transform .24s ease, filter .24s ease;
}
body.v3-leaving .app-content {
    opacity: .35;
    transform: translateY(8px) scale(.992);
    filter: blur(2px);
}
body.v3-leaving .v3-preloader {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

/* ── Toolbar ── */
.app-toolbar {
    background: linear-gradient(135deg, rgba(255,255,255,.64), rgba(219,234,254,.54));
    border: 1px solid rgba(255,255,255,.36);
    backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 12px 14px;
    box-shadow: 0 12px 28px rgba(15,23,42,.08);
}
.app-toolbar .btn-primary,
.app-toolbar .btn-outline-primary,
.app-toolbar .btn-outline-secondary,
.app-toolbar .btn-outline-dark {
    border-radius: 14px !important;
}
.app-toolbar .btn-primary {
    background: linear-gradient(135deg, #0b63ff, #0a4be1 55%, #0837b8) !important;
    border-color: transparent !important;
    box-shadow: 0 14px 28px rgba(11,99,255,.22);
}
.app-toolbar .btn-outline-primary {
    color: #0b56f0;
    border-color: rgba(11,99,255,.22);
    background: linear-gradient(135deg, rgba(11,99,255,.08), rgba(147,197,253,.10));
}
.app-content .btn-primary {
    background: linear-gradient(135deg, #0b63ff, #0a4be1 55%, #0837b8) !important;
    border-color: transparent !important;
    box-shadow: 0 14px 28px rgba(11,99,255,.20);
}
.app-content .btn-outline-primary {
    color: #0b56f0;
    border-color: rgba(11,99,255,.20);
    background: linear-gradient(135deg, rgba(11,99,255,.08), rgba(147,197,253,.10));
}

/* ── Toggle ── */
.v3-toggle {
    min-width: 44px;
    font-size: 1rem;
    font-weight: 700;
}

/* ── Preloader ── */
.v3-preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, rgba(96,165,250,.22), transparent 28%), linear-gradient(135deg, rgba(2,6,23,.92), rgba(15,23,42,.96));
    backdrop-filter: blur(12px);
    transition: opacity .35s ease, visibility .35s ease;
    animation: v3PreloaderAutoHide 0s 2.5s forwards;
}
.v3-preloader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
@keyframes v3PreloaderAutoHide {
    to { opacity: 0; visibility: hidden; pointer-events: none; }
}
.v3-preloader-box {
    text-align: center;
    color: #fff;
}
.v3-preloader-ring {
    width: 76px;
    height: 76px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,.12);
    border-top-color: #60a5fa;
    border-right-color: #a78bfa;
    animation: v3Spin 1.1s linear infinite;
    box-shadow: 0 0 30px rgba(96,165,250,.18);
}
.v3-preloader-title {
    font-weight: 700;
    letter-spacing: .04em;
}
.v3-preloader-subtitle {
    color: rgba(255,255,255,.68);
    font-size: .78rem;
    margin-top: 4px;
}

/* ── Keyframes ── */
@keyframes v3Spin {
    to { transform: rotate(360deg); }
}
@keyframes sidebarGlowSweep {
    0% { transform: translateX(0) rotate(12deg); }
    100% { transform: translateX(240%) rotate(12deg); }
}
@keyframes logoPulseGlow {
    0%, 100% { opacity: .62; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.04); }
}

/* ── Sidebar buttons ── */
.app-sidebar .btn {
    justify-content: flex-start;
    align-items: center;
    gap: 20px;
    border-radius: 14px !important;
    border-color: rgba(255,255,255,.12) !important;
    background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.88) !important;
    backdrop-filter: blur(10px);
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
    position: relative;
    overflow: hidden;
    font-size: .82rem;
    font-weight: 500;
    letter-spacing: .01em;
    padding: 8px 12px;
}
.app-sidebar .btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255,255,255,.08), transparent);
    opacity: 0;
    transition: opacity .16s ease;
    border-radius: 14px;
}
.app-sidebar .btn:hover {
    background: rgba(255,255,255,.14) !important;
    border-color: rgba(255,255,255,.28) !important;
    color: #fff !important;
    transform: translateX(3px);
    box-shadow: 0 4px 18px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.12);
}
.app-sidebar .btn:hover::before { opacity: 1; }

.app-sidebar .btn.active-nav {
    background: rgba(255,255,255,.18) !important;
    border-color: rgba(255,255,255,.38) !important;
    color: #fff !important;
    box-shadow: 0 4px 20px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.20);
    font-weight: 600;
}
.app-sidebar .btn.active-nav .nav-ico {
    background: linear-gradient(135deg, rgba(255,255,255,.45), rgba(147,197,253,.30)) !important;
    box-shadow: 0 0 0 1px rgba(255,255,255,.20), 0 4px 14px rgba(96,165,250,.35), 0 0 20px rgba(96,165,250,.25) !important;
}
.app-sidebar .btn.active-nav::after {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: linear-gradient(180deg, #93c5fd, #60a5fa);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px rgba(96,165,250,.6);
}

.app-sidebar .btn span {
    padding-left: 2px;
    letter-spacing: .01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-sidebar .nav-ico {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    text-align: center;
    opacity: 1;
    font-size: .95rem;
    color: #ffffff;
    background: linear-gradient(135deg, rgba(255,255,255,.22), rgba(96,165,250,.14));
    border: 1px solid rgba(255,255,255,.18);
    box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 4px 12px rgba(2,6,23,.20);
    position: relative;
    flex-shrink: 0;
    transition: box-shadow .16s ease, background .16s ease;
}

/* ── Sidebar section labels ── */
.sidebar-section-label {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.38);
    padding: 4px 4px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,.10);
}

/* ── Sidebar user info ── */
.sidebar-user-info {
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59,130,246,.4);
}
.sidebar-user-name {
    font-size: .82rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-user-role {
    font-size: .7rem;
    color: rgba(255,255,255,.5);
    line-height: 1;
}

/* UI polish layer */
:root {
    --ui-radius: 8px;
    --ui-border: rgba(148, 163, 184, .28);
    --ui-soft: #f8fafc;
    --ui-text: #0f172a;
    --ui-muted: #64748b;
    --action-view: #0d6efd;
    --action-edit: #f59f00;
    --action-success: #198754;
    --action-print: #6f42c1;
    --action-danger: #dc3545;
}

.card,
.modal-content,
.dropdown-menu,
.list-group-item,
.alert {
    border-radius: var(--ui-radius) !important;
}

.card {
    border-color: var(--ui-border) !important;
}

.card-header {
    border-top-left-radius: var(--ui-radius) !important;
    border-top-right-radius: var(--ui-radius) !important;
}

.btn,
.form-control,
.form-select,
.input-group-text,
.page-link,
.badge {
    border-radius: 7px !important;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-height: 34px;
    font-weight: 700;
    transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease, border-color .14s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .10);
}

.btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.btn-outline-success,
.btn-success {
    --bs-btn-border-color: var(--action-success);
}

.btn-outline-warning,
.btn-warning {
    --bs-btn-border-color: var(--action-edit);
}

.btn-outline-danger,
.btn-danger {
    --bs-btn-border-color: var(--action-danger);
}

.btn-outline-primary,
.btn-primary {
    --bs-btn-border-color: var(--action-view);
}

.btn-outline-secondary .bi-printer,
.btn-secondary .bi-printer,
.btn-outline-dark .bi-printer,
.btn-dark .bi-printer {
    color: var(--action-print);
}

.table {
    vertical-align: middle;
}

.table thead th {
    background: var(--ui-soft);
    color: #334155;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
    white-space: nowrap;
    border-bottom-color: var(--ui-border);
}

.table tbody tr {
    transition: background-color .14s ease;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.module-toolbar,
.filter-toolbar,
.finance-filter-bar,
form.row.g-2.align-items-end {
    background: var(--ui-soft);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    padding: 10px;
}

.module-toolbar .form-label,
.filter-toolbar .form-label,
.finance-filter-bar .form-label,
form.row.g-2.align-items-end .form-label {
    color: var(--ui-muted);
    font-size: .72rem;
    font-weight: 800;
    margin-bottom: 3px;
    text-transform: uppercase;
}

.action-group,
.table-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.action-group .btn,
.table-actions .btn,
.table td .btn.btn-sm {
    min-width: 34px;
    min-height: 32px;
    padding-inline: 9px;
}

.list-group-item {
    border-color: rgba(148, 163, 184, .20);
}

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

.progress {
    border-radius: 999px;
    background: #e2e8f0;
}

.progress-bar {
    border-radius: inherit;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }

    .btn:hover {
        transform: none;
    }
}

@media (max-width: 768px) {
    .btn {
        min-height: 38px;
    }

    .table-responsive {
        border-radius: var(--ui-radius);
        border: 1px solid var(--ui-border);
    }

    .module-toolbar,
    .filter-toolbar,
    .finance-filter-bar,
    form.row.g-2.align-items-end {
        padding: 8px;
    }
}

.sidebar-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -8px -4px 12px;
    padding: 8px 4px 12px;
    border-bottom: 1px solid rgba(255,255,255,.14);
}

.sidebar-nav-group {
    padding: 4px;
    border-radius: 16px;
    background: rgba(15,23,42,.10);
    border: 1px solid rgba(255,255,255,.08);
}

/* ── Sidebar brand badge ── */
.app-brand-badge {
    display: inline-block;
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .06em;
    color: rgba(255,255,255,.45);
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    padding: 2px 10px;
    margin-top: 4px;
}

/* ── Sidebar scrollbar ── */
.app-sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}
.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }
.app-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }

/* ── Sidebar logout btn ── */
.sidebar-logout-btn {
    background: rgba(239,68,68,.12) !important;
    border-color: rgba(239,68,68,.24) !important;
    color: rgba(255,180,180,.9) !important;
    font-size: .82rem;
    font-weight: 600;
}
.sidebar-logout-btn:hover {
    background: rgba(239,68,68,.22) !important;
    border-color: rgba(239,68,68,.4) !important;
    color: #fca5a5 !important;
    transform: none !important;
}

/* ── Toolbar melhorias ── */
.app-toolbar {
    background: linear-gradient(135deg, rgba(255,255,255,.70), rgba(219,234,254,.60));
    border: 1px solid rgba(255,255,255,.45);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 10px 14px;
    box-shadow: 0 8px 24px rgba(15,23,42,.07);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.app-toolbar .btn { font-size: .8rem; }
.app-toolbar .form-control-sm { font-size: .8rem; border-radius: 12px !important; }

/* ── Notificações badge pulse ── */
#notif-count {
    animation: badgePulse 2s ease infinite;
}
.modal {
    z-index: 1065;
}
.modal.show {
    pointer-events: auto;
}
.modal-dialog {
    pointer-events: auto;
}
.modal-content,
.modal iframe {
    pointer-events: auto;
}
#notificacoesModal {
    z-index: 1065 !important;
}
.modal-backdrop {
    z-index: 1060;
}
@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.4); }
    50% { box-shadow: 0 0 0 5px rgba(220,38,38,0); }
}

/* ── Cards melhorias ── */
.card {
    transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(15,23,42,.12) !important;
}

/* ── Badges de status ── */
.badge { font-weight: 600; letter-spacing: .03em; }

/* ── Tables melhorias ── */
.table thead th {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}
.table tbody tr { transition: background .12s ease; }

/* ── Form melhorias ── */
.form-label {
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .02em;
    margin-bottom: .3rem;
}
.form-control, .form-select {
    transition: border-color .15s ease, box-shadow .15s ease;
}

/* ── Page title ── */
.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: #1e293b;
    line-height: 1.2;
}
.page-subtitle {
    font-size: .8rem;
    color: #64748b;
    margin-top: 2px;
}
body.v3-dark .page-title { color: #e2e8f0; }
body.v3-dark .page-subtitle { color: #94a3b8; }

/* ── Scrollbar global ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,.04); border-radius: 6px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.30); }
body.v3-dark ::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }
body.v3-dark ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }

/* ── Focus ring acessível ── */
:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

/* ── Mobile sidebar ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1090;
    opacity: 0;
    transition: opacity .2s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 1030;
    min-height: 62px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    padding: 8px;
    border-radius: 20px;
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(148,163,184,.28);
    box-shadow: 0 18px 45px rgba(15,23,42,.22);
    backdrop-filter: blur(18px);
}

.products-mobile-list {
    display: none;
}
.mobile-bottom-nav a,
.mobile-bottom-nav button {
    border: 0;
    background: transparent;
    color: #475569;
    text-decoration: none;
    border-radius: 14px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1;
}
.mobile-bottom-nav i {
    font-size: 1.15rem;
    line-height: 1;
}
.mobile-bottom-nav .active {
    color: #0b56f0;
    background: rgba(13,110,253,.10);
}
body.v3-dark .mobile-bottom-nav {
    background: rgba(15,23,42,.94);
    border-color: rgba(255,255,255,.12);
}
body.v3-dark .mobile-bottom-nav a,
body.v3-dark .mobile-bottom-nav button {
    color: #cbd5e1;
}
body.v3-dark .mobile-bottom-nav .active {
    color: #93c5fd;
    background: rgba(96,165,250,.16);
}

@media (max-width: 991.98px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
        background: #f6f8fb !important;
    }
    .app-shell {
        display: block !important;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    .app-shell::before,
    .app-shell::after {
        display: none;
    }
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;
        width: min(88vw, 360px) !important;
        max-width: 360px !important;
        z-index: 1100;
        transform: translateX(-104%);
        transition: transform .26s ease;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 14px 12px 88px;
        border-radius: 0 16px 16px 0;
    }
    .app-sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 18px 0 55px rgba(15,23,42,.32);
    }
    body.sidebar-open {
        overflow: hidden;
        touch-action: none;
    }
    .app-shell.sidebar-collapsed .app-sidebar {
        width: min(88vw, 360px) !important;
        padding: 14px 12px 88px !important;
    }
    .app-shell.sidebar-collapsed .app-sidebar .sidebar-section-label {
        display: flex !important;
    }
    .app-shell.sidebar-collapsed .app-sidebar .app-brand-badge,
    .app-shell.sidebar-collapsed .app-sidebar .sidebar-user-name,
    .app-shell.sidebar-collapsed .app-sidebar .sidebar-user-role,
    .app-shell.sidebar-collapsed .app-sidebar .fw-bold.fs-5 {
        display: block !important;
    }
    .app-shell.sidebar-collapsed .app-sidebar .btn span {
        display: inline !important;
    }
    .app-shell.sidebar-collapsed .app-sidebar .btn {
        justify-content: flex-start;
        padding: 8px 12px;
        gap: 14px;
    }
    .app-shell.sidebar-collapsed .app-sidebar .nav-ico {
        margin-right: 0;
        width: 30px;
        min-width: 30px;
    }
    .app-shell.sidebar-collapsed .app-sidebar .sidebar-user-info {
        justify-content: flex-start;
        padding: 10px;
    }
    .app-sidebar .btn[data-bs-toggle="collapse"] {
        min-height: 42px;
    }
    .app-sidebar .collapse {
        min-width: 0;
    }
    .app-main {
        width: 100%;
        max-width: 100vw;
        min-width: 0;
        padding: 6px 6px 88px;
    }
    .app-content {
        width: 100%;
        max-width: 100%;
        padding: 10px;
        border-radius: 14px;
        overflow-x: hidden;
        background: #ffffff;
        border-color: rgba(148,163,184,.22);
        box-shadow: 0 8px 26px rgba(15,23,42,.08);
        backdrop-filter: none;
    }
    body.v3-dark .app-content {
        background: #0f172a;
    }
    .app-toolbar {
        position: sticky;
        top: 4px;
        z-index: 1020;
        display: grid !important;
        grid-template-columns: 1fr;
        align-items: center;
        gap: 8px;
        padding: 8px;
        border-radius: 14px;
        margin-bottom: 12px !important;
        background: #ffffff;
        border-color: rgba(148,163,184,.24);
        box-shadow: 0 8px 22px rgba(15,23,42,.08);
        backdrop-filter: none;
    }
    .app-toolbar-main {
        min-width: 0;
        width: 100%;
        flex-wrap: nowrap;
    }
    .app-search-form {
        flex: 1;
        min-width: 0;
        max-width: 100%;
    }
    .app-search-form input[name="q"] {
        min-width: 0 !important;
        width: 100%;
    }
    .app-search-form .btn span,
    .app-toolbar-actions a span {
        display: none;
    }
    .app-toolbar-actions {
        flex-wrap: nowrap !important;
        justify-content: space-between;
        gap: 6px !important;
        width: 100%;
    }
    .app-toolbar-actions .btn,
    .app-toolbar-main > .btn,
    .app-search-form .btn {
        width: 40px;
        height: 38px;
        padding: 0 !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .app-toolbar-actions .btn i,
    .app-search-form .btn i {
        margin: 0 !important;
    }
    .card {
        border-radius: 14px !important;
        box-shadow: 0 6px 18px rgba(15,23,42,.07) !important;
    }
    .card:hover {
        transform: none;
    }
    .table-responsive {
        border-radius: 14px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
    }
    .table-responsive .table {
        width: max-content;
        min-width: 100%;
    }
    table.table {
        max-width: none;
    }
    .card,
    .card-body,
    .modal-content,
    .modal-body,
    .tab-content,
    .tab-pane {
        max-width: 100%;
        min-width: 0;
    }
    .card > .table,
    .card-body > .table,
    .app-content > .table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .row {
        min-width: 0;
    }
    .row > [class*="col-"] {
        min-width: 0;
    }
    .form-control,
    .form-select,
    textarea,
    input,
    select {
        max-width: 100%;
    }
    .input-group {
        flex-wrap: wrap;
        max-width: 100%;
    }
    .input-group > .form-control,
    .input-group > .form-select {
        min-width: 0;
    }
    .d-flex {
        min-width: 0;
    }
    .d-flex.flex-nowrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .justify-content-between {
        min-width: 0;
    }
    .btn-group,
    .btn-toolbar {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .btn {
        white-space: normal;
        max-width: 100%;
    }
    .btn + .btn {
        margin-left: 0;
    }
    .card-body,
    .modal-body {
        min-width: 0;
    }
    [style*="min-width"] {
        min-width: 0 !important;
    }
    [style*="max-width"] {
        max-width: 100% !important;
    }
    [style*="width:220px"],
    [style*="width: 220px"],
    [style*="width:200px"],
    [style*="width: 200px"] {
        width: 100% !important;
    }
    .modal-dialog {
        margin: .5rem;
    }
    .btn {
        min-height: 38px;
    }
    .row.g-3 {
        --bs-gutter-x: .75rem;
        --bs-gutter-y: .75rem;
    }
    .products-page-head,
    .products-page-actions,
    .products-table-toolbar,
    .products-bulk-actions {
        align-items: stretch !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: 100%;
    }
    .products-page-head > h4,
    .products-table-toolbar > small {
        width: 100%;
    }
    .products-page-actions .btn,
    .products-bulk-actions .btn {
        flex: 1 1 calc(50% - 8px);
        min-width: 132px;
    }
    .products-table-wrap {
        position: relative;
        overflow-x: auto !important;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        border: 1px solid rgba(148,163,184,.24);
    }
    .products-table {
        min-width: 980px !important;
    }
    .products-table .product-actions-col {
        position: sticky;
        right: 0;
        z-index: 3;
        min-width: 132px;
        background: #fff;
        box-shadow: -10px 0 16px rgba(15,23,42,.08);
    }
    .products-table thead .product-actions-col {
        z-index: 4;
        background: #f8fafc;
    }
    .products-table tr.table-warning .product-actions-col {
        background: #fff3cd;
    }
    .product-row-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .product-row-actions .btn,
    .product-row-actions form,
    .product-row-actions form .btn {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    body {
        font-size: .92rem;
    }
    .app-main {
        padding-left: 4px;
        padding-right: 4px;
    }
    .app-content {
        padding: 8px;
        border-radius: 12px;
    }
    .app-content > .d-flex,
    .card-body > .d-flex,
    .modal-body > .d-flex {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .app-content > .d-flex > *,
    .card-body > .d-flex > *,
    .modal-body > .d-flex > * {
        min-width: 0;
    }
    .app-content > .d-flex > .d-flex,
    .card-body > .d-flex > .d-flex {
        width: 100%;
    }
    .row {
        --bs-gutter-x: .65rem;
        --bs-gutter-y: .65rem;
    }
    .row > [class*="col-"] {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }
    .col-6,
    .col-md-3,
    .col-md-4,
    .col-md-5,
    .col-md-6,
    .col-md-8,
    .col-lg-3,
    .col-lg-4,
    .col-lg-6,
    .col-xl-6 {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }
    .card-body {
        padding: .85rem;
    }
    .form-control,
    .form-select,
    .btn {
        min-height: 42px;
    }
    .input-group,
    form .d-flex,
    form .gap-2 {
        flex-wrap: wrap !important;
    }
    .input-group > *,
    form .d-flex > *,
    form .gap-2 > * {
        min-width: 0;
    }
    form .btn,
    form a.btn {
        width: 100%;
    }
    .table-responsive {
        overflow-x: visible;
        border-radius: 0;
    }
    table.responsive-card-table {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        border-collapse: separate;
        border-spacing: 0;
    }
    table.responsive-card-table thead {
        display: none;
    }
    table.responsive-card-table tbody {
        display: grid;
        gap: 10px;
    }
    table.responsive-card-table tr {
        display: block;
        width: 100%;
        border: 1px solid rgba(148,163,184,.28);
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 6px 18px rgba(15,23,42,.06);
        overflow: hidden;
    }
    table.responsive-card-table tr.table-warning {
        background: #fff8e1;
    }
    table.responsive-card-table td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        width: 100% !important;
        max-width: 100%;
        min-height: 38px;
        padding: 8px 10px !important;
        border: 0;
        border-bottom: 1px solid rgba(148,163,184,.16);
        text-align: right !important;
        white-space: normal;
        word-break: break-word;
    }
    table.responsive-card-table td:last-child {
        border-bottom: 0;
    }
    table.responsive-card-table td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        max-width: 42%;
        text-align: left;
        color: #64748b;
        font-weight: 700;
        font-size: .78rem;
        text-transform: uppercase;
        letter-spacing: .03em;
    }
    table.responsive-card-table td[data-label=""]::before {
        display: none;
    }
    table.responsive-card-table td[data-label="Ações"],
    table.responsive-card-table td[data-label="Acoes"] {
        display: block;
        text-align: left !important;
        background: #f8fafc;
    }
    table.responsive-card-table td[data-label="Ações"]::before,
    table.responsive-card-table td[data-label="Acoes"]::before {
        display: block;
        max-width: 100%;
        margin-bottom: 8px;
    }
    table.responsive-card-table td[data-label="Ações"] .btn,
    table.responsive-card-table td[data-label="Acoes"] .btn,
    table.responsive-card-table td[data-label="Ações"] form,
    table.responsive-card-table td[data-label="Acoes"] form {
        width: 100%;
        margin: 0 0 6px 0;
    }
    table.responsive-card-table td input,
    table.responsive-card-table td select,
    table.responsive-card-table td textarea {
        width: 100%;
    }
    .products-table {
        min-width: 0 !important;
    }
    .products-table .product-actions-col {
        position: static;
        min-width: 0;
        background: #f8fafc !important;
        box-shadow: none;
    }
    .product-row-actions {
        display: grid;
        gap: 6px;
    }
    .products-desktop-table {
        display: none !important;
    }
    .products-mobile-list {
        display: grid;
        gap: 12px;
    }
    .product-mobile-card {
        border: 1px solid rgba(148,163,184,.26);
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 8px 22px rgba(15,23,42,.07);
        padding: 12px;
    }
    .product-mobile-card.is-critical {
        border-color: rgba(220,53,69,.32);
        background: #fff8e8;
    }
    .product-mobile-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 8px;
    }
    .product-mobile-check {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: #64748b;
        font-size: .85rem;
        font-weight: 700;
    }
    .product-mobile-name {
        font-weight: 800;
        color: #0f172a;
        line-height: 1.25;
        margin-bottom: 10px;
        word-break: break-word;
    }
    .product-mobile-fields {
        display: grid;
        gap: 7px;
        margin-bottom: 12px;
    }
    .product-mobile-fields div {
        display: grid;
        grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        border-top: 1px solid rgba(148,163,184,.16);
        padding-top: 7px;
    }
    .product-mobile-fields span {
        color: #64748b;
        font-size: .76rem;
        text-transform: uppercase;
        letter-spacing: .03em;
        font-weight: 800;
    }
    .product-mobile-fields strong {
        min-width: 0;
        text-align: right;
        word-break: break-word;
        font-size: .9rem;
    }
    .product-mobile-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        border-top: 1px solid rgba(148,163,184,.16);
        padding-top: 10px;
    }
    .product-mobile-actions form,
    .product-mobile-actions .btn {
        width: 100%;
    }
    .app-toolbar-actions {
        width: 100%;
        justify-content: space-between;
    }
    .app-toolbar-actions .btn {
        flex: 1 1 0;
    }
    h1, .h1 { font-size: 1.55rem; }
    h2, .h2 { font-size: 1.35rem; }
    h4, .h4 { font-size: 1.12rem; }
    .nav-pills {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        padding-bottom: 4px;
    }
    .nav-pills .nav-link {
        white-space: nowrap;
    }
    .mobile-bottom-nav {
        left: 6px;
        right: 6px;
        bottom: 6px;
        min-height: 58px;
        padding: 6px;
        border-radius: 16px;
    }
    .mobile-bottom-nav a,
    .mobile-bottom-nav button {
        font-size: .62rem;
    }
    .sidebar-nav-group {
        background: transparent;
        border-color: rgba(255,255,255,.08);
    }
    .app-sidebar .btn {
        min-height: 42px;
        padding: 7px 10px;
    }
    .app-sidebar .nav-ico {
        width: 30px;
        height: 30px;
        min-width: 30px;
    }
}
