:root {
    /* User Palette Definition */
    --color-morning-sky: #CAE4DB;
    /* Pastel Teal */
    --color-honey: #DCAE1D;
    /* Mustard/Gold */
    --color-cerulean: #00303F;
    /* Dark Blue */
    --color-mist: #7A9D96;
    /* Muted Teal/Green */

    /* Functional Mapping */
    /* Primary: Cerulean for high contrast and strong branding */
    --primary-color: var(--color-cerulean);

    /* Backgrounds */
    --bg-color: #f3f8f7;
    /* Very light mist tint */
    --card-bg: #ffffff;
    --sidebar-bg: var(--color-morning-sky);

    /* Text */
    --text-color: var(--color-cerulean);
    --text-muted: #536b66;
    /* Darker Mist for readability */
    --heading-color: var(--color-cerulean);

    /* UI Elements */
    --border-color: var(--color-mist);
    --input-border: var(--color-mist);
    --input-bg: #ffffff;

    /* States */
    --success-color: #2e7d32;
    --success-bg: #e8f5e9;
    --warning-color: #ed6c02;
    --warning-bg: #fff3e0;
    --danger-color: #d32f2f;
    --danger-bg: #ffebee;

    /* Honey Accent for specific highlights */
    --accent-color: var(--color-honey);

    /* Spacing & Shadows */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;

    --shadow-sm: 0 1px 2px rgba(0, 48, 63, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 48, 63, 0.1), 0 2px 4px -1px rgba(0, 48, 63, 0.06);
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    font-size: 16px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

/* Layout Containers */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    /* Prevent squishing */
}

.main-content {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.8) 0%, rgba(243, 248, 247, 1) 100%);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--heading-color);
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

/* Components: Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    font-size: 0.9rem;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #00232e;
    /* Darker Cerulean */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 48, 63, 0.2);
}

.btn-secondary {
    background-color: white;
    border-color: var(--border-color);
    /* Mist */
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: #f1f5f9;
    border-color: var(--text-muted);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 2px solid var(--input-border);
    /* Mist Color, 2px thick */
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 48, 63, 0.1);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.table th {
    background-color: #f8fafc;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.table tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success {
    background-color: var(--success-bg);
    color: var(--success-color);
}

.badge-warning {
    background-color: var(--warning-bg);
    color: var(--warning-color);
    border: 1px solid var(--color-honey);
}

.badge-danger {
    background-color: var(--danger-bg);
    color: var(--danger-color);
}

.badge-info {
    background-color: #e0f2fe;
    color: #0284c7;
}

/* Navigation */
.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Allow both svg and ion-icon targeting */
.nav-link ion-icon,
.nav-link svg {
    margin-right: 10px;
    font-size: 1.25rem;
    min-width: 24px;
    /* Fix for icon squishing */
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.5);
    /* Semi-transparent white on Morning Sky */
    color: var(--primary-color);
    font-weight: 600;
}

.nav-link.active {
    background-color: #ffffff;
    box-shadow: var(--shadow-sm);
}

/* Login Page */
.login-page {
    background-color: var(--color-morning-sky);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Utilities */
.text-muted {
    color: var(--text-muted);
}

/* Mobile Header & Toggle */
.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--sidebar-bg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin: -2.5rem -2.5rem 1.5rem -2.5rem;
}

.mobile-logo {
    font-weight: 800;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.btn-toggle {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 100;
        width: 260px;
        transition: left 0.3s ease;
        box-shadow: 10px 0 15px -3px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
    }

    .mobile-header {
        display: flex;
    }

    .main-content {
        padding: 1.5rem;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header h1 {
        margin-bottom: 0;
    }

    .card {
        padding: 1.25rem;
    }

    .modal .card {
        margin: 1rem;
        width: auto;
        max-width: calc(100% - 2rem);
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .main-content {
        padding: 1.5rem;
    }

    .mobile-header {
        margin: -1.5rem -1.5rem 1rem -1.5rem;
    }

    .btn {
        width: 100%;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }

    .badge {
        font-size: 0.7rem;
    }
}