/**
 * OTLOX SMARTOME AUTOMATION - Main Stylesheet
 * Invoice & Inventory Management System
 * Brand Colors: Modern Slate Palette
 * Primary: Charcoal (#2D3748) | Secondary: Emerald (#059669) | Accent: Copper (#B45309)
 */

/* ============================================
   CSS VARIABLES - MODERN SLATE PALETTE
   ============================================ */
:root {
    /* Primary: Charcoal (Sophisticated, Modern) */
    --charcoal: #2D3748;
    --charcoal-dark: #1A202C;
    --charcoal-light: #4A5568;
    --charcoal-lighter: #718096;
    
    /* Secondary: Emerald (Success, Growth, Money) */
    --emerald: #059669;
    --emerald-dark: #047857;
    --emerald-light: #10B981;
    --emerald-lighter: #6EE7B7;
    
    /* Accent: Copper (Warmth, Premium Touch) */
    --copper: #B45309;
    --copper-dark: #92400E;
    --copper-light: #D97706;
    --copper-lighter: #FCD34D;
    
    /* Derived Colors */
    --primary-color: var(--charcoal);
    --primary-dark: var(--charcoal-dark);
    --primary-light: var(--charcoal-light);
    
    --secondary-color: var(--emerald);
    --secondary-dark: var(--emerald-dark);
    --secondary-light: var(--emerald-light);
    
    --accent-color: var(--copper);
    --accent-dark: var(--copper-dark);
    --accent-light: var(--copper-light);
    
    /* Semantic Colors */
    --success-color: var(--emerald);
    --success-light: #D1FAE5;
    --success-dark: var(--emerald-dark);
    
    --warning-color: #D97706;
    --warning-light: #FEF3C7;
    
    --danger-color: #DC2626;
    --danger-light: #FEE2E2;
    
    --info-color: #2563EB;
    --info-light: #DBEAFE;
    
    /* Premium Grays */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    
    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--gray-700);
    background-color: var(--gray-50);
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-900);
}

h1 { font-size: 1.75rem; color: var(--primary-color); }
h2 { font-size: 1.5rem; color: var(--primary-color); }
h3 { font-size: 1.25rem; color: var(--primary-color); }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

.text-primary { color: var(--primary-color) !important; }
.text-secondary { color: var(--secondary-color) !important; }
.text-accent { color: var(--accent-color) !important; }
.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(--gray-500) !important; }

/* ============================================
   LAYOUT - APP CONTAINER
   ============================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR - CLEAN & PROFESSIONAL (LIGHT THEME)
   ============================================ */

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Main Sidebar - Clean Light Theme */
.sidebar {
    width: var(--sidebar-width);
    background: #FFFFFF;
    color: var(--gray-700);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
    border-right: 1px solid var(--gray-200);
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFC 100%);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-dark) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
    flex-shrink: 0;
}

.sidebar-logo i {
    font-size: 1.25rem;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--charcoal);
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--emerald);
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.sidebar-close:hover {
    background: var(--gray-100);
    color: var(--charcoal);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

.nav-section {
    padding: 0;
}

/* Navigation Items */
.nav-item-wrapper {
    margin-bottom: 0.25rem;
}

.nav-item-wrapper.active > .nav-item {
    background: linear-gradient(90deg, rgba(5, 150, 105, 0.08) 0%, rgba(5, 150, 105, 0.02) 100%);
    color: var(--emerald);
    border-left-color: var(--emerald);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    color: var(--gray-600);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
    border-radius: 0 var(--border-radius-lg) var(--border-radius-lg) 0;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 0.125rem;
    transform: translateX(0);
}

.nav-item:hover {
    background: var(--gray-50);
    color: var(--charcoal);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(5, 150, 105, 0.08) 0%, rgba(5, 150, 105, 0.02) 100%);
    color: var(--emerald);
    border-left-color: var(--emerald);
    font-weight: 600;
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-icon i {
    font-size: 1rem;
}

.nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-arrow {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--gray-400);
}

.nav-arrow i {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

/* Submenu */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 2.75rem;
}

.submenu.open {
    max-height: 300px;
}

