/* CSS Variables für konsistentes Cyberpunk Design */
:root {
    /* Z-Index System - Organized by layer */
    --z-base: 0;
    --z-dropdown: 10;
    --z-sticky: 100;
    --z-fixed: 500;
    --z-modal-backdrop: 1000;
    --z-modal: 1001;
    --z-toast: 9999;
    --z-turbo-bar: 999999;

    /* Cyberpunk Fairy Theme Colors - From Logo */
    --color-primary: #0f172a;
    --color-primary-light: #1e293b;
    --color-secondary: #06b6d4;       /* Vibrant Cyan - Cyberpunk Fairy signature */
    --color-secondary-hover: #0891b2;
    --color-accent-pink: #ec4899;     /* Vibrant Pink - Fairy magic glow */
    --color-accent-purple: #8b5cf6;   /* Vibrant Purple - Mystical aura */
    --color-success: #10b981;         /* Emerald - Positive fairy dust */
    --color-warning: #f59e0b;         /* Amber - Caution sparkles */
    --color-danger: #ef4444;          /* Red - Alert flames */
    --color-info: #06b6d4;            /* Cyan - Info glow */

    /* Text Colors - Improved contrast for WCAG AA compliance */
    --color-text: #1e293b;
    --color-text-light: #64748b;
    --color-text-muted: #64748b;  /* Changed from #94a3b8 for better contrast (6.4:1) */
    --color-text-secondary: #64748b;  /* Alias for --text-secondary compatibility */

    /* Semantic Light Variants for Status Backgrounds */
    --color-success-light: rgba(16, 185, 129, 0.15);   /* Emerald subtle bg */
    --color-warning-light: rgba(245, 158, 11, 0.15);   /* Amber subtle bg */
    --color-danger-light: rgba(239, 68, 68, 0.15);     /* Red subtle bg */
    --color-info-light: rgba(6, 182, 212, 0.15);       /* Cyan subtle bg */

    /* Background Colors */
    --color-bg: #f8fafc;
    --color-bg-alt: #f1f5f9;
    --color-white: #ffffff;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;

    /* Background Variables (used by components) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;

    /* Bootstrap Variables Override - Light Mode */
    --bs-body-bg: #ffffff;
    --bs-body-color: #1e293b;
    --bs-tertiary-bg: #f8fafc;
    --bs-secondary-bg: #f1f5f9;

    /* Text Variables (used by components) */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Border Variables (used by components) */
    --border-color: #e2e8f0;
    --border-color-light: #f1f5f9;

    /* Neon Glow Colors */
    --glow-cyan: 0 0 10px rgba(6, 182, 212, 0.3), 0 0 20px rgba(6, 182, 212, 0.2);
    --glow-pink: 0 0 10px rgba(236, 72, 153, 0.3), 0 0 20px rgba(236, 72, 153, 0.2);
    --glow-purple: 0 0 10px rgba(139, 92, 246, 0.3), 0 0 20px rgba(139, 92, 246, 0.2);
    --glow-green: 0 0 10px rgba(16, 185, 129, 0.3), 0 0 20px rgba(16, 185, 129, 0.2);

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

    /* Border Radius */
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;

    /* Shadows - Enhanced for Cyberpunk */
    --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 8px rgba(15, 23, 42, 0.12);
    --shadow-lg: 0 8px 16px rgba(15, 23, 42, 0.16);
    --shadow-neon: 0 0 15px rgba(6, 182, 212, 0.4);
    --shadow-neon-pink: 0 0 15px rgba(236, 72, 153, 0.4);

    /* Gradients - Cyberpunk Fairy Theme */
    --gradient-primary: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-info: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    --gradient-purple: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);  /* Mystical purple aura */
    --gradient-pink: linear-gradient(135deg, #ec4899 0%, #db2777 100%);    /* Fairy magic glow */

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* Reset und Basis */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global Keyboard Focus Indicators - WCAG 2.1 AA Compliant */
/* Focus-visible only shows when keyboard navigating, not on mouse clicks */
*:focus-visible {
    outline: 3px solid var(--color-secondary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Remove outline for mouse users */
*:focus:not(:focus-visible) {
    outline: none;
}

/* High contrast focus for dark mode */
[data-theme="dark"] *:focus-visible {
    outline-color: #22d3ee;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.4);
}

/* Specific focus styles for buttons */
.btn:focus-visible,
button:focus-visible {
    outline: 3px solid var(--color-accent-pink);
    outline-offset: 3px;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.3);
}

[data-theme="dark"] .btn:focus-visible,
[data-theme="dark"] button:focus-visible {
    outline-color: #f472b6;
    box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.4);
}

/* Enhanced focus for form inputs to override default */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--color-secondary) !important;
    outline-offset: 2px;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2), var(--glow-cyan);
}

[data-theme="dark"] input:focus-visible,
[data-theme="dark"] select:focus-visible,
[data-theme="dark"] textarea:focus-visible {
    outline-color: #22d3ee !important;
    border-color: #22d3ee;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.4);
}

/* Link focus indicators */
a:focus-visible {
    outline: 3px solid var(--color-secondary);
    outline-offset: 2px;
    text-decoration: underline;
    text-decoration-color: var(--color-secondary);
    text-decoration-thickness: 2px;
}

[data-theme="dark"] a:focus-visible {
    outline-color: #22d3ee;
    text-decoration-color: #22d3ee;
}

/* Focus for custom checkbox/radio inputs */
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: 3px solid var(--color-secondary);
    outline-offset: 3px;
}

[data-theme="dark"] input[type="checkbox"]:focus-visible,
[data-theme="dark"] input[type="radio"]:focus-visible {
    outline-color: #22d3ee;
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    font-size: 16px;
}

/* Skip Links for Accessibility - WCAG 2.4.1 */
.skip-link {
    position: absolute;
    top: -50px;
    left: 0;
    background: #1e40af; /* High contrast blue - WCAG AAA compliant */
    color: #ffffff;
    padding: var(--spacing-sm) var(--spacing-lg);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 0 0 8px 0;
    z-index: calc(var(--z-turbo-bar) + 10);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: top 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    opacity: 0;
    pointer-events: none;
}

.skip-link:focus,
.skip-link:focus-visible {
    top: 0;
    opacity: 1;
    pointer-events: auto;
    outline: 4px solid #fbbf24; /* Gold outline for high visibility */
    outline-offset: 2px;
    box-shadow: 0 6px 20px rgba(30, 64, 175, 0.5),
                0 0 0 4px rgba(251, 191, 36, 0.3);
}

.skip-link:hover {
    background: #1e3a8a; /* Darker blue on hover */
    box-shadow: 0 6px 20px rgba(30, 64, 175, 0.6);
}

/* Dark mode support for skip links */
[data-theme="dark"] .skip-link {
    background: #3b82f6; /* Lighter blue for dark mode */
    color: #000000; /* Black text for better contrast */
}

[data-theme="dark"] .skip-link:focus,
[data-theme="dark"] .skip-link:focus-visible {
    outline-color: #fbbf24;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6),
                0 0 0 4px rgba(251, 191, 36, 0.3);
}

[data-theme="dark"] .skip-link:hover {
    background: var(--color-primary, #60a5fa);
}

/* Header - Cyberpunk Style with Dark Mode Support */
.header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 1rem var(--spacing-lg);
    min-height: 80px;
    box-shadow: var(--shadow-md), 0 1px 0 var(--color-secondary);
    border-bottom: 2px solid var(--color-secondary);
    position: relative; /* Create stacking context */
    z-index: 100; /* Explicitly below mega menu panel (99999) */
    display: flex;
    align-items: center;
}

/* Header sticky only on desktop (matches nav behavior) */
@media (min-width: 768px) {
    .header {
        position: sticky;
        top: 0;
        z-index: 100; /* Keep same z-index when sticky */
    }
}

[data-theme="dark"] .header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-bottom-color: var(--border-color);
}

.header img[alt*="Logo"] {
    filter: drop-shadow(var(--glow-cyan));
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.header img[alt*="Logo"]:hover {
    filter: drop-shadow(0 0 25px rgba(6, 182, 212, 0.8))
            drop-shadow(0 0 15px rgba(236, 72, 153, 0.4))
            drop-shadow(0 0 10px rgba(139, 92, 246, 0.3));
    transform: scale(1.08) rotate(2deg);
    animation: fairy-sparkle 2s ease-in-out infinite;
}

/* ============================================
   Cyberpunk Fairy - Automation Magic Effects
   Subtle, professional with a wink 😉
   ============================================ */

/* Container glow - subtle shimmer effect */
.fairy-magic-glow {
    position: relative;
    box-shadow:
        inset 0 0 0 1px rgba(236, 72, 153, 0.2),
        0 0 20px rgba(236, 72, 153, 0.15);
    border-radius: var(--border-radius, 8px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.fairy-magic-glow::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(
        135deg,
        transparent 40%,
        rgba(236, 72, 153, 0.1) 50%,
        transparent 60%
    );
    background-size: 200% 200%;
    animation: fairy-shimmer 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.fairy-magic-glow:hover {
    box-shadow:
        inset 0 0 0 1px rgba(236, 72, 153, 0.3),
        0 0 30px rgba(236, 72, 153, 0.25),
        0 0 10px rgba(6, 182, 212, 0.15);
    transform: translateY(-1px);
}

/* Icon sparkle - elegant pulse, not hyperactive */
.fairy-icon-sparkle {
    color: var(--color-accent-pink);
    display: inline-block;
    animation: fairy-pulse 2.5s ease-in-out infinite;
}

.fairy-icon-sparkle::after {
    content: " ✨";
    font-size: 0.7em;
    opacity: 0.8;
}

/* Badge - refined, not too flashy */
.fairy-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: linear-gradient(135deg,
        rgba(236, 72, 153, 0.9) 0%,
        rgba(139, 92, 246, 0.85) 100%);
    color: white;
    border-radius: 100px;
    padding: 0.25rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(236, 72, 153, 0.25);
    border: none;
    transition: all 0.2s ease;
}

.fairy-badge:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.35);
}

.fairy-badge::before {
    content: "✦";
    font-size: 0.9em;
}

