﻿/**
 * easyMember 2.0 - Modern Bootstrap 5 Design System
 * WCAG 2.0 AA Compliant
 */

/* Prevent horizontal overflow globally */
* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

:root {
    /* Brand Colors - easyMember Brand Guidelines */
    /* PrimÃ¤ra fÃ¤rger: #202942 (mÃ¶rk blÃ¥) och #FFFFFF (vit) */
    --em-primary: #202942;
    --em-primary-dark: #151d33;
    --em-primary-light: #2F55D4;
    --em-primary-gradient: linear-gradient(135deg, #202942 0%, #2F55D4 100%);
    /* Alternativa fÃ¤rger: #2F55D4 (ljusare blÃ¥) och #F6F7FA (mycket ljus grÃ¥) */
    --em-accent: #2F55D4;
    --em-accent-hover: #2544b0;
    --em-accent-gradient: linear-gradient(135deg, #2F55D4 0%, #202942 100%);

    /* Vibrant Colors - Updated to match brand */
    --em-purple: #8b5cf6;
    --em-pink: #ec4899;
    --em-orange: #f97316;
    --em-teal: #14b8a6;
    --em-indigo: #2F55D4;
    --em-cyan: #2F55D4;

    /* Neutral Colors - Updated for WCAG 2.0 AA compliance */
    --em-white: #ffffff;
    --em-gray-50: #F6F7FA;
    --em-gray-100: #f1f5f9;
    --em-gray-200: #e2e8f0;
    --em-gray-300: #cbd5e1;
    --em-gray-400: #64748b;
    --em-gray-500: #475569;
    --em-gray-600: #334155;
    --em-gray-700: #1e293b;
    --em-gray-800: #1a2235;
    --em-gray-900: #202942;

    /* Semantic Colors - More Vibrant */
    --em-success: #10b981;
    --em-success-light: #d1fae5;
    --em-info: #2F55D4;
    --em-info-light: #e8edff;
    --em-warning: #f59e0b;
    --em-warning-light: #fef3c7;
    --em-danger: #ef4444;
    --em-danger-light: #fee2e2;

    /* Spacing */
    --em-spacing-xs: 0.25rem;
    --em-spacing-sm: 0.5rem;
    --em-spacing-md: 1rem;
    --em-spacing-lg: 1.5rem;
    --em-spacing-xl: 2rem;
    --em-spacing-xxl: 3rem;

    /* Typography */
    --em-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --em-font-size-base: 0.9375rem;
    --em-font-size-sm: 0.875rem;
    --em-font-size-lg: 1.125rem;
    --em-line-height-base: 1.6;

    /* Shadows */
    --em-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --em-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --em-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --em-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Transitions */
    --em-transition: all 0.2s ease-in-out;

    /* Border Radius */
    --em-radius-sm: 0.375rem;
    --em-radius-md: 0.5rem;
    --em-radius-lg: 0.75rem;

    /* Semantic Surface & Text Colors (Light Theme) */
    --em-surface: var(--em-white);
    --em-surface-2: var(--em-gray-50);
    --em-surface-3: var(--em-gray-100);
    --em-surface-elevated: var(--em-white);
    --em-surface-overlay: rgba(255, 255, 255, 0.9);
    --em-surface-sunken: var(--em-gray-50);
    --em-text: var(--em-gray-900);
    --em-text-muted: var(--em-gray-500);
    --em-text-subtle: var(--em-gray-400);
    --em-border: var(--em-gray-200);
    --em-border-strong: var(--em-gray-300);

    /* Accent Card Colors â€” theme-aware */
    --em-accent-purple-bg: linear-gradient(135deg, rgba(237, 233, 254, 0.5) 0%, rgba(221, 214, 254, 0.5) 100%);
    --em-accent-purple-border: #8b5cf6;
    --em-accent-cyan-bg: linear-gradient(135deg, rgba(207, 250, 254, 0.5) 0%, rgba(165, 243, 252, 0.5) 100%);
    --em-accent-cyan-border: #06b6d4;
    --em-accent-warning-bg: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    --em-accent-warning-border: #f59e0b;
    --em-accent-danger-bg: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    --em-accent-danger-border: #f87171;
    --em-accent-success-bg: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    --em-accent-success-border: #10b981;

    /* Sidebar-specific */
    --em-sidebar-bg: #202942;
    --em-sidebar-hover: rgba(255, 255, 255, 0.08);
    --em-sidebar-active: rgba(47, 85, 212, 0.15);
    --em-sidebar-border: rgba(255, 255, 255, 0.06);

    /* Supermodern sidebar tokens */
    --em-sidebar-item-radius: 8px;
    --em-sidebar-item-mx: 8px;
    --em-sidebar-item-px: 12px;
    --em-sidebar-active-bg: rgba(47, 85, 212, 0.08);
    --em-sidebar-active-text: #2F55D4;
    --em-sidebar-active-icon-bg: rgba(47, 85, 212, 0.12);
    --em-sidebar-hover-bg: rgba(0, 0, 0, 0.03);
    --em-sidebar-heading-color: var(--em-gray-400);
    --em-sidebar-sublink-indicator: var(--em-gray-300);
    --em-sidebar-transition-speed: 180ms;
    --em-sidebar-transition-fn: cubic-bezier(0.4, 0, 0.2, 1);
    --em-sidebar-submenu-bg: rgba(0, 0, 0, 0.015);

    /* Theme transition */
    --em-theme-transition: background-color 0.3s ease, color 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Base Styles */
html {
    overflow-x: hidden;
}

body,
.em-v2-body {
    font-family: var(--em-font-family);
    font-size: var(--em-font-size-base);
    line-height: var(--em-line-height-base);
    color: var(--em-gray-900);
    background-color: var(--em-gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Main Wrapper */
.em-v2-wrapper {
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */

/* Sidebar */
.em-v2-sidebar {
    width: 260px;
    min-width: 260px;
    background: var(--em-surface);
    border-right: 1px solid var(--em-border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    z-index: 1000;
    transition: width var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn),
                transform 0.3s ease;
    box-shadow: none;
}

/* Custom thin scrollbar */
.em-v2-sidebar::-webkit-scrollbar {
    width: 4px;
}
.em-v2-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.em-v2-sidebar::-webkit-scrollbar-thumb {
    background: var(--em-gray-300);
    border-radius: 4px;
}
.em-v2-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--em-gray-400);
}
.em-v2-sidebar {
    scrollbar-width: thin;
    scrollbar-color: var(--em-gray-300) transparent;
}

.em-v2-sidebar.collapsed {
    width: 80px;
    min-width: 80px;
}

.em-v2-sidebar.collapsed .em-v2-nav-link {
    padding: 0 var(--em-spacing-md);
    margin: 1px 4px;
    justify-content: center;
}

/* Desktop hover expand (only on desktop) */
@media (min-width: 992px) {
    .em-v2-sidebar.collapsed:hover {
        width: 260px;
        min-width: 260px;
        z-index: 1001;
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.08), 1px 0 0 var(--em-border);
    }

    .em-v2-sidebar.collapsed:hover .em-v2-nav-link {
        padding: 0 var(--em-sidebar-item-px);
        margin: 1px var(--em-sidebar-item-mx);
        justify-content: flex-start;
    }

    .em-v2-sidebar.collapsed:hover .em-v2-nav-icon {
        margin-right: 10px;
        width: 20px;
        min-width: 20px;
    }

    .em-v2-sidebar.collapsed:hover .em-v2-nav-text {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        width: auto;
        overflow: visible;
    }

    .em-v2-sidebar.collapsed:hover .em-v2-nav-chevron {
        opacity: 0.7;
        visibility: visible;
        pointer-events: auto;
        width: auto;
        min-width: 12px;
    }

    .em-v2-sidebar.collapsed:hover .em-v2-nav-sub-chevron {
        opacity: 0.6;
        visibility: visible;
        pointer-events: auto;
        width: auto;
        min-width: auto;
        overflow: visible;
    }

    .em-v2-sidebar.collapsed:hover .em-v2-nav-heading {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        height: auto;
        min-height: auto;
        padding: 20px 20px 6px;
        overflow: visible;
    }
}

.em-v2-sidebar-nav {
    padding: 8px 0;
}

.em-v2-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.em-v2-nav-item {
    margin: 0;
    padding: 0;
    list-style: none;
}

.em-v2-nav-heading {
    padding: 20px 20px 6px;
    min-height: auto;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--em-sidebar-heading-color);
    transition: opacity 0.3s ease;
    box-sizing: border-box;
    margin: 0;
    user-select: none;
}

.em-v2-nav-list > .em-v2-nav-heading:first-child {
    padding-top: 12px;
}

.em-v2-sidebar.collapsed .em-v2-nav-heading {
    opacity: 0;
    visibility: hidden;
    height: 0;
    min-height: 0;
    padding: 0 20px;
    margin: 0;
    pointer-events: none;
    overflow: hidden;
}

.em-v2-nav-link {
    display: flex;
    align-items: center;
    padding: 0 var(--em-sidebar-item-px);
    margin: 1px var(--em-sidebar-item-mx);
    min-height: 36px;
    height: 36px;
    color: var(--em-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--em-sidebar-item-radius);
    border-left: none;
    position: relative;
    box-sizing: border-box;
    transition: background-color var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn),
                color var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn),
                box-shadow var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn);
}

.em-v2-nav-link:hover {
    background-color: var(--em-sidebar-hover-bg);
    color: var(--em-text);
}

.em-v2-nav-link.active {
    background-color: var(--em-sidebar-active-bg);
    color: var(--em-sidebar-active-text);
    font-weight: 600;
    border-left: none;
}

.em-v2-nav-link.active::before {
    display: none;
}

.em-v2-nav-link.active .em-v2-nav-icon {
    color: var(--em-sidebar-active-text);
    opacity: 1;
}

.em-v2-nav-icon {
    width: 20px;
    min-width: 20px;
    text-align: center;
    margin-right: 10px;
    font-size: 1rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: color var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn),
                opacity var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn);
}

.em-v2-nav-link:hover .em-v2-nav-icon {
    opacity: 0.9;
}

.em-v2-sidebar.collapsed .em-v2-nav-icon {
    margin-right: 0;
}

.em-v2-nav-text {
    flex: 1;
    transition: opacity 0.3s ease;
}

.em-v2-sidebar.collapsed .em-v2-nav-text {
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}

.em-v2-nav-chevron {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn),
                opacity var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn),
                color var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn);
    width: auto;
    min-width: 12px;
    opacity: 0.5;
    padding: 2px;
}

.em-v2-nav-link:hover .em-v2-nav-chevron {
    opacity: 1;
}

.em-v2-sidebar.collapsed .em-v2-nav-chevron,
.em-v2-sidebar.collapsed .em-v2-nav-sub-chevron {
    opacity: 0;
    visibility: hidden;
    width: 0;
    min-width: 0;
    overflow: hidden;
    pointer-events: none;
}

.em-v2-nav-item-dropdown.open .em-v2-nav-chevron {
    transform: rotate(180deg);
}

.em-v2-nav-link-dropdown {
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
}

/* Dropdown hover: accent chevron signals expandability */
.em-v2-nav-link-dropdown:hover .em-v2-nav-chevron {
    opacity: 1;
    color: var(--em-sidebar-active-text);
}

/* Open dropdown: parent stays highlighted */
.em-v2-nav-item-dropdown.open > .em-v2-nav-link-dropdown {
    color: var(--em-text);
    background-color: var(--em-sidebar-hover-bg);
}

.em-v2-nav-item-dropdown.open > .em-v2-nav-link-dropdown .em-v2-nav-icon {
    opacity: 0.9;
}

.em-v2-nav-item-dropdown.open > .em-v2-nav-link-dropdown .em-v2-nav-chevron {
    opacity: 0.8;
}

.em-v2-nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s var(--em-sidebar-transition-fn),
                opacity 0.2s var(--em-sidebar-transition-fn);
    opacity: 0;
}

.em-v2-nav-item-dropdown.open .em-v2-nav-submenu {
    max-height: 500px;
    opacity: 1;
}

/* Submenu visual container - subtle background + connector line */
.em-v2-nav-item-dropdown.open > .em-v2-nav-submenu {
    background: var(--em-sidebar-submenu-bg);
    border-radius: 0 0 var(--em-sidebar-item-radius) var(--em-sidebar-item-radius);
    padding: 4px 0;
    margin: 0 4px 4px;
    position: relative;
}

.em-v2-nav-item-dropdown.open > .em-v2-nav-submenu::before {
    content: '';
    position: absolute;
    left: calc(var(--em-sidebar-item-mx) + 30px + 1px);
    top: 4px;
    bottom: 4px;
    width: 1px;
    background: var(--em-sidebar-sublink-indicator);
    opacity: 0.5;
}

.em-v2-sidebar.collapsed .em-v2-nav-submenu {
    display: none !important;
}

/* Prevent submenus from showing on hover when collapsed */
@media (min-width: 992px) {
    .em-v2-sidebar.collapsed .em-v2-nav-submenu {
        display: none !important;
    }

    /* Allow submenus to show when hovered and expanded */
    .em-v2-sidebar.collapsed:hover .em-v2-nav-item-dropdown.open .em-v2-nav-submenu {
        display: block !important;
    }
}

.em-v2-nav-subitem {
    margin: 0;
}

.em-v2-nav-sublink {
    display: flex;
    align-items: center;
    padding: 5px 12px 5px 8px;
    margin: 0 var(--em-sidebar-item-mx) 0 calc(var(--em-sidebar-item-mx) + 30px);
    color: var(--em-text-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 400;
    border-radius: 6px;
    position: relative;
    transition: background-color var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn),
                color var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn);
}

.em-v2-nav-sublink::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--em-sidebar-sublink-indicator);
    margin-right: 10px;
    flex-shrink: 0;
    transition: background-color var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn),
                transform var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn);
}

.em-v2-nav-sublink:hover {
    background-color: var(--em-sidebar-hover-bg);
    color: var(--em-text);
}

.em-v2-nav-sublink:hover::before {
    background: var(--em-text-muted);
    transform: scale(1.3);
}

.em-v2-nav-sublink.active {
    color: var(--em-sidebar-active-text);
    font-weight: 500;
    background-color: transparent;
}

.em-v2-nav-sublink.active::before {
    background: var(--em-sidebar-active-text);
    transform: scale(1.3);
}

/* Nested dropdowns in submenu */
.em-v2-nav-subitem-dropdown {
    position: relative;
}

.em-v2-nav-sublink-dropdown {
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    padding: 5px 12px 5px 8px;
    margin: 0 var(--em-sidebar-item-mx) 0 calc(var(--em-sidebar-item-mx) + 30px);
    color: var(--em-text-muted);
    font-size: 0.8125rem;
    font-weight: 400;
    border-radius: 6px;
    transition: background-color var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn),
                color var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn);
}

.em-v2-nav-sublink-dropdown::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--em-sidebar-sublink-indicator);
    margin-right: 10px;
    flex-shrink: 0;
}

.em-v2-nav-sublink-dropdown:hover {
    background-color: var(--em-sidebar-hover-bg);
    color: var(--em-text);
}

/* Sub-dropdown chevron arrow */
.em-v2-nav-sub-chevron {
    margin-left: 6px;
    flex-shrink: 0;
    font-size: 0.65rem;
    line-height: 1;
    color: var(--em-text-muted);
    opacity: 0.6;
    transition: transform var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn),
                opacity var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn);
}

.em-v2-nav-sublink-dropdown:hover > .em-v2-nav-sub-chevron {
    opacity: 1;
}

.em-v2-nav-subitem-dropdown.open > .em-v2-nav-sublink-dropdown > .em-v2-nav-sub-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

/* Open sub-dropdown: parent highlight */
.em-v2-nav-subitem-dropdown.open > .em-v2-nav-sublink-dropdown {
    color: var(--em-text);
    font-weight: 500;
}

/* Level 3 nested submenu */
.em-v2-nav-subitem-dropdown .em-v2-nav-submenu {
    padding-left: 12px;
    margin-top: 0;
    max-height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    transition: max-height 0.25s var(--em-sidebar-transition-fn),
                opacity 0.2s var(--em-sidebar-transition-fn);
    display: none;
}

.em-v2-nav-subitem-dropdown.open .em-v2-nav-submenu {
    max-height: 500px !important;
    opacity: 1 !important;
    display: block !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}

/* Level 3 sublinks get a smaller dot */
.em-v2-nav-subitem-dropdown .em-v2-nav-submenu .em-v2-nav-sublink::before {
    width: 3px;
    height: 3px;
}

/* Section dividers */
.em-v2-nav-divider {
    height: 1px;
    background: var(--em-border);
    margin: 4px 20px 0;
    list-style: none;
    opacity: 0.5;
}

.em-v2-sidebar.collapsed .em-v2-nav-divider {
    margin: 4px 8px 0;
}

/* Sidebar Header (Mobile) */
.em-v2-sidebar-header {
    background: var(--em-surface);
}

/* Sidebar Close Button (Mobile) */
.em-v2-sidebar-close {
    color: var(--em-gray-700);
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--em-radius-sm);
    transition: var(--em-transition);
}

.em-v2-sidebar-close:hover {
    color: var(--em-primary);
    background-color: var(--em-gray-100);
}

/* Sidebar Toggle Button */
.em-v2-sidebar-toggle {
    padding: 6px;
    color: var(--em-text-muted);
    border: none;
    background: none;
    font-size: 1.125rem;
    transition: color var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn),
                background-color var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn);
    cursor: pointer;
    border-radius: var(--em-sidebar-item-radius);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.em-v2-sidebar-toggle:hover {
    color: var(--em-text);
    background-color: var(--em-sidebar-hover-bg);
}

/* Mobile Sidebar */
@media (max-width: 991.98px) {
    .em-v2-sidebar {
        transform: translateX(-100%) !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        z-index: 1051 !important;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        height: 100dvh !important;
    }

    .em-v2-sidebar.show {
        transform: translateX(0) !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 1051 !important;
    }

    /* Ignore collapsed class on mobile */
    .em-v2-sidebar.collapsed {
        width: 100% !important;
        min-width: 100% !important;
        transform: translateX(-100%) !important;
    }

    .em-v2-sidebar.collapsed.show {
        transform: translateX(0) !important;
        display: block !important;
        visibility: visible !important;
    }

    /* Show all text and elements on mobile */
    .em-v2-sidebar .em-v2-nav-text,
    .em-v2-sidebar .em-v2-nav-chevron,
    .em-v2-sidebar .em-v2-nav-heading {
        opacity: 1 !important;
        visibility: visible !important;
        width: auto !important;
        overflow: visible !important;
    }

    .em-v2-sidebar .em-v2-nav-heading {
        height: auto !important;
        min-height: auto !important;
        padding: 20px 20px 6px !important;
    }

    .em-v2-sidebar .em-v2-nav-icon {
        margin-right: 10px !important;
    }

    /* Pill margins for mobile full-width */
    .em-v2-sidebar .em-v2-nav-link {
        margin: 1px 12px !important;
    }

    .em-v2-sidebar .em-v2-nav-sublink,
    .em-v2-sidebar .em-v2-nav-sublink-dropdown {
        margin-left: calc(12px + 30px) !important;
        margin-right: 12px !important;
    }

    .em-v2-main {
        margin-left: 0 !important;
    }

    .em-v2-sidebar-backdrop {
        z-index: 1040 !important;
        display: block !important;
    }
}

/* Main Content Area */
.em-v2-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    margin-left: 260px;
    transition: margin-left 0.3s ease;
}


.em-v2-sidebar.collapsed ~ .em-v2-main {
    margin-left: 80px;
}

/* Initial paint: apply collapsed layout from html attribute (set in head) to avoid content shift on load */
@media (min-width: 992px) {
    [data-sidebar-collapsed="true"] .em-v2-sidebar {
        width: 80px;
        min-width: 80px;
    }
    [data-sidebar-collapsed="true"] .em-v2-main {
        margin-left: 80px;
    }
}

@media (max-width: 991.98px) {
    .em-v2-main {
        margin-left: 0 !important;
    }
}

/* Header */
.em-v2-header {
    background: var(--em-white);
    border-bottom: 1px solid var(--em-gray-200);
    padding: var(--em-spacing-md) var(--em-spacing-lg);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--em-shadow-xs);
    backdrop-filter: blur(10px);
}

.em-v2-header-content {
    max-width: 100%;
}

.em-v2-header-toggle {
    padding: var(--em-spacing-sm);
    color: var(--em-gray-700);
    border: none;
    background: none;
    font-size: 1.25rem;
    transition: var(--em-transition);
}

.em-v2-header-toggle:hover {
    color: var(--em-primary);
    background-color: var(--em-gray-100);
}

.em-v2-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.em-v2-header-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
    padding: 0.25rem 0;
}

.em-v2-header-logo:hover {
    opacity: 0.8;
}

.em-v2-header-logo img {
    height: 28px;
    width: auto;
    display: block;
}

/* Logo theme switching */
.em-v2-header-logo .em-logo-light,
.em-v2-footer-logo .em-logo-light {
    display: block;
}

.em-v2-header-logo .em-logo-dark,
.em-v2-footer-logo .em-logo-dark {
    display: none;
}

[data-theme="dark"] .em-v2-header-logo .em-logo-light,
[data-theme="dark"] .em-v2-footer-logo .em-logo-light {
    display: none;
}

[data-theme="dark"] .em-v2-header-logo .em-logo-dark,
[data-theme="dark"] .em-v2-footer-logo .em-logo-dark {
    display: block;
}

.em-v2-page-title {
    font-size: 1.75rem;
    font-weight: 800;
    background: var(--em-primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: -0.02em;
}

.em-v2-header-right {
    gap: var(--em-spacing-sm);
}

/* Header Buttons - Consistent Styling */
.em-v2-header-right .btn,
.em-v2-header-right .btn-outline-secondary,
.em-v2-header-right .em-v2-user-dropdown-btn {
    height: 36px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--em-radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    line-height: 1;
    border: 1px solid var(--em-gray-300);
    background: var(--em-white);
    color: var(--em-gray-700);
    transition: all 0.2s ease;
}

.em-v2-header-right .btn:hover,
.em-v2-header-right .btn-outline-secondary:hover {
    background: var(--em-gray-50);
    border-color: var(--em-gray-400);
    color: var(--em-gray-900);
}

.em-v2-header-right .btn:focus,
.em-v2-header-right .btn-outline-secondary:focus {
    box-shadow: 0 0 0 3px rgba(32, 41, 66, 0.1);
    outline: none;
}

/* Header Search */
.em-v2-header-search {
    position: relative;
    display: flex;
    align-items: center;
    height: 36px;
    width: 220px;
    background: var(--em-white);
    border: 1px solid var(--em-gray-300);
    border-radius: var(--em-radius-md);
    padding: 0 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.em-v2-header-search:focus-within {
    border-color: var(--em-primary);
    box-shadow: 0 0 0 3px rgba(47, 85, 212, 0.1);
}

.em-v2-header-search-icon {
    color: var(--em-gray-400);
    font-size: 0.875rem;
    flex-shrink: 0;
    margin-right: 0.5rem;
}

.em-v2-header-search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.875rem;
    color: var(--em-gray-700);
    width: 100%;
    cursor: text;
    font-weight: 400;
}

.em-v2-header-search-input::placeholder {
    color: var(--em-gray-400);
}

/* Header Search Dropdown */
.em-v2-header-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 300px;
    background: var(--em-white);
    border: 1px solid var(--em-gray-200);
    border-radius: var(--em-radius-lg);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    z-index: 1050;
    overflow: hidden;
}

.em-v2-header-search-item {
    display: block;
    padding: 0.625rem 0.75rem;
    text-decoration: none;
    color: var(--em-gray-700);
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--em-gray-100);
}

.em-v2-header-search-item:last-of-type {
    border-bottom: none;
}

.em-v2-header-search-item:hover {
    background: var(--em-gray-50);
    color: var(--em-primary);
    text-decoration: none;
}

.em-v2-header-search-item-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.em-v2-header-search-item-meta {
    font-size: 0.75rem;
    color: var(--em-gray-500);
    margin-top: 0.125rem;
}

.em-v2-header-search-empty {
    padding: 1rem;
    text-align: center;
    color: var(--em-gray-400);
    font-size: 0.875rem;
}

.em-v2-header-search-more {
    padding: 0.5rem 0.75rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--em-gray-400);
    background: var(--em-gray-50);
    border-top: 1px solid var(--em-gray-100);
}

/* Content */
.em-v2-content {
    padding: var(--em-spacing-xl);
    flex: 1;
    background: linear-gradient(180deg, var(--em-gray-50) 0%, var(--em-white) 100%);
    min-height: calc(100vh - 140px);
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

/* Footer */
.em-v2-footer {
    background: linear-gradient(135deg, var(--em-gray-50) 0%, var(--em-white) 100%);
    border-top: 1px solid var(--em-gray-200);
    padding: var(--em-spacing-md) var(--em-spacing-lg);
    margin-top: auto;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.03);
}

.em-v2-footer-content {
    font-size: 0.8125rem;
    color: var(--em-gray-600);
}

.em-v2-footer-left {
    flex-wrap: wrap;
    justify-content: center;
}

.em-v2-footer-logo {
    display: inline-flex;
    align-items: center;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    text-decoration: none;
}

.em-v2-footer-logo:hover {
    opacity: 1;
}

.em-v2-footer-logo img {
    height: 24px;
    width: auto;
}

.em-v2-footer-version {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.em-v2-footer-dev-info {
    color: var(--em-gray-500);
    font-size: 0.75rem;
}

.em-v2-footer-version-text {
    color: var(--em-gray-600);
}

.em-v2-footer-version-text strong {
    color: var(--em-gray-700);
    font-weight: 600;
}

.em-v2-footer-right {
    flex-wrap: wrap;
    justify-content: center;
}

.em-v2-footer-copyright {
    color: var(--em-gray-600);
}

.em-v2-footer-separator {
    color: var(--em-gray-400);
    font-size: 0.75rem;
}

/* Diskret sidladdningstid fÃ¶r personal (easyMember) */
.em-v2-footer-load-time {
    font-size: 0.75rem;
    color: var(--em-gray-500);
    margin-left: 0.2rem;
}

.em-v2-footer-link {
    color: var(--em-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.em-v2-footer-link:hover {
    color: var(--em-primary-dark);
    text-decoration: underline;
}

/* Theme Toggle Button */
.em-v2-theme-toggle {
    position: relative;
    width: 36px;
    padding: 0.5rem !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    /* Base surface palette â€” 5 levels of depth */
    --em-dark-base: #0c1222;
    --em-dark-surface-1: #131b2e;
    --em-dark-surface-2: #1a2340;
    --em-dark-surface-3: #212d4a;
    --em-dark-surface-4: #2a3755;

    /* Map existing gray scale to dark palette */
    --em-white: var(--em-dark-base);
    --em-gray-50: var(--em-dark-surface-1);
    --em-gray-100: var(--em-dark-surface-2);
    --em-gray-200: var(--em-dark-surface-3);
    --em-gray-300: #3d4f6f;
    --em-gray-400: #8896b3;
    --em-gray-500: #a8b5cc;
    --em-gray-600: #c4cee0;
    --em-gray-700: #dbe3f0;
    --em-gray-800: #edf1f7;
    --em-gray-900: #f8fafc;

    /* Surfaces */
    --em-surface: var(--em-dark-surface-1);
    --em-surface-2: var(--em-dark-surface-2);
    --em-surface-3: var(--em-dark-surface-3);
    --em-surface-elevated: var(--em-dark-surface-2);
    --em-surface-overlay: rgba(19, 27, 46, 0.95);
    --em-surface-sunken: var(--em-dark-base);

    /* Text â€” better hierarchy, WCAG 2.0 AA compliant */
    --em-text: #edf1f7;
    --em-text-muted: #96a3bd;
    --em-text-subtle: #a8b5cc;

    /* Borders â€” subtle but visible */
    --em-border: rgba(255, 255, 255, 0.08);
    --em-border-strong: rgba(255, 255, 255, 0.15);

    /* Primary â€” brighter in dark mode for contrast */
    --em-primary: #4a73f5;
    --em-primary-dark: #3d63e0;
    --em-primary-light: #6b8ff7;
    --em-primary-gradient: linear-gradient(135deg, #4a73f5 0%, #2a4cc7 100%);
    --em-accent: #4a73f5;
    --em-accent-hover: #3d63e0;
    --em-accent-gradient: linear-gradient(135deg, #4a73f5 0%, #2a4cc7 100%);

    /* Semantic â€” brighter variants for dark backgrounds */
    --em-success: #34d399;
    --em-success-light: rgba(52, 211, 153, 0.12);
    --em-info: #38bdf8;
    --em-info-light: rgba(56, 189, 248, 0.12);
    --em-warning: #fbbf24;
    --em-warning-light: rgba(251, 191, 36, 0.12);
    --em-danger: #fb7185;
    --em-danger-light: rgba(251, 113, 133, 0.12);

    /* Shadows â€” deeper and more dramatic */
    --em-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --em-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    --em-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --em-shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5);

    /* Accent cards â€” colorful but adapted for dark background */
    --em-accent-purple-bg: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(124, 58, 237, 0.1) 100%);
    --em-accent-purple-border: #a78bfa;
    --em-accent-cyan-bg: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(8, 145, 178, 0.1) 100%);
    --em-accent-cyan-border: #22d3ee;
    --em-accent-warning-bg: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(245, 158, 11, 0.1) 100%);
    --em-accent-warning-border: #fbbf24;
    --em-accent-danger-bg: linear-gradient(135deg, rgba(251, 113, 133, 0.15) 0%, rgba(239, 68, 68, 0.1) 100%);
    --em-accent-danger-border: #fca5a5;
    --em-accent-success-bg: linear-gradient(135deg, rgba(52, 211, 153, 0.15) 0%, rgba(16, 185, 129, 0.1) 100%);
    --em-accent-success-border: #6ee7b7;

    /* Sidebar â€” distinct from content area */
    --em-sidebar-bg: #0a0f1e;
    --em-sidebar-hover: rgba(74, 115, 245, 0.1);
    --em-sidebar-active: rgba(74, 115, 245, 0.18);
    --em-sidebar-border: rgba(255, 255, 255, 0.04);

    /* Supermodern sidebar tokens (dark) */
    --em-sidebar-active-bg: rgba(74, 115, 245, 0.12);
    --em-sidebar-active-text: #6b8ff7;
    --em-sidebar-active-icon-bg: rgba(74, 115, 245, 0.18);
    --em-sidebar-hover-bg: rgba(255, 255, 255, 0.04);
    --em-sidebar-heading-color: #6b7a99;
    --em-sidebar-sublink-indicator: rgba(255, 255, 255, 0.1);
    --em-sidebar-submenu-bg: rgba(255, 255, 255, 0.02);
}

/* Accent Card System â€” theme-aware */
.em-accent-card {
    transition: var(--em-theme-transition), transform 0.2s ease;
    border-color: transparent !important;
}
.em-accent-card--purple  { background: var(--em-accent-purple-bg);  border-left: 3px solid var(--em-accent-purple-border) !important; }
.em-accent-card--cyan    { background: var(--em-accent-cyan-bg);    border-left: 3px solid var(--em-accent-cyan-border) !important; }
.em-accent-card--warning { background: var(--em-accent-warning-bg); border-left: 3px solid var(--em-accent-warning-border) !important; }
.em-accent-card--danger  { background: var(--em-accent-danger-bg);  border-left: 3px solid var(--em-accent-danger-border) !important; }
.em-accent-card--success { background: var(--em-accent-success-bg); border-left: 3px solid var(--em-accent-success-border) !important; }

/* Dark theme accent card text colors */
[data-theme="dark"] .em-accent-card .fw-semibold,
[data-theme="dark"] .em-accent-card .fw-bold,
[data-theme="dark"] .em-accent-card p {
    color: var(--em-text);
}

[data-theme="dark"] .em-accent-card .text-muted {
    color: var(--em-text-muted) !important;
}

/* Smooth theme transition */
html.em-theme-transitioning,
html.em-theme-transitioning *,
html.em-theme-transitioning *::before,
html.em-theme-transitioning *::after {
    transition: background-color 0.4s ease, color 0.3s ease,
                border-color 0.4s ease, box-shadow 0.4s ease,
                fill 0.4s ease, stroke 0.4s ease !important;
    transition-delay: 0s !important;
}

/* Dark Theme Styles */
[data-theme="dark"] {
    color-scheme: dark;
}

[data-theme="dark"] .em-v2-body {
    background-color: var(--em-dark-base) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-v2-header {
    background: var(--em-surface-elevated) !important;
    border-bottom-color: var(--em-border) !important;
    color: var(--em-text) !important;
    box-shadow: 0 1px 0 var(--em-border), var(--em-shadow-sm);
}

[data-theme="dark"] .em-v2-content {
    background: linear-gradient(180deg, var(--em-dark-base) 0%, var(--em-dark-surface-1) 100%) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-v2-footer {
    background: linear-gradient(135deg, var(--em-dark-surface-1) 0%, var(--em-dark-base) 100%) !important;
    border-top-color: var(--em-border) !important;
    color: var(--em-text-subtle) !important;
}

[data-theme="dark"] .em-dashboard-widget {
    background: var(--em-surface-elevated) !important;
    border: none !important;
    box-shadow: var(--em-shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
    color: var(--em-text) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

[data-theme="dark"] .em-dashboard-widget:hover {
    box-shadow: var(--em-shadow-lg) !important;
    transform: translateY(-1px);
}

[data-theme="dark"] .em-dashboard-widget-header {
    background: transparent !important;
    border-bottom-color: var(--em-border) !important;
}

[data-theme="dark"] .em-dashboard-widget-title {
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-dashboard-widget-body {
    background: var(--em-surface-elevated) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .card {
    background: var(--em-dark-surface-2) !important;
    border-color: var(--em-border) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .table {
    color: var(--em-text) !important;
    background-color: transparent !important;
}

[data-theme="dark"] .table thead th {
    background: linear-gradient(135deg, var(--em-dark-surface-3) 0%, var(--em-dark-surface-2) 100%) !important;
    color: var(--em-text) !important;
    border-bottom-color: var(--em-border) !important;
}

[data-theme="dark"] .table tbody td {
    color: var(--em-text) !important;
    background-color: transparent !important;
    border-bottom-color: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .table tbody th {
    color: var(--em-text) !important;
    background-color: transparent !important;
    border-bottom-color: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .table tbody tr {
    background-color: transparent !important;
}

[data-theme="dark"] .table tbody tr:hover {
    background-color: var(--em-dark-surface-3) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--em-dark-base) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) th {
    background-color: var(--em-dark-base) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd):hover {
    background-color: var(--em-dark-surface-3) !important;
    color: var(--em-text) !important;
}

/* Dark Theme - Table Contextual Classes */
[data-theme="dark"] .table-danger,
[data-theme="dark"] .table-danger > th,
[data-theme="dark"] .table-danger > td {
    background-color: var(--em-danger-light) !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .table-danger a {
    color: #fee2e2 !important;
}

[data-theme="dark"] .table-danger a:hover {
    color: #ffffff !important;
}

/* Light mode - table-warning */
.table-warning,
.table-warning > th,
.table-warning > td {
    background-color: #fef3c7 !important;
    color: #78350f !important;
    border-color: rgba(245, 158, 11, 0.2) !important;
}

.table-warning a:not(.btn) {
    color: #78350f !important;
    font-weight: 600;
}

.table-warning a:not(.btn):hover {
    color: #451a03 !important;
}

.table-warning .btn-outline-light {
    border-color: #78350f !important;
    color: #78350f !important;
    background-color: transparent !important;
}

.table-warning .btn-outline-light:hover {
    background-color: #78350f !important;
    color: #ffffff !important;
}

/* Dark mode - table-warning */
[data-theme="dark"] .table-warning,
[data-theme="dark"] .table-warning > th,
[data-theme="dark"] .table-warning > td {
    background-color: rgba(251, 191, 36, 0.2) !important;
    color: #fef3c7 !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
}

[data-theme="dark"] .table-warning th {
    background-color: rgba(251, 191, 36, 0.2) !important;
    color: #fef3c7 !important;
}

[data-theme="dark"] .table-warning a:not(.btn) {
    color: #fef3c7 !important;
    font-weight: 600;
}

[data-theme="dark"] .table-warning a:not(.btn):hover {
    color: #ffffff !important;
}

[data-theme="dark"] .table-warning .btn-outline-light {
    border-color: #fef3c7 !important;
    color: #fef3c7 !important;
    background-color: transparent !important;
}

[data-theme="dark"] .table-warning .btn-outline-light:hover {
    background-color: rgba(254, 243, 199, 0.2) !important;
    border-color: #ffffff !important;
    color: #ffffff !important;
}

[data-theme="dark"] .table-success,
[data-theme="dark"] .table-success > th,
[data-theme="dark"] .table-success > td {
    background-color: var(--em-success-light) !important;
    color: #6ee7b7 !important;
}

[data-theme="dark"] .table-info,
[data-theme="dark"] .table-info > th,
[data-theme="dark"] .table-info > td {
    background-color: var(--em-info-light) !important;
    color: #67e8f9 !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: var(--em-dark-surface-3) !important;
    border-color: var(--em-border-strong) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background: var(--em-dark-surface-3) !important;
    border-color: var(--em-primary) !important;
    color: var(--em-text) !important;
    box-shadow: 0 0 0 3px rgba(74, 115, 245, 0.15) !important;
}

[data-theme="dark"] .em-v2-header-right .btn,
[data-theme="dark"] .em-v2-header-right .btn-outline-secondary {
    background: var(--em-gray-50);
    border-color: var(--em-gray-300);
    color: var(--em-gray-900);
}

[data-theme="dark"] .em-v2-header-right .btn:hover,
[data-theme="dark"] .em-v2-header-right .btn-outline-secondary:hover {
    background: var(--em-gray-100);
    border-color: var(--em-primary);
    color: var(--em-primary);
}

[data-theme="dark"] .em-v2-user-dropdown-menu {
    background: var(--em-gray-50);
    border-color: var(--em-gray-200);
}

[data-theme="dark"] .em-v2-user-dropdown-header {
    background: linear-gradient(135deg, var(--em-gray-100) 0%, var(--em-gray-50) 100%);
}

[data-theme="dark"] .em-v2-user-dropdown-item {
    color: var(--em-gray-900);
}

[data-theme="dark"] .em-v2-user-dropdown-item:hover {
    background: linear-gradient(135deg, rgba(32, 41, 66, 0.1) 0%, rgba(47, 85, 212, 0.1) 100%);
}

[data-theme="dark"] .em-v2-user-dropdown-email {
    color: var(--em-gray-600);
}

[data-theme="dark"] .em-v2-user-dropdown-heading {
    color: var(--em-gray-500);
}

[data-theme="dark"] .em-v2-user-dropdown-theme-row {
    color: var(--em-gray-800);
}

[data-theme="dark"] .em-v2-theme-switch {
    background: var(--em-gray-200);
}

[data-theme="dark"] .em-v2-theme-switch-btn {
    color: var(--em-gray-600);
}

[data-theme="dark"] .em-v2-theme-switch-btn:hover {
    color: var(--em-gray-800);
}

[data-theme="dark"] .em-v2-theme-switch-btn.active {
    background: var(--em-gray-300);
    color: var(--em-gray-900);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .em-has-brand-accent .em-v2-user-dropdown-avatar-wrapper {
    box-shadow: 0 0 0 2px var(--em-gray-100), 0 0 0 3.5px var(--em-brand-accent);
}

[data-theme="dark"] .em-v2-header-search {
    background: var(--em-gray-50);
    border-color: var(--em-gray-300);
}

[data-theme="dark"] .em-v2-header-search:focus-within {
    border-color: var(--em-primary);
    background: var(--em-gray-100);
}

[data-theme="dark"] .em-v2-header-search-input {
    color: var(--em-gray-900);
}

[data-theme="dark"] .em-v2-header-search-input::placeholder {
    color: var(--em-gray-400);
}

[data-theme="dark"] .em-v2-header-search-dropdown {
    background: var(--em-gray-50);
    border-color: var(--em-gray-200);
}

[data-theme="dark"] .em-v2-header-search-item {
    color: var(--em-gray-900);
    border-bottom-color: var(--em-gray-200);
}

[data-theme="dark"] .em-v2-header-search-item:hover {
    background: var(--em-gray-100);
}

[data-theme="dark"] .em-v2-header-search-more {
    background: var(--em-gray-100);
    border-top-color: var(--em-gray-200);
}

[data-theme="dark"] .em-v2-member-search-modal {
    background: var(--em-gray-50);
}

[data-theme="dark"] .em-v2-member-search-body {
    background: var(--em-gray-50);
}

[data-theme="dark"] .em-v2-member-search-input-group {
    background: var(--em-gray-100);
    border-color: var(--em-gray-300);
}

[data-theme="dark"] .em-v2-member-search-input {
    background: transparent;
    color: var(--em-gray-900);
}

[data-theme="dark"] .em-v2-member-search-table-container {
    background: var(--em-gray-50);
    border-color: var(--em-gray-200);
}

[data-theme="dark"] .em-v2-member-search-table thead {
    background: linear-gradient(135deg, var(--em-gray-100) 0%, var(--em-gray-50) 100%);
}

[data-theme="dark"] .em-v2-member-search-table thead th {
    color: var(--em-gray-700);
    border-bottom-color: var(--em-gray-200);
}

[data-theme="dark"] .em-v2-member-search-table tbody td {
    color: var(--em-gray-900);
    border-bottom-color: var(--em-gray-200);
}

/* Dark theme pagination buttons */
[data-theme="dark"] .em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .paginate_button,
[data-theme="dark"] #memberSearchModal .dataTables_wrapper .dataTables_paginate .paginate_button {
    background: transparent;
    border-color: transparent;
    color: var(--em-gray-400);
}

[data-theme="dark"] .em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled):not(.current),
[data-theme="dark"] #memberSearchModal .dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled):not(.current) {
    background: var(--em-gray-200);
    border-color: transparent;
    color: var(--em-gray-300);
}

[data-theme="dark"] .em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .paginate_button.current,
[data-theme="dark"] #memberSearchModal .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--em-gray-300);
    color: var(--em-gray-100);
    border-color: transparent;
}

[data-theme="dark"] .em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
[data-theme="dark"] #memberSearchModal .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    background: transparent;
    border-color: transparent;
    color: var(--em-gray-600);
    opacity: 0.3;
}

[data-theme="dark"] .em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .ellipsis,
[data-theme="dark"] #memberSearchModal .dataTables_wrapper .dataTables_paginate .ellipsis {
    color: var(--em-gray-500);
}

[data-theme="dark"] .em-v2-modal-content {
    background: var(--em-gray-50);
}

[data-theme="dark"] .em-v2-modal-header {
    background: linear-gradient(135deg, var(--em-gray-100) 0%, var(--em-gray-50) 100%);
    border-bottom-color: var(--em-gray-200);
}

[data-theme="dark"] .em-v2-modal-title {
    color: var(--em-gray-900);
}

[data-theme="dark"] .em-v2-modal-body {
    background: var(--em-gray-50);
}

[data-theme="dark"] .em-v2-modal-message {
    color: var(--em-gray-900);
}

[data-theme="dark"] .em-v2-modal-footer {
    background: var(--em-gray-100);
    border-top-color: var(--em-gray-200);
}

/* Dark Theme - Bootstrap Modals */
[data-theme="dark"] .modal-content {
    background-color: var(--em-dark-surface-2) !important;
    border-color: var(--em-border) !important;
    color: var(--em-text) !important;
    box-shadow: var(--em-shadow-lg) !important;
}

[data-theme="dark"] .modal-header {
    background-color: var(--em-dark-surface-1) !important;
    border-bottom-color: var(--em-border) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .modal-title {
    color: var(--em-text) !important;
}

[data-theme="dark"] .modal-body {
    background-color: var(--em-dark-surface-2) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .modal-footer {
    background-color: var(--em-dark-surface-1) !important;
    border-top-color: var(--em-border) !important;
}

[data-theme="dark"] .modal .card {
    background-color: var(--em-dark-surface-1) !important;
    border-color: var(--em-border) !important;
}

[data-theme="dark"] .modal .card-body {
    background-color: var(--em-dark-surface-1) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .modal .form-check-label {
    color: var(--em-text) !important;
}

[data-theme="dark"] .modal .text-muted {
    color: var(--em-text-muted) !important;
}

[data-theme="dark"] .modal .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Dark Theme - Text Colors */
[data-theme="dark"] .text-muted {
    color: var(--em-gray-500) !important;
}

[data-theme="dark"] .text-secondary {
    color: var(--em-gray-500) !important;
}

[data-theme="dark"] .text-dark {
    color: var(--em-gray-900) !important;
}

[data-theme="dark"] .text-light {
    color: var(--em-gray-300) !important;
}

/* Dark Theme - Badges */
[data-theme="dark"] .badge {
    color: var(--em-white);
}

[data-theme="dark"] .badge.bg-danger {
    background: var(--em-danger) !important;
}

[data-theme="dark"] .badge.bg-success {
    background: var(--em-success) !important;
}

[data-theme="dark"] .badge.bg-warning {
    background: var(--em-warning) !important;
    color: var(--em-gray-900);
}

[data-theme="dark"] .badge.bg-info {
    background: var(--em-info) !important;
}

[data-theme="dark"] .badge.bg-primary {
    background: var(--em-primary) !important;
}

/* Dark Theme - Alerts */
[data-theme="dark"] .alert {
    background: var(--em-gray-100);
    border-color: var(--em-gray-300);
    color: var(--em-gray-900);
}

[data-theme="dark"] .alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--em-success);
    color: var(--em-success);
}

[data-theme="dark"] .alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--em-danger);
    color: var(--em-danger);
}

[data-theme="dark"] .alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--em-warning);
    color: var(--em-warning);
}

[data-theme="dark"] .alert-info {
    background: rgba(47, 85, 212, 0.1);
    border-color: var(--em-info);
    color: var(--em-info);
}

/* Dark Theme - Buttons */
[data-theme="dark"] .btn-primary {
    background: var(--em-primary) !important;
    border-color: var(--em-primary) !important;
    color: white !important;
}

[data-theme="dark"] .btn-primary:hover {
    background: var(--em-primary-dark) !important;
    border-color: var(--em-primary-dark) !important;
    color: white !important;
}

[data-theme="dark"] .btn-success {
    background: linear-gradient(135deg, var(--em-success) 0%, #059669 100%) !important;
    border-color: transparent !important;
    color: white !important;
}

[data-theme="dark"] .btn-success:hover {
    background: linear-gradient(135deg, #4ade80 0%, var(--em-success) 100%) !important;
    color: white !important;
}

[data-theme="dark"] .btn-info {
    background: var(--em-primary-gradient) !important;
    border-color: transparent !important;
    color: white !important;
}

[data-theme="dark"] .btn-info:hover {
    background: linear-gradient(135deg, var(--em-primary-dark) 0%, var(--em-primary) 100%) !important;
    color: white !important;
}

[data-theme="dark"] .btn-outline-secondary {
    border-color: var(--em-gray-300);
    color: var(--em-text-subtle);
}

[data-theme="dark"] .btn-outline-primary {
    border-color: var(--em-primary) !important;
    color: var(--em-primary) !important;
}

[data-theme="dark"] .btn-outline-primary:hover {
    background: var(--em-primary) !important;
    border-color: var(--em-primary) !important;
    color: white !important;
}

[data-theme="dark"] .btn-outline-secondary:hover {
    background: var(--em-dark-surface-4);
    border-color: var(--em-gray-300);
    color: var(--em-text);
}

/* Dark Theme - btn-alt-primary (OneUI style button) */
[data-theme="dark"] .btn-alt-primary {
    background-color: rgba(74, 115, 245, 0.1) !important;
    border-color: rgba(74, 115, 245, 0.25) !important;
    color: var(--em-primary-light) !important;
}

[data-theme="dark"] .btn-alt-primary:hover {
    background-color: rgba(74, 115, 245, 0.2) !important;
    border-color: rgba(74, 115, 245, 0.4) !important;
    color: var(--em-primary) !important;
}

[data-theme="dark"] .btn-alt-primary i {
    color: var(--em-primary-light) !important;
}

[data-theme="dark"] .btn-alt-primary:hover i {
    color: #a5b4fc !important;
}

/* Dark Theme - Page Title */
[data-theme="dark"] .em-v2-page-title {
    color: var(--em-gray-900);
}

/* Dark Theme - Footer */
[data-theme="dark"] .em-v2-footer-content {
    color: var(--em-gray-500);
}

[data-theme="dark"] .em-v2-footer-version-text {
    color: var(--em-gray-500);
}

[data-theme="dark"] .em-v2-footer-version-text strong {
    color: var(--em-gray-600);
}

[data-theme="dark"] .em-v2-footer-copyright {
    color: var(--em-gray-500);
}

[data-theme="dark"] .em-v2-footer-link {
    color: var(--em-primary-light);
}

[data-theme="dark"] .em-v2-footer-link:hover {
    color: var(--em-primary);
}

[data-theme="dark"] .em-v2-footer-load-time {
    color: var(--em-gray-500);
    opacity: 0.6;
}

/* Dark Theme - Member Search Modal Header */
[data-theme="dark"] .em-v2-member-search-header {
    background: linear-gradient(135deg, #202942 0%, #2F55D4 100%);
}

/* Dark Theme - KPI Widget */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="kpi_members"] .table {
    color: var(--em-gray-900);
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="kpi_members"] .table td {
    color: var(--em-gray-900);
}

/* Dark Theme - System Log Widget */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="system_log"] .table thead {
    background: linear-gradient(135deg, var(--em-gray-100) 0%, var(--em-gray-50) 100%);
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="system_log"] .table thead th {
    color: var(--em-gray-700);
    border-bottom-color: var(--em-gray-200);
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="system_log"] .table tbody td {
    color: var(--em-gray-900);
    border-bottom-color: var(--em-gray-200);
}

/* Dark Theme - Latest Activity Widget */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="latest_members_activity"] .em-dashboard-widget-body {
    background: var(--em-gray-50);
}

/* Dark Theme - New Members Registered Widget */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="new_members_registered"] .em-dashboard-widget-body {
    background: var(--em-gray-50);
}

/* Dark Theme - Select Dropdowns */
[data-theme="dark"] .form-select {
    background-color: var(--em-gray-50);
    border-color: var(--em-gray-300);
    color: var(--em-gray-900);
}

[data-theme="dark"] .form-select:focus {
    background-color: var(--em-gray-50);
    border-color: var(--em-primary);
    color: var(--em-gray-900);
}

/* Dark Theme - Chart Container */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="members_chart"] .em-dashboard-widget-body {
    background: var(--em-gray-50);
}

