/**
 * ERP Design System v2.0
 * Premium enterprise admin UI — scoped under .erp-v2
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Design Tokens ── */
.erp-v2 {
    --erp-primary: #2563EB;
    --erp-primary-hover: #1D4ED8;
    --erp-primary-light: #DBEAFE;
    --erp-success: #16A34A;
    --erp-success-light: #DCFCE7;
    --erp-warning: #EA580C;
    --erp-warning-light: #FFEDD5;
    --erp-danger: #DC2626;
    --erp-danger-light: #FEE2E2;
    --erp-info: #2563EB;
    --erp-info-light: #DBEAFE;
    --erp-gray-50: #F9FAFB;
    --erp-gray-100: #F3F4F6;
    --erp-gray-200: #E5E7EB;
    --erp-gray-300: #D1D5DB;
    --erp-gray-400: #9CA3AF;
    --erp-gray-500: #6B7280;
    --erp-gray-600: #4B5563;
    --erp-gray-700: #374151;
    --erp-gray-800: #1F2937;
    --erp-gray-900: #111827;
    --erp-bg-page: #F4F6F9;
    --erp-bg-card: #FFFFFF;
    --erp-bg-sidebar: #FFFFFF;
    --erp-bg-sidebar-brand: #0F172A;
    --erp-border: #E5E7EB;
    --erp-radius-input: 12px;
    --erp-radius-card: 16px;
    --erp-radius-btn: 12px;
    --erp-radius-modal: 20px;
    --erp-radius-dropdown: 12px;
    --erp-radius-badge: 9999px;
    --erp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --erp-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --erp-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.10);
    --erp-sidebar-width: 280px;
    --erp-sidebar-collapsed: 80px;
    --erp-header-height: 72px;
    --erp-header-glass: rgba(255, 255, 255, 0.72);
    --erp-header-glass-border: rgba(255, 255, 255, 0.55);
    --erp-sidebar-glass: linear-gradient(135deg, rgba(15, 23, 42, 0.94) 0%, rgba(30, 41, 59, 0.9) 100%);
    --erp-btn-height: 44px;
    --erp-form-control-height: 40px;
    --erp-form-control-height-lg: 44px;
    --erp-input-height: 44px;
    --erp-space-1: 8px;
    --erp-space-2: 12px;
    --erp-space-3: 16px;
    --erp-space-4: 24px;
    --erp-space-5: 32px;
    --erp-space-6: 48px;
    --erp-transition-hover: 120ms ease;
    --erp-transition-card: 150ms ease;
    --erp-transition-sidebar: 150ms ease;
    --erp-font: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ── Base ── */
body.erp-v2 {
    font-family: var(--erp-font) !important;
    background-color: var(--erp-bg-page) !important;
    color: var(--erp-gray-900);
}

body.erp-v2 .fas,
body.erp-v2 .fa,
body.erp-v2 .far,
body.erp-v2 .fab {
    font-family: "Font Awesome 5 Free", FontAwesome !important;
}

body.erp-v2 main.tw-bg-white {
    background-color: var(--erp-bg-page) !important;
}

body.erp-v2 #scrollable-container {
    position: relative;
    z-index: 1;
    background-color: var(--erp-bg-page);
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ── App shell: fixed header row, scroll content only ── */
body.erp-v2 .thetop {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}

body.erp-v2 .thetop > main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Hide all visible scrollbars — wheel/touch scrolling still works */
body.erp-v2,
body.erp-v2 * {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body.erp-v2 *::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
    background: transparent;
}

body.erp-v2 .erp-content {
    padding: var(--erp-space-4);
    max-width: 100%;
}

/* ── Sidebar ── */
body.erp-v2 .erp-sidebar {
    width: var(--erp-sidebar-width);
    min-width: var(--erp-sidebar-width);
    background: var(--erp-bg-sidebar);
    border-right: 1px solid var(--erp-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    transition: width var(--erp-transition-sidebar), min-width var(--erp-transition-sidebar);
    z-index: 30;
}

body.erp-v2.sidebar-collapse .erp-sidebar {
    width: var(--erp-sidebar-collapsed);
    min-width: var(--erp-sidebar-collapsed);
}

body.erp-v2 .erp-sidebar-brand {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--erp-space-2);
    height: var(--erp-header-height);
    min-height: var(--erp-header-height);
    padding: 0 var(--erp-space-4);
    background: var(--erp-sidebar-glass);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 2;
}

body.erp-v2 .erp-sidebar-brand:hover {
    color: #fff;
    text-decoration: none;
}

body.erp-v2 .erp-sidebar-brand-icon {
    position: relative;
    z-index: 1;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

body.erp-v2 .erp-sidebar-brand-text {
    position: relative;
    z-index: 1;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    transition: opacity var(--erp-transition-sidebar);
}

body.erp-v2.sidebar-collapse .erp-sidebar-brand-text,
body.erp-v2.sidebar-collapse .erp-nav-item > span,
body.erp-v2.sidebar-collapse .erp-nav-header,
body.erp-v2.sidebar-collapse .erp-sidebar-collapse-text {
    display: none !important;
}

body.erp-v2.sidebar-collapse .erp-sidebar-brand {
    justify-content: center;
    padding: 0;
}

body.erp-v2.sidebar-collapse .erp-crystal-artifact--sidebar {
    display: none;
}

body.erp-v2.sidebar-collapse .erp-nav-header {
    padding: 0;
    margin: 0;
    height: 0;
}

body.erp-v2.sidebar-collapse .erp-nav-item > svg.svg {
    display: none !important;
}

body.erp-v2.sidebar-collapse .erp-nav-item {
    justify-content: center;
    align-items: center;
    gap: 0;
    width: 48px;
    height: 48px;
    margin: 2px auto;
    padding: 0;
}

body.erp-v2.sidebar-collapse .erp-nav-item i {
    margin: 0;
    width: 20px;
    text-align: center;
    font-size: 18px;
    line-height: 1;
}

body.erp-v2.sidebar-collapse .erp-nav-item > svg:not(.svg) {
    margin: 0;
}

body.erp-v2.sidebar-collapse .erp-sidebar-nav {
    padding: 8px 6px;
}

body.erp-v2.sidebar-collapse .erp-sidebar-footer {
    padding: 12px 8px;
}

body.erp-v2.sidebar-collapse .erp-sidebar-collapse-btn {
    justify-content: center;
    padding: 0;
    width: 48px;
    height: 48px;
    margin: 0 auto;
}

body.erp-v2.sidebar-collapse .erp-sidebar-collapse-btn .erp-sidebar-collapse-icon {
    transform: rotate(180deg);
}

body.erp-v2 .erp-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--erp-space-2) var(--erp-space-2);
}

