:root {
    --primary: #38B9C8; /* Cordlife Teal */
    --primary-hover: #2da1ae;
    --secondary: #24D0A5; /* Mint Green */
    --ocean-blue: #006EA1;
    --header-navy: #004F71;
    --background: #F1F8F9; /* Light Oceanic BG */
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-main: #004F71;
    --text-body: #555555;
    --text-muted: #8ba5ac;
    --border: #d7e6e9;
    --shadow: 0 10px 15px -3px rgba(56, 185, 200, 0.1), 0 4px 6px -4px rgba(56, 185, 200, 0.1);
    --top-bar-height: 60px;
    --sidebar-width: 240px;
    --brand-width: 240px; /* Fixed width for logo area */
    --sidebar-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapsed {
    --sidebar-width: 80px;
}

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

body {
    font-family: 'Montserrat', 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-body);
    line-height: 1.6;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--text-body);
    padding: 1.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--top-bar-height);
    left: 0;
    bottom: 0;
    height: calc(100vh - var(--top-bar-height));
    border-right: 1px solid var(--border);
    z-index: 900;
    transition: width var(--sidebar-transition);
    overflow: hidden;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-body);
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    transition: background var(--sidebar-transition), color var(--sidebar-transition), transform 0.2s;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-icon {
    flex-shrink: 0;
    margin-right: 1rem;
    transition: margin var(--sidebar-transition);
}

.sidebar-collapsed .nav-icon {
    margin-right: 0;
}

.nav-link span {
    opacity: 1;
    transition: opacity var(--sidebar-transition);
}

.sidebar-collapsed .nav-link span,
.sidebar-collapsed .system-label {
    display: none;
}

.nav-link:hover {
    background-color: var(--background);
    color: var(--primary);
    transform: translateX(4px);
}

.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar-collapsed .nav-link:hover {
    transform: scale(1.1);
}

.nav-link.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(56, 185, 200, 0.3);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2.5rem;
    padding-top: calc(var(--top-bar-height) + 2rem);
    max-width: 1400px;
    transition: margin-left var(--sidebar-transition);
}

/* Fixed Top Bar 100% Width */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--top-bar-height);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    width: var(--brand-width);
    padding: 0 1.25rem;
    height: 100%;
    border-right: 1px solid var(--border);
    gap: 0.75rem;
    flex-shrink: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--header-navy);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--background);
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    height: 100%;
    overflow: hidden;
}

.top-bar-logo {
    max-height: 32px;
    width: auto;
}

.site-name {
    font-weight: 800;
    color: var(--primary);
    font-size: 1rem;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.header-center {
    flex: 1;
    padding-left: 1.5rem;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--header-navy);
}

.user-info {
    display: flex;
    align-items: center;
    padding-right: 1.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--header-navy);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    box-shadow: 0 2px 6px rgba(56, 185, 200, 0.2);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: none;
    transition: all 0.3s ease;
}

.card:hover { transform: translateY(-5px); box-shadow: 0 20px 25px -5px rgba(56, 185, 200, 0.15); }

/* Buttons & Rest */
.btn { display: inline-block; padding: 0.875rem 1.75rem; border-radius: 30px; font-weight: 700; text-align: center; cursor: pointer; border: none; font-size: 0.95rem; }
.btn-primary { background: var(--primary); color: white; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { text-align: left; padding: 1.25rem 1rem; font-size: 0.8rem; color: var(--text-muted); border-bottom: 2px solid var(--background); }
td { padding: 1.25rem 1rem; border-bottom: 1px solid var(--background); }
.badge { display: inline-block; padding: 0.35rem 1rem; border-radius: 30px; font-size: 0.75rem; font-weight: 700; }
.badge-success { background: #e6fffa; color: #00a3c4; }
.grid { display: grid; gap: 2rem; }

@media (max-width: 1024px) {
    :root { 
        --sidebar-width: 80px; 
        --brand-width: 80px;
    }
    .sidebar-toggle { display: none; }
    .nav-link span, .system-label, .site-name { display: none; }
}

@media (max-width: 768px) {
    .dashboard-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; top: 0; padding: 1rem; border-right: none; border-bottom: 1px solid var(--border); }
    .main-content { margin-left: 0; }
}