/* Dark Theme - Welcome Banner (if exists) */
[data-theme="dark"] .bg-primary,
[data-theme="dark"] .bg-gradient {
    background: var(--em-primary-gradient) !important;
}

/* Dark Theme - Border Colors */
[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-start,
[data-theme="dark"] .border-end {
    border-color: var(--em-gray-200) !important;
}

/* Dark Theme - Background Colors */
[data-theme="dark"] .bg-white {
    background-color: var(--em-gray-50) !important;
}

[data-theme="dark"] .bg-light {
    background-color: var(--em-gray-100) !important;
}

[data-theme="dark"] .bg-body {
    background-color: var(--em-gray-50) !important;
}

[data-theme="dark"] .bg-body-light {
    background-color: var(--em-gray-100) !important;
}

/* Dark Theme - Additional Widget Styling */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="tasks_and_alerts"] .em-dashboard-widget-body {
    background: var(--em-gray-50);
    color: var(--em-gray-900);
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="tasks_and_alerts"] .text-muted {
    color: var(--em-gray-500) !important;
}

/* Dark Theme - Activity Cards */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="latest_members_activity"] .rounded-3 {
    background: var(--em-gray-100) !important;
    border-color: var(--em-gray-200) !important;
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="latest_members_activity"] .text-muted {
    color: var(--em-gray-500) !important;
}

/* Dark Theme - New Members Registered Cards â€” retain vibrancy */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="new_members_registered"] .rounded-3 {
    opacity: 0.92;
}

/* Dark Theme - Dropdown Menus */
[data-theme="dark"] .dropdown-menu {
    background: var(--em-dark-surface-2);
    border-color: var(--em-border);
    box-shadow: var(--em-shadow-lg);
}

[data-theme="dark"] .dropdown-item {
    color: var(--em-text);
}

[data-theme="dark"] .dropdown-item:hover {
    background: var(--em-dark-surface-3);
    color: var(--em-text);
}

[data-theme="dark"] .dropdown-divider {
    border-color: var(--em-border);
}

/* Dark Theme - Input Groups */
[data-theme="dark"] .input-group-text {
    background: var(--em-dark-surface-3);
    border-color: var(--em-border-strong);
    color: var(--em-text-subtle);
}

/* Dark Theme - Links */
[data-theme="dark"] a {
    color: var(--em-primary-light);
}

[data-theme="dark"] a:hover {
    color: var(--em-primary);
}

/* Dark Theme - Small Text */
[data-theme="dark"] small {
    color: var(--em-gray-500);
}

/* Dark Theme - Strong/Bold Text */
[data-theme="dark"] strong {
    color: var(--em-gray-900);
}

/* Dark Theme - Horizontal Rules */
[data-theme="dark"] hr {
    border-color: var(--em-gray-200);
    opacity: 0.5;
}

/* Dark Theme - Code/Pre */
[data-theme="dark"] code,
[data-theme="dark"] pre {
    background: var(--em-gray-100);
    color: var(--em-gray-900);
}

/* Dark Theme - Blockquotes */
[data-theme="dark"] blockquote {
    border-left-color: var(--em-gray-300);
    color: var(--em-gray-700);
}

/* Dark Theme - Welcome Banner */
[data-theme="dark"] .rounded-4[style*="background: linear-gradient(135deg, #202942"] {
    background: linear-gradient(135deg, #202942 0%, #2F55D4 100%) !important;
    color: white !important;
}

[data-theme="dark"] .btn-light {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    backdrop-filter: blur(4px);
}

[data-theme="dark"] .btn-light:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
}

/* Dark Theme - Additional Text Colors */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--em-gray-900);
}

[data-theme="dark"] p {
    color: var(--em-gray-800);
}

/* Dark Theme - Container Backgrounds */
[data-theme="dark"] .container-fluid {
    background: transparent;
}

/* Dark Theme - Row Backgrounds */
[data-theme="dark"] .row {
    background: transparent;
}

/* Dark Theme - Ensure proper contrast for all text */
[data-theme="dark"] .em-v2-content {
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-v2-content .text-muted {
    color: var(--em-text-subtle) !important;
}

[data-theme="dark"] .text-muted {
    color: var(--em-text-subtle) !important;
}

/* Dark Theme - Widget body backgrounds */
[data-theme="dark"] .em-dashboard-widget .em-dashboard-widget-body {
    background: var(--em-surface-elevated) !important;
}

/* Dark Theme - Table in widgets */
[data-theme="dark"] .em-dashboard-widget .table tbody td {
    color: var(--em-text) !important;
    border-bottom-color: rgba(255, 255, 255, 0.04) !important;
}

[data-theme="dark"] .em-dashboard-widget .table tbody tr:hover {
    background: var(--em-dark-surface-3) !important;
}

[data-theme="dark"] .em-dashboard-widget .table thead th {
    color: var(--em-text) !important;
    background: linear-gradient(135deg, var(--em-dark-surface-3) 0%, var(--em-dark-surface-2) 100%) !important;
    border-bottom-color: var(--em-border) !important;
}

/* Dark Theme - KPI Widget specific */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="kpi_members"] .table td {
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="kpi_members"] .fw-semibold,
[data-theme="dark"] .em-dashboard-widget[data-widget-key="kpi_members"] .fw-bold {
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="kpi_members"] .text-muted {
    color: var(--em-text-subtle) !important;
}

/* Dark Theme - Activity cards - use accent system */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="latest_members_activity"] .em-accent-card,
[data-theme="dark"] .em-dashboard-widget[data-widget-key="latest_members_activity"] .rounded-2 {
    background: var(--em-accent-purple-bg) !important;
    border-color: rgba(139, 92, 246, 0.15) !important;
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="latest_members_activity"] .fw-semibold {
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="latest_members_activity"] .text-muted {
    color: var(--em-text-subtle) !important;
}

/* Dark Theme - Latest logins cards */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="latest_logins"] .em-accent-card,
[data-theme="dark"] .em-dashboard-widget[data-widget-key="latest_logins"] .rounded-2 {
    background: var(--em-accent-cyan-bg) !important;
    border-color: rgba(6, 182, 212, 0.15) !important;
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="latest_logins"] .fw-semibold {
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="latest_logins"] .text-muted {
    color: var(--em-text-subtle) !important;
}

/* Dark Theme - System log table */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="system_log"] .table tbody td {
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="system_log"] .table thead th {
    color: var(--em-text) !important;
    background: linear-gradient(135deg, var(--em-dark-surface-3) 0%, var(--em-dark-surface-2) 100%) !important;
}

/* Dark Theme - System log footer */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="system_log"] .bg-light,
[data-theme="dark"] .em-dashboard-widget[data-widget-key="ping_payments"] .bg-light {
    background: var(--em-dark-surface-1) !important;
}

/* Dark Theme - Tasks and Alerts widget - accent cards */
[data-theme="dark"] .em-dashboard-widget[data-widget-key="tasks_and_alerts"] .em-accent-card--warning {
    background: var(--em-accent-warning-bg) !important;
    border-color: rgba(251, 191, 36, 0.15) !important;
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="tasks_and_alerts"] .em-accent-card--cyan {
    background: var(--em-accent-cyan-bg) !important;
    border-color: rgba(6, 182, 212, 0.15) !important;
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="tasks_and_alerts"] .em-accent-card--danger {
    background: var(--em-accent-danger-bg) !important;
    border-color: rgba(251, 113, 133, 0.15) !important;
}

[data-theme="dark"] .em-dashboard-widget[data-widget-key="tasks_and_alerts"] .text-muted {
    color: var(--em-text-muted) !important;
}

/* Dark Theme - Page title */
[data-theme="dark"] .em-v2-page-title {
    color: var(--em-text) !important;
}

/* Dark Theme - Header toggle */
[data-theme="dark"] .em-v2-header-toggle {
    color: var(--em-gray-700) !important;
}

[data-theme="dark"] .em-v2-header-toggle:hover {
    color: var(--em-primary) !important;
}

/* Dark Theme - Theme toggle button */
[data-theme="dark"] .em-v2-theme-toggle {
    color: var(--em-gray-700) !important;
}

[data-theme="dark"] .em-v2-theme-toggle:hover {
    background: var(--em-dark-surface-3) !important;
    border-color: var(--em-primary) !important;
    color: var(--em-primary) !important;
}

/* Alerts & Tasks Notification Dropdown */
.em-v2-alerts-btn {
    position: relative;
    padding: 0.5rem 0.75rem !important;
    overflow: visible !important;
}

.em-v2-alerts-btn .badge {
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.em-v2-alerts-dropdown-menu {
    border: none;
    border-radius: var(--em-radius-lg);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 0;
    margin-top: 0.5rem;
    background: var(--em-white);
}

.em-v2-alerts-dropdown-menu .border-bottom {
    border-bottom: 1px solid var(--em-gray-200) !important;
}

[data-theme="dark"] .em-v2-alerts-dropdown-menu {
    background: var(--em-dark-surface-2) !important;
    border: 1px solid var(--em-border) !important;
    box-shadow: var(--em-shadow-lg) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-v2-alerts-dropdown-menu .border-bottom {
    border-bottom-color: var(--em-border) !important;
}

[data-theme="dark"] .em-v2-alerts-dropdown-menu h6 {
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-v2-alerts-dropdown-menu small {
    color: var(--em-text-muted) !important;
}

[data-theme="dark"] .em-v2-alerts-dropdown-menu .text-muted {
    color: var(--em-text-muted) !important;
}

/* Dark theme - Alert cards in dropdown using accent system */
[data-theme="dark"] .em-v2-alerts-dropdown-menu .rounded-2 {
    background: var(--em-dark-surface-3) !important;
    border-color: var(--em-border) !important;
}

/* Warning card (yellow/orange) */
[data-theme="dark"] .em-v2-alerts-dropdown-menu .rounded-2[style*="#fef3c7"],
[data-theme="dark"] .em-v2-alerts-dropdown-menu .rounded-2[style*="#fde68a"],
[data-theme="dark"] .em-v2-alerts-dropdown-menu .em-accent-card--warning {
    background: var(--em-accent-warning-bg) !important;
    border-left-color: var(--em-accent-warning-border) !important;
    border-color: rgba(251, 191, 36, 0.2) !important;
}

/* Info card (cyan/blue) */
[data-theme="dark"] .em-v2-alerts-dropdown-menu .rounded-2[style*="#cffafe"],
[data-theme="dark"] .em-v2-alerts-dropdown-menu .rounded-2[style*="#a5f3fc"],
[data-theme="dark"] .em-v2-alerts-dropdown-menu .em-accent-card--cyan {
    background: var(--em-accent-cyan-bg) !important;
    border-left-color: var(--em-accent-cyan-border) !important;
    border-color: rgba(6, 182, 212, 0.2) !important;
}

/* Danger card (red/pink) */
[data-theme="dark"] .em-v2-alerts-dropdown-menu .rounded-2[style*="#fee2e2"],
[data-theme="dark"] .em-v2-alerts-dropdown-menu .rounded-2[style*="#fecaca"],
[data-theme="dark"] .em-v2-alerts-dropdown-menu .em-accent-card--danger {
    background: var(--em-accent-danger-bg) !important;
    border-left-color: var(--em-accent-danger-border) !important;
    border-color: rgba(251, 113, 133, 0.2) !important;
}

/* Text colors in dark theme */
[data-theme="dark"] .em-v2-alerts-dropdown-menu .fw-semibold,
[data-theme="dark"] .em-v2-alerts-dropdown-menu p.fw-semibold {
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-v2-alerts-dropdown-menu .text-muted,
[data-theme="dark"] .em-v2-alerts-dropdown-menu p.text-muted,
[data-theme="dark"] .em-v2-alerts-dropdown-menu small {
    color: var(--em-text-muted) !important;
}

[data-theme="dark"] .em-v2-alerts-dropdown-menu .badge {
    color: #ffffff !important;
}

/* Links in dark theme */
[data-theme="dark"] .em-v2-alerts-dropdown-menu a {
    color: var(--em-primary-light) !important;
}

[data-theme="dark"] .em-v2-alerts-dropdown-menu a[style*="color: #f59e0b"] {
    color: var(--em-accent-warning-border) !important;
}

[data-theme="dark"] .em-v2-alerts-dropdown-menu a[style*="color: #06b6d4"] {
    color: var(--em-accent-cyan-border) !important;
}

[data-theme="dark"] .em-v2-alerts-dropdown-menu a[style*="color: #f87171"] {
    color: var(--em-accent-danger-border) !important;
}

[data-theme="dark"] .em-v2-alerts-dropdown-menu a:hover {
    text-decoration: underline !important;
    opacity: 0.9;
}

/* Dashboard Widgets */
.em-dashboard-widget {
    background: var(--em-white);
    border-radius: var(--em-radius-lg);
    box-shadow: var(--em-shadow-xs);
    border: none;
    transition: box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1),
                transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
    height: auto;
    min-height: auto;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.em-dashboard-widget:hover {
    box-shadow: var(--em-shadow);
    transform: translateY(-1px);
}

.em-dashboard-widget-header {
    padding: var(--em-spacing-sm) var(--em-spacing-md);
    border-bottom: 1px solid var(--em-gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--em-spacing-sm);
    background: transparent;
}

.em-dashboard-widget-drag-handle {
    cursor: grab;
    opacity: 0.4;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    padding: 0.25rem 0.375rem;
    border-radius: var(--em-radius-sm);
    color: var(--em-gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    flex-shrink: 0;
}

.em-dashboard-widget-drag-handle:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--em-gray-900);
}

.em-dashboard-widget-drag-handle:active {
    cursor: grabbing;
    background-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .em-dashboard-widget-drag-handle {
    color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .em-dashboard-widget-drag-handle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .em-dashboard-widget-drag-handle:active {
    background-color: rgba(255, 255, 255, 0.15);
}

.em-dashboard-widget-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--em-gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--em-spacing-sm);
}

.em-dashboard-widget-title i {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--em-radius-sm);
    background: var(--em-primary-gradient);
    color: var(--em-white);
    font-size: 0.875rem;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.em-dashboard-widget-actions {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-xs);
}

.em-dashboard-widget-action {
    background: var(--em-gray-100);
    border: none;
    color: var(--em-gray-600);
    padding: var(--em-spacing-xs);
    border-radius: var(--em-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.em-dashboard-widget-action:hover {
    background: var(--em-gray-200);
    color: var(--em-gray-900);
}

.em-dashboard-widget-body {
    padding: var(--em-spacing-md) var(--em-spacing-lg);
    flex: 0 0 auto;
    overflow: visible;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.em-dashboard-widget-body .table {
    margin-bottom: 0;
}

.em-dashboard-widget-body .table td {
    vertical-align: middle;
    padding: 0.75rem 0.5rem;
}

/* New Members Registered Widget - Compact styling */
.em-dashboard-widget[data-widget-key="new_members_registered"] .em-dashboard-widget-body {
    padding: 0.75rem !important;
}

/* ============================================
   DASHBOARD MODERNISERING
   ============================================ */

/* Versionlog News Banner */
.em-versionlog-banner {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-md);
    background: var(--em-surface);
    border: 1px solid var(--em-info);
    border-left: 4px solid var(--em-info);
    border-radius: var(--em-radius-lg);
    padding: var(--em-spacing-md) var(--em-spacing-lg);
    box-shadow: var(--em-shadow);
    position: relative;
}

.em-versionlog-banner-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: var(--em-info-light);
    color: var(--em-info);
    font-size: 1.15rem;
}

.em-versionlog-banner-content {
    flex: 1;
    min-width: 0;
}

.em-versionlog-banner-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--em-text);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.em-versionlog-banner-text {
    font-size: 0.9rem;
    color: var(--em-text-muted);
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.em-versionlog-banner-text strong {
    color: var(--em-text);
    font-weight: 600;
}

.em-versionlog-banner-actions {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-sm);
    flex-shrink: 0;
}

.em-versionlog-banner-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--em-text-subtle);
    border-radius: var(--em-radius-sm);
    cursor: pointer;
    transition: all 180ms ease;
    padding: 0;
}

.em-versionlog-banner-close:hover {
    background: var(--em-surface-3);
    color: var(--em-text);
}

/* Animation */
@keyframes emBannerSlideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.em-versionlog-banner-animate .em-versionlog-banner {
    animation: emBannerSlideDown 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Responsive: stacka vertikalt pÃ¥ mobil */
@media (max-width: 575.98px) {
    .em-versionlog-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--em-spacing-sm);
    }

    .em-versionlog-banner-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .em-versionlog-banner-text {
        white-space: normal;
    }
}

/* Dark mode */
[data-theme="dark"] .em-versionlog-banner {
    background: var(--em-surface);
    border-color: rgba(47, 85, 212, 0.4);
    border-left-color: var(--em-info);
}

[data-theme="dark"] .em-versionlog-banner-icon {
    background: rgba(47, 85, 212, 0.15);
    color: #6b8cff;
}

[data-theme="dark"] .em-versionlog-banner-close:hover {
    background: var(--em-surface-3);
}

/* Welcome Banner */
.em-dashboard-welcome {
    background: var(--em-accent-gradient);
    border-radius: var(--em-radius-lg);
    padding: var(--em-spacing-md) var(--em-spacing-lg);
    position: relative;
    overflow: hidden;
    color: var(--em-white);
    box-shadow: var(--em-shadow-md);
}

.em-dashboard-welcome-icon {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 6rem;
    line-height: 1;
    opacity: 0.25;
}

.em-dashboard-welcome-title {
    font-size: clamp(1rem, 4vw, 1.5rem);
    font-weight: 700;
    margin-bottom: var(--em-spacing-xs);
}

.em-dashboard-welcome-subtitle {
    font-size: clamp(0.75rem, 3vw, 0.875rem);
    opacity: 0.9;
}

/* KPI Cards */
.em-dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--em-spacing-sm);
}

.em-dashboard-kpi-card {
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-lg);
    padding: var(--em-spacing-md);
    transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.em-dashboard-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 300ms ease;
}

.em-dashboard-kpi-card--primary::before { background: var(--em-accent); }
.em-dashboard-kpi-card--success::before { background: var(--em-success); }
.em-dashboard-kpi-card--info::before { background: #06b6d4; }

.em-dashboard-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--em-shadow-md);
}

.em-dashboard-kpi-card:hover::before {
    transform: scaleX(1);
}

.em-dashboard-kpi-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--em-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-bottom: var(--em-spacing-xs);
}

.em-dashboard-kpi-icon--primary {
    background: rgba(47, 85, 212, 0.1);
    color: var(--em-accent);
}

.em-dashboard-kpi-icon--success {
    background: var(--em-success-light);
    color: var(--em-success);
}

.em-dashboard-kpi-icon--info {
    background: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
}

.em-dashboard-kpi-label {
    font-size: 0.8125rem;
    color: var(--em-text-muted);
    font-weight: 500;
}

.em-dashboard-kpi-sublabel {
    font-size: 0.75rem;
    color: var(--em-text-subtle);
}

.em-dashboard-kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--em-text);
    line-height: 1.2;
    margin: 2px 0;
}

.em-dashboard-kpi-change {
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: var(--em-spacing-xs);
    margin-top: var(--em-spacing-xs);
}

.em-dashboard-kpi-change--positive { color: var(--em-success); }
.em-dashboard-kpi-change--negative { color: var(--em-danger); }
.em-dashboard-kpi-change--neutral { color: var(--em-text-muted); }

.em-dashboard-kpi-change .text-muted {
    color: var(--em-text-subtle) !important;
    font-size: 0.75rem;
}

[data-theme="dark"] .em-dashboard-kpi-card {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-dashboard-kpi-icon--primary {
    background: rgba(47, 85, 212, 0.2);
}

[data-theme="dark"] .em-dashboard-kpi-icon--success {
    background: rgba(16, 185, 129, 0.15);
}

[data-theme="dark"] .em-dashboard-kpi-icon--info {
    background: rgba(6, 182, 212, 0.15);
}

/* Task/Alert Cards */
.em-dashboard-task-card {
    border-radius: var(--em-radius-md);
    border: 1px solid var(--em-border);
    padding: 0.75rem;
    transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: var(--em-spacing-sm);
}

.em-dashboard-task-card:hover {
    transform: translateX(2px);
    box-shadow: var(--em-shadow-sm);
}

.em-dashboard-task-card--warning {
    background: var(--em-accent-warning-bg);
    border-color: rgba(245, 158, 11, 0.2);
}

.em-dashboard-task-card--info {
    background: var(--em-accent-cyan-bg);
    border-color: rgba(6, 182, 212, 0.2);
}

.em-dashboard-task-card--danger {
    background: var(--em-accent-danger-bg);
    border-color: rgba(248, 113, 113, 0.2);
}

.em-dashboard-task-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--em-white);
}

.em-dashboard-task-icon--warning { background: var(--em-warning); }
.em-dashboard-task-icon--info { background: #06b6d4; }
.em-dashboard-task-icon--danger { background: #f87171; }

.em-dashboard-task-title {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--em-text);
}

.em-dashboard-task-desc {
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--em-text-muted);
}

.em-dashboard-task-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
    font-weight: 600;
    color: var(--em-white);
}