/* Automatic field indicator - subtle left border accent */
.fairy-field-automatic {
    position: relative;
    border-left: 3px solid var(--color-accent-pink) !important;
    background: linear-gradient(
        90deg,
        rgba(236, 72, 153, 0.04) 0%,
        transparent 30%
    ) !important;
    transition: all 0.2s ease;
}

.fairy-field-automatic:focus {
    border-left-color: var(--color-accent-purple) !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

/* Helper text for automatic fields */
.fairy-helper {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--color-accent-pink);
    margin-top: 0.25rem;
    opacity: 0.85;
}

.fairy-helper::before {
    content: "✦";
    font-size: 0.65rem;
}

/* Tooltip for magic explanation - used for auto-filled fields */
.fairy-tooltip {
    position: relative;
    cursor: help;
    display: inline-flex;
    align-items: center;
    color: var(--color-accent-pink);
    transition: color 0.2s ease;
}

.fairy-tooltip:hover {
    color: var(--color-accent-purple);
}

.fairy-tooltip::after {
    content: "✦ " attr(data-fairy-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
    padding: 0.5rem 0.75rem;
    padding-top: 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    max-width: 280px;
    white-space: normal;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(236, 72, 153, 0.2);
    z-index: 100;
}

/* Pink accent line at top */
.fairy-tooltip::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    width: 60%;
    max-width: 100px;
    height: 2px;
    transform: translateX(-50%);
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--color-accent-pink) 20%,
        var(--color-accent-purple) 80%,
        transparent 100%
    );
    border-radius: 1px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

/* Arrow (separate element needed) */
.fairy-tooltip-arrow {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
}

.fairy-tooltip:hover::after,
.fairy-tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Dark mode enhancement */
[data-theme="dark"] .fairy-tooltip::after {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(236, 72, 153, 0.3);
}

/* Bootstrap Tooltip - Subtle fairy shimmer on appear */
.tooltip.show .tooltip-inner {
    animation: fairy-tooltip-appear 0.6s ease-out;
}

@keyframes fairy-tooltip-appear {
    0% {
        box-shadow: 0 0 12px rgba(236, 72, 153, 0.4);
    }
    100% {
        box-shadow: none;
    }
}

/* Reduced motion - no shimmer */
@media (prefers-reduced-motion: reduce) {
    .tooltip.show .tooltip-inner {
        animation: none;
    }
}

/* 12. Audit Log - Fresh entries glow */
.fairy-fresh-entry {
    animation: fairy-fresh-appear 2s ease-out;
}

@keyframes fairy-fresh-appear {
    0% {
        background-color: rgba(236, 72, 153, 0.12);
        box-shadow: inset 0 0 20px rgba(236, 72, 153, 0.1);
    }
    100% {
        background-color: transparent;
        box-shadow: none;
    }
}

/* Timestamp sparkle for very fresh entries (< 5 min) */
.fairy-timestamp-fresh {
    position: relative;
    color: var(--color-accent-pink);
}

.fairy-timestamp-fresh::after {
    content: "✦";
    position: absolute;
    top: -2px;
    right: -12px;
    font-size: 0.6rem;
    color: var(--color-accent-pink);
    animation: fairy-sparkle 2s ease-in-out infinite;
}

/* Slightly stale but still recent (5-30 min) */
.fairy-timestamp-recent {
    position: relative;
}

.fairy-timestamp-recent::after {
    content: "·";
    position: absolute;
    top: 0;
    right: -8px;
    font-size: 0.8rem;
    color: var(--color-accent-pink);
    opacity: 0.5;
}

@media (prefers-reduced-motion: reduce) {
    .fairy-fresh-entry {
        animation: none;
        background-color: rgba(236, 72, 153, 0.05);
    }
    .fairy-timestamp-fresh::after {
        animation: none;
    }
}

/* 13. Session Timeout - Gentle reminder glow */
.fairy-session-warning {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.5s ease;
    box-shadow: inset 0 0 100px rgba(236, 72, 153, 0);
}

.fairy-session-warning-active {
    opacity: 1;
    animation: fairy-session-pulse 4s ease-in-out infinite;
}

@keyframes fairy-session-pulse {
    0%, 100% {
        box-shadow: inset 0 0 60px rgba(236, 72, 153, 0.08);
    }
    50% {
        box-shadow: inset 0 0 100px rgba(236, 72, 153, 0.15);
    }
}

.fairy-session-warning-fade {
    opacity: 0;
    animation: none;
}

/* Alert/Notification with fairy touch */
.fairy-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(
        135deg,
        rgba(236, 72, 153, 0.08) 0%,
        rgba(139, 92, 246, 0.05) 100%
    );
    border: 1px solid rgba(236, 72, 153, 0.2);
    border-radius: var(--border-radius, 8px);
    color: var(--color-text);
}

.fairy-alert-icon {
    font-size: 1.25rem;
    color: var(--color-accent-pink);
    animation: fairy-pulse 2.5s ease-in-out infinite;
}

.fairy-alert-content {
    flex: 1;
}

.fairy-alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--color-accent-pink);
}

/* Dark Mode - Enhanced visibility */
[data-theme="dark"] .fairy-field-automatic {
    background: linear-gradient(
        90deg,
        rgba(236, 72, 153, 0.08) 0%,
        transparent 30%
    ) !important;
}

[data-theme="dark"] .fairy-magic-glow {
    box-shadow:
        inset 0 0 0 1px rgba(236, 72, 153, 0.25),
        0 0 25px rgba(236, 72, 153, 0.2);
}

[data-theme="dark"] .fairy-alert {
    background: linear-gradient(
        135deg,
        rgba(236, 72, 153, 0.12) 0%,
        rgba(139, 92, 246, 0.08) 100%
    );
    border-color: rgba(236, 72, 153, 0.3);
}

/* Animations - Smooth and subtle */
@keyframes fairy-shimmer {
    0% { background-position: 200% 200%; }
    100% { background-position: -200% -200%; }
}

@keyframes fairy-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

@keyframes fairy-sparkle {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(236, 72, 153, 0.6));
        opacity: 1;
    }
    50% {
        filter: drop-shadow(0 0 12px rgba(236, 72, 153, 0.8))
                drop-shadow(0 0 4px rgba(6, 182, 212, 0.4));
        opacity: 0.85;
    }
}

/* Reduced motion - Respect user preferences */
@media (prefers-reduced-motion: reduce) {
    .fairy-magic-glow::before,
    .fairy-icon-sparkle,
    .fairy-alert-icon {
        animation: none;
    }
}

/* ============================================
   Fairy Magic - Contextual Patterns
   For specific use cases in the application
   ============================================ */

/* 1. Smart Insights - Suggestion indicator */
.fairy-suggestion {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: linear-gradient(
        135deg,
        rgba(236, 72, 153, 0.08) 0%,
        rgba(6, 182, 212, 0.05) 100%
    );
    border: 1px dashed rgba(236, 72, 153, 0.3);
    border-radius: var(--border-radius, 8px);
    font-size: 0.8125rem;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.fairy-suggestion:hover {
    background: linear-gradient(
        135deg,
        rgba(236, 72, 153, 0.12) 0%,
        rgba(6, 182, 212, 0.08) 100%
    );
    border-color: rgba(236, 72, 153, 0.5);
    transform: translateY(-1px);
}

.fairy-suggestion-icon {
    color: var(--color-accent-pink);
    animation: fairy-pulse 2.5s ease-in-out infinite;
}

.fairy-suggestion-text {
    flex: 1;
}

.fairy-suggestion-action {
    color: var(--color-accent-pink);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* 2. Workflow Magic - Auto-transition effect */
.fairy-workflow-magic {
    position: relative;
    overflow: hidden;
}

.fairy-workflow-magic::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(236, 72, 153, 0.2),
        rgba(6, 182, 212, 0.2),
        transparent
    );
    animation: fairy-workflow-sweep 1.5s ease-out forwards;
}

@keyframes fairy-workflow-sweep {
    0% { left: -100%; }
    100% { left: 100%; }
}

.fairy-workflow-complete {
    animation: fairy-workflow-pulse 0.6s ease-out;
}

@keyframes fairy-workflow-pulse {
    0% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(236, 72, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0); }
}

/* 3. Bulk Actions - Completion feedback */
.fairy-bulk-complete {
    animation: fairy-bulk-flash 0.8s ease-out;
}

@keyframes fairy-bulk-flash {
    0% { background-color: rgba(236, 72, 153, 0.15); }
    100% { background-color: transparent; }
}

.fairy-bulk-bar {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 0%,
        rgba(236, 72, 153, 0.1) 50%,
        var(--bg-secondary) 100%
    );
    border: 1px solid rgba(236, 72, 153, 0.2);
}

.fairy-bulk-action {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: var(--gradient-pink);
    color: white;
    border: none;
    border-radius: 100px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fairy-bulk-action:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

.fairy-bulk-action::before {
    content: "✦";
    font-size: 0.9em;
}

/* 4. Search/Command Palette - Priority highlighting */
.fairy-search-priority {
    position: relative;
    border-left: 2px solid var(--color-accent-pink);
    background: linear-gradient(
        90deg,
        rgba(236, 72, 153, 0.06) 0%,
        transparent 50%
    );
}

.fairy-search-priority::after {
    content: "✦ Priorisiert";
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    color: var(--color-accent-pink);
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* 5. Onboarding - Guided highlights */
.fairy-onboarding-highlight {
    position: relative;
    z-index: 10;
    animation: fairy-onboarding-glow 2s ease-in-out infinite;
}

@keyframes fairy-onboarding-glow {
    0%, 100% {
        box-shadow:
            0 0 0 4px rgba(236, 72, 153, 0.2),
            0 0 20px rgba(236, 72, 153, 0.15);
    }
    50% {
        box-shadow:
            0 0 0 6px rgba(236, 72, 153, 0.3),
            0 0 30px rgba(236, 72, 153, 0.2);
    }
}

.fairy-onboarding-step {
    position: absolute;
    bottom: -2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--color-accent-pink);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 100px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.fairy-onboarding-step::before {
    content: "✦";
}

/* 6. Auto-Correct - Field correction feedback */
.fairy-auto-correct {
    animation: fairy-correct-flash 0.5s ease-out;
}

@keyframes fairy-correct-flash {
    0% {
        background-color: rgba(236, 72, 153, 0.15);
        border-color: var(--color-accent-pink);
    }
    100% {
        background-color: transparent;
    }
}

.fairy-corrected-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    color: var(--color-accent-pink);
    margin-left: 0.5rem;
    opacity: 0;
    animation: fairy-fade-in 0.3s ease-out forwards;
}

@keyframes fairy-fade-in {
    0% { opacity: 0; transform: translateY(-5px); }
    100% { opacity: 0.85; transform: translateY(0); }
}

.fairy-corrected-indicator::before {
    content: "✦";
    font-size: 0.6rem;
}

/* Dark Mode - Contextual patterns */
[data-theme="dark"] .fairy-suggestion {
    background: linear-gradient(
        135deg,
        rgba(236, 72, 153, 0.12) 0%,
        rgba(6, 182, 212, 0.08) 100%
    );
}

[data-theme="dark"] .fairy-search-priority {
    background: linear-gradient(
        90deg,
        rgba(236, 72, 153, 0.1) 0%,
        transparent 50%
    );
}

[data-theme="dark"] .fairy-bulk-bar {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 0%,
        rgba(236, 72, 153, 0.15) 50%,
        var(--bg-tertiary) 100%
    );
}

