/* SupplyOne - Apple Premium Design */
/* Developed by William for WLMZZ */
/* Ultra-clean Apple-inspired UX */

:root {
    /* Apple Premium Color Palette */
    --primary-color: #1d1d1f;
    --secondary-color: #0071e3;
    --accent-color: #ff375f;
    --success-color: #30d158;
    --warning-color: #ff9f0a;
    --danger-color: #ff453a;

    /* Premium Light Theme */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-tertiary: #fafafa;
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.72);
    --bg-glass-dark: rgba(255, 255, 255, 0.92);

    /* Text Colors */
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --text-tertiary: #a1a1a6;

    /* Borders */
    --border-color: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.04);
    --divider-color: rgba(0, 0, 0, 0.06);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 56px;

    /* Premium Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16), 0 8px 16px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 0 4px rgba(0, 113, 227, 0.15);
    --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.06);

    /* Border Radius */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-fast: 0.15s var(--ease-out-expo);
    --transition-normal: 0.3s var(--ease-out-expo);
    --transition-slow: 0.5s var(--ease-out-expo);
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;
    background: linear-gradient(180deg, #f5f5f7 0%, #ffffff 50%, #f5f5f7 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
    min-height: 100vh;
}

::selection {
    background: rgba(0, 113, 227, 0.2);
    color: var(--text-primary);
}

.hidden {
    display: none !important;
}

/* ==================== LOGIN SCREEN ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0052D4 0%, #4364F7 50%, #6FB1FC 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.login-box {
    background: var(--bg-glass-dark);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    padding: 48px 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: loginAppear 0.8s var(--ease-out-expo);
    position: relative;
    z-index: 1;
}

@keyframes loginAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 52px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #5856d6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
    display: inline-block;
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.login-logo {
    width: 240px;
    height: 240px;
    object-fit: contain;
    border-radius: var(--radius-lg);
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
}

.login-footer {
    text-align: center;
    margin-top: 28px;
    color: var(--text-tertiary);
    font-size: 12px;
}

.login-footer strong {
    color: var(--text-secondary);
}

.login-hint {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.login-hint a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-fast);
}

.login-hint a:hover {
    color: #0077ed;
}

/* ==================== FORM STYLES ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.form-group label i {
    margin-right: 8px;
    color: var(--text-tertiary);
    font-size: 12px;
}

/* Checkbox alignment */
.form-group label input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-inset);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-tertiary);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: rgba(0, 0, 0, 0.15);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-glow), var(--shadow-inset);
}

.form-group input.error,
.form-group select.error,
.form-group textarea.error {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 4px rgba(255, 59, 48, 0.1);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

/* Search Select Component */
.search-select-wrapper {
    position: relative;
}

.search-select-input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-inset);
    cursor: pointer;
}

.search-select-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-glow), var(--shadow-inset);
}

.search-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
}

.search-select-wrapper.open .search-select-dropdown {
    display: block;
}

.search-select-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
    background: var(--bg-card);
}

.search-select-option:hover {
    background: var(--bg-secondary);
}

.search-select-option.selected {
    background: var(--secondary-color);
    color: white;
}

.search-select-option.hidden {
    display: none;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    background: linear-gradient(180deg, #0077ed 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.35), 0 1px 2px rgba(0, 113, 227, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 113, 227, 0.4), 0 2px 4px rgba(0, 113, 227, 0.25);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-success {
    background: linear-gradient(180deg, #34d058 0%, var(--success-color) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(48, 209, 88, 0.35);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(48, 209, 88, 0.4);
}

.btn-danger {
    background: linear-gradient(180deg, #ff5a52 0%, var(--danger-color) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 69, 58, 0.35);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 69, 58, 0.4);
}

.btn-warning {
    background: linear-gradient(180deg, #ffb340 0%, var(--warning-color) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 159, 10, 0.35);
}

.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 159, 10, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: rgba(0, 0, 0, 0.12);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-secondary);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 18px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    color: var(--secondary-color);
    transform: scale(1.05);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

/* ==================== MAIN LAYOUT ==================== */
#app {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-glass-dark);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-header i {
    font-size: 22px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #5856d6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-logo {
    width: 100%;
    height: auto;
    max-height: 100px;
    padding: 5px 5px;
    object-fit: contain;
}

.sidebar-favicon {
    display: none;
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-divider {
    height: 1px;
    background: var(--divider-color);
    margin: 16px 20px;
}

.nav-section {
    padding: 20px 24px 10px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-tertiary);
    letter-spacing: 0.08em;
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 20px;
    margin: 2px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--secondary-color);
    border-radius: 0 3px 3px 0;
    transition: height var(--transition-fast);
}

.nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(0, 113, 227, 0.08);
    color: var(--secondary-color);
    font-weight: 600;
}

.nav-item.active::before {
    height: 24px;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    opacity: 0.85;
}

.nav-item.active i {
    opacity: 1;
}

/* Nav Dropdown */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    justify-content: flex-start;
}

.nav-dropdown-toggle .dropdown-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform var(--transition-fast);
}

.nav-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-sm);
    margin: 0 12px;
}

.nav-dropdown.open .nav-dropdown-menu {
    max-height: 400px;
}

