:root {
    /* M3 Color Tokens (Google Enterprise / Standard Blue Theme) */
    --md-sys-color-primary: #0b57d0;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #d3e3fd;
    --md-sys-color-on-primary-container: #041e49;

    --md-sys-color-secondary: #00639b;
    --md-sys-color-on-secondary: #FFFFFF;
    --md-sys-color-secondary-container: #c2e7ff;
    --md-sys-color-on-secondary-container: #001d35;

    --md-sys-color-background: #F8F9FA;
    --md-sys-color-on-background: #1f1f1f;

    --md-sys-color-surface: #FFFFFF;
    /* Surface Container Low/Lowest usually */
    --md-sys-color-surface-container: #F0F2F5;
    /* Sidebar/AppShell */
    --md-sys-color-on-surface: #1f1f1f;
    --md-sys-color-on-surface-variant: #444746;

    --md-sys-color-outline: #747775;
    --md-sys-color-outline-variant: #c4c7c5;

    --md-sys-color-success: #14ae5c;

    /* Elevation / Shadows */
    --md-sys-elevation-1: 0px 1px 3px 0px rgba(60, 64, 67, 0.3), 0px 4px 8px 3px rgba(60, 64, 67, 0.15);
    --md-sys-elevation-2: 0px 1px 2px 0px rgba(60, 64, 67, 0.3), 0px 2px 6px 2px rgba(60, 64, 67, 0.15);

    /* Layout */
    --md-sys-shape-corner-small: 4px;
    --md-sys-shape-corner-medium: 8px;
    --md-sys-shape-corner-large: 12px;
    --md-sys-shape-corner-full: 9999px;
}

/* Dark Theme Overrides (Optional, focusing on Light Theme for classic Google Enterprise look, but support dark if needed) */
@media (prefers-color-scheme: dark) {
    :root {
        --md-sys-color-primary: #D0BCFF;
        --md-sys-color-on-primary: #381E72;
        --md-sys-color-primary-container: #4F378B;
        --md-sys-color-on-primary-container: #EADDFF;

        --md-sys-color-background: #1C1B1F;
        --md-sys-color-on-background: #E6E1E5;

        --md-sys-color-surface: #1C1B1F;
        --md-sys-color-surface-container: #25232A;
        --md-sys-color-on-surface: #E6E1E5;
        --md-sys-color-on-surface-variant: #CAC4D0;

        --md-sys-color-outline: #938F99;
        --md-sys-color-outline-variant: #49454F;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    display: flex;
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 400;
    /* M3 Display/Headline weights are often lighter */
    color: var(--md-sys-color-on-surface);
}

.page-title {
    font-family: 'Google Sans', 'Roboto', sans-serif;
    /* Use Google Sans if available */
    font-size: 22px;
    line-height: 28px;
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Navigation Rail / Drawer */
.sidebar {
    width: 280px;
    /* M3 Standard Drawer width */
    background-color: var(--md-sys-color-surface-container);
    border-right: none;
    /* M3 usually uses color difference or subtle non-border separation */
    padding: 12px;
    display: flex;
    flex-direction: column;
    border-top-right-radius: var(--md-sys-shape-corner-large);
    border-bottom-right-radius: var(--md-sys-shape-corner-large);
    margin-right: 0;
    /* Can separate slightly */
}

.logo {
    display: flex;
    align-items: center;
    height: 56px;
    padding-left: 16px;
    font-size: 1.25rem;
    font-family: 'Google Sans', 'Roboto', sans-serif;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 12px;
}

/* M3 Navigation Drawer Item */
.nav-item {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 24px;
    margin-bottom: 4px;
    /* Gap between items */
    border-radius: var(--md-sys-shape-corner-full);
    /* Pill shape */
    color: var(--md-sys-color-on-surface-variant);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.1px;
    transition: background-color 0.2s, color 0.2s;
}

.nav-item:hover {
    background-color: rgba(29, 25, 43, 0.08);
    /* Stateful layer */
    color: var(--md-sys-color-on-surface);
}

.nav-item.active {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    font-weight: 600;
}

/* Top App Bar */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background-color: var(--md-sys-color-background);
}

.top-bar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background-color: var(--md-sys-color-background);
}

/* Buttons (M3 Filled, Outlined, Text) */
.btn {
    height: 40px;
    padding: 0 24px;
    border-radius: var(--md-sys-shape-corner-full);
    font-family: 'Roboto', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: box-shadow 0.2s, background-color 0.2s;
    gap: 8px;
}

.btn-primary {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.3);
    /* Subtle shadow for filled button */
}

.btn-primary:hover {
    box-shadow: 0px 2px 4px 1px rgba(0, 0, 0, 0.3);
    opacity: 0.92;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-primary);
}

.btn-outline:hover {
    background-color: rgba(103, 80, 164, 0.08);
    /* Primary color opacity */
}

.btn-success {
    background-color: var(--md-sys-color-success);
    color: #ffffff;
}

/* Cards (M3 Elevated Card) */
.dashboard-grid {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 24px;
}

.widget-card {
    background-color: var(--md-sys-color-surface);
    /* Default surface */
    border-radius: var(--md-sys-shape-corner-medium);
    padding: 24px;
    /* M3 standard padding */
    box-shadow: var(--md-sys-elevation-1);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Very subtle border helper */
}

.widget-card:hover {
    box-shadow: var(--md-sys-elevation-2);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    /* More spacing */
}

.widget-title {
    font-size: 1.125rem;
    /* Headline Small approx */
    color: var(--md-sys-color-on-surface);
    font-weight: 500;
}

/* Forms (M3 Text Fields - Outlined) */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
    margin-left: 4px;
}

.form-control {
    width: 100%;
    height: 56px;
    /* M3 Text Field height */
    padding: 8px 16px;
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 4px;
    /* Text fields usually have smaller radius than buttons */
    color: var(--md-sys-color-on-surface);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
}

/* Utilities */
.w-full {
    width: 100%;
}

.active-pulse {
    position: relative;
}

.active-pulse::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--md-sys-color-success);
    border-radius: 50%;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
}