/*
 * Tabler bridge layer for the PHP-rendered inventory app.
 * Loaded after legacy styles to progressively modernize shell and high-traffic pages.
 */

:root {
    --tb-shell-bg: #f8fafc;
    --tb-surface: #ffffff;
    --tb-border: #e5e7eb;
    --tb-border-soft: #eef2f7;
    --tb-text: #1e293b;
    --tb-muted: #64748b;
    --tb-sidebar: #111827;
    --tb-sidebar-soft: #1f2937;
    --tb-brand: #1d4ed8;
    --tb-brand-soft: rgba(29, 78, 216, 0.15);
    --tb-radius: 12px;
    --tb-radius-lg: 16px;
    --tb-shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04);
    --tb-shadow-hover: 0 6px 16px rgba(15, 23, 42, 0.06);
    --tb-sidebar-glow: rgba(59, 130, 246, 0.18);
}

@media (min-width: 992px) {
    :root {
        margin-left: 0 !important;
    }
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--tb-shell-bg);
    color: var(--tb-text);
    font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6,
.card-title,
.modal-title {
    font-family: "Space Grotesk", "Plus Jakarta Sans", sans-serif;
}

.container-fluid {
    position: relative;
}

body .container-fluid {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.app-shell {
    --app-sidebar-width: 224px;
    --app-sidebar-collapsed-width: 64px;
    display: grid;
    grid-template-columns: var(--app-sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    background: var(--tb-shell-bg);
}

.app-shell:has(#sidebar.collapsed) {
    grid-template-columns: var(--app-sidebar-collapsed-width) minmax(0, 1fr);
}

body > .container-fluid.px-0 {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 !important;
}

body > .container-fluid.px-0 > .row.g-0 {
    flex-wrap: nowrap;
    width: 100%;
    margin: 0;
}

body > .container-fluid.px-0 > .row.g-0 > #sidebar.sidebar {
    flex: 0 0 var(--app-sidebar-width) !important;
    width: var(--app-sidebar-width) !important;
    max-width: var(--app-sidebar-width) !important;
}

body > .container-fluid.px-0 > .row.g-0 > #sidebar.sidebar.collapsed {
    flex-basis: var(--app-sidebar-collapsed-width) !important;
    width: var(--app-sidebar-collapsed-width) !important;
    max-width: var(--app-sidebar-collapsed-width) !important;
}

body > .container-fluid.px-0 > .row.g-0 > .main-content {
    flex: 1 1 auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0;
}

#sidebar.sidebar {
    background: #0f172a;
    border-right: 1px solid #1f2937;
    min-height: 100vh;
    box-shadow: none;
    overflow-y: auto;
    margin: 0 !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 0 !important;
    border-radius: 0;
    align-self: stretch;
}

#sidebar.sidebar::-webkit-scrollbar {
    width: 8px;
}

#sidebar.sidebar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 999px;
}

#sidebar .sidebar-logo-area {
    margin: 0 0 0.35rem !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    padding: 0.95rem 0.75rem 0.85rem;
}

#sidebar .sidebar-logo-area h6 {
    color: #e5edff !important;
    font-weight: 700;
    letter-spacing: 0.02em;
    font-size: 0.88rem;
    line-height: 1.25;
}

#sidebar .sidebar-logo {
    max-width: 112px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
}

#sidebar .nav {
    gap: 0.08rem;
    padding: 0 0.55rem 0.9rem;
}

#sidebar .nav-section-label {
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.69rem;
    font-weight: 700;
    margin: 0.65rem 0.35rem 0.22rem;
    padding-left: 0.4rem;
}

#sidebar .nav-link {
    display: flex;
    align-items: center;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.93rem;
    padding: 0.48rem 0.58rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    position: relative;
}

#sidebar .nav-link i {
    width: 1.08rem;
    text-align: center;
    opacity: 1;
    font-size: 0.95rem;
}

#sidebar .nav-link:hover {
    color: #ffffff;
    background: rgba(148, 163, 184, 0.16);
    border-color: rgba(148, 163, 184, 0.22);
}

#sidebar .nav-link.active {
    color: #ffffff;
    background: rgba(59, 130, 246, 0.16);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
}

#sidebar .nav-link.active::before {
    content: "";
    position: absolute;
    left: -0.32rem;
    width: 3px;
    top: 8px;
    bottom: 8px;
    border-radius: 999px;
    background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
    box-shadow: 0 0 12px var(--tb-sidebar-glow);
}

#sidebar .collapse .nav-link {
    padding-left: 1.5rem;
    color: #ffffff;
    font-size: 0.86rem;
}