/* 7. Empty States - Ghost-Writer Fee */
/* Applied to existing .empty-state component for subtle magic */
.empty-state {
    position: relative;
}

.empty-state::before {
    content: "\2726"; /* ✦ Unicode star */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    opacity: 0.035;
    color: var(--color-accent-pink);
    pointer-events: none;
    z-index: 0;
}

.empty-state-icon,
.empty-state .empty-state-icon {
    position: relative;
    z-index: 1;
}

.empty-state-icon i {
    color: var(--color-text-muted);
    opacity: 0.5;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.empty-state:hover .empty-state-icon i {
    color: var(--color-accent-pink);
    opacity: 0.7;
}

.empty-state-title {
    position: relative;
    z-index: 1;
}

.empty-state-description {
    position: relative;
    z-index: 1;
}

/* Explicit fairy class for more prominent styling */
.fairy-empty-state {
    position: relative;
    text-align: center;
    padding: 3rem 2rem;
    color: var(--color-text-muted);
}

.fairy-empty-state::before {
    opacity: 0.05;
}

/* 8. Filter Hint - Smart Reset Nudge */
.fairy-filter-hint {
    animation: fairy-filter-pulse 2s ease-in-out infinite;
}

@keyframes fairy-filter-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(236, 72, 153, 0);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(236, 72, 153, 0.15);
    }
}

.fairy-filter-hint::after {
    content: "✦";
    margin-left: 0.375rem;
    font-size: 0.8em;
    color: var(--color-accent-pink);
    animation: fairy-sparkle 1.5s ease-in-out infinite;
}

@keyframes fairy-sparkle {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* 9. Upload Success - Glow-up Animation */
.fairy-upload-success {
    animation: fairy-upload-glow 2.5s ease-out forwards;
}

@keyframes fairy-upload-glow {
    0% {
        background-color: rgba(236, 72, 153, 0.15);
        box-shadow: 0 0 20px rgba(236, 72, 153, 0.2);
    }
    70% {
        background-color: rgba(236, 72, 153, 0.08);
        box-shadow: 0 0 10px rgba(236, 72, 153, 0.1);
    }
    100% {
        background-color: transparent;
        box-shadow: none;
    }
}

/* 10. Transition Success - One-time magic flash */
.fairy-transition-success {
    animation: fairy-magic-sweep 0.8s ease-out forwards;
}

@keyframes fairy-magic-sweep {
    0% {
        background: linear-gradient(
            90deg,
            transparent 0%,
            rgba(236, 72, 153, 0.2) 50%,
            transparent 100%
        );
        background-size: 200% 100%;
        background-position: -100% 0;
    }
    50% {
        background-position: 100% 0;
    }
    100% {
        background: transparent;
    }
}

/* 11. Toast/Notification - Fairy accent */
.fairy-toast {
    border-left: 3px solid var(--color-accent-pink);
    position: relative;
    overflow: hidden;
}

.fairy-toast::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        var(--color-accent-pink),
        var(--color-accent-purple),
        var(--color-accent-pink)
    );
    background-size: 200% 100%;
    animation: fairy-toast-shimmer 2s linear infinite;
}

@keyframes fairy-toast-shimmer {
    0% { background-position: 0% 0; }
    100% { background-position: 200% 0; }
}

/* Reduced motion - disable all fairy animations */
@media (prefers-reduced-motion: reduce) {
    .fairy-empty-state::before,
    .fairy-filter-hint,
    .fairy-filter-hint::after,
    .fairy-upload-success,
    .fairy-transition-success,
    .fairy-toast::before {
        animation: none;
    }

    .fairy-filter-hint::after {
        display: none;
    }
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.125rem;
    text-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.header p {
    font-size: 0.875rem;
    opacity: 0.95;
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.3),
                 0 0 5px rgba(236, 72, 153, 0.2);
}

/* Mobile Menu Button - Hidden on Desktop */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: calc(var(--z-fixed) + 1); /* 501 - above sidebar, below modals */
    position: relative;
}

.mobile-menu-btn span {
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #06b6d4, #ec4899);
    border-radius: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 0 5px rgba(6, 182, 212, 0.5);
}

/* Hamburger Animation */
.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile only */
@media (max-width: 767.98px) {
    .mobile-menu-btn {
        display: flex;
        margin-right: var(--spacing-md);
    }
}

/* Sidebar Backdrop - Mobile only */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
                rgba(15, 23, 42, 0.85) 0%,
                rgba(30, 41, 59, 0.75) 50%,
                rgba(15, 23, 42, 0.85) 100%);
    backdrop-filter: blur(4px); /* iOS Safari blur effect */
    -webkit-backdrop-filter: blur(4px);
    z-index: calc(var(--z-fixed) - 1); /* 499 - below sidebar, above page content */
    opacity: 0;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
    will-change: opacity;
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

/* App Layout with Sidebar */
.app-layout {
    display: flex;
    min-height: calc(100vh - 180px);
}

/* App Sidebar - Theme-aware */
.app-sidebar {
    width: 260px;
    background: var(--color-bg-alt); /* Light mode: Light gray using CSS var */
    border-right: 1px solid var(--color-border);
    padding: var(--spacing-lg) 0;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0; /* Scrolls with page - header stays on top */
    align-self: flex-start;
    max-height: 100vh;
    z-index: 50; /* Below header (z-index: 100), above content */
}

/* Custom Scrollbar for Sidebar - Light Mode */
.app-sidebar::-webkit-scrollbar {
    width: 8px;
}

.app-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    margin: var(--spacing-sm) 0;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.app-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.app-sidebar::-webkit-scrollbar-thumb:active {
    background: rgba(0, 0, 0, 0.4);
}

/* Firefox Scrollbar */
.app-sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) rgba(0, 0, 0, 0.05);
}

/* Dark Mode Sidebar */
[data-theme="dark"] .app-sidebar,
[data-bs-theme="dark"] .app-sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    border-right: 3px solid transparent;
    border-image: linear-gradient(180deg,
                  rgba(6, 182, 212, 0.6),
                  rgba(236, 72, 153, 0.4),
                  rgba(139, 92, 246, 0.3),
                  rgba(6, 182, 212, 0.6)) 1;
    box-shadow: 2px 0 30px rgba(6, 182, 212, 0.15),
                inset -1px 0 20px rgba(6, 182, 212, 0.05);
}

/* Dark Mode Scrollbar */
[data-theme="dark"] .app-sidebar::-webkit-scrollbar-track,
[data-bs-theme="dark"] .app-sidebar::-webkit-scrollbar-track {
    background: linear-gradient(180deg,
                rgba(15, 23, 42, 0.3),
                rgba(30, 41, 59, 0.5),
                rgba(15, 23, 42, 0.3));
}

[data-theme="dark"] .app-sidebar::-webkit-scrollbar-thumb,
[data-bs-theme="dark"] .app-sidebar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg,
                #06b6d4 0%,
                #8b5cf6 50%,
                #ec4899 100%);
    border: 1px solid rgba(6, 182, 212, 0.3);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.6),
                inset 0 0 10px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .app-sidebar::-webkit-scrollbar-thumb:hover,
[data-bs-theme="dark"] .app-sidebar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg,
                #22d3ee 0%,
                #a78bfa 50%,
                #f472b6 100%);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.9),
                0 0 10px rgba(236, 72, 153, 0.6),
                inset 0 0 15px rgba(255, 255, 255, 0.2);
    border-color: rgba(6, 182, 212, 0.6);
}

[data-theme="dark"] .app-sidebar::-webkit-scrollbar-thumb:active,
[data-bs-theme="dark"] .app-sidebar::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg,
                #0891b2 0%,
                #7c3aed 50%,
                #db2777 100%);
    box-shadow: 0 0 25px rgba(6, 182, 212, 1),
                0 0 15px rgba(236, 72, 153, 0.8);
}

[data-theme="dark"] .app-sidebar,
[data-bs-theme="dark"] .app-sidebar {
    scrollbar-color: #06b6d4 rgba(15, 23, 42, 0.5);
}

.app-sidebar nav:not(#main-navigation) {
    padding: 0 var(--spacing-xs);
}

.app-sidebar ul:not(.mega-menu-categories):not(.mega-menu-links) {
    list-style: none;
    padding: 0;
    margin: 0;
}

.app-sidebar li:not(.mega-menu-category) {
    margin: 0;
}

/* Sidebar Dividers - Light Mode */
.app-sidebar .nav-divider {
    padding: var(--spacing-lg) var(--spacing-md) var(--spacing-sm);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--color-text-muted); /* Using CSS var */
    letter-spacing: 1.5px;
    margin-top: var(--spacing-xl);
    border-left: 0;
    position: relative;
    user-select: none;
}

.app-sidebar .nav-divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 60%;
    transform: translateY(-50%);
    background: var(--color-secondary);
    border-radius: 2px;
}