.nav-dropdown-menu .nav-item {
    padding-left: 44px;
    margin: 0;
    border-radius: 0;
}

.nav-dropdown-menu .nav-item:first-child {
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.nav-dropdown-menu .nav-item:last-child {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* Nested sub-dropdown */
.nav-sub-dropdown {
    position: relative;
}

.nav-sub-dropdown-toggle {
    display: flex;
    align-items: center;
    padding-left: 44px !important;
    cursor: pointer;
}

.nav-sub-dropdown-toggle .sub-dropdown-arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform var(--transition-fast);
}

.nav-sub-dropdown.open .sub-dropdown-arrow {
    transform: rotate(90deg);
}

.nav-sub-dropdown-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.03);
}

.nav-sub-dropdown.open .nav-sub-dropdown-menu {
    max-height: 200px;
}

.nav-sub-dropdown-menu .nav-item {
    padding-left: 60px !important;
    font-size: 13px;
}

.sidebar-footer {
    padding: 16px 0;
    border-top: 1px solid var(--border-light);
}

.powered-by-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
    transition: all var(--transition-fast);
    margin-bottom: 4px;
}

.powered-by-link:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.powered-by-link i {
    font-size: 16px;
}

.logout-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 24px;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 11px;
    transition: all var(--transition-fast);
}

.logout-link:hover {
    color: var(--danger);
}

.logout-link i {
    font-size: 12px;
}

.powered-by-text {
    display: block;
    text-align: center;
    padding: 6px 24px;
    color: var(--text-tertiary);
    font-size: 11px;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-header {
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

#sidebar-toggle {
    display: flex;
}

/* Collapsed Sidebar State */
.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .sidebar-logo {
    display: none;
}

.sidebar.collapsed .sidebar-favicon {
    display: block;
}

.sidebar.collapsed .sidebar-nav .nav-item span,
.sidebar.collapsed .sidebar-nav .dropdown-arrow,
.sidebar.collapsed .logout-link span,
.sidebar.collapsed .powered-by-text,
.sidebar.collapsed .nav-dropdown-menu {
    display: none;
}

.sidebar.collapsed .sidebar-nav .nav-item {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .sidebar-nav .nav-item i {
    margin: 0;
    font-size: 18px;
}

.sidebar.collapsed .sidebar-footer .logout-link {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .nav-dropdown-toggle {
    pointer-events: auto;
}

/* Collapsed: adjust main content */
.app-collapsed .main-content {
    margin-left: 60px;
}

/* Collapsed: tooltip on hover for nav items */
.sidebar.collapsed .nav-item {
    position: relative;
}

.sidebar.collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-glass-dark);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    margin-left: 10px;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.sidebar.collapsed .nav-item:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Help tooltip for question mark icons */
.help-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    margin-left: 4px;
}

.help-tooltip .help-tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 1100;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-glass-dark, #333);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    white-space: normal;
    width: max-content;
    max-width: 250px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
}

.help-tooltip .help-tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: var(--bg-glass-dark, #333) transparent transparent transparent;
}

.help-tooltip:hover .help-tooltip-text,
.help-tooltip:focus .help-tooltip-text,
.help-tooltip.active .help-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Fix tooltip visibility inside modals with overflow - position below instead of above */
#modal-body .help-tooltip .help-tooltip-text {
    bottom: auto;
    top: 100%;
    margin-top: 8px;
    background: #333;
    color: #fff;
}

#modal-body .help-tooltip .help-tooltip-text::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent #333 transparent;
}

/* Ensure form-group doesn't clip tooltips */
#modal-body .form-group {
    overflow: visible;
}

#modal-body .form-row {
    overflow: visible;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-alerts {
    position: relative;
}

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(255, 59, 48, 0.4);
}

/* Status badges (inline) */
.badge.badge-secondary,
.badge.badge-info,
.badge.badge-primary,
.badge.badge-warning,
.badge.badge-success,
.badge.badge-danger {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 12px;
    box-shadow: none;
    white-space: nowrap;
}

.badge-secondary {
    background: #6c757d;
    color: white;
}

.badge-info {
    background: #17a2b8;
    color: white;
}

.badge-primary {
    background: var(--primary-color);
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #212529;
}

.badge-success {
    background: var(--success-color);
    color: white;
}

.badge-danger {
    background: var(--danger-color);
    color: white;
}

.badge-teal {
    background: #0097a7;
    color: white;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
    cursor: pointer;
}

.user-info:hover {
    background: var(--bg-secondary);
}

.user-info i {
    font-size: 24px;
    color: var(--text-tertiary);
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-info {
    border: none;
    background: transparent;
}

.user-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    max-width: 28px;
    max-height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

/* Header avatar image specific */
.user-info img.user-avatar,
#user-avatar {
    width: 28px !important;
    height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    display: inline-block;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 180px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s ease;
}