#sidebar .nav-submenu {
    margin-left: 0.45rem;
    margin-bottom: 0.2rem;
    border-left: 1px dashed rgba(148, 163, 184, 0.3);
}

#sidebar .nav-link-has-submenu .nav-caret {
    transition: transform 0.2s ease;
}

#sidebar .nav-link-has-submenu[aria-expanded="true"] .nav-caret {
    transform: rotate(180deg);
}

#sidebar .sidebar-user-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0.55rem 0.55rem 0.9rem;
    padding: 0.55rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(255, 255, 255, 0.03);
}

#sidebar .sidebar-user-chip .chip-avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
}

#sidebar .sidebar-user-chip .chip-name {
    color: #ffffff;
    font-size: 0.78rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

#sidebar .sidebar-user-chip .chip-role {
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.62rem;
}

#sidebar .btn-sidebar-toggle,
#sidebar .btn-close-sidebar {
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
    backdrop-filter: blur(4px);
}

#sidebar .btn-sidebar-toggle {
    top: 0.85rem;
    right: 0.85rem;
    width: 34px;
    height: 34px;
}

#sidebar .btn-sidebar-toggle:hover,
#sidebar .btn-close-sidebar:hover {
    background: rgba(59, 130, 246, 0.18);
    color: #fff;
}

.main-content {
    min-width: 0;
    max-width: 100%;
    padding: 1.2rem 1.5rem 5rem !important;
}

.top-bar {
    background: var(--tb-surface);
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius);
    padding: 0.8rem 1rem;
    box-shadow: none;
    gap: 1rem;
    margin-bottom: 1.1rem !important;
    overflow: visible;
    position: relative;
    z-index: 2500;
}

.top-bar .page-title {
    min-width: 0;
}

.main-content > * {
    animation: contentReveal 0.28s ease both;
}

@keyframes contentReveal {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-title-row {
    gap: 0.75rem;
}

.page-title-row h2 {
    font-weight: 700;
    letter-spacing: 0.01em;
}

.clickable-card {
    cursor: pointer;
}

.clickable-card.active,
.clickable-card:hover {
    box-shadow: var(--tb-shadow-hover);
    transform: translateY(-1px);
}

.top-bar .global-search .input-group {
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--tb-border);
    background: #f8faff;
}

.top-bar .global-search {
    max-width: 500px;
    min-width: 280px;
    position: relative;
    z-index: 2510;
}

.top-bar .global-search-results,
.global-search-results {
    z-index: 2600 !important;
}

.top-bar .global-search .input-group-text,
.top-bar .global-search .form-control,
.top-bar .global-search .btn {
    border: 0 !important;
    background: transparent;
}

.top-bar .global-search .form-control {
    min-height: 42px;
}

.top-bar .search-shortcut-hint {
    font-size: 0.69rem;
    color: #64748b;
    margin-top: 0.25rem;
    text-align: right;
    letter-spacing: 0.04em;
}

.top-bar .search-shortcut-hint::before {
    content: "";
}

.top-bar .profile-dropdown .dropdown-toggle {
    border: 1px solid var(--tb-border);
    background: #ffffff;
    border-radius: 999px;
    padding: 0.3rem 0.65rem;
    color: var(--tb-text);
    max-width: 240px;
}

.top-bar .profile-dropdown .dropdown-menu {
    min-width: 220px;
}

.top-bar .user-avatar-img,
.top-bar .avatar-placeholder {
    width: 32px;
    height: 32px;
    object-fit: cover;
}

.top-bar .avatar-placeholder {
    background-color: var(--tb-brand);
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 700;
}

.top-bar .user-info {
    min-width: 0;
}

