@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
    --bg: #0a0a0b;
    --surface: #111114;
    --surface-2: #18181c;
    --border: #262628;
    --text: #f0f0f0;
    --text-muted: #666670;
    --accent: #e8ff47;
    --accent-dim: #e8ff4720;
    --danger: #ff4444;
    --warning: #ff9500;
    --success: #00c896;
    --sidebar-width: 240px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'DM Sans', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.sidebar .logo img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.sidebar .logo h1 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.02em;
}

.sidebar-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.toggle-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#nav-buttons {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.sidebar button {
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    letter-spacing: 0.01em;
}

.sidebar button:hover {
    background-color: var(--surface-2);
    color: var(--text);
}

.sidebar button.active {
    background-color: var(--accent-dim);
    color: var(--accent);
}

#btn-logout {
    margin-top: auto !important;
    color: var(--danger) !important;
    opacity: 0.7;
}

#btn-logout:hover {
    opacity: 1;
    background-color: #ff444415 !important;
}

/* ===== SWITCH TOGGLE ===== */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border);
    border-radius: 20px;
    cursor: pointer;
    transition: 0.2s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    border-radius: 50%;
    transition: 0.2s;
}

input:checked + .slider { background-color: var(--accent); }
input:checked + .slider:before {
    transform: translateX(16px);
    background-color: #000;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    max-width: 1200px;
}

/* ===== ROLE BANNER ===== */
#user-role-banner {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* ===== DASHBOARD SECTIONS ===== */
.dashboard-section h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

/* ===== LOGIN ===== */
#login {
    max-width: 400px;
    margin: 80px auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
}

#login h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 28px;
    color: var(--text);
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    opacity: 0.4;
}

.stat-number {
    font-family: 'DM Mono', monospace;
    font-size: 36px;
    font-weight: 500;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ===== LIST ITEMS ===== */
.list-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color 0.15s ease;
}

.list-item:hover {
    border-color: #333336;
}

.list-item strong {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.list-item span {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== BADGES ===== */
.stage-badge {
    display: inline-block;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    width: fit-content;
}

.wait-badge {
    display: inline-block;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    background: #ff950015;
    border: 1px solid #ff950040;
    color: var(--warning);
    width: fit-content;
}

/* ===== SCROLL BOX ===== */
.scroll-box {
    max-height: 500px;
    overflow-y: auto;
}

.scroll-box::-webkit-scrollbar {
    width: 4px;
}

.scroll-box::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-box::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    transition: border-color 0.15s ease;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
}

select option {
    background: var(--surface-2);
    color: var(--text);
}

/* ===== BUTTONS ===== */
button {
    background-color: var(--accent);
    color: #000;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.15s ease;
    letter-spacing: 0.02em;
}

button:hover {
    opacity: 0.85;
}

/* ===== SECTION HEADERS ===== */
.dashboard-section h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
    margin-top: 0;
}

/* ===== DARK MODE (already dark by default, this handles the toggle) ===== */
body.dark {
    --bg: #0a0a0b;
    --surface: #111114;
    --surface-2: #18181c;
    --text: #f0f0f0;
}

body:not(.dark) {
    --bg: #f4f4f6;
    --surface: #ffffff;
    --surface-2: #f0f0f3;
    --border: #e0e0e4;
    --text: #0a0a0b;
    --text-muted: #888890;
    --dark-bg: #f4f4f6;
    --dark-card: #ffffff;
}

/* ===== UTILITY ===== */
p {
    color: var(--text-muted);
    font-size: 13px;
}

h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
}

.filter-btn {
    padding: 6px 14px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.active-filter {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    font-weight: 600;
}

/* ===== MOBILE ===== */
#mobile-menu-btn {
    display: none; /* hidden on desktop */
}

@media (max-width: 768px) {

    /* Hide sidebar, show top bar instead */
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow: visible;
        z-index: 1000;
    }

    .sidebar .logo {
        padding: 0;
        border: none;
        margin: 0;
    }

    #nav-buttons {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 12px;
        z-index: 999;
    }

    #nav-buttons.mobile-open {
        display: flex;
    }

    .sidebar-section {
        display: none;
    }

    #mobile-menu-btn {
        display: flex;
        background: transparent;
        border: none;
        color: var(--text);
        font-size: 22px;
        cursor: pointer;
        padding: 4px 8px;
    }

    .main-content {
        margin-left: 0;
        margin-top: 56px;
        padding: 20px 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .scroll-box {
        max-height: none;
    }

    input[type="text"],
    input[type="password"],
    input[type="datetime-local"],
    select, textarea {
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    button {
        width: 100%;
        padding: 14px;
        font-size: 15px;
    }

    .filter-btn {
        width: auto;
        padding: 8px 12px;
    }
}