body.erp-v2 .erp-sidebar-footer {
    padding: var(--erp-space-3);
    border-top: 1px solid var(--erp-border);
    flex-shrink: 0;
}

body.erp-v2 .erp-sidebar-collapse-btn {
    display: flex;
    align-items: center;
    gap: var(--erp-space-2);
    width: 100%;
    padding: var(--erp-space-2) var(--erp-space-3);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-btn);
    background: var(--erp-bg-card);
    color: var(--erp-gray-600);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--erp-transition-hover), transform var(--erp-transition-sidebar);
}

body.erp-v2 .erp-sidebar-collapse-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--erp-transition-sidebar);
}

body.erp-v2 .erp-sidebar-collapse-btn:hover {
    background: var(--erp-gray-100);
    color: var(--erp-gray-900);
}

/* ── Navigation Items ── */
body.erp-v2 .erp-nav-header {
    padding: var(--erp-space-3) var(--erp-space-3) var(--erp-space-1);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--erp-gray-400);
}

body.erp-v2 .erp-nav-item {
    display: flex;
    align-items: center;
    gap: var(--erp-space-2);
    padding: 10px var(--erp-space-3);
    margin-bottom: 2px;
    border-radius: var(--erp-radius-btn);
    font-size: 14px;
    font-weight: 500;
    color: var(--erp-gray-600);
    text-decoration: none;
    transition: all var(--erp-transition-hover);
    white-space: nowrap;
}

body.erp-v2 .erp-nav-item:hover {
    background: var(--erp-gray-100);
    color: var(--erp-gray-900);
    text-decoration: none;
}

body.erp-v2 a.erp-nav-item--active,
body.erp-v2 a.erp-nav-item.erp-nav-item--active {
    background: var(--erp-primary) !important;
    color: #fff !important;
}

body.erp-v2 a.erp-nav-item--active svg,
body.erp-v2 a.erp-nav-item.erp-nav-item--active svg {
    stroke: #fff;
    color: #fff;
}

body.erp-v2 .erp-nav-group {
    margin-bottom: 2px;
}

body.erp-v2 .erp-nav-group--active > a.erp-nav-item {
    background: var(--erp-primary) !important;
    color: #fff !important;
}

body.erp-v2 .erp-nav-group--active > a.erp-nav-item svg {
    stroke: #fff;
    color: #fff;
}

body.erp-v2 .erp-nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

body.erp-v2 .erp-nav-child {
    padding: 7px 12px 7px 12px;
    margin-bottom: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--erp-gray-600);
    background: transparent !important;
    border-radius: 10px;
}

body.erp-v2 .erp-nav-child:hover {
    background: var(--erp-gray-100) !important;
    color: var(--erp-gray-900) !important;
}

body.erp-v2 .erp-nav-children {
    position: relative;
    margin-top: 4px;
    margin-bottom: 6px;
    padding: 4px 0 4px 12px;
    margin-left: 16px;
    border-left: none;
}

body.erp-v2 .erp-nav-children::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--erp-gray-200);
    border-radius: 1px;
}

body.erp-v2 .erp-nav-children > .tw-space-y-1 {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 0 !important;
}

body.erp-v2 .erp-nav-child--active,
body.erp-v2 a.erp-nav-child.erp-nav-child--active {
    background: var(--erp-primary-light) !important;
    color: var(--erp-primary) !important;
    font-weight: 600;
}

body.erp-v2.sidebar-collapse .erp-nav-children {
    display: none !important;
}

/* ── Top Navbar ── */
body.erp-v2 .erp-navbar {
    position: sticky;
    top: 0;
    z-index: 120;
    height: var(--erp-header-height);
    min-height: var(--erp-header-height);
    background: var(--erp-header-glass);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-bottom: 1px solid var(--erp-header-glass-border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
    padding: 0 var(--erp-space-4);
    flex-shrink: 0;
    overflow: visible;
    isolation: isolate;
}

body.erp-v2 .erp-navbar::before,
body.erp-v2 .erp-sidebar-brand::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    pointer-events: none;
    z-index: 2;
}

body.erp-v2 .erp-navbar::before {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.85) 35%, rgba(255, 255, 255, 0.85) 65%, rgba(255, 255, 255, 0.15) 100%);
}

body.erp-v2 .erp-sidebar-brand::before {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 255, 255, 0.08) 100%);
}

body.erp-v2 .erp-navbar-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--erp-space-3);
    height: 100%;
    width: 100%;
}

/* ── Crystal glass accent (sidebar + navbar) ── */
body.erp-v2 .erp-crystal-artifact {
    position: absolute;
    pointer-events: none;
    z-index: 0;
}

body.erp-v2 .erp-crystal-artifact--sidebar {
    width: 96px;
    height: 96px;
    top: -28px;
    right: -18px;
    opacity: 0.7;
    background:
        linear-gradient(145deg, rgba(147, 197, 253, 0.55) 0%, rgba(96, 165, 250, 0.08) 42%, transparent 70%),
        linear-gradient(225deg, rgba(167, 139, 250, 0.45) 0%, rgba(129, 140, 248, 0.1) 48%, transparent 72%),
        linear-gradient(315deg, rgba(34, 211, 238, 0.35) 0%, transparent 55%);
    clip-path: polygon(50% 0%, 92% 25%, 100% 70%, 50% 100%, 8% 70%, 0% 25%);
    filter: blur(0.2px);
}

body.erp-v2 .erp-crystal-artifact--sidebar::after {
    content: '';
    position: absolute;
    width: 34px;
    height: 34px;
    top: 28px;
    left: 10px;
    opacity: 0.55;
    background: linear-gradient(160deg, rgba(191, 219, 254, 0.65), rgba(59, 130, 246, 0.15));
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    transform: rotate(18deg);
}