.submenu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--gray-500);
    font-size: 0.8125rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--border-radius);
    margin-bottom: 0.125rem;
    transform: translateX(0);
}

.submenu-item:hover {
    background: var(--gray-50);
    color: var(--charcoal);
    transform: translateX(6px);
}

.submenu-item.active {
    background: rgba(5, 150, 105, 0.08);
    color: var(--emerald);
    font-weight: 600;
}

.submenu-dot {
    width: 6px;
    height: 6px;
    background: var(--gray-300);
    border-radius: 50%;
    flex-shrink: 0;
    transition: var(--transition);
}

.submenu-item:hover .submenu-dot {
    background: var(--gray-400);
}

.submenu-item.active .submenu-dot {
    background: var(--emerald);
}

/* Sidebar Footer - User Profile */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--gray-100);
    flex-shrink: 0;
    background: #FAFBFC;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: white;
    border-radius: var(--border-radius-lg);
    transition: var(--transition);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.user-card:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8125rem;
    color: white;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--charcoal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.6875rem;
    color: var(--gray-500);
    text-transform: capitalize;
}

.user-logout {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    border-radius: var(--border-radius);
    transition: var(--transition);
    flex-shrink: 0;
}

.user-logout:hover {
    background: var(--danger-light);
    color: var(--danger-color);
}

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

/* ============================================
   HEADER
   ============================================ */
.header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-toggle {
    background: none;
    border: none;
    color: var(--gray-600);
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: all 0.15s ease;
    transform: translateY(0);
}

.header-toggle:hover {
    background: var(--gray-100);
    color: var(--primary-color);
}

.header-toggle:active {
    transform: translateY(2px);
}

.header-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-btn {
    position: relative;
    background: none;
    border: none;
    color: var(--gray-600);
    font-size: 1.125rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.header-btn:hover {
    background: var(--gray-100);
    color: var(--primary-color);
}

.header-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--copper);
    color: white;
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    font-weight: 700;
}

/* ============================================
   CONTENT AREA
   ============================================ */
.content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.content-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.content-actions {
    display: flex;
    gap: 0.75rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 2px 0 var(--gray-200), 0 4px 12px rgba(0,0,0,0.06);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

.card:hover {
    box-shadow: 0 6px 0 var(--gray-200), 0 12px 24px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, white 0%, var(--gray-50) 100%);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i {
    color: var(--copper);
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ============================================
   BUTTONS - MODERN SLATE
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    transition: var(--transition);
    letter-spacing: 0.2px;
}

.btn-primary {
    background: var(--charcoal);
    border-color: var(--charcoal);
    color: white;
}

.btn-primary:hover {
    background: var(--charcoal-dark);
    border-color: var(--charcoal-dark);
    color: white;
    box-shadow: 0 4px 12px rgba(45, 55, 72, 0.25);
}

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

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-800);
}

.btn-success {
    background: var(--emerald);
    border-color: var(--emerald);
    color: white;
}

.btn-success:hover {
    background: var(--emerald-dark);
    border-color: var(--emerald-dark);
    color: white;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

/* ============================================
   3D BUTTON EFFECTS
   ============================================ */
.btn {
    position: relative;
    transform: translateY(0);
    box-shadow: 0 4px 0 rgba(0,0,0,0.15), 0 6px 12px rgba(0,0,0,0.1);
    transition: all 0.15s ease;
}

.btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
}

.btn-primary {
    box-shadow: 0 4px 0 #1a202c, 0 6px 12px rgba(45, 55, 72, 0.25);
}

.btn-primary:active {
    box-shadow: 0 1px 0 #1a202c, 0 2px 4px rgba(45, 55, 72, 0.25);
}

.btn-success {
    box-shadow: 0 4px 0 #047857, 0 6px 12px rgba(5, 150, 105, 0.25);
}

.btn-success:active {
    box-shadow: 0 1px 0 #047857, 0 2px 4px rgba(5, 150, 105, 0.25);
}

.btn-danger {
    box-shadow: 0 4px 0 #991b1b, 0 6px 12px rgba(220, 38, 38, 0.25);
}