.top-bar .user-name {
    max-width: 140px;
    color: var(--tb-text);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-bar .user-role {
    color: var(--tb-muted);
    font-size: 0.75rem;
    line-height: 1;
}

.top-bar .profile-caret {
    color: var(--tb-muted);
    font-size: 0.8rem;
}

.is-hidden {
    display: none;
}

.card {
    border-radius: var(--tb-radius-lg);
    border-color: var(--tb-border);
    box-shadow: none;
    overflow: hidden;
}

.card-header {
    background: #ffffff;
    border-bottom-color: var(--tb-border-soft);
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

.card-body {
    padding: 1rem 1.05rem;
}

.page-title-row h2 > i,
.card-header h5 > i,
.card-title > i {
    display: inline-block;
    width: auto;
    height: auto;
    border-radius: 0;
    background: transparent;
    color: #64748b !important;
    box-shadow: none;
    margin-right: 0.45rem !important;
}

.stats-card .stats-icon {
    width: auto;
    height: auto;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.stats-card .stats-icon i {
    color: #64748b;
    font-size: 1.7rem !important;
}

.stats-card .stats-content {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.table-responsive {
    border: 1px solid var(--tb-border);
    border-radius: 14px;
    background: #fff;
    overflow-x: auto;
}

.table {
    margin-bottom: 0;
}

.table-responsive > .table,
.table-responsive table.dataTable {
    border: 0 !important;
    border-radius: 0;
    width: 100% !important;
}

.table-responsive > .table thead th,
.table-responsive table.dataTable thead th {
    border-top: 0 !important;
}

.table thead th {
    background: #ffffff;
    color: #334155;
    border-bottom: 1px solid #d7e3f8;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.78rem 0.85rem;
}

.table td {
    padding: 0.72rem 0.85rem;
    vertical-align: middle;
    border-color: #e7eef9;
    color: #475569;
    line-height: 1.35;
}

.table tbody tr {
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.table-hover tbody tr:hover {
    background-color: #f8fbff !important;
    box-shadow: inset 2px 0 0 #60a5fa;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border-radius: 10px;
    border: 1px solid #cfd9ea;
    min-height: 36px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 8px !important;
    border: 1px solid transparent !important;
}

.table-responsive .dataTables_wrapper > .row {
    align-items: center;
    margin: 0;
}

.table-responsive .dataTables_wrapper > .row:first-child {
    padding: 0.75rem 0.75rem 0.5rem;
    row-gap: 0.65rem;
}

.table-responsive .dataTables_wrapper > .row:last-child {
    padding: 0.7rem 0.75rem 0.75rem;
    border-top: 1px solid #e7eef9;
    row-gap: 0.65rem;
}

.table-responsive .dataTables_length,
.table-responsive .dataTables_filter,
.table-responsive .dataTables_info,
.table-responsive .dataTables_paginate {
    color: #475569;
    font-size: 0.84rem;
}

.table-responsive .dataTables_filter {
    text-align: right;
}

.table-responsive .dataTables_length select {
    width: 70px;
    margin: 0 0.35rem;
}

.table-responsive .dataTables_filter input {
    width: min(220px, 42vw);
    margin-left: 0.45rem;
}

.table td[data-label="Status"] {
    text-align: center;
}

.table td[data-label="Actions"],
.table th:last-child {
    text-align: right;
}

.table td[data-label="Actions"] .btn-group,
.table td:last-child .btn-group-sm {
    display: inline-flex;
    gap: 0.25rem;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.table td[data-label="Actions"] .btn,
.table td:last-child .btn-group-sm > .btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px !important;
}

.vendors-table-card #vendorsTable {
    table-layout: fixed;
}

.vendors-table-card #vendorsTable th,
.vendors-table-card #vendorsTable td {
    padding: 0.88rem 0.75rem;
}

.vendors-table-card #vendorsTable thead th {
    white-space: nowrap;
}

.vendors-table-card #vendorsTable th:nth-child(1),
.vendors-table-card #vendorsTable td:nth-child(1) {
    width: 22%;
}

.vendors-table-card #vendorsTable th:nth-child(2),
.vendors-table-card #vendorsTable td:nth-child(2) {
    width: 13%;
}

.vendors-table-card #vendorsTable th:nth-child(3),
.vendors-table-card #vendorsTable td:nth-child(3) {
    width: 18%;
}

.vendors-table-card #vendorsTable th:nth-child(4),
.vendors-table-card #vendorsTable td:nth-child(4) {
    width: 10%;
}

.vendors-table-card #vendorsTable th:nth-child(5),
.vendors-table-card #vendorsTable td:nth-child(5) {
    width: 22%;
}

.vendors-table-card #vendorsTable th:nth-child(6),
.vendors-table-card #vendorsTable td:nth-child(6) {
    width: 7%;
    text-align: center;
}

.vendors-table-card #vendorsTable th:nth-child(7),
.vendors-table-card #vendorsTable td:nth-child(7) {
    width: 8%;
    text-align: right;
}

.vendors-table-card #vendorsTable td:first-child {
    color: #1e293b;
}

.vendors-table-card #vendorsTable td:first-child strong {
    font-weight: 650;
}

.vendors-table-card #vendorsTable td a,
.vendors-table-card #vendorsTable td small {
    overflow-wrap: anywhere;
}

.quick-actions-card .card-body {
    display: grid;
    gap: 0.55rem;
}

.quick-action-btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.45rem;
    border-radius: 10px;
}