body.erp-v2 .erp-crystal-artifact--navbar {
    width: 110px;
    height: 110px;
    top: -42px;
    right: 12%;
    opacity: 0.55;
    background:
        linear-gradient(135deg, rgba(59, 130, 246, 0.28) 0%, rgba(59, 130, 246, 0.04) 45%, transparent 70%),
        linear-gradient(225deg, rgba(139, 92, 246, 0.22) 0%, rgba(139, 92, 246, 0.04) 50%, transparent 75%),
        linear-gradient(315deg, rgba(6, 182, 212, 0.2) 0%, transparent 60%);
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

body.erp-v2 .erp-crystal-artifact--navbar::before {
    content: '';
    position: absolute;
    width: 42px;
    height: 42px;
    top: 36px;
    left: 18px;
    opacity: 0.45;
    background: linear-gradient(145deg, rgba(147, 197, 253, 0.5), rgba(37, 99, 235, 0.08));
    clip-path: polygon(50% 0%, 92% 25%, 100% 70%, 50% 100%, 8% 70%, 0% 25%);
    transform: rotate(-12deg);
}

body.erp-v2 .erp-crystal-artifact--navbar::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    top: 12px;
    right: 8px;
    opacity: 0.35;
    background: linear-gradient(180deg, rgba(165, 180, 252, 0.55), rgba(99, 102, 241, 0.1));
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

body.erp-v2 .erp-navbar-left {
    display: flex;
    align-items: center;
    gap: var(--erp-space-3);
    flex: 1;
    min-width: 0;
}

body.erp-v2 .erp-navbar-right {
    display: flex;
    align-items: center;
    gap: var(--erp-space-2);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

body.erp-v2 .erp-navbar .notifications-menu {
    position: relative;
}

body.erp-v2 .erp-navbar .notifications-menu.open {
    z-index: 130;
}

body.erp-v2 .erp-navbar .notifications-menu .dropdown-menu {
    z-index: 140 !important;
    margin-top: 8px;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-dropdown);
    box-shadow: var(--erp-shadow-lg);
}

body.erp-v2 .erp-navbar-right details {
    position: relative;
}

body.erp-v2 .erp-navbar-right details[open] {
    z-index: 130;
}

body.erp-v2 .erp-navbar-right details[open] .erp-dropdown-menu {
    z-index: 140;
}

body.erp-v2 .erp-search {
    position: relative;
    flex: 1;
    max-width: 480px;
}

body.erp-v2 .erp-search-input {
    width: 100%;
    height: 40px;
    padding: 0 var(--erp-space-4) 0 44px;
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: var(--erp-radius-input);
    background: rgba(249, 250, 251, 0.85);
    font-size: 14px;
    color: var(--erp-gray-900);
    transition: border-color var(--erp-transition-hover), box-shadow var(--erp-transition-hover);
}

body.erp-v2 .erp-search-input:focus {
    outline: none;
    border-color: var(--erp-primary);
    box-shadow: 0 0 0 3px var(--erp-primary-light);
    background: var(--erp-bg-card);
}

body.erp-v2 .erp-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--erp-gray-400);
    pointer-events: none;
}

body.erp-v2 .erp-search-kbd {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--erp-gray-200);
    color: var(--erp-gray-500);
    font-size: 11px;
    font-weight: 500;
    pointer-events: none;
}

body.erp-v2 .erp-navbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 var(--erp-space-3);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-input);
    background: var(--erp-bg-card);
    font-size: 13px;
    font-weight: 500;
    color: var(--erp-gray-700);
    cursor: pointer;
    transition: background var(--erp-transition-hover);
}

body.erp-v2 .erp-navbar-chip:hover {
    background: var(--erp-gray-50);
}

body.erp-v2 .erp-notif-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-input);
    background: var(--erp-bg-card);
    color: var(--erp-gray-600);
    cursor: pointer;
    transition: background var(--erp-transition-hover);
}

body.erp-v2 .erp-notif-btn:hover {
    background: var(--erp-gray-50);
}

body.erp-v2 .erp-notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--erp-radius-badge);
    background: var(--erp-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.erp-v2 .erp-profile-btn {
    display: flex;
    align-items: center;
    gap: var(--erp-space-2);
    padding: 4px 12px 4px 4px;
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-input);
    background: var(--erp-bg-card);
    cursor: pointer;
    transition: background var(--erp-transition-hover);
}

body.erp-v2 .erp-profile-btn:hover {
    background: var(--erp-gray-50);
}

body.erp-v2 .erp-profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--erp-primary-light);
    color: var(--erp-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
}

body.erp-v2 .erp-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.erp-v2 .erp-profile-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--erp-gray-900);
    line-height: 1.2;
}

body.erp-v2 .erp-profile-role {
    font-size: 11px;
    color: var(--erp-gray-500);
}

/* ── Buttons ── */
.erp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--erp-space-1);
    min-height: var(--erp-btn-height);
    padding: 0 var(--erp-space-4);
    border-radius: var(--erp-radius-btn);
    font-family: var(--erp-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--erp-transition-hover);
    text-decoration: none;
    white-space: nowrap;
}

.erp-btn:hover {
    text-decoration: none;
}

.erp-btn--primary {
    background: var(--erp-primary);
    color: #fff;
    border-color: var(--erp-primary);
}

.erp-btn--primary:hover {
    background: var(--erp-primary-hover);
    border-color: var(--erp-primary-hover);
    color: #fff;
}

.erp-btn--secondary {
    background: var(--erp-gray-100);
    color: var(--erp-gray-700);
    border-color: var(--erp-border);
}

.erp-btn--secondary:hover {
    background: var(--erp-gray-200);
    color: var(--erp-gray-900);
}

.erp-btn--outline {
    background: transparent;
    color: var(--erp-gray-700);
    border-color: var(--erp-border);
}

.erp-btn--outline:hover {
    background: var(--erp-gray-50);
    color: var(--erp-gray-900);
}

.erp-btn--ghost {
    background: transparent;
    color: var(--erp-gray-600);
    border-color: transparent;
}

.erp-btn--ghost:hover {
    background: var(--erp-gray-100);
    color: var(--erp-gray-900);
}

.erp-btn--sm {
    min-height: 36px;
    padding: 0 var(--erp-space-3);
    font-size: 13px;
}

/* Legacy Bootstrap buttons → v2 (admin shell only; POS uses lockscreen without erp-v2) */
body.erp-v2 .btn {
    border-radius: var(--erp-radius-btn);
    font-family: var(--erp-font);
    font-weight: 500;
    transition: all var(--erp-transition-hover);
    box-shadow: none;
}

body.erp-v2 .btn.btn-success,
body.erp-v2 .btn.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--erp-btn-height);
    padding: 0 var(--erp-space-4);
    background: var(--erp-primary);
    border-color: var(--erp-primary);
    color: #fff !important;
}

body.erp-v2 .btn.btn-success:hover,
body.erp-v2 .btn.btn-success:focus,
body.erp-v2 .btn.btn-primary:hover,
body.erp-v2 .btn.btn-primary:focus {
    background: var(--erp-primary-hover);
    border-color: var(--erp-primary-hover);
    color: #fff !important;
}

body.erp-v2 .btn.btn-default {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--erp-btn-height);
    padding: 0 var(--erp-space-4);
    background: var(--erp-gray-100);
    border-color: var(--erp-border);
    color: var(--erp-gray-700) !important;
}

body.erp-v2 .btn.btn-default:hover,
body.erp-v2 .btn.btn-default:focus {
    background: var(--erp-gray-200);
    border-color: var(--erp-border);
    color: var(--erp-gray-900) !important;
}