.user-dropdown-menu .dropdown-item:first-child {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.user-dropdown-menu .dropdown-item:last-child {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.user-dropdown-menu .dropdown-item:hover {
    background: var(--bg-secondary);
}

.user-dropdown-menu .dropdown-item.text-danger {
    color: var(--danger-color);
}

.user-dropdown-menu .dropdown-item i {
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.user-dropdown-menu .dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

.content-area {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
    animation: contentFadeIn 0.4s var(--ease-out-expo);
}

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

/* ==================== CARDS ==================== */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: all var(--transition-normal);
}

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

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-tertiary);
}

.card-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.01em;
}

.card-header h3 i {
    color: var(--secondary-color);
    font-size: 14px;
}

.card-body {
    padding: 24px;
}

/* ==================== STATS CARDS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--secondary-color);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.15) 0%, rgba(0, 113, 227, 0.08) 100%);
    color: var(--secondary-color);
}
.stat-icon.green {
    background: linear-gradient(135deg, rgba(48, 209, 88, 0.15) 0%, rgba(48, 209, 88, 0.08) 100%);
    color: var(--success-color);
}
.stat-icon.orange {
    background: linear-gradient(135deg, rgba(255, 159, 10, 0.15) 0%, rgba(255, 159, 10, 0.08) 100%);
    color: var(--warning-color);
}
.stat-icon.red {
    background: linear-gradient(135deg, rgba(255, 69, 58, 0.15) 0%, rgba(255, 69, 58, 0.08) 100%);
    color: var(--danger-color);
}
.stat-icon.teal {
    background: linear-gradient(135deg, rgba(0, 151, 167, 0.15) 0%, rgba(0, 151, 167, 0.08) 100%);
    color: #0097a7;
}

.stat-info h4 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

/* ==================== TABLES ==================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 16px 18px;
    text-align: left;
}

th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

td {
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 400;
}

tr:last-child td {
    border-bottom: none;
}

tr {
    transition: background var(--transition-fast);
}

tr:hover td {
    background: rgba(0, 113, 227, 0.02);
}

.table-actions {
    display: flex;
    gap: 6px;
}

.table-actions .btn-icon {
    padding: 8px;
    font-size: 14px;
}

/* ==================== TOOLBAR ==================== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 12px 18px 12px 46px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-full);
    width: 320px;
    font-size: 14px;
    background: var(--bg-primary);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-xs);
}

.search-box input:focus {
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-glow);
    outline: none;
}

.search-box i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 14px;
}

/* ==================== FILTER PILLS ==================== */
.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-primary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230071e3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    min-width: 140px;
}

.filter-pill:hover {
    border-color: var(--secondary-color);
    color: var(--text-primary);
    background-color: rgba(0, 113, 227, 0.04);
}

.filter-pill:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-glow);
}

/* When filter is active (has selection) */
.filter-pill.active,
.filter-pill:not([data-value=""]):not(:placeholder-shown) {
    background-color: rgba(0, 113, 227, 0.08);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

/* Filter pill with icon */
.filter-pill-wrapper {
    position: relative;
    display: inline-flex;
}

.filter-pill-wrapper > i:first-child {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--secondary-color);
    pointer-events: none;
    z-index: 1;
}

.filter-pill-wrapper .filter-pill {
    padding-left: 38px;
}

.filter-pill-wrapper:hover > i:first-child {
    color: var(--secondary-color);
}

/* Date input filter pill */
input[type="date"].filter-pill {
    background-image: none;
    padding-right: 16px;
    cursor: pointer;
}

input[type="date"].filter-pill::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

input[type="date"].filter-pill:hover::-webkit-calendar-picker-indicator {
    opacity: 1;
}

/* Button styled as filter pill */
button.filter-pill {
    background-image: none;
    padding-right: 16px;
}

/* ==================== MULTI-SELECT DROPDOWN ==================== */
.multi-select-dropdown {
    position: relative;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* Team filters specific styling */
.team-filters .filter-group {
    position: relative;
}

.team-filters .filter-option:hover {
    background: #f1f5f9;
}

.multi-select-dropdown .multiselect-option {
    transition: background-color var(--transition-fast);
}

.multi-select-dropdown .multiselect-option:hover {
    background-color: var(--bg-secondary);
}

/* Custom checkbox styling for dropdowns */
.multi-select-dropdown input[type="checkbox"],
.multi-select-dropdown label input[type="checkbox"],
.multiselect-option input[type="checkbox"] {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 4px !important;
    background: var(--bg-primary) !important;
    cursor: pointer !important;
    position: relative !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    margin-right: 10px !important;
    padding: 0 !important;
}

.multi-select-dropdown input[type="checkbox"]:checked,
.multi-select-dropdown label input[type="checkbox"]:checked,
.multiselect-option input[type="checkbox"]:checked {
    background-color: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
}

.multi-select-dropdown input[type="checkbox"]:checked::after,
.multi-select-dropdown label input[type="checkbox"]:checked::after,
.multiselect-option input[type="checkbox"]:checked::after {
    content: '' !important;
    position: absolute !important;
    left: 5px !important;
    top: 2px !important;
    width: 5px !important;
    height: 9px !important;
    border: solid white !important;
    border-width: 0 2px 2px 0 !important;
    transform: rotate(45deg) !important;
}

.multi-select-dropdown input[type="checkbox"]:focus,
.multi-select-dropdown label input[type="checkbox"]:focus,
.multiselect-option input[type="checkbox"]:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.2) !important;
}