.em-dashboard-task-badge--warning { background: var(--em-warning); }
.em-dashboard-task-badge--info { background: #06b6d4; }
.em-dashboard-task-badge--danger { background: #f87171; }

.em-dashboard-task-link {
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 180ms ease;
    display: inline-flex;
    align-items: center;
    gap: var(--em-spacing-xs);
}

.em-dashboard-task-link:hover { text-decoration: underline; }
.em-dashboard-task-link--warning { color: #b45309; }
.em-dashboard-task-link--warning:hover { color: #92400e; }
.em-dashboard-task-link--info { color: #0e7490; }
.em-dashboard-task-link--info:hover { color: #155e75; }
.em-dashboard-task-link--danger { color: #b91c1c; }
.em-dashboard-task-link--danger:hover { color: #991b1b; }

[data-theme="dark"] .em-dashboard-task-card--warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
}

[data-theme="dark"] .em-dashboard-task-card--info {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.2);
}

[data-theme="dark"] .em-dashboard-task-card--danger {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.2);
}

[data-theme="dark"] .em-dashboard-task-link--warning { color: #fbbf24; }
[data-theme="dark"] .em-dashboard-task-link--info { color: #22d3ee; }
[data-theme="dark"] .em-dashboard-task-link--danger { color: #fca5a5; }

/* Member Card (latest activity / latest logins) */
.em-dashboard-member-card {
    border-radius: var(--em-radius-md);
    border: 1px solid var(--em-border);
    padding: var(--em-spacing-sm);
    transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    text-decoration: none;
    color: inherit;
}

.em-dashboard-member-card:hover {
    transform: translateX(2px);
    text-decoration: none;
    color: inherit;
}

.em-dashboard-member-card--purple:hover {
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
}

.em-dashboard-member-card--cyan:hover {
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.2);
}

.em-dashboard-member-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--em-white);
    font-size: 0.7rem;
}

.em-dashboard-member-icon--purple { background: #8b5cf6; }
.em-dashboard-member-icon--cyan { background: #06b6d4; }

.em-dashboard-member-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--em-text);
    line-height: 1.3;
}

.em-dashboard-member-meta {
    font-size: 0.7rem;
    color: var(--em-text-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--em-spacing-sm);
}

.em-dashboard-member-tag {
    font-weight: 600;
    font-size: 0.65rem;
}

.em-dashboard-member-tag--purple { color: #6d28d9; }
.em-dashboard-member-tag--cyan { color: #0e7490; }

[data-theme="dark"] .em-dashboard-member-card {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-dashboard-member-name { color: var(--em-text); }
[data-theme="dark"] .em-dashboard-member-tag--purple { color: #a78bfa; }
[data-theme="dark"] .em-dashboard-member-tag--cyan { color: #22d3ee; }

/* System Log Table */
.em-dashboard-syslog-table {
    width: 100%;
    margin: 0;
}

.em-dashboard-syslog-table thead th {
    background: transparent;
    border-bottom: 1px solid var(--em-border);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--em-text-muted);
    padding: 0.25rem 0.75rem 0.4rem;
    text-align: left;
}

.em-dashboard-syslog-th--time { width: 100px; }
.em-dashboard-syslog-th--affected { width: 140px; }
.em-dashboard-syslog-th--doneby { width: 120px; }

.em-dashboard-syslog-table tbody td {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    color: var(--em-text);
    text-align: left;
}

.em-dashboard-syslog-table tbody tr:last-child td { border-bottom: none; }

.em-dashboard-syslog-table tbody tr:hover {
    background: var(--em-surface-2);
}

.em-dashboard-syslog-time { white-space: nowrap; }
.em-dashboard-syslog-event { word-break: break-word; }

.em-dashboard-syslog-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--em-border);
    background: var(--em-surface-2);
}

[data-theme="dark"] .em-dashboard-syslog-table thead th {
    border-bottom-color: var(--em-border);
    color: var(--em-text-muted);
}

[data-theme="dark"] .em-dashboard-syslog-table tbody td {
    color: var(--em-text);
    border-bottom-color: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .em-dashboard-syslog-table tbody tr:hover {
    background: var(--em-dark-surface-3);
}

[data-theme="dark"] .em-dashboard-syslog-footer {
    background: var(--em-dark-surface-2);
    border-top-color: var(--em-border);
}

/* Widget Table - Shared styles for ping/payment widgets */
.em-dashboard-table {
    width: 100%;
    margin: 0;
}

.em-dashboard-table thead th {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--em-text-muted);
    background: var(--em-surface-2);
    border-bottom: 1px solid var(--em-border);
    padding: 0.5rem 0.75rem;
}

.em-dashboard-table tbody td {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
    vertical-align: middle;
    color: var(--em-text);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.em-dashboard-table tbody tr:last-child td { border-bottom: none; }

.em-dashboard-table tbody tr:hover {
    background: var(--em-surface-2);
}

.em-dashboard-table-amount { text-align: right; font-weight: 600; }
.em-dashboard-table-count { text-align: right; color: var(--em-text-muted); }
.em-dashboard-table-muted { color: var(--em-text-muted); }
.em-dashboard-table-nowrap { white-space: nowrap; }

[data-theme="dark"] .em-dashboard-table thead th {
    background: var(--em-dark-surface-3);
    color: var(--em-text);
    border-bottom-color: var(--em-border);
}

[data-theme="dark"] .em-dashboard-table tbody td {
    color: var(--em-text);
    border-bottom-color: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .em-dashboard-table tbody tr:hover {
    background: var(--em-dark-surface-3);
}

/* Gradient Stat Cards (member-count, new-members) */
.em-dashboard-stat-gradient {
    padding: var(--em-spacing-lg);
    border-radius: var(--em-radius-lg);
    position: relative;
    overflow: hidden;
    color: var(--em-white);
}

.em-dashboard-stat-gradient--primary { background: var(--em-primary-gradient); }
.em-dashboard-stat-gradient--success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.em-dashboard-stat-gradient--info { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }
.em-dashboard-stat-gradient--accent { background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%); }

.em-dashboard-stat-gradient-bg {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 4rem;
    line-height: 1;
    opacity: 0.25;
}

.em-dashboard-stat-gradient-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0;
}

.em-dashboard-stat-gradient-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.em-dashboard-stat-gradient-meta {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Empty State */
.em-dashboard-empty {
    text-align: center;
    padding: var(--em-spacing-xl) var(--em-spacing-md);
    color: var(--em-text-muted);
}

.em-dashboard-empty-icon {
    font-size: 1.5rem;
    opacity: 0.5;
    margin-bottom: var(--em-spacing-sm);
}

/* Customize Modal */
#customizeDashboardModal .modal-content {
    border: none;
    border-radius: var(--em-radius-lg);
    overflow: hidden;
    box-shadow: var(--em-shadow-lg);
}

.em-dashboard-modal-header {
    background: var(--em-accent-gradient);
    color: var(--em-white);
    border-bottom: none;
    border-radius: 0;
    padding: var(--em-spacing-lg) var(--em-spacing-lg);
}

.em-dashboard-modal-header .modal-title {
    font-weight: 700;
    font-size: 1.125rem;
}

.em-dashboard-modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
    transition: opacity 180ms ease;
}

.em-dashboard-modal-header .btn-close:hover {
    opacity: 1;
}

.em-dashboard-modal-intro {
    color: var(--em-text-muted);
    font-size: var(--em-font-size-sm);
    line-height: 1.5;
    margin-bottom: var(--em-spacing-lg);
}

.em-dashboard-widget-toggle-card {
    border-radius: var(--em-radius-lg);
    border: 1.5px solid var(--em-border);
    padding: var(--em-spacing-md);
    transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--em-surface);
    display: flex;
    align-items: flex-start;
    gap: var(--em-spacing-md);
    cursor: pointer;
    position: relative;
}

.em-dashboard-widget-toggle-card:hover {
    border-color: var(--em-accent);
    box-shadow: 0 2px 8px rgba(47, 85, 212, 0.1);
    transform: translateY(-1px);
}

.em-dashboard-widget-toggle-card.is-active {
    border-color: var(--em-accent);
    background: rgba(47, 85, 212, 0.03);
}

.em-dashboard-widget-toggle-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--em-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    transition: all 180ms ease;
}

.em-dashboard-widget-toggle-icon--blue {
    background: rgba(47, 85, 212, 0.1);
    color: #2F55D4;
}
.em-dashboard-widget-toggle-icon--green {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}
.em-dashboard-widget-toggle-icon--purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}
.em-dashboard-widget-toggle-icon--orange {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}
.em-dashboard-widget-toggle-icon--cyan {
    background: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
}
.em-dashboard-widget-toggle-icon--red {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}
.em-dashboard-widget-toggle-icon--teal {
    background: rgba(20, 184, 166, 0.1);
    color: #14b8a6;
}

.em-dashboard-widget-toggle-card.is-active .em-dashboard-widget-toggle-icon--blue {
    background: rgba(47, 85, 212, 0.18);
}
.em-dashboard-widget-toggle-card.is-active .em-dashboard-widget-toggle-icon--green {
    background: rgba(16, 185, 129, 0.18);
}
.em-dashboard-widget-toggle-card.is-active .em-dashboard-widget-toggle-icon--purple {
    background: rgba(139, 92, 246, 0.18);
}
.em-dashboard-widget-toggle-card.is-active .em-dashboard-widget-toggle-icon--orange {
    background: rgba(249, 115, 22, 0.18);
}
.em-dashboard-widget-toggle-card.is-active .em-dashboard-widget-toggle-icon--cyan {
    background: rgba(6, 182, 212, 0.18);
}
.em-dashboard-widget-toggle-card.is-active .em-dashboard-widget-toggle-icon--red {
    background: rgba(239, 68, 68, 0.18);
}
.em-dashboard-widget-toggle-card.is-active .em-dashboard-widget-toggle-icon--teal {
    background: rgba(20, 184, 166, 0.18);
}

.em-dashboard-widget-toggle-content {
    flex: 1;
    min-width: 0;
}

.em-dashboard-widget-toggle-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--em-spacing-sm);
}

.em-dashboard-widget-toggle-label {
    font-weight: 600;
    color: var(--em-text);
    font-size: 0.9375rem;
    line-height: 1.3;
}

.em-dashboard-widget-toggle-desc {
    font-size: 0.8125rem;
    color: var(--em-text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.em-dashboard-widget-toggle-card .form-check-input {
    width: 2.5rem;
    height: 1.25rem;
    flex-shrink: 0;
    cursor: pointer;
    margin-top: 0;
}

.em-dashboard-modal-footer {
    border-top: 1px solid var(--em-border);
    padding: var(--em-spacing-md) var(--em-spacing-lg);
    display: flex;
    justify-content: flex-end;
}

/* Dark mode - Customize Modal */
[data-theme="dark"] #customizeDashboardModal .modal-content {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .em-dashboard-widget-toggle-card {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-dashboard-widget-toggle-card:hover {
    border-color: var(--em-accent);
    box-shadow: 0 2px 8px rgba(47, 85, 212, 0.15);
}

[data-theme="dark"] .em-dashboard-widget-toggle-card.is-active {
    border-color: var(--em-accent);
    background: rgba(47, 85, 212, 0.08);
}

[data-theme="dark"] .em-dashboard-widget-toggle-icon--blue {
    background: rgba(47, 85, 212, 0.15);
}
[data-theme="dark"] .em-dashboard-widget-toggle-icon--green {
    background: rgba(16, 185, 129, 0.15);
}
[data-theme="dark"] .em-dashboard-widget-toggle-icon--purple {
    background: rgba(139, 92, 246, 0.15);
}
[data-theme="dark"] .em-dashboard-widget-toggle-icon--orange {
    background: rgba(249, 115, 22, 0.15);
}
[data-theme="dark"] .em-dashboard-widget-toggle-icon--cyan {
    background: rgba(6, 182, 212, 0.15);
}
[data-theme="dark"] .em-dashboard-widget-toggle-icon--red {
    background: rgba(239, 68, 68, 0.15);
}
[data-theme="dark"] .em-dashboard-widget-toggle-icon--teal {
    background: rgba(20, 184, 166, 0.15);
}

/* Chart Widget */
.em-dashboard-chart-body {
    padding: var(--em-spacing-md);
}

/* Filter Button Group */
.em-dashboard-filter-bar {
    padding: 0.75rem var(--em-spacing-md) var(--em-spacing-sm);
    border-bottom: 1px solid var(--em-border);
}

[data-theme="dark"] .em-dashboard-filter-bar {
    border-bottom-color: var(--em-border);
}

/* Sortable ghost/drag (also in inline, but moved here) */
/* Drag & drop: ghost = platsmarkering i kolumnen, drag = kortet som följer muspekaren */
.em-dashboard-widget.sortable-ghost {
    opacity: 0.45;
    box-shadow: none;
    outline: 2px dashed var(--em-gray-300);
    outline-offset: -2px;
}

.em-dashboard-widget.sortable-drag {
    opacity: 0.95;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    transform: scale(1.02);
}

[data-theme="dark"] .em-dashboard-widget.sortable-ghost {
    outline-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .em-dashboard-widget.sortable-drag {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.em-dashboard-column { min-height: 200px; }

/* Dashboard Responsive */
@media (max-width: 768px) {
    .em-dashboard-welcome {
        padding: var(--em-spacing-md);
    }

    .em-dashboard-welcome-icon {
        font-size: 4rem;
    }

    .em-dashboard-kpi-grid {
        grid-template-columns: 1fr;
    }

    .em-dashboard-syslog-th--affected,
    .em-dashboard-syslog-table tbody td:nth-child(3) {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .em-dashboard-kpi-card,
    .em-dashboard-task-card,
    .em-dashboard-member-card {
        transition: none;
    }

    .em-dashboard-kpi-card:hover,
    .em-dashboard-task-card:hover,
    .em-dashboard-member-card:hover {
        transform: none;
    }
}

/* Member Search Modal - v2 Styling */
/* ============================================
   MEMBER SEARCH MODAL - MOBILE FIRST
   ============================================ */

.em-v2-member-search-modal {
    border: none;
    border-radius: var(--em-radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header - Mobile First */
.em-v2-member-search-header {
    background: linear-gradient(135deg, #202942 0%, #2F55D4 100%);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    flex-shrink: 0;
}

.em-v2-member-search-header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.em-v2-member-search-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--em-radius-md);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.em-v2-member-search-icon i {
    font-size: 1rem;
    color: var(--em-white);
}

.em-v2-member-search-title-wrapper {
    flex: 1;
    min-width: 0;
}

.em-v2-member-search-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--em-white);
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.em-v2-member-search-subtitle {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0.125rem 0 0 0;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.em-v2-member-search-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
    transition: opacity 0.2s ease;
    padding: 0.5rem;
    margin: -0.5rem;
    font-size: 0.875rem;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.em-v2-member-search-close:hover,
.em-v2-member-search-close:focus {
    opacity: 1;
}

/* Body - Mobile First */
.em-v2-member-search-body {
    padding: 1rem;
    background: var(--em-white);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Search Input - Mobile First */
.em-v2-member-search-input-wrapper {
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.em-v2-member-search-input-group {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--em-white);
    border: 2px solid var(--em-gray-300);
    border-radius: var(--em-radius-md);
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.em-v2-member-search-input-group:focus-within {
    border-color: var(--em-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.em-v2-member-search-input-icon {
    color: var(--em-gray-400);
    font-size: 1rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.em-v2-member-search-input-group:focus-within .em-v2-member-search-input-icon {
    color: var(--em-primary);
}

.em-v2-member-search-input {
    border: none;
    padding: 0;
    font-size: 1rem;
    background: transparent;
    flex: 1;
    color: var(--em-gray-900);
    font-weight: 400;
    min-width: 0;
}

.em-v2-member-search-input:focus {
    outline: none;
    box-shadow: none;
}

.em-v2-member-search-input::placeholder {
    color: var(--em-gray-400);
}

.em-v2-member-search-input-loader {
    margin-left: 0.75rem;
    color: var(--em-primary);
    font-size: 1rem;
    flex-shrink: 0;
}

/* Results Container - Mobile First */
.em-v2-member-search-results {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Mobile Card View */
.em-v2-member-search-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.25rem;
    max-height: calc(100vh - 280px);
}

.em-v2-member-search-card {
    background: var(--em-white);
    border: 1px solid var(--em-gray-200);
    border-radius: var(--em-radius-md);
    padding: 1rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.em-v2-member-search-card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.em-v2-member-search-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.em-v2-member-search-card-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--em-gray-500);
    background: var(--em-gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: var(--em-radius-sm);
    flex-shrink: 0;
}

.em-v2-member-search-card-name {
    flex: 1;
    min-width: 0;
}

.em-v2-member-search-card-name h6 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--em-gray-900);
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.em-v2-member-search-card-name p {
    font-size: 0.8125rem;
    color: var(--em-gray-600);
    margin: 0.25rem 0 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.em-v2-member-search-card-city {
    font-size: 0.75rem;
    color: var(--em-gray-500);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.em-v2-member-search-card-city i {
    font-size: 0.6875rem;
}

.em-v2-member-search-card-action {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--em-gray-200);
}

.em-v2-member-search-card-btn {
    width: 100%;
    background: linear-gradient(135deg, #202942 0%, #2F55D4 100%);
    color: white;
    border: none;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--em-radius-md);
    box-shadow: 0 2px 4px rgba(32, 41, 66, 0.2);
    transition: all 0.2s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.em-v2-member-search-card-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(32, 41, 66, 0.2);
}

/* Table Container - Desktop Only */
.em-v2-member-search-table-container {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    overflow-x: auto;
    border-radius: var(--em-radius-md);
    border: 1px solid var(--em-gray-200);
    background: var(--em-white);
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.em-v2-member-search-table {
    margin: 0;
    width: 100%;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}

.em-v2-member-search-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, var(--em-gray-50) 0%, var(--em-white) 100%);
}

.em-v2-member-search-table thead th {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.625rem 0.75rem;
    color: var(--em-gray-600);
    border-bottom: 1px solid var(--em-gray-200);
    background: linear-gradient(135deg, var(--em-gray-50) 0%, var(--em-white) 100%);
    white-space: nowrap;
}

.em-v2-member-search-th-number {
    width: 70px;
    text-align: center;
}

.em-v2-member-search-th-name {
    min-width: 140px;
}

.em-v2-member-search-th-city {
    min-width: 120px;
}

.em-v2-member-search-th-action {
    width: 110px;
    text-align: center;
}

.em-v2-member-search-table tbody td {
    padding: 0.625rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--em-gray-100);
    color: var(--em-gray-700);
    font-size: 0.8125rem;
}

.em-v2-member-search-table tbody tr {
    transition: all 0.15s ease;
}

.em-v2-member-search-table tbody tr:hover {
    background: linear-gradient(135deg, rgba(32, 41, 66, 0.05) 0%, rgba(47, 85, 212, 0.05) 100%);
}

.em-v2-member-search-table tbody tr:last-child td {
    border-bottom: none;
}

/* Empty State */
.em-v2-member-search-empty {
    padding: 2rem 1rem !important;
    text-align: center;
    border-bottom: none !important;
}

.em-v2-member-search-empty-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
}

.em-v2-member-search-empty-icon {
    font-size: 2rem;
    color: var(--em-gray-300);
    margin-bottom: 0.25rem;
}

.em-v2-member-search-empty-text {
    font-size: 0.8125rem;
    color: var(--em-gray-500);
    margin: 0;
    font-weight: 500;
}

/* Empty state for cards */
.em-v2-member-search-cards .em-v2-member-search-empty-content {
    padding: 3rem 1rem;
}

/* Footer - Mobile First */
.em-v2-member-search-footer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--em-gray-200);
    flex-shrink: 0;
}

.em-v2-member-search-info {
    display: flex;
    align-items: center;
    justify-content: center;
    order: 2;
}

.em-v2-member-search-info-text {
    font-size: 0.8125rem;
    color: var(--em-gray-600);
    font-weight: 500;
    text-align: center;
}

.em-v2-member-search-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    flex-wrap: wrap;
    order: 1;
}

/* Custom pagination buttons */
.em-v2-member-search-pagination-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.em-v2-member-search-pagination-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--em-gray-500);
    border-radius: var(--em-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    font-size: 0.875rem;
}

.em-v2-member-search-pagination-btn:hover:not(.em-v2-member-search-pagination-btn-disabled) {
    background: var(--em-gray-100);
    color: var(--em-gray-700);
}

.em-v2-member-search-pagination-btn:active:not(.em-v2-member-search-pagination-btn-disabled) {
    background: var(--em-gray-200);
    transform: scale(0.95);
}

.em-v2-member-search-pagination-btn-disabled {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}

.em-v2-member-search-pagination-info {
    font-size: 0.8125rem;
    color: var(--em-gray-500);
    font-weight: 400;
    white-space: nowrap;
}

/* Dark theme pagination buttons */
[data-theme="dark"] .em-v2-member-search-pagination-btn {
    color: var(--em-gray-400);
}

[data-theme="dark"] .em-v2-member-search-pagination-btn:hover:not(.em-v2-member-search-pagination-btn-disabled) {
    background: var(--em-gray-200);
    color: var(--em-gray-300);
}

[data-theme="dark"] .em-v2-member-search-pagination-info {
    color: var(--em-gray-400);
}

.em-v2-member-search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3) !important;
}

/* User Dropdown - v2 Styling */
.em-v2-user-dropdown-btn {
    height: 36px !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: var(--em-radius-md);
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.875rem;
    gap: 0.5rem;
    line-height: 1;
    border: 1px solid var(--em-gray-300);
    background: var(--em-white);
    color: var(--em-gray-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.em-v2-user-dropdown-btn:hover {
    background: var(--em-gray-50);
    border-color: var(--em-primary);
    color: var(--em-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.15);
}

.em-v2-user-dropdown-btn[aria-expanded="true"] {
    background: var(--em-primary-gradient);
    border-color: transparent;
    color: var(--em-white);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.em-v2-user-dropdown-btn[aria-expanded="true"] .em-v2-user-chevron {
    transform: rotate(180deg);
}

.em-v2-user-avatar-wrapper {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--em-gray-200) 0%, var(--em-gray-300) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.em-v2-user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.em-v2-user-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--em-gray-600);
    font-size: 0.875rem;
}

.em-v2-user-name {
    font-weight: 500;
    color: var(--em-gray-700);
}

.em-v2-user-chevron {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.em-v2-user-dropdown-menu {
    border: none;
    border-radius: var(--em-radius-lg);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 0.5rem;
    margin-top: 0.5rem;
    min-width: 260px;
    background: var(--em-white);
}

.em-v2-user-dropdown-header {
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, var(--em-gray-50) 0%, var(--em-white) 100%);
    border-radius: var(--em-radius-md);
    margin-bottom: 0.5rem;
}

.em-v2-user-dropdown-avatar-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--em-primary-gradient));
    display: flex;
    align-items: center;
    justify-content: center;
}

.em-has-brand-accent .em-v2-user-dropdown-avatar-wrapper {
    box-shadow: 0 0 0 2px var(--em-white), 0 0 0 3.5px var(--em-brand-accent);
}

.em-v2-user-dropdown-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.em-v2-user-dropdown-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--em-white);
    font-size: 1rem;
}

.em-v2-user-dropdown-info {
    text-align: left;
    min-width: 0;
}

.em-v2-user-dropdown-name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--em-gray-900);
    line-height: 1.3;
}

.em-v2-user-dropdown-email {
    font-size: 0.75rem;
    color: var(--em-gray-500);
    margin-top: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.em-v2-user-dropdown-divider {
    margin: 0.5rem 0;
    border-color: var(--em-gray-200);
}

.em-v2-user-dropdown-item {
    padding: 0.625rem 0.75rem;
    border-radius: var(--em-radius-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--em-gray-700);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    margin: 0.125rem 0;
}

.em-v2-user-dropdown-item:hover {
    background: linear-gradient(135deg, rgba(32, 41, 66, 0.05) 0%, rgba(47, 85, 212, 0.05) 100%);
    color: var(--em-primary);
    transform: translateX(2px);
}

.em-v2-user-dropdown-item-danger {
    color: var(--em-danger);
}

.em-v2-user-dropdown-item-danger:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
    color: var(--em-danger);
}

.em-v2-user-dropdown-icon {
    width: 18px;
    text-align: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.em-v2-user-dropdown-heading {
    display: block;
    padding: 0.25rem 0.75rem 0.125rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--em-gray-400);
}

.em-v2-user-dropdown-theme-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.375rem 0.75rem;
    margin: 0.125rem 0;
    color: var(--em-gray-700);
    font-weight: 500;
    font-size: 0.875rem;
}

.em-v2-theme-switch {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    background: var(--em-gray-100);
    border-radius: 999px;
}

.em-v2-theme-switch-btn {
    border: none;
    background: transparent;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--em-gray-500);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.em-v2-theme-switch-btn:hover {
    color: var(--em-gray-700);
}

.em-v2-theme-switch-btn.active {
    background: var(--em-white);
    color: var(--em-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* DataTables v2 Styling for Member Search */
.em-v2-member-search-modal .dataTables_wrapper,
#memberSearchModal .dataTables_wrapper {
    font-size: 0.875rem;
    width: 100%;
}

.em-v2-member-search-modal .dataTables_wrapper .dataTables_length,
.em-v2-member-search-modal .dataTables_wrapper .dataTables_info,
#memberSearchModal .dataTables_wrapper .dataTables_length,
#memberSearchModal .dataTables_wrapper .dataTables_info {
    display: none; /* We handle this in our custom footer */
}

.em-v2-member-search-modal .dataTables_wrapper .dataTables_filter,
#memberSearchModal .dataTables_wrapper .dataTables_filter {
    display: none; /* We have our own search input */
}

/* Hide default DataTables pagination - we use our own in footer */
.em-v2-member-search-modal .dataTables_wrapper > .row:last-child,
#memberSearchModal .dataTables_wrapper > .row:last-child {
    display: none;
}

.em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate,
#memberSearchModal .dataTables_wrapper .dataTables_paginate {
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .paginate_button,
#memberSearchModal .dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.5rem 0.75rem;
    margin: 0;
    border-radius: var(--em-radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: var(--em-gray-500);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 400;
    font-size: 0.875rem;
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    line-height: 1;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

.em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .paginate_button i,
#memberSearchModal .dataTables_wrapper .dataTables_paginate .paginate_button i {
    font-size: 0.875rem;
}

.em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .paginate_button::before,
#memberSearchModal .dataTables_wrapper .dataTables_paginate .paginate_button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--em-gray-50);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled):not(.current),
#memberSearchModal .dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled):not(.current) {
    background: var(--em-gray-100);
    border-color: transparent;
    color: var(--em-gray-700);
    transform: none;
    box-shadow: none;
}

.em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .paginate_button:active:not(.disabled):not(.current),
#memberSearchModal .dataTables_wrapper .dataTables_paginate .paginate_button:active:not(.disabled):not(.current) {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .paginate_button.current,
#memberSearchModal .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--em-gray-200);
    color: var(--em-gray-900);
    border-color: transparent;
    box-shadow: none;
    cursor: default;
    font-weight: 500;
    transform: none;
}

.em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
#memberSearchModal .dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(32, 41, 66, 0.25);
}

.em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
#memberSearchModal .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
    background: transparent;
    border-color: transparent;
    color: var(--em-gray-300);
    box-shadow: none;
    transform: none;
}

.em-v2-member-search-modal .dataTables_wrapper .dataTables_paginate .ellipsis,
#memberSearchModal .dataTables_wrapper .dataTables_paginate .ellipsis {
    padding: 0.625rem 0.5rem;
    color: var(--em-gray-400);
    cursor: default;
    border: none;
    background: transparent;
    font-weight: 500;
    min-width: auto;
    height: 40px;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.em-v2-member-search-modal .dataTables_wrapper .dataTables_processing,
#memberSearchModal .dataTables_wrapper .dataTables_processing {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    border-radius: var(--em-radius-md);
    padding: 1rem;
    font-weight: 500;
    color: var(--em-gray-700);
    border: 1px solid var(--em-gray-200);
}

/* Sidebar Backdrop */
.em-v2-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
    will-change: opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.em-v2-sidebar-backdrop.show {
    opacity: 1;
    pointer-events: all;
}

/* Override Bootstrap collapse transition for faster animation */
.em-v2-sidebar.collapsing {
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
    height: auto !important;
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE
   ============================================ */
@media (max-width: 991.98px) {
    .em-v2-content {
        padding: var(--em-spacing-md);
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .em-v2-page-title {
        font-size: 1.25rem;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Modern sidebar animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 500px;
    }
}

@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 2px 10px rgba(6, 182, 212, 0.6); }
    50% { box-shadow: 0 2px 16px rgba(6, 182, 212, 0.8), 0 0 20px rgba(6, 182, 212, 0.4); }
}

/* Desktop Enhancements for Member Search Modal */
@media (min-width: 768px) {
    .em-v2-member-search-header {
        padding: 1rem 1.25rem;
    }

    .em-v2-member-search-icon {
        width: 40px;
        height: 40px;
    }

    .em-v2-member-search-icon i {
        font-size: 1.125rem;
    }

    .em-v2-member-search-title {
        font-size: 1.125rem;
    }

    .em-v2-member-search-subtitle {
        font-size: 0.75rem;
    }

    .em-v2-member-search-body {
        padding: 1rem 1.25rem;
    }

    .em-v2-member-search-input-group {
        padding: 0.625rem 1rem;
    }

    .em-v2-member-search-input {
        font-size: 0.9375rem;
    }

    .em-v2-member-search-footer {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .em-v2-member-search-info {
        order: 1;
        justify-content: flex-start;
    }

    .em-v2-member-search-pagination {
        order: 2;
        justify-content: flex-end;
    }

    .em-v2-member-search-info-text {
        font-size: 0.75rem;
    }
}

@media (max-width: 575.98px) {
    .em-v2-content {
        padding: var(--em-spacing-sm);
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .em-v2-member-search-cards {
        max-height: calc(100vh - 260px);
    }

    .em-v2-member-search-pagination .paginate_button {
        min-width: 44px;
        min-height: 44px;
        font-size: 0.8125rem;
        padding: 0.625rem 0.875rem;
    }

    .em-v2-member-search-pagination {
        gap: 0.375rem;
    }

    .em-v2-member-search-card-btn {
        min-height: 44px;
    }
}

    .em-dashboard-widget-header {
        padding: var(--em-spacing-sm) var(--em-spacing-md);
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .em-dashboard-widget-title {
        font-size: 0.875rem !important;
    }

    .em-dashboard-widget-body {
        padding: var(--em-spacing-sm) !important;
    }

    .em-dashboard-widget-drag-handle {
        padding: 0.2rem 0.3rem;
    }

    .em-dashboard-widget-drag-handle i {
        font-size: 0.75rem;
    }

    /* Tabeller pÃ¥ mobil - horizontal scroll */
    .em-dashboard-widget .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .em-dashboard-widget .table-responsive table {
        min-width: 600px;
        font-size: 0.75rem;
        margin-bottom: 0;
    }

    .em-dashboard-widget .table-responsive table th,
    .em-dashboard-widget .table-responsive table td {
        padding: 0.5rem 0.375rem;
        white-space: nowrap;
    }

    /* Kompaktare footer pÃ¥ mobil */
    .em-dashboard-widget-body > div:last-child.p-3,
    .em-dashboard-widget-body > div:last-child[class*="border-top"] {
        padding: var(--em-spacing-sm) var(--em-spacing-md) !important;
    }

    .em-dashboard-widget-body .btn {
        font-size: 0.8125rem;
        padding: 0.375rem 0.75rem;
    }

    /* Mindre gap mellan widgets pÃ¥ mobil */
    #em-dashboard .em-dashboard-column {
        gap: var(--em-spacing-sm) !important;
    }

    /* Kompaktare widgets pÃ¥ mobil */
    .em-dashboard-widget {
        margin-bottom: var(--em-spacing-sm);
    }
}

/* Landscape orientation fÃ¶r mobil */
@media (max-width: 991.98px) and (orientation: landscape) {
    .em-v2-content {
        padding: var(--em-spacing-sm) var(--em-spacing-md);
    }

    .em-dashboard-widget-header {
        padding: var(--em-spacing-sm) var(--em-spacing-md);
    }

    .em-dashboard-widget-body {
        padding: var(--em-spacing-sm) !important;
    }

    /* Tabeller i landscape - mindre padding */
    .em-dashboard-widget table th,
    .em-dashboard-widget table td {
        padding: 0.375rem 0.5rem;
        font-size: 0.8125rem;
    }
}

/* Accessibility Improvements */
.visually-hidden-focusable:focus {
    position: absolute;
    z-index: 10000;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    margin: 0.5rem;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Focus Styles for Keyboard Navigation */
.em-v2-nav-link:focus-visible,
.em-v2-nav-sublink:focus-visible,
.em-dashboard-widget-action:focus-visible {
    outline: 2px solid var(--em-accent);
    outline-offset: 2px;
}

.em-v2-nav-sublink-dropdown:focus,
.em-v2-nav-sublink-dropdown:focus-visible {
    outline: none;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .em-v2-sidebar { border-right-width: 2px; }
    .em-v2-nav-link { border-left-width: 4px; }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Header Search - Mobile */
@media (max-width: 767.98px) {
    .em-v2-header-search {
        width: 36px;
        padding: 0;
        justify-content: center;
        overflow: hidden;
        transition: width 0.2s ease, padding 0.2s ease;
    }

    .em-v2-header-search-input {
        display: none;
    }

    .em-v2-header-search-icon {
        margin-right: 0;
    }

    .em-v2-header-search:focus-within {
        position: absolute;
        right: 0;
        width: calc(100vw - 80px);
        max-width: 320px;
        padding: 0 0.75rem;
        overflow: visible;
        z-index: 1060;
    }

    .em-v2-header-search:focus-within .em-v2-header-search-input {
        display: block;
    }

    .em-v2-header-search:focus-within .em-v2-header-search-icon {
        margin-right: 0.5rem;
    }

    .em-v2-header-search-dropdown {
        min-width: unset;
    }
}

/* Print Styles */
@media print {
    .em-v2-sidebar,
    .em-v2-header,
    .em-v2-footer { display: none; }

    .em-v2-main { margin-left: 0; }
    .em-v2-content { padding: 0; }
}

/* Utility Classes */
.em-shadow-sm { box-shadow: var(--em-shadow-sm); }
.em-shadow-md { box-shadow: var(--em-shadow-md); }
.em-shadow-lg { box-shadow: var(--em-shadow-lg); }
.em-rounded { border-radius: var(--em-radius-md); }
.em-rounded-lg { border-radius: var(--em-radius-lg); }

/* Card Enhancements */
.card {
    border: 1px solid var(--em-gray-200);
    box-shadow: var(--em-shadow-sm);
    transition: var(--em-transition);
}

.card:hover {
    box-shadow: var(--em-shadow-md);
}

/* Button Enhancements - Minimal tweaks only */
.btn {
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
    vertical-align: middle;
    box-sizing: border-box;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Ensure all buttons have exactly the same height - force consistent borders */
.btn-primary,
.btn-success,
.btn-info,
.btn-outline-secondary,
.btn-outline-primary {
    border-width: 1px;
    border-style: solid;
}

.btn-primary,
.btn-success,
.btn-info {
    border-color: transparent;
}

.btn-outline-secondary {
    border-color: var(--em-gray-300);
}

.btn-primary {
    background: #2F55D4;
    border: 1px solid #2F55D4;
    color: white;
}

.btn-primary:hover {
    background: #2544b0;
    border-color: #2544b0;
    color: white;
    box-shadow: 0 4px 12px rgba(47, 85, 212, 0.4);
}

.btn-outline-primary {
    border: 1px solid var(--em-primary);
    color: var(--em-primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: #2F55D4;
    border-color: #2F55D4;
    color: white;
}

.btn-outline-secondary {
    border: 1px solid var(--em-gray-300);
    color: var(--em-gray-700);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--em-gray-800);
    border-color: var(--em-gray-800);
    color: white;
}

/* Form Enhancements */
.form-control:focus,
.form-select:focus {
    border-color: var(--em-accent);
    box-shadow: 0 0 0 0.25rem rgba(47, 85, 212, 0.25);
}

/* Table Enhancements */
.table { color: var(--em-gray-900); }

.table thead th {
    font-weight: 700;
    text-transform: uppercase;
    font-size: var(--em-font-size-sm);
    letter-spacing: 0.1em;
    border-bottom: 3px solid var(--em-primary);
    background: linear-gradient(135deg, var(--em-gray-50) 0%, var(--em-white) 100%);
    color: var(--em-gray-700);
}

.table-hover tbody tr {
    transition: var(--em-transition);
}

.table-hover tbody tr:hover {
    background: linear-gradient(135deg, rgba(32, 41, 66, 0.05) 0%, rgba(47, 85, 212, 0.05) 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Prevent buttons from moving on table row hover */
.table-hover tbody tr:hover td .btn {
    transform: none !important;
}

/* Table Responsive - Hide scrollbar completely */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox - hide scrollbar */
    -ms-overflow-style: none; /* IE and Edge - hide scrollbar */
}

.table-responsive::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera - hide scrollbar */
}

/* Show scrollbar only when actively scrolling */
.table-responsive.scrolling {
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: var(--em-gray-300) transparent;
}

.table-responsive.scrolling::-webkit-scrollbar {
    display: block;
    height: 6px;
}

.table-responsive.scrolling::-webkit-scrollbar-track {
    background: transparent;
}

.table-responsive.scrolling::-webkit-scrollbar-thumb {
    background: var(--em-gray-400);
    border-radius: 3px;
}

/* Badge Enhancements */
.badge {
    font-weight: 600;
    padding: 0.4em 0.75em;
    border-radius: var(--em-radius-md);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.badge.rounded-pill {
    padding: 0.5em 1em;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* Alert Enhancements */
.alert {
    border-radius: var(--em-radius-md);
    border: none;
    box-shadow: var(--em-shadow-sm);
}

/* Loading States */
.em-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Empty States */
.em-empty-state {
    text-align: center;
    padding: var(--em-spacing-xxl);
    color: var(--em-gray-500);
}

.em-empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--em-spacing-md);
    opacity: 0.5;
}

.em-empty-state-title {
    font-size: var(--em-font-size-lg);
    font-weight: 600;
    margin-bottom: var(--em-spacing-sm);
    color: var(--em-gray-700);
}

.em-empty-state-text {
    font-size: var(--em-font-size-sm);
    color: var(--em-gray-600);
}

/* ============================================
   STANDARDIZED CARD TITLE - V2 DESIGN
   ============================================ */
/* Standardiserad klass fÃ¶r alla card headers i v2-designen */
.title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
    margin: 0;
    color: var(--em-gray-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

[data-theme="dark"] .title {
    color: #f1f5f9 !important;
}

.title i {
    font-size: 1rem;
    color: var(--em-primary);
}

[data-theme="dark"] .title i {
    color: var(--em-primary-light) !important;
}

/* ============================================
   ACL USERS PAGE - V2 STYLING
   ============================================ */

/* Stats Card */
.card[style*="background: linear-gradient(135deg, var(--em-primary-gradient))"] {
    border: none !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .card[style*="background: linear-gradient(135deg, var(--em-primary-gradient))"] {
    background: linear-gradient(135deg, #202942 0%, #2F55D4 100%) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}

/* Card Header */
.card-header[style*="background: linear-gradient(135deg, var(--em-gray-50)"] {
    border-bottom: 1px solid var(--em-gray-200);
}

[data-theme="dark"] .card-header[style*="background: linear-gradient(135deg, var(--em-gray-50)"] {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%) !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .card-header h5 {
    color: #f1f5f9 !important;
}

/* Table styling improvements */
.table thead.table-light th {
    background: linear-gradient(135deg, var(--em-gray-50) 0%, var(--em-gray-100) 100%);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--em-gray-700);
    border-bottom: 2px solid var(--em-gray-300);
}

[data-theme="dark"] .table thead.table-light th {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%) !important;
    color: #f1f5f9 !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

/* Table row hover */
.table tbody tr:hover {
    background-color: var(--em-gray-50);
    transition: background-color 0.15s ease;
}

[data-theme="dark"] .table tbody tr:hover {
    background-color: #334155 !important;
}

/* Table active rows (region sub-rows) */
.table tbody tr.table-active {
    background-color: var(--em-gray-100);
}

[data-theme="dark"] .table tbody tr.table-active {
    background-color: #0f172a !important;
}

[data-theme="dark"] .table tbody tr.table-active td {
    color: #94a3b8 !important;
}

/* Links in table */
.table a {
    transition: color 0.15s ease;
}

.table a:hover {
    text-decoration: underline;
}

/* Badges */
.table .badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    font-weight: 600;
}

/* Form controls in table */
.table .form-select-sm {
    font-size: 0.875rem;
}

/* Modal improvements */
.modal-content.border {
    border: 1px solid var(--em-gray-200) !important;
}

[data-theme="dark"] .modal-content.border {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.modal-header[style*="background: linear-gradient(135deg, var(--em-primary-gradient))"] {
    border-bottom: none !important;
}

[data-theme="dark"] .modal-header[style*="background: linear-gradient(135deg, var(--em-primary-gradient))"] {
    background: linear-gradient(135deg, #202942 0%, #2F55D4 100%) !important;
}

.modal-body .card[style*="background: var(--em-gray-50)"] {
    border: 1px solid var(--em-gray-200);
}

[data-theme="dark"] .modal-body .card[style*="background: var(--em-gray-50)"] {
    background: #334155 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .modal-body .card[style*="background: var(--em-gray-50)"] p {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .modal-body .card[style*="background: var(--em-gray-50)"] .text-muted {
    color: #94a3b8 !important;
}

/* Button improvements */
.btn-outline-primary:hover,
.btn-outline-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.15s ease;
}

[data-theme="dark"] .btn-outline-primary:hover {
    box-shadow: 0 2px 4px rgba(32, 41, 66, 0.3);
}

[data-theme="dark"] .btn-outline-danger:hover {
    box-shadow: 0 2px 4px rgba(248, 113, 113, 0.3);
}

/* Input group improvements */
.input-group .form-select-sm {
    border-right: none;
}

.input-group .btn-sm {
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Confirmation Modal - easyMember 2.0 Style */
.em-v2-modal-content {
    border: none;
    border-radius: var(--em-radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.em-v2-modal-header {
    border-bottom: 1px solid var(--em-gray-200);
    padding: var(--em-spacing-lg);
    background: linear-gradient(135deg, var(--em-gray-50) 0%, var(--em-white) 100%);
    display: flex;
    align-items: center;
    gap: var(--em-spacing-md);
    position: relative;
}

.em-v2-modal-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--em-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--em-primary-gradient);
}

.em-v2-modal-icon-wrapper.warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.em-v2-modal-icon-wrapper.danger  { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.em-v2-modal-icon-wrapper.success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.em-v2-modal-icon-wrapper.info    { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }

.em-v2-modal-icon {
    font-size: 1.5rem;
    color: var(--em-white);
}

.em-v2-modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--em-gray-900);
    margin: 0;
    flex: 1;
}

.em-v2-modal-close {
    opacity: 0.6;
    transition: opacity 0.2s ease;
    padding: var(--em-spacing-xs);
}

.em-v2-modal-close:hover {
    opacity: 1;
}

.em-v2-modal-body {
    padding: var(--em-spacing-lg);
}

.em-v2-modal-message {
    font-size: var(--em-font-size-base);
    color: var(--em-gray-700);
    line-height: 1.6;
}

.em-v2-modal-footer {
    border-top: 1px solid var(--em-gray-200);
    padding: var(--em-spacing-md) var(--em-spacing-lg);
    background: var(--em-gray-50);
    display: flex;
    justify-content: flex-end;
    gap: var(--em-spacing-sm);
}

.em-v2-modal-btn-cancel {
    background: var(--em-white);
    border: 1px solid var(--em-gray-300);
    color: var(--em-gray-700);
    padding: 0.5rem 1.25rem;
    border-radius: var(--em-radius-md);
    font-weight: 600;
    font-size: var(--em-font-size-base);
    transition: var(--em-transition);
}

.em-v2-modal-btn-cancel:hover {
    background: var(--em-gray-100);
    border-color: var(--em-gray-400);
    color: var(--em-gray-900);
}

.em-v2-modal-btn-confirm {
    background: var(--em-primary-gradient);
    border: none;
    color: var(--em-white);
    padding: 0.5rem 1.25rem;
    border-radius: var(--em-radius-md);
    font-weight: 600;
    font-size: var(--em-font-size-base);
    transition: var(--em-transition);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.em-v2-modal-btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
    color: var(--em-white);
}

.em-v2-modal-btn-confirm.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}
.em-v2-modal-btn-confirm.danger:hover { box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3); }

.em-v2-modal-btn-confirm.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}
.em-v2-modal-btn-confirm.warning:hover { box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3); }

.em-v2-modal-btn-confirm.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}
.em-v2-modal-btn-confirm.success:hover { box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3); }

/* Members Page - Vue Component Styling */
.cursor-pointer { cursor: pointer; }
.cursor-pointer:hover { background-color: var(--em-gray-50); }
[data-theme="dark"] .cursor-pointer:hover { background-color: var(--em-gray-700); }

.user-select-none {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Modern Vertical Navigation for User Profile */
.card .nav-link {
    padding: 0.75rem 1.25rem;
    color: var(--em-gray-600);
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center; /* FIX: was invalid "align-items-center" */
    font-weight: 500;
}

.card .nav-link:hover {
    background-color: var(--em-gray-50);
    color: var(--em-primary);
    border-left-color: var(--em-primary);
}

.card .nav-link.active {
    background-color: var(--em-primary);
    color: white;
    border-left-color: var(--em-primary-dark);
    font-weight: 600;
}

.card .nav-link i {
    width: 20px;
    text-align: center;
}

.card .nav-link .badge {
    margin-left: auto;
}

/* Dark theme support */
[data-theme="dark"] .card .nav-link { color: var(--em-gray-300); }
[data-theme="dark"] .card .nav-link:hover {
    background-color: var(--em-gray-800);
    color: var(--em-primary-light);
}
[data-theme="dark"] .card .nav-link.active {
    background-color: var(--em-primary);
    color: white;
}

/* User Profile Hero Section */
.card[style*="background: linear-gradient"] {
    position: relative;
    overflow: hidden;
}

.card[style*="background: linear-gradient"]::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* Stats Cards */
.card .fa-2x { transition: transform 0.3s ease; }
.card:hover .fa-2x { transform: scale(1.1); }

/* Sticky Sidebar */
.sticky-top { z-index: 1020; }

/* Better spacing for profile content */
.tab-content { min-height: 400px; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .card[style*="background: linear-gradient"] .card-body { padding: 1.5rem !important; }
    .card[style*="background: linear-gradient"] img {
        width: 80px !important;
        height: 80px !important;
    }
    .card[style*="background: linear-gradient"] h1 { font-size: 1.25rem !important; }
}

/* Ensure tab-content works correctly */
.tab-content > .tab-pane { display: none; }
.tab-content > .tab-pane.active { display: block; }
.tab-content > .tab-pane.show { display: block; }

/* Enhanced Tabs Styling - Make tabs look like actual tabs/flikar */
.nav-tabs {
    border-bottom: 2px solid var(--em-gray-200);
    margin-bottom: 0;
}

.nav-tabs .nav-item { margin-bottom: -2px; }

.nav-tabs .nav-link {
    border: 1px solid transparent;
    border-top-left-radius: var(--em-radius-md);
    border-top-right-radius: var(--em-radius-md);
    padding: 0.75rem 1.25rem;
    color: var(--em-gray-600);
    background-color: transparent;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
    position: relative;
}

.nav-tabs .nav-link:hover {
    border-color: var(--em-gray-300);
    background-color: var(--em-gray-50);
    color: var(--em-gray-900);
    border-bottom-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--em-primary);
    background-color: var(--em-white);
    border-color: var(--em-gray-200);
    border-bottom-color: var(--em-white);
    font-weight: 600;
}

.nav-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--em-primary);
}