.app-sidebar .nav-divider:first-child {
    margin-top: 0;
}

/* Dark Mode Dividers */
[data-theme="dark"] .app-sidebar .nav-divider,
[data-bs-theme="dark"] .app-sidebar .nav-divider {
    color: #22d3ee;
    text-shadow: 0 0 15px rgba(6, 182, 212, 0.8),
                 0 0 5px rgba(6, 182, 212, 0.5);
}

[data-theme="dark"] .app-sidebar .nav-divider::before,
[data-bs-theme="dark"] .app-sidebar .nav-divider::before {
    background: linear-gradient(180deg,
                transparent,
                rgba(6, 182, 212, 0.8),
                transparent);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

/* Sidebar Links - Light Mode */
.app-sidebar nav:not(#main-navigation) a {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 0.75rem var(--spacing-md);
    margin: 0.25rem var(--spacing-sm);
    min-height: 44px; /* WCAG touch target minimum */
    color: var(--color-text); /* Using CSS var */
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--border-radius-sm);
    border-left: 0;
    position: relative;
    overflow: hidden;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    touch-action: manipulation; /* Disable double-tap zoom */
}

.app-sidebar nav:not(#main-navigation) a i {
    font-size: 1.15rem;
    min-width: 24px;
    text-align: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 3px rgba(6, 182, 212, 0.3));
}

.app-sidebar nav:not(#main-navigation) a span {
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Link Hover Effect - Subtle Glow */
.app-sidebar nav:not(#main-navigation) a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg,
                rgba(6, 182, 212, 0.25),
                rgba(139, 92, 246, 0.15),
                transparent);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--border-radius-sm);
}

.app-sidebar nav:not(#main-navigation) a::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: transparent;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-sidebar nav:not(#main-navigation) a:hover::before {
    width: 100%;
}

.app-sidebar nav:not(#main-navigation) a:hover::after {
    background: linear-gradient(180deg, #06b6d4, #8b5cf6);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.6);
}

.app-sidebar nav:not(#main-navigation) a:hover {
    color: white;
    background: rgba(6, 182, 212, 0.1);
    padding-left: calc(var(--spacing-md) + 4px);
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
    transform: translateX(2px);
}

.app-sidebar nav:not(#main-navigation) a:hover i {
    color: #22d3ee;
    transform: scale(1.12) rotate(-5deg);
    filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.8));
}

.app-sidebar nav:not(#main-navigation) a:hover span {
    letter-spacing: 0.5px;
}

/* Sidebar Active Link - Bold Gradient */
.app-sidebar nav:not(#main-navigation) a.active {
    /* WCAG AA: Solid gradient background ensures 4.5:1 contrast with white text */
    background: linear-gradient(135deg,
                rgba(6, 182, 212, 0.35) 0%,
                rgba(139, 92, 246, 0.3) 100%),
                linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4));
    background-blend-mode: normal, multiply;
    color: white;
    padding-left: calc(var(--spacing-md) + 4px);
    box-shadow: 0 2px 15px rgba(6, 182, 212, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8),
                 0 0 15px rgba(6, 182, 212, 0.6);
    font-weight: 600;
    border: 1px solid rgba(6, 182, 212, 0.4);
}

.app-sidebar nav:not(#main-navigation) a.active::before {
    width: 100%;
    background: linear-gradient(90deg,
                rgba(6, 182, 212, 0.15),
                rgba(139, 92, 246, 0.1),
                transparent);
}

.app-sidebar nav:not(#main-navigation) a.active::after {
    background: linear-gradient(180deg, #06b6d4, #ec4899, #8b5cf6);
    width: 4px;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.8),
                0 0 10px rgba(236, 72, 153, 0.5);
}

.app-sidebar nav:not(#main-navigation) a.active i {
    color: #22d3ee;
    transform: scale(1.2);
    filter: drop-shadow(0 0 10px rgba(6, 182, 212, 1));
}

.app-sidebar nav:not(#main-navigation) a.active span {
    letter-spacing: 0.5px;
}

/* Focus State for Accessibility */
.app-sidebar nav:not(#main-navigation) a:focus-visible {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
}

[data-theme="dark"] .app-sidebar nav:not(#main-navigation) a {
    color: var(--text-secondary);
}

[data-theme="dark"] .app-sidebar nav:not(#main-navigation) a:hover {
    color: white;
}

[data-theme="dark"] .app-sidebar nav:not(#main-navigation) a.active {
    /* WCAG AA: Enhanced contrast in dark mode */
    background: linear-gradient(135deg,
                rgba(6, 182, 212, 0.4) 0%,
                rgba(139, 92, 246, 0.35) 100%),
                linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3));
    background-blend-mode: normal, multiply;
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9),
                 0 0 15px rgba(34, 211, 238, 0.6);
}

/* Sidebar Submenu (Expandable Navigation) */
.app-sidebar .has-submenu {
    position: relative;
}

.app-sidebar .submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-sidebar .submenu-toggle .submenu-icon {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
}

.app-sidebar .submenu-toggle .submenu-icon.rotated {
    transform: rotate(180deg);
}

.app-sidebar .submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.2);
    margin: 0 var(--spacing-xs);
    border-radius: var(--border-radius-sm);
}

.app-sidebar .submenu.expanded {
    max-height: 500px;
}

.app-sidebar .submenu li {
    margin: 0;
}

.app-sidebar .submenu a {
    padding: 0.5rem var(--spacing-md) 0.5rem calc(var(--spacing-md) + 8px);
    margin: 0.15rem var(--spacing-xs);
    font-size: 0.8rem;
}

.app-sidebar .submenu a i {
    font-size: 0.95rem;
    min-width: 20px;
}

.app-sidebar .submenu a span {
    font-size: 0.8rem;
}

.app-sidebar .submenu-divider {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #67e8f9;
    letter-spacing: 1px;
    opacity: 0.8;
    user-select: none;
    border-top: 1px solid rgba(6, 182, 212, 0.2);
    margin-top: var(--spacing-xs);
}

.app-sidebar .submenu-divider:first-child {
    border-top: none;
    margin-top: 0;
}

.app-sidebar .badge-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    margin-left: auto;
    min-width: 14px;
    height: 14px;
}

.app-sidebar .badge-mini.badge-danger {
    background: rgba(239, 68, 68, 0.8);
    color: white;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.app-sidebar .framework-link {
    position: relative;
}

.app-sidebar .framework-link::before {
    display: none;
}

/* Main Content Area */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Container & Content with Dark Mode Support */
.container {
    max-width: 1600px;  /* Increased from 1400px for better use of modern displays */
    margin: var(--spacing-xl) auto;
    padding: 0 var(--spacing-xl);
}

.content {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    animation: fadeIn var(--transition-slow);
}

[data-theme="dark"] .content {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Typography with Dark Mode Support */
h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: var(--spacing-lg);
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #0f172a;
    margin-top: var(--spacing-2xl);
    margin-bottom: var(--spacing-md);
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: var(--spacing-md);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3 {
    color: var(--text-primary);
}

/* Cards - Cyberpunk Style with Dark Mode Support */
/* ============================================================
   Card Component System - Standardized
   Based on UI/UX Audit Issue 3.1
   ============================================================ */

/* Base Card (Bootstrap compatible) */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    margin-bottom: var(--spacing-md);
}

/* Card Header */
.card-header {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
}

.card-header h5,
.card-header h4,
.card-header h3 {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
}

.card-header h5 i,
.card-header h4 i,
.card-header h3 i {
    margin-right: 0.5rem;
    color: var(--color-secondary);
}

/* Card Actions (header buttons) */
.card-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Card Body */
.card-body {
    padding: var(--spacing-lg);
}

/* Card Footer */
.card-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

/* Dark Mode */
[data-theme="dark"] .card {
    background: var(--bg-elevated);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .card-header {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .card-footer {
    background: var(--bg-tertiary);
    border-top-color: var(--border-color);
}

/* Hoverable Card Variant */
.card-hoverable {
    cursor: pointer;
}

.card-hoverable::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-secondary), var(--color-accent-pink), var(--color-accent-purple));
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.card-hoverable:hover::before {
    opacity: 1;
}

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

.card:hover {
    box-shadow: var(--shadow-lg),
                0 0 25px rgba(6, 182, 212, 0.3),
                0 0 15px rgba(236, 72, 153, 0.2),
                0 0 10px rgba(139, 92, 246, 0.15);
    transform: translateY(-4px);
    border-color: var(--color-secondary);
    animation: card-glow 2s ease-in-out infinite;
}

@keyframes card-glow {
    0%, 100% {
        box-shadow: var(--shadow-lg),
                    0 0 25px rgba(6, 182, 212, 0.3),
                    0 0 15px rgba(236, 72, 153, 0.2),
                    0 0 10px rgba(139, 92, 246, 0.15);
    }
    50% {
        box-shadow: var(--shadow-lg),
                    0 0 30px rgba(6, 182, 212, 0.4),
                    0 0 20px rgba(236, 72, 153, 0.3),
                    0 0 15px rgba(139, 92, 246, 0.2);
    }
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin: var(--spacing-xl) 0;
}

.kpi-card {
    background: linear-gradient(135deg, var(--color-white) 0%, var(--color-bg-alt) 100%);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--color-secondary), var(--color-accent-purple));
    box-shadow: var(--glow-cyan);
}

.kpi-card:hover {
    box-shadow: var(--shadow-lg),
                0 0 20px rgba(6, 182, 212, 0.3),
                0 0 10px rgba(236, 72, 153, 0.2);
    transform: translateY(-6px) scale(1.02);
}

.kpi-card .icon {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-sm);
    opacity: 0.9;
}

.kpi-card .label {
    color: var(--color-text-light);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-card .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}

.kpi-card .unit {
    color: var(--color-text-muted);
    font-size: 1.2rem;
    font-weight: 500;
    margin-left: var(--spacing-xs);
}

/* Module Grid */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-lg);
    margin: var(--spacing-xl) 0;
}

.module-card {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    transition: all var(--transition-normal);
    background: var(--color-white);
}

.module-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
    border-color: var(--color-secondary);
}

.module-card h3 {
    margin-bottom: var(--spacing-sm);
    color: var(--color-primary);
}