/* Multi-select dropdown labels */
.multi-select-dropdown label {
    background: var(--bg-card);
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin: 2px 0;
    transition: background-color var(--transition-fast);
}

.multi-select-dropdown label:hover {
    background-color: var(--bg-secondary);
}

/* ==================== SEARCHABLE DROPDOWN ==================== */
.searchable-select {
    position: relative;
}

.searchable-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99999;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

/* Ensure searchable dropdown is visible inside modals */
.modal-body .searchable-select {
    position: relative;
    z-index: 1;
}

.modal-body .searchable-dropdown.show {
    display: block;
}

.searchable-dropdown.show {
    display: block;
}

/* Fixed position dropdown to escape overflow:hidden containers */
.searchable-dropdown[style*="position: fixed"] {
    position: fixed !important;
    z-index: 100000 !important;
}

.searchable-input {
    width: 100%;
}

.searchable-input.has-value {
    background-color: #f0fff0;
    border-color: #28a745;
}

.searchable-option {
    padding: 10px 12px;
    cursor: pointer;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-fast);
}

.searchable-option:hover,
.searchable-option.highlighted {
    background-color: var(--bg-secondary);
}

.searchable-option:last-child {
    border-bottom: none;
}

.searchable-option.selected {
    background-color: var(--secondary-color);
    color: white;
}

/* Search dropdown options (supplier search, etc.) */
.search-option {
    padding: 10px 12px;
    cursor: pointer;
    background: white;
    border-bottom: 1px solid #eee;
    transition: background-color 0.15s ease;
}

.search-option:hover {
    background-color: #e3f2fd;
}

.search-option:last-child {
    border-bottom: none;
}

/* ==================== MODAL ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 580px;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: visible;
    box-shadow: var(--shadow-xl);
    animation: modalAppear 0.35s var(--ease-out-expo);
    border: 1px solid var(--border-light);
}

.modal-content.modal-large {
    max-width: 800px;
}

.modal-content.modal-xlarge {
    max-width: 1100px;
    max-height: 90vh;
}

.modal-content.modal-fullscreen {
    max-width: 95vw;
    max-height: 95vh;
    width: 95vw;
}

.modal-content.modal-small {
    max-width: 400px;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-tertiary);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.modal-close {
    color: var(--text-tertiary);
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 28px;
}

.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--bg-tertiary);
}

/* ==================== TOAST NOTIFICATIONS ==================== */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-primary);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 14px;
    animation: toastSlide 0.4s var(--ease-out-expo);
    min-width: 340px;
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast.success::before { background: var(--success-color); }
.toast.error::before { background: var(--danger-color); }
.toast.warning::before { background: var(--warning-color); }
.toast.info::before { background: var(--secondary-color); }

.toast i {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.success i { color: var(--success-color); }
.toast.error i { color: var(--danger-color); }
.toast.warning i { color: var(--warning-color); }
.toast.info i { color: var(--secondary-color); }

.toast span {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

@keyframes toastSlide {
    from {
        transform: translateX(100%) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0) translateY(0);
        opacity: 1;
    }
}

/* ==================== ALERTS ==================== */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(255, 159, 10, 0.08) 0%, rgba(255, 159, 10, 0.04) 100%);
    color: #b36b00;
    border-color: rgba(255, 159, 10, 0.2);
}

.alert-danger {
    background: linear-gradient(135deg, rgba(255, 69, 58, 0.08) 0%, rgba(255, 69, 58, 0.04) 100%);
    color: #c5221f;
    border-color: rgba(255, 69, 58, 0.2);
}

.alert-success {
    background: linear-gradient(135deg, rgba(48, 209, 88, 0.08) 0%, rgba(48, 209, 88, 0.04) 100%);
    color: #1e7e34;
    border-color: rgba(48, 209, 88, 0.2);
}

.alert-info {
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.08) 0%, rgba(0, 113, 227, 0.04) 100%);
    color: #0056b3;
    border-color: rgba(0, 113, 227, 0.2);
}

/* ==================== PAGINATION ==================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 28px;
}

.pagination button {
    padding: 10px 16px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    font-family: inherit;
}

.pagination button:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.pagination button.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3);
}

.pagination button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ==================== TAGS/BADGES ==================== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.tag-success {
    background: linear-gradient(135deg, rgba(48, 209, 88, 0.15) 0%, rgba(48, 209, 88, 0.08) 100%);
    color: #1e7e34;
}
.tag-warning {
    background: linear-gradient(135deg, rgba(255, 159, 10, 0.15) 0%, rgba(255, 159, 10, 0.08) 100%);
    color: #b36b00;
}
.tag-danger {
    background: linear-gradient(135deg, rgba(255, 69, 58, 0.15) 0%, rgba(255, 69, 58, 0.08) 100%);
    color: #c5221f;
}
.tag-info {
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.15) 0%, rgba(0, 113, 227, 0.08) 100%);
    color: #0056b3;
}
.tag-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* ==================== LOADING ==================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-secondary);
}

.empty-state > i {
    font-size: 56px;
    margin-bottom: 20px;
    color: var(--text-tertiary);
    opacity: 0.5;
    display: block;
}

.empty-state .btn i {
    font-size: inherit;
    margin-bottom: 0;
    opacity: 1;
}

.empty-state h4 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.empty-state p {
    font-size: 14px;
    max-width: 320px;
    margin: 0 auto;
}

/* ==================== GRID LAYOUTS ==================== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ==================== TABS ==================== */
.tabs {
    display: inline-flex;
    gap: 6px;
    background: var(--bg-secondary);
    padding: 6px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    border: 1px solid var(--border-light);
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Tab Buttons (DDT and similar pages) */
.tabs .tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    white-space: nowrap;
}