.btn-danger:active {
    box-shadow: 0 1px 0 #991b1b, 0 2px 4px rgba(220, 38, 38, 0.25);
}

.btn-warning {
    box-shadow: 0 4px 0 #92400e, 0 6px 12px rgba(180, 83, 9, 0.25);
}

.btn-warning:active {
    box-shadow: 0 1px 0 #92400e, 0 2px 4px rgba(180, 83, 9, 0.25);
}

.btn-secondary {
    box-shadow: 0 4px 0 #d1d5db, 0 6px 12px rgba(0,0,0,0.08);
}

.btn-secondary:active {
    box-shadow: 0 1px 0 #d1d5db, 0 2px 4px rgba(0,0,0,0.08);
}

.btn-info {
    box-shadow: 0 4px 0 #1e40af, 0 6px 12px rgba(37, 99, 235, 0.25);
}

.btn-info:active {
    box-shadow: 0 1px 0 #1e40af, 0 2px 4px rgba(37, 99, 235, 0.25);
}

/* ============================================
   BUTTON SIZES
   ============================================ */
.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

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

.btn-danger:hover {
    background: #B91C1C;
    border-color: #B91C1C;
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: white;
}

.btn-accent {
    background: var(--copper);
    border-color: var(--copper);
    color: white;
    font-weight: 600;
}

.btn-accent:hover {
    background: var(--copper-dark);
    border-color: var(--copper-dark);
    color: white;
    box-shadow: 0 4px 12px rgba(180, 83, 9, 0.3);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-label.required::after {
    content: ' *';
    color: var(--danger-color);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--gray-800);
    background-color: white;
    background-clip: padding-box;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}

.form-control:focus {
    color: var(--gray-800);
    background-color: white;
    border-color: var(--copper);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.15), inset 0 1px 2px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control:disabled {
    background-color: var(--gray-100);
    opacity: 1;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.375rem;
}

/* Input Groups */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--gray-600);
    text-align: center;
    white-space: nowrap;
    background-color: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.input-group .form-control {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin-left: -1px;
}

/* Select */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 0.875rem 1rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary-color);
    background: var(--gray-50);
    border-bottom: 2px solid var(--primary-color);
}

.table tbody tr {
    transition: all 0.15s ease;
}

.table tbody tr:hover {
    background: var(--gray-50);
    transform: translateX(3px);
    box-shadow: -2px 0 8px rgba(0,0,0,0.04);
}

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

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.3), 0 1px 2px rgba(0,0,0,0.05);
}

.badge-primary {
    background: rgba(45, 55, 72, 0.1);
    color: var(--charcoal);
}

.badge-success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--emerald);
}

.badge-warning {
    background: var(--warning-light);
    color: #92400E;
}

.badge-danger {
    background: var(--danger-light);
    color: #991B1B;
}

.badge-info {
    background: var(--info-light);
    color: #1E40AF;
}

.badge-accent {
    background: rgba(180, 83, 9, 0.15);
    color: var(--copper);
}