body.erp-v2 .btn.btn-xs,
body.erp-v2 .btn.btn-sm {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 10px;
}

body.erp-v2 .btn.btn-xs.btn-success,
body.erp-v2 .btn.btn-sm.btn-success,
body.erp-v2 .btn.btn-xs.btn-primary,
body.erp-v2 .btn.btn-sm.btn-primary {
    min-height: 32px;
    padding: 0 10px;
}

body.erp-v2 .btn .fa-save,
body.erp-v2 .erp-btn .fa-save {
    display: none;
}

/* ── Cards ── */
.erp-card {
    background: var(--erp-bg-card);
    border-radius: var(--erp-radius-card);
    box-shadow: var(--erp-shadow-sm);
    padding: var(--erp-space-4);
    border: 1px solid var(--erp-border);
    transition: box-shadow var(--erp-transition-card);
}

.erp-card--stretch {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.erp-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: visible;
}

.erp-card--has-list .erp-card__body {
    overflow: visible;
}

.erp-card:hover {
    box-shadow: var(--erp-shadow-md);
}

.erp-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--erp-space-3);
    margin-bottom: var(--erp-space-3);
    min-height: 40px;
    flex-shrink: 0;
}

.erp-card__header-text {
    min-width: 0;
}

.erp-card__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--erp-gray-900);
    margin: 0;
    line-height: 1.3;
}

.erp-card__subtitle {
    font-size: 12px;
    color: var(--erp-gray-500);
    margin: 2px 0 0;
}

.erp-card__action {
    flex-shrink: 0;
}

.erp-card--flat,
.erp-card--flat:hover {
    box-shadow: var(--erp-shadow-sm);
    transform: none;
}

.erp-dashboard-widget.erp-card--flat:hover {
    box-shadow: var(--erp-shadow-sm);
}

/* ── KPI Cards ── */
.erp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--erp-space-3);
    align-items: stretch;
    margin-bottom: var(--erp-space-4);
}

.erp-kpi {
    background: var(--erp-bg-card);
    border-radius: var(--erp-radius-card);
    box-shadow: var(--erp-shadow-sm);
    border: 1px solid var(--erp-border);
    padding: var(--erp-space-4);
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.erp-kpi:hover {
    box-shadow: var(--erp-shadow-sm);
    transform: none;
}

.erp-kpi__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--erp-space-3);
    min-height: 40px;
}

.erp-kpi__trend-slot {
    min-width: 48px;
    text-align: right;
}

.erp-kpi__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.erp-kpi__icon--green { background: var(--erp-success-light); color: var(--erp-success); }
.erp-kpi__icon--blue { background: var(--erp-info-light); color: var(--erp-info); }
.erp-kpi__icon--orange { background: var(--erp-warning-light); color: var(--erp-warning); }
.erp-kpi__icon--purple { background: #EDE9FE; color: #7C3AED; }
.erp-kpi__icon--red { background: var(--erp-danger-light); color: var(--erp-danger); }

.erp-kpi__trend {
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 2px;
}

.erp-kpi__trend--up { color: var(--erp-success); }
.erp-kpi__trend--down { color: var(--erp-danger); }

.erp-kpi__label {
    font-size: 13px;
    color: var(--erp-gray-500);
    margin: 0 0 6px;
    line-height: 1.3;
}

.erp-kpi__value {
    font-size: 22px;
    font-weight: 700;
    color: var(--erp-gray-900);
    line-height: 1.2;
    margin: 0;
    margin-top: auto;
}

/* ── Badges ── */
.erp-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    border-radius: var(--erp-radius-badge);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    min-width: 72px;
}

.erp-badge--success { background: var(--erp-success-light); color: var(--erp-success); }
.erp-badge--info { background: var(--erp-info-light); color: var(--erp-info); }
.erp-badge--warning { background: var(--erp-warning-light); color: var(--erp-warning); }
.erp-badge--danger { background: var(--erp-danger-light); color: var(--erp-danger); }
.erp-badge--gray { background: var(--erp-gray-100); color: var(--erp-gray-600); }

/* ── Inputs ── */
.erp-input {
    height: var(--erp-input-height);
    padding: 0 var(--erp-space-3);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-input);
    background: var(--erp-bg-card);
    font-family: var(--erp-font);
    font-size: 14px;
    color: var(--erp-gray-900);
    transition: border-color var(--erp-transition-hover), box-shadow var(--erp-transition-hover);
}

.erp-input:focus {
    outline: none;
    border-color: var(--erp-primary);
    box-shadow: 0 0 0 3px var(--erp-primary-light);
}

/* ── Tables ── */
.erp-table-wrap {
    overflow-x: visible;
    border-radius: var(--erp-radius-card);
}

.erp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.erp-table thead th {
    position: sticky;
    top: 0;
    background: var(--erp-gray-50);
    padding: var(--erp-space-2) var(--erp-space-3);
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--erp-gray-500);
    border-bottom: 1px solid var(--erp-border);
}

.erp-table tbody tr:nth-child(even) {
    background: var(--erp-gray-50);
}

.erp-table tbody tr:hover {
    background: var(--erp-primary-light);
}

.erp-table tbody td {
    padding: var(--erp-space-3);
    border-bottom: 1px solid var(--erp-border);
    color: var(--erp-gray-700);
}

.erp-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Quick Actions ── */
.erp-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--erp-space-2);
    flex: 1;
    align-content: start;
}

.erp-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 88px;
    padding: var(--erp-space-3) var(--erp-space-2);
    border: 1px solid var(--erp-border);
    border-radius: 12px;
    background: var(--erp-gray-50);
    text-decoration: none;
    color: var(--erp-gray-700);
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
    transition: border-color var(--erp-transition-hover), background var(--erp-transition-hover);
}

.erp-quick-action:hover {
    background: var(--erp-bg-card);
    color: var(--erp-primary);
    text-decoration: none;
    border-color: var(--erp-primary-light);
    box-shadow: var(--erp-shadow-sm);
    transform: none;
}

.erp-quick-action svg {
    width: 24px;
    height: 24px;
    color: var(--erp-gray-500);
}

.erp-quick-action:hover svg {
    color: var(--erp-primary);
}

/* ── Dashboard Layout ── */
.erp-dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--erp-space-4);
    margin-bottom: var(--erp-space-5);
}

.erp-dashboard-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--erp-gray-900);
    margin: 0;
}

.erp-dashboard-subtitle {
    font-size: 14px;
    color: var(--erp-gray-500);
    margin: 4px 0 0;
}

.erp-dashboard-actions {
    display: flex;
    align-items: center;
    gap: var(--erp-space-2);
}

