:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    --bg-color: #f8fafc;
    /* Fallback/Solid */
    --card-bg: rgba(255, 255, 255, 0.95);
    --component-bg: #ffffff;
    /* For sidebar, header */
    --secondary-bg: #f8fafc;
    /* For result column/contrast */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --input-bg: #ffffff;
    --border-color: #e2e8f0;
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] {
    --primary-color: #6366f1;
    /* Brighter for dark mode */
    --primary-hover: #818cf8;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --component-bg: #1e293b;
    --secondary-bg: #0f172a;
    /* Darker than component for contrast areas */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --input-bg: #1e293b;
    --border-color: #334155;
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
}

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    padding: 2.5rem;
    border-radius: 1.5rem;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-premium);
    text-align: center;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #4f46e5, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

/* Dashboard Layout */
/* Dashboard Layout */
.dashboard-container {

    position: relative;
    background-color: var(--bg-color);
    padding-top: 64px;
    /* Account for fixed header */
}

.sidebar {
    width: 250px;
    height: calc(100vh - 64px);
    /* Full height minus header */
    position: fixed;
    top: 64px;
    /* Start below header */
    left: 0;
    background-color: var(--component-bg);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow-y: auto;
}

/* ... logo ... */

.sidebar-logo {
    display: none;
    /* Logo moved to header */
}

/* ... header styles ... */
.app-header {
    height: 64px;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 20;
    background: var(--component-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    color: var(--text-primary);
}

.header-left .header-logo {
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, #2563EB 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ... nav ... */

.nav-menu {
    list-style: none;
    flex: 1;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-menu ul {
    list-style: none;
    padding-left: 0;
}

.nav-item {
    margin-bottom: 0.25rem;
}

/* Sidebar Separator for Parent Items */
.nav-menu>ul>.nav-item {
    border-bottom: 1px solid #aaaaaa;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.nav-menu>ul>.nav-item:last-child {
    border-bottom: none;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 500;
    cursor: pointer;
    font-size: 15px;
    /* Main items slightly larger */
}

.nav-link:hover,
.nav-link.active {
    background-color: #F1F5F9;
    color: var(--primary-color);
}

/* Submenu Styles */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding-left: 1rem;
    /* Indent sub-items */
}

.submenu.open {
    max-height: 500px;
    /* Arbitrary large height for animation */
}

.nav-item.has-submenu>.nav-link::after {
    content: '›';
    font-size: 1.2rem;
    transition: transform 0.2s;
    margin-left: 0.5rem;
    line-height: 1;
}

.nav-item.has-submenu.expanded>.nav-link::after {
    transform: rotate(90deg);
}

/* Specific style to make submenu items smaller/distinct if needed */
.submenu .nav-link {
    font-size: 13px;
    /* Smaller than main items */
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    justify-content: flex-start;
    /* Left align only */
}

.submenu .nav-link::before {
    content: '- ';
    margin-right: 0.5rem;
    color: var(--text-secondary);
}

.nav-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.logout-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.2s;
}

.logout-btn:hover {
    background-color: #FEF2F2;
}

.main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
    padding: 0;
    /* Remove padding here, move to content wrapper */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-content-wrapper {
    padding: 2rem;
    flex: 1;
}


.user-email {
    color: var(--text-secondary);
}

.separator {
    margin: 0 1rem;
    color: var(--border-color);
}

.logout-link {
    color: #ef4444;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}

.logout-link:hover {
    color: #dc2626;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Tables */
.table-container {
    background: var(--component-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--bg-color);
    /* Slightly different than component bg */
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    color: var(--text-primary);
}

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

h1 {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 400;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0 1rem;
    transition: all 0.3s ease;
}

.input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.input-group input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.75rem 0.5rem;
    font-size: 1rem;
    width: 100%;
    outline: none;
}

.input-group .email-suffix {
    color: var(--text-secondary);
    font-weight: 500;
    padding-right: 0.5rem;
    user-select: none;
}

.submit-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.submit-btn:active {
    transform: translateY(0);
}