/* ── 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;
}

.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;
}
@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: 1040;
}
.sidebar-overlay.active { display: block; }

.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);
}
.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) {
    body {
        overflow-x: auto;
        background: #f6f8fb !important;
    }
    .app-shell::before,
    .app-shell::after {
        display: none;
    }
    .app-sidebar {
        position: fixed;
        top: 0;
        left: -86vw;
        height: 100dvh;
        width: min(84vw, 340px);
        max-width: 340px;
        z-index: 1050;
        transition: left .3s ease;
        overflow-y: auto;
        padding: 14px 12px 88px;
        border-radius: 0 16px 16px 0;
    }
    .app-sidebar.mobile-open {
        left: 0;
    }
    .app-main {
        width: 100%;
        min-width: 0;
        padding: 6px 6px 88px;
    }
    .app-content {
        width: 100%;
        max-width: 100%;
        padding: 10px;
        border-radius: 14px;
        overflow-x: visible;
        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%;
    }
    .app-search-form {
        flex: 1;
        min-width: 0;
    }
    .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%;
    }
    .table-responsive .table {
        min-width: 720px;
    }
    .row {
        min-width: 0;
    }
    .row > [class*="col-"] {
        min-width: 0;
    }
    .form-control,
    .form-select,
    textarea,
    input,
    select {
        max-width: 100%;
    }
    .input-group {
        flex-wrap: nowrap;
        max-width: 100%;
    }
    .input-group > .form-control,
    .input-group > .form-select {
        min-width: 0;
    }
    .d-flex {
        min-width: 0;
    }
    .btn {
        white-space: normal;
    }
    .card-body,
    .modal-body {
        min-width: 0;
    }
    [style*="min-width"] {
        min-width: 0 !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;
    }
}

@media (max-width: 575.98px) {
    .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;
    }
}