.erp-dashboard-row {
    display: grid;
    gap: var(--erp-space-4);
    margin-bottom: var(--erp-space-4);
    align-items: stretch;
}

.erp-dashboard-row--charts {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
}

.erp-dashboard-row--tables {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
}

/* ── Order List ── */
.erp-order-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    overflow: visible;
}

.erp-order-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--erp-border);
    font-size: 13px;
}

.erp-order-item:first-child {
    padding-top: 0;
}

.erp-order-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.erp-order-item__main {
    min-width: 0;
}

.erp-order-item__id {
    font-weight: 600;
    color: var(--erp-gray-900);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-order-item__meta {
    color: var(--erp-gray-500);
    font-size: 11px;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.erp-order-item__time {
    color: var(--erp-gray-400);
    font-size: 11px;
    white-space: nowrap;
    text-align: right;
}

.erp-order-item__amount {
    font-weight: 600;
    color: var(--erp-gray-900);
    font-size: 12px;
    white-space: nowrap;
    text-align: right;
}

/* ── Today Summary Bar ── */
.erp-today-bar {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0;
    background: var(--erp-bg-card);
    border-radius: var(--erp-radius-card);
    box-shadow: var(--erp-shadow-sm);
    border: 1px solid var(--erp-border);
    padding: var(--erp-space-4) 0;
    margin-top: var(--erp-space-2);
}

.erp-today-item {
    text-align: center;
    padding: 0 var(--erp-space-3);
    border-right: 1px solid var(--erp-border);
}

.erp-today-item:last-child {
    border-right: none;
}

.erp-today-item__label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--erp-gray-500);
    margin-bottom: 6px;
}

.erp-today-item__value {
    font-size: 17px;
    font-weight: 700;
    color: var(--erp-gray-900);
    line-height: 1.2;
}

/* ── Chart container ── */
.erp-chart-container {
    flex: 1;
    min-height: 260px;
    height: 260px;
    position: relative;
    overflow: hidden;
}

.erp-chart-container .highcharts-container,
.erp-chart-container > div {
    width: 100% !important;
    height: 100% !important;
}

#erp-order-status-chart {
    flex: 1;
    min-height: 200px;
    height: 200px;
}

.erp-order-status-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#erp-order-status-legend {
    flex-shrink: 0;
    margin-top: var(--erp-space-2);
    padding-top: var(--erp-space-2);
    border-top: 1px solid var(--erp-border);
}

.erp-legend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 0;
    color: var(--erp-gray-600);
}

.erp-legend-row span:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
}

.erp-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Dashboard table in widget ── */
.erp-dashboard-widget .erp-table-wrap {
    flex: 1;
    overflow: visible;
}

.erp-dashboard-widget .erp-table thead th {
    padding: 8px 12px;
}

.erp-dashboard-widget .erp-table tbody td {
    padding: 10px 12px;
    font-size: 13px;
    vertical-align: middle;
}

.erp-dashboard-widget .erp-table tbody td:first-child {
    width: 36px;
    color: var(--erp-gray-400);
    font-weight: 600;
}

/* ── Dropdown menu ── */
.erp-dropdown-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 200px;
    background: var(--erp-bg-card);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-dropdown);
    box-shadow: var(--erp-shadow-lg);
    padding: var(--erp-space-1);
    z-index: 50;
    list-style: none;
    margin: 0;
}

.erp-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: var(--erp-space-2);
    padding: var(--erp-space-2) var(--erp-space-3);
    border-radius: 8px;
    font-size: 14px;
    color: var(--erp-gray-700);
    text-decoration: none;
    transition: background var(--erp-transition-hover);
}

.erp-dropdown-menu a:hover {
    background: var(--erp-gray-100);
    color: var(--erp-gray-900);
    text-decoration: none;
}

/* ── Product row in table ── */
.erp-product-cell {
    display: flex;
    align-items: center;
    gap: var(--erp-space-2);
}

.erp-product-thumb {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--erp-gray-100);
}

/* ── Loading skeleton ── */
.erp-skeleton {
    background: linear-gradient(90deg, var(--erp-gray-100) 25%, var(--erp-gray-200) 50%, var(--erp-gray-100) 75%);
    background-size: 200% 100%;
    animation: erp-shimmer 1.5s infinite;
    border-radius: 6px;
}