.tabs .tab-btn i {
    font-size: 15px;
    opacity: 0.75;
    transition: all var(--transition-fast);
}

.tabs .tab-btn:hover {
    background: rgba(0, 113, 227, 0.06);
    color: var(--text-primary);
}

.tabs .tab-btn:hover i {
    opacity: 1;
    color: var(--secondary-color);
}

.tabs .tab-btn.active {
    background: var(--bg-primary);
    color: var(--secondary-color);
    box-shadow: var(--shadow-sm);
}

.tabs .tab-btn.active i {
    opacity: 1;
    color: var(--secondary-color);
}

/* Badge inside tabs */
.tabs .tab-btn .badge {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--radius-full);
    margin-left: 2px;
}

.tabs .tab-btn .badge.badge-danger {
    background: linear-gradient(135deg, #ff5a52 0%, var(--danger-color) 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(255, 69, 58, 0.35);
}

.tabs .tab-btn .badge.badge-success {
    background: linear-gradient(135deg, #34d058 0%, var(--success-color) 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(48, 209, 88, 0.35);
}

.tabs .tab-btn .badge.badge-warning {
    background: linear-gradient(135deg, #ffb340 0%, var(--warning-color) 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(255, 159, 10, 0.35);
}

.tabs .tab-btn .badge.badge-info {
    background: linear-gradient(135deg, #0077ed 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(0, 113, 227, 0.35);
}

/* Responsive tabs */
@media (max-width: 768px) {
    .tabs {
        flex-wrap: wrap;
        width: 100%;
    }

    .tabs .tab-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 14px;
        font-size: 13px;
    }

    .tabs .tab-btn i {
        font-size: 14px;
    }
}

/* ==================== PROGRESS BAR ==================== */
.progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color) 0%, #5856d6 100%);
    border-radius: var(--radius-full);
    transition: width 0.5s var(--ease-out-expo);
}

.progress-bar-fill.success {
    background: linear-gradient(90deg, var(--success-color) 0%, #28cd41 100%);
}
.progress-bar-fill.warning {
    background: linear-gradient(90deg, var(--warning-color) 0%, #ffb340 100%);
}
.progress-bar-fill.danger {
    background: linear-gradient(90deg, var(--danger-color) 0%, #ff6961 100%);
}

/* ==================== DETAIL VIEW ==================== */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.detail-item {
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.detail-item:hover {
    background: rgba(0, 113, 227, 0.04);
}

.detail-item label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    font-weight: 600;
}

.detail-item span {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==================== COMPANY SELECTOR ==================== */
.company-selector-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 50%, #5eead4 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.company-selector-box {
    background: var(--bg-glass-dark);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    padding: 44px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 440px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: loginAppear 0.8s var(--ease-out-expo);
}

.selector-header {
    text-align: center;
    margin-bottom: 32px;
}

.selector-header i {
    font-size: 48px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #5856d6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
    display: inline-block;
}

.selector-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.selector-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.company-list {
    margin-bottom: 24px;
}

.company-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-primary);
}

.company-option:hover {
    border-color: var(--secondary-color);
    background: rgba(0, 113, 227, 0.04);
    transform: translateX(4px);
}

.company-option-info strong {
    display: block;
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 15px;
}

.company-option-info .company-code {
    font-size: 12px;
    color: var(--text-tertiary);
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.company-option i {
    color: var(--text-tertiary);
    font-size: 14px;
    transition: all var(--transition-fast);
}

.company-option:hover i {
    color: var(--secondary-color);
    transform: translateX(4px);
}

.selector-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* ==================== TOGGLE SWITCH ==================== */
.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 32px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: var(--transition-fast);
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-fast);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: var(--success-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 32px;
}

.slider.round:before {
    border-radius: 50%;
}

/* ==================== CURRENT COMPANY BADGE ==================== */
#current-company {
    display: none;
    font-size: 12px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.1) 0%, rgba(0, 113, 227, 0.05) 100%);
    border-radius: var(--radius-full);
    color: var(--secondary-color);
    margin-left: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition-fast);
    border: 1px solid rgba(0, 113, 227, 0.2);
}

#current-company:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

/* ==================== TEXT UTILITIES ==================== */
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-muted { color: var(--text-secondary) !important; }
.text-center { text-align: center !important; }

/* ==================== INGREDIENT LIST ==================== */
.ingredient-list {
    list-style: none;
}

.ingredient-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: all var(--transition-fast);
}