.quick-action-btn i {
    width: 1.32rem;
    text-align: center;
}

.stats-card {
    border-left-width: 4px !important;
    border-radius: var(--tb-radius);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.stats-card .card-body {
    padding: 1.15rem;
}

.stats-card .card-title {
    color: var(--tb-muted);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.stats-card h3 {
    margin-top: 0.1rem;
    margin-bottom: 0.35rem;
    font-size: 1.8rem;
}

.stats-card .stats-icon i {
    font-size: 1.7rem !important;
}

.table thead th {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: #334155;
}

.table tbody tr {
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.table-hover tbody tr:hover {
    background-color: #f8fbff !important;
}

.table-responsive #productsTable .product-title-cell {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.table-responsive #productsTable .product-image-link,
.table-responsive #productsTable .product-thumbnail,
.table-responsive #productsTable .product-thumbnail-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    overflow: visible;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    flex: 0 0 auto;
}

.table-responsive #productsTable .product-image-link {
    position: relative;
    z-index: 1;
}

.table-responsive #productsTable .product-thumbnail {
    object-fit: cover;
    position: relative;
    transform-origin: center center;
}

.table-responsive #productsTable .product-thumbnail-placeholder {
    color: #94a3b8;
    font-size: 0.95rem;
}

.table-responsive #productsTable td[data-label="Title"] strong {
    display: block;
    min-width: 0;
    line-height: 1.25;
}

.table-responsive #productsTable .product-image-link:hover .product-thumbnail,
.table-responsive #productsTable .product-image-link:hover .product-thumbnail-placeholder,
.table-responsive #productsTable .product-thumbnail:hover {
    transform: scale(1.08);
    z-index: 5;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
    border-color: #cbd5e1;
}

.product-image-preview-popup {
    position: fixed;
    z-index: 3000;
    display: none;
    width: min(420px, calc(100vw - 24px));
    pointer-events: none;
    transform: translateZ(0);
}

.product-image-preview-frame {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 16px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image-preview-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
}

.product-image-preview-caption {
    margin-top: 0.45rem;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.82);
    color: #fff;
    font-size: 0.78rem;
    line-height: 1.2;
    width: fit-content;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table-responsive #productsTable .product-image-link:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

.table td,
.table th {
    border-color: var(--tb-border-soft);
}

.status-badge,
.badge {
    border-radius: 999px;
}

.badge.bg-primary,
.badge.bg-secondary,
.badge.bg-success,
.badge.bg-danger,
.badge.bg-warning,
.badge.bg-info,
.table .badge.bg-primary,
.table .badge.bg-secondary,
.table .badge.bg-success,
.table .badge.bg-danger,
.table .badge.bg-warning,
.table .badge.bg-info {
    color: #fff !important;
}