/* Card header tabs - same styling but integrated with card */
.card-header-tabs {
    border-bottom: 2px solid var(--em-gray-200);
    margin: 0;
    padding: 0;
}

.card-header-tabs .nav-link {
    border: 1px solid transparent;
    border-top-left-radius: var(--em-radius-md);
    border-top-right-radius: var(--em-radius-md);
    padding: 0.75rem 1.25rem;
    color: var(--em-gray-600);
    background-color: transparent;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
    position: relative;
    margin-bottom: -2px;
}

.card-header-tabs .nav-link:hover {
    border-color: var(--em-gray-300);
    background-color: var(--em-gray-50);
    color: var(--em-gray-900);
    border-bottom-color: transparent;
}

.card-header-tabs .nav-link.active {
    color: var(--em-primary);
    background-color: var(--em-white);
    border: 1px solid var(--em-gray-200);
    border-bottom-color: var(--em-white);
    font-weight: 600;
}

.card-header-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--em-primary);
}

/* Dark theme support for tabs */
[data-theme="dark"] .nav-tabs { border-bottom-color: var(--em-gray-700); }

[data-theme="dark"] .nav-tabs .nav-link {
    color: var(--em-gray-400);
    background-color: transparent;
}

[data-theme="dark"] .nav-tabs .nav-link:hover {
    background-color: var(--em-gray-800);
    border-color: var(--em-gray-600);
    color: var(--em-gray-200);
    border-bottom-color: transparent;
}

[data-theme="dark"] .nav-tabs .nav-link.active {
    color: var(--em-primary-light);
    background-color: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid #1e293b;
    border-top-left-radius: var(--em-radius-md);
    border-top-right-radius: var(--em-radius-md);
}

[data-theme="dark"] .nav-tabs .nav-link.active::after { background-color: var(--em-primary); }

[data-theme="dark"] .card-header-tabs { border-bottom-color: var(--em-gray-700); }

[data-theme="dark"] .card-header-tabs .nav-link {
    color: var(--em-gray-400);
    background-color: transparent;
}

[data-theme="dark"] .card-header-tabs .nav-link:hover {
    background-color: var(--em-gray-800);
    border-color: var(--em-gray-600);
    color: var(--em-gray-200);
    border-bottom-color: transparent;
}

[data-theme="dark"] .card-header-tabs .nav-link.active {
    color: var(--em-primary-light);
    background-color: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid #1e293b;
    border-top-left-radius: var(--em-radius-md);
    border-top-right-radius: var(--em-radius-md);
}

[data-theme="dark"] .card-header-tabs .nav-link.active::after { background-color: var(--em-primary); }

/* Modern Compact Sidebar Sections */
.user-profile-sidebar .card {
    margin-bottom: 0.75rem !important;
    transition: all 0.2s ease;
}

.user-profile-sidebar .card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.user-profile-sidebar .card-body { padding: 0.75rem !important; }

.user-profile-sidebar .bg-opacity-10 {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-profile-sidebar .border {
    border-color: var(--em-gray-200) !important;
    transition: all 0.2s ease;
}

.user-profile-sidebar a.border:hover {
    border-color: var(--em-primary) !important;
    background: var(--em-primary-light) !important;
    background-opacity: 0.1 !important;
    transform: translateX(2px);
}

.user-profile-sidebar .btn-group-sm { gap: 0.25rem; }

.user-profile-sidebar .badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
}

.user-profile-sidebar .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Quick Actions Grid */
.user-profile-sidebar .btn.flex-column { transition: all 0.2s ease; }
.user-profile-sidebar .btn.flex-column:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Dark theme support */
[data-theme="dark"] .user-profile-sidebar .card {
    background-color: var(--em-gray-900);
    border-color: var(--em-gray-700);
}

[data-theme="dark"] .user-profile-sidebar .card-body {
    background-color: var(--em-gray-900);
}

[data-theme="dark"] .user-profile-sidebar .border {
    border-color: var(--em-gray-700) !important;
    background-color: var(--em-gray-800) !important;
}

[data-theme="dark"] .user-profile-sidebar a.border:hover {
    background-color: var(--em-gray-700) !important;
    border-color: var(--em-primary) !important;
}

/* Dark Sidebar Theme - Uses semantic variables that work in both light and dark themes */
.em-v2-sidebar.dark {
    background: var(--em-surface) !important;
    border-right-color: var(--em-border) !important;
}

.em-v2-sidebar.dark .em-v2-nav-heading {
    color: var(--em-sidebar-heading-color) !important;
}

.em-v2-sidebar.dark .em-v2-nav-link {
    color: var(--em-text-muted) !important;
}

.em-v2-sidebar.dark .em-v2-nav-link:hover {
    background-color: var(--em-sidebar-hover-bg) !important;
    color: var(--em-text) !important;
}

.em-v2-sidebar.dark .em-v2-nav-link.active {
    background-color: var(--em-sidebar-active-bg) !important;
    color: var(--em-sidebar-active-text) !important;
    border-left: none !important;
}

.em-v2-sidebar.dark .em-v2-nav-link.active .em-v2-nav-icon {
    color: var(--em-sidebar-active-text) !important;
}

.em-v2-sidebar.dark .em-v2-nav-sublink {
    color: var(--em-text-muted) !important;
}

.em-v2-sidebar.dark .em-v2-nav-sublink:hover {
    background-color: var(--em-sidebar-hover-bg) !important;
    color: var(--em-text) !important;
}

.em-v2-sidebar.dark .em-v2-nav-sublink.active {
    color: var(--em-sidebar-active-text) !important;
    background-color: transparent !important;
}

.em-v2-sidebar.dark .em-v2-nav-sublink::before {
    background: var(--em-sidebar-sublink-indicator) !important;
}

.em-v2-sidebar.dark .em-v2-nav-sublink.active::before {
    background: var(--em-sidebar-active-text) !important;
}

.em-v2-sidebar.dark .em-v2-sidebar-header {
    background: var(--em-surface) !important;
    border-bottom-color: var(--em-border) !important;
    color: var(--em-text) !important;
}

.em-v2-sidebar.dark .em-v2-nav-icon {
    color: inherit !important;
}

/* Dark theme - Sidebar automatically uses dark surface colors */
[data-theme="dark"] .em-v2-sidebar {
    background: var(--em-dark-surface-1) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
    box-shadow: none;
}

[data-theme="dark"] .em-v2-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .em-v2-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-heading {
    color: var(--em-sidebar-heading-color) !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-link {
    color: var(--em-text-muted) !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-link:hover {
    background-color: var(--em-sidebar-hover-bg) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-link.active {
    background-color: var(--em-sidebar-active-bg) !important;
    color: var(--em-sidebar-active-text) !important;
    border-left: none !important;
    box-shadow: none !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-link.active .em-v2-nav-icon {
    color: var(--em-sidebar-active-text) !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-sublink {
    color: var(--em-text-subtle) !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-sublink::before {
    background: var(--em-sidebar-sublink-indicator) !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-sublink:hover {
    background-color: var(--em-sidebar-hover-bg) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-sublink.active {
    color: var(--em-sidebar-active-text) !important;
    background-color: transparent !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-sublink.active::before {
    background: var(--em-sidebar-active-text) !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-sidebar-header {
    background: var(--em-dark-surface-1) !important;
    border-bottom-color: rgba(255, 255, 255, 0.06) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-icon,
[data-theme="dark"] .em-v2-sidebar .em-v2-nav-chevron {
    color: inherit !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-sublink-dropdown {
    color: var(--em-text-subtle) !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-sublink-dropdown::before {
    background: var(--em-sidebar-sublink-indicator) !important;
}

[data-theme="dark"] .em-v2-sidebar .em-v2-nav-sublink-dropdown:hover {
    background-color: var(--em-sidebar-hover-bg) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .em-v2-nav-item-dropdown.open > .em-v2-nav-submenu {
    background: var(--em-sidebar-submenu-bg) !important;
}

/* Dark mode hover-expand shadow */
@media (min-width: 992px) {
    [data-theme="dark"] .em-v2-sidebar.collapsed:hover {
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.3), 1px 0 0 rgba(255, 255, 255, 0.06);
    }
}

/* ============================================
   SweetAlert2 - easyMember v2 Styling
   ============================================ */

/* Light Theme */
.swal2-popup {
    border-radius: 1rem !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    background: var(--em-white) !important;
    color: var(--em-text) !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

.swal2-title {
    color: var(--em-text) !important;
    font-weight: 600 !important;
    font-size: 1.5rem !important;
    margin-bottom: 0.75rem !important;
}

.swal2-content {
    color: var(--em-text-muted) !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
}

.swal2-icon {
    border: none !important;
    margin: 1.5rem auto 1rem !important;
}

.swal2-icon.swal2-success {
    border-color: var(--em-success) !important;
    color: var(--em-success) !important;
}

.swal2-icon.swal2-success [class^=swal2-success-line] {
    background-color: var(--em-success) !important;
}

.swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(16, 185, 129, 0.3) !important;
}

.swal2-icon.swal2-error {
    border-color: var(--em-danger) !important;
    color: var(--em-danger) !important;
}

.swal2-icon.swal2-error [class^=swal2-x-mark-line] {
    background-color: var(--em-danger) !important;
}

.swal2-icon.swal2-warning {
    border-color: var(--em-warning) !important;
    color: var(--em-warning) !important;
}

.swal2-icon.swal2-info {
    border-color: var(--em-info) !important;
    color: var(--em-info) !important;
}

.swal2-icon.swal2-question {
    border-color: var(--em-primary) !important;
    color: var(--em-primary) !important;
}

.swal2-actions {
    margin: 1.5rem auto 0 !important;
    gap: 0.75rem !important;
}

.swal2-confirm {
    background: #2F55D4 !important;
    border: 1px solid #2F55D4 !important;
    border-radius: 0.5rem !important;
    color: white !important;
    font-weight: 500 !important;
    padding: 0.625rem 1.5rem !important;
    font-size: 0.875rem !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 4px 6px -1px rgba(47, 85, 212, 0.3), 0 2px 4px -1px rgba(47, 85, 212, 0.2) !important;
}

.swal2-confirm:hover {
    background: #2544b0 !important;
    border-color: #2544b0 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 10px 15px -3px rgba(47, 85, 212, 0.4), 0 4px 6px -2px rgba(47, 85, 212, 0.3) !important;
}

.swal2-confirm:active {
    transform: translateY(0) !important;
}

.swal2-cancel {
    background: var(--em-gray-100) !important;
    border: none !important;
    border-radius: 0.5rem !important;
    color: var(--em-text) !important;
    font-weight: 500 !important;
    padding: 0.625rem 1.5rem !important;
    font-size: 0.875rem !important;
    transition: all 0.2s ease !important;
}

.swal2-cancel:hover {
    background: var(--em-gray-200) !important;
    transform: translateY(-1px) !important;
}

.swal2-loader {
    border-color: var(--em-primary) transparent var(--em-primary) transparent !important;
}

.swal2-timer-progress-bar {
    background: #2F55D4 !important;
}

/* Dark Theme */
[data-theme="dark"] .swal2-popup {
    background: var(--em-gray-800) !important;
    color: var(--em-text) !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2) !important;
}

[data-theme="dark"] .swal2-title {
    color: var(--em-text) !important;
}

[data-theme="dark"] .swal2-content {
    color: var(--em-text-muted) !important;
}

[data-theme="dark"] .swal2-cancel {
    background: var(--em-gray-700) !important;
    color: var(--em-text) !important;
}

[data-theme="dark"] .swal2-cancel:hover {
    background: var(--em-gray-600) !important;
}

[data-theme="dark"] .swal2-close {
    color: var(--em-text-muted) !important;
}

[data-theme="dark"] .swal2-close:hover {
    color: var(--em-text) !important;
}

/* Loading State */
.swal2-loading {
    border-color: var(--em-primary) transparent var(--em-primary) transparent !important;
}

/* HTML Content Styling */
.swal2-html-container p {
    margin-bottom: 0.5rem !important;
    color: var(--em-text-muted) !important;
}

.swal2-html-container p:last-child {
    margin-bottom: 0 !important;
}

.swal2-html-container .small {
    font-size: 0.875rem !important;
    color: var(--em-text-muted) !important;
}

/* ============================================
   Hero Avatar - Clickable Upload
   ============================================ */

.hero-avatar-container {
    transition: transform 0.2s ease !important;
}

.hero-avatar-container:hover {
    transform: scale(1.02) !important;
}

.hero-avatar-overlay {
    pointer-events: none !important;
}

.hero-avatar-container:hover .hero-avatar-overlay {
    pointer-events: auto !important;
}

/* ============================================
   Hero Info Pills - Theme Aware
   ============================================ */

.hero-info-pill {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(10px) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    transition: all 0.2s ease !important;
}

.hero-info-pill:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-1px) !important;
}

.hero-info-pill i {
    color: white !important;
    opacity: 0.9 !important;
}

.hero-info-pill span {
    color: white !important;
}

/* Light theme override - make pills more visible */
[data-theme="light"] .hero-info-pill {
    background: rgba(255, 255, 255, 0.95) !important;
    color: var(--em-gray-800) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .hero-info-pill:hover {
    background: rgba(255, 255, 255, 1) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .hero-info-pill i {
    color: var(--em-primary) !important;
    opacity: 1 !important;
}

[data-theme="light"] .hero-info-pill span {
    color: var(--em-gray-800) !important;
}

/* ============================================
   Hero Quick Action Buttons - Theme Aware
   ============================================ */

.hero-action-btn {
    background: rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(10px) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    transition: all 0.2s ease !important;
}

.hero-action-btn:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: translateY(-1px) !important;
    color: white !important;
}

.hero-action-btn i {
    color: white !important;
}

/* Light theme override - make buttons visible */
[data-theme="light"] .hero-action-btn {
    background: rgba(255, 255, 255, 0.95) !important;
    color: var(--em-gray-800) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .hero-action-btn:hover {
    background: rgba(255, 255, 255, 1) !important;
    color: var(--em-primary) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .hero-action-btn i {
    color: var(--em-primary) !important;
}


/* ============================================
   ACTIVITY INDEX PAGE - Modern Dashboard
   ============================================ */

/* KPI Summary Cards */
/* Taket på 260px hindrar korten från att blåsas upp när de är få — med
   1fr blev två kort en halv skärm breda var, med ett ensamt tal i mitten.
   justify-content: start håller dem vänsterställda mot resten av sidan. */
.em-activity-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 260px));
    justify-content: start;
    gap: 12px;
    margin-bottom: 24px;
}

/* Lugnare stat-card: vänsterjusterat innehåll, ikon i hörnet, mindre dekoration */
.em-activity-stat-card {
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: 14px;
    padding: 18px 20px;
    text-align: left;
    box-shadow: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 14px;
    align-items: center;
}
.em-activity-stat-card .em-activity-stat-icon {
    grid-row: 1 / 3;
}
.em-activity-stat-card .em-activity-stat-value {
    align-self: end;
    grid-column: 2;
}
.em-activity-stat-card .em-activity-stat-label {
    align-self: start;
    grid-column: 2;
}

.em-activity-stat-card::before {
    display: none;
}

.em-activity-stat-card:hover {
    border-color: var(--em-accent, #2f55d4);
    transform: none;
    box-shadow: 0 2px 8px rgba(20, 30, 60, 0.06);
}

.em-activity-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    margin-bottom: 0;
    flex-shrink: 0;
}

.em-activity-stat-icon--primary   { background: rgba(47, 85, 212, 0.1);  color: var(--em-accent); }
.em-activity-stat-icon--success   { background: var(--em-success-light);  color: var(--em-success); }
.em-activity-stat-icon--warning   { background: var(--em-warning-light);  color: var(--em-warning); }
.em-activity-stat-icon--danger    { background: var(--em-danger-light);   color: var(--em-danger); }
.em-activity-stat-icon--info      { background: var(--em-info-light);     color: var(--em-info); }

.em-activity-stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--em-text);
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.em-activity-stat-label {
    font-size: 0.78rem;
    color: var(--em-text-muted);
    font-weight: 600;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}


/* Tab Navigation */
.em-activity-tabs {
    display: flex;
    gap: var(--em-spacing-xs);
    border-bottom: 2px solid var(--em-border);
    margin-bottom: var(--em-spacing-lg);
    padding: 0;
    list-style: none;
}

.em-activity-tab {
    padding: var(--em-spacing-sm) var(--em-spacing-lg);
    font-weight: 600;
    font-size: var(--em-font-size-sm);
    color: var(--em-text-muted);
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    transition: color 0.18s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}

.em-activity-tab:hover {
    color: var(--em-text);
}

.em-activity-tab:focus-visible {
    outline: 2px solid var(--em-accent);
    outline-offset: -2px;
    border-radius: var(--em-radius-sm);
}

.em-activity-tab[aria-selected="true"] {
    color: var(--em-accent);
    border-bottom-color: var(--em-accent);
}

.em-activity-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 6px;
    background: var(--em-gray-200);
    color: var(--em-text-muted);
}

.em-activity-tab[aria-selected="true"] .em-activity-tab-badge {
    background: rgba(47, 85, 212, 0.1);
    color: var(--em-accent);
}

/* Search & Filter Toolbar */
.em-activity-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--em-spacing-sm);
    align-items: center;
    margin-bottom: var(--em-spacing-md);
    padding: var(--em-spacing-sm) 0;
}

.em-activity-search {
    flex: 1 1 240px;
    max-width: 360px;
    position: relative;
}

.em-activity-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-md);
    background: var(--em-surface);
    color: var(--em-text);
    font-size: var(--em-font-size-sm);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.em-activity-search-input:focus {
    outline: none;
    border-color: var(--em-accent);
    box-shadow: 0 0 0 3px rgba(47, 85, 212, 0.15);
}

.em-activity-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--em-text-subtle);
    pointer-events: none;
    font-size: 0.875rem;
}

.em-activity-filter-select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-md);
    background: var(--em-surface);
    color: var(--em-text);
    font-size: var(--em-font-size-sm);
    cursor: pointer;
    transition: border-color 0.18s ease;
    min-width: 140px;
    appearance: auto;
}

.em-activity-filter-select:focus {
    outline: none;
    border-color: var(--em-accent);
    box-shadow: 0 0 0 3px rgba(47, 85, 212, 0.15);
}

/* View Toggle (Table / Card) */
.em-activity-view-toggle {
    display: inline-flex;
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-md);
    overflow: hidden;
    margin-left: auto;
}

.em-activity-view-btn {
    padding: 0.4rem 0.65rem;
    background: var(--em-surface);
    border: none;
    color: var(--em-text-muted);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
    font-size: 0.875rem;
    line-height: 1;
}

.em-activity-view-btn + .em-activity-view-btn {
    border-left: 1px solid var(--em-border);
}

.em-activity-view-btn:focus-visible {
    outline: 2px solid var(--em-accent);
    outline-offset: -2px;
}

.em-activity-view-btn[aria-pressed="true"] {
    background: var(--em-accent);
    color: #ffffff;
}

/* Activity Card View */
.em-activity-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--em-spacing-md);
}

.em-activity-card {
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-lg);
    box-shadow: var(--em-shadow-sm);
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.18s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.18s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.em-activity-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--em-shadow-md);
    border-color: var(--em-border-strong);
}

.em-activity-card--cancelled {
    opacity: 0.7;
    border-left: 3px solid var(--em-danger);
}

.em-activity-card--open {
    border-left: 3px solid var(--em-success);
}

.em-activity-card--upcoming-signup {
    border-left: 3px solid var(--em-info);
}

.em-activity-card-header {
    padding: var(--em-spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--em-spacing-sm);
}

.em-activity-card-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--em-text);
    line-height: 1.4;
    flex: 1;
    min-width: 0;
}

.em-activity-card-title a {
    color: inherit;
    text-decoration: none;
}

.em-activity-card-title a:hover {
    color: var(--em-accent);
}

.em-activity-card-title a:focus-visible {
    outline: 2px solid var(--em-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.em-activity-card-body {
    padding: 0 var(--em-spacing-md) var(--em-spacing-md);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--em-spacing-sm);
}

.em-activity-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--em-spacing-sm) var(--em-spacing-md);
    font-size: var(--em-font-size-sm);
    color: var(--em-text-muted);
}

.em-activity-card-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

/* Capacity progress bar */
.em-activity-capacity {
    margin-top: auto;
}

.em-activity-capacity-bar {
    width: 100%;
    height: 6px;
    background: var(--em-gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.em-activity-capacity-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.em-activity-capacity-fill--low      { background: var(--em-success); }
.em-activity-capacity-fill--medium   { background: var(--em-warning); }
.em-activity-capacity-fill--high     { background: var(--em-danger); }

.em-activity-capacity-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--em-text-muted);
    margin-top: 4px;
}

.em-activity-card-footer {
    padding: var(--em-spacing-sm) var(--em-spacing-md);
    border-top: 1px solid var(--em-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Status Pills */
.em-activity-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}

.em-activity-status--open {
    background: var(--em-success-light);
    color: var(--em-success);
}

.em-activity-status--closed {
    background: var(--em-gray-200);
    color: var(--em-text-muted);
}

.em-activity-status--upcoming {
    background: var(--em-info-light);
    color: var(--em-info);
}

.em-activity-status--cancelled {
    background: var(--em-danger-light);
    color: var(--em-danger);
}

.em-activity-status--no-signup {
    background: var(--em-gray-200);
    color: var(--em-text-subtle);
}

/* Bokningsstatus "Bekräftad" — egen färg så den inte krockar med "Öppen anmälan"
   som också är --open/grön (UI-review: olika semantik förtjänar olika färg). */
.em-activity-status--confirmed {
    background: var(--em-info-light);
    color: var(--em-info);
}

.em-activity-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.em-activity-status-dot--open      { background: var(--em-success); }
.em-activity-status-dot--closed    { background: var(--em-gray-400); }
.em-activity-status-dot--upcoming  { background: var(--em-info); }
.em-activity-status-dot--cancelled { background: var(--em-danger); }
.em-activity-status-dot--confirmed { background: var(--em-info); }

/* Enhanced Table View */
.em-activity-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.em-activity-table thead th {
    padding: 0.625rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--em-text-muted);
    border-bottom: 2px solid var(--em-border);
    background: var(--em-surface-2);
    white-space: nowrap;
}

.em-activity-table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--em-border);
    vertical-align: middle;
    color: var(--em-text);
    font-size: var(--em-font-size-sm);
}

.em-activity-table tbody tr {
    transition: background-color 0.15s ease;
}

.em-activity-table tbody tr:hover {
    background: var(--em-surface-2);
}

.em-activity-table tbody tr:last-child td {
    border-bottom: none;
}

/* Empty States */
.em-activity-empty {
    text-align: center;
    padding: var(--em-spacing-xxl) var(--em-spacing-lg);
}

.em-activity-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--em-surface-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--em-text-subtle);
    margin-bottom: var(--em-spacing-md);
}

.em-activity-empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--em-text);
    margin-bottom: var(--em-spacing-xs);
}

.em-activity-empty-description {
    font-size: var(--em-font-size-sm);
    color: var(--em-text-muted);
    margin-bottom: var(--em-spacing-lg);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Screen reader announcements */
.em-activity-sr-announce {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Filter empty state */
.em-activity-filter-empty {
    grid-column: 1 / -1;
}

/* Tab panel */
.em-activity-tab-panel {
    min-height: 200px;
}

/* ============================================
   ACTIVITY INDEX - Dark Mode
   ============================================ */

[data-theme="dark"] .em-activity-stat-card {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-activity-stat-card:hover {
    box-shadow: var(--em-shadow-lg);
}

[data-theme="dark"] .em-activity-search-input,
[data-theme="dark"] .em-activity-filter-select {
    background: var(--em-surface-2);
    border-color: var(--em-border);
    color: var(--em-text);
}

[data-theme="dark"] .em-activity-search-input:focus,
[data-theme="dark"] .em-activity-filter-select:focus {
    border-color: var(--em-accent);
    box-shadow: 0 0 0 3px rgba(74, 115, 245, 0.2);
}

[data-theme="dark"] .em-activity-card {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-activity-card:hover {
    border-color: var(--em-border-strong);
    box-shadow: var(--em-shadow-lg);
}

[data-theme="dark"] .em-activity-card-footer {
    border-top-color: var(--em-border);
}

[data-theme="dark"] .em-activity-capacity-bar {
    background: var(--em-surface-3);
}

[data-theme="dark"] .em-activity-tab {
    color: var(--em-text-muted);
}

[data-theme="dark"] .em-activity-tab:hover {
    color: var(--em-text);
}

[data-theme="dark"] .em-activity-tab[aria-selected="true"] {
    color: var(--em-accent);
    border-bottom-color: var(--em-accent);
}

[data-theme="dark"] .em-activity-tab-badge {
    background: var(--em-surface-3);
    color: var(--em-text-subtle);
}

[data-theme="dark"] .em-activity-tab[aria-selected="true"] .em-activity-tab-badge {
    background: rgba(74, 115, 245, 0.15);
    color: var(--em-accent);
}

[data-theme="dark"] .em-activity-view-btn {
    background: var(--em-surface-2);
    color: var(--em-text-muted);
}

[data-theme="dark"] .em-activity-view-btn + .em-activity-view-btn {
    border-left-color: var(--em-border);
}

[data-theme="dark"] .em-activity-view-btn[aria-pressed="true"] {
    background: var(--em-accent);
    color: #ffffff;
}

[data-theme="dark"] .em-activity-empty-icon {
    background: var(--em-surface-3);
}

[data-theme="dark"] .em-activity-table thead th {
    background: var(--em-surface-3);
    color: var(--em-text-muted);
    border-bottom-color: var(--em-border);
}

[data-theme="dark"] .em-activity-table tbody td {
    border-bottom-color: var(--em-border);
    color: var(--em-text);
}

[data-theme="dark"] .em-activity-table tbody tr:hover {
    background: var(--em-surface-3);
}

[data-theme="dark"] .em-activity-status--closed {
    background: var(--em-surface-3);
}

[data-theme="dark"] .em-activity-status--no-signup {
    background: var(--em-surface-3);
}

[data-theme="dark"] .em-activity-view-toggle {
    border-color: var(--em-border);
}

[data-theme="dark"] .em-activity-tabs {
    border-bottom-color: var(--em-border);
}

/* ============================================
   ACTIVITY INDEX - Responsive
   ============================================ */

@media (max-width: 767.98px) {
    .em-activity-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .em-activity-cards {
        grid-template-columns: 1fr;
    }

    .em-activity-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .em-activity-search {
        max-width: 100%;
    }

    .em-activity-view-toggle {
        margin-left: 0;
        align-self: flex-end;
    }

    .em-activity-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .em-activity-tabs::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .em-activity-stats {
        gap: var(--em-spacing-sm);
    }

    .em-activity-stat-card {
        padding: var(--em-spacing-md);
    }

    .em-activity-stat-value {
        font-size: 1.375rem;
    }

    .em-activity-stat-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* ============================================
   ACTIVITY INDEX - Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .em-activity-stat-card,
    .em-activity-card,
    .em-activity-capacity-fill,
    .em-activity-tab,
    .em-activity-view-btn,
    .em-activity-search-input,
    .em-activity-filter-select,
    .em-activity-table tbody tr {
        transition: none !important;
    }

    .em-activity-stat-card:hover,
    .em-activity-card:hover {
        transform: none !important;
    }

    .em-activity-stat-card::before {
        transition: none !important;
    }
}


/* ============================================
   ACTIVITY SHOW PAGE
   ============================================ */

/* Sammanfattningsrad på aktivitetslistan — ersätter KPI-kortraden vars siffror
   redan stod i flikarnas räknare. */
.em-activity-summary-line {
    font-size: 0.875rem;
    color: var(--em-text-muted);
    margin: 0 0 1rem;
}

/* Tillval och antal — ersätter de tidigare per-tillval/per-fråga-korten i
   nyckeltalsraden. En lista växer på höjden och klarar godtyckligt många rader;
   kortraden växte på bredden och sprack. */
.em-activity-tally {
    background: var(--em-surface, #fff);
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-lg, 12px);
    padding: 1.25rem 1.5rem;
    margin-bottom: var(--em-spacing-lg);
}

.em-activity-tally-row {
    padding: 0.625rem 0;
    border-top: 1px solid var(--em-border);
}

.em-activity-tally-row:first-of-type {
    border-top: 0;
}

.em-activity-tally-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.em-activity-tally-kind {
    flex-shrink: 0;
    font-size: 0.6875rem;
    line-height: 1.4;
    padding: 0.125rem 0.5rem;
    border-radius: var(--em-radius-sm, 6px);
    white-space: nowrap;
}

/* Samma mjuka accent som den valda flikens badge — fungerar i båda teman
   eftersom rgba lägger sig ovanpå underlaget i stället för att sätta en ton. */
.em-activity-tally-kind--addon {
    background: rgba(47, 85, 212, 0.1);
    color: var(--em-accent);
}

.em-activity-tally-kind--question {
    background: var(--em-surface-2);
    color: var(--em-text-muted);
}

.em-activity-tally-label {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
}

.em-activity-tally-note {
    flex-shrink: 0;
    font-size: 0.8125rem;
    color: var(--em-text-muted);
    white-space: nowrap;
}

.em-activity-tally-note--full {
    color: var(--em-danger);
    font-weight: 600;
}

.em-activity-tally-value {
    flex-shrink: 0;
    min-width: 4rem;
    text-align: right;
    font-size: 1rem;
    font-weight: 600;
}

.em-activity-tally-meter {
    height: 4px;
    border-radius: 2px;
    background: var(--em-surface-2);
    margin-top: 0.5rem;
}

.em-activity-tally-meter-fill {
    height: 4px;
    border-radius: 2px;
    background: var(--em-accent);
}

.em-activity-tally-meter-fill--full {
    background: var(--em-danger);
}

@media (max-width: 575.98px) {
    .em-activity-tally-main {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .em-activity-tally-label {
        flex-basis: 100%;
        order: -1;
    }
}

/* Status + nyckelfakta under <x-page-header>. Det egna sidhuvudet
   (.em-activity-show-header m.fl.) togs bort 2026-08-15 när sidan gick över
   till den gemensamma page-header-komponenten. */
.em-activity-show-facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--em-spacing-sm) var(--em-spacing-md);
    margin-bottom: var(--em-spacing-xl);
}

/* Section Titles */
.em-activity-show-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--em-text);
    margin-bottom: var(--em-spacing-md);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Details Panel */
.em-activity-show-details {
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-lg);
    padding: var(--em-spacing-lg);
    margin-bottom: var(--em-spacing-xl);
    box-shadow: var(--em-shadow-sm);
}

.em-activity-show-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--em-spacing-md);
}

.em-activity-show-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.em-activity-show-detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--em-text-muted);
}

.em-activity-show-detail-value {
    font-size: var(--em-font-size-sm);
    color: var(--em-text);
    font-weight: 500;
}

/* Direct Link */
.em-activity-show-directlink {
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-lg);
    padding: var(--em-spacing-lg);
    margin-bottom: var(--em-spacing-xl);
    box-shadow: var(--em-shadow-sm);
}

.em-activity-show-link-row {
    display: flex;
    gap: var(--em-spacing-sm);
    align-items: center;
}

.em-activity-show-link-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-md);
    background: var(--em-surface-2);
    color: var(--em-text);
    font-size: var(--em-font-size-sm);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.em-activity-show-link-input:focus {
    outline: none;
    border-color: var(--em-accent);
    box-shadow: 0 0 0 3px rgba(47, 85, 212, 0.15);
}

/* Bookings Section */
.em-activity-show-bookings {
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-lg);
    padding: var(--em-spacing-lg);
    box-shadow: var(--em-shadow-sm);
}

/* Paid status pill — grön (betalt = klart), så den skiljs från den
   blå "Bekräftad"-pillen. Använder success-variablerna som är
   theme-medvetna, så dark mode anpassas automatiskt. */
.em-activity-status--paid {
    background: var(--em-success-light);
    color: var(--em-success);
}

.em-activity-status-dot--paid {
    background: var(--em-success);
}

/* ============================================
   ACTIVITY SHOW - Dark Mode
   ============================================ */

[data-theme="dark"] .em-activity-show-details,
[data-theme="dark"] .em-activity-show-directlink,
[data-theme="dark"] .em-activity-show-bookings {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-activity-show-link-input {
    background: var(--em-surface-3);
    border-color: var(--em-border);
    color: var(--em-text);
}

[data-theme="dark"] .em-activity-show-link-input:focus {
    border-color: var(--em-accent);
    box-shadow: 0 0 0 3px rgba(74, 115, 245, 0.2);
}

/* (Paid-pillen i dark mode hanteras nu via theme-medvetna success-vars) */

/* ============================================
   ACTIVITY SHOW - Responsive
   ============================================ */

@media (max-width: 767.98px) {
    .em-activity-show-facts {
        flex-direction: column;
        align-items: flex-start;
    }

    .em-activity-show-details-grid {
        grid-template-columns: 1fr;
    }

    .em-activity-show-link-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ============================================
   ACTIVITY SHOW - Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .em-activity-show-details,
    .em-activity-show-directlink,
    .em-activity-show-bookings {
        transition: none !important;
    }
}


/* ============================================
   ACTIVITY FORM (Create / Edit)
   ============================================ */

/* Page Header */
.em-activity-form-header {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-md);
    margin-bottom: var(--em-spacing-xl);
}

.em-activity-form-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--em-text);
    margin: 0;
}

.em-activity-form-header .badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25em 0.75em;
    border-radius: var(--em-radius-full);
}

/* Container */
.em-activity-form-container {
    max-width: 960px;
}

/* ===== Aktivitetsformulär — anpassad till admin-designen ===== */

/* Tabbar med ikoner + badge/check.
   !important + scrollbar-hide för att tvinga bort scroll-artefakten
   som ärvs från em-activity-form-tabs (har overflow-x: auto). */