.ingredient-list li:hover {
    background: rgba(0, 113, 227, 0.04);
    transform: translateX(4px);
}

.ingredient-list li:last-child {
    margin-bottom: 0;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    /* On mobile, collapsed state is hidden instead */
    .sidebar.collapsed {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.collapsed.open {
        transform: translateX(0);
    }

    .main-content,
    .app-collapsed .main-content {
        margin-left: 0;
    }

    #sidebar-toggle {
        display: flex;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .search-box input {
        width: 100%;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left {
        flex-direction: column;
        width: 100%;
    }

    .modal-content {
        margin: 16px;
        max-height: calc(100vh - 32px);
        border-radius: var(--radius-lg);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .content-area {
        padding: 20px;
    }

    .login-box {
        padding: 36px 28px;
    }
}

/* ==================== FLOATING HELP BUTTON ==================== */
.help-float-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.4);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: all 0.3s ease;
}

.help-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.5);
}

.help-float-btn:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .help-float-btn {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
}

/* ==================== AI CHATBOT ==================== */
.chatbot-float-btn {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0071e3, #0051b3);
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 113, 227, 0.4);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: all 0.3s ease;
}

.chatbot-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 113, 227, 0.5);
}

.chatbot-float-btn:active {
    transform: scale(0.95);
}

.chatbot-panel {
    position: fixed;
    bottom: 160px;
    right: 24px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chatbot-panel.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

.chatbot-header {
    background: linear-gradient(135deg, #0071e3, #0051b3);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

.chatbot-welcome {
    text-align: center;
    padding: 20px;
}

.chatbot-welcome h4 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.chatbot-welcome p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 0 16px 0;
}

.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.chatbot-suggestion {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.chatbot-suggestion:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.chatbot-message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.chatbot-message.user {
    align-items: flex-end;
}

.chatbot-message.bot {
    align-items: flex-start;
}

.chatbot-message .bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.chatbot-message.user .bubble {
    background: linear-gradient(135deg, #0071e3, #0051b3);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message.bot .bubble {
    background: white;
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chatbot-input-area {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

.chatbot-input-area input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input-area input:focus {
    border-color: var(--primary-color);
}

.chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0071e3, #0051b3);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: transform 0.2s;
}

.chatbot-send-btn:hover {
    transform: scale(1.05);
}

.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.chatbot-typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: chatbotTyping 1.2s infinite;
}

.chatbot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chatbotTyping {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

@media (max-width: 768px) {
    .chatbot-float-btn {
        bottom: 70px;
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    .chatbot-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ==================== INTEGRATION STYLES ==================== */
.slack-connected {
    background: linear-gradient(135deg, #4A154B 0%, #611f69 100%);
}

/* ==================== ANALYTICS STYLES ==================== */
.analytics-page {
    animation: contentFadeIn 0.5s var(--ease-out-expo);
}

.animated-card {
    animation: cardSlideUp 0.6s var(--ease-out-expo) forwards;
    opacity: 0;
}

.animated-card:nth-child(1) { animation-delay: 0.05s; }
.animated-card:nth-child(2) { animation-delay: 0.1s; }
.animated-card:nth-child(3) { animation-delay: 0.15s; }
.animated-card:nth-child(4) { animation-delay: 0.2s; }
.animated-card:nth-child(5) { animation-delay: 0.25s; }
.animated-card:nth-child(6) { animation-delay: 0.3s; }

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

.kpi-card {
    transition: all var(--transition-normal);
    cursor: pointer;
}

.kpi-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.kpi-change.positive {
    color: rgba(255,255,255,0.95);
}

.kpi-change.negative {
    color: rgba(255,180,180,1);
}

.mini-kpi {
    transition: all var(--transition-fast);
    cursor: pointer;
}

.mini-kpi:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-md);
}

.metric-item {
    transition: all var(--transition-fast);
}

.metric-item:hover {
    transform: translateX(4px);
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 12px;
}

/* Analytics filters */
.analytics-filters {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
}

.analytics-filters .btn-outline {
    border: 1.5px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    padding: 8px 16px;
    font-size: 13px;
}

.analytics-filters .btn-outline:hover {
    background: var(--bg-secondary);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

/* Chart containers */
.card canvas {
    animation: chartFadeIn 1s var(--ease-out-expo);
}

@keyframes chartFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Data table in analytics */
.analytics-page .data-table {
    border-collapse: collapse;
}

.analytics-page .data-table th,
.analytics-page .data-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
}

.analytics-page .data-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

.analytics-page .data-table tr:hover {
    background: rgba(0, 113, 227, 0.02);
}

/* Responsive analytics */
@media (max-width: 1200px) {
    .analytics-page > div[style*="grid-template-columns: 2fr 1fr"],
    .analytics-page > div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .analytics-kpi-grid {
        grid-template-columns: 1fr !important;
    }

    .analytics-kpi-grid-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .kpi-card {
        padding: 20px !important;
    }

    .kpi-value {
        font-size: 24px !important;
    }
}

/* ==================== FOCUS STATES ==================== */
:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* ==================== SKELETON LOADING ==================== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

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

/* ==================== HOVER EFFECTS ==================== */
.hover-lift {
    transition: all var(--transition-fast);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.hover-scale {
    transition: all var(--transition-fast);
}

.hover-scale:hover {
    transform: scale(1.02);
}

/* ==================== GLASSMORPHISM UTILITIES ==================== */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-light);
}

.glass-dark {
    background: var(--bg-glass-dark);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ==================== HACCP MODULE ==================== */
.haccp-page {
    padding: 0;
}

.haccp-page .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.haccp-page .page-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.haccp-page .header-actions {
    display: flex;
    gap: 12px;
}

.haccp-alerts-banner {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.haccp-alerts-banner .alert-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
}

.haccp-alerts-banner .alert-item.critical {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.haccp-alerts-banner .alert-item.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.haccp-alerts-banner .alert-item.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.haccp-alerts-banner .alert-item.info {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.haccp-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.haccp-kpi-grid .kpi-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-normal);
}

.haccp-kpi-grid .kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.haccp-kpi-grid .kpi-card.success {
    border-left: 4px solid #10b981;
}

.haccp-kpi-grid .kpi-card.warning {
    border-left: 4px solid #f59e0b;
}

.haccp-kpi-grid .kpi-card.danger {
    border-left: 4px solid #ef4444;
}

.haccp-kpi-grid .kpi-card.info {
    border-left: 4px solid #3b82f6;
}

.haccp-kpi-grid .kpi-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    font-size: 20px;
    color: var(--secondary-color);
}

.haccp-kpi-grid .kpi-content .kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.haccp-kpi-grid .kpi-content .kpi-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.haccp-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.haccp-tabs .tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.haccp-tabs .tab-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.haccp-tabs .tab-btn.active {
    background: var(--secondary-color);
    color: white;
}

.haccp-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    min-height: 400px;
}

.haccp-content .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.haccp-content .section-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.haccp-content .header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.haccp-content .table-container {
    overflow-x: auto;
}

.haccp-content .data-table {
    width: 100%;
    border-collapse: collapse;
}

.haccp-content .data-table th,
.haccp-content .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.haccp-content .data-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.haccp-content .data-table tr:hover {
    background: var(--bg-secondary);
}

.haccp-content .data-table .row-warning {
    background: rgba(245, 158, 11, 0.05);
}

.haccp-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.haccp-overview-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
}

.haccp-overview-card h4 {
    margin: 0 0 16px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.haccp-overview-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.haccp-overview-card li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.haccp-overview-card li:last-child {
    border-bottom: none;
}

.haccp-reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.haccp-reports-grid .report-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.haccp-reports-grid .report-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1976d2, #42a5f5);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.haccp-reports-grid .report-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(25, 118, 210, 0.2);
    border-color: #1976d2;
    background: white;
}

.haccp-reports-grid .report-card:hover::before {
    opacity: 1;
}

.haccp-reports-grid .report-card:active {
    transform: translateY(-2px);
}

.haccp-reports-grid .report-card i {
    font-size: 36px;
    color: #1976d2;
    margin-bottom: 14px;
    display: block;
}

.haccp-reports-grid .report-card h4 {
    margin: 0 0 8px 0;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.haccp-reports-grid .report-card p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
}

/* HACCP Quick Actions Grid */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 8px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 120px;
}

.quick-action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1976d2, #42a5f5);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.quick-action-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(25, 118, 210, 0.2);
    border-color: #1976d2;
    background: white;
}

.quick-action-btn:hover::before {
    opacity: 1;
}

.quick-action-btn:active {
    transform: translateY(-2px);
}

.quick-action-btn i {
    font-size: 32px;
    color: #1976d2;
    transition: transform 0.2s ease;
}

.quick-action-btn:hover i {
    transform: scale(1.1);
}

.quick-action-btn span {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
    line-height: 1.3;
}

@media (max-width: 480px) {
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }

    .quick-action-btn {
        min-height: 100px;
        padding: 20px 16px;
    }
}

