/* ============================================
   Team Status Tracker – Custom Styles
   ============================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #6366f1;
    --body-bg: #0b1120;
    --card-bg: #1e293b;
    --card-border: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --accent-blue: #6366f1;
    --accent-purple: #8b5cf6;
    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-green: linear-gradient(135deg, #10b981, #34d399);
    --gradient-yellow: linear-gradient(135deg, #f59e0b, #fbbf24);
    --gradient-red: linear-gradient(135deg, #ef4444, #f87171);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--card-border);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-brand i {
    font-size: 1.5rem;
    -webkit-text-fill-color: var(--accent-blue);
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
    border-left-color: var(--accent-blue);
}

.sidebar-nav li a.active {
    background: var(--sidebar-hover);
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
}

.sidebar-nav li a i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--card-border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.user-info i {
    font-size: 1.2rem;
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 0;
}

.topbar {
    display: flex;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--card-border);
    background: var(--sidebar-bg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.sidebar-toggle {
    color: var(--text-primary);
    text-decoration: none;
}

.page-content {
    padding: 2rem;
}

.flash-container {
    padding: 0 2rem;
    padding-top: 1rem;
}

/* ============================================
   Auth Pages
   ============================================ */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: radial-gradient(ellipse at top, #1e293b 0%, var(--body-bg) 60%);
}

.auth-center-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.75rem;
    color: white;
}

.auth-header h2 {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ============================================
   Status Summary Bar
   ============================================ */
.status-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.summary-online .summary-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.summary-away .summary-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
}

.summary-dnd .summary-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.summary-absent .summary-icon {
    background: rgba(100, 116, 139, 0.15);
    color: #64748b;
}

.summary-total .summary-icon {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-blue);
}

.summary-info {
    display: flex;
    flex-direction: column;
}

.summary-count {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.summary-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* ============================================
   Filter Bar
   ============================================ */
.filter-bar {
    margin-bottom: 1.5rem;
}

.search-input {
    max-width: 320px;
}

.status-filter {
    max-width: 200px;
}

/* ============================================
   Workspace Badge
   ============================================ */
.workspace-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.workspace-badge i {
    color: #e01e5a;
    font-size: 1.1rem;
}

/* ============================================
   Members Grid
   ============================================ */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.member-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.member-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.member-avatar-wrap {
    position: relative;
    margin-bottom: 1rem;
}

.member-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--card-border);
}

.member-avatar-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--sidebar-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-secondary);
    border: 3px solid var(--card-border);
}

.presence-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid var(--card-bg);
}

.presence-dot-lg {
    width: 20px;
    height: 20px;
    border-width: 3px;
}

.presence-active {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.presence-away {
    background-color: var(--accent-yellow);
}

.presence-dnd {
    background-color: var(--accent-red);
}

.presence-absent {
    background-color: #64748b;
}

/* Small presence dot for table rows */
.presence-dot-sm {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
}

.member-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.member-handle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.member-status {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-height: 1.5rem;
}

.status-emoji {
    margin-right: 0.25rem;
}

.member-presence-label {
    margin-top: 0.75rem;
}

.member-card-footer {
    margin-top: auto;
    padding-top: 0.75rem;
}

/* Badges */
.badge-online {
    background: rgba(16, 185, 129, 0.15) !important;
    color: var(--accent-green) !important;
    font-weight: 600;
}

.badge-away {
    background: rgba(245, 158, 11, 0.15) !important;
    color: var(--accent-yellow) !important;
    font-weight: 600;
}

.badge-dnd {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--accent-red) !important;
    font-weight: 600;
}

.badge-absent {
    background: rgba(100, 116, 139, 0.15) !important;
    color: #94a3b8 !important;
    font-weight: 600;
}

/* View Toggle Buttons */
.view-toggle-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.view-toggle-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

.view-toggle-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

.badge-lg {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}

.badge-coming-soon {
    font-size: 0.65rem;
    vertical-align: middle;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ============================================
   Profile Header (Member Detail)
   ============================================ */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
}

.profile-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--card-border);
}

.profile-avatar-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--sidebar-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--text-secondary);
    border: 4px solid var(--card-border);
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.profile-handle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.custom-status-display {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   Activity Summary Cards
   ============================================ */
.activity-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.activity-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease;
}

.activity-card:hover {
    transform: translateY(-2px);
}

.activity-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.activity-active .activity-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.activity-away-card .activity-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
}

.activity-dnd-card .activity-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.activity-first .activity-icon {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-blue);
}

.activity-last .activity-icon {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
}

.activity-detail {
    display: flex;
    flex-direction: column;
}

.activity-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.activity-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   Charts
   ============================================ */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.chart-container {
    position: relative;
    height: 280px;
}

/* ============================================
   Status Log Table
   ============================================ */
.status-log-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
}