.em-actform-tabs {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid var(--em-border);
    list-style: none;
    overflow: visible !important;
    max-height: none !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.em-actform-tabs::-webkit-scrollbar {
    display: none;
}
.em-actform-tabs li.nav-item {
    list-style: none;
    margin: 0;
    flex-shrink: 1;
}
.em-actform-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    color: var(--em-text-muted);
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    white-space: nowrap;
}
.em-actform-tab:hover {
    color: var(--em-text);
    background: rgba(47, 85, 212, 0.04);
}
.em-actform-tab.active {
    color: var(--em-accent, #2f55d4);
    border-bottom-color: var(--em-accent, #2f55d4);
    background: transparent;
}
.em-actform-tab i {
    font-size: 0.95rem;
    opacity: 0.9;
}
.em-actform-tab-check {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    background: #d1fae5;
    color: #047857;
    border-radius: 50%;
    font-size: 0.65rem;
    margin-left: 2px;
}
.em-actform-tab-check--danger {
    background: #fde7e9;
    color: #b3261e;
}
.em-actform-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--em-surface-sunken, #f5f7fb);
    color: var(--em-text-muted);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: 2px;
}
.em-actform-tab.active .em-actform-tab-badge {
    background: rgba(47, 85, 212, 0.12);
    color: var(--em-accent, #2f55d4);
}

/* Mobil: kompaktare tabbar med scroll om de inte ryms.
   Visa bara aktiv flikens text; inaktiva blir bara ikon + ev. badge —
   ger plats till alla fliknamn utan att texten klipps. */
@media (max-width: 767.98px) {
    .em-actform-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory;
    }
    .em-actform-tab {
        padding: 12px 14px;
        font-size: 0.88rem;
        flex-shrink: 0;
        scroll-snap-align: start;
    }
    .em-actform-tab:not(.active) .em-actform-tab-label {
        display: none;
    }
    .em-actform-tab i { font-size: 1rem; }
}

/* ===== Form-inputs inom aktivitetsformuläret =====
   Anpassar Bootstrap-defaults så form-control / form-select får samma
   premium-känsla som toggle-pills och sektioner. */
.em-actform-section .form-control,
.em-actform-section .form-select,
.em-actform-section .input-group-text {
    border-radius: 10px;
    border-color: var(--em-border);
    padding: 10px 14px;
    font-size: 0.92rem;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.em-actform-section .form-control:hover,
.em-actform-section .form-select:hover {
    border-color: rgba(47, 85, 212, 0.35);
}
.em-actform-section .form-control:focus,
.em-actform-section .form-select:focus {
    border-color: var(--em-accent, #2f55d4);
    box-shadow: 0 0 0 4px rgba(47, 85, 212, 0.08);
    outline: 0;
}
.em-actform-section textarea.form-control {
    line-height: 1.5;
    min-height: 90px;
}

/* Dölj de inbyggda upp/ner-pilarna i nummerfält (Chrome/Edge/Safari)
   så de matchar våra rena, polerade inputs. */
.em-actform-section input[type="number"]::-webkit-inner-spin-button,
.em-actform-section input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.em-actform-section input[type="number"] {
    -moz-appearance: textfield;
}

/* Input-grupp (datepicker, kr-suffix, etc.) — runda hörn på första/sista */
.em-actform-section .input-group {
    border-radius: 10px;
    overflow: hidden;
}
.em-actform-section .input-group > .form-control,
.em-actform-section .input-group > .input-group-text {
    border-radius: 0;
}
.em-actform-section .input-group > :first-child {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}
.em-actform-section .input-group > :last-child {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}
.em-actform-section .input-group-text {
    background: var(--em-surface-sunken);
    color: var(--em-text-muted);
    border-color: var(--em-border);
}

/* Mobilanpassning för date-range — vänd till stackad layout på små skärmar
   så fälten får full bredd istället för att tryckas ihop. */
@media (max-width: 575.98px) {
    .em-actform-section .input-daterange.input-group {
        flex-direction: column;
        border: 0;
        gap: 8px;
        overflow: visible;
    }
    .em-actform-section .input-daterange.input-group > .form-control {
        border-radius: 10px;
        border: 1px solid var(--em-border);
        width: 100%;
    }
    .em-actform-section .input-daterange.input-group > .input-group-text {
        border-radius: 0;
        background: transparent;
        border: 0;
        padding: 4px 0;
        justify-content: center;
    }
}

/* ===== Avancerat-flärp (disclosure) =====
   Bygger på native <details><summary>. Default-stängt, expanderar
   när användaren klickar. Används för fält som är sällan-relevanta
   som bokföring per aktivitet/tillval. */
.em-actform-disclosure[open] .em-actform-disclosure-chevron {
    transform: rotate(90deg);
}
.em-actform-disclosure-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    user-select: none;
}
.em-actform-disclosure-summary::-webkit-details-marker {
    display: none;
}
.em-actform-disclosure-chevron {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--em-surface-sunken);
    color: var(--em-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    transition: transform 0.15s ease;
}
.em-actform-disclosure-eyebrow {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--em-text-muted);
}
.em-actform-disclosure-title {
    display: block;
    font-weight: 600;
    color: var(--em-text);
    font-size: 0.95rem;
    margin-top: 2px;
}
.em-actform-disclosure-body {
    padding-top: 4px;
    padding-bottom: 8px;
}
/* Inline-variant: när disclosure ligger inuti annan kontext (t.ex. modal)
   utan section-padding, ge den en egen ram så den ser ut som en behållare. */
.em-actform-disclosure--inline {
    border: 1px solid var(--em-border);
    border-radius: 10px;
    padding: 0 16px;
    background: var(--em-surface-sunken);
}
.em-actform-disclosure--inline .em-actform-disclosure-summary {
    padding: 12px 0;
}
.em-actform-disclosure--inline[open] .em-actform-disclosure-summary {
    border-bottom: 1px solid var(--em-border);
}
.em-actform-disclosure--inline .em-actform-disclosure-body {
    padding: 16px 0;
}

/* Sektion-kort inom tab — ikon + titel + subtitle, sen fält */
.em-actform-section {
    padding: 24px 28px;
    border-bottom: 1px solid var(--em-border);
}
.em-actform-section:last-child {
    border-bottom: 0;
}
.em-actform-section-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 22px;
}
.em-actform-section-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(47, 85, 212, 0.1);
    color: var(--em-accent, #2f55d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.em-actform-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--em-text);
    margin: 0 0 2px;
    letter-spacing: -0.01em;
}
.em-actform-section-subtitle {
    font-size: 0.875rem;
    color: var(--em-text-muted);
    margin: 0;
    line-height: 1.4;
}

/* Fältblock */
.em-actform-field {
    margin-bottom: 18px;
}
.em-actform-field:last-child {
    margin-bottom: 0;
}
.em-actform-field--narrow input,
.em-actform-field--narrow select {
    max-width: 360px;
}
.em-actform-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.em-actform-label {
    display: inline-block;
    font-weight: 600;
    color: var(--em-text);
    margin-bottom: 4px;
    font-size: 0.92rem;
}
.em-actform-help {
    display: block;
    color: var(--em-text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
    margin: -2px 0 8px;
}

/* Variant: help-text placerad EFTER inputen (för att input ska kunna
   linjera vertikalt i två-kolumns-grids även när help-texterna är
   olika långa). */
.em-actform-help--after {
    margin: 6px 0 0;
}

/* Grid — två-kolumns layout för relaterade fält */
.em-actform-grid {
    display: grid;
    gap: 16px;
}
.em-actform-grid-2 {
    grid-template-columns: 1fr 1fr;
}
@media (max-width: 767.98px) {
    .em-actform-grid-2 { grid-template-columns: 1fr; }
}

/* Toggle-pills (ersätter Ja/Nej radioknapparna) */
.em-actform-toggle-group {
    display: inline-flex;
    gap: 8px;
    margin-top: 6px;
}
.em-actform-toggle {
    cursor: pointer;
    display: inline-flex;
}
.em-actform-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.em-actform-toggle-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--em-border);
    border-radius: 999px;
    background: var(--em-surface);
    color: var(--em-text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    user-select: none;
}
.em-actform-toggle-pill i { font-size: 0.78rem; opacity: 0.7; }
.em-actform-toggle:hover .em-actform-toggle-pill {
    border-color: var(--em-accent, #2f55d4);
    color: var(--em-text);
}
.em-actform-toggle-input:checked + .em-actform-toggle-pill {
    background: var(--em-accent, #2f55d4);
    border-color: var(--em-accent, #2f55d4);
    color: white;
}
.em-actform-toggle-input:checked + .em-actform-toggle-pill i { opacity: 1; }
.em-actform-toggle-input:focus-visible + .em-actform-toggle-pill {
    outline: 2px solid var(--em-accent, #2f55d4);
    outline-offset: 2px;
}

/* ===== Choice-cards (radio-knappar i kort-format) =====
   Används bl.a. för Betalflöde-val. Två kolumner med kant + titel +
   beskrivning. Selected får accent-färgad ram + ljus accentbakgrund. */
.em-actform-choice-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 6px;
}
@media (max-width: 575.98px) {
    .em-actform-choice-group { grid-template-columns: 1fr; }
}
.em-actform-choice {
    display: block;
    cursor: pointer;
    position: relative;
}
.em-actform-choice-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.em-actform-choice-card {
    display: block;
    padding: 16px 18px;
    border: 1.5px solid var(--em-border);
    border-radius: 12px;
    background: var(--em-surface);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.em-actform-choice:hover .em-actform-choice-card {
    border-color: rgba(47, 85, 212, 0.45);
}
.em-actform-choice-input:checked + .em-actform-choice-card {
    border-color: var(--em-accent, #2f55d4);
    background: rgba(47, 85, 212, 0.04);
}
.em-actform-choice-input:focus-visible + .em-actform-choice-card {
    outline: 2px solid var(--em-accent, #2f55d4);
    outline-offset: 2px;
}
.em-actform-choice-title {
    display: block;
    font-weight: 700;
    color: var(--em-text);
    font-size: 0.95rem;
    margin-bottom: 4px;
}
.em-actform-choice-desc {
    display: block;
    font-size: 0.82rem;
    color: var(--em-text-muted);
    line-height: 1.4;
}

/* ===== Förhandsvisning (höger-kolumn) ===== */
.em-actform-payments-col {
    padding-right: 24px;
}
.em-actform-preview-col {
    padding: 24px 28px;
    border-left: 1px solid var(--em-border);
    background: var(--em-surface-sunken);
}
.em-actform-preview {
    position: sticky;
    top: 16px;
}
.em-actform-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 18px;
    gap: 12px;
}
.em-actform-preview-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--em-text-muted);
}
.em-actform-preview-subtitle {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--em-text);
    margin-top: 2px;
}
.em-actform-preview-participants {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--em-text-muted);
}
.em-actform-preview-participants input {
    width: 56px;
    padding: 6px 8px;
    border: 1px solid var(--em-border);
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    background: var(--em-surface);
}
.em-actform-preview-participants input:focus {
    border-color: var(--em-accent, #2f55d4);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(47, 85, 212, 0.08);
}
.em-actform-preview-lines {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 16px;
    min-height: 60px;
}
.em-actform-preview-lines > div,
.em-actform-preview-lines > .em-preview-line {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid var(--em-border);
    font-size: 0.88rem;
    color: var(--em-text);
}
.em-actform-preview-lines > :first-child {
    border-top: 0;
}
.em-actform-preview-lines :is(.text-muted, small) {
    color: var(--em-text-muted) !important;
    font-size: 0.82rem;
}
.em-actform-preview-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 16px;
    border-top: 2px solid var(--em-text);
    margin-bottom: 8px;
}
.em-actform-preview-total > span:first-child {
    font-weight: 600;
    color: var(--em-text-muted);
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.em-actform-preview-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--em-text);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.em-actform-preview-foot {
    font-size: 0.78rem;
    color: var(--em-text-muted);
    margin: 0;
    line-height: 1.4;
}

/* Mobil: preview blir egen sektion under, inte sidoplacerad */
@media (max-width: 991.98px) {
    .em-actform-payments-col { padding-right: 0; }
    .em-actform-preview-col {
        border-left: 0;
        border-top: 1px solid var(--em-border);
        padding: 20px 16px;
    }
    .em-actform-preview { position: static; }
}

/* Mobil: större touch-target + jämn breddfördelning */
@media (max-width: 575.98px) {
    .em-actform-toggle-group {
        display: flex;
        width: 100%;
        gap: 8px;
    }
    .em-actform-toggle {
        flex: 1;
    }
    .em-actform-toggle-pill {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 0.92rem;
        min-height: 44px;
    }
}

/* Sektionspadding — mer kompakt på mobil */
@media (max-width: 575.98px) {
    .em-actform-section {
        padding: 18px 16px;
    }
    .em-actform-section-header {
        gap: 10px;
        margin-bottom: 16px;
    }
    .em-actform-section-icon {
        width: 34px;
        height: 34px;
        font-size: 0.92rem;
    }
    .em-actform-section-title {
        font-size: 0.98rem;
    }
    .em-actform-section-subtitle {
        font-size: 0.82rem;
    }
}

/* Sticky save-bar längst ned */
.em-actform-stickybar {
    position: sticky;
    bottom: 0;
    margin-top: 16px;
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-lg);
    box-shadow: 0 -2px 16px rgba(20, 30, 60, 0.06);
    padding: 12px 20px;
    z-index: 50;
    max-width: 960px;
}
.em-actform-stickybar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.em-actform-stickybar-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--em-text-muted);
    font-size: 0.88rem;
}
.em-actform-stickybar-status i { font-size: 0.85rem; }
.em-actform-stickybar-actions {
    display: inline-flex;
    gap: 8px;
}

/* Sektion-header med inline-action (knapp till höger) */
.em-actform-section-header--with-action {
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.em-actform-section-header--with-action .btn {
    flex-shrink: 0;
}

/* Action-knappar i tabellrader — outline-stil, gråa default, accent vid hover */
.em-actform-rowactions {
    display: inline-flex;
    gap: 4px;
    justify-content: flex-end;
}
.em-actform-rowbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--em-border);
    border-radius: 8px;
    background: var(--em-surface);
    color: var(--em-text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.em-actform-rowbtn:hover {
    border-color: var(--em-accent, #2f55d4);
    color: var(--em-accent, #2f55d4);
    background: rgba(47, 85, 212, 0.04);
}
.em-actform-rowbtn--danger:hover {
    border-color: #b3261e;
    color: #b3261e;
    background: #fde7e9;
}

/* Mini-badge för "Krävs"-status och liknande inline-flaggor */
.em-actform-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.em-actform-badge--required {
    background: #fff4e0;
    color: #b76b00;
}

/* Type-tag i tabeller — neutral pill för rad-typ */
.em-actform-typetag {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 6px;
    background: var(--em-surface-sunken);
    color: var(--em-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

/* Cell — huvudtext i en tabell-rad får mer vikt */
.em-actform-cell-main {
    font-weight: 600;
    color: var(--em-text);
}

/* Tabell i en sektion — minimal styling som ärver från em-activity-table */
.em-actform-table {
    width: 100%;
    margin: 0;
}
.em-actform-table thead th {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--em-text-muted);
    border-bottom: 1px solid var(--em-border);
    padding: 12px 12px;
    background: var(--em-surface-sunken);
}
.em-actform-table tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--em-border);
    vertical-align: middle;
    font-size: 0.92rem;
}
.em-actform-table tbody tr:last-child td {
    border-bottom: 0;
}
.em-actform-table-empty td {
    padding: 0 !important;
    background: transparent;
    border: 0 !important;
}

/* Empty state — när listor saknar data */
.em-actform-empty {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 28px 24px;
    background: var(--em-surface-sunken);
    border: 1px dashed var(--em-border);
    border-radius: 12px;
    margin-top: 8px;
}
.em-actform-empty > i {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--em-surface);
    color: var(--em-text-muted);
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.em-actform-empty-title {
    font-weight: 600;
    color: var(--em-text);
    margin-bottom: 2px;
}
.em-actform-empty-text {
    color: var(--em-text-muted);
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Citatlik blockstil för t.ex. inställnings-meddelandet */
.em-actform-quote {
    background: var(--em-surface-sunken);
    border-left: 3px solid var(--em-accent, #2f55d4);
    border-radius: 8px;
    padding: 14px 18px;
    color: var(--em-text);
    line-height: 1.5;
    white-space: pre-line;
}

/* Danger-variant av sektion — för "Ställ in"-tabben */
.em-actform-section--danger {
    background: linear-gradient(180deg, #fff6f6 0%, var(--em-surface) 70%);
    border-left: 3px solid #b3261e;
}
.em-actform-section-icon--danger {
    background: #fde7e9;
    color: #b3261e;
}
.em-actform-danger-action {
    background: var(--em-surface);
    border: 1px solid #fde7e9;
    border-radius: 12px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}
.em-actform-danger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid #b3261e;
    background: transparent;
    color: #b3261e;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.em-actform-danger-btn:hover {
    background: #b3261e;
    color: white;
}
.em-actform-danger-btn i { font-size: 0.85rem; }

/* Göm den inbäddade footern när sticky finns — i mobillayout visas båda */
.em-actform-footer-inline {
    display: none;
}
@media (max-width: 575.98px) {
    .em-actform-stickybar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
    }
    .em-actform-stickybar-status span { display: none; }
    .em-actform-stickybar-actions { flex: 1; }
    .em-actform-stickybar-actions .btn { flex: 1; }
    .em-actform-shell { padding-bottom: 80px; }
}

/* Card */
.em-activity-form-card {
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-lg);
    box-shadow: var(--em-shadow-sm);
    overflow: hidden;
}

/* Tabs */
.em-activity-form-tabs {
    display: flex;
    gap: 0;
    padding: 0 var(--em-spacing-lg);
    border-bottom: 1px solid var(--em-border);
    background: var(--em-surface);
    margin: 0;
    list-style: none;
    overflow-x: auto;
}

.em-activity-form-tabs .nav-item {
    flex-shrink: 0;
}

.em-activity-form-tab {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: var(--em-font-size-sm);
    font-weight: 500;
    color: var(--em-text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 180ms ease, border-color 180ms ease;
    white-space: nowrap;
}

.em-activity-form-tab:hover {
    color: var(--em-text);
    text-decoration: none;
}

.em-activity-form-tab.active {
    color: var(--em-accent);
    border-bottom-color: var(--em-accent);
}

/* Body */
.em-activity-form-body {
    padding: var(--em-spacing-xl);
}

/* Divider */
.em-activity-form-divider {
    height: 1px;
    background: var(--em-border);
    margin: var(--em-spacing-lg) 0;
}

/* Form Group */
.em-activity-form-group {
    margin-bottom: var(--em-spacing-lg);
}

.em-activity-form-group > label,
.em-activity-form-group > .col-form-label {
    font-weight: 500;
    color: var(--em-text);
    margin-bottom: 0.375rem;
}

.em-activity-form-help {
    font-size: var(--em-font-size-xs);
    color: var(--em-text-muted);
    margin-top: 0.25rem;
}

/* Date Row (2-column grid) */
.em-activity-form-date-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--em-spacing-lg);
}

/* Radio Group */
.em-activity-form-radio-group {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-lg);
}

/* Footer */
.em-activity-form-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--em-spacing-sm);
    padding: var(--em-spacing-md) var(--em-spacing-xl);
    border-top: 1px solid var(--em-border);
    background: var(--em-surface-2);
}

/* Modal Header */
/* Modal-header: vit bakgrund med tunn underrad — matchar resten av admin */
.em-activity-form-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    background: var(--em-surface);
    color: var(--em-text);
    border-bottom: 1px solid var(--em-border);
    border-radius: var(--em-radius-lg) var(--em-radius-lg) 0 0;
}
.em-activity-form-modal-header h5 {
    margin: 0;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--em-text);
    letter-spacing: -0.01em;
}
.em-activity-form-modal-header .btn-close {
    filter: none;
    opacity: 0.6;
    transition: opacity 0.12s ease;
}
.em-activity-form-modal-header .btn-close:hover {
    opacity: 1;
}

/* Modal-body: ärver samma fält-stilar som em-actform-section */
.em-activity-form-modal-header + .card-body,
.modal-content .card-body {
    padding: 22px;
}
.modal-content .card-body .form-control,
.modal-content .card-body .form-select,
.modal-content .card-body .input-group-text {
    border-radius: 10px;
    border-color: var(--em-border);
    padding: 10px 14px;
    font-size: 0.92rem;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.modal-content .card-body .form-control:focus,
.modal-content .card-body .form-select:focus {
    border-color: var(--em-accent, #2f55d4);
    box-shadow: 0 0 0 4px rgba(47, 85, 212, 0.08);
    outline: 0;
}
.modal-content .card-body .input-group {
    border-radius: 10px;
    overflow: hidden;
}
.modal-content .card-body .input-group-text {
    background: var(--em-surface-sunken);
    color: var(--em-text-muted);
}
.modal-content .card-body label {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--em-text);
    margin-bottom: 4px;
}

/* Modal-footer: ljus bakgrund, mer luft */
.modal-content .card-footer {
    padding: 14px 22px;
    background: var(--em-surface-sunken);
    border-top: 1px solid var(--em-border);
    border-radius: 0 0 var(--em-radius-lg) var(--em-radius-lg);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.modal-content .card-footer .btn {
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
}

/* ============================================
   ACTIVITY FORM - Dark Mode
   ============================================ */

[data-theme="dark"] .em-activity-form-card {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-activity-form-tabs {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-activity-form-tab:hover {
    color: var(--em-text);
}

[data-theme="dark"] .em-activity-form-tab.active {
    color: var(--em-accent);
    border-bottom-color: var(--em-accent);
}

[data-theme="dark"] .em-activity-form-footer {
    background: var(--em-surface-3);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-activity-form-modal-header {
    background: var(--em-accent);
}

/* ============================================
   ACTIVITY FORM - Responsive
   ============================================ */

@media (max-width: 767.98px) {
    .em-activity-form-date-row {
        grid-template-columns: 1fr;
    }

    .em-activity-form-body {
        padding: var(--em-spacing-lg);
    }

    .em-activity-form-tabs {
        padding: 0 var(--em-spacing-md);
    }

    .em-activity-form-footer {
        padding: var(--em-spacing-md) var(--em-spacing-lg);
    }
}

/* ============================================
   ACTIVITY FORM - Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .em-activity-form-tab {
        transition: none !important;
    }
}

/* ============================================
   DOCUMENT PAGE
   ============================================ */

/* --- Stats Row --- */

.em-doc-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--em-spacing-md);
    margin-bottom: var(--em-spacing-xl);
}

.em-doc-stat-card {
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-lg);
    padding: var(--em-spacing-lg);
    text-align: center;
    box-shadow: var(--em-shadow-sm);
    transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.em-doc-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--em-primary-gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 300ms ease;
}

.em-doc-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--em-shadow-md);
}

.em-doc-stat-card:hover::before {
    transform: scaleX(1);
}

.em-doc-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--em-radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    margin-bottom: var(--em-spacing-sm);
}

.em-doc-stat-icon--primary { background: rgba(47, 85, 212, 0.1); color: var(--em-accent); }
.em-doc-stat-icon--success { background: var(--em-success-light); color: var(--em-success); }
.em-doc-stat-icon--info    { background: var(--em-info-light);    color: var(--em-info); }
.em-doc-stat-icon--warning { background: var(--em-warning-light); color: var(--em-warning); }
/* Nyckeltalskorten här används även av försäkringslistan — em-doc-prefixet
   är historiskt. Danger-varianten tillkom för "Obetalda". */
.em-doc-stat-icon--danger  { background: color-mix(in srgb, var(--em-danger) 12%, transparent); color: var(--em-danger); }

.em-doc-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--em-text);
    line-height: 1.2;
}

.em-doc-stat-label {
    font-size: var(--em-font-size-sm);
    color: var(--em-text-muted);
    font-weight: 500;
    margin-top: var(--em-spacing-xs);
}

/* --- Sidebar Widget --- */

.em-doc-sidebar-widget {
    background: var(--em-surface);
    border-radius: var(--em-radius-lg);
    box-shadow: var(--em-shadow-sm);
    border: 1px solid var(--em-border);
    overflow: hidden;
    transition: box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: var(--em-spacing-md);
}

.em-doc-sidebar-widget:hover {
    box-shadow: var(--em-shadow-md);
}

.em-doc-sidebar-widget-header {
    padding: var(--em-spacing-sm) var(--em-spacing-md);
    border-bottom: 1px solid var(--em-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--em-surface-2) 0%, var(--em-surface) 100%);
}

.em-doc-sidebar-widget-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--em-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--em-spacing-sm);
}

.em-doc-icon-pill {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--em-radius-sm);
    background: var(--em-primary-gradient);
    color: var(--em-white);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.em-doc-sidebar-widget-body {
    padding: var(--em-spacing-md);
}

/* --- Category Nav --- */

.em-doc-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.em-doc-category-item {
    margin-bottom: 2px;
}

.em-doc-category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--em-radius-md);
    color: var(--em-text);
    text-decoration: none;
    font-size: var(--em-font-size-sm);
    font-weight: 500;
    transition: background-color 180ms cubic-bezier(0.4, 0, 0.2, 1),
                color 180ms cubic-bezier(0.4, 0, 0.2, 1),
                transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.em-doc-category-link:hover {
    background: var(--em-surface-2);
    color: var(--em-accent);
    transform: translateX(2px);
    text-decoration: none;
}

.em-doc-category-link.active {
    background: rgba(47, 85, 212, 0.08);
    color: var(--em-accent);
    font-weight: 600;
}

.em-doc-category-icon {
    opacity: 0.6;
    margin-right: var(--em-spacing-sm);
    font-size: 0.8rem;
    transition: opacity 180ms ease;
}

.em-doc-category-link:hover .em-doc-category-icon,
.em-doc-category-link.active .em-doc-category-icon {
    opacity: 1;
}

.em-doc-category-count {
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--em-surface-2);
    color: var(--em-text-muted);
    padding: 0.15em 0.5em;
    border-radius: 999px;
    min-width: 22px;
    text-align: center;
    line-height: 1.4;
}

.em-doc-category-link.active .em-doc-category-count {
    background: rgba(47, 85, 212, 0.15);
    color: var(--em-accent);
}

/* --- Category Create Button --- */

.em-doc-category-create-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--em-radius-sm);
    background: var(--em-success);
    color: var(--em-white);
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background-color 180ms ease, transform 180ms ease;
}

.em-doc-category-create-btn:hover {
    background: #059669;
    transform: scale(1.08);
}

/* --- Recent Files List --- */

.em-doc-recent-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.em-doc-recent-item {
    margin-bottom: 2px;
}

.em-doc-recent-link {
    display: flex;
    align-items: flex-start;
    gap: var(--em-spacing-sm);
    padding: 0.5rem;
    border-radius: var(--em-radius-md);
    text-decoration: none;
    color: var(--em-text);
    transition: background-color 180ms cubic-bezier(0.4, 0, 0.2, 1),
                transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.em-doc-recent-link:hover {
    background: var(--em-surface-2);
    transform: translateX(2px);
    text-decoration: none;
    color: var(--em-text);
}

.em-doc-recent-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--em-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.em-doc-recent-icon--pdf   { background: var(--em-danger-light);  color: var(--em-danger); }
.em-doc-recent-icon--image { background: var(--em-info-light);    color: var(--em-info); }
.em-doc-recent-icon--excel { background: var(--em-success-light); color: var(--em-success); }
.em-doc-recent-icon--word  { background: rgba(47, 85, 212, 0.1); color: var(--em-accent); }
.em-doc-recent-icon--other { background: var(--em-surface-2);     color: var(--em-text-muted); }

.em-doc-recent-info {
    flex: 1;
    min-width: 0;
}

.em-doc-recent-title {
    font-size: var(--em-font-size-sm);
    font-weight: 600;
    color: var(--em-text);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.em-doc-recent-meta {
    font-size: 0.75rem;
    color: var(--em-text-muted);
}

/* --- Main Content Widget --- */

.em-doc-main-widget {
    background: var(--em-surface);
    border-radius: var(--em-radius-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--em-border);
    overflow: hidden;
    position: relative;
    transition: box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.em-doc-main-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--em-primary-gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 300ms ease;
    z-index: 1;
}

.em-doc-main-widget:hover::before {
    transform: scaleX(1);
}

.em-doc-main-widget-header {
    padding: var(--em-spacing-sm) var(--em-spacing-md);
    border-bottom: 1px solid var(--em-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--em-spacing-sm);
    background: linear-gradient(135deg, var(--em-surface-2) 0%, var(--em-surface) 100%);
}

.em-doc-main-widget-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--em-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--em-spacing-sm);
}

.em-doc-main-widget-title .em-doc-icon-pill {
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.em-doc-main-widget-actions {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-xs);
}

.em-doc-main-widget-body {
    padding: 0;
}

/* --- Document Table --- */

.em-doc-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.em-doc-table thead th {
    padding: 0.625rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--em-text-muted);
    border-bottom: 2px solid var(--em-border);
    background: var(--em-surface-2);
    white-space: nowrap;
}

.em-doc-table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--em-border);
    vertical-align: middle;
    color: var(--em-text);
    font-size: var(--em-font-size-sm);
}

.em-doc-table tbody tr {
    transition: background-color 150ms ease;
}

.em-doc-table tbody tr:hover {
    background: var(--em-surface-2);
}

.em-doc-table tbody tr:last-child td {
    border-bottom: none;
}

/* --- File Type Badge --- */

.em-doc-filetype {
    width: 40px;
    height: 40px;
    border-radius: var(--em-radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    transition: transform 180ms ease;
}

.em-doc-filetype:hover {
    transform: scale(1.08);
}

.em-doc-filetype--pdf   { background: var(--em-danger-light);  color: var(--em-danger); }
.em-doc-filetype--image { background: var(--em-info-light);    color: var(--em-info); }
.em-doc-filetype--excel { background: var(--em-success-light); color: var(--em-success); }
.em-doc-filetype--word  { background: rgba(47, 85, 212, 0.1); color: var(--em-accent); }
.em-doc-filetype--other { background: var(--em-surface-2);     color: var(--em-text-muted); }

/* --- Document Title Link --- */

.em-doc-title-link {
    font-weight: 600;
    color: var(--em-text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: color 180ms ease;
}

.em-doc-title-link:hover {
    color: var(--em-accent);
    text-decoration: none;
}

.em-doc-title-link .em-doc-external-icon {
    font-size: 0.7rem;
    color: var(--em-text-subtle);
    transition: color 180ms ease, transform 180ms ease;
}

.em-doc-title-link:hover .em-doc-external-icon {
    color: var(--em-accent);
    transform: translate(1px, -1px);
}

.em-doc-title-desc {
    font-size: 0.8125rem;
    color: var(--em-text-muted);
    margin-top: 2px;
}

/* --- Visibility Badge --- */

.em-doc-visibility {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.2em 0.5em;
    border-radius: 999px;
    background: var(--em-info-light);
    color: var(--em-info);
    white-space: nowrap;
}

/* --- Category Badge (table) --- */

.em-doc-category-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.3em 0.625em;
    border-radius: var(--em-radius-sm);
    background: var(--em-surface-2);
    color: var(--em-text-muted);
    line-height: 1.4;
}

/* --- Downloads Counter --- */

.em-doc-downloads {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--em-text-muted);
    font-weight: 500;
}

.em-doc-downloads i {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* --- Action Button --- */

.em-doc-action-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--em-radius-sm);
    border: 1px solid var(--em-border);
    background: var(--em-surface);
    color: var(--em-text-muted);
    cursor: pointer;
    transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.8rem;
    padding: 0;
}

.em-doc-action-btn:hover {
    background: var(--em-surface-2);
    color: var(--em-accent);
    border-color: var(--em-accent);
}

.em-doc-action-btn::after {
    display: none;
}

/* --- Upload Button --- */

.em-doc-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    font-size: var(--em-font-size-sm);
    font-weight: 600;
    border-radius: var(--em-radius-md);
    background: var(--em-accent);
    color: var(--em-white);
    border: none;
    cursor: pointer;
    transition: background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.em-doc-upload-btn:hover {
    background: var(--em-accent-hover);
    box-shadow: 0 4px 12px rgba(47, 85, 212, 0.3);
    transform: translateY(-1px);
    color: var(--em-white);
}

/* --- Empty State --- */

.em-doc-empty {
    text-align: center;
    padding: var(--em-spacing-xxl) var(--em-spacing-lg);
}

.em-doc-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--em-surface-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--em-text-subtle);
    margin-bottom: var(--em-spacing-md);
}

.em-doc-empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--em-text);
    margin-bottom: var(--em-spacing-xs);
}

.em-doc-empty-description {
    font-size: var(--em-font-size-sm);
    color: var(--em-text-muted);
    margin-bottom: 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Modal --- */

.em-doc-modal .modal-content {
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-lg);
    overflow: hidden;
    box-shadow: var(--em-shadow-lg);
}

.em-doc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--em-accent);
    color: #fff;
}

.em-doc-modal-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
}

.em-doc-modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.em-doc-modal-body {
    padding: var(--em-spacing-lg);
}

.em-doc-modal-body .form-label {
    font-weight: 600;
    font-size: var(--em-font-size-sm);
    color: var(--em-text);
    margin-bottom: 0.375rem;
}

.em-doc-modal-body .form-control,
.em-doc-modal-body .form-select {
    border-radius: var(--em-radius-sm);
    border-color: var(--em-border);
    font-size: var(--em-font-size-sm);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.em-doc-modal-body .form-control:focus,
.em-doc-modal-body .form-select:focus {
    border-color: var(--em-accent);
    box-shadow: 0 0 0 3px rgba(47, 85, 212, 0.15);
}

.em-doc-modal-footer {
    padding: 0.75rem 1.25rem;
    background: var(--em-surface-2);
    border-top: 1px solid var(--em-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--em-spacing-sm);
}

/* --- Mobile Toggle --- */

.em-doc-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem;
    border-radius: var(--em-radius-md);
    border: 1px solid var(--em-border);
    background: var(--em-surface);
    color: var(--em-text);
    font-weight: 600;
    font-size: var(--em-font-size-sm);
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease;
}

.em-doc-mobile-toggle:hover {
    background: var(--em-surface-2);
    border-color: var(--em-accent);
    color: var(--em-accent);
}

/* ============================================
   DOCUMENT PAGE - Dark Mode
   ============================================ */

