:root {
    /* Professional Color Palette (Slate/Indigo) */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --secondary: #64748b;

    --bg-body: #f8fafc;
    --bg-card: #ffffff;

    --text-main: #0f172a;
    --text-muted: #64748b;

    --border-color: #e2e8f0;

    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;

    --card-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --card-shadow-hover: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius: 0.5rem;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow-y: auto;
    /* Ensure scrollbar is always available if content overflows */
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    /* Key change: Contain scroll within main-content */
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #1e293b;
    color: white;
    display: flex;
    /* Flex container */
    flex-direction: column;
    height: 100vh;
    /* Full height */
    overflow-y: hidden;
    /* Hide sidebar scroll, use inner container */
    flex-shrink: 0;
    z-index: 1000;
    transition: var(--transition);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    /* Flex for alignment */
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    flex-shrink: 0;
}

.sidebar-scroll-area {
    padding: 1rem;
    flex: 1;
    /* Grow to fill available space */
    overflow-y: auto;
    /* Scrollable area */
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 transparent;
}

/* Nav Links */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 1.25rem;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.logout-container {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    /* Push to bottom */
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    /* Take remaining width */
    height: 100vh;
    /* Full height */
    overflow-y: auto;
    /* Independent scroll */
    padding: 2rem;
    background-color: var(--bg-body);
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

.page-header p {
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Mobile Sidebar */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        transition: left 0.3s ease;
        z-index: 2000;
    }

    .sidebar.show {
        left: 0;
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.5);
    }

    .main-content {
        width: 100%;
        /* Full width on mobile */
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ... keep existing component classes (cards, buttons, forms, tables) below ... */

/* Cards (Replacing Glass effect with Professional Card) */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    overflow: hidden;
    /* Clean corners */
    margin-bottom: 1rem;
}

.glass-card:hover {
    /* Only hover effect if interactive, otherwise subtle */
    box-shadow: var(--card-shadow-hover);
    border-color: #cbd5e1;
}

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

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

.stat-card {
    padding: 1rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.5rem;
    letter-spacing: -0.025em;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.925rem;
}

.data-table thead {
    background-color: #f1f5f9;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    text-align: left;
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

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

.data-table tr:hover td {
    background-color: #f8fafc;
}

/* Also apply to generic tables inside cards */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}


/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: var(--radius);
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    gap: 0.5rem;
}

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

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

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

.btn-secondary {
    background-color: white;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

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

.btn-success:hover {
    background-color: #059669;
}

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

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-warning {
    background-color: var(--warning);
    color: #78350f;
}

.btn-warning:hover {
    background-color: #d97706;
}

.w-100 {
    width: 100%;
}

/* Forms */
.form-input,
.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background-color: #fff;
    color: var(--text-main);
    font-size: 0.875rem;
    transition: var(--transition);
}

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

label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-main);
}

/* Badges / Status */
.badge,
.status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-success,
.status-ACTIVE,
.status-COMPLETED,
.status-APPROVED,
.status-VERIFIED {
    background-color: var(--success-bg);
    color: #065f46;
}

.badge-warning,
.status-PENDING,
.status-IN_PROGRESS,
.status-CHANGES_REQUESTED {
    background-color: var(--warning-bg);
    color: #92400e;
}

.status-SERVICE_DONE {
    background-color: #e0e7ff;
    color: #4338ca;
}

.badge-danger,
.status-CANCELLED,
.status-REJECTED,
.status-SUSPENDED,
.status-BLOCKED {
    background-color: var(--danger-bg);
    color: #991b1b;
}

.badge-secondary,
.status-INACTIVE {
    background-color: #f1f5f9;
    color: #64748b;
}

/* Utilities */
.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mb-6 {
    margin-bottom: 3rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.text-center {
    text-align: center;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 0.875rem;
}

.font-bold {
    font-weight: 700;
}

/* Detail List Views */
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color);
    align-items: flex-start;
}

.detail-row:hover {
    background-color: #f8fafc;
    border-radius: 4px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0;
    flex-shrink: 0;
    /* Prevent label from shrinking */
    margin-right: 1rem;
}

.detail-row span:last-child {
    /* Target the value span */
    text-align: right;
    overflow-wrap: anywhere;
    /* Break long words/emails */
    max-width: 60%;
    /* Ensure it doesn't take full width if not needed, or constrains it */
}

/* Grid */
.grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: #f1f5f9;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.logout-btn {
    width: 100%;
    background: transparent;
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.logout-btn:hover {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}

/* Chart Container */
.chart-container {
    padding: 1.5rem;
    height: 350px;
    position: relative;
}

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

/* Login Page */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    background: white;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.form-group {
    margin-bottom: 1.25rem;
}