.module-card p {
    color: var(--color-text-light);
    margin-bottom: var(--spacing-md);
}

/* Buttons - Cyberpunk Style */
.btn {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-lg);
    /* Cyberpunk Fairy gradient with dark overlay for WCAG AA compliance */
    background: linear-gradient(135deg, var(--color-secondary), var(--color-accent-purple)),
                linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3));
    background-blend-mode: normal, multiply;
    color: var(--color-white);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-normal);
    border: 1px solid var(--color-secondary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600; /* Increased from 500 for better readability */
    box-shadow: var(--shadow-sm), var(--glow-cyan);
    position: relative;
    overflow: hidden;
    /* WCAG AA: Text shadow improves contrast ratio */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8),
                 0 2px 6px rgba(0, 0, 0, 0.5);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.3), transparent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    background: linear-gradient(135deg, var(--color-secondary-hover), var(--color-accent-purple));
    box-shadow: var(--shadow-md),
                0 0 20px rgba(6, 182, 212, 0.6),
                0 0 15px rgba(236, 72, 153, 0.4),
                0 0 10px rgba(139, 92, 246, 0.3);
    transform: translateY(-3px) scale(1.02);
    border-color: var(--color-accent-pink);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

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

.btn-secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    border-color: #64748b;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #475569, #334155);
    box-shadow: var(--shadow-md);
}

.btn-success {
    /* Cyberpunk Fairy green with dark overlay for WCAG AA compliance */
    background: linear-gradient(135deg, var(--color-success), #059669),
                linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25));
    background-blend-mode: normal, multiply;
    border-color: var(--color-success);
    box-shadow: var(--shadow-sm), var(--glow-green);
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8),
                 0 2px 6px rgba(0, 0, 0, 0.5);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857),
                linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3));
    background-blend-mode: normal, multiply;
    box-shadow: var(--shadow-md),
                0 0 20px rgba(16, 185, 129, 0.6),
                0 0 10px rgba(16, 185, 129, 0.4);
    transform: translateY(-3px) scale(1.02);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9),
                 0 2px 6px rgba(0, 0, 0, 0.6);
}

.btn-danger {
    /* Cyberpunk Fairy red with dark overlay for WCAG AA compliance */
    background: linear-gradient(135deg, var(--color-danger), #dc2626),
                linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2));
    background-blend-mode: normal, multiply;
    border-color: var(--color-danger);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8),
                 0 2px 6px rgba(0, 0, 0, 0.5);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c),
                linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25));
    background-blend-mode: normal, multiply;
    box-shadow: var(--shadow-md),
                0 0 20px rgba(239, 68, 68, 0.6),
                0 0 10px rgba(239, 68, 68, 0.4);
    transform: translateY(-3px) scale(1.02);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9),
                 0 2px 6px rgba(0, 0, 0, 0.6);
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.875rem;
}

/* ==============================================
   Outline Buttons - Light Mode Readability Fix
   ============================================== */
/* Outline buttons need darker text colors in light mode for WCAG AA compliance */

.btn-outline-primary {
    color: #0d4f6e;
    border-color: #0d6efd;
    background: transparent;
    font-weight: 600;
}