[data-theme="dark"] .em-doc-stat-card {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-doc-stat-card:hover {
    box-shadow: var(--em-shadow-lg);
}

[data-theme="dark"] .em-doc-sidebar-widget {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-doc-sidebar-widget-header {
    background: linear-gradient(135deg, var(--em-surface-3) 0%, var(--em-surface-elevated) 100%);
    border-bottom-color: var(--em-border);
}

[data-theme="dark"] .em-doc-category-link:hover {
    background: var(--em-surface-3);
}

[data-theme="dark"] .em-doc-category-link.active {
    background: rgba(74, 115, 245, 0.1);
}

[data-theme="dark"] .em-doc-category-count {
    background: var(--em-surface-3);
}

[data-theme="dark"] .em-doc-category-link.active .em-doc-category-count {
    background: rgba(74, 115, 245, 0.2);
}

[data-theme="dark"] .em-doc-recent-link:hover {
    background: var(--em-surface-3);
}

[data-theme="dark"] .em-doc-recent-icon--pdf   { background: rgba(239, 68, 68, 0.15); }
[data-theme="dark"] .em-doc-recent-icon--image { background: rgba(47, 85, 212, 0.15); }
[data-theme="dark"] .em-doc-recent-icon--excel { background: rgba(16, 185, 129, 0.15); }
[data-theme="dark"] .em-doc-recent-icon--word  { background: rgba(47, 85, 212, 0.15); }
[data-theme="dark"] .em-doc-recent-icon--other { background: var(--em-surface-3); }

[data-theme="dark"] .em-doc-main-widget {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
    box-shadow: var(--em-shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .em-doc-main-widget-header {
    background: linear-gradient(135deg, var(--em-surface-3) 0%, var(--em-surface-elevated) 100%);
    border-bottom-color: var(--em-border);
}

[data-theme="dark"] .em-doc-table thead th {
    background: var(--em-surface-3);
    color: var(--em-text-muted);
    border-bottom-color: var(--em-border);
}

[data-theme="dark"] .em-doc-table tbody td {
    border-bottom-color: var(--em-border);
    color: var(--em-text);
}

[data-theme="dark"] .em-doc-table tbody tr:hover {
    background: var(--em-surface-3);
}

[data-theme="dark"] .em-doc-filetype--pdf   { background: rgba(239, 68, 68, 0.15); }
[data-theme="dark"] .em-doc-filetype--image { background: rgba(47, 85, 212, 0.15); }
[data-theme="dark"] .em-doc-filetype--excel { background: rgba(16, 185, 129, 0.15); }
[data-theme="dark"] .em-doc-filetype--word  { background: rgba(47, 85, 212, 0.15); }
[data-theme="dark"] .em-doc-filetype--other { background: var(--em-surface-3); }

[data-theme="dark"] .em-doc-category-badge {
    background: var(--em-surface-3);
}

[data-theme="dark"] .em-doc-action-btn {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
    color: var(--em-text-muted);
}

[data-theme="dark"] .em-doc-action-btn:hover {
    background: var(--em-surface-3);
}

[data-theme="dark"] .em-doc-empty-icon {
    background: var(--em-surface-3);
}

[data-theme="dark"] .em-doc-visibility {
    background: rgba(47, 85, 212, 0.15);
}

[data-theme="dark"] .em-doc-modal .modal-content {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-doc-modal-body .form-control,
[data-theme="dark"] .em-doc-modal-body .form-select {
    background: var(--em-surface);
    border-color: var(--em-border);
    color: var(--em-text);
}

[data-theme="dark"] .em-doc-modal-footer {
    background: var(--em-surface-3);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-doc-mobile-toggle {
    background: var(--em-surface-elevated);
    border-color: var(--em-border);
    color: var(--em-text);
}

/* ============================================
   DOCUMENT PAGE - Responsive
   ============================================ */

@media (max-width: 767.98px) {
    .em-doc-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--em-spacing-sm);
    }

    .em-doc-stat-card {
        padding: var(--em-spacing-md);
    }

    .em-doc-stat-value {
        font-size: 1.25rem;
    }

    .em-doc-stat-icon {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }

    .em-doc-main-widget-header {
        flex-wrap: wrap;
        gap: var(--em-spacing-sm);
    }
}

@media (max-width: 575.98px) {
    .em-doc-stats {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================
   DOCUMENT PAGE - Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .em-doc-stat-card,
    .em-doc-category-link,
    .em-doc-recent-link,
    .em-doc-filetype,
    .em-doc-table tbody tr,
    .em-doc-main-widget::before,
    .em-doc-stat-card::before,
    .em-doc-upload-btn {
        transition: none !important;
    }

    .em-doc-stat-card:hover,
    .em-doc-upload-btn:hover,
    .em-doc-filetype:hover {
        transform: none !important;
    }
}


/* ============================================
   NEWSLETTER BLOCK EDITOR
   ============================================ */

/* Step Indicator */
.em-step-indicator {
    display: flex;
    justify-content: center;
}

.em-step-indicator-track {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 16px 24px;
    background: var(--em-surface, #fff);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.em-step-indicator-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 80px;
}

.em-step-indicator-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    background: var(--em-border, #e2e8f0);
    color: var(--em-text-muted, #94a3b8);
    transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.em-step-indicator-step.active .em-step-indicator-circle {
    background: var(--em-accent, #3b82f6);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.em-step-indicator-step.completed .em-step-indicator-circle {
    background: #22c55e;
    color: #fff;
}

.em-step-indicator-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--em-text-muted, #94a3b8);
    white-space: nowrap;
}

.em-step-indicator-step.active .em-step-indicator-label {
    color: var(--em-accent, #3b82f6);
    font-weight: 600;
}

.em-step-indicator-step.completed .em-step-indicator-label {
    color: #22c55e;
}

/* Avklarade steg är länkar tillbaka i guiden — de behöver se klickbara ut utan
   att bryta kolumnlayouten som .em-step-indicator-step sätter. */
a.em-step-indicator-step--link {
    text-decoration: none;
    border-radius: 8px;
    padding: 4px 6px;
    margin: -4px -6px;
    transition: background 140ms ease;
}

a.em-step-indicator-step--link:hover,
a.em-step-indicator-step--link:focus-visible {
    background: rgba(34, 197, 94, 0.1);
}

a.em-step-indicator-step--link:hover .em-step-indicator-label {
    text-decoration: underline;
}

a.em-step-indicator-step--link:focus-visible {
    outline: 2px solid var(--em-accent, #3b82f6);
    outline-offset: 2px;
}

.em-step-indicator-connector {
    width: 40px;
    height: 2px;
    background: var(--em-border, #e2e8f0);
    margin: 0 4px;
    margin-bottom: 24px;
    transition: background 180ms ease;
}

.em-step-indicator-connector.completed {
    background: #22c55e;
}

/* Recipient List */
.em-recipient-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--em-border, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
    max-height: 420px;
    overflow-y: auto;
}

.em-recipient-list::-webkit-scrollbar {
    width: 4px;
}

.em-recipient-list::-webkit-scrollbar-track {
    background: transparent;
}

.em-recipient-list::-webkit-scrollbar-thumb {
    background: var(--em-border, #e2e8f0);
    border-radius: 4px;
}

.em-recipient-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 16px;
    border-bottom: 1px solid var(--em-border, #e2e8f0);
    cursor: pointer;
    transition: background 120ms ease;
    margin: 0;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.em-recipient-item:last-child {
    border-bottom: none;
}

.em-recipient-item:hover {
    background: var(--em-surface-2, #f8fafc);
}

.em-recipient-item:has(input:checked) {
    background: rgba(47, 85, 212, 0.04);
    border-left: 3px solid var(--em-accent, #2F55D4);
    padding-left: 13px;
}

.em-recipient-item--header {
    background: var(--em-surface-2, #f8fafc);
    border-bottom: 2px solid var(--em-border, #e2e8f0);
    position: sticky;
    top: 0;
    z-index: 1;
}

.em-recipient-item--header:hover {
    background: var(--em-surface-3, #f1f5f9);
}

.em-recipient-item .form-check-input {
    flex-shrink: 0;
}

/* Sökfält över mottagarlistorna — ikonen ligger i fältet, inte i en
   input-group, så höjden matchar listan under. */
.em-recipient-search {
    position: relative;
}

.em-recipient-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--em-text-muted, #94a3b8);
    font-size: 0.8rem;
    pointer-events: none;
}

.em-recipient-search .form-control {
    padding-left: 32px;
}

/* Kanalval (E-post/SMS) — valet styr hela resten av guiden och var tidigare en
   rullgardin med två rader. Radioknappen är visuellt dold men behåller
   tangentbord och skärmläsare; kortet är dess etikett. */
.em-channel-choice {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.em-channel-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--em-border, #e2e8f0);
    border-radius: 10px;
    background: var(--em-surface, #fff);
    cursor: pointer;
    transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.em-channel-card:hover {
    border-color: var(--em-accent, #2F55D4);
}

.em-channel-card-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}

.em-channel-card:has(.em-channel-card-input:checked) {
    border-color: var(--em-accent, #2F55D4);
    background: rgba(47, 85, 212, 0.04);
    box-shadow: 0 0 0 1px var(--em-accent, #2F55D4);
}

.em-channel-card:has(.em-channel-card-input:focus-visible) {
    outline: 2px solid var(--em-accent, #2F55D4);
    outline-offset: 2px;
}

.em-channel-card-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--em-surface-2, #f8fafc);
    color: var(--em-text-muted, #94a3b8);
}

.em-channel-card:has(.em-channel-card-input:checked) .em-channel-card-icon {
    background: var(--em-accent, #2F55D4);
    color: #fff;
}

.em-channel-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.em-channel-card-title {
    font-weight: 600;
    line-height: 1.2;
}

.em-channel-card-text {
    font-size: 0.78rem;
    color: var(--em-text-muted, #94a3b8);
}

/* Bocken syns bara på det valda kortet — den är en bekräftelse, inte en ruta
   att leta efter. */
.em-channel-card-check {
    position: absolute;
    top: 10px;
    right: 12px;
    color: var(--em-accent, #2F55D4);
    opacity: 0;
    transition: opacity 140ms ease;
}

.em-channel-card:has(.em-channel-card-input:checked) .em-channel-card-check {
    opacity: 1;
}

/* Guidens åtgärdsrad: följer med i stället för att ligga längst ner på en sida
   som kan vara flera skärmar lång. */
.em-wizard-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding: 12px 16px;
    background: var(--em-surface, #fff);
    border: 1px solid var(--em-border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.08);
}

/* Inuti ett kort ärver raden kortets kanter — bara toppkanten behövs. */
.em-wizard-actions--in-card {
    margin-top: 0;
    border: 0;
    border-top: 1px solid var(--em-border, #e2e8f0);
    border-radius: 0 0 12px 12px;
}

.em-wizard-actions-summary {
    font-size: 0.85rem;
    color: var(--em-text-muted, #94a3b8);
}

/* Sparstatus. Utkastet bor i sessionen — att sparningen syns är hela skillnaden
   mot att hoppas. */
.em-draft-status {
    font-size: 0.82rem;
    color: var(--em-text-muted, #94a3b8);
    transition: color 140ms ease;
}

.em-draft-status[data-state="saving"] { color: var(--em-accent, #2F55D4); }
.em-draft-status[data-state="saved"] { color: #16a34a; }
.em-draft-status[data-state="error"] { color: #dc2626; font-weight: 600; }

/* Hopfällbara tips i sidospalten — <details> klarar det utan JS. */
.em-tips {
    border: 1px solid var(--em-border, #e2e8f0);
    border-radius: 12px;
    background: var(--em-surface, #fff);
}

.em-tips-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.em-tips-summary::-webkit-details-marker {
    display: none;
}

.em-tips-summary::after {
    content: "\f078";
    /* FA 7 Pro är det som är självhostat under /assets/vendor/fontawesome/7. */
    font-family: "Font Awesome 7 Pro", "Font Awesome 6 Pro";
    font-weight: 900;
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--em-text-muted, #94a3b8);
    transition: transform 140ms ease;
}

.em-tips[open] .em-tips-summary::after {
    transform: rotate(180deg);
}

.em-tips-summary i {
    color: var(--em-accent, #2F55D4);
}

.em-tips-body {
    padding: 0 16px 14px;
    font-size: 0.82rem;
    color: var(--em-text-muted, #94a3b8);
}

/* Block Editor */
.em-block-editor {
    border: 2px dashed var(--em-border, #e2e8f0);
    border-radius: 8px;
    padding: 16px;
    min-height: 200px;
    background: var(--em-surface, #f8fafc);
}

.em-block-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.em-block-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--em-text-muted, #94a3b8);
}

.em-block-empty-icon {
    font-size: 36px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.4;
}

/* Block Wrapper */
.em-block-wrapper {
    background: #fff;
    border: 1px solid var(--em-border, #e2e8f0);
    border-radius: 8px;
    transition: border-color 180ms ease, box-shadow 180ms ease;
    cursor: pointer;
}

.em-block-wrapper--hover {
    border-color: var(--em-accent, #3b82f6);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.08);
}

.em-block-wrapper--active {
    border-color: var(--em-accent, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
    cursor: default;
}

.em-block-wrapper-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 10px;
    background: var(--em-accent, #3b82f6);
    border-bottom: none;
    border-radius: 7px 7px 0 0;
}

.em-block-wrapper-type {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
}

.em-block-wrapper-actions {
    display: flex;
    gap: 2px;
}

.em-block-action-btn {
    background: none;
    border: none;
    padding: 3px 6px;
    cursor: pointer;
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 11px;
    transition: all 120ms ease;
}

.em-block-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.em-block-action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.em-block-action-btn--danger:hover {
    background: rgba(220, 38, 38, 0.3);
    color: #fff;
}

.em-block-action-btn--close {
    margin-left: 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    padding-left: 8px;
}

.em-block-wrapper-content {
    padding: 0;
}

.em-block-wrapper--active .em-block-wrapper-content {
    padding: 12px;
}

/* Block Preview Mode (collapsed) */
.em-block-preview {
    padding: 8px 12px;
    min-height: 24px;
}

.em-block-preview-placeholder {
    color: var(--em-text-muted, #94a3b8);
    font-size: 13px;
    padding: 12px;
    text-align: center;
    font-style: italic;
}

/* Block Edit Mode */
.em-block-edit {
    padding: 0;
}

/* Header block preview */
.em-block-header-preview-img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    max-height: 80px;
    object-fit: cover;
}

.em-block-header-preview-heading {
    font-size: 18px;
    font-weight: 700;
    color: var(--em-text, #334155);
    margin-top: 4px;
}

/* RichText block preview */
.em-block-richtext-preview-html {
    font-size: 13px;
    line-height: 1.5;
    color: var(--em-text, #334155);
    max-height: 80px;
    overflow: hidden;
    position: relative;
}

.em-block-richtext-preview-html::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: linear-gradient(transparent, #fff);
    pointer-events: none;
}

.em-block-richtext-preview-html p {
    margin: 0 0 4px;
}

/* Image block preview */
.em-block-image-preview-mode .em-block-image-preview {
    max-height: 120px;
    object-fit: contain;
    border-radius: 4px;
}

/* Spacer block compact preview */
.em-block-spacer-preview-compact {
    padding: 0 12px;
}

.em-block-spacer-bar {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 4px,
        rgba(59, 130, 246, 0.06) 4px,
        rgba(59, 130, 246, 0.06) 8px
    );
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 12px;
}

/* Block Toolbar (Add Block) */
.em-block-toolbar {
    border-top: 1px dashed var(--em-border, #e2e8f0);
    padding-top: 16px;
}

.em-block-toolbar-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--em-text-muted, #94a3b8);
    margin-bottom: 8px;
}

.em-block-toolbar-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.em-block-toolbar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    border: 1px solid var(--em-border, #e2e8f0);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 180ms ease;
    min-width: 72px;
}

.em-block-toolbar-btn:hover {
    border-color: var(--em-accent, #3b82f6);
    background: rgba(59, 130, 246, 0.04);
    transform: translateY(-1px);
}

.em-block-toolbar-btn-icon {
    font-size: 16px;
    color: var(--em-accent, #3b82f6);
}

.em-block-toolbar-btn-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--em-text-muted, #94a3b8);
}

/* Block-specific styles */
.em-block-field {
    margin-bottom: 8px;
}

.em-block-field:last-child {
    margin-bottom: 0;
}

.em-block-field-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--em-text-muted, #94a3b8);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.em-block-field-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.em-block-image-preview {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 8px;
}

.em-block-image-preview-container {
    text-align: center;
    margin-bottom: 12px;
}

.em-block-image-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.em-block-image-dropzone {
    border: 2px dashed var(--em-border, #e2e8f0);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 180ms ease;
    margin-bottom: 12px;
}

.em-block-image-dropzone:hover {
    border-color: var(--em-accent, #3b82f6);
}

.em-block-image-dropzone-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--em-text-muted, #94a3b8);
}

.em-block-image-dropzone-icon {
    font-size: 24px;
    color: var(--em-accent, #3b82f6);
    opacity: 0.6;
}

/* Button block preview */
.em-block-button-preview {
    padding: 12px;
    background: var(--em-surface, #f8fafc);
    border-radius: 4px;
    margin-bottom: 12px;
}

.em-block-button-sample {
    display: inline-block;
    padding: 10px 24px;
    color: #fff;
    border-radius: 5px;
    font-weight: 600;
    font-size: 14px;
}

/* Divider block preview */
.em-block-divider-preview {
    padding: 8px 0;
}

/* Spacer block preview */
.em-block-spacer-preview {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(59, 130, 246, 0.04) 5px,
        rgba(59, 130, 246, 0.04) 10px
    );
    border: 1px dashed var(--em-border, #e2e8f0);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.em-block-spacer-label {
    font-size: 11px;
    color: var(--em-text-muted, #94a3b8);
    font-weight: 600;
}

/* Rich text block */
.em-block-richtext-editor {
    min-height: 120px;
}

/* Template Gallery */
.em-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.em-template-card {
    transition: all 180ms ease;
    cursor: pointer;
}

.em-template-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}

.em-template-card--blank {
    border: 2px dashed var(--em-border, #e2e8f0) !important;
    background: var(--em-surface, #f8fafc);
}

.em-template-card--blank:hover {
    border-color: var(--em-accent, #3b82f6) !important;
}

.em-template-card-icon {
    font-size: 32px;
    color: var(--em-accent, #3b82f6);
    opacity: 0.6;
}

.em-template-card-preview {
    height: 100px;
    background: var(--em-surface, #f8fafc);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.em-template-card-preview-icon {
    font-size: 28px;
    color: var(--em-text-muted, #94a3b8);
    opacity: 0.4;
}

/* Dark mode support */
[data-theme="dark"] .em-block-editor {
    background: var(--em-bg, #1e293b);
    border-color: var(--em-border, #334155);
}

[data-theme="dark"] .em-block-wrapper {
    background: var(--em-surface, #1e293b);
    border-color: var(--em-border, #334155);
}

[data-theme="dark"] .em-block-preview-placeholder {
    color: var(--em-text-muted, #64748b);
}

[data-theme="dark"] .em-block-richtext-preview-html::after {
    background: linear-gradient(transparent, var(--em-surface, #1e293b));
}

[data-theme="dark"] .em-block-header-preview-heading {
    color: var(--em-text, #e2e8f0);
}

[data-theme="dark"] .em-block-richtext-preview-html {
    color: var(--em-text, #e2e8f0);
}

[data-theme="dark"] .em-block-toolbar-btn {
    background: var(--em-surface, #1e293b);
    border-color: var(--em-border, #334155);
}

[data-theme="dark"] .em-block-toolbar-btn:hover {
    background: rgba(59, 130, 246, 0.1);
}

[data-theme="dark"] .em-block-image-dropzone {
    border-color: var(--em-border, #334155);
}

[data-theme="dark"] .em-block-button-preview {
    background: var(--em-bg, #0f172a);
}

[data-theme="dark"] .em-template-card--blank {
    border-color: var(--em-border, #334155) !important;
    background: var(--em-bg, #0f172a);
}

[data-theme="dark"] .em-template-card-preview {
    background: var(--em-bg, #0f172a);
}

/* Template pick card (inside modal) */
.em-template-pick-card {
    cursor: pointer;
    transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
}
.em-template-pick-card:hover {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

/* Vehicle block (editor preview) */
.em-block-vehicle-badge {
    display: inline-flex;
    align-items: center;
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
}
.em-block-vehicle-sample {
    margin-top: 10px;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    padding: 10px;
    background: #fafafa;
}
.em-block-vehicle-info {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 12px;
}
[data-theme="dark"] .em-block-vehicle-badge {
    background: #1e1b4b;
    color: #a5b4fc;
    border-color: #3730a3;
}
[data-theme="dark"] .em-block-vehicle-sample {
    background: var(--em-surface, #1e293b);
    border-color: var(--em-border, #334155);
}
[data-theme="dark"] .em-block-vehicle-info {
    background: var(--em-surface, #1e293b);
    border-color: var(--em-border, #334155);
}

/* Activity Block */
.em-block-activity-badge {
    display: inline-flex;
    align-items: center;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
}
.em-block-activity-sample {
    margin-top: 10px;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    padding: 10px;
    background: #fafafa;
}
.em-block-activity-info {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 12px;
}
.em-block-activity-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
}
[data-theme="dark"] .em-block-activity-badge {
    background: #064e3b;
    color: #6ee7b7;
    border-color: #047857;
}
[data-theme="dark"] .em-block-activity-sample {
    background: var(--em-surface, #1e293b);
    border-color: var(--em-border, #334155);
}
[data-theme="dark"] .em-block-activity-info {
    background: var(--em-surface, #1e293b);
    border-color: var(--em-border, #334155);
}
[data-theme="dark"] .em-block-activity-empty {
    border-color: var(--em-border, #334155);
}

/* Poll Block */
.em-block-poll-badge {
    display: inline-flex;
    align-items: center;
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
}
.em-block-poll-sample {
    margin-top: 10px;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    padding: 10px;
    background: #fafafa;
}
.em-block-poll-info {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 12px;
}
.em-block-poll-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
}
[data-theme="dark"] .em-block-poll-badge {
    background: #1e3a5f;
    color: #93c5fd;
    border-color: #1e40af;
}
[data-theme="dark"] .em-block-poll-sample {
    background: var(--em-surface, #1e293b);
    border-color: var(--em-border, #334155);
}
[data-theme="dark"] .em-block-poll-info {
    background: var(--em-surface, #1e293b);
    border-color: var(--em-border, #334155);
}
[data-theme="dark"] .em-block-poll-empty {
    border-color: var(--em-border, #334155);
}

[data-theme="dark"] .em-step-indicator-track {
    background: var(--em-surface, #1e293b);
}

[data-theme="dark"] .em-recipient-list {
    border-color: var(--em-border, #334155);
}

[data-theme="dark"] .em-recipient-item {
    border-bottom-color: var(--em-border, #334155);
}

[data-theme="dark"] .em-recipient-item:hover {
    background: var(--em-surface-2, #334155);
}

[data-theme="dark"] .em-recipient-item:has(input:checked) {
    background: rgba(47, 85, 212, 0.1);
}

[data-theme="dark"] .em-recipient-item--header {
    background: var(--em-surface-2, #334155);
    border-bottom-color: var(--em-border, #334155);
}

[data-theme="dark"] .em-recipient-item--header:hover {
    background: var(--em-surface-3, #475569);
}

[data-theme="dark"] .em-channel-card,
[data-theme="dark"] .em-wizard-actions,
[data-theme="dark"] .em-tips {
    background: var(--em-surface-elevated, #1e293b);
    border-color: var(--em-border, #334155);
}

[data-theme="dark"] .em-channel-card-icon {
    background: var(--em-surface-2, #334155);
}

[data-theme="dark"] .em-channel-card:has(.em-channel-card-input:checked) {
    background: rgba(47, 85, 212, 0.14);
}

[data-theme="dark"] .em-wizard-actions {
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .em-wizard-actions--in-card {
    border-top-color: var(--em-border, #334155);
}

/* Responsive */
@media (max-width: 768px) {
    .em-step-indicator-connector {
        width: 20px;
    }

    .em-step-indicator-label {
        font-size: 9px;
    }

    .em-step-indicator-step {
        min-width: 60px;
    }

    .em-template-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .em-block-field-row {
        flex-direction: column;
        gap: 8px;
    }
}

/* ============================================================
 * Aktiviteter 2.0 â€” Avgifter & tillval
 * ============================================================
 * Visuellt sprÃ¥k fÃ¶r pris-, betal- och tillvalssektionerna i admin
 * (tab "Avgifter & tillval" i aktivitetsformulÃ¤ret). Bygger pÃ¥ samma
 * design-tokens (--em-*) som resten av formulÃ¤ret fÃ¶r konsekvent dark-
 * mode och spacing.
 */

.em-payments-card {
    background: var(--em-surface);
    border-radius: var(--em-radius-md);
    transition: box-shadow 180ms ease, transform 180ms ease;
}

.em-payments-card:hover {
    box-shadow: var(--em-shadow-md);
}

[data-theme="dark"] .em-payments-card {
    background: var(--em-surface-elevated);
}

/* FÃ¤rgade ikon-cirklar fÃ¶r sektionsrubrikerna */
.em-payments-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.1rem;
}

/* Sticky preview-kort pÃ¥ desktop â€” fÃ¶ljer med nÃ¤r admin scrollar */
.em-payments-preview-sticky {
    position: sticky;
    top: var(--em-spacing-lg);
}

.em-payments-preview {
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-md);
}

[data-theme="dark"] .em-payments-preview {
    background: var(--em-surface-elevated);
}

.em-preview-lines {
    min-height: 60px;
    max-height: 280px;
    overflow-y: auto;
    font-size: var(--em-font-size-sm);
}

.em-preview-lines > div:last-child {
    border-bottom: 0 !important;
}

.em-preview-total {
    border-top: 2px solid var(--em-border);
    padding-top: var(--em-spacing-md);
    font-size: 1.1rem;
}

.em-preview-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--em-accent);
}

/* Lista Ã¶ver tillval */
.em-addon-list {
    display: flex;
    flex-direction: column;
    gap: var(--em-spacing-sm);
}

.em-addon-empty {
    background: var(--em-surface-elevated);
    border: 1px dashed var(--em-border);
    border-radius: var(--em-radius-md);
    color: var(--em-text-muted);
}

.em-addon-row {
    background: var(--em-surface-elevated);
    border: 1px solid var(--em-border);
    border-radius: var(--em-radius-md);
    padding: var(--em-spacing-md);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.em-addon-row:hover {
    border-color: var(--em-accent);
    box-shadow: var(--em-shadow-sm);
}

.em-addon-basis-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--em-accent-subtle, rgba(99, 102, 241, 0.1));
    color: var(--em-accent);
    border-radius: 50%;
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* Charge-basis val i addon-modalen â€” radio-knappar som klickbara kort */
.em-charge-basis-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--em-spacing-sm);
}

.em-charge-basis-option {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-md);
    padding: var(--em-spacing-md);
    border: 2px solid var(--em-border);
    border-radius: var(--em-radius-md);
    cursor: pointer;
    transition: border-color 180ms ease, background 180ms ease;
    margin: 0;
}

.em-charge-basis-option:hover {
    border-color: var(--em-accent);
}

.em-charge-basis-option input[type="radio"] {
    display: none;
}

.em-charge-basis-option:has(input[type="radio"]:checked) {
    border-color: var(--em-accent);
    background: var(--em-accent-subtle, rgba(99, 102, 241, 0.06));
}

.em-charge-basis-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--em-surface);
    color: var(--em-text-muted);
    flex-shrink: 0;
}

.em-charge-basis-option:has(input[type="radio"]:checked) .em-charge-basis-icon {
    background: var(--em-accent);
    color: white;
}

/* Mobil: stack preview under konfiguration, slÃ¤pp sticky */
@media (max-width: 991.98px) {
    .em-payments-preview-sticky {
        position: static;
        margin-top: var(--em-spacing-lg);
    }

    .em-charge-basis-group {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   Bulk actions bar (visas när bokningar är markerade i listan)
   ========================================================================= */
.em-bulkbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: var(--em-info-light);
    border: 1px solid var(--em-info);
    border-radius: var(--em-radius-lg, 12px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    animation: emBulkbarSlide 0.15s ease-out;
}

@keyframes emBulkbarSlide {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.em-bulkbar[hidden] { display: none !important; }

.em-bulkbar-count {
    color: var(--em-info);
    font-weight: 600;
    font-size: 0.9rem;
}

.em-bulkbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Pill för antal-värden i bokningslistan (ex. addon-kvantitet) */
.em-activity-pill {
    display: inline-block;
    min-width: 1.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: var(--em-warning-light, #fff7e0);
    color: var(--em-warning, #b88200);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

/* Totalrad-stil för bokningslistans tfoot */
.em-activity-table tfoot.em-activity-table-foot td {
    background: var(--em-gray-50, #f8f9fa);
    border-top: 2px solid var(--em-gray-200);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

/* xxl-breakpoint shim (Bootstrap 5 har den, men säkerställ d-xxl-table-cell finns) */
@media (max-width: 1399.98px) {
    .d-xxl-table-cell { display: none !important; }
}
@media (min-width: 1400px) {
    .d-xxl-table-cell { display: table-cell !important; }
}

/* =========================================================================
   Activity show — header-meta-rad + kompakt direktlänk
   ========================================================================= */
.em-activity-show-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--em-text-muted);
    font-size: 0.875rem;
    margin: 0;
}
.em-activity-show-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.4;
}
.em-activity-show-meta i {
    opacity: 0.75;
}

/* =========================================================================
   Bokningar — tabs för vy-omkoppling (Aktiva | Avbokade)
   ========================================================================= */
.em-bookings-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--em-border);
    margin-bottom: 16px;
}
@media (max-width: 575.98px) {
    .em-bookings-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .em-bookings-tabs::-webkit-scrollbar { display: none; }
}
.em-bookings-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: var(--em-text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    margin-bottom: -1px;
}
.em-bookings-tab:hover {
    color: var(--em-text);
    text-decoration: none;
}
.em-bookings-tab--active {
    color: var(--em-accent);
    border-bottom-color: var(--em-accent);
    font-weight: 600;
}
.em-bookings-tab i {
    font-size: 0.85rem;
    opacity: 0.7;
}
.em-bookings-tab--active i {
    opacity: 1;
}
.em-bookings-tab-count {
    display: inline-block;
    min-width: 22px;
    padding: 1px 8px;
    background: var(--em-gray-100, #f3f4f6);
    color: var(--em-text-muted);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
}
.em-bookings-tab--active .em-bookings-tab-count {
    background: rgba(47, 85, 212, 0.12);
    color: var(--em-accent);
}
/* A11y: tydlig fokus-indikator för tangentbordsanvändare. */
.em-bookings-tab:focus-visible {
    outline: 2px solid var(--em-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Kontakt-ikoner inline i bokningstabellens "Bokad av"-cell. */
.em-booking-contact {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    font-size: 0.8rem;
}
.em-booking-contact-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: var(--em-text-muted);
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.12s, color 0.12s;
}
.em-booking-contact-link:hover {
    background: var(--em-accent-soft, rgba(47, 85, 212, 0.1));
    color: var(--em-accent);
}
.em-booking-contact-link:focus-visible {
    outline: 2px solid var(--em-accent);
    outline-offset: 1px;
}

/* =========================================================================
   Booking card — modern, tät layout för en bokning
   Används både full-sida och i modal.
   ========================================================================= */
.em-bookcard {
    --bookcard-gap: 14px;
    --bookcard-radius: 12px;
    --bookcard-pad: 16px 18px;
}

/* ─── Hero ─── */
.em-bookcard-hero {
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: var(--bookcard-radius);
    padding: 16px 20px;
    margin-bottom: var(--bookcard-gap);
}
.em-bookcard-hero-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.em-bookcard-hero-id {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.em-bookcard-copy-btn {
    background: transparent;
    border: 0;
    color: var(--em-text-muted);
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.12s, color 0.12s;
    align-self: center;
}
.em-bookcard-copy-btn:hover {
    background: var(--em-accent-soft, rgba(47, 85, 212, 0.08));
    color: var(--em-accent);
}
.em-bookcard-copy-btn:focus-visible {
    outline: 2px solid var(--em-accent);
    outline-offset: 2px;
}
.em-bookcard-hero-eyebrow {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--em-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.em-bookcard-hero-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--em-text);
}
.em-bookcard-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--em-text-muted);
    font-size: 0.875rem;
    line-height: 1.4;
}
.em-bookcard-hero-meta > span {
    display: inline-flex;
    align-items: center;
}
.em-bookcard-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--em-border);
}

/* I bokningsmodalen visar modalhuvudet redan "Bokning #N" — dölj den
   dubblerade id-rubriken i kortets hero. Status-pillen och meta-raden
   (namn/datum) behålls eftersom de inte finns i modalhuvudet. På helsidan
   (application/show) ligger kortet inte i modalen och hero visas som vanligt. */
#modal-booking-card-body .em-bookcard-hero-id {
    display: none;
}

/* ─── Grid + sections ─── */
.em-bookcard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--bookcard-gap);
}
@media (max-width: 991.98px) {
    .em-bookcard-grid { grid-template-columns: 1fr; }
}

.em-bookcard-section {
    background: var(--em-surface);
    border: 1px solid var(--em-border);
    border-radius: var(--bookcard-radius);
    padding: var(--bookcard-pad);
}
.em-bookcard-section--wide { grid-column: 1 / -1; }
.em-bookcard-section--payment {
    background: linear-gradient(180deg, var(--em-surface) 0%, var(--em-accent-soft, rgba(47, 85, 212, 0.04)) 100%);
}

.em-bookcard-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--em-text);
    margin: 0 0 14px;
    letter-spacing: -0.005em;
}
.em-bookcard-section-title i {
    font-size: 1rem;
    color: var(--em-text-muted);
}
.em-bookcard-section-title small {
    margin-left: auto;
    font-size: 0.78rem;
}
.em-bookcard-section-hint {
    margin-left: auto;
    padding: 2px 8px;
    background: rgba(217, 119, 6, 0.12);
    color: #92400e;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}
.em-bookcard-section-title--sub {
    font-size: 0.88rem;
    color: var(--em-text-muted);
    font-weight: 600;
}

.em-bookcard-section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}
.em-bookcard-section-title-row .em-bookcard-section-title { margin: 0; }

.em-bookcard-divider {
    height: 1px;
    background: var(--em-border);
    margin: 16px 0;
}

/* ─── Definition list (kontakt + frågor) ─── */
.em-bookcard-dl,
.em-bookcard-qa {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 16px;
    row-gap: 6px;
    margin: 0;
    font-size: 0.9rem;
}
.em-bookcard-dl dt,
.em-bookcard-qa dt {
    color: var(--em-text-muted);
    font-weight: 500;
    align-self: center;
}
.em-bookcard-dl dd,
.em-bookcard-qa dd {
    margin: 0;
    color: var(--em-text);
    align-self: center;
    word-break: break-word;
}
.em-bookcard-dl dt i {
    width: 16px;
    text-align: center;
    margin-right: 4px;
}

.em-bookcard-qa {
    grid-template-columns: minmax(120px, max-content) 1fr;
    row-gap: 10px;
    column-gap: 24px;
}
.em-bookcard-qa dt {
    color: var(--em-text);
    font-weight: 600;
}

/* ─── Payment ─── */
.em-bookcard-paylist {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    font-size: 0.9rem;
}
.em-bookcard-paylist li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--em-border);
}
.em-bookcard-paylist li:last-child { border-bottom: none; }

.em-bookcard-paytotal {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-top: 12px;
    margin-top: 4px;
    border-top: 2px solid var(--em-border);
    font-weight: 600;
    color: var(--em-text);
}

.em-bookcard-empty {
    padding: 14px 16px;
    background: var(--em-gray-50, #f8f9fa);
    border-radius: 8px;
    font-size: 0.875rem;
    text-align: center;
}

/* Färgkontrast-fix för upcoming + confirmed på pills (WCAG AA).
   Ljust läge: ljus bg → mörkblå text. */
.em-activity-status--upcoming,
.em-activity-status--confirmed {
    color: #1e40af; /* mörkare blå för bättre kontrast på info-light bg */
}
/* Mörkt läge: mörk bg → ljus blå text (theme-medveten info-färg),
   annars blir mörkblå text oläsbar på den mörka pillen. */
[data-theme="dark"] .em-activity-status--upcoming,
[data-theme="dark"] .em-activity-status--confirmed {
    color: var(--em-info);
}
.em-bookcard-paytotal-amount {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--em-accent);
}

.em-bookcard-paymeta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    color: var(--em-text-muted);
    font-size: 0.825rem;
}

.em-bookcard-refund {
    background: rgba(13, 110, 253, 0.08);
    border: 1px solid rgba(13, 110, 253, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 10px;
    font-size: 0.875rem;
}

.em-bookcard-callout {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.5;
}
.em-bookcard-callout--warning {
    background: rgba(217, 119, 6, 0.1);
    border: 1px solid rgba(217, 119, 6, 0.25);
    color: #92400e;
}

/* ─── Refund cards ─── */
.em-refund-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 1rem;
}
.em-refund-card {
    border: 1px solid var(--em-border, #e5e7eb);
    border-radius: 10px;
    background: #fff;
    padding: 12px 14px;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.em-refund-card:hover { border-color: var(--em-border-strong, #cbd5e1); }
.em-refund-card--unchecked {
    background: var(--em-gray-50, #f8f9fa);
    opacity: 0.65;
}
.em-refund-card--disabled {
    background: var(--em-gray-50, #f8f9fa);
    opacity: 0.5;
}
.em-refund-card-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.em-refund-card-check {
    display: flex;
    align-items: center;
    padding-top: 2px;
    cursor: pointer;
    margin: 0;
}
.em-refund-card-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}
.em-refund-card-check input[type="checkbox"]:disabled { cursor: not-allowed; }
.em-refund-card-body {
    flex: 1;
    min-width: 0;
}
.em-refund-card-title {
    font-weight: 600;
    color: var(--em-text, #111827);
    line-height: 1.3;
}
.em-refund-card-meta {
    font-size: 0.8rem;
    color: var(--em-text-muted, #6b7280);
    margin-top: 2px;
}
.em-refund-card-amount {
    text-align: right;
    min-width: 110px;
    white-space: nowrap;
}
.em-refund-card-amount .em-refund-row-amount {
    font-size: 0.95rem;
    color: var(--em-text, #111827);
}
.em-refund-card-amount .em-refund-row-status {
    font-size: 0.75rem;
    margin-top: 2px;
}
.em-refund-card-stepper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    padding-left: 30px;
    border-top: 1px dashed var(--em-border, #e5e7eb);
    flex-wrap: wrap;
}
.em-refund-stepper-label {
    font-size: 0.8rem;
    color: var(--em-text-muted, #6b7280);
}
.em-refund-stepper {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--em-border, #e5e7eb);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.em-refund-stepper-btn {
    background: var(--em-gray-50, #f8f9fa);
    border: none;
    width: 32px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--em-text, #111827);
    cursor: pointer;
    transition: background 0.1s ease;
    line-height: 1;
}
.em-refund-stepper-btn:hover:not(:disabled) { background: var(--em-gray-100, #e9ecef); }
.em-refund-stepper-btn:disabled {
    color: #cbd5e1;
    cursor: not-allowed;
}
.em-refund-stepper-input {
    width: 48px;
    border: none;
    border-left: 1px solid var(--em-border, #e5e7eb);
    border-right: 1px solid var(--em-border, #e5e7eb);
    text-align: center;
    padding: 4px 0;
    font-size: 0.9rem;
    -moz-appearance: textfield;
    background: #fff;
}
.em-refund-stepper-input:disabled { background: var(--em-gray-50, #f8f9fa); color: #94a3b8; }
.em-refund-stepper-input::-webkit-outer-spin-button,
.em-refund-stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.em-refund-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    margin-top: 4px;
    margin-bottom: 1rem;
    background: var(--em-gray-50, #f8f9fa);
    border-radius: 10px;
    border: 1px solid var(--em-border, #e5e7eb);
}
.em-refund-total-label {
    font-weight: 600;
    color: var(--em-text, #111827);
}
.em-refund-total-amount {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--em-text, #111827);
}

/* ─── Participants table ─── */
.em-bookcard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.em-bookcard-table th,
.em-bookcard-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--em-border);
}
.em-bookcard-table th {
    font-weight: 600;
    color: var(--em-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--em-gray-50, #f8f9fa);
}
.em-bookcard-table tbody tr:last-child td { border-bottom: none; }
.em-bookcard-table tbody tr:hover td { background: var(--em-gray-50, #f9fafb); }

/* ─── Booking log (collapsible) ─── */
.em-bookcard-section--collapsible {
    padding: 0;
    overflow: hidden;
}
.em-bookcard-section--collapsible summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 18px;
    font-weight: 600;
    color: var(--em-text);
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
    transition: background 0.15s;
}
.em-bookcard-section--collapsible summary:hover {
    background: var(--em-gray-50, #f9fafb);
}
.em-bookcard-section--collapsible summary::-webkit-details-marker { display: none; }
.em-bookcard-section--collapsible summary::before {
    content: '\f078'; /* chevron-down */
    font-family: 'Font Awesome 6 Pro', 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.75rem;
    color: var(--em-text-muted);
    margin-right: 8px;
    transform: rotate(-90deg);
    transition: transform 0.2s;
}
.em-bookcard-section--collapsible[open] summary::before {
    transform: rotate(0deg);
}
.em-bookcard-log-count {
    margin-left: auto;
    display: inline-block;
    min-width: 22px;
    padding: 2px 8px;
    background: var(--em-gray-200, #e5e7eb);
    color: var(--em-text-muted);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
}
.em-bookcard-section-body { padding: 0 18px 16px; }

.em-bookcard-log {
    list-style: none;
    padding: 0;
    margin: 0;
}
.em-bookcard-log li {
    display: grid;
    grid-template-columns: 160px 1fr 180px;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--em-border);
    font-size: 0.85rem;
    align-items: start;
}
.em-bookcard-log li:first-child { border-top: none; }
.em-bookcard-log-when {
    color: var(--em-text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}
.em-bookcard-log-what { color: var(--em-text); }
.em-bookcard-log-type {
    display: inline-block;
    padding: 1px 8px;
    margin-right: 6px;
    background: var(--em-gray-100, #f3f4f6);
    color: var(--em-text-muted);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.em-bookcard-log-who {
    color: var(--em-text-muted);
    font-size: 0.78rem;
    text-align: right;
}

@media (max-width: 767.98px) {
    .em-bookcard-log li {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .em-bookcard-log-who { text-align: left; }
    .em-bookcard-dl,
    .em-bookcard-qa {
        grid-template-columns: 1fr;
        row-gap: 2px;
    }
    .em-bookcard-dl dd,
    .em-bookcard-qa dd { margin-bottom: 10px; }
}

/* Dark mode */
[data-theme="dark"] .em-bookcard-hero,
[data-theme="dark"] .em-bookcard-section {
    background: var(--em-surface-elevated, #1f2937);
    border-color: var(--em-border);
}
[data-theme="dark"] .em-bookcard-table th {
    background: var(--em-surface-3, #111827);
}


/* ============================================================
   Dashboard KPI-rad (kompakta nyckeltal överst på skrivbordet)
   ============================================================ */
.em-kpi-row {
    --em-kpi-blue: #2F55D4;
    --em-kpi-green: #10b981;
    --em-kpi-purple: #8b5cf6;
    --em-kpi-cyan: #06b6d4;
    --em-kpi-orange: #f97316;
}

.em-kpi-tile {
    background: var(--em-white);
    border-radius: var(--em-radius-lg);
    box-shadow: var(--em-shadow-xs);
    padding: var(--em-spacing-md) var(--em-spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--em-spacing-md);
    height: 100%;
    min-height: 92px;
    transition: box-shadow 180ms cubic-bezier(0.4, 0, 0.2, 1),
                transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.em-kpi-tile:hover {
    box-shadow: var(--em-shadow);
    transform: translateY(-1px);
}

.em-kpi-tile-icon {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: var(--em-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.em-kpi-tile-icon--blue   { background: rgba(47, 85, 212, 0.1);  color: var(--em-kpi-blue); }
.em-kpi-tile-icon--green  { background: rgba(16, 185, 129, 0.1); color: var(--em-kpi-green); }
.em-kpi-tile-icon--purple { background: rgba(139, 92, 246, 0.1); color: var(--em-kpi-purple); }
.em-kpi-tile-icon--cyan   { background: rgba(6, 182, 212, 0.1);  color: var(--em-kpi-cyan); }
.em-kpi-tile-icon--orange { background: rgba(249, 115, 22, 0.1); color: var(--em-kpi-orange); }

.em-kpi-tile-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.em-kpi-tile-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--em-gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.em-kpi-tile-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--em-gray-900);
    letter-spacing: -0.02em;
    margin: 2px 0;
}

.em-kpi-tile-trend {
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.em-kpi-tile-trend--up    { color: var(--em-kpi-green); }
.em-kpi-tile-trend--down  { color: #ef4444; }
.em-kpi-tile-trend--flat,
.em-kpi-tile-trend--muted { color: var(--em-gray-500); font-weight: 500; }

.em-kpi-tile-note {
    color: var(--em-gray-500);
    font-weight: 500;
}

/* Dark mode */
[data-theme="dark"] .em-kpi-tile {
    background: var(--em-surface-elevated, #1f2937);
    box-shadow: none;
    border: 1px solid var(--em-border, rgba(255, 255, 255, 0.08));
}
[data-theme="dark"] .em-kpi-tile-label { color: rgba(255, 255, 255, 0.65); }
[data-theme="dark"] .em-kpi-tile-value { color: #f9fafb; }
[data-theme="dark"] .em-kpi-tile-trend--flat,
[data-theme="dark"] .em-kpi-tile-trend--muted,
[data-theme="dark"] .em-kpi-tile-note { color: rgba(255, 255, 255, 0.5); }

/* Mobil: lite tightare brickor */
@media (max-width: 575.98px) {
    .em-kpi-tile { min-height: 80px; padding: var(--em-spacing-sm) var(--em-spacing-md); gap: var(--em-spacing-sm); }
    .em-kpi-tile-icon { width: 40px; height: 40px; font-size: 1rem; }
    .em-kpi-tile-value { font-size: 1.4rem; }
}

/* ============================================================
   Dashboard-header (slimmad hälsningsrad, ersätter välkomstblocket)
   ============================================================ */
.em-dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--em-spacing-md);
    flex-wrap: wrap;
}

.em-dashboard-header-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--em-gray-900);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.em-dashboard-header-date {
    font-size: 0.85rem;
    color: var(--em-gray-500);
    margin-top: 2px;
}

.em-dashboard-header-btn {
    flex-shrink: 0;
}

[data-theme="dark"] .em-dashboard-header-title { color: #f9fafb; }
[data-theme="dark"] .em-dashboard-header-date { color: rgba(255, 255, 255, 0.55); }

/* ============================================================
   Dashboard widgets — enhetligt tomt-läge + responsiva tabeller
   ============================================================ */
.em-dashboard-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--em-spacing-sm);
    padding: var(--em-spacing-lg) var(--em-spacing-md);
}

.em-dashboard-empty-state-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--em-gray-100);
    color: var(--em-gray-400);
    font-size: 1.05rem;
}

.em-dashboard-empty-state-text {
    font-size: 0.85rem;
    color: var(--em-gray-500);
}

[data-theme="dark"] .em-dashboard-empty-state-icon {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.4);
}
[data-theme="dark"] .em-dashboard-empty-state-text { color: rgba(255, 255, 255, 0.55); }

/* Sifferkolumnerna ska alltid synas, även i smal sidokolumn/mobil.
   table-layout: fixed gör att th-bredderna respekteras och att kolumnen utan
   satt bredd krymper och trunkerar — i stället för att tabellen växer ut i
   horisontell scroll (auto-layout låter aldrig kolumner bli smalare än sitt
   innehåll). */
.em-dashboard-table {
    table-layout: fixed;
}

.em-dashboard-table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobil-regeln ger widget-tabeller min-width 600px (horisontell scroll) —
   ska inte gälla dessa tabeller, de krymper med widgeten. */
.em-dashboard-widget .table-responsive .em-dashboard-table {
    min-width: 0;
}

.em-dashboard-table-amount,
.em-dashboard-table-count { white-space: nowrap; }

.em-dashboard-table td:first-child { min-width: 0; }
.em-dashboard-table td:first-child .d-flex { min-width: 0; }
.em-dashboard-table td:first-child .fw-semibold {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* ============================================================
   Dashboard widgets — skeletons, refresh-läge, mikrointeraktioner
   ============================================================ */

/* Skeleton (shimmer) — platshållare medan innehåll laddas */
.em-skeleton {
    position: relative;
    overflow: hidden;
    background: var(--em-gray-200);
    border-radius: var(--em-radius-sm);
}

.em-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: em-skeleton-shimmer 1.4s ease infinite;
}

@keyframes em-skeleton-shimmer {
    100% { transform: translateX(100%); }
}

.em-dashboard-skeleton {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: var(--em-spacing-md) var(--em-spacing-lg);
}

.em-dashboard-skeleton-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.em-dashboard-skeleton-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.em-dashboard-skeleton-line {
    height: 12px;
}

.em-dashboard-widget--skeleton .em-dashboard-widget-header {
    min-height: 49px;
}

[data-theme="dark"] .em-skeleton {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .em-skeleton::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}

/* Uppdatera-läge: innehållet tonas ned medan färskt fragment hämtas */
.em-widget-refreshing .em-dashboard-widget-body {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.em-dashboard-widget-action.is-refreshing i {
    animation: em-spin 0.8s linear infinite;
}

@keyframes em-spin {
    to { transform: rotate(360deg); }
}

/* Mjuk entré: widgets och KPI-rutor fadeas in stegvis vid sidladdning.
   Stängs av under drag (ghost/drag) så animationen inte triggas om vid flytt. */
@media (prefers-reduced-motion: no-preference) {
    .em-dashboard-column > .em-dashboard-widget,
    .em-kpi-row > .col {
        animation: em-widget-enter 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    }

    .em-dashboard-column > .em-dashboard-widget:nth-child(1) { animation-delay: 0.03s; }
    .em-dashboard-column > .em-dashboard-widget:nth-child(2) { animation-delay: 0.08s; }
    .em-dashboard-column > .em-dashboard-widget:nth-child(3) { animation-delay: 0.13s; }
    .em-dashboard-column > .em-dashboard-widget:nth-child(4) { animation-delay: 0.18s; }
    .em-dashboard-column > .em-dashboard-widget:nth-child(5) { animation-delay: 0.23s; }
    .em-dashboard-column > .em-dashboard-widget:nth-child(n+6) { animation-delay: 0.28s; }

    .em-kpi-row > .col:nth-child(1) { animation-delay: 0s; }
    .em-kpi-row > .col:nth-child(2) { animation-delay: 0.04s; }
    .em-kpi-row > .col:nth-child(3) { animation-delay: 0.08s; }
    .em-kpi-row > .col:nth-child(4) { animation-delay: 0.12s; }

    .em-dashboard-widget.sortable-ghost,
    .em-dashboard-widget.sortable-drag {
        animation: none;
    }
}

@keyframes em-widget-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* Diagram-toolbar: periodens utveckling till vänster, periodpills till höger */
.em-dashboard-chart-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--em-spacing-sm);
    flex-wrap: wrap;
    margin-bottom: var(--em-spacing-sm);
}

.em-dashboard-chart-stat {
    display: flex;
    align-items: baseline;
    gap: var(--em-spacing-sm);
    min-width: 0;
}

.em-dashboard-chart-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    color: var(--em-gray-900);
}

.em-dashboard-chart-stat-delta {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--em-gray-500);
}

.em-dashboard-chart-stat-delta--up { color: #10b981; }
.em-dashboard-chart-stat-delta--down { color: #ef4444; }
.em-dashboard-chart-stat-delta--flat { color: var(--em-gray-500); }

[data-theme="dark"] .em-dashboard-chart-stat-value { color: #f9fafb; }
[data-theme="dark"] .em-dashboard-chart-stat-delta--up { color: #34d399; }
[data-theme="dark"] .em-dashboard-chart-stat-delta--down { color: #f87171; }

/* ============================================================
   Skrivbordet 2026-08: hero-snabbåtgärder, Kräver åtgärd,
   KPI-sparklines och Föreningsårets puls
   ============================================================ */

/* Hero */
.em-dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-sm);
    flex-wrap: wrap;
}

.em-quick-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--em-gray-900);
    background: var(--em-white);
    border: 1px solid var(--em-gray-200);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    box-shadow: var(--em-shadow-sm);
    text-decoration: none;
    transition: var(--em-transition);
}

.em-quick-action:hover {
    color: var(--em-accent);
    border-color: var(--em-accent);
    transform: translateY(-1px);
    box-shadow: var(--em-shadow);
}

.em-quick-action i { color: var(--em-accent); }

.em-dashboard-header-pending { color: var(--em-warning); font-weight: 700; }

.em-dashboard-header-updated { color: var(--em-gray-400); font-size: 0.8rem; }

/* Kräver åtgärd */
.em-action-center .em-dashboard-widget-body { padding: 0; }

.em-action-center-count {
    display: inline-block;
    background: var(--em-warning-light);
    color: var(--em-warning);
    font-size: 0.75rem;
    font-weight: 800;
    border-radius: 999px;
    padding: 0.05rem 0.55rem;
    margin-left: 4px;
    vertical-align: middle;
}

.em-action-center-row {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-md);
    padding: 0.7rem var(--em-spacing-lg);
    border-bottom: 1px solid var(--em-gray-100);
    border-left: 3px solid transparent;
}

.em-action-center-row:last-child { border-bottom: none; }

.em-action-center-row--warning { border-left-color: var(--em-warning); }
.em-action-center-row--danger  { border-left-color: var(--em-danger); }
.em-action-center-row--info    { border-left-color: var(--em-accent); }

.em-action-center-ico {
    width: 32px;
    height: 32px;
    border-radius: var(--em-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.em-action-center-ico--warning { background: var(--em-warning-light); color: var(--em-warning); }
.em-action-center-ico--danger  { background: var(--em-danger-light);  color: var(--em-danger); }
.em-action-center-ico--info    { background: var(--em-info-light);    color: var(--em-accent); }

.em-action-center-text { flex: 1; min-width: 0; line-height: 1.35; }
.em-action-center-text b { display: block; font-size: 0.88rem; font-weight: 700; color: var(--em-gray-900); }
.em-action-center-text span { font-size: 0.8rem; color: var(--em-gray-500); }

.em-action-center-cta {
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    color: var(--em-accent);
    border: 1px solid var(--em-gray-300);
    border-radius: 999px;
    padding: 0.32rem 0.85rem;
    text-decoration: none;
    transition: var(--em-transition);
}

.em-action-center-cta:hover {
    color: var(--em-accent);
    background: var(--em-info-light);
    border-color: var(--em-accent);
}

.em-action-center--empty { display: none; }

/* KPI-sparklines (ligger i fotraden bredvid trenden så etiketten inte trängs ut) */
.em-kpi-tile-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.em-kpi-tile-spark {
    width: 72px;
    height: 26px;
    flex-shrink: 0;
}

.em-kpi-spark-line {
    fill: none;
    stroke: var(--em-accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.em-kpi-spark-fill { fill: rgba(47, 85, 212, 0.12); }

.em-kpi-spark-dot { fill: var(--em-accent); }

@media (max-width: 767px) {
    .em-kpi-tile-spark { display: none; }
}

/* Föreningsårets puls */
.em-pulse-rate { display: flex; align-items: baseline; gap: 8px; margin-bottom: var(--em-spacing-sm); }

.em-pulse-rate-value {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--em-gray-900);
}

.em-pulse-rate-label { font-size: 0.85rem; font-weight: 600; color: var(--em-gray-500); }

.em-pulse-progress { margin-bottom: var(--em-spacing-md); }

.em-pulse-progress-track {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: var(--em-gray-100);
}

.em-pulse-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--em-accent);
}

/* Målmarkering: fjolårets slutliga förnyelsegrad som tick på baren */
.em-pulse-progress-target {
    position: absolute;
    top: -3px;
    bottom: -3px;
    width: 3px;
    border-radius: 2px;
    background: var(--em-gray-400);
    transform: translateX(-50%);
}

.em-pulse-progress-meta {
    display: flex;
    justify-content: space-between;
    gap: var(--em-spacing-sm);
    font-size: 0.78rem;
    color: var(--em-gray-500);
    margin-top: 6px;
    font-variant-numeric: tabular-nums;
}

.em-pulse-progress-target-label { display: inline-flex; align-items: center; gap: 5px; }

.em-pulse-progress-target-tick {
    width: 3px;
    height: 12px;
    border-radius: 2px;
    background: var(--em-gray-400);
    display: inline-block;
}

/* Rader: hårstrecksavdelare i stället för inramade boxar */
.em-pulse-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.65rem 0;
    border-top: 1px solid var(--em-gray-100);
    font-size: 0.85rem;
    color: var(--em-gray-600);
}

.em-pulse-item:last-child { padding-bottom: 0; }

.em-pulse-item b { color: var(--em-gray-900); font-variant-numeric: tabular-nums; }

.em-pulse-item-ico {
    width: 28px;
    height: 28px;
    border-radius: var(--em-radius-sm);
    background: var(--em-info-light);
    color: var(--em-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.em-pulse-item-text { flex: 1; min-width: 0; }

.em-pulse-item-cta {
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    color: var(--em-accent);
    border: 1px solid var(--em-gray-300);
    border-radius: 999px;
    padding: 0.28rem 0.8rem;
    text-decoration: none;
    transition: var(--em-transition);
}

.em-pulse-item-cta:hover { color: var(--em-accent); background: var(--em-info-light); border-color: var(--em-accent); }

.em-pulse-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-variant-numeric: tabular-nums;
}

.em-pulse-delta--up { color: var(--em-success); background: var(--em-success-light); }
.em-pulse-delta--down { color: var(--em-danger); background: var(--em-danger-light); }

/* Mörkt tema */
[data-theme="dark"] .em-quick-action {
    background: var(--em-surface-elevated);
    border-color: var(--em-border, rgba(255, 255, 255, 0.08));
    color: var(--em-text, #edf1f7);
    box-shadow: none;
}
[data-theme="dark"] .em-quick-action:hover { border-color: var(--em-accent); color: var(--em-accent); }
[data-theme="dark"] .em-dashboard-header-updated { color: rgba(255, 255, 255, 0.4); }
[data-theme="dark"] .em-action-center-row { border-bottom-color: var(--em-border, rgba(255, 255, 255, 0.08)); }
[data-theme="dark"] .em-action-center-text b { color: var(--em-text, #edf1f7); }
[data-theme="dark"] .em-action-center-text span { color: var(--em-text-muted, #96a3bd); }
[data-theme="dark"] .em-action-center-cta,
[data-theme="dark"] .em-pulse-item-cta { border-color: var(--em-border-strong, rgba(255, 255, 255, 0.15)); }
[data-theme="dark"] .em-kpi-spark-fill { fill: rgba(74, 115, 245, 0.16); }
[data-theme="dark"] .em-pulse-rate-value { color: #f9fafb; }
[data-theme="dark"] .em-pulse-progress-track { background: var(--em-surface-3); }
[data-theme="dark"] .em-pulse-progress-target,
[data-theme="dark"] .em-pulse-progress-target-tick { background: var(--em-gray-400); }
[data-theme="dark"] .em-pulse-item {
    border-top-color: var(--em-border, rgba(255, 255, 255, 0.08));
    color: var(--em-text-subtle, #a8b5cc);
}
[data-theme="dark"] .em-pulse-item b { color: var(--em-text, #edf1f7); }

/* ============================================================
   Versionsloggen 2026-08: tidslinje, typ-chips och kort
   ============================================================ */
.em-vlog-toolbar {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-md);
    flex-wrap: wrap;
    background: var(--em-surface);
    border: 1px solid var(--em-border, var(--em-gray-200));
    border-radius: var(--em-radius-lg);
    box-shadow: var(--em-shadow-sm);
    padding: 0.75rem var(--em-spacing-md);
    margin-bottom: var(--em-spacing-xl);
}

.em-vlog-search {
    position: relative;
    flex: 1 1 220px;
    min-width: 200px;
    display: flex;
    align-items: center;
}

.em-vlog-search > i {
    position: absolute;
    left: 12px;
    color: var(--em-gray-400);
    font-size: 0.85rem;
    pointer-events: none;
}

.em-vlog-search .form-control { padding-left: 34px; border-radius: 999px; }

.em-vlog-clear {
    position: absolute;
    right: 10px;
    color: var(--em-gray-400);
    text-decoration: none;
    padding: 4px;
}
.em-vlog-clear:hover { color: var(--em-danger); }

.em-vlog-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.em-vlog-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--em-gray-600);
    background: var(--em-surface);
    border: 1px solid var(--em-gray-300);
    border-radius: 999px;
    padding: 0.32rem 0.8rem;
    text-decoration: none;
    transition: var(--em-transition);
    white-space: nowrap;
}

.em-vlog-chip:hover { border-color: var(--em-accent); color: var(--em-accent); }

.em-vlog-chip.is-active {
    background: var(--em-accent);
    border-color: var(--em-accent);
    color: #fff;
}

.em-vlog-chip-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.em-vlog-chip--nyhet .em-vlog-chip-dot       { background: var(--em-success); }
.em-vlog-chip--bugg .em-vlog-chip-dot        { background: var(--em-danger); }
.em-vlog-chip--borttaget .em-vlog-chip-dot   { background: var(--em-warning); }
.em-vlog-chip--forbattring .em-vlog-chip-dot { background: var(--em-accent); }
.em-vlog-chip.is-active .em-vlog-chip-dot    { background: #fff; }

.em-vlog-chip-count {
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--em-gray-100);
    color: var(--em-gray-500);
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    font-variant-numeric: tabular-nums;
}
.em-vlog-chip.is-active .em-vlog-chip-count { background: rgba(255, 255, 255, 0.2); color: #fff; }

.em-vlog-perpage { width: auto; border-radius: 999px; }

/* Månadsavsnitt + tidslinje */
.em-vlog-month { margin-bottom: var(--em-spacing-xl); }

.em-vlog-month-head {
    display: flex;
    align-items: baseline;
    gap: var(--em-spacing-sm);
    margin-bottom: var(--em-spacing-md);
}

.em-vlog-month-title { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; margin: 0; color: var(--em-gray-900); }

.em-vlog-month-count { font-size: 0.78rem; font-weight: 600; color: var(--em-gray-400); }

.em-vlog-timeline {
    position: relative;
    padding-left: 44px;
    display: flex;
    flex-direction: column;
    gap: var(--em-spacing-md);
}

.em-vlog-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--em-gray-200);
    border-radius: 2px;
}

.em-vlog-entry { position: relative; }

.em-vlog-dot {
    position: absolute;
    left: -44px;
    top: 6px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #fff;
    box-shadow: 0 0 0 4px var(--em-surface-2, var(--em-gray-50));
}

.em-vlog-entry--nyhet .em-vlog-dot       { background: var(--em-success); }
.em-vlog-entry--bugg .em-vlog-dot        { background: var(--em-danger); }
.em-vlog-entry--borttaget .em-vlog-dot   { background: var(--em-warning); }
.em-vlog-entry--forbattring .em-vlog-dot { background: var(--em-accent); }

.em-vlog-card {
    background: var(--em-surface);
    border: 1px solid var(--em-border, var(--em-gray-200));
    border-radius: var(--em-radius-lg);
    box-shadow: var(--em-shadow-sm);
    padding: var(--em-spacing-md) var(--em-spacing-lg);
    transition: box-shadow 180ms ease;
}

.em-vlog-card:hover { box-shadow: var(--em-shadow-md); }

.em-vlog-card-head {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-sm);
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.em-vlog-type-pill {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 999px;
    padding: 0.15rem 0.6rem;
    white-space: nowrap;
}

.em-vlog-entry--nyhet .em-vlog-type-pill       { background: var(--em-success-light); color: var(--em-success); }
.em-vlog-entry--bugg .em-vlog-type-pill        { background: var(--em-danger-light);  color: var(--em-danger); }
.em-vlog-entry--borttaget .em-vlog-type-pill   { background: var(--em-warning-light); color: var(--em-warning); }
.em-vlog-entry--forbattring .em-vlog-type-pill { background: var(--em-info-light);    color: var(--em-accent); }

.em-vlog-card-title { font-size: 0.98rem; font-weight: 700; margin: 0; color: var(--em-gray-900); flex: 1; min-width: 0; }

.em-vlog-card-date { font-size: 0.78rem; color: var(--em-gray-400); white-space: nowrap; font-variant-numeric: tabular-nums; }

.em-vlog-card-actions { display: inline-flex; align-items: center; gap: 4px; }

.em-vlog-like {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    color: var(--em-gray-400);
    background: none;
    border: none;
    padding: 4px 6px;
    border-radius: var(--em-radius-sm);
    cursor: pointer;
    transition: var(--em-transition);
}

.em-vlog-like:hover { color: var(--em-danger); background: var(--em-danger-light); }
.em-vlog-like.is-liked { color: var(--em-danger); }
.em-vlog-like .versionlog-like-count { font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Innehåll (HTML från redaktören) */
.versionlog-content { line-height: 1.6; word-wrap: break-word; overflow-wrap: break-word; color: var(--em-gray-600); font-size: 0.9rem; }
.versionlog-content * { max-width: 100%; }
.versionlog-content p { margin-bottom: 0.75rem; }
.versionlog-content p:last-child { margin-bottom: 0; }
.versionlog-content h1, .versionlog-content h2, .versionlog-content h3,
.versionlog-content h4, .versionlog-content h5, .versionlog-content h6 { color: var(--em-gray-900); font-size: 1rem; font-weight: 700; }
.versionlog-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--em-radius-md);
    margin: 1rem 0;
    box-shadow: var(--em-shadow);
    display: block;
}

.em-vlog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--em-spacing-md);
    flex-wrap: wrap;
    margin-top: var(--em-spacing-lg);
}

.em-vlog-showing { font-size: 0.8rem; color: var(--em-gray-400); font-variant-numeric: tabular-nums; }

.em-vlog-empty { padding: var(--em-spacing-xxl) 0; }

/* Mörkt tema */
[data-theme="dark"] .em-vlog-toolbar,
[data-theme="dark"] .em-vlog-card {
    background: var(--em-surface-elevated);
    border-color: var(--em-border, rgba(255, 255, 255, 0.08));
    box-shadow: none;
}
[data-theme="dark"] .em-vlog-month-title,
[data-theme="dark"] .em-vlog-card-title { color: var(--em-text, #edf1f7); }
[data-theme="dark"] .em-vlog-chip {
    background: var(--em-surface-elevated);
    border-color: var(--em-border-strong, rgba(255, 255, 255, 0.15));
    color: var(--em-text-subtle, #a8b5cc);
}
[data-theme="dark"] .em-vlog-chip.is-active { background: var(--em-accent); border-color: var(--em-accent); color: #fff; }
[data-theme="dark"] .em-vlog-chip-count { background: var(--em-surface-3); color: var(--em-text-muted, #96a3bd); }
[data-theme="dark"] .em-vlog-chip.is-active .em-vlog-chip-count { background: rgba(255, 255, 255, 0.2); color: #fff; }
[data-theme="dark"] .em-vlog-timeline::before { background: var(--em-surface-3); }
[data-theme="dark"] .em-vlog-dot { box-shadow: 0 0 0 4px var(--em-dark-base, #0c1222); }
[data-theme="dark"] .versionlog-content { color: var(--em-text-subtle, #a8b5cc); }
[data-theme="dark"] .versionlog-content h1, [data-theme="dark"] .versionlog-content h2,
[data-theme="dark"] .versionlog-content h3, [data-theme="dark"] .versionlog-content h4,
[data-theme="dark"] .versionlog-content h5, [data-theme="dark"] .versionlog-content h6 { color: var(--em-text, #edf1f7); }

/* ============================================================
   Sidomenyn: premium-detaljer — aktiv-rail, mikromotorik,
   kvarlämnad-aktiv-prick och tunn scrollbar
   ============================================================ */

/* Aktiv-rail: rundad accentmarkör som följer föreningens accentfärg
   (defaultar till em-blå). Ger navigationen en tydlig "du är här". */
.em-v2-nav-link.active::before {
    content: '';
    display: block;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 999px;
    background: var(--em-brand-accent);
}

.em-v2-nav-link.active .em-v2-nav-icon {
    color: var(--em-brand-accent);
    opacity: 1;
}

/* Aktiv undersida: accentprick + tydligare vikt */
.em-v2-nav-sublink.active {
    font-weight: 600;
}

.em-v2-nav-sublink.active::before {
    background: var(--em-brand-accent);
    transform: scale(1.4);
}

/* Hopfälld grupp som innehåller aktiv sida: liten accentprick vid chevronen
   så man aldrig tappar bort var man är (progressive enhancement via :has) */
.em-v2-nav-item-dropdown:not(.open):has(.em-v2-nav-sublink.active) > .em-v2-nav-link-dropdown::after {
    content: '';
    position: absolute;
    right: 34px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--em-brand-accent);
}

.em-v2-sidebar.collapsed .em-v2-nav-item-dropdown > .em-v2-nav-link-dropdown::after {
    display: none;
}

/* Mikromotorik: mjuk förflyttning vid hover (respekterar reduced motion) */
@media (prefers-reduced-motion: no-preference) {
    .em-v2-nav-link,
    .em-v2-nav-sublink {
        transition: background-color var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn),
                    color var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn),
                    transform var(--em-sidebar-transition-speed) var(--em-sidebar-transition-fn);
    }

    .em-v2-nav-link:not(.active):hover,
    .em-v2-nav-sublink:not(.active):hover {
        transform: translateX(2px);
    }
}

/* Tunn scrollbar i sidomenyn */
.em-v2-sidebar,
.em-v2-sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: var(--em-gray-300) transparent;
}

.em-v2-sidebar::-webkit-scrollbar,
.em-v2-sidebar-nav::-webkit-scrollbar { width: 6px; }

.em-v2-sidebar::-webkit-scrollbar-thumb,
.em-v2-sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--em-gray-300);
    border-radius: 3px;
}

.em-v2-sidebar::-webkit-scrollbar-track,
.em-v2-sidebar-nav::-webkit-scrollbar-track { background: transparent; }

/* Mörkt tema */
[data-theme="dark"] .em-v2-sidebar,
[data-theme="dark"] .em-v2-sidebar-nav { scrollbar-color: var(--em-surface-3) transparent; }
[data-theme="dark"] .em-v2-sidebar::-webkit-scrollbar-thumb,
[data-theme="dark"] .em-v2-sidebar-nav::-webkit-scrollbar-thumb { background: var(--em-surface-3); }

/* ============================================================
   Anpassa skrivbordet: grupprubriker + fäst-badge
   ============================================================ */
.em-dashboard-modal-group-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--em-gray-400);
    margin-bottom: 0.6rem;
}

.em-dashboard-widget-toggle-pin {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--em-gray-500);
    background: var(--em-gray-100);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    margin-left: 6px;
    vertical-align: middle;
}

[data-theme="dark"] .em-dashboard-modal-group-heading { color: var(--em-text-muted, #96a3bd); }
[data-theme="dark"] .em-dashboard-widget-toggle-pin {
    background: var(--em-surface-3);
    color: var(--em-text-muted, #96a3bd);
}

/* ============================================================
   Notisklockan: kompakta åtgärdsrader i dropdownen
   ============================================================ */
.em-v2-alert-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.7rem;
    border-radius: var(--em-radius-md);
    text-decoration: none;
    color: inherit;
    border-left: 3px solid transparent;
    transition: background 0.15s ease;
}

.em-v2-alert-row:hover { background: var(--em-gray-50); color: inherit; }

.em-v2-alert-row--warning { border-left-color: var(--em-warning); }
.em-v2-alert-row--danger  { border-left-color: var(--em-danger); }
.em-v2-alert-row--info    { border-left-color: var(--em-accent); }

.em-v2-alert-ico {
    width: 32px;
    height: 32px;
    border-radius: var(--em-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
}

.em-v2-alert-ico--warning { background: var(--em-warning-light); color: var(--em-warning); }
.em-v2-alert-ico--danger  { background: var(--em-danger-light);  color: var(--em-danger); }
.em-v2-alert-ico--info    { background: var(--em-info-light);    color: var(--em-accent); }

.em-v2-alert-body { flex: 1; min-width: 0; line-height: 1.35; }

.em-v2-alert-title {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--em-gray-900);
}

.em-v2-alert-count {
    display: inline-block;
    background: var(--em-gray-100);
    color: var(--em-gray-500);
    font-size: 0.7rem;
    font-weight: 800;
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    margin-left: 4px;
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}

.em-v2-alert-text {
    display: block;
    font-size: 0.75rem;
    color: var(--em-gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.em-v2-alert-cta {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--em-accent);
    white-space: nowrap;
    flex-shrink: 0;
}

[data-theme="dark"] .em-v2-alert-row:hover { background: var(--em-surface-2); }
[data-theme="dark"] .em-v2-alert-title { color: var(--em-text, #edf1f7); }
[data-theme="dark"] .em-v2-alert-text { color: var(--em-text-muted, #96a3bd); }
[data-theme="dark"] .em-v2-alert-count { background: var(--em-surface-3); color: var(--em-text-muted, #96a3bd); }

/* ============================================================
   Föreningsidentitet: brandblock + "Drivs av" + accentfärg
   ============================================================ */
:root { --em-brand-accent: var(--em-accent); }

.em-v2-sidebar-brandrow {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--em-border, var(--em-gray-200));
    padding-right: 10px;
}

.em-v2-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    flex: 1;
}

.em-v2-sidebar-close {
    border: none;
    background: var(--em-gray-100);
    color: var(--em-gray-500);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.em-v2-sidebar-close:hover { background: var(--em-gray-200); color: var(--em-gray-900); }

.em-v2-sidebar-brand:hover { color: inherit; }
.em-v2-sidebar-brand:hover .em-v2-sidebar-brand-name b { color: var(--em-brand-accent); }

.em-v2-sidebar-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    color: #fff;
    background: var(--em-brand-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--em-brand-accent) 15%, transparent);
}

.em-v2-sidebar-brand-logo {
    max-height: 40px;
    max-width: 150px;
    object-fit: contain;
    flex-shrink: 0;
}

.em-v2-sidebar-brand-name { min-width: 0; }

.em-v2-sidebar-brand-name b {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--em-gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s ease;
}

.em-v2-sidebar-brand-name > span {
    font-size: 0.7rem;
    color: var(--em-gray-400);
}

.em-v2-sidebar-powered {
    border-top: 1px solid var(--em-border, var(--em-gray-200));
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--em-gray-400);
}

.em-v2-sidebar-powered .em-logo-light { display: inline-block; }
.em-v2-sidebar-powered .em-logo-dark { display: none; }
[data-theme="dark"] .em-v2-sidebar-powered .em-logo-light { display: none; }
[data-theme="dark"] .em-v2-sidebar-powered .em-logo-dark { display: inline-block; }

[data-theme="dark"] .em-v2-sidebar-brandrow { border-color: var(--em-border, rgba(255, 255, 255, 0.08)); }
[data-theme="dark"] .em-v2-sidebar-close { background: var(--em-surface-3); color: var(--em-text-muted, #96a3bd); }
[data-theme="dark"] .em-v2-sidebar-close:hover { color: var(--em-text, #edf1f7); }

/* Hopfälld sidomeny: bara brandmärket syns */
.em-v2-sidebar.collapsed .em-v2-sidebar-brand { justify-content: center; padding: 14px 8px; }
.em-v2-sidebar.collapsed .em-v2-sidebar-brand-name,
.em-v2-sidebar.collapsed .em-v2-sidebar-brand-logo,
.em-v2-sidebar.collapsed .em-v2-sidebar-powered { display: none; }
.em-v2-sidebar.collapsed .em-v2-sidebar-brand-mark { display: flex; }

/* Accent-tillämpningar — bara när föreningen har egen temafärg (opt-in via
   webbmodulens website_theme_primary_color). Utan den ser allt ut som idag. */
.em-has-brand-accent .em-v2-nav-link.active {
    background-color: color-mix(in srgb, var(--em-brand-accent) 12%, transparent);
    color: var(--em-brand-accent);
}

.em-has-brand-accent .em-v2-nav-link.active .em-v2-nav-icon { color: var(--em-brand-accent); }

.em-has-brand-accent .em-v2-user-avatar-wrapper {
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--em-brand-accent);
}

/* Mörkt tema */
[data-theme="dark"] .em-v2-sidebar-brand,
[data-theme="dark"] .em-v2-sidebar-powered { border-color: var(--em-border, rgba(255, 255, 255, 0.08)); }
[data-theme="dark"] .em-v2-sidebar-brand-name b { color: var(--em-text, #edf1f7); }
[data-theme="dark"] .em-v2-sidebar-brand-name > span,
[data-theme="dark"] .em-v2-sidebar-powered { color: var(--em-text-muted, #96a3bd); }
/* Egen accentfärg är kontrastvaliderad mot VIT yta — på mörk yta används den
   bara som tonad bakgrund/indikator, aldrig som textfärg. */
[data-theme="dark"] .em-has-brand-accent .em-v2-nav-link.active { color: var(--em-text, #edf1f7); }
[data-theme="dark"] .em-has-brand-accent .em-v2-nav-link.active .em-v2-nav-icon { color: var(--em-text, #edf1f7); }

/* ============================================================
   Gemensamt sidhuvud (<x-page-header>)
   ============================================================ */
.em-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--em-spacing-md);
    flex-wrap: wrap;
}

.em-page-header-crumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--em-gray-400);
    margin-bottom: 2px;
}

.em-page-header-crumbs a {
    color: var(--em-gray-500);
    text-decoration: none;
}

.em-page-header-crumbs a:hover { color: var(--em-accent); }

.em-page-header-crumbs i { font-size: 0.55rem; opacity: 0.7; }

.em-page-header-crumbs span[aria-current] { color: var(--em-gray-500); }

.em-page-header-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: var(--em-primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.em-page-header-subtitle {
    font-size: 0.875rem;
    color: var(--em-gray-500);
    margin-top: 2px;
}

.em-page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-sm);
    flex-wrap: wrap;
}

/* Åtgärdsknappar i sidhuvuden: samma pillerspråk som skrivbordets snabb-
   åtgärder. Max EN primär (fylld accent) per sida — resten sekundära. */
.em-page-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--em-gray-900);
    background: var(--em-white);
    border: 1px solid var(--em-gray-200);
    border-radius: 999px;
    padding: 0.45rem 1rem;
    box-shadow: var(--em-shadow-sm);
    text-decoration: none;
    cursor: pointer;
    transition: var(--em-transition);
}

.em-page-action:hover {
    color: var(--em-accent);
    border-color: var(--em-accent);
    transform: translateY(-1px);
    box-shadow: var(--em-shadow);
}

.em-page-action i { color: var(--em-accent); }

/* Antalsbricka för åtgärder som bara visas när det finns något att hantera —
   siffran är hela poängen med att knappen syns, så den ska synas direkt. */
.em-page-action-count {
    display: inline-block;
    min-width: 20px;
    padding: 1px 7px;
    margin-left: 2px;
    background: var(--em-accent);
    color: #fff;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
}

.em-page-action--primary {
    background: var(--em-accent);
    border-color: var(--em-accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(47, 85, 212, 0.3);
}

.em-page-action--primary i { color: #fff; }

.em-page-action--primary:hover {
    color: #fff;
    border-color: var(--em-accent);
    filter: brightness(1.08);
}

[data-theme="dark"] .em-page-action {
    background: var(--em-surface-elevated);
    border-color: var(--em-border, rgba(255, 255, 255, 0.08));
    color: var(--em-text, #edf1f7);
    box-shadow: none;
}
[data-theme="dark"] .em-page-action:hover { color: var(--em-accent); border-color: var(--em-accent); }
[data-theme="dark"] .em-page-action--primary { background: var(--em-accent); color: #fff; }
[data-theme="dark"] .em-page-action--primary:hover { color: #fff; }

[data-theme="dark"] .em-page-header-subtitle { color: var(--em-text-muted, #96a3bd); }
[data-theme="dark"] .em-page-header-crumbs,
[data-theme="dark"] .em-page-header-crumbs a,
[data-theme="dark"] .em-page-header-crumbs span[aria-current] { color: var(--em-text-muted, #96a3bd); }
[data-theme="dark"] .em-page-header-crumbs a:hover { color: var(--em-accent); }

/* ============================================================
   Kommandopalett (Ctrl+K)
   ============================================================ */
.em-palette-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 14vh 1rem 1rem;
    z-index: 10500;
}

.em-palette-overlay.open { display: flex; }

.em-palette {
    width: 100%;
    max-width: 620px;
    background: var(--em-surface-elevated, #fff);
    border: 1px solid var(--em-border, var(--em-gray-200));
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 62vh;
}

@media (prefers-reduced-motion: no-preference) {
    .em-palette-overlay.open .em-palette { animation: emPaletteIn 0.16s cubic-bezier(0.22, 1, 0.36, 1); }
}

@keyframes emPaletteIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.985); }
}

.em-palette kbd {
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--em-gray-100);
    border: 1px solid var(--em-gray-300);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 0.1rem 0.4rem;
    color: var(--em-gray-500);
    white-space: nowrap;
}

.em-palette-input-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--em-border, var(--em-gray-200));
}

.em-palette-input-row > i { color: var(--em-gray-400); flex: none; }

.em-palette-input {
    flex: 1;
    border: none;
    outline: none;
    background: none;
    font: inherit;
    font-size: 1rem;
    color: var(--em-gray-900);
}

.em-palette-input::placeholder { color: var(--em-gray-400); }

.em-palette-close {
    border: none;
    background: var(--em-gray-100);
    color: var(--em-gray-500);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 0.85rem;
    transition: var(--em-transition);
}

.em-palette-close:hover { background: var(--em-gray-200); color: var(--em-gray-900); }

[data-theme="dark"] .em-palette-close { background: var(--em-surface-3); color: var(--em-text-muted, #96a3bd); }
[data-theme="dark"] .em-palette-close:hover { color: var(--em-text, #edf1f7); }

.em-palette-results { overflow-y: auto; padding: 0.4rem 0.5rem 0.5rem; flex: 1; }

.em-palette-group-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--em-gray-400);
    padding: 0.65rem 0.7rem 0.3rem;
}

.em-palette-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.7rem;
    border-radius: 9px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font: inherit;
    color: var(--em-gray-900);
}

.em-palette-item.active { background: var(--em-info-light); }
.em-palette-item.active .em-palette-item-title { color: var(--em-accent); }

.em-palette-ico {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    background: var(--em-gray-100);
    color: var(--em-gray-500);
}

.em-palette-ico--action { background: var(--em-info-light); color: var(--em-accent); }

.em-palette-ico--member {
    background: var(--em-info-light);
    color: var(--em-accent);
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.72rem;
}

.em-palette-item-body { flex: 1; min-width: 0; }

.em-palette-item-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.em-palette-item-title mark {
    background: var(--em-warning-light);
    color: inherit;
    border-radius: 3px;
    padding: 0 1px;
}

.em-palette-item-sub {
    display: block;
    font-size: 0.75rem;
    color: var(--em-gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.em-palette-item-sub mark { background: var(--em-warning-light); color: inherit; border-radius: 3px; }

.em-palette-item-hint { font-size: 0.72rem; color: var(--em-gray-400); flex: none; }

.em-palette-empty { padding: 2rem 1rem; text-align: center; color: var(--em-gray-400); font-size: 0.875rem; }

.em-palette-loading {
    padding: 0.55rem 0.7rem;
    font-size: 0.82rem;
    color: var(--em-gray-400);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.em-palette-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid var(--em-border, var(--em-gray-200));
    padding: 0.55rem 1rem;
    font-size: 0.72rem;
    color: var(--em-gray-400);
    background: var(--em-surface-2, var(--em-gray-50));
}

.em-palette-footer-keys { display: inline-flex; gap: 0.9rem; }
.em-palette-footer-keys span { display: inline-flex; align-items: center; gap: 0.3rem; }

/* Ctrl+K-chip i headerns sökfält */
.em-v2-header-search-kbd {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    border: none;
    background: none;
    padding: 0 6px;
    cursor: pointer;
}

.em-v2-header-search-kbd kbd {
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    background: var(--em-gray-100);
    border: 1px solid var(--em-gray-300);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0.05rem 0.35rem;
    color: var(--em-gray-500);
}

.em-v2-header-search-kbd:hover kbd { color: var(--em-accent); border-color: var(--em-accent); }

/* Mörkt tema */
[data-theme="dark"] .em-palette {
    background: var(--em-surface-elevated);
    border-color: var(--em-border, rgba(255, 255, 255, 0.08));
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
}
[data-theme="dark"] .em-palette-overlay { background: rgba(2, 6, 16, 0.6); }
[data-theme="dark"] .em-palette kbd,
[data-theme="dark"] .em-v2-header-search-kbd kbd {
    background: var(--em-surface-3);
    border-color: var(--em-border-strong, rgba(255, 255, 255, 0.15));
    color: var(--em-text-muted, #96a3bd);
}
[data-theme="dark"] .em-palette-input { color: var(--em-text, #edf1f7); }
[data-theme="dark"] .em-palette-item { color: var(--em-text, #edf1f7); }
[data-theme="dark"] .em-palette-ico { background: var(--em-surface-3); }
[data-theme="dark"] .em-palette-item-title mark,
[data-theme="dark"] .em-palette-item-sub mark { background: rgba(251, 191, 36, 0.3); }

/* ============================================================
   Medlemslistan (register/members): verktygsrad, chips,
   statusprickar, klickbara rader och mobilkort
   ============================================================ */
.em-mlist-total {
    display: inline-block;
    background: var(--em-info-light);
    color: var(--em-accent);
    font-size: 0.75rem;
    font-weight: 800;
    border-radius: 999px;
    padding: 0.05rem 0.55rem;
    margin-left: 6px;
    font-variant-numeric: tabular-nums;
    vertical-align: middle;
}

.em-mlist-adv-count {
    display: inline-block;
    background: var(--em-accent);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    border-radius: 999px;
    padding: 0.02rem 0.4rem;
    margin-left: 2px;
    font-variant-numeric: tabular-nums;
}

.em-mlist-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--em-gray-200);
}

.em-mlist-chips-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--em-gray-400);
}

.em-mlist-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--em-accent);
    background: var(--em-info-light);
    border: none;
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    cursor: pointer;
    transition: var(--em-transition);
}

.em-mlist-chip i { font-size: 0.7rem; opacity: 0.7; }
.em-mlist-chip:hover { filter: brightness(0.95); }
.em-mlist-chip:hover i { opacity: 1; }

.em-mlist-chip--clear {
    background: none;
    color: var(--em-gray-500);
    text-decoration: underline;
}

.em-mlist-status {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.em-mlist-status--active { background: var(--em-success); box-shadow: 0 0 0 3px var(--em-success-light); }
.em-mlist-status--inactive { background: var(--em-gray-300); }

.em-mlist-row { cursor: pointer; }

.em-mlist-name {
    font-weight: 600;
    color: var(--em-accent);
    text-decoration: none;
}

.em-mlist-name:hover { text-decoration: underline; }

.em-mlist-nr { font-variant-numeric: tabular-nums; white-space: nowrap; }

.em-mlist-refreshing { opacity: 0.55; pointer-events: none; transition: opacity 0.15s ease; }

/* Tomt läge: flex-centrerat i stället för text-align (FA-ikoner som d-block
   i en text-center-tabellcell centreras inte pålitligt) */
.em-mlist-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 3.5rem 1rem;
    width: 100%;
}

.em-mlist-empty i {
    font-size: 2.4rem;
    color: var(--em-gray-300);
}

.em-mlist-empty p {
    margin: 0;
    color: var(--em-gray-500);
    font-size: 0.9rem;
}

[data-theme="dark"] .em-mlist-empty i { color: var(--em-surface-3); }
[data-theme="dark"] .em-mlist-empty p { color: var(--em-text-muted, #96a3bd); }

.em-mlist-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--em-gray-100);
}

.em-mlist-showing {
    font-size: 0.8rem;
    color: var(--em-gray-500);
    font-variant-numeric: tabular-nums;
}

/* Mobilkort */
.em-mlist-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--em-gray-100);
    text-decoration: none;
    color: inherit;
}

.em-mlist-card:last-of-type { border-bottom: none; }
.em-mlist-card:active { background: var(--em-gray-50); }

.em-mlist-card-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--em-info-light);
    color: var(--em-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.em-mlist-card-avatar--inactive { background: var(--em-gray-100); color: var(--em-gray-400); }

.em-mlist-card-body { flex: 1; min-width: 0; line-height: 1.35; }
.em-mlist-card-body b { display: block; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-mlist-card-body > span { font-size: 0.78rem; color: var(--em-gray-500); font-variant-numeric: tabular-nums; }

.em-mlist-card-chevron { color: var(--em-gray-300); font-size: 0.8rem; flex-shrink: 0; }

/* Mörkt tema */
[data-theme="dark"] .em-mlist-chips { border-top-color: var(--em-border, rgba(255, 255, 255, 0.08)); }
[data-theme="dark"] .em-mlist-status--inactive { background: var(--em-gray-300); }
[data-theme="dark"] .em-mlist-pagination { border-top-color: var(--em-border, rgba(255, 255, 255, 0.08)); }
[data-theme="dark"] .em-mlist-card { border-bottom-color: var(--em-border, rgba(255, 255, 255, 0.08)); }
[data-theme="dark"] .em-mlist-card:active { background: var(--em-surface-2); }
[data-theme="dark"] .em-mlist-card-avatar--inactive { background: var(--em-surface-3); color: var(--em-text-muted, #96a3bd); }

/* ============================================================
   Hjälpcentret 2026-08 (/admin/help): avdelningskort, spellista
   och kapitelnavigering
   ============================================================
   Sidorna var tabeller i Bootstrap-kort — funktionellt men platt, och
   utan känsla av att det är ett filmbibliotek. Kategorierna är nu kort
   med ikonmedaljong, och avsnitten en spellista med speltid. */

/* --- Avdelningskort på index --- */
.em-help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--em-spacing-md);
}

.em-help-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: var(--em-spacing-lg);
    background: var(--em-surface);
    border: 1px solid var(--em-border, var(--em-gray-200));
    border-radius: var(--em-radius-lg);
    box-shadow: var(--em-shadow-sm);
    text-decoration: none;
    color: inherit;
    transition: var(--em-transition);
}

.em-help-card:hover,
.em-help-card:focus-visible {
    text-decoration: none;
    color: inherit;
    border-color: var(--em-accent);
    box-shadow: var(--em-shadow-md);
    transform: translateY(-2px);
}

.em-help-card-medallion {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    background: color-mix(in srgb, var(--em-accent) 12%, transparent);
    color: var(--em-accent);
    flex-shrink: 0;
}

/* Avdelningens theme-fält (bg-success/bg-warning m.fl. från Backoffice)
   mappas till våra tokens i stället för Bootstraps kontextfärger. */
.em-help-card-medallion--success { background: color-mix(in srgb, var(--em-success) 14%, transparent); color: var(--em-success); }
.em-help-card-medallion--warning { background: color-mix(in srgb, var(--em-warning) 16%, transparent); color: var(--em-warning); }
.em-help-card-medallion--danger  { background: color-mix(in srgb, var(--em-danger) 14%, transparent);  color: var(--em-danger); }
.em-help-card-medallion--info    { background: color-mix(in srgb, var(--em-info, var(--em-accent)) 14%, transparent); color: var(--em-info, var(--em-accent)); }

.em-help-card-title {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--em-gray-900);
}

.em-help-card-desc {
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--em-gray-500);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.em-help-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: auto;
    padding-top: 0.35rem;
}

/* --- Meta-chip, används på alla tre hjälpsidorna --- */
.em-help-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--em-gray-600);
    background: var(--em-gray-100);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.em-help-chip--video { background: color-mix(in srgb, var(--em-accent) 12%, transparent); color: var(--em-accent); }
.em-help-chip--text  { background: color-mix(in srgb, var(--em-success) 14%, transparent); color: var(--em-success); }
/* Generisk "på"-variant. Grid, kort och chips här används även av
   fordonsinställningarnas översikt — em-help-prefixet är historiskt. */
.em-help-chip--ok    { background: color-mix(in srgb, var(--em-success) 14%, transparent); color: var(--em-success); }

/* --- Rail: nya och uppdaterade avsnitt --- */
.em-help-rail {
    display: flex;
    flex-direction: column;
}

.em-help-rail-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--em-border, var(--em-gray-200));
    text-decoration: none;
    color: inherit;
    transition: var(--em-transition);
}

.em-help-rail-item:last-child { border-bottom: none; }

.em-help-rail-item:hover,
.em-help-rail-item:focus-visible {
    text-decoration: none;
    color: inherit;
    padding-left: 0.3rem;
}

.em-help-rail-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    background: var(--em-gray-100);
    color: var(--em-gray-500);
    flex-shrink: 0;
}

.em-help-rail-body { min-width: 0; flex: 1; }

.em-help-rail-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--em-gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.em-help-rail-meta {
    font-size: 0.75rem;
    color: var(--em-gray-400);
    font-variant-numeric: tabular-nums;
}

/* --- Spellista på kategorisidan --- */
.em-help-section + .em-help-section { margin-top: var(--em-spacing-lg); }

.em-help-section-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.6rem;
}

.em-help-section-number {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    background: color-mix(in srgb, var(--em-accent) 12%, transparent);
    color: var(--em-accent);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.em-help-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    color: var(--em-gray-900);
}

.em-help-lesson {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--em-border, var(--em-gray-200));
    border-radius: var(--em-radius-md);
    background: var(--em-surface);
    text-decoration: none;
    color: inherit;
    transition: var(--em-transition);
}

.em-help-lesson + .em-help-lesson { margin-top: 0.4rem; }

.em-help-lesson:hover,
.em-help-lesson:focus-visible {
    text-decoration: none;
    color: inherit;
    border-color: var(--em-accent);
    background: color-mix(in srgb, var(--em-accent) 4%, var(--em-surface));
}

.em-help-lesson.is-current {
    border-color: var(--em-accent);
    background: color-mix(in srgb, var(--em-accent) 7%, var(--em-surface));
}

.em-help-lesson-play {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    background: color-mix(in srgb, var(--em-accent) 12%, transparent);
    color: var(--em-accent);
    flex-shrink: 0;
}

.em-help-lesson-body { min-width: 0; flex: 1; }

.em-help-lesson-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--em-gray-900);
}

.em-help-lesson-sub {
    font-size: 0.76rem;
    color: var(--em-gray-400);
}

.em-help-lesson-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.em-help-lesson-chevron { color: var(--em-gray-300); font-size: 0.8rem; }
.em-help-lesson:hover .em-help-lesson-chevron { color: var(--em-accent); }

/* --- Kapitelnavigering på filmsidan --- */
.em-help-chapter {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid transparent;
    border-radius: var(--em-radius-md);
    background: transparent;
    text-align: left;
    color: inherit;
    transition: var(--em-transition);
}

.em-help-chapter:hover,
.em-help-chapter:focus-visible {
    border-color: var(--em-accent);
    background: color-mix(in srgb, var(--em-accent) 5%, transparent);
}

.em-help-chapter.is-playing {
    border-color: var(--em-accent);
    background: color-mix(in srgb, var(--em-accent) 9%, transparent);
}

.em-help-chapter-time {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--em-accent);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    min-width: 44px;
}

.em-help-chapter-title {
    font-size: 0.86rem;
    color: var(--em-gray-700);
    min-width: 0;
}

/* --- Nästa avsnitt --- */
.em-help-next {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem;
    border-radius: var(--em-radius-md);
    background: color-mix(in srgb, var(--em-accent) 8%, transparent);
    text-decoration: none;
    color: inherit;
    transition: var(--em-transition);
}

.em-help-next:hover,
.em-help-next:focus-visible {
    text-decoration: none;
    color: inherit;
    background: color-mix(in srgb, var(--em-accent) 14%, transparent);
}

.em-help-next-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--em-accent);
}

.em-help-next-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--em-gray-900);
}

/* Mörkt tema */
[data-theme="dark"] .em-help-chip { background: var(--em-surface-2); color: var(--em-text-muted, #96a3bd); }
[data-theme="dark"] .em-help-rail-icon { background: var(--em-surface-2); color: var(--em-text-muted, #96a3bd); }
[data-theme="dark"] .em-help-rail-item { border-bottom-color: var(--em-border, rgba(255, 255, 255, 0.08)); }
[data-theme="dark"] .em-help-lesson-chevron { color: var(--em-gray-500); }

/* Rörelsekänslighet */
@media (prefers-reduced-motion: reduce) {
    .em-help-card,
    .em-help-rail-item,
    .em-help-lesson,
    .em-help-chapter,
    .em-help-next {
        transition: none;
    }

    .em-help-card:hover,
    .em-help-card:focus-visible { transform: none; }

    .em-help-rail-item:hover,
    .em-help-rail-item:focus-visible { padding-left: 0; }
}

/* ============================================================
   Erbjudanden 2026-08 (/admin/modules/offers): sorterbar lista
   ============================================================
   Listan var en Bootstrap-tabell med en kolumn per fält, vilket dolde
   det som faktiskt skiljer erbjudanden åt: logotypen, rabatten och om
   de syns för medlemmarna. Nu en dragbar radlista med logotyp och chips. */

.em-offer-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.em-offer-row {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-md);
    padding: 0.85rem var(--em-spacing-md);
    background: var(--em-surface);
    border: 1px solid var(--em-border, var(--em-gray-200));
    border-radius: var(--em-radius-lg);
    box-shadow: var(--em-shadow-sm);
    transition: var(--em-transition);
}

.em-offer-row:hover {
    border-color: var(--em-accent);
    box-shadow: var(--em-shadow-md);
}

/* Inaktiva poster tonas ned men förblir läsbara. */
.em-offer-row--inactive { opacity: 0.62; }
.em-offer-row--inactive:hover { opacity: 1; }

.em-offer-row--ghost { opacity: 0.35; }
.em-offer-row--drag { box-shadow: var(--em-shadow-lg, 0 12px 24px rgba(0, 0, 0, 0.16)); }

.em-offer-drag {
    cursor: grab;
    color: var(--em-gray-400);
    padding: 0.35rem;
    border-radius: var(--em-radius-sm);
    flex-shrink: 0;
}
.em-offer-drag:hover { color: var(--em-accent); background: var(--em-gray-100); }
.em-offer-drag:active { cursor: grabbing; }

.em-offer-logo {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--em-gray-100);
    border-radius: var(--em-radius-md);
    color: var(--em-gray-400);
    overflow: hidden;
}

.em-offer-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.em-offer-main { flex: 1; min-width: 0; }

.em-offer-name {
    display: inline-block;
    font-weight: 700;
    color: var(--em-gray-900);
    text-decoration: none;
    letter-spacing: -0.01em;
}
.em-offer-name:hover { color: var(--em-accent); text-decoration: none; }

.em-offer-desc {
    font-size: 0.84rem;
    color: var(--em-gray-500);
    margin: 0.1rem 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.em-offer-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.4rem;
}

.em-offer-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--em-gray-600);
    background: var(--em-gray-100);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    white-space: nowrap;
}

.em-offer-chip--discount { background: color-mix(in srgb, var(--em-danger) 14%, transparent); color: var(--em-danger); }
.em-offer-chip--muted { background: transparent; border: 1px dashed var(--em-gray-300); color: var(--em-gray-500); }

.em-offer-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.em-offer-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--em-radius-md);
    border: 1px solid var(--em-border, var(--em-gray-200));
    background: var(--em-surface);
    color: var(--em-gray-600);
    font-size: 0.85rem;
    text-decoration: none;
    transition: var(--em-transition);
}

.em-offer-btn:hover {
    border-color: var(--em-accent);
    color: var(--em-accent);
    text-decoration: none;
}

.em-offer-btn--danger:hover { border-color: var(--em-danger); color: var(--em-danger); }

/* Nuvarande logotyp i formuläret */
.em-offer-logo-current {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-md);
    padding: 0.75rem;
    background: var(--em-gray-100);
    border-radius: var(--em-radius-md);
    margin-bottom: 0.5rem;
}

.em-offer-logo-current img {
    max-width: 110px;
    max-height: 70px;
    object-fit: contain;
}

/* Synlighetsreglage i formuläret — hela raden är klickbar */
.em-offer-toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--em-border, var(--em-gray-200));
    border-radius: var(--em-radius-md);
    cursor: pointer;
    transition: var(--em-transition);
}

.em-offer-toggle + .em-offer-toggle { margin-top: 0.5rem; }
.em-offer-toggle:hover { border-color: var(--em-accent); }
.em-offer-toggle .form-check-input { margin-top: 0.15rem; flex-shrink: 0; }
.em-offer-toggle-title { display: block; font-weight: 600; color: var(--em-gray-900); }
.em-offer-toggle-help { display: block; font-size: 0.8rem; color: var(--em-gray-500); }

/* Mörkt tema */
[data-theme="dark"] .em-offer-logo { background: var(--em-surface-2); }
[data-theme="dark"] .em-offer-chip { background: var(--em-surface-2); color: var(--em-text-muted, #96a3bd); }
[data-theme="dark"] .em-offer-chip--muted { background: transparent; border-color: var(--em-gray-500); }
[data-theme="dark"] .em-offer-drag:hover { background: var(--em-surface-2); }
[data-theme="dark"] .em-offer-logo-current { background: var(--em-surface-2); }

/* Rörelsekänslighet */
@media (prefers-reduced-motion: reduce) {
    .em-offer-row,
    .em-offer-btn,
    .em-offer-toggle {
        transition: none;
    }
}

/* Smal skärm: logotyp och åtgärder får bryta ner */
@media (max-width: 640px) {
    .em-offer-row {
        flex-wrap: wrap;
        gap: 0.6rem;
    }
    .em-offer-main { flex: 1 1 100%; order: 3; }
    .em-offer-actions { margin-left: auto; }
    .em-offer-desc { white-space: normal; }
}

/* ============================================================
   Fordon 2026-08 (/admin/modules/vehicles + /gallery)
   ============================================================
   Listan var en 13-kolumners tabell där varje teknisk uppgift fick en
   egen kolumn — oläsbar och full av tomma celler. Nu en rad per fordon
   med bild, titel och tekniken som chips. Galleriet var Bootstrap-kort
   med cyanfärgade knappar; nu bildrutor med åtgärder vid hover. */

/* --- Filtrerings-toolbar, delad av listan och galleriet --- */
.em-vfilter {
    background: var(--em-surface);
    border: 1px solid var(--em-border, var(--em-gray-200));
    border-radius: var(--em-radius-lg);
    box-shadow: var(--em-shadow-sm);
    padding: var(--em-spacing-md);
    margin-bottom: var(--em-spacing-lg);
}

.em-vfilter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.em-vfilter-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1 1 130px;
    min-width: 110px;
}

.em-vfilter-field--wide { flex: 2 1 200px; }

.em-vfilter-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--em-gray-500);
}

.em-vfilter-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.em-vfilter-summary {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--em-border, var(--em-gray-200));
    font-size: 0.82rem;
    color: var(--em-gray-500);
    font-variant-numeric: tabular-nums;
}

/* --- Fordonsrader --- */
.em-vlist {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.em-vrow {
    display: flex;
    align-items: center;
    gap: var(--em-spacing-md);
    padding: 0.7rem var(--em-spacing-md);
    background: var(--em-surface);
    border: 1px solid var(--em-border, var(--em-gray-200));
    border-radius: var(--em-radius-lg);
    transition: var(--em-transition);
}

.em-vrow:hover {
    border-color: var(--em-accent);
    box-shadow: var(--em-shadow-sm);
}

/* Fordon vars ägare inte är aktiv medlem. */
.em-vrow--inactive { border-left: 3px solid var(--em-danger); }

.em-vrow-thumb {
    position: relative;
    width: 68px;
    height: 48px;
    flex-shrink: 0;
    border-radius: var(--em-radius-md);
    background: var(--em-gray-100);
    color: var(--em-gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Ikonen ligger alltid kvar under bilden. Saknas filen på disk tar
   onerror bort <img> och ikonen blir synlig i stället för en trasig bild. */
.em-vrow-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.em-vrow-main { flex: 1 1 260px; min-width: 0; }

.em-vrow-title {
    font-weight: 700;
    color: var(--em-gray-900);
    letter-spacing: -0.01em;
}

.em-vrow-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.25rem;
}

.em-vchip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--em-gray-600);
    background: var(--em-gray-100);
    border-radius: 999px;
    padding: 0.12rem 0.5rem;
    white-space: nowrap;
}

.em-vchip--reg {
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    letter-spacing: 0.04em;
    background: color-mix(in srgb, var(--em-accent) 10%, transparent);
    color: var(--em-accent);
}

/* Innehåll bakom inloggning. Egen ton så den skiljer sig från neutrala
   chips utan att skrika som en varning — det är ett tillstånd, inte ett fel. */
.em-vchip--locked {
    background: color-mix(in srgb, var(--em-accent) 12%, transparent);
    color: var(--em-accent);
}

/* Färgprick för region. Färgen kommer ur regionens egen inställning och
   skickas in som custom property i stället för att sättas som style-regel
   direkt — då räcker en enda deklaration här. */
.em-region-dot {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: var(--em-region-color, var(--em-gray-400));
    flex: 0 0 auto;
}

.em-vrow-owner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    text-decoration: none;
    color: var(--em-gray-600);
    font-size: 0.82rem;
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--em-border, var(--em-gray-200));
    transition: var(--em-transition);
}

.em-vrow-owner:hover {
    border-color: var(--em-accent);
    color: var(--em-accent);
    text-decoration: none;
}

.em-vrow-owner-nr {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.em-vrow-owner-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--em-success);
    flex-shrink: 0;
}
.em-vrow-owner-dot--inactive { background: var(--em-danger); }

/* --- Galleri --- */
.em-vgallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: var(--em-spacing-md);
}

.em-vgallery-item {
    position: relative;
    border-radius: var(--em-radius-lg);
    overflow: hidden;
    background: var(--em-gray-100);
    border: 1px solid var(--em-border, var(--em-gray-200));
    transition: var(--em-transition);
}

.em-vgallery-item:hover {
    border-color: var(--em-accent);
    box-shadow: var(--em-shadow-md);
}

.em-vgallery-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    color: var(--em-gray-400);
    font-size: 1.6rem;
}

/* Ikonen ligger under bilden och blir synlig om filen saknas på disk. */
.em-vgallery-fallback { pointer-events: none; }

.em-vgallery-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.em-vgallery-item:hover .em-vgallery-media img { transform: scale(1.04); }

.em-vgallery-body {
    padding: 0.55rem 0.7rem 0.65rem;
    background: var(--em-surface);
}

.em-vgallery-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--em-gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.em-vgallery-sub {
    font-size: 0.75rem;
    color: var(--em-gray-500);
    font-variant-numeric: tabular-nums;
}

/* Åtgärder ligger över bilden och tonas fram vid hover/fokus. */
.em-vgallery-actions {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    display: flex;
    gap: 0.3rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.em-vgallery-item:hover .em-vgallery-actions,
.em-vgallery-item:focus-within .em-vgallery-actions { opacity: 1; }

.em-vgallery-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: 0.78rem;
    text-decoration: none;
    backdrop-filter: blur(4px);
}

.em-vgallery-btn:hover { background: var(--em-accent); color: #fff; }

/* Mörkt tema */
[data-theme="dark"] .em-vchip { background: var(--em-surface-2); color: var(--em-text-muted, #96a3bd); }
[data-theme="dark"] .em-vrow-thumb { background: var(--em-surface-2); }
[data-theme="dark"] .em-vgallery-item { background: var(--em-surface-2); }

/* Rörelsekänslighet */
@media (prefers-reduced-motion: reduce) {
    .em-vrow,
    .em-vrow-owner,
    .em-vgallery-item,
    .em-vgallery-media img,
    .em-vgallery-actions {
        transition: none;
    }
    .em-vgallery-item:hover .em-vgallery-media img { transform: none; }
}

/* Smal skärm */
@media (max-width: 767.98px) {
    .em-vrow { flex-wrap: wrap; }
    .em-vrow-main { flex: 1 1 100%; order: 3; }
    .em-vrow-owner { margin-left: auto; }
    .em-vgallery-actions { opacity: 1; }
}

/* ============================================================
   Omröstningar 2026-08 (/admin/polls)
   ============================================================
   Korten låg i kort som låg i kort, med bg-{färg} bg-opacity-10 på
   sektionsrubrikerna och fyra olikfärgade Bootstrap-ikonknappar per kort.
   Nu en grupprubrik utan låda, kort med statuschip och neutrala åtgärder. */

.em-poll-group { margin-bottom: var(--em-spacing-xl); }

.em-poll-group-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

.em-poll-group-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.em-poll-group-dot--active  { background: var(--em-success); box-shadow: 0 0 0 3px var(--em-success-light); }
.em-poll-group-dot--stopped { background: var(--em-warning); }
.em-poll-group-dot--draft   { background: var(--em-gray-300); }
.em-poll-group-dot--ended   { background: var(--em-gray-500); }

.em-poll-group-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--em-gray-900);
}

.em-poll-group-count {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--em-gray-500);
    background: var(--em-gray-100);
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    font-variant-numeric: tabular-nums;
}

.em-poll-group-desc {
    font-size: 0.8rem;
    color: var(--em-gray-400);
    margin: 0 0 0 auto;
}

.em-poll-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--em-spacing-md);
}

.em-poll-card {
    display: flex;
    flex-direction: column;
    background: var(--em-surface);
    border: 1px solid var(--em-border, var(--em-gray-200));
    border-radius: var(--em-radius-lg);
    box-shadow: var(--em-shadow-sm);
    padding: var(--em-spacing-md);
    transition: var(--em-transition);
}

.em-poll-card:hover {
    border-color: var(--em-accent);
    box-shadow: var(--em-shadow-md);
}

.em-poll-card-question {
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--em-gray-900);
    text-decoration: none;
    display: block;
}

.em-poll-card-question:hover { color: var(--em-accent); text-decoration: none; }

.em-poll-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.em-poll-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0.85rem 0;
    font-size: 0.82rem;
    color: var(--em-gray-500);
    flex: 1;
}

.em-poll-card-meta span { display: flex; align-items: center; gap: 0.45rem; }
.em-poll-card-meta i { width: 14px; text-align: center; color: var(--em-gray-400); flex-shrink: 0; }

.em-poll-card-actions {
    display: flex;
    gap: 0.35rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--em-border, var(--em-gray-200));
}

.em-poll-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    height: 34px;
    padding: 0 0.7rem;
    border-radius: var(--em-radius-md);
    border: 1px solid var(--em-border, var(--em-gray-200));
    background: var(--em-surface);
    color: var(--em-gray-600);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--em-transition);
}

.em-poll-btn:hover {
    border-color: var(--em-accent);
    color: var(--em-accent);
    text-decoration: none;
}

.em-poll-btn--primary {
    flex: 1;
    background: var(--em-accent);
    border-color: var(--em-accent);
    color: #fff;
}

.em-poll-btn--primary:hover { color: #fff; filter: brightness(0.94); }
.em-poll-btn--danger:hover { border-color: var(--em-danger); color: var(--em-danger); }

/* Statuschip — samma skala som ovriga listor */
.em-poll-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.12rem 0.55rem;
    background: var(--em-gray-100);
    color: var(--em-gray-600);
    white-space: nowrap;
}

.em-poll-chip--active  { background: color-mix(in srgb, var(--em-success) 14%, transparent); color: var(--em-success); }
.em-poll-chip--stopped { background: color-mix(in srgb, var(--em-warning) 16%, transparent); color: var(--em-warning); }
.em-poll-chip--ended   { background: var(--em-gray-100); color: var(--em-gray-600); }
.em-poll-chip--hidden  { background: transparent; border: 1px dashed var(--em-gray-300); color: var(--em-gray-500); }

/* Omslagsminiatyr i tidningslistan (/admin/modules/magazine).
   Ikonen ligger under bilden, som i fordonslistan, sa saknade filer inte
   blir en trasig bildruta. */
.em-mag-cover {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 64px;
    border-radius: var(--em-radius-sm);
    background: var(--em-gray-100);
    color: var(--em-gray-400);
    overflow: hidden;
}

.em-mag-cover img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

[data-theme="dark"] .em-mag-cover { background: var(--em-surface-2); }

/* Svarsalternativ i formuläret */
.em-poll-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.em-poll-options .option-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.em-poll-options .option-item .form-control { flex: 1; }

/* Bildbaserad-reglaget — hela raden klickbar, som i erbjudandeformuläret */
.em-poll-toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--em-border, var(--em-gray-200));
    border-radius: var(--em-radius-md);
    cursor: pointer;
    transition: var(--em-transition);
}

.em-poll-toggle:hover { border-color: var(--em-accent); }
.em-poll-toggle .form-check-input { margin-top: 0.15rem; flex-shrink: 0; }
.em-poll-toggle-title { display: block; font-weight: 600; color: var(--em-gray-900); }
.em-poll-toggle-help { display: block; font-size: 0.8rem; color: var(--em-gray-500); }

/* Resultatrader på visningssidan */
.em-poll-result + .em-poll-result {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--em-border, var(--em-gray-200));
}

.em-poll-result-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.em-poll-result-label { font-weight: 600; color: var(--em-gray-900); }

.em-poll-result-value {
    font-size: 0.82rem;
    color: var(--em-gray-500);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.em-poll-result-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--em-gray-100);
    overflow: hidden;
}

.em-poll-result-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--em-accent);
    transition: width 0.4s ease;
}

/* Vinnaren markeras — annars far man jamfora procenttal sjalv. */
.em-poll-result--top .em-poll-result-fill { background: var(--em-success); }
.em-poll-result--top .em-poll-result-label { color: var(--em-success); }

.em-poll-result-image {
    max-height: 160px;
    border-radius: var(--em-radius-md);
    object-fit: contain;
    margin-bottom: 0.5rem;
}

/* Mörkt tema */
[data-theme="dark"] .em-poll-group-count,
[data-theme="dark"] .em-poll-chip,
[data-theme="dark"] .em-poll-result-bar { background: var(--em-surface-2); }
[data-theme="dark"] .em-poll-chip { color: var(--em-text-muted, #96a3bd); }
[data-theme="dark"] .em-poll-chip--hidden { background: transparent; border-color: var(--em-gray-500); }

/* Rörelsekänslighet */
@media (prefers-reduced-motion: reduce) {
    .em-poll-card,
    .em-poll-btn,
    .em-poll-result-fill {
        transition: none;
    }
}

/* ============================================================
   Statistik — verktygsrad ovanför ett diagram: vylägen till
   vänster, periodfilter till höger. Generisk, tänkt att
   återanvändas av fler diagramsidor än medlemsantalet.
   ============================================================ */
.em-chart-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.em-chart-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Segmenterad kontroll — skiljer sig medvetet från em-bookings-tabs,
   som redan ligger som sidflikar strax ovanför. */
.em-chart-modes {
    display: inline-flex;
    padding: 3px;
    background: var(--em-gray-100, #f3f4f6);
    border: 1px solid var(--em-border);
    border-radius: 999px;
}

.em-chart-mode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--em-text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--em-transition, 0.15s), color var(--em-transition, 0.15s), box-shadow var(--em-transition, 0.15s);
}

.em-chart-mode i {
    font-size: 0.78rem;
    opacity: 0.75;
}

.em-chart-mode:hover {
    color: var(--em-text);
}

.em-chart-mode--active {
    background: var(--em-surface, #fff);
    color: var(--em-accent);
    font-weight: 600;
    box-shadow: var(--em-shadow-sm, 0 1px 2px rgba(16, 24, 40, 0.08));
}

.em-chart-mode--active i {
    opacity: 1;
}

.em-chart-mode:focus-visible {
    outline: 2px solid var(--em-accent);
    outline-offset: 2px;
}

.em-chart-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.em-chart-filter-label {
    margin: 0;
    color: var(--em-text-muted);
    font-size: 0.82rem;
    font-weight: 500;
}

.em-chart-filter .form-select {
    width: auto;
    min-width: 92px;
}

[data-theme="dark"] .em-chart-modes {
    background: var(--em-gray-800, #1b2333);
    border-color: var(--em-border);
}

[data-theme="dark"] .em-chart-mode--active {
    background: var(--em-surface, #232c3d);
    box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
    .em-chart-mode { transition: none; }
}

@media (max-width: 640px) {
    .em-chart-toolbar-controls {
        width: 100%;
        justify-content: space-between;
    }

    .em-chart-modes { flex: 1 1 auto; }
    .em-chart-mode { flex: 1 1 0; justify-content: center; padding: 6px 8px; }
}

/* ============================================================
   Mobilanpassning av 2026-komponenterna (skrivbord, palett,
   versionslogg, sidhuvud, puls, åtgärdsrader).
   Ligger SIST i filen så mobilreglerna vinner kaskaden.
   ============================================================ */
@media (max-width: 640px) {
    /* Kommandopaletten: near-fullscreen med tangentbordssäker höjd */
    .em-palette-overlay {
        padding: 8px;
        align-items: stretch;
    }

    .em-palette {
        max-width: none;
        max-height: calc(100dvh - 16px);
        border-radius: 12px;
    }

    /* Dölj tangentbordstipsen på touch — behörighetstexten räcker */
    .em-palette-footer-keys { display: none; }

    /* Kräver åtgärd + notisrader: låt CTA:n radbrytas snyggt under texten */
    .em-action-center-row,
    .em-v2-alert-row {
        flex-wrap: wrap;
    }

    .em-action-center-cta,
    .em-v2-alert-cta {
        margin-left: 42px; /* linjera med texten (ikonbredd + gap) */
    }

    /* Föreningsårets puls: rader får radbrytas */
    .em-pulse-item { flex-wrap: wrap; }
    .em-pulse-item-cta { margin-left: 38px; }

    /* Sidhuvudet: mindre titel, actions under */
    .em-page-header { align-items: flex-start; flex-direction: column; }
    .em-page-header-title { font-size: 1.3rem; }

    /* Versionsloggen: tightare tidslinje och scrollbara typ-chips */
    .em-vlog-timeline { padding-left: 36px; }
    .em-vlog-dot { left: -36px; width: 26px; height: 26px; font-size: 0.7rem; }
    .em-vlog-timeline::before { left: 12px; }
    .em-vlog-card { padding: 0.8rem 0.9rem; }
    .em-vlog-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        max-width: 100%;
        padding-bottom: 2px;
    }
    .em-vlog-chips::-webkit-scrollbar { display: none; }
    .em-vlog-toolbar { padding: 0.65rem 0.75rem; }

    /* Hero-raden på skrivbordet: hälsning + åtgärder i egen rad */
    .em-dashboard-header-actions { width: 100%; }
}

/* iOS zoomar in på inputs med mindre än 16px text — säkra sökfälten */
@media (max-width: 767.98px) {
    .em-palette-input,
    .em-vlog-search .form-control,
    .em-v2-header-search-input {
        font-size: 16px;
    }
}
