/* Professional CRM Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #334155;
    --header-bg: #ffffff;
    --body-bg: #f1f5f9;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    background-color: var(--body-bg);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

.wrapper { display: flex; min-height: 100vh; }

/* Fixed Header */
.header {
    background-color: var(--header-bg);
    height: 60px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    border-bottom: 1px solid var(--border);
}

.header-left { display: flex; align-items: center; gap: 15px; }
.header-left h1 { font-size: 1.1rem; font-weight: 700; margin: 0; color: #0f172a; }

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: #cbd5e1;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding-top: 60px;
    transition: var(--transition);
    z-index: 1000;
    overflow-y: auto;
}

.sidebar ul { list-style: none; padding: 10px 0; margin: 0; }

.sidebar ul li .menu-label {
    padding: 15px 20px 5px;
    font-size: 0.7rem;
    color: #475569;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1px;
}

.sidebar ul li a {
    color: #94a3b8;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 12px 20px;
    transition: var(--transition);
    font-weight: 500;
    border-left: 3px solid transparent;
}

.sidebar ul li a i { width: 20px; margin-right: 12px; font-size: 1rem; }

.sidebar ul li a:hover {
    background-color: var(--sidebar-hover);
    color: #fff;
}

.sidebar ul li a.active {
    background-color: var(--sidebar-active);
    color: #fff;
    border-left-color: var(--primary);
}

/* Sub-menus */
.sub-menu {
    background-color: #020617;
    display: none;
    padding: 5px 0;
}

.sub-menu.active { display: block; }

.sub-menu li a { padding-left: 52px; font-size: 0.9rem; }

/* Main Content Area */
.main-content {
    flex-grow: 1;
    padding: 30px;
    margin-left: 260px;
    margin-top: 60px;
    transition: var(--transition);
    width: calc(100% - 260px);
}

/* Dashboard Cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-5px); }

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.sales .card-icon { background: #eff6ff; color: #3b82f6; }
.costs .card-icon { background: #fff1f2; color: #ef4444; }
.profit .card-icon { background: #f0fdf4; color: #10b981; }
.entities .card-icon { background: #fff7ed; color: #f59e0b; }

.card-info p { margin: 0; font-size: 0.875rem; color: var(--text-muted); font-weight: 500; }
.card-info h3 { margin: 5px 0; font-size: 1.5rem; font-weight: 700; color: var(--text-main); }
.card-info small { color: var(--text-muted); font-size: 0.75rem; }

/* Common UI Components */
.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

h1 { font-size: 1.75rem; font-weight: 700; margin: 0; color: #0f172a; }

.card-container {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 25px;
}

.card-container h3 { margin-top: 0; margin-bottom: 20px; font-size: 1.1rem; color: #0f172a; }

/* Modern Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border);
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.data-table tr:hover td { background-color: #f8fafc; }

/* Form Elements */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 20px; }
.form-group { display: flex; flex-direction: column; }
.form-group label { margin-bottom: 6px; font-weight: 600; font-size: 0.875rem; color: #475569; }
.form-group input, .form-group select, .form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: #fff;
    transition: var(--transition);
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Status Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
    font-size: 0.9rem;
}
.btn-primary { background: var(--primary); color: #fff !important; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary-color); color: #3d3b3b !important; }
.btn-success { background: var(--success); color: #fff !important; }
.btn-danger { background: var(--danger); color: #fff !important; }
.btn-info { background: var(--info); color: #fff !important; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* Invoice/PO Items */
.item-row {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
}

/* Messaging */
.message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-weight: 500;
}
.message.success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.message.error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* User Profile in Header */
.user-profile { display: flex; align-items: center; gap: 20px; }
.user-profile a { color: var(--text-main); text-decoration: none; font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.user-profile a:hover { color: var(--primary); }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width: 70px; }
    .sidebar .menu-label, .sidebar ul li a span { display: none; }
    .main-content { margin-left: 70px; width: calc(100% - 70px); }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 260px; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; width: 100%; padding: 15px; }
    .header-datetime { display: none; }
}