.status-log-card .table {
    margin-bottom: 0;
}

.status-log-card .table thead th {
    border-bottom-color: var(--card-border);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-log-card .table td {
    border-bottom-color: var(--card-border);
    vertical-align: middle;
    padding: 0.75rem;
}

/* ============================================
   Date Selector
   ============================================ */
.date-selector .form-control {
    max-width: 200px;
    background: var(--card-bg);
    border-color: var(--card-border);
    color: var(--text-primary);
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--card-bg);
    border: 2px dashed var(--card-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: var(--text-secondary);
}

/* ============================================
   Integrations
   ============================================ */
.integrations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

.integration-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    transition: transform 0.2s ease;
}

.integration-card:hover {
    transform: translateY(-2px);
}

.integration-disabled {
    opacity: 0.7;
}

.integration-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.integration-logo {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.slack-logo {
    background: rgba(224, 30, 90, 0.15);
    color: #e01e5a;
}

.teams-logo {
    background: rgba(80, 90, 250, 0.15);
    color: #505af0;
}

.integration-status {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
}

.integration-status.connected {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.integration-status.disconnected {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.integration-details {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--card-border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.detail-value {
    font-weight: 500;
    font-size: 0.85rem;
}

/* ============================================
   Settings
   ============================================ */
.settings-container {
    max-width: 700px;
}

.settings-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
}

.settings-card-header {
    display: flex;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.15);
}

.settings-card-header i {
    font-size: 1.2rem;
    color: var(--accent-blue);
}

.settings-card-body {
    padding: 1.5rem;
}

.interval-options {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.interval-option {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.interval-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.interval-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.interval-option:hover .interval-content {
    border-color: var(--accent-blue);
}

.interval-option.active .interval-content,
.interval-option input:checked+.interval-content {
    border-color: var(--accent-blue);
    background: rgba(99, 102, 241, 0.1);
}

.interval-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-blue);
}

.interval-unit {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   Form Styling
   ============================================ */
.form-control,
.form-select,
.input-group-text {
    background-color: rgba(0, 0, 0, 0.2);
    border-color: var(--card-border);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    background-color: rgba(0, 0, 0, 0.3);
    border-color: var(--accent-blue);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.15);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: 1rem;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .integrations-grid {
        grid-template-columns: 1fr;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .interval-options {
        flex-direction: column;
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--body-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

.member-card,
.summary-card,
.activity-card,
.chart-card {
    animation: fadeIn 0.3s ease forwards;
}

.members-grid .member-card:nth-child(n) {
    animation-delay: calc(0.05s * var(--i, 0));
}

/* ============================================
   Theme Toggle Button
   ============================================ */
.theme-toggle-btn {
    color: var(--text-secondary);
    font-size: 1.25rem;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.theme-toggle-btn:hover {
    color: var(--accent-yellow);
    background: rgba(245, 158, 11, 0.1);
}

/* ============================================
   Custom Status Badge (Dashboard Cards)
   ============================================ */
.member-custom-status {
    margin-top: 0.5rem;
}

.custom-status-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--text-secondary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-status-filter {
    max-width: 260px;
}

/* ============================================
   Snapshot Picker
   ============================================ */
.snapshot-picker {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.snapshot-picker .form-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.snapshot-picker .form-control {
    max-width: 200px;
}

.snapshot-header h5 {
    color: var(--text-primary);
}

/* ============================================
   Donut Chart + 3-Column Chart Layout
   ============================================ */
.charts-row-3 {
    display: grid;
    grid-template-columns: 280px 1fr 1fr;
    gap: 1.5rem;
}

.chart-container-donut {
    position: relative;
    height: 240px;
}

@media (max-width: 1200px) {
    .charts-row-3 {
        grid-template-columns: 1fr 1fr;
    }

    .charts-row-3 .chart-card:first-child {
        grid-column: 1 / -1;
    }

    .chart-container-donut {
        height: 200px;
        max-width: 300px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .charts-row-3 {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Light Mode Theme
   ============================================ */
body.light-mode {
    --sidebar-bg: #ffffff;
    --sidebar-hover: #f0f5ff;
    --sidebar-active: #6366f1;
    --body-bg: #f0f6ff;
    --card-bg: #ffffff;
    --card-border: #dce5f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
}

body.light-mode .sidebar {
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.06);
}

body.light-mode .sidebar-brand {
    -webkit-text-fill-color: transparent;
}

body.light-mode .sidebar-brand i {
    -webkit-text-fill-color: var(--accent-blue);
}

body.light-mode .sidebar-footer .btn-outline-light {
    color: var(--text-secondary);
    border-color: var(--card-border);
}

body.light-mode .sidebar-footer .btn-outline-light:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

body.light-mode .topbar {
    background: #ffffff;
    border-bottom-color: var(--card-border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

body.light-mode .auth-wrapper {
    background: radial-gradient(ellipse at top, #dbeafe 0%, var(--body-bg) 60%);
}

body.light-mode .auth-card {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.08);
}

body.light-mode .summary-card,
body.light-mode .activity-card,
body.light-mode .chart-card,
body.light-mode .status-log-card,
body.light-mode .member-card,
body.light-mode .snapshot-picker {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body.light-mode .member-card:hover {
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
}

body.light-mode .form-control,
body.light-mode .form-select,
body.light-mode .input-group-text {
    background-color: #f8fafc;
    border-color: var(--card-border);
    color: var(--text-primary);
}

body.light-mode .form-control:focus,
body.light-mode .form-select:focus {
    background-color: #ffffff;
}

body.light-mode .form-control::placeholder {
    color: #94a3b8;
}

body.light-mode .presence-dot {
    border-color: var(--card-bg);
}

body.light-mode .interval-content {
    background: #f8fafc;
}

body.light-mode .integration-details {
    background: #f8fafc;
}

body.light-mode .settings-card-header {
    background: #f8fafc;
}

body.light-mode .empty-state-icon {
    background: #f0f5ff;
    border-color: var(--card-border);
}

body.light-mode ::-webkit-scrollbar-track {
    background: var(--body-bg);
}

body.light-mode ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

body.light-mode .table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: #f8fafc;
    color: var(--text-primary);
}

body.light-mode .custom-status-badge {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.15);
}

/* ============================================
   Timezone Badge
   ============================================ */
.tz-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-blue);
    letter-spacing: 0.3px;
}

body.light-mode .tz-badge {
    background: rgba(99, 102, 241, 0.08);
}

/* ============================================
   Analytics Table
   ============================================ */
.analytics-table {
    font-size: 0.82rem;
    white-space: nowrap;
}

.analytics-table thead th {
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 2;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--card-border);
}

.analytics-table .small-header {
    font-size: 0.68rem;
    font-weight: 600;
}

.analytics-table .sticky-col {
    position: sticky;
    left: 0;
    background: var(--card-bg);
    z-index: 3;
    min-width: 180px;
}

.analytics-table tbody td {
    vertical-align: middle;
    padding: 0.5rem 0.6rem;
}

.analytics-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.analytics-table .border-start {
    border-left: 1px solid var(--card-border) !important;
}

.analytics-info {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

body.light-mode .analytics-table thead th,
body.light-mode .analytics-table .sticky-col {
    background: #ffffff;
}

body.light-mode .analytics-table tbody tr:hover {
    background: #f8faff;
}

body.light-mode .analytics-info {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* ============================================
   Member Card V2 – Info-Rich Layout
   ============================================ */
.member-card-v2 {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 1.25rem;
    transition: all 0.2s ease;
    animation: fadeIn 0.3s ease forwards;
}

.member-card-v2:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.mc-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.mc-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.mc-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--card-border);
}

.mc-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--sidebar-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-secondary);
    border: 2px solid var(--card-border);
}

.mc-avatar-wrap .presence-dot {
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    border-width: 2px;
}

.mc-identity {
    flex: 1;
    min-width: 0;
}

.mc-name-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.mc-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mc-role-badges {
    display: flex;
    gap: 0.25rem;
}

.role-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.role-badge.role-admin {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-blue);
}

.role-badge.role-owner {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
}

.mc-email {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mc-title {
    display: block;
    font-size: 0.78rem;
    color: var(--accent-blue);
    font-weight: 500;
}

.mc-title-unknown {
    color: var(--text-secondary);
    font-weight: 400;
    font-style: italic;
}

.mc-view-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.15s;
    text-decoration: none;
}

.mc-view-btn:hover {
    background: var(--accent-blue);
    color: #fff;
}

.mc-custom-status {
    margin-bottom: 0.5rem;
}

.mc-info-rows {
    border-top: 1px solid var(--card-border);
    padding-top: 0.6rem;
}

.mc-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    font-size: 0.8rem;
}

.mc-info-label {
    color: var(--text-secondary);
}

.mc-info-value {
    font-weight: 500;
    text-align: right;
}

/* ============================================
   Workspace Switcher
   ============================================ */
.ws-switcher {
    position: relative;
}

.ws-switcher-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.ws-switcher-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.ws-switcher-btn .bi-slack {
    color: var(--accent-blue);
}

.ws-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.ws-dot-active {
    background: var(--accent-green);
}

.ws-dot-inactive {
    background: var(--text-secondary);
}

/* ============================================
   Sortable Table Headers
   ============================================ */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.sortable:hover {
    color: var(--accent-blue) !important;
}

.sortable::after {
    content: '⇅';
    margin-left: 4px;
    font-size: 0.7rem;
    opacity: 0.4;
}

.sortable.sort-asc::after {
    content: '▲';
    opacity: 1;
    color: var(--accent-blue);
}

.sortable.sort-desc::after {
    content: '▼';
    opacity: 1;
    color: var(--accent-blue);
}

/* ============================================
   Light Mode Overrides – New Components
   ============================================ */
body.light-mode .member-card-v2 {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-mode .member-card-v2:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

body.light-mode .mc-view-btn {
    background: rgba(0, 0, 0, 0.04);
}

body.light-mode .mc-info-rows {
    border-color: #e2e8f0;
}

body.light-mode .role-badge.role-admin {
    background: rgba(99, 102, 241, 0.08);
}

body.light-mode .role-badge.role-owner {
    background: rgba(139, 92, 246, 0.08);
}

body.light-mode .ws-switcher-btn {
    background: rgba(99, 102, 241, 0.05);
    border-color: #e2e8f0;
}

/* ============================================
   Activity Timeline (Gantt View)
   ============================================ */
.timeline-container {
    overflow-x: auto;
}

.timeline-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.tl-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.tl-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
}

.tl-dot.tl-active {
    background: var(--accent-green);
}

.tl-dot.tl-away {
    background: var(--accent-yellow);
}

.tl-dot.tl-dnd {
    background: var(--accent-red);
}

.timeline-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 2px solid var(--card-border);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.timeline-body {
    max-height: 520px;
    overflow-y: auto;
}

.timeline-row {
    display: flex;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--card-border);
    transition: background 0.15s ease;
}

.timeline-row:hover {
    background: rgba(99, 102, 241, 0.04);
}

.tl-col-date {
    width: 130px;
    min-width: 130px;
    padding-right: 0.75rem;
}

.tl-col-engagement {
    width: 90px;
    min-width: 90px;
    text-align: center;
    padding-right: 0.75rem;
}

.tl-col-bar {
    flex: 1;
    min-width: 300px;
}

.tl-hours {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-secondary);
    padding: 0 2px;
}

.tl-date-label {
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}

.tl-bar-track {
    position: relative;
    height: 26px;
    background: rgba(148, 163, 184, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.tl-gridline {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--card-border);
    opacity: 0.3;
}

.tl-segment {
    position: absolute;
    top: 3px;
    bottom: 3px;
    border-radius: 3px;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
    min-width: 2px;
}

.tl-segment:hover {
    opacity: 0.9;
    transform: scaleY(1.25);
    z-index: 2;
}

.tl-seg-active {
    background: var(--accent-green);
    opacity: 0.75;
}

.tl-seg-away {
    background: var(--accent-yellow);
    opacity: 0.7;
}

.tl-seg-dnd {
    background: var(--accent-red);
    opacity: 0.7;
}

/* ============================================
   Status Change Table – Enhanced
   ============================================ */
.status-change-table tbody tr {
    border-left: 3px solid transparent;
    transition: border-color 0.15s ease;
}

.status-row-active {
    border-left-color: var(--accent-green) !important;
}

.status-row-away {
    border-left-color: var(--accent-yellow) !important;
}

.status-row-dnd {
    border-left-color: var(--accent-red) !important;
}

.duration-cell .fw-medium {
    font-variant-numeric: tabular-nums;
    color: var(--accent-blue);
}

/* ============================================
   Light Mode – Timeline & Status Table
   ============================================ */
body.light-mode .timeline-row:hover {
    background: rgba(99, 102, 241, 0.06);
}

body.light-mode .tl-bar-track {
    background: rgba(0, 0, 0, 0.04);
}

body.light-mode .tl-gridline {
    background: rgba(0, 0, 0, 0.06);
}

/* ============================================
   Date Preset Buttons
   ============================================ */
.date-preset-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    font-size: 0.78rem;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

.date-preset-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-blue);
    background: rgba(99, 102, 241, 0.1);
}

.date-preset-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

/* ============================================
   Rich Timeline Tooltip
   ============================================ */
.tl-tooltip {
    position: absolute;
    z-index: 9999;
    pointer-events: none;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
    font-size: 0.82rem;
    color: #f1f5f9;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    min-width: 180px;
    max-width: 260px;
    transition: opacity 0.15s;
}

.tl-tip-header {
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.tl-tip-row {
    color: var(--text-secondary);
    margin-top: 0.2rem;
    font-size: 0.8rem;
}

.tl-tip-row strong {
    color: #f1f5f9;
}

body.light-mode .tl-tooltip {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(99, 102, 241, 0.25);
    color: #1e293b;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

body.light-mode .tl-tip-header {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .tl-tip-row {
    color: #64748b;
}

body.light-mode .tl-tip-row strong {
    color: #1e293b;
}

body.light-mode .date-preset-btn {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #475569;
}

body.light-mode .date-preset-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(99, 102, 241, 0.08);
}

body.light-mode .date-preset-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

/* ========== User Management ========== */
.user-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
}