* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0c0c1d;
    color: #c8c8d8;
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: 'Barlow Condensed', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.hidden {
    display: none !important;
}

/* ==========================================
   Layout: Sidebar + Content
   ========================================== */
#shell {
    display: flex;
    min-height: 100vh;
}

/* ==========================================
   Sidebar
   ========================================== */
#sidebar {
    width: 220px;
    background: #0f0f22;
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand h1 {
    font-size: 15px;
    font-weight: 600;
    color: #efefef;
    letter-spacing: -0.3px;
}

.sidebar-brand-logo {
    max-width: 120px;
    height: auto;
}

.sidebar-brand span {
    font-size: 11px;
    color: #555570;
    display: block;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: 10px;
    color: #555570;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
    padding: 12px 20px 6px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: #7a7a96;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidebar-item:hover {
    background: rgba(255,255,255,0.04);
    color: #c8c8d8;
}

.sidebar-item.active {
    background: rgba(200, 0, 161, 0.1);
    color: #E840C8;
}

.sidebar-item-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(200, 0, 161, 0.15);
    color: #E840C8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-email {
    font-size: 12px;
    color: #c8c8d8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 10px;
    color: #555570;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sidebar-logout {
    background: none;
    border: none;
    color: #7a7a96;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.12s;
}

.sidebar-logout:hover {
    color: #f87171;
}

/* ==========================================
   Content Area
   ========================================== */
#content-area {
    flex: 1;
    min-height: 100vh;
    margin-left: 0;
    transition: margin-left 0.2s ease;
}

#content-area.with-sidebar {
    margin-left: 220px;
}

/* ==========================================
   Login View (shown in content area when not authed)
   ========================================== */
#login-view {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    max-width: 380px;
    width: 100%;
    padding: 36px 32px;
    background: #141428;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    text-align: center;
}

.login-logo {
    max-width: 180px;
    height: auto;
    margin-bottom: 16px;
}

.login-container h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #efefef;
    letter-spacing: -0.3px;
}

.login-container > p {
    color: #7a7a96;
    margin-bottom: 28px;
    font-size: 13px;
}

.divider {
    display: flex;
    align-items: center;
    margin: 18px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.divider span {
    padding: 0 14px;
    color: #555570;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#magic-link-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#email-input {
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255,255,255,0.04);
    color: #e0e0e0;
    transition: border-color 0.15s;
}

#email-input:focus {
    outline: none;
    border-color: rgba(200, 0, 161, 0.5);
}

#email-input::placeholder {
    color: #555570;
}

#login-error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid rgba(239, 68, 68, 0.15);
    font-size: 13px;
}

/* ==========================================
   Shared Buttons
   ========================================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Barlow Condensed', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.btn-primary {
    background: #C800A1;
    color: white;
}

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

.btn-secondary {
    background: rgba(255,255,255,0.06);
    color: #c8c8d8;
    border: 1px solid rgba(255,255,255,0.08);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
}

.btn-success {
    background: #22c55e;
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-disabled {
    background: rgba(255,255,255,0.04);
    color: #555570;
    cursor: not-allowed;
}

.btn-small {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-action {
    padding: 5px 14px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.2px;
    font-family: 'Barlow Condensed', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.btn-action-primary {
    background: #C800A1;
    color: white;
}

.btn-action-primary:hover {
    background: #AD008C;
}

.btn-action-success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.btn-action-success:hover {
    background: rgba(34, 197, 94, 0.25);
}

.btn-action-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.btn-action-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-action-muted {
    background: rgba(255,255,255,0.04);
    color: #555570;
    cursor: not-allowed;
}

/* ==========================================
   Shared Modal styles
   ========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: #141428;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 28px;
    width: 100%;
    max-width: 420px;
}

.modal-wide {
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #efefef;
    letter-spacing: -0.2px;
}

.modal-subtitle {
    font-size: 13px;
    color: #7a7a96;
    margin-bottom: 20px;
}

.modal-subtitle strong {
    color: #c8c8d8;
}

.modal-section {
    margin-bottom: 18px;
}

.modal-section h4 {
    font-size: 11px;
    color: #555570;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: #7a7a96;
    margin-bottom: 4px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    font-size: 13px;
    background: rgba(255,255,255,0.04);
    color: #e0e0e0;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: rgba(200, 0, 161, 0.5);
}

.form-group input::placeholder {
    color: #555570;
}

.form-group select {
    cursor: pointer;
}

.form-group select option {
    background: #141428;
    color: #e0e0e0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.modal-wide::-webkit-scrollbar {
    width: 6px;
}

.modal-wide::-webkit-scrollbar-track {
    background: transparent;
}

.modal-wide::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

/* ==========================================
   Mobile hamburger button
   ========================================== */
.mobile-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 200;
    background: #C800A1;
    border: none;
    color: white;
    font-size: 22px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(200, 0, 161, 0.4);
}

/* ==========================================
   Responsive — Mobile (< 768px)
   ========================================== */
@media (max-width: 768px) {
    /* Hide sidebar by default, slide in when .open */
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        width: 260px;
    }

    #sidebar.open {
        transform: translateX(0);
    }

    /* No margin on content area — full width */
    #content-area.with-sidebar {
        margin-left: 0;
    }

    /* Show hamburger */
    .mobile-toggle {
        display: flex;
    }

    /* Login centering — full screen, no sidebar offset */
    #login-view {
        padding: 20px;
    }

    .login-container {
        max-width: 100%;
        padding: 28px 20px;
    }

    /* Modals — full width on mobile */
    .modal {
        max-width: calc(100% - 32px);
        padding: 20px;
        margin: 0 16px;
    }

    .modal-wide {
        max-width: calc(100% - 32px);
    }

    /* Overlay for sidebar on mobile */
    #sidebar.open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 260px;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
    }
}