/* Responsive HACCP */
@media (max-width: 768px) {
    .haccp-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .haccp-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .haccp-tabs .tab-btn {
        white-space: nowrap;
    }

    .haccp-content {
        padding: 16px;
    }
}

/* ==================== PUBLIC PRODUCT PAGE ==================== */
.public-product-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
}

.public-product-logo {
    margin-bottom: 24px;
    text-align: center;
}

.public-product-logo img {
    max-height: 60px;
    width: auto;
}

.public-product-loading,
.public-product-error {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-secondary);
}

.public-product-loading i,
.public-product-error i {
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.public-product-error h2 {
    margin: 20px 0 10px;
    color: var(--text-primary);
}

.public-product-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.1);
    max-width: 700px;
    width: 100%;
    overflow: hidden;
}

.public-product-header {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #0056b3 100%);
    padding: 24px 32px;
    color: white;
}

.public-product-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.public-product-body {
    padding: 32px;
}

.public-product-body .product-image {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 12px;
    margin-bottom: 24px;
    background: var(--bg-secondary);
}

.public-product-body .product-info {
    margin-bottom: 32px;
}

.public-product-body .product-code {
    display: inline-block;
    background: var(--bg-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.public-product-body .product-barcode {
    display: inline-block;
    background: var(--bg-tertiary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.public-product-body .product-barcode:hover {
    background: var(--primary-color);
    color: white;
}

.public-product-body .product-barcode:hover i {
    color: white;
}

.public-product-body .product-barcode i {
    margin-right: 6px;
    color: var(--primary-color);
}

/* Barcode Fullscreen */
.barcode-fullscreen-content {
    background: white;
    padding: 40px 60px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
}

.barcode-display {
    margin-bottom: 20px;
}

.barcode-display svg {
    max-width: 100%;
}

.barcode-number {
    font-size: 28px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 4px;
    color: #333;
}

.public-product-body .product-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
    line-height: 1.3;
}

.public-product-body .product-short-name {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0 0 16px;
}

.public-product-body .product-description {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.product-details .detail-section {
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border-color);
}

.product-details .detail-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.product-details .detail-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-details .detail-section h4 i {
    color: var(--secondary-color);
}

.product-details .detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.product-details .detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-details .detail-item span {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-details .detail-item strong {
    font-size: 15px;
    color: var(--text-primary);
}

.allergens-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.allergen-badge {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #ffc107;
}

.attachments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attachment-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.attachment-link:hover {
    background: var(--secondary-color);
    color: white;
}

.attachment-link i {
    font-size: 18px;
    color: var(--secondary-color);
}

.attachment-link:hover i {
    color: white;
}

.public-product-footer {
    background: var(--bg-secondary);
    padding: 20px 32px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.public-product-footer p {
    margin: 0 0 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.public-product-footer small {
    color: var(--text-tertiary);
    font-size: 12px;
}

@media (max-width: 600px) {
    .public-product-container {
        padding: 20px 12px;
    }

    .public-product-body {
        padding: 24px 20px;
    }

    .public-product-body .product-name {
        font-size: 22px;
    }

    .product-details .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Public Product Attachments */
.public-attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
}

.public-attachment-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.public-attachment-image {
    flex-direction: column;
    text-align: center;
}

.public-attachment-thumb {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.public-attachment-file i {
    font-size: 24px;
    color: var(--primary-color);
    min-width: 32px;
}

.public-attachment-name {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}

.attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Attachment Fullscreen Overlay */
.attachment-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.attachment-fullscreen-content {
    position: relative;
    max-width: 95%;
    max-height: 95%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.attachment-fullscreen-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.attachment-fullscreen-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s;
}

.attachment-fullscreen-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.attachment-fullscreen-caption {
    color: white;
    margin-top: 16px;
    font-size: 14px;
    opacity: 0.8;
}

/* ==================== DDT Report Stats Cards ==================== */
.ddt-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.ddt-stats-grid.ddt-stats-3 {
    grid-template-columns: repeat(3, 1fr);
}

.ddt-stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.2s ease;
}

.ddt-stat-card:hover {
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.ddt-stat-card.has-warning {
    border-left: 3px solid var(--danger-color);
}

.ddt-stat-card.has-alert {
    border-left: 3px solid var(--warning-color);
}

.ddt-stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.ddt-stat-content {
    flex: 1;
    min-width: 0;
}

.ddt-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 4px;
}

.ddt-stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

@media (max-width: 1200px) {
    .ddt-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ddt-stats-grid.ddt-stats-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .ddt-stats-grid,
    .ddt-stats-grid.ddt-stats-3 {
        grid-template-columns: 1fr;
    }

    .ddt-stat-card {
        padding: 16px;
    }

    .ddt-stat-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .ddt-stat-value {
        font-size: 20px;
    }
}

/* ==================== INTEGRATIONS GRID ==================== */
.integrations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.integration-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.integration-card:hover {
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.integration-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}

.integration-info {
    flex: 1;
    min-width: 0;
}

.integration-info h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.integration-info p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.integration-arrow {
    color: var(--text-tertiary);
    font-size: 14px;
    transition: transform 0.2s ease;
}

.integration-card:hover .integration-arrow {
    transform: translateX(4px);
    color: var(--secondary-color);
}

.integration-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.integration-status.connected {
    background: rgba(48, 209, 88, 0.1);
    color: var(--success-color);
}

.integration-status.disconnected {
    background: rgba(134, 134, 139, 0.1);
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .integrations-grid {
        grid-template-columns: 1fr;
    }

    .integration-card {
        padding: 16px;
    }

    .integration-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

/* Multiselect Component */
.multiselect-container {
    position: relative;
}

.multiselect-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    min-height: 42px;
    transition: border-color 0.2s;
}

.multiselect-selected:hover {
    border-color: var(--primary-color);
}

.multiselect-placeholder {
    color: var(--text-secondary);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multiselect-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow: hidden;
    margin-top: 4px;
}

.multiselect-search {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
}

.multiselect-search i {
    color: var(--text-secondary);
}

.multiselect-search input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
}

.multiselect-options {
    max-height: 240px;
    overflow-y: auto;
    padding: 8px 0;
}

.multiselect-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 10px;
}

.multiselect-option:hover {
    background: var(--bg-hover);
}

.multiselect-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.multiselect-option span {
    font-size: 14px;
    color: var(--text-color);
}