/* Quote statuses */
.badge-draft { background: rgba(107, 114, 128, 0.15); color: #4b5563; }
.badge-sent { background: rgba(59, 130, 246, 0.15); color: #1d4ed8; }
.badge-accepted { background: rgba(5, 150, 105, 0.15); color: var(--emerald); }
.badge-declined { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }
.badge-converted { background: rgba(139, 92, 246, 0.15); color: #6d28d9; }
.badge-expired { background: rgba(107, 114, 128, 0.2); color: #374151; }

/* Return statuses */
.badge-pending { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.badge-processed { background: rgba(5, 150, 105, 0.15); color: var(--emerald); }
.badge-cancelled { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }

/* Transfer statuses */
.badge-in_transit { background: rgba(59, 130, 246, 0.15); color: #1d4ed8; }
.badge-completed { background: rgba(5, 150, 105, 0.15); color: var(--emerald); }

/* Recurring statuses */
.badge-active { background: rgba(5, 150, 105, 0.15); color: var(--emerald); }
.badge-paused { background: rgba(245, 158, 11, 0.15); color: #b45309; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    box-shadow: inset 3px 0 0 rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    transform: translateX(0);
    transition: all 0.2s ease;
}

.alert:hover {
    transform: translateX(2px);
    box-shadow: inset 4px 0 0 rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.06);
}

.alert i {
    font-size: 1.125rem;
    margin-top: 0.125rem;
}

.alert-success {
    background: var(--success-light);
    border-color: var(--emerald);
    color: var(--emerald-dark);
}

.alert-danger {
    background: var(--danger-light);
    border-color: var(--danger-color);
    color: #991B1B;
}

.alert-warning {
    background: var(--warning-light);
    border-color: var(--warning-color);
    color: #92400E;
}

.alert-info {
    background: var(--info-light);
    border-color: var(--info-color);
    color: #1E40AF;
}

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

.stat-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 3px 0 var(--gray-200), 0 6px 16px rgba(0,0,0,0.06);
    border: 1px solid var(--gray-200);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

.stat-card:hover {
    box-shadow: 0 6px 0 var(--gray-200), 0 12px 28px rgba(0,0,0,0.1);
    border-color: var(--copper);
    transform: translateY(-4px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.primary {
    background: rgba(45, 55, 72, 0.08);
    color: var(--charcoal);
}

.stat-icon.success {
    background: rgba(5, 150, 105, 0.08);
    color: var(--emerald);
}

.stat-icon.warning {
    background: var(--warning-light);
    color: var(--warning-color);
}

.stat-icon.danger {
    background: var(--danger-light);
    color: var(--danger-color);
}

.stat-icon.accent {
    background: rgba(180, 83, 9, 0.12);
    color: var(--copper);
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-change {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.stat-change.positive {
    color: var(--emerald);
}

.stat-change.negative {
    color: var(--danger-color);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--gray-50);
    color: var(--charcoal);
    border-color: var(--charcoal);
}

.pagination .active {
    background: var(--charcoal);
    border-color: var(--charcoal);
    color: white;
}

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

/* ============================================
   FILTERS & SEARCH
   ============================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.search-box i {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.search-box input {
    padding-left: 2.5rem;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-icon {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.empty-text {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}

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

.tab.active {
    color: var(--charcoal);
    border-bottom-color: var(--copper);
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--charcoal-dark) 0%, var(--charcoal) 50%, var(--charcoal-light) 100%);
    padding: 1rem;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 8px 0 rgba(0,0,0,0.08), 0 20px 50px rgba(0,0,0,0.12);
    overflow: hidden;
    transform: translateY(0);
    transition: all 0.3s ease;
}

.login-box:hover {
    box-shadow: 0 12px 0 rgba(0,0,0,0.08), 0 28px 60px rgba(0,0,0,0.15);
    transform: translateY(-4px);
}

.login-header {
    padding: 2rem;
    text-align: center;
    background: linear-gradient(135deg, var(--charcoal) 0%, var(--charcoal-dark) 100%);
    color: white;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: var(--copper);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 auto 1rem;
    color: white;
    box-shadow: 0 4px 0 #92400e, 0 4px 16px rgba(180, 83, 9, 0.4);
    transition: all 0.2s ease;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: white;
}

.login-subtitle {
    font-size: 0.875rem;
    opacity: 0.8;
}

.login-body {
    padding: 2rem;
}

.login-footer {
    padding: 1rem 2rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--gray-500);
    border-top: 1px solid var(--gray-200);
}

/* ============================================
   STATUS INDICATORS
   ============================================ */
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
}

.status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status.active::before,
.status.paid::before,
.status.finalized::before {
    background: var(--emerald);
}

.status.pending::before,
.status.partial::before {
    background: var(--warning-color);
}

.status.inactive::before,
.status.cancelled::before,
.status.overdue::before {
    background: var(--danger-color);
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar,
    .header,
    .content-actions,
    .btn {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }
}

/* ============================================
   RESPONSIVE - COMPREHENSIVE
   ============================================ */

/* Large screens (1200px+) */
@media (min-width: 1200px) {
    .content {
        padding: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Medium screens (992px - 1199px) */
@media (max-width: 1199px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small screens (768px - 991px) */
@media (max-width: 991px) {
    :root {
        --sidebar-width: 220px;
    }
    
    .sidebar-logo-text {
        font-size: 0.875rem;
    }
    
    .sidebar-nav-item {
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
    }
    
    .content {
        padding: 1rem;
    }
    
    .content-title {
        font-size: 1.25rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table th,
    .table td {
        padding: 0.625rem 0.75rem;
    }
}

/* Extra small screens (576px - 767px) */
@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: flex;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    body.sidebar-open {
        overflow: hidden;
    }
    
    .header {
        padding: 0 1rem;
        height: 56px;
    }
    
    .header-title {
        font-size: 1rem;
    }
    
    .content {
        padding: 0.75rem;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .content-title {
        font-size: 1.125rem;
    }
    
    .content-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .content-actions .btn {
        flex: 1;
        min-width: 120px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .search-box {
        max-width: none;
    }
    
    .card-header {
        padding: 0.875rem 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .table-container {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.25rem;
    }
    
    .login-box {
        margin: 0.5rem;
    }
    
    .login-header,
    .login-body {
        padding: 1.5rem;
    }
}

/* Very small screens (480px - 575px) */
@media (max-width: 575px) {
    .header {
        padding: 0 0.75rem;
    }
    
    .header-right {
        gap: 0.25rem;
    }
    
    .header-btn {
        padding: 0.375rem;
        font-size: 1rem;
    }
    
    .content {
        padding: 0.5rem;
    }
    
    .card {
        border-radius: var(--border-radius);
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .content-actions .btn {
        width: 100%;
    }
    
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }
    
    .tab {
        white-space: nowrap;
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    .modal {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }
}

/* Tiny screens (up to 479px) */
@media (max-width: 479px) {
    html {
        font-size: 14px;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .header-title {
        display: none;
    }
    
    .card-title {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    .badge {
        font-size: 0.625rem;
        padding: 0.2rem 0.4rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
    }
    
    .form-control {
        padding: 0.5rem 0.75rem;
    }
    
    .alert {
        padding: 0.75rem;
        font-size: 0.8125rem;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        overflow-y: auto;
    }
    
    .login-page {
        align-items: flex-start;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}

/* High DPI / Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .sidebar-logo-icon,
    .stat-icon,
    .login-logo {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode
    :root {
        --gray-50: #111827;
        --gray-100: #1F2937;
        --gray-200: #374151;
        --gray-300: #4B5563;
        --gray-400: #6B7280;
        --gray-500: #9CA3AF;
        --gray-600: #D1D5DB;
        --gray-700: #E5E7EB;
        --gray-800: #F3F4F6;
        --gray-900: #F9FAFB;
    }
    
    body {
        background-color: var(--gray-50);
        color: var(--gray-700);
    }
    
    .card {
        background: var(--gray-100);
        border-color: var(--gray-200);
    }
    */
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease;
}

.animate-fadeOut {
    animation: fadeOut 0.3s ease;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.d-flex { display: flex !important; }
.d-block { display: block !important; }
.d-none { display: none !important; }
.d-grid { display: grid !important; }

.flex-1 { flex: 1 !important; }
.flex-wrap { flex-wrap: wrap !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.align-items-center { align-items: center !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

.m-0 { margin: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }

.p-0 { padding: 0 !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }

.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

.font-weight-bold { font-weight: 700 !important; }
.font-weight-semibold { font-weight: 600 !important; }

.text-small { font-size: 0.8125rem !important; }
.text-smaller { font-size: 0.75rem !important; }

.border-0 { border: 0 !important; }
.rounded { border-radius: var(--border-radius) !important; }

.cursor-pointer { cursor: pointer !important; }

/* ============================================
   MODAL / CONFIRM DIALOG
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 420px;
    width: 90%;
    animation: scaleIn 0.2s ease;
    overflow: hidden;
}

.modal-header {
    padding: 1.25rem 1.5rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-header i {
    font-size: 1.5rem;
    color: var(--warning-color);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--charcoal);
    margin: 0;
}

.modal-body {
    padding: 0.5rem 1.5rem 1.25rem;
    color: var(--gray-600);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.modal-footer {
    padding: 1rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