@keyframes erp-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Responsive ── */
@media (max-width: 1600px) {
    .erp-kpi-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1366px) {
    .erp-dashboard-row--charts,
    .erp-dashboard-row--tables {
        grid-template-columns: 1fr 1fr;
    }

    .erp-dashboard-row--charts > :first-child,
    .erp-dashboard-row--tables > :first-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1024px) {
    .erp-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .erp-dashboard-row--charts,
    .erp-dashboard-row--tables {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .erp-today-bar {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .erp-today-item:nth-child(3) {
        border-right: none;
    }

    .erp-today-item:nth-child(4),
    .erp-today-item:nth-child(5),
    .erp-today-item:nth-child(6) {
        border-top: 1px solid var(--erp-border);
        padding-top: var(--erp-space-3);
        margin-top: var(--erp-space-3);
    }

    body.erp-v2 .erp-search {
        max-width: 100%;
    }

    body.erp-v2 .erp-search-kbd {
        display: none;
    }
}

@media (min-width: 1024px) {
    body.erp-v2 .small-view-button {
        display: none !important;
    }
}

/* Mobile nav backdrop — lighter than legacy 80% black */
body.erp-v2 .overlay {
    background: rgba(15, 23, 42, 0.4);
    z-index: 35;
}

/* Bootstrap modals — backdrop on body, dialog must also be on body */
body.erp-v2 .modal-backdrop {
    z-index: 1040;
    opacity: 0.4;
    background-color: #0f172a;
}

body.erp-v2 .modal {
    z-index: 1050;
}

body.erp-v2 .modal.erp-modal-stacked {
    z-index: 1070 !important;
}

body.erp-v2 .modal-backdrop.erp-modal-backdrop-stacked {
    z-index: 1060 !important;
}

body.erp-v2 .modal .modal-content {
    border-radius: var(--erp-radius-modal, 12px);
    border: 1px solid var(--erp-border);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
}

body.erp-v2 .modal .modal-dialog {
    margin: 30px auto;
}

body.erp-v2 .small-view-side-active.erp-sidebar {
    z-index: 50;
}

@media (max-width: 1023px) {
    body.erp-v2 .erp-sidebar {
        display: none !important;
    }

    body.erp-v2 .erp-sidebar.small-view-side-active {
        display: flex !important;
    }
}

@media (max-width: 640px) {
    .erp-kpi-grid {
        grid-template-columns: 1fr;
    }

    .erp-today-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: var(--erp-space-3) 0;
    }

    .erp-today-item {
        border-right: none;
        border-bottom: 1px solid var(--erp-border);
        padding: var(--erp-space-2) var(--erp-space-3);
    }

    .erp-today-item:nth-child(odd) {
        border-right: 1px solid var(--erp-border);
    }

    .erp-today-item:nth-child(even) {
        border-right: none;
    }

    .erp-today-item:last-child,
    .erp-today-item:nth-last-child(2):nth-child(odd) {
        border-bottom: none;
    }

    .erp-dashboard-header {
        flex-direction: column;
    }

    body.erp-v2 .erp-profile-name,
    body.erp-v2 .erp-profile-role {
        display: none;
    }
}

/* ── RTL Support ── */
[dir="rtl"] body.erp-v2 .erp-search-input {
    padding: 0 44px 0 var(--erp-space-4);
}

[dir="rtl"] body.erp-v2 .erp-search-icon {
    left: auto;
    right: 14px;
}

[dir="rtl"] body.erp-v2 .erp-search-kbd {
    right: auto;
    left: 12px;
}

[dir="rtl"] body.erp-v2 .erp-nav-child {
    padding: 7px 12px;
}

[dir="rtl"] body.erp-v2 .erp-nav-children {
    padding: 4px 12px 4px 0;
    margin-left: 0;
    margin-right: 16px;
}

[dir="rtl"] body.erp-v2 .erp-nav-children::before {
    left: auto;
    right: 0;
}

/* ── Focus accessibility ── */
.erp-btn:focus-visible,
.erp-input:focus-visible,
.erp-nav-item:focus-visible,
.erp-quick-action:focus-visible {
    outline: 2px solid var(--erp-primary);
    outline-offset: 2px;
}

/* ══════════════════════════════════════════════════════════
   Business Settings — horizontal tabs, full-width forms
   ══════════════════════════════════════════════════════════ */
body.erp-v2 .erp-business-settings {
    max-width: 1400px;
}

body.erp-v2 .erp-business-settings .erp-settings-card {
    background: #fff;
    border: 1px solid var(--erp-border, #e2e8f0);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

/* Toolbar: search + save */
body.erp-v2 .erp-business-settings .erp-settings-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #fafbfc;
    flex-wrap: wrap;
}

body.erp-v2 .erp-business-settings .erp-settings-toolbar__search {
    flex: 1;
    min-width: 220px;
    max-width: 480px;
}

body.erp-v2 .erp-business-settings .erp-settings-toolbar__search .row {
    margin: 0;
}

body.erp-v2 .erp-business-settings .erp-settings-toolbar__search .col-md-8 {
    float: none;
    width: 100%;
    padding: 0;
    margin: 0;
}

body.erp-v2 .erp-business-settings .erp-settings-toolbar__search .input-group {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

body.erp-v2 .erp-business-settings .erp-settings-toolbar__search .input-group-addon {
    background: transparent;
    border: none;
    color: #94a3b8;
}

body.erp-v2 .erp-business-settings .erp-settings-toolbar__search .form-control {
    border: none;
    box-shadow: none;
    height: 40px;
}

body.erp-v2 .erp-business-settings .erp-settings-save-btn {
    white-space: nowrap;
    padding: 10px 22px;
    font-size: 14px;
}

/* Layout: tabs on top, content full width */
body.erp-v2 .erp-business-settings .erp-settings-layout {
    display: block;
    margin: 0;
    padding: 0;
}

body.erp-v2 .erp-business-settings .erp-settings-tabs-h {
    width: 100%;
    float: none;
    padding: 0;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    position: sticky;
    top: 56px;
    z-index: 20;
}

body.erp-v2 .erp-business-settings .erp-settings-nav-h {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 4px;
    margin: 0;
    padding: 12px 16px 14px;
    border: none;
    border-radius: 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    -webkit-overflow-scrolling: touch;
}

body.erp-v2 .erp-business-settings .erp-settings-nav-h::-webkit-scrollbar {
    height: 4px;
}

body.erp-v2 .erp-business-settings .erp-settings-nav-h::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

body.erp-v2 .erp-business-settings .erp-settings-nav-h .list-group-item {
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 8px 14px;
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    background: transparent;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

body.erp-v2 .erp-business-settings .erp-settings-nav-h .list-group-item i {
    font-size: 12px;
    opacity: 0.85;
}

body.erp-v2 .erp-business-settings .erp-settings-nav-h .list-group-item:hover {
    background: #f1f5f9;
    color: #334155;
}

body.erp-v2 .erp-business-settings .erp-settings-nav-h .list-group-item.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

body.erp-v2 .erp-business-settings .erp-settings-nav-h .list-group-item.active i {
    opacity: 1;
    color: #fff;
}

body.erp-v2 .erp-business-settings .erp-settings-panel {
    width: 100%;
    float: none;
    padding: 28px 32px 36px;
    min-height: 420px;
}

body.erp-v2 .erp-business-settings .pos-tab-content {
    animation: erpSettingsFadeIn 0.18s ease;
}

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

body.erp-v2 .erp-business-settings div.pos-tab div.pos-tab-content:not(.active) {
    display: none !important;
}

/* Tab page header */
body.erp-v2 .erp-business-settings .erp-settings-tab-head {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

body.erp-v2 .erp-business-settings .erp-settings-tab-head h2 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

body.erp-v2 .erp-business-settings .erp-settings-tab-head h2 i {
    color: #2563eb;
    font-size: 18px;
}

body.erp-v2 .erp-business-settings .erp-settings-tab-head p {
    margin: 0;
    font-size: 14px;
    color: #64748b;
}

/* Legacy tab headers — hide duplicate first-row titles */
body.erp-v2 .erp-business-settings .pos-tab-content > .row:first-child:has(h4) {
    display: none;
}

/* Display screen & carousel uploads */
body.erp-v2 .erp-settings-stack {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

body.erp-v2 .erp-settings-toggle-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px 18px;
}

body.erp-v2 .erp-settings-toggle-card__label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
    margin: 0;
    cursor: pointer;
}

body.erp-v2 .erp-settings-toggle-card__hint {
    margin: 10px 0 0 26px;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

body.erp-v2 .erp-settings-editor-wrap .tox-tinymce {
    border-radius: 10px !important;
    border-color: #cbd5e1 !important;
}

body.erp-v2 .erp-carousel-grid,
body.erp-v2 .erp-image-upload-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
}

body.erp-v2 .erp-image-upload-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.erp-v2 .erp-image-upload-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.erp-v2 .erp-carousel-card,
body.erp-v2 .erp-image-upload {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

body.erp-v2 .erp-carousel-card__head,
body.erp-v2 .erp-image-upload__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

body.erp-v2 .erp-carousel-card__num,
body.erp-v2 .erp-image-upload__badge {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: #2563eb;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

body.erp-v2 .erp-carousel-card__title,
body.erp-v2 .erp-image-upload__title {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    line-height: 1.3;
}

body.erp-v2 .erp-carousel-card__preview,
body.erp-v2 .erp-image-upload__preview {
    aspect-ratio: 16 / 10;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

body.erp-v2 .erp-carousel-card__preview img,
body.erp-v2 .erp-image-upload__preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

body.erp-v2 .erp-carousel-card__empty,
body.erp-v2 .erp-image-upload__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 12px;
}

body.erp-v2 .erp-carousel-card__empty i,
body.erp-v2 .erp-image-upload__empty i {
    font-size: 22px;
}

body.erp-v2 .erp-carousel-card__upload,
body.erp-v2 .erp-image-upload__actions {
    padding: 10px 12px;
    border-top: 1px solid #f1f5f9;
}

body.erp-v2 .erp-carousel-file-input,
body.erp-v2 .erp-image-upload__input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
}

body.erp-v2 .erp-carousel-file-btn,
body.erp-v2 .erp-image-upload__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 10px;
    margin: 0;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.erp-v2 .erp-carousel-file-btn:hover,
body.erp-v2 .erp-image-upload__btn:hover {
    border-color: #2563eb;
    background: #eff6ff;
    color: #2563eb;
}

body.erp-v2 .erp-image-upload__hint {
    margin: 0;
    padding: 0 12px 10px;
    font-size: 11px;
    line-height: 1.45;
    color: #64748b;
}

body.erp-v2 .erp-image-upload--compact .erp-image-upload__head {
    padding: 8px 10px;
}

body.erp-v2 .erp-image-upload--compact .erp-image-upload__preview {
    aspect-ratio: 1 / 1;
    max-height: 96px;
}

body.erp-v2 .erp-image-upload--compact .erp-image-upload__actions {
    padding: 8px 10px;
}

body.erp-v2 .erp-image-upload--compact .erp-image-upload__btn {
    padding: 6px 8px;
    font-size: 11px;
}

@media (max-width: 1400px) {
    body.erp-v2 .erp-carousel-grid,
    body.erp-v2 .erp-image-upload-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    body.erp-v2 .erp-carousel-grid,
    body.erp-v2 .erp-image-upload-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    body.erp-v2 .erp-carousel-grid,
    body.erp-v2 .erp-image-upload-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Form grid — replaces cramped col-sm-4 rows inside sections */
body.erp-v2 .erp-business-settings .erp-settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 24px;
}

body.erp-v2 .erp-business-settings .erp-settings-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.erp-v2 .erp-business-settings .erp-settings-grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

body.erp-v2 .erp-business-settings .erp-settings-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.erp-v2 .erp-business-settings .erp-settings-grid .form-group {
    margin-bottom: 0;
}

body.erp-v2 .erp-business-settings .erp-settings-grid .col-sm-4,
body.erp-v2 .erp-business-settings .erp-settings-grid .col-md-4,
body.erp-v2 .erp-business-settings .erp-settings-grid .col-sm-3,
body.erp-v2 .erp-business-settings .erp-settings-grid .col-md-3,
body.erp-v2 .erp-business-settings .erp-settings-grid .col-sm-6,
body.erp-v2 .erp-business-settings .erp-settings-grid .col-md-6 {
    width: 100%;
    float: none;
    padding: 0;
    max-width: none;
}

body.erp-v2 .erp-business-settings .erp-settings-grid .clearfix {
    display: none;
}

/* Section cards */
body.erp-v2 .erp-settings-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 22px 24px;
    margin-bottom: 20px;
}

body.erp-v2 .erp-settings-section--info {
    background: #f8fbff;
    border-color: #bfdbfe;
}

body.erp-v2 .erp-settings-section--warning {
    background: #fffbeb;
    border-color: #fde68a;
}

body.erp-v2 .erp-settings-section__title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

body.erp-v2 .erp-settings-section__title i {
    color: #2563eb;
    font-size: 14px;
    text-transform: none;
}

body.erp-v2 .erp-settings-section--info .erp-settings-section__title {
    color: #1e40af;
    border-bottom-color: #dbeafe;
}

body.erp-v2 .erp-settings-section__desc {
    font-size: 13px;
    color: #64748b;
    margin: -10px 0 18px;
    line-height: 1.5;
}

/* Form controls */
body.erp-v2 .erp-business-settings .pos-tab-content .form-group {
    margin-bottom: 18px;
}

body.erp-v2 .erp-business-settings .pos-tab-content .erp-settings-section .form-group > label,
body.erp-v2 .erp-business-settings .pos-tab-content .erp-settings-grid .form-group > label {
    font-weight: 600;
    font-size: 12px;
    color: #475569;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

body.erp-v2 .erp-business-settings .pos-tab-content .form-group > label,
body.erp-v2 .erp-business-settings .pos-tab-content label.control-label {
    font-weight: 600;
    font-size: 13px;
    color: #475569;
    margin-bottom: 6px;
}

body.erp-v2 .erp-business-settings .pos-tab-content .help-block,
body.erp-v2 .erp-business-settings .pos-tab-content small.text-muted {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 5px;
    line-height: 1.4;
}

body.erp-v2 .erp-business-settings .pos-tab-content .form-control {
    border-radius: 8px;
    border-color: #cbd5e1;
    min-height: 40px;
    box-shadow: none;
    font-size: 14px;
}

body.erp-v2 .erp-business-settings .pos-tab-content .form-control:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

body.erp-v2 .erp-business-settings .pos-tab-content .input-group-addon {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #64748b;
}

body.erp-v2 .erp-business-settings .pos-tab-content input[type="color"] {
    width: 44px;
    min-width: 44px;
    height: 40px;
    padding: 3px;
    border: 1px solid #cbd5e1;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
}

body.erp-v2 .erp-business-settings .pos-tab-content .input-group input[type="color"] + .form-control {
    border-left: 0;
    border-radius: 0 8px 8px 0;
}

body.erp-v2 .erp-business-settings .pos-tab-content table.table thead th {
    background: #f8fafc;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
}

body.erp-v2 .erp-business-settings .pos-tab-content [class*="tw-border-blue"] {
    border-radius: 12px !important;
    margin-bottom: 20px !important;
}

body.erp-v2 .erp-business-settings .pos-tab-content .row.well {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: none;
}

@media (max-width: 1200px) {
    body.erp-v2 .erp-business-settings .erp-settings-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    body.erp-v2 .erp-business-settings .erp-settings-grid--4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    body.erp-v2 .erp-business-settings .erp-settings-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    body.erp-v2 .erp-business-settings .erp-settings-toolbar__search {
        max-width: none;
    }
    body.erp-v2 .erp-business-settings .erp-settings-panel {
        padding: 16px;
    }
    body.erp-v2 .erp-business-settings .erp-settings-grid,
    body.erp-v2 .erp-business-settings .erp-settings-grid--2,
    body.erp-v2 .erp-business-settings .erp-settings-grid--3,
    body.erp-v2 .erp-business-settings .erp-settings-grid--4 {
        grid-template-columns: 1fr;
    }
    body.erp-v2 .erp-business-settings .erp-settings-nav-h .list-group-item span {
        display: none;
    }
    body.erp-v2 .erp-business-settings .erp-settings-nav-h .list-group-item {
        padding: 10px 12px;
    }
}

/* ── Food App settings tab ───────────────────────────────────── */
body.erp-v2 .erp-food-app-settings {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

body.erp-v2 .erp-food-app-settings .erp-settings-section {
    scroll-margin-top: 88px;
}

body.erp-v2 .erp-fa-section-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 4px;
}

body.erp-v2 .erp-fa-section-nav a {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    background: #fff;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

body.erp-v2 .erp-fa-section-nav a:hover {
    color: #2563eb;
    border-color: #93c5fd;
    background: #eff6ff;
}

body.erp-v2 .erp-fa-brand-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: start;
}

body.erp-v2 .erp-fa-brand-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

body.erp-v2 .erp-fa-brand-preview {
    position: sticky;
    top: 16px;
}

body.erp-v2 .erp-fa-preview-label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
}

body.erp-v2 .erp-fa-preview-phone {
    border-radius: 12px;
    overflow: hidden;
    width: 100%;
    max-width: 300px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    position: relative;
}

body.erp-v2 .erp-fa-color-input {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

body.erp-v2 .erp-fa-color-input input[type="color"] {
    width: 44px;
    height: 38px;
    border: none;
    padding: 2px;
    cursor: pointer;
    flex-shrink: 0;
    background: transparent;
}

body.erp-v2 .erp-fa-color-input .form-control {
    border: none;
    box-shadow: none;
    height: 38px;
    font-size: 13px;
}

body.erp-v2 .erp-fa-dark-mode-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100%;
}

body.erp-v2 .erp-fa-advanced-panel {
    margin-top: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

body.erp-v2 .erp-fa-advanced-panel summary {
    cursor: pointer;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    list-style: none;
}

body.erp-v2 .erp-fa-advanced-panel summary::-webkit-details-marker {
    display: none;
}

body.erp-v2 .erp-fa-advanced-panel__body {
    padding: 0 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

body.erp-v2 .erp-fa-orders-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 220px;
    gap: 20px;
    align-items: start;
}

body.erp-v2 .erp-fa-orders-types .checkbox {
    margin-top: 0;
    margin-bottom: 8px;
}

body.erp-v2 .erp-fa-content-grid {
    align-items: stretch;
}

body.erp-v2 .erp-fa-content-field {
    display: flex;
    flex-direction: column;
    height: 100%;
}

body.erp-v2 .erp-fa-content-textarea {
    flex: 1;
    min-height: 200px;
    resize: vertical;
}

body.erp-v2 .erp-fa-radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

body.erp-v2 .erp-fa-radio-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    margin: 0;
}

body.erp-v2 .erp-fa-radio-option input {
    margin: 0;
}

@media (max-width: 1200px) {
    body.erp-v2 .erp-fa-brand-layout,
    body.erp-v2 .erp-fa-orders-layout {
        grid-template-columns: 1fr;
    }

    body.erp-v2 .erp-fa-brand-preview {
        position: static;
    }
}

/* ── Checkboxes & radios (native, replaces broken iCheck sprites) ── */
body.erp-v2 input[type="checkbox"],
body.erp-v2 input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    flex: 0 0 18px;
    margin: 0;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    vertical-align: middle;
    position: relative;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

body.erp-v2 input[type="radio"] {
    border-radius: 50%;
}

body.erp-v2 input[type="checkbox"]:hover:not(:disabled),
body.erp-v2 input[type="radio"]:hover:not(:disabled) {
    border-color: #94a3b8;
}

body.erp-v2 input[type="checkbox"]:focus-visible,
body.erp-v2 input[type="radio"]:focus-visible {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

body.erp-v2 input[type="checkbox"]:checked {
    background: #3b82f6;
    border-color: #3b82f6;
}

body.erp-v2 input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

body.erp-v2 input[type="radio"]:checked {
    border-color: #3b82f6;
}

body.erp-v2 input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    transform: translate(-50%, -50%);
}

body.erp-v2 input[type="checkbox"]:disabled,
body.erp-v2 input[type="radio"]:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

body.erp-v2 .icheckbox_square-blue,
body.erp-v2 .iradio_square-blue {
    display: none !important;
}

body.erp-v2 label:has(> input[type="checkbox"]),
body.erp-v2 label:has(> input[type="radio"]),
body.erp-v2 .checkbox label,
body.erp-v2 .radio label,
body.erp-v2 .erp-settings-toggle-card__label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    margin-bottom: 0 !important;
    line-height: 1.45;
    cursor: pointer;
}

body.erp-v2 label:has(> input[type="checkbox"]) > input[type="checkbox"],
body.erp-v2 label:has(> input[type="radio"]) > input[type="radio"],
body.erp-v2 .checkbox label > input[type="checkbox"],
body.erp-v2 .radio label > input[type="radio"] {
    align-self: flex-start;
    margin-top: 2px;
}

body.erp-v2 .erp-settings-toggle-card__label {
    align-items: center;
}

body.erp-v2 .erp-settings-toggle-card__label > input[type="checkbox"],
body.erp-v2 .erp-settings-toggle-card__label > input[type="radio"] {
    align-self: center;
    margin-top: 0;
}

body.erp-v2 .erp-business-settings .pos-tab-content .form-group > label:has(input[type="checkbox"]),
body.erp-v2 .erp-business-settings .pos-tab-content .form-group > label:has(input[type="radio"]) {
    text-transform: none;
    font-size: 14px;
    letter-spacing: normal;
    color: #0f172a;
    margin-bottom: 0;
}

body.erp-v2 .checkbox,
body.erp-v2 .radio {
    margin-top: 0;
    margin-bottom: 8px;
}

body.erp-v2 .check_group .checkbox,
body.erp-v2 .check_group .radio {
    margin-bottom: 6px;
}

body.erp-v2 label.tw-flex:has(> input[type="checkbox"]),
body.erp-v2 label.tw-flex:has(> input[type="radio"]) {
    align-items: flex-start !important;
}
