:root {
    /* Color Palette derived from green-to-blue gradient image */
    --primary-color: #156f91;
    /* Darkest Blue-Teal (Rightmost) */
    --primary-hover: #105a76;
    /* Hover state */

    --secondary-color: #64748b;
    --background-color: #f6fdfa;
    /* Very light cool green tint */

    --card-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --sidebar-hover: #e4f5cc;
    /* Light Lime (Leftmost) - hover background */

    --text-main: #1e293b;
    --text-muted: #475569;
    --border-color: #cbd5e1;
    /* Neutral border to balance the colors */

    --danger-color: #ef4444;
    --success-color: #56c0a5;
    /* Medium Teal-Green (Middle) */

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-main);
    line-height: 1.5;
    /* padding-bottom removed for sidebar layout */
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout Utilities */
.container {
    padding: 1rem;
    width: 100%;
    margin: 0 auto;
}

/* If existing container style is needed, we can override or keep it simpler */

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

/* Sidebar Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: margin-left 0.3s ease-in-out;
    flex-shrink: 0;
}

/* Collapsed State (Desktop) */
body.sidebar-collapsed .sidebar {
    margin-left: -250px;
}

.sidebar-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
}

.sidebar-links a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    gap: 1rem;
}

.sidebar-links a:hover,
.sidebar-links a.active {
    background-color: var(--sidebar-hover);
    color: var(--primary-color);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--background-color);
}

/* Top Bar for Mobile */
/* Top Bar (Always Visible now, but styled for layout) */
.top-bar {
    display: flex;
    background: var(--primary-color);
    padding: 0.25rem 1rem;
    border-bottom: 1px solid var(--primary-hover);
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 900;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0.5rem;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: white;
    border-radius: 2px;
}

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 990;
    backdrop-filter: blur(2px);
}

/* Base Components (Cards, Buttons, etc from previous style.css) */
.card {
    background: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    text-decoration: none;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #cbd5e1;
    text-decoration: none;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
}

.btn-outline {
    background-color: white;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}

.btn-outline-success {
    background-color: white;
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.btn-outline-success:hover {
    background-color: #f0fdf4;
}

.btn-outline-secondary {
    background-color: white;
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-outline-secondary:hover {
    background-color: #f1f5f9;
}

.p-3 {
    padding: 0.75rem !important;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
}

/* Responsive Logic */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        margin-left: 0;
        /* Reset desktop collapse margin */
        transition: transform 0.3s ease-in-out;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .mobile-only {
        display: block;
    }

    /* On mobile, collapse class does nothing to margin, standard active class handles it */
    body.sidebar-collapsed .sidebar {
        margin-left: 0;
    }

    /* Responsive Tables */
    .table-responsive-stack thead {
        display: none;
    }

    .table-responsive-stack tr {
        display: flex;
        flex-direction: column;
        border: 1px solid var(--border-color);
        margin-bottom: 1rem;
        border-radius: 0.5rem;
        background: white;
    }

    .table-responsive-stack td {
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid #f1f5f9;
        font-size: 0.95rem;
    }

    .table-responsive-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        margin-right: 1rem;
    }

    .table-responsive-stack td:last-child {
        border-bottom: none;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.mobile-only {
    display: none;
}

@media (min-width: 769px) {
    .grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .grid-3 {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 1rem;
    }

    .grid-4 {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }
}

/* Tabs */
.tabs {
    display: flex;
    gap: 2rem;
    border-bottom: 2px solid #eee;
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.5rem 0;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab.active {
    color: var(--danger-color);
    border-bottom-color: var(--danger-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Input Groups */
.input-group {
    display: flex;
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-append {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-left: none;
    padding: 0.5rem;
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
    display: flex;
    align-items: center;
    color: var(--text-muted);
}

/* Switch, Modal, Toggle Utils from previous file... */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    vertical-align: middle;
    margin: 0 8px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #2563eb;
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 800px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: #f9f9f9;
}

.toggle-switch {
    display: inline-flex;
    background: #e2e8f0;
    border-radius: 20px;
    padding: 2px;
    position: relative;
    cursor: pointer;
    vertical-align: middle;
}

.toggle-option {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 2;
    transition: color 0.3s;
}

.toggle-option.active-blue {
    background: var(--primary-color);
    color: white;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
}