.btn-outline-primary:hover,
.btn-outline-primary.active {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-outline-secondary {
    color: #3d4852;
    border-color: #6c757d;
    background: transparent;
    font-weight: 600;
}

.btn-outline-secondary:hover,
.btn-outline-secondary.active {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-outline-success {
    color: #0d5c36;
    border-color: #198754;
    background: transparent;
    font-weight: 600;
}

.btn-outline-success:hover,
.btn-outline-success.active {
    color: #fff;
    background-color: #198754;
    border-color: #198754;
}

.btn-outline-warning {
    color: #664d03;
    border-color: #cc9a06;
    background: transparent;
    font-weight: 600;
}

.btn-outline-warning:hover,
.btn-outline-warning.active {
    color: #000;
    background-color: #ffc107;
    border-color: #ffc107;
}

.btn-outline-danger {
    color: #842029;
    border-color: #dc3545;
    background: transparent;
    font-weight: 600;
}

.btn-outline-danger:hover,
.btn-outline-danger.active {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-outline-info {
    color: #055160;
    border-color: #0dcaf0;
    background: transparent;
    font-weight: 600;
}

.btn-outline-info:hover,
.btn-outline-info.active {
    color: #000;
    background-color: #0dcaf0;
    border-color: #0dcaf0;
}

/* Button Loading State */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Spinner - Bootstrap-like */
.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: -0.125em;
    border: 0.15em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border-spin 0.75s linear infinite;
}

.spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
    border-width: 0.125em;
}

@keyframes spinner-border-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Spacing helper for spinner */
.me-2 {
    margin-right: 0.5rem;
}

/* Info/Warning Boxes */
.info-box,
.warning-box,
.success-box,
.danger-box {
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    margin: var(--spacing-md) 0;
    border-left: 4px solid;
}

.info-box {
    background-color: rgba(6, 182, 212, 0.1);
    border-color: var(--color-info);
    color: var(--text-primary);
}

.warning-box {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: var(--color-warning);
    color: var(--text-primary);
}

.success-box {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: var(--color-success);
    color: var(--text-primary);
}

.danger-box {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: var(--color-danger);
    color: var(--text-primary);
}

/* Bootstrap Alerts - Light Mode with readable dark text */
.alert-info {
    background-color: #cff4fc;
    border-color: #9eeaf9;
    color: #055160;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffecb5;
    color: #664d03;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #842029;
}

.alert-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

/* Tables with Dark Mode Support */
.table-container {
    overflow-x: auto;
    margin: var(--spacing-xl) 0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

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

[data-theme="dark"] table {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

thead {
    background-color: var(--bs-dark);
    color: var(--bs-light);
    border-bottom: 2px solid var(--bs-primary);
    box-shadow: 0 2px 0 rgba(var(--bs-primary-rgb), 0.3);
}

[data-theme="dark"] thead {
    background-color: var(--bs-secondary-bg);
    border-bottom-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

thead th {
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

[data-theme="dark"] thead th {
    color: var(--bs-body-color);
}

tbody {
    background-color: var(--bs-body-bg);
}

tbody tr {
    border-bottom: 1px solid var(--bs-border-color);
    transition: background-color var(--transition-fast);
    background-color: var(--bs-body-bg);
}

[data-theme="dark"] tbody {
    background-color: var(--bs-dark);
}

[data-theme="dark"] tbody tr {
    border-bottom-color: var(--bs-border-color);
    background-color: var(--bs-dark);
}

tbody tr:hover {
    background-color: var(--bs-tertiary-bg);
}

[data-theme="dark"] tbody tr:hover {
    background-color: var(--bs-secondary-bg);
}

tbody td {
    padding: var(--spacing-md);
    color: var(--bs-body-color);
}

[data-theme="dark"] tbody td {
    color: var(--bs-gray-200);
}

/* Sticky Table Headers */
.table thead.sticky-top,
.table thead.thead-sticky {
    position: sticky;
    top: 60px; /* Adjust based on navbar height */
    z-index: 10;
    box-shadow: var(--bs-box-shadow);
}

.table thead.sticky-top th,
.table thead.thead-sticky th {
    background-color: var(--bs-dark);
    color: var(--bs-light);
    font-weight: 600;
    border-bottom: 2px solid var(--bs-border-color);
    padding: 0.75rem var(--spacing-sm);
    white-space: nowrap;
}

[data-theme="dark"] .table thead.sticky-top th,
[data-theme="dark"] .table thead.thead-sticky th {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

[data-theme="dark"] .table thead.sticky-top,
[data-theme="dark"] .table thead.thead-sticky {
    box-shadow: var(--bs-box-shadow-lg);
}

/* Table container for scrollable tables */
.table-container {
    position: relative;
    max-height: 800px;
    overflow-y: auto;
    margin-top: 1rem;
}

/* ==========================================
   BADGES - Standardized Badge System
   ==========================================

   Badge Categories:
   1. STATUS BADGES - Use Bootstrap 5 syntax: badge bg-{color}
   2. SEVERITY BADGES - Risk/Vulnerability levels: badge-{severity}
   3. ACTION BADGES - Audit log actions (already in ui-components.css)
   4. SPECIAL BADGES - Custom use cases

   Bootstrap 5 Status Badges (bg-success, bg-warning, etc.) are provided by Bootstrap.
   We only add dark mode support and severity variants here.
   ========================================== */

.badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.badge-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-lg {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Badge spacing utilities */
.badge + .badge {
    margin-left: 0.25rem;
}

/* WCAG AA Contrast Fix: bg-warning badges need dark text for readability */
.badge.bg-warning {
    color: #212529 !important; /* Bootstrap text-dark value */
}

/* Icon in badge spacing */
.badge .bi {
    margin-right: 0.25rem;
}

.badge .bi:only-child {
    margin-right: 0;
}

/* SEVERITY BADGES - For Risks, Vulnerabilities, Incidents (WCAG AA Compliant) */
.badge-critical {
    /* Already WCAG AA compliant: 4.83:1 contrast */
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.badge-high {
    /* WCAG AA: Dark overlay improves contrast from 2.80:1 to 4.5:1 */
    background: linear-gradient(135deg, #f97316, #ea580c),
                linear-gradient(rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.25));
    background-blend-mode: normal, multiply;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(249, 115, 22, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.badge-medium {
    /* Already WCAG AA compliant with black text on yellow */
    background: linear-gradient(135deg, #eab308, #ca8a04);
    color: #000;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(234, 179, 8, 0.3);
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
}

.badge-low {
    /* WCAG AA: Dark overlay improves contrast from 3.68:1 to 4.5:1 */
    background: linear-gradient(135deg, #3b82f6, #2563eb),
                linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2));
    background-blend-mode: normal, multiply;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* SPECIAL BADGES */
.badge-neutral {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Forms with Dark Mode Support */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    color: #1e293b;
}

[data-theme="dark"] .form-label {
    color: var(--text-primary);
}

/* Required Field Indicator */
.form-label .required,
.required-indicator {
    color: #ef4444;
    margin-left: 0.25rem;
    font-weight: 700;
}

[data-theme="dark"] .form-label .required,
[data-theme="dark"] .required-indicator {
    color: #f87171;
}

/* Required Field Legend */
.form-required-legend {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-left: 3px solid #ef4444;
    border-radius: var(--border-radius-sm);
}

.form-required-legend .required {
    color: #ef4444;
    font-weight: 700;
    margin-right: 0.25rem;
}

[data-theme="dark"] .form-required-legend {
    background: var(--bg-tertiary);
}

/* ==========================================
   FIELDSET STYLING - Issues 2.1 & 2.3
   Semantic form sections with card-like appearance
   ========================================== */

/* Fieldset base styling - looks like card */
fieldset {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0;
    margin-bottom: 1rem;
    background: var(--bg-primary);
}

/* Fieldset legend - looks like card header */
fieldset legend {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    margin: 0;
    width: 100%;
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    color: var(--text-primary);
    float: none;  /* Override browser default */
}

/* Content padding inside fieldset */
fieldset > .row,
fieldset > div:not(legend) {
    padding: 1rem;
}

/* Dark Mode support for fieldsets */
[data-theme="dark"] fieldset {
    background: var(--bg-elevated);
    border-color: var(--border-color);
}

[data-theme="dark"] fieldset legend {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
    color: var(--text-primary);
}

/* Nested rows inside fieldset don't need extra padding */
fieldset .row .row {
    padding: 0;
}

/* NIS2 Fieldset - Special Warning Styling */
fieldset.nis2-fieldset {
    border-color: #ffc107;
}

fieldset.nis2-fieldset legend.nis2-legend {
    background: var(--color-warning, #ffc107) !important;
    color: #212529 !important;
    border-bottom-color: #e0a800;
}

[data-theme="dark"] fieldset.nis2-fieldset {
    border-color: #ffc107;
}

[data-theme="dark"] fieldset.nis2-fieldset legend.nis2-legend {
    background: var(--color-warning, #ffc107) !important;
    color: #212529 !important;
    border-bottom-color: #e0a800;
}

/* Invalid Field Feedback - Consistent Positioning */
.invalid-feedback,
.form-error,
.error-message {
    display: none;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #ef4444;
    font-weight: 500;
    line-height: 1.4;
    position: relative;
    padding-left: 1.5rem;
}

/* Always show error if it has d-block class */
.invalid-feedback.d-block,
.form-error.d-block {
    display: block;
}

/* Show error when field is invalid */
.is-invalid ~ .invalid-feedback,
.is-invalid ~ .form-error,
.has-error .invalid-feedback,
.has-error .form-error {
    display: block;
}

/* Error icon positioning */
.invalid-feedback i,
.form-error i {
    position: absolute;
    left: 0;
    top: 0.1rem;
}

/* Invalid field styling */
.form-control.is-invalid,
.form-select.is-invalid,
input.is-invalid,
select.is-invalid,
textarea.is-invalid {
    border-color: #ef4444;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23ef4444'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23ef4444' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus,
input.is-invalid:focus,
select.is-invalid:focus,
textarea.is-invalid:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] .invalid-feedback,
[data-theme="dark"] .form-error {
    color: #f87171;
}

[data-theme="dark"] .form-control.is-invalid,
[data-theme="dark"] .form-select.is-invalid,
[data-theme="dark"] input.is-invalid,
[data-theme="dark"] select.is-invalid,
[data-theme="dark"] textarea.is-invalid {
    border-color: #f87171;
}

/* ==========================================
   FORM PLACEHOLDER TEXT - WCAG AA Compliant
   ========================================== */

/* Light mode: Darker placeholder for 4.5:1 contrast */
input::placeholder,
textarea::placeholder,
.form-control::placeholder,
.form-select::placeholder {
    color: #64748b; /* Darkened from #94a3b8 for 4.76:1 contrast */
    opacity: 1;
}

/* Dark mode: Lighter placeholder maintained in dark-mode.css */

/* Valid Field Feedback */
.valid-feedback {
    display: none;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #10b981;
}

.is-valid ~ .valid-feedback {
    display: block;
}

.form-control.is-valid {
    border-color: #10b981;
}

.form-control {
    width: 100%;
    padding: var(--spacing-sm);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: all var(--transition-normal);
    background: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .form-control {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2), var(--glow-cyan);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.02), rgba(236, 72, 153, 0.02));
}

[data-theme="dark"] .form-control:focus {
    border-color: var(--color-primary);
    background: var(--bg-primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Progress Bar - Cyberpunk Style */
.progress {
    height: 24px;
    background-color: var(--color-primary);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-secondary) 0%, var(--color-accent-pink) 50%, var(--color-accent-purple) 100%);
    transition: width var(--transition-slow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-white);
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: var(--glow-cyan);
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Progress Fill Color Variants */
.progress-fill-mini.progress-success {
    background: var(--color-success, #28a745) !important;
}

.progress-fill-mini.progress-warning {
    background: var(--color-warning, #ffc107) !important;
}

.progress-fill-mini.progress-danger {
    background: var(--color-danger, #dc3545) !important;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.stat-item {
    padding: var(--spacing-md);
    background: var(--color-bg-alt);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--color-secondary);
}

.stat-item strong {
    display: block;
    color: var(--color-primary);
    margin-bottom: var(--spacing-xs);
}

/* Loading Spinner - Cyberpunk Fairy Style */
.spinner {
    border: 3px solid rgba(6, 182, 212, 0.1);
    border-top: 3px solid var(--color-secondary);
    border-right: 3px solid var(--color-accent-pink);
    border-bottom: 3px solid var(--color-accent-purple);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    box-shadow: var(--glow-cyan);
    position: relative;
}

.spinner::after {
    content: '✨';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes sparkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Language Switcher - Cyberpunk Style */
.language-switcher {
    display: flex;
    gap: var(--spacing-xs);
    background: rgba(6, 182, 212, 0.1);
    padding: var(--spacing-xs);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(6, 182, 212, 0.3);
    box-shadow: inset 0 0 10px rgba(6, 182, 212, 0.1);
}

.lang-btn {
    padding: var(--spacing-xs) var(--spacing-md);
    color: var(--color-white);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all var(--transition-normal);
    opacity: 0.7;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.lang-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.3), transparent);
    transition: left 0.5s;
}

.lang-btn:hover::before {
    left: 100%;
}

.lang-btn:hover {
    opacity: 1;
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--color-secondary);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5),
                inset 0 0 10px rgba(6, 182, 212, 0.2);
    text-shadow: 0 0 5px rgba(6, 182, 212, 0.8);
}

.lang-btn.active {
    background: linear-gradient(135deg, var(--color-secondary), var(--color-accent-purple));
    opacity: 1;
    border-color: var(--color-accent-pink);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.6),
                0 0 10px rgba(236, 72, 153, 0.4),
                inset 0 0 10px rgba(255, 255, 255, 0.1);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Detail Grid - Structured Label-Value Display */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.detail-item .label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.detail-item .value {
    font-size: 1rem;
    color: var(--text-primary);
    word-break: break-word;
}

.detail-item .value:empty::after {
    content: '—';
    color: var(--text-muted);
}

.detail-section {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(6, 182, 212, 0.15);
}

.detail-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

/* Detail Item with Data Reuse indicator */
.detail-item.fairy-data-reuse .label::after {
    content: ' ✦';
    color: var(--color-accent-pink);
    font-size: 0.75rem;
}

.detail-item.fairy-data-reuse .value {
    position: relative;
}

/* User Menu Dropdown - Cyberpunk Style */
.user-menu {
    position: relative;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-secondary), var(--color-accent-purple));
    color: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    text-decoration: none;
    border: 2px solid rgba(6, 182, 212, 0.5);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.user-avatar:hover,
.user-avatar:focus {
    border-color: var(--color-accent-pink);
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.5),
                0 0 10px rgba(6, 182, 212, 0.4);
    transform: scale(1.05);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 220px;
    background: var(--bg-primary);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: var(--border-radius-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
                0 0 20px rgba(6, 182, 212, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    z-index: 1000;
}

.user-menu:hover .user-dropdown,
.user-menu:focus-within .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid rgba(6, 182, 212, 0.2);
    background: rgba(6, 182, 212, 0.05);
}

.user-dropdown-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.user-dropdown-email {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.user-dropdown-divider {
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(6, 182, 212, 0.3),
        transparent);
    margin: var(--spacing-xs) 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-primary);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.user-dropdown-item i {
    width: 1.25rem;
    text-align: center;
    color: var(--color-secondary);
}

.user-dropdown-item:hover {
    background: rgba(6, 182, 212, 0.1);
    color: var(--color-secondary);
}

/* Fairy Logout - The magic goodbye */
.fairy-logout {
    position: relative;
}

.fairy-logout-sparkle {
    opacity: 0;
    color: var(--color-accent-pink);
    margin-left: auto;
    transition: all 0.3s ease;
    transform: scale(0.5);
}

.fairy-logout:hover {
    background: linear-gradient(90deg,
        rgba(236, 72, 153, 0.15),
        rgba(139, 92, 246, 0.1));
    color: var(--color-accent-pink);
}

.fairy-logout:hover i {
    color: var(--color-accent-pink);
    animation: fairy-wave 0.6s ease;
}

.fairy-logout:hover .fairy-logout-sparkle {
    opacity: 1;
    transform: scale(1);
    animation: fairy-sparkle-bye 1s ease infinite;
}

@keyframes fairy-wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    75% { transform: rotate(15deg); }
}

@keyframes fairy-sparkle-bye {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

@media (prefers-reduced-motion: reduce) {
    .fairy-logout:hover i,
    .fairy-logout:hover .fairy-logout-sparkle {
        animation: none;
    }

    .fairy-logout-sparkle {
        opacity: 1;
        transform: scale(1);
    }
}

/* Footer with Dark Mode Support */
.footer {
    text-align: center;
    padding: var(--spacing-xl);
    color: #64748b;
    margin-top: var(--spacing-2xl);
    border-top: 2px solid transparent;
    border-image: linear-gradient(90deg,
                  transparent,
                  rgba(6, 182, 212, 0.3),
                  rgba(236, 72, 153, 0.2),
                  rgba(139, 92, 246, 0.2),
                  transparent) 1;
    background: linear-gradient(180deg, transparent, rgba(6, 182, 212, 0.02));
}

[data-theme="dark"] .footer {
    color: var(--text-secondary);
    background: linear-gradient(180deg, transparent, rgba(6, 182, 212, 0.05));
}

.footer p {
    margin: var(--spacing-xs) 0;
}

.footer kbd {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(236, 72, 153, 0.15));
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.875rem;
    box-shadow: 0 0 5px rgba(6, 182, 212, 0.2);
}

.footer a {
    color: var(--color-secondary);
    transition: all var(--transition-normal);
}

.footer a:hover {
    color: var(--color-accent-pink);
    text-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
}

/* Utility Classes */
/* Screen Reader Only - WCAG 2.1 Compliant */
.sr-only,
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focusable screen reader text */
.sr-only-focusable:focus,
.visually-hidden-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.d-flex { display: flex; }
.gap-1 { gap: var(--spacing-sm); }
.gap-2 { gap: var(--spacing-md); }
.gap-3 { gap: var(--spacing-lg); }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Responsive */
/* Mobile (up to 768px) - Hide Sidebar, show mobile menu */
@media (max-width: 767.98px) {
    .header {
        padding: var(--spacing-sm) var(--spacing-md);
        min-height: 64px;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .header p {
        font-size: 0.75rem;
    }

    .header-logo img {
        width: 32px;
        height: 32px;
    }

    .header-logo {
        gap: 0.5rem;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.75rem;
    }

    .user-dropdown {
        min-width: 200px;
        right: -0.5rem;
    }

    .notification-bell-btn-header {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    /* Hide sidebar on mobile by default */
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: var(--z-fixed); /* 500 - below modals (1000+), above page content */
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); /* Elastic bounce */
        box-shadow: 5px 0 30px rgba(6, 182, 212, 0.3);
        will-change: transform;
        contain: layout style paint;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }

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

    /* Pull-revealing state (visual feedback while dragging) */
    .app-sidebar.pull-revealing {
        transition: none; /* Disable transition during drag */
        will-change: transform;
    }

    .app-layout {
        flex-direction: column;
    }

    .app-main {
        width: 100%;
    }

    .container {
        padding: 0 var(--spacing-sm);
        margin: var(--spacing-md) auto;
    }

    .content {
        padding: var(--spacing-sm);
    }

    .kpi-grid,
    .module-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 1.5rem;
    }
}

/* Tablet (769px to 1024px) - Narrower Sidebar */
@media (min-width: 768px) and (max-width: 1024px) {
    .app-sidebar {
        width: 220px;
    }

    .app-sidebar a {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.85rem;
    }

    .app-sidebar a i {
        font-size: 1rem;
    }

    .container {
        padding: 0 var(--spacing-md);
    }
}

/* Large Desktop (> 1440px) - Wider Sidebar */
@media (min-width: 1440px) {
    .app-sidebar {
        width: 300px;
    }

    .app-sidebar a {
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: 1rem;
    }
}

/* ===============================
   Dashboard Widget Sizing
   =============================== */
.widget-size-small {
    flex: 0 0 calc(25% - 15px);
    max-width: calc(25% - 15px);
}

.widget-size-medium {
    flex: 0 0 calc(50% - 15px);
    max-width: calc(50% - 15px);
}

.widget-size-large {
    flex: 0 0 calc(75% - 15px);
    max-width: calc(75% - 15px);
}

.widget-size-full {
    flex: 0 0 100%;
    max-width: 100%;
}

/* Responsive widget sizes */
@media (max-width: 767.98px) {
    .widget-size-small,
    .widget-size-medium,
    .widget-size-large,
    .widget-size-full {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Widget drag state */
.widget.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.widget.drag-over {
    border: 2px dashed var(--color-secondary, #06b6d4);
    background: rgba(6, 182, 212, 0.05);
}

/* ============================================================
   Real-time Validation & Feedback Styles
   ============================================================ */

/* Field wrapper for feedback icon positioning */
.field-with-feedback {
    position: relative;
}

/* Validation feedback icons (checkmark and X) */
.validation-feedback-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 5;
    font-size: 1.25rem;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    animation: feedbackAppear 0.2s ease-out;
}

@keyframes feedbackAppear {
    from {
        opacity: 0;
        transform: translateY(-50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/* Adjust icon position for input groups */
.input-group .field-with-feedback .validation-feedback-icon {
    right: -35px;
}

/* Valid field styling with checkmark */
.form-control.is-valid,
.form-select.is-valid,
input.is-valid,
select.is-valid,
textarea.is-valid {
    border-color: var(--color-success);
    padding-right: calc(1.5em + 0.75rem);
}

.form-control.is-valid:focus,
input.is-valid:focus {
    border-color: var(--color-success);
    box-shadow: 0 0 0 0.2rem rgba(16, 185, 129, 0.25);
}

/* Valid feedback message */
.valid-feedback {
    display: none;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-success);
    font-weight: 500;
    line-height: 1.4;
}

.valid-feedback.d-block {
    display: block;
}

.is-valid ~ .valid-feedback {
    display: block;
}

/* Dark mode adjustments */
[data-theme="dark"] .invalid-feedback,
[data-theme="dark"] .form-error {
    color: #f87171;
}

[data-theme="dark"] .valid-feedback {
    color: #34d399;
}

[data-theme="dark"] .form-control.is-invalid,
[data-theme="dark"] input.is-invalid {
    border-color: #f87171;
}

[data-theme="dark"] .form-control.is-valid,
[data-theme="dark"] input.is-valid {
    border-color: #34d399;
}

/* ============================================================
   Password Strength Indicator
   ============================================================ */

.password-strength-meter {
    margin-top: 0.75rem;
}

.password-strength-meter .progress {
    height: 6px;
    border-radius: 3px;
    background-color: #e5e7eb;
    overflow: hidden;
}

[data-theme="dark"] .password-strength-meter .progress {
    background-color: #374151;
}

.password-strength-meter .progress-bar {
    transition: width 0.3s ease, background-color 0.3s ease;
}

.password-strength-meter small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.4;
}

/* Strength level colors */
.password-strength-meter .bg-danger {
    background-color: #ef4444 !important;
}

.password-strength-meter .bg-warning {
    background-color: #f59e0b !important;
}

.password-strength-meter .bg-info {
    background-color: #06b6d4 !important;
}

.password-strength-meter .bg-success {
    background-color: #10b981 !important;
}

/* Dark mode strength colors */
[data-theme="dark"] .password-strength-meter .bg-danger {
    background-color: #f87171 !important;
}

[data-theme="dark"] .password-strength-meter .bg-warning {
    background-color: #fbbf24 !important;
}

[data-theme="dark"] .password-strength-meter .bg-info {
    background-color: #22d3ee !important;
}

[data-theme="dark"] .password-strength-meter .bg-success {
    background-color: #34d399 !important;
}

/* ============================================================
   Unique Field Validation (AJAX Loading)
   ============================================================ */

.unique-check-spinner {
    display: none;
    color: var(--color-secondary);
    z-index: 10;
}

.unique-check-spinner .spinner-icon {
    animation: spin 1s linear infinite;
    font-size: 1.25rem;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Adjust field padding when spinner is visible */
.field-with-feedback:has(.unique-check-spinner[style*="display: block"]) input,
.field-with-feedback:has(.unique-check-spinner[style*="display: block"]) .form-control {
    padding-right: calc(2.5em + 0.75rem);
}

/* ===================================================================
   Mobile Table Responsiveness - Issue 12.2
   Auto-wrap all tables in responsive containers on mobile devices
   =================================================================== */
@media (max-width: 767.98px) {
    /* Make tables scrollable on mobile */
    table:not(.no-mobile-scroll) {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        max-width: 100%;
    }

    /* Ensure table headers stay visible during scroll */
    table:not(.no-mobile-scroll) thead {
        position: sticky;
        left: 0;
        z-index: 1;
    }

    /* Minimum column width on mobile */
    table:not(.no-mobile-scroll) td,
    table:not(.no-mobile-scroll) th {
        min-width: 100px;
        white-space: nowrap;
    }

    /* Allow text wrapping for specific columns */
    table:not(.no-mobile-scroll) td.wrap,
    table:not(.no-mobile-scroll) th.wrap {
        white-space: normal;
        min-width: 150px;
    }
}

/* Dark mode adjustments for sticky headers */
[data-theme="dark"] table thead {
    background-color: var(--bs-secondary-bg);
}

/* ===================================================================
   Table Styling Standardization - Issue 4.1
   Default styling for all tables to ensure consistency
   =================================================================== */

/* Base table styling - applies to ALL tables unless overridden */
table:not(.no-default-style) {
    width: 100%;
    margin-bottom: 1rem;
    color: var(--bs-body-color);
    border-collapse: collapse;
    background-color: var(--bs-body-bg);
}

table:not(.no-default-style) th,
table:not(.no-default-style) td {
    padding: 0.75rem;
    vertical-align: top;
    border-bottom: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
}

[data-theme="dark"] table:not(.no-default-style) td,
[data-theme="dark"] table:not(.no-default-style) th,
[data-bs-theme="dark"] table:not(.no-default-style) td,
[data-bs-theme="dark"] table:not(.no-default-style) th {
    background-color: #1e293b !important;
    color: #ffffff !important;
}

table:not(.no-default-style) thead th {
    vertical-align: bottom;
    font-weight: 600;
    border-bottom: 2px solid var(--bs-border-color);
    color: var(--bs-light);
    background-color: var(--bs-dark);
}

[data-theme="dark"] table:not(.no-default-style) thead th {
    color: var(--bs-body-color);
    background-color: var(--bs-secondary-bg);
}

table:not(.no-default-style) tbody tr:hover {
    background-color: var(--bs-tertiary-bg);
}

[data-theme="dark"] table:not(.no-default-style) tbody tr:hover,
[data-bs-theme="dark"] table:not(.no-default-style) tbody tr:hover {
    background-color: #334155 !important;
}

[data-theme="dark"] table:not(.no-default-style) tbody tr:hover td,
[data-bs-theme="dark"] table:not(.no-default-style) tbody tr:hover td {
    color: #ffffff !important;
    background-color: #334155 !important;
}

/* Fix text-muted in tables for dark mode */
[data-theme="dark"] table:not(.no-default-style) .text-muted,
[data-theme="dark"] table:not(.no-default-style) small.text-muted {
    color: #94a3b8 !important; /* slate-400 - readable muted text */
}

/* Ensure strong/bold text is highly visible in dark mode tables */
[data-theme="dark"] table:not(.no-default-style) strong,
[data-theme="dark"] table:not(.no-default-style) b,
[data-theme="dark"] table:not(.no-default-style) td strong,
[data-theme="dark"] table:not(.no-default-style) td b,
[data-theme="dark"] table tbody td strong,
[data-theme="dark"] table tbody td b {
    color: #ffffff !important; /* Pure white for maximum contrast */
    font-weight: 600;
    opacity: 1 !important;
}

/* Striped tables */
table.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--bs-table-striped-bg);
}

[data-theme="dark"] table.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--bs-table-striped-bg);
}

/* Bordered tables */
table.table-bordered th,
table.table-bordered td {
    border: 1px solid var(--color-border);
}

/* Small/compact tables */
table.table-sm th,
table.table-sm td {
    padding: 0.3rem 0.5rem;
    font-size: 0.875rem;
}

/* Borderless tables */
table.table-borderless th,
table.table-borderless td {
    border: none;
}

/* Table inside cards - no extra margin */
.card table:last-child,
.info-box table:last-child {
    margin-bottom: 0;
}


/* ===================================================================
   Utility Classes - Issue 7.1
   Replace common inline styles with reusable CSS classes
   =================================================================== */

/* Height Utilities */
.h-10px { height: 10px; }
.h-20px { height: 20px; }
.h-25px { height: 25px; }
.h-30px { height: 30px; }
.h-40px { height: 40px; }
.h-50px { height: 50px; }

/* Width Utilities (percentages) */
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-60 { width: 60%; }
.w-70 { width: 70%; }
.w-80 { width: 80%; }
.w-90 { width: 90%; }
.w-auto { width: auto; }

/* Font Size Utilities */
.fs-8pt { font-size: 8pt; }
.fs-9pt { font-size: 9pt; }
.fs-10pt { font-size: 10pt; }
.fs-11pt { font-size: 11pt; }
.fs-12pt { font-size: 12pt; }

/* Common spacing utilities (if not in Bootstrap) */
.mt-2rem { margin-top: 2rem; }
.mb-2rem { margin-bottom: 2rem; }
.mt-3rem { margin-top: 3rem; }
.mb-3rem { margin-bottom: 3rem; }

/* Display utilities (complement Bootstrap) */
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex-row { display: flex; flex-direction: row; }
.d-flex-col { display: flex; flex-direction: column; }

/* Flex utilities */
.flex-align-center { align-items: center; }
.flex-justify-center { justify-content: center; }
.flex-gap-xs { gap: 0.25rem; }
.flex-gap-sm { gap: 0.5rem; }
.flex-gap-md { gap: 0.625rem; }
.flex-gap-lg { gap: 1rem; }

/* Cursor utilities */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* Square icon size */
.icon-20 {
    width: 20px;
    height: 20px;
    display: inline-block;
    flex-shrink: 0;
}

.icon-24 {
    width: 24px;
    height: 24px;
    display: inline-block;
    flex-shrink: 0;
}

.icon-32 {
    width: 32px;
    height: 32px;
    display: inline-block;
    flex-shrink: 0;
}

/* White space utilities */
.ws-nowrap { white-space: nowrap; }
.ws-normal { white-space: normal; }
.ws-pre-wrap { white-space: pre-wrap; }

/* Flex shrink */
.flex-shrink-0 { flex-shrink: 0; }

/* ===================================================================
   Profile Avatar Utilities - Issue 7.2
   Replace inline avatar styles with reusable classes
   =================================================================== */

/* Base avatar styles */
.profile-avatar {
    object-fit: cover;
    border: 2px solid var(--color-primary, #0d6efd);
    border-radius: 50%;
}

/* Avatar sizes */
.profile-avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
}

.profile-avatar-md {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
}

.profile-avatar-lg {
    width: 80px;
    height: 80px;
    font-size: 2rem;
    font-weight: 600;
}

.profile-avatar-xl {
    width: 120px;
    height: 120px;
    font-size: 3rem;
    font-weight: 600;
}

/* Avatar placeholder (initials) */
.profile-avatar.bg-primary {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dark mode avatar border */
[data-theme="dark"] .profile-avatar,
[data-bs-theme="dark"] .profile-avatar {
    border-color: var(--color-secondary, #06b6d4);
}

/* ============================================
   Required Field Indicator (Bootstrap 5 Floating Labels)
   ============================================ */

/* Required field asterisk */
.required {
    color: var(--color-danger, #ef4444);
    margin-left: 0.25rem;
    font-weight: 700;
    font-size: 1.1em;
    line-height: 1;
    vertical-align: middle;
}

/* Bootstrap Floating Labels - Required indicator positioning */
.form-floating > label .required {
    position: relative;
    top: -1px;
}

/* Dark mode - ensure asterisk is visible */
[data-theme="dark"] .required,
[data-bs-theme="dark"] .required {
    color: #fca5a5; /* Lighter red for better contrast in dark mode */
}

/* Accessibility: Screen reader text */
.required[aria-label] {
    position: relative;
}



/* ============================================
   Modal Standardization - Consistent Centering
   ============================================ */

/* All modals should be vertically centered by default */
.modal-dialog {
    display: flex;
    align-items: center;
    min-height: calc(100% - 1rem);
}

@media (min-width: 576px) {
    .modal-dialog {
        min-height: calc(100% - 3.5rem);
    }
}

/* Modal header standardization */
.modal-header {
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.modal-header .modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Danger modal header (for delete/destructive actions) */
.modal-header.bg-danger {
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.modal-header.bg-danger .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Warning modal header */
.modal-header.bg-warning {
    color: #212529;
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

/* Dark mode modal adjustments */
[data-theme="dark"] .modal-content,
[data-bs-theme="dark"] .modal-content {
    background-color: var(--bg-primary, #1e293b);
    border-color: var(--border-color, #334155);
}

[data-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-header {
    border-bottom-color: var(--border-color, #334155);
}

[data-theme="dark"] .modal-footer,
[data-bs-theme="dark"] .modal-footer {
    border-top-color: var(--border-color, #334155);
}

/* ============================================
   Icon Standardization - Bootstrap Icons
   ============================================ */

/* Icon size standards:
   - Default (no class): 1em - inline with text
   - icon-sm: 0.875rem - small/compact contexts
   - icon-md: 1.25rem - medium emphasis
   - icon-lg: 1.5rem - large/prominent
   - icon-xl: 2rem - hero/feature icons
*/

.icon-sm { font-size: 0.875rem; }
.icon-md { font-size: 1.25rem; }
.icon-lg { font-size: 1.5rem; }
.icon-xl { font-size: 2rem; }

/* Semantic icon colors - use these for consistent meaning */
.icon-success { color: var(--color-success, #10b981); }
.icon-danger { color: var(--color-danger, #ef4444); }
.icon-warning { color: var(--color-warning, #f59e0b); }
.icon-info { color: var(--color-info, #06b6d4); }
.icon-muted { color: var(--text-muted, #94a3b8); }

/* Action icon colors (for buttons/links) */
.icon-edit { color: var(--color-info, #06b6d4); }
.icon-delete { color: var(--color-danger, #ef4444); }
.icon-view { color: var(--color-secondary, #06b6d4); }

/* Icons in buttons should have consistent spacing */
.btn .bi:not(:only-child) {
    margin-right: 0.375rem;
}

.btn .bi:only-child {
    margin: 0;
}

/* Icon-only buttons need consistent sizing */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem;
    line-height: 1;
}

.btn-icon .bi {
    font-size: 1rem;
}

.btn-icon.btn-sm .bi {
    font-size: 0.875rem;
}

.btn-icon.btn-lg .bi {
    font-size: 1.25rem;
}

/* Dark mode icon adjustments */
[data-theme="dark"] .icon-muted,
[data-bs-theme="dark"] .icon-muted {
    color: var(--text-secondary, #94a3b8);
}

/* ============================================
   Badge Semantic Standards
   ============================================

   Use consistent badge colors for semantic meaning:

   STATUS BADGES:
   - bg-success: Active, Completed, Approved, Implemented
   - bg-danger: Inactive, Failed, Rejected, Critical
   - bg-warning: Pending, In Progress, Needs Review (auto text-dark)
   - bg-info: Information, Count, New
   - bg-secondary: Unknown, N/A, Default fallback
   - bg-primary: Role, Category, Type label

   PRIORITY BADGES:
   - badge-critical: Critical priority (custom gradient)
   - badge-high: High priority (custom gradient)
   - badge-medium: Medium priority
   - badge-low: Low priority
*/

/* Status badge semantic classes */
.badge-status-active { @extend .badge, .bg-success; }
.badge-status-inactive { @extend .badge, .bg-danger; }
.badge-status-pending { @extend .badge, .bg-warning; }
.badge-status-info { @extend .badge, .bg-info; }

/* Ensure all info/warning badges are readable */
.badge.bg-info {
    color: #fff;
}

/* Light background badges need dark text */
.badge.bg-light {
    color: #212529 !important;
}

/* Badge with icons - consistent spacing */
.badge .bi {
    font-size: 0.85em;
    vertical-align: -0.1em;
}

/* Status indicator badges (small dots) */
.badge-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    margin-right: 0.375rem;
}

.badge-dot.bg-success { background-color: var(--color-success); }
.badge-dot.bg-danger { background-color: var(--color-danger); }
.badge-dot.bg-warning { background-color: var(--color-warning); }
.badge-dot.bg-info { background-color: var(--color-info); }

/* Dark mode badge adjustments */
[data-theme="dark"] .badge.bg-secondary,
[data-bs-theme="dark"] .badge.bg-secondary {
    background-color: #475569 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .badge.bg-light,
[data-bs-theme="dark"] .badge.bg-light {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
}