.btn {
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.btn-primary {
    background-image: none;
    border: 0;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-success:hover,
.btn-outline-warning:hover,
.btn-outline-danger:hover {
    transform: translateY(-1px);
}

.form-control,
.form-select {
    border-radius: 10px;
    border-color: #cfd9ea;
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: #7aa2ff;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.14);
}

.modal-content {
    border-radius: 16px;
    border: 1px solid var(--tb-border);
    box-shadow: var(--tb-shadow-hover);
}

body.auth-page {
    background: radial-gradient(circle at top left, #dfe9ff 0%, #f2f6ff 40%, #f8fbff 100%);
}

body.auth-page .login-card,
body.auth-page .reset-card {
    border-radius: 16px;
    border: 1px solid #d9e3f5;
    box-shadow: 0 24px 50px rgba(30, 41, 59, 0.15);
}

@media (max-width: 1199.98px) {
    .app-shell {
        display: block;
    }

    .main-content {
        padding: 4.25rem 0.95rem 5rem !important;
    }

    .top-bar {
        padding: 0.7rem 0.75rem;
        gap: 0.6rem;
    }

    .top-bar .global-search {
        min-width: 260px;
    }

    #sidebar .nav-section-label {
        margin-top: 0.6rem;
    }

    .sidebar {
        left: 0 !important;
        transform: translateX(-110%);
        transition: transform 0.28s ease !important;
        position: fixed !important;
        inset: 0 auto 0 0;
        z-index: 1040;
    }

    #sidebar.sidebar {
        width: min(280px, 85vw) !important;
        max-width: 85vw !important;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-menu-toggle {
        border-radius: 12px !important;
        background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%) !important;
        border: 0 !important;
        box-shadow: 0 12px 26px rgba(30, 64, 175, 0.35) !important;
    }

    .mobile-overlay {
        backdrop-filter: blur(3px);
    }
}

@media (max-width: 767.98px) {
    #sidebar.sidebar {
        min-height: auto;
    }

    .top-bar {
        border-radius: 10px;
        padding: 0.55rem 0.6rem;
        gap: 0.5rem;
        align-items: stretch !important;
    }

    .top-bar .page-title {
        display: flex;
        align-items: center;
        min-height: 38px;
    }

    .top-bar .global-search {
        order: 3;
        flex: 1 1 100%;
        min-width: 0;
        max-width: 100% !important;
        margin: 0 !important;
    }

    .top-bar .global-search .input-group {
        min-height: 42px;
    }

    .top-bar .profile-dropdown {
        margin-left: auto;
    }

    .top-bar .profile-dropdown .dropdown-toggle {
        min-height: 40px;
        padding: 0.3rem 0.5rem;
        max-width: 180px;
    }

    .table-responsive table:not(.product-cards-table) tbody tr {
        padding: 0.85rem;
        gap: 0.45rem 0.75rem;
        border-radius: 12px;
    }

    .table-responsive table:not(.product-cards-table) td {
        font-size: 0.84rem;
        line-height: 1.35;
        min-width: 0;
    }

    .table-responsive table:not(.product-cards-table) td:first-child {
        font-size: 0.95rem;
        line-height: 1.3;
    }

    .table-responsive .dataTables_wrapper > .row:first-child,
    .table-responsive .dataTables_wrapper > .row:last-child {
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }

    .table-responsive .dataTables_length,
    .table-responsive .dataTables_filter,
    .table-responsive .dataTables_info,
    .table-responsive .dataTables_paginate {
        text-align: left;
    }

    .table-responsive .dataTables_filter input {
        width: 100%;
        max-width: none;
        margin: 0.35rem 0 0;
    }

    .table-responsive > .table,
    .table-responsive table.dataTable {
        table-layout: auto;
    }

    .table-responsive > .table th,
    .table-responsive > .table td,
    .table-responsive table.dataTable th,
    .table-responsive table.dataTable td {
        width: auto !important;
        text-align: left !important;
    }

    .table-responsive table:not(.product-cards-table) td .text-muted,
    .table-responsive table:not(.product-cards-table) td small {
        font-size: 0.78rem;
    }

    .table-responsive table:not(.product-cards-table) td,
    .table-responsive table:not(.product-cards-table) td * {
        word-break: break-word;
    }

    .table-responsive td[data-label="Actions"] .btn-group,
    .table-responsive table:not(.product-cards-table) td[data-label="Actions"] .btn-group,
    .table-responsive table:not(.product-cards-table) td:last-child .btn-group,
    .table-responsive .product-cards-table td[data-label="Actions"] .btn-group {
        gap: 0.35rem;
    }

    .table-responsive td[data-label="Actions"] .btn,
    .table-responsive table:not(.product-cards-table) td[data-label="Actions"] .btn,
    .table-responsive table:not(.product-cards-table) td:last-child .btn,
    .table-responsive .product-cards-table td[data-label="Actions"] .btn,
    .btn-group-sm > .btn,
    .btn-sm {
        min-height: 40px;
        min-width: 40px;
        padding: 0.32rem 0.5rem !important;
        font-size: 0.78rem !important;
        border-radius: 9px;
    }

    .table-responsive td[data-label="Actions"] .btn i,
    .table-responsive table:not(.product-cards-table) td[data-label="Actions"] .btn i,
    .table-responsive .product-cards-table td[data-label="Actions"] .btn i {
        font-size: 0.88rem !important;
    }

    .stats-card h3 {
        font-size: 1.55rem;
    }

    .top-bar .search-shortcut-hint {
        display: none;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 0.5rem 0.5rem;
    }

    .top-bar .global-search .input-group {
        min-height: 40px;
    }

    .top-bar .profile-dropdown .dropdown-toggle {
        padding: 0.26rem 0.42rem;
    }
}

/* Respect collapsed sidebar behavior from legacy stylesheet while improving appearance */
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-link .nav-caret,
.sidebar.collapsed .sidebar-logo-area h6,
.sidebar.collapsed .nav-submenu,
.sidebar.collapsed .sidebar-user-chip {
    display: none !important;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.7rem 0.5rem;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0 !important;
}

#sidebar.sidebar.collapsed {
    width: var(--app-sidebar-collapsed-width) !important;
    max-width: var(--app-sidebar-collapsed-width) !important;
    min-width: var(--app-sidebar-collapsed-width) !important;
}
