/* =================================================================
   MASERA DESIGN SYSTEM v3.0
   Modern glassmorphic KPI cards — geometric accents + orbital icons
   Base Color: Teal (#2a6169) + Gold (#d4af37) + Warm (#c49a6c)
   ================================================================= */

/* ==================== DESIGN TOKENS ==================== */
:root {
    /* --- Intelligent Color Palette --- */
    --ds-teal-900: #1a3a40;
    --ds-teal-800: #1e4449;
    --ds-teal-700: #2a6169;
    --ds-teal-600: #337d84;
    --ds-teal-500: #3d949c;
    --ds-teal-400: #5ab5bd;
    --ds-teal-300: #84cdd4;
    
    --ds-gold-500: #d4af37;
    --ds-gold-400: #e4c04a;
    --ds-gold-300: #f0d060;
    --ds-warm-500: #c49a6c;
    --ds-warm-400: #d4aa7c;
    
    /* --- Semantic Colors --- */
    --ds-surface-0: #0f2528;
    --ds-surface-1: #162f33;
    --ds-surface-2: #1e3d42;
    --ds-surface-3: #244951;
    --ds-surface-4: #2a6169;
    --ds-surface-elevated: rgba(42, 97, 105, 0.85);
    
    --ds-border-subtle: rgba(212, 175, 55, 0.08);
    --ds-border-default: rgba(212, 175, 55, 0.15);
    --ds-border-emphasis: rgba(212, 175, 55, 0.35);
    --ds-border-strong: rgba(212, 175, 55, 0.6);
    
    --ds-text-primary: #ffffff;
    --ds-text-secondary: rgba(255, 255, 255, 0.78);
    --ds-text-tertiary: rgba(255, 255, 255, 0.55);
    --ds-text-accent: var(--ds-gold-500);
    
    /* --- Spacing Scale --- */
    --ds-space-xs: 4px;
    --ds-space-sm: 8px;
    --ds-space-md: 16px;
    --ds-space-lg: 24px;
    --ds-space-xl: 32px;
    --ds-space-2xl: 48px;
    
    /* --- Radius Scale --- */
    --ds-radius-sm: 8px;
    --ds-radius-md: 12px;
    --ds-radius-lg: 16px;
    --ds-radius-xl: 20px;
    --ds-radius-2xl: 24px;
    --ds-radius-pill: 100px;
    
    /* --- Shadow Scale --- */
    --ds-shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.12);
    --ds-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.18);
    --ds-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
    --ds-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.35);
    --ds-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.45);
    --ds-shadow-glow-gold: 0 0 20px rgba(212, 175, 55, 0.25);
    --ds-shadow-glow-teal: 0 0 20px rgba(90, 181, 189, 0.2);
    
    /* --- Motion --- */
    --ds-ease-out: cubic-bezier(0.25, 0, 0.1, 1);
    --ds-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ds-duration-fast: 0.15s;
    --ds-duration-normal: 0.3s;
    --ds-duration-slow: 0.5s;
    
    /* --- KPI Palette — Teal Harmonic System (8 teal-derived gradients) --- */
    --kpi-1-from: #1a6b62; --kpi-1-to: #2dbf96;  /* Teal Signature */
    --kpi-2-from: #14506a; --kpi-2-to: #2884a8;  /* Teal Sapphire */
    --kpi-3-from: #0e3d42; --kpi-3-to: #1a6168;  /* Teal Deep */
    --kpi-4-from: #0f7b5f; --kpi-4-to: #2ed89a;  /* Teal Emerald */
    --kpi-5-from: #176e86; --kpi-5-to: #36bcd4;  /* Teal Azure */
    --kpi-6-from: #0a2e33; --kpi-6-to: #164e56;  /* Teal Midnight */
    --kpi-7-from: #2d8d96; --kpi-7-to: #6ec6cf;  /* Teal Frost */
    --kpi-8-from: #1b5e52; --kpi-8-to: #3aa882;  /* Teal Warm */

    /* --- KPI Glow Colors (for hover effects) --- */
    --kpi-1-glow: rgba(45, 191, 150, 0.35);
    --kpi-2-glow: rgba(40, 132, 168, 0.35);
    --kpi-3-glow: rgba(26, 97, 104, 0.35);
    --kpi-4-glow: rgba(46, 216, 154, 0.35);
    --kpi-5-glow: rgba(54, 188, 212, 0.35);
    --kpi-6-glow: rgba(22, 78, 86, 0.35);
    --kpi-7-glow: rgba(110, 198, 207, 0.35);
    --kpi-8-glow: rgba(58, 168, 130, 0.35);

    /* --- Pipeline Stage Colors (teal spectrum) --- */
    --pipe-1: #2a8fa0; --pipe-1-bg: rgba(42, 143, 160, 0.15);
    --pipe-2: #1d7a6e; --pipe-2-bg: rgba(29, 122, 110, 0.15);
    --pipe-3: #3d949c; --pipe-3-bg: rgba(61, 148, 156, 0.15);
    --pipe-4: #1a6b62; --pipe-4-bg: rgba(26, 107, 98, 0.15);
    --pipe-5: #2dbf96; --pipe-5-bg: rgba(45, 191, 150, 0.15);
}

/* ==================== KEYFRAME ANIMATIONS ==================== */
@keyframes ds-slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes ds-slideDown {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes ds-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes ds-scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes ds-shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
@keyframes ds-pulse-ring {
    0%   { transform: scale(1); opacity: 0.4; }
    100% { transform: scale(1.8); opacity: 0; }
}
@keyframes ds-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
@keyframes ds-gradient-flow {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes ds-border-dance {
    0%   { border-color: rgba(212, 175, 55, 0.15); }
    50%  { border-color: rgba(212, 175, 55, 0.4); }
    100% { border-color: rgba(212, 175, 55, 0.15); }
}
@keyframes ds-countUp {
    from { opacity: 0; transform: translateY(10px) scale(0.8); filter: blur(4px); }
    to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes ds-icon-breathe {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50%      { transform: scale(1.1); opacity: 1; }
}
@keyframes ds-gloss-sweep {
    0%   { left: -120%; opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { left: 130%; opacity: 0; }
}
@keyframes ds-card-breathe {
    0%, 100% { box-shadow: var(--ds-shadow-md), 0 0 12px rgba(45, 191, 150, 0.08); }
    50%      { box-shadow: var(--ds-shadow-md), 0 0 26px rgba(45, 191, 150, 0.22); }
}
@keyframes ds-specular-pulse {
    0%, 100% { opacity: 0.55; }
    50%      { opacity: 0.85; }
}
@keyframes ds-border-glow-kpi {
    0%, 100% { opacity: 0.55; }
    50%      { opacity: 1; }
}
@keyframes ds-value-pop {
    0%   { opacity: 0; transform: translateY(10px) scale(0.85); filter: blur(6px); }
    60%  { transform: translateY(-3px) scale(1.03); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes ds-icon-orbit {
    0%   { transform: scale(1) rotate(0deg); }
    25%  { transform: scale(1.08) rotate(8deg); }
    75%  { transform: scale(1.05) rotate(-4deg); }
    100% { transform: scale(1) rotate(0deg); }
}
@keyframes ds-ripple-out {
    0%   { transform: scale(0.6); opacity: 0.6; }
    100% { transform: scale(2.4); opacity: 0; }
}
@keyframes ds-gradient-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes ds-card-enter {
    0%   { opacity: 0; transform: translateY(28px) scale(0.94); filter: blur(4px); }
    60%  { filter: blur(0); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==================== ENHANCED BODY & PAGE ==================== */
body {
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(90, 181, 189, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(212, 175, 55, 0.05) 0%, transparent 50%),
        linear-gradient(160deg, #1a3a40 0%, #2a6169 40%, #244951 100%);
    background-attachment: fixed;
}

/* ==================== HEADER REDESIGN ==================== */
.header {
    background: linear-gradient(135deg, var(--ds-surface-2) 0%, var(--ds-surface-3) 100%);
    padding: 10px 24px;
    box-shadow: var(--ds-shadow-md), inset 0 1px 0 rgba(255,255,255,0.04);
    border-bottom: 1px solid var(--ds-border-default);
    position: sticky;
    top: 0;
    z-index: 999;
    overflow: visible;
    animation: ds-slideDown 0.4s var(--ds-ease-out) both;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--ds-gold-500), var(--ds-warm-500), var(--ds-gold-500));
    background-size: 200% auto;
    animation: ds-gradient-flow 4s ease infinite;
}

.header-title {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--ds-gold-500) 0%, var(--ds-warm-400) 40%, var(--ds-gold-300) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.3px;
    position: relative;
    z-index: 1;
}

/* ==================== CONTENT AREA SPACING FIX ==================== */
/* style.css sets padding: 30px on .content which creates excessive gap below sticky header */
.content {
    padding: 8px 24px 24px 24px !important;
}

/* ==================== KPI GRID SYSTEM ==================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 22px;
    margin-bottom: 28px;
    perspective: 1200px;
}

/* ==================== KPI CARD v3 — MODERN GLASSMORPHIC ==================== */
.kpi-card {
    position: relative;
    border-radius: 18px;
    padding: 22px 20px 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(24px) saturate(1.8);
    -webkit-backdrop-filter: blur(24px) saturate(1.8);
    background: linear-gradient(165deg,
        rgba(30, 61, 66, 0.85) 0%,
        rgba(20, 45, 50, 0.92) 100%);
    transition: 
        transform 0.45s var(--ds-ease-spring),
        box-shadow 0.45s var(--ds-ease-out),
        border-color 0.4s ease;
    animation: ds-card-enter 0.5s var(--ds-ease-out) both;
    cursor: pointer;
    isolation: isolate;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.28),
        0 1px 3px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Decorative corner accent — geometric triangle */
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: linear-gradient(225deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.03) 40%,
        transparent 70%);
    clip-path: polygon(100% 0, 0 0, 100% 100%);
    pointer-events: none;
    z-index: 1;
    border-radius: 0 18px 0 0;
    transition: all 0.4s ease;
}

/* Shimmer sweep on hover */
.kpi-card::after {
    content: '';
    position: absolute;
    top: -60%;
    left: -150%;
    width: 60%;
    height: 260%;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255, 255, 255, 0.06) 45%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.06) 55%,
        transparent 60%
    );
    transform: skewX(-18deg);
    transition: left 0.7s cubic-bezier(0.25, 0, 0.1, 1);
    pointer-events: none;
    z-index: 5;
    border-radius: inherit;
}
.kpi-card:hover::after {
    left: 160%;
}

/* Hover state — lift + glow */
.kpi-card:hover {
    transform: translateY(-6px) scale(1.015);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.35),
        0 8px 24px rgba(0, 0, 0, 0.20),
        0 0 40px rgba(45, 191, 150, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.22);
}
.kpi-card:hover::before {
    width: 100px;
    height: 100px;
    background: linear-gradient(225deg,
        rgba(255, 255, 255, 0.12) 0%,
        rgba(255, 255, 255, 0.04) 40%,
        transparent 70%);
}

/* Active press */
.kpi-card:active {
    transform: translateY(-2px) scale(0.985);
    transition: transform 0.1s var(--ds-ease-out);
}

/* Stagger entrance */
.kpi-card:nth-child(1) { animation-delay: 0.03s; }
.kpi-card:nth-child(2) { animation-delay: 0.08s; }
.kpi-card:nth-child(3) { animation-delay: 0.13s; }
.kpi-card:nth-child(4) { animation-delay: 0.18s; }
.kpi-card:nth-child(5) { animation-delay: 0.23s; }
.kpi-card:nth-child(6) { animation-delay: 0.28s; }
.kpi-card:nth-child(7) { animation-delay: 0.33s; }
.kpi-card:nth-child(8) { animation-delay: 0.38s; }

/* Bottom accent bar — colored stripe */
.kpi-card .kpi-accent-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(45,191,150,0.6), rgba(54,188,212,0.6));
    transition: height 0.35s ease, opacity 0.35s ease;
    z-index: 4;
}
.kpi-card:hover .kpi-accent-bar {
    height: 4px;
    opacity: 1;
    box-shadow: 0 0 12px rgba(45, 191, 150, 0.3);
}

/* --- KPI Header --- */
.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    position: relative;
    z-index: 3;
}

.kpi-title {
    font-size: 11.5px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.72);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    line-height: 1.5;
    max-width: 65%;
}

/* --- KPI Icon — Floating Circle with Ring --- */
.kpi-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(145deg,
        rgba(45, 191, 150, 0.25) 0%,
        rgba(54, 188, 212, 0.15) 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    font-size: 19px;
    color: rgba(255, 255, 255, 0.95);
    transition: all 0.4s var(--ds-ease-spring);
    flex-shrink: 0;
    position: relative;
    z-index: 3;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* Orbiting ring decoration */
.kpi-icon::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 1.5px dashed rgba(255, 255, 255, 0.12);
    animation: ds-icon-ring-spin 12s linear infinite;
    pointer-events: none;
}

@keyframes ds-icon-ring-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.kpi-card:hover .kpi-icon {
    background: linear-gradient(145deg,
        rgba(45, 191, 150, 0.40) 0%,
        rgba(54, 188, 212, 0.30) 100%);
    transform: scale(1.12) rotate(8deg);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.30),
        0 0 20px rgba(45, 191, 150, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.30);
    border-color: rgba(255, 255, 255, 0.30);
}
.kpi-card:hover .kpi-icon::before {
    border-color: rgba(45, 191, 150, 0.30);
    animation-duration: 4s;
}

/* --- KPI Value --- */
.kpi-value {
    font-size: 36px;
    font-weight: 900;
    color: #ffffff;
    line-height: 1.1;
    margin-bottom: 10px;
    position: relative;
    z-index: 3;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.30);
    animation: ds-value-pop 0.6s var(--ds-ease-spring) both;
    /* Reset gradient text from modern-effects */
    -webkit-text-fill-color: initial;
    background-clip: initial;
    -webkit-background-clip: initial;
    background: none;
}

/* --- KPI Trend --- */
.kpi-trend {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 3;
    transition: color 0.3s ease;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.kpi-card:hover .kpi-trend {
    color: rgba(255, 255, 255, 0.90);
    border-top-color: rgba(255, 255, 255, 0.12);
}

.kpi-trend .fa-external-link-alt {
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s var(--ds-ease-spring);
    transform: translateX(-6px) scale(0.8);
    font-size: 10px;
}
.kpi-card:hover .kpi-trend .fa-external-link-alt {
    opacity: 0.7;
    transform: translateX(0) scale(1);
}

/* Trend indicator dot */
.kpi-trend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.kpi-trend-dot.up { background: #48bb78; box-shadow: 0 0 8px rgba(72,187,120,0.4); }
.kpi-trend-dot.down { background: #fc5c65; box-shadow: 0 0 8px rgba(252,92,101,0.4); }
.kpi-trend-dot.neutral { background: rgba(255,255,255,0.3); }

/* ==================== KPI VARIANT STYLES v3 ==================== */
/* Modern accent — top border gradient + tinted background */

.kpi-card.primary {
    background: linear-gradient(165deg,
        rgba(30, 70, 78, 0.88) 0%,
        rgba(20, 48, 55, 0.95) 100%);
    border-top: 3px solid rgba(45, 191, 150, 0.50);
    border-left: none;
}
.kpi-card.primary:hover {
    box-shadow:
        0 20px 50px rgba(0,0,0,0.38),
        0 0 40px rgba(45, 191, 150, 0.20),
        inset 0 1px 0 rgba(255,255,255,0.15) !important;
}

.kpi-card.success {
    background: linear-gradient(165deg,
        rgba(20, 95, 78, 0.70) 0%,
        rgba(18, 68, 60, 0.85) 100%);
    border-top: 3px solid rgba(72, 187, 120, 0.60);
    border-left: none;
}
.kpi-card.success .kpi-icon {
    background: linear-gradient(145deg, rgba(72, 187, 120, 0.30) 0%, rgba(56, 161, 105, 0.15) 100%);
}
.kpi-card.success:hover {
    box-shadow:
        0 20px 50px rgba(0,0,0,0.38),
        0 0 40px rgba(72, 187, 120, 0.22),
        inset 0 1px 0 rgba(255,255,255,0.15) !important;
}

.kpi-card.warning {
    background: linear-gradient(165deg,
        rgba(23, 85, 105, 0.70) 0%,
        rgba(18, 60, 78, 0.85) 100%);
    border-top: 3px solid rgba(54, 188, 212, 0.60);
    border-left: none;
}
.kpi-card.warning .kpi-icon {
    background: linear-gradient(145deg, rgba(54, 188, 212, 0.30) 0%, rgba(45, 160, 185, 0.15) 100%);
}
.kpi-card.warning:hover {
    box-shadow:
        0 20px 50px rgba(0,0,0,0.38),
        0 0 40px rgba(54, 188, 212, 0.22),
        inset 0 1px 0 rgba(255,255,255,0.15) !important;
}

.kpi-card.danger {
    background: linear-gradient(165deg,
        rgba(28, 55, 60, 0.80) 0%,
        rgba(18, 40, 45, 0.92) 100%);
    border-top: 3px solid rgba(212, 175, 55, 0.55);
    border-left: none;
}
.kpi-card.danger .kpi-icon {
    background: linear-gradient(145deg, rgba(212, 175, 55, 0.25) 0%, rgba(196, 154, 108, 0.15) 100%);
}
.kpi-card.danger:hover {
    box-shadow:
        0 20px 50px rgba(0,0,0,0.38),
        0 0 40px rgba(212, 175, 55, 0.22),
        inset 0 1px 0 rgba(255,255,255,0.15) !important;
}

.kpi-card.info {
    background: linear-gradient(165deg,
        rgba(35, 105, 115, 0.68) 0%,
        rgba(25, 72, 80, 0.82) 100%);
    border-top: 3px solid rgba(110, 198, 207, 0.60);
    border-left: none;
}
.kpi-card.info .kpi-icon {
    background: linear-gradient(145deg, rgba(110, 198, 207, 0.30) 0%, rgba(90, 170, 180, 0.15) 100%);
}
.kpi-card.info:hover {
    box-shadow:
        0 20px 50px rgba(0,0,0,0.38),
        0 0 40px rgba(110, 198, 207, 0.22),
        inset 0 1px 0 rgba(255,255,255,0.15) !important;
}

/* ==================== GRADIENT CARDS v3 ==================== */

/* Breathing border glow animation */
@keyframes ds-borderGlow {
    0%, 100% { border-color: rgba(255, 255, 255, 0.10); }
    50% { border-color: rgba(45, 191, 150, 0.30); }
}

/* Shared gradient card enhancements */
.kpi-card[class*='gradient-'],
.kpi-detail-card[class*='gradient-'] {
    background-size: 200% 200% !important;
    animation: ds-card-enter 0.5s var(--ds-ease-out) both,
               ds-gradient-shift 10s ease infinite !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-top: 3px solid rgba(255, 255, 255, 0.20) !important;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.10) !important;
}
.kpi-card[class*='gradient-']:hover,
.kpi-detail-card[class*='gradient-']:hover {
    border-color: rgba(255, 255, 255, 0.22) !important;
}

/* Gradient 1 — Teal Signature */
.kpi-card.gradient-1,
.kpi-detail-card.gradient-1 {
    background: linear-gradient(135deg, var(--kpi-1-from) 0%, var(--kpi-1-to) 50%, var(--kpi-1-from) 100%) !important;
    border-top-color: rgba(45, 191, 150, 0.55) !important;
}
.kpi-card.gradient-1 .kpi-icon { background: linear-gradient(145deg, rgba(45,191,150,0.35), rgba(45,191,150,0.10)); }
.kpi-card.gradient-1:hover, .kpi-detail-card.gradient-1:hover {
    box-shadow: 0 20px 52px rgba(0,0,0,0.40), 0 0 45px var(--kpi-1-glow), inset 0 1px 0 rgba(255,255,255,0.20) !important;
}

/* Gradient 2 — Teal Sapphire */
.kpi-card.gradient-2,
.kpi-detail-card.gradient-2 {
    background: linear-gradient(135deg, var(--kpi-2-from) 0%, var(--kpi-2-to) 50%, var(--kpi-2-from) 100%) !important;
    border-top-color: rgba(40, 132, 168, 0.55) !important;
}
.kpi-card.gradient-2 .kpi-icon { background: linear-gradient(145deg, rgba(40,132,168,0.35), rgba(40,132,168,0.10)); }
.kpi-card.gradient-2:hover, .kpi-detail-card.gradient-2:hover {
    box-shadow: 0 20px 52px rgba(0,0,0,0.40), 0 0 45px var(--kpi-2-glow), inset 0 1px 0 rgba(255,255,255,0.20) !important;
}

/* Gradient 3 — Teal Deep */
.kpi-card.gradient-3,
.kpi-detail-card.gradient-3 {
    background: linear-gradient(135deg, var(--kpi-3-from) 0%, var(--kpi-3-to) 50%, var(--kpi-3-from) 100%) !important;
    border-top-color: rgba(26, 97, 104, 0.65) !important;
}
.kpi-card.gradient-3 .kpi-icon { background: linear-gradient(145deg, rgba(26,97,104,0.40), rgba(26,97,104,0.15)); }
.kpi-card.gradient-3:hover, .kpi-detail-card.gradient-3:hover {
    box-shadow: 0 20px 52px rgba(0,0,0,0.40), 0 0 45px var(--kpi-3-glow), inset 0 1px 0 rgba(255,255,255,0.20) !important;
}

/* Gradient 4 — Teal Emerald */
.kpi-card.gradient-4,
.kpi-detail-card.gradient-4 {
    background: linear-gradient(135deg, var(--kpi-4-from) 0%, var(--kpi-4-to) 50%, var(--kpi-4-from) 100%) !important;
    border-top-color: rgba(46, 216, 154, 0.55) !important;
}
.kpi-card.gradient-4 .kpi-icon { background: linear-gradient(145deg, rgba(46,216,154,0.35), rgba(46,216,154,0.10)); }
.kpi-card.gradient-4:hover, .kpi-detail-card.gradient-4:hover {
    box-shadow: 0 20px 52px rgba(0,0,0,0.40), 0 0 45px var(--kpi-4-glow), inset 0 1px 0 rgba(255,255,255,0.20) !important;
}

/* Gradient 5 — Teal Azure */
.kpi-card.gradient-5,
.kpi-detail-card.gradient-5 {
    background: linear-gradient(135deg, var(--kpi-5-from) 0%, var(--kpi-5-to) 50%, var(--kpi-5-from) 100%) !important;
    border-top-color: rgba(54, 188, 212, 0.55) !important;
}
.kpi-card.gradient-5 .kpi-icon { background: linear-gradient(145deg, rgba(54,188,212,0.35), rgba(54,188,212,0.10)); }
.kpi-card.gradient-5:hover, .kpi-detail-card.gradient-5:hover {
    box-shadow: 0 20px 52px rgba(0,0,0,0.40), 0 0 45px var(--kpi-5-glow), inset 0 1px 0 rgba(255,255,255,0.20) !important;
}

/* Gradient 6 — Teal Midnight */
.kpi-card.gradient-6,
.kpi-detail-card.gradient-6 {
    background: linear-gradient(135deg, var(--kpi-6-from) 0%, var(--kpi-6-to) 50%, var(--kpi-6-from) 100%) !important;
    border-top-color: rgba(22, 78, 86, 0.70) !important;
}
.kpi-card.gradient-6 .kpi-icon { background: linear-gradient(145deg, rgba(22,78,86,0.45), rgba(22,78,86,0.15)); }
.kpi-card.gradient-6:hover, .kpi-detail-card.gradient-6:hover {
    box-shadow: 0 20px 52px rgba(0,0,0,0.40), 0 0 45px var(--kpi-6-glow), inset 0 1px 0 rgba(255,255,255,0.20) !important;
}

/* Gradient 7 — Teal Frost */
.kpi-card.gradient-7,
.kpi-detail-card.gradient-7 {
    background: linear-gradient(135deg, var(--kpi-7-from) 0%, var(--kpi-7-to) 50%, var(--kpi-7-from) 100%) !important;
    border-top-color: rgba(110, 198, 207, 0.55) !important;
}
.kpi-card.gradient-7 .kpi-icon { background: linear-gradient(145deg, rgba(110,198,207,0.35), rgba(110,198,207,0.10)); }
.kpi-card.gradient-7:hover, .kpi-detail-card.gradient-7:hover {
    box-shadow: 0 20px 52px rgba(0,0,0,0.40), 0 0 45px var(--kpi-7-glow), inset 0 1px 0 rgba(255,255,255,0.20) !important;
}

/* Gradient 8 — Teal Warm */
.kpi-card.gradient-8,
.kpi-detail-card.gradient-8 {
    background: linear-gradient(135deg, var(--kpi-8-from) 0%, var(--kpi-8-to) 50%, var(--kpi-8-from) 100%) !important;
    border-top-color: rgba(58, 168, 130, 0.55) !important;
}
.kpi-card.gradient-8 .kpi-icon { background: linear-gradient(145deg, rgba(58,168,130,0.35), rgba(58,168,130,0.10)); }
.kpi-card.gradient-8:hover, .kpi-detail-card.gradient-8:hover {
    box-shadow: 0 20px 52px rgba(0,0,0,0.40), 0 0 45px var(--kpi-8-glow), inset 0 1px 0 rgba(255,255,255,0.20) !important;
}

/* ==================== KPI CLICKABLE — MODERN VARIANT ==================== */
.kpi-clickable {
    position: relative;
}

/* Bottom accent line — animated glow strip */
.kpi-clickable::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.35) 40%,
        rgba(255, 255, 255, 0.55) 50%,
        rgba(255, 255, 255, 0.35) 60%,
        transparent
    );
    transition: all 0.4s var(--ds-ease-out);
    z-index: 4;
    opacity: 0.6;
}

.kpi-clickable:hover::before {
    left: 8%;
    right: 8%;
    height: 3px;
    opacity: 1;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.50) 30%,
        rgba(255, 255, 255, 0.80) 50%,
        rgba(255, 255, 255, 0.50) 70%,
        transparent
    );
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.25);
}

/* ==================== SECTION HEADERS ==================== */
/* Use h3 + h2 selectors to beat style.css specificity (h3.section-header rule) */
.section-header,
h3.section-header,
h2.section-header {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: rgba(255, 255, 255, 0.92) !important;
    margin: 0 0 14px 0 !important;
    padding: 8px 0 !important;
    border-bottom: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    position: relative;
}

.section-header i {
    color: var(--ds-gold-500);
    font-size: 15px;
}

.section-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--ds-border-emphasis), transparent);
    margin-left: 12px;
}

/* ==================== CARD COMPONENT REDESIGN ==================== */
.card {
    background: var(--ds-surface-2);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-lg);
    box-shadow: var(--ds-shadow-md);
    transition: all var(--ds-duration-normal) var(--ds-ease-out);
    animation: ds-slideUp 0.5s var(--ds-ease-out) both;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--ds-shadow-lg);
    border-color: var(--ds-border-emphasis);
}

.card-header {
    background: linear-gradient(135deg, var(--ds-surface-1) 0%, var(--ds-surface-2) 100%);
    padding: 18px 24px;
    border-bottom: 1px solid var(--ds-border-default);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.card-title {
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--ds-gold-500) 0%, var(--ds-warm-400) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.3px;
    border-bottom: none;
    padding-bottom: 0;
}

.card-body {
    padding: 22px 24px;
}

/* Remove card-body padding when it directly wraps a table */
.card-body:has(> .table-container) {
    padding: 0;
}

/* ==================== TABLE REDESIGN ==================== */
.table-container {
    background: var(--ds-surface-2);
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    overflow: auto;
    border: none;
}

table {
    border-collapse: separate;
    border-spacing: 0;
}

thead tr {
    background: linear-gradient(135deg, var(--ds-surface-3) 0%, var(--ds-surface-4) 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

thead th {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ds-gold-500);
    padding: 14px 16px;
    border-bottom: 2px solid var(--ds-border-emphasis);
    white-space: nowrap;
}

tbody tr {
    transition: background var(--ds-duration-fast) ease;
    background: var(--ds-surface-2);
}

tbody tr:nth-child(even) {
    background: var(--ds-surface-3);
}

tbody tr:hover {
    background: var(--ds-surface-3) !important;
    filter: brightness(1.1);
}

tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ds-text-secondary);
    vertical-align: middle;
}

/* ==================== FORM CONTROLS REDESIGN ==================== */
.form-control {
    background: var(--ds-surface-2);
    border: 1.5px solid var(--ds-border-emphasis);
    color: var(--ds-text-primary);
    padding: 12px 16px;
    border-radius: var(--ds-radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--ds-duration-normal) var(--ds-ease-out);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.form-control:hover {
    border-color: rgba(212, 175, 55, 0.45);
    background: var(--ds-surface-3);
}

.form-control:focus {
    outline: none;
    border-color: var(--ds-gold-500);
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.1),
        0 0 0 3px rgba(212, 175, 55, 0.15),
        0 0 16px rgba(212, 175, 55, 0.08);
    background: var(--ds-surface-3);
}

.form-control[readonly] {
    background: var(--ds-surface-1);
    border-color: var(--ds-border-default);
    opacity: 0.8;
    cursor: default;
}

.form-control::placeholder {
    color: var(--ds-text-tertiary);
    font-weight: 400;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

.form-label {
    color: var(--ds-text-secondary);
    font-weight: 700;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    display: block;
}

select {
    background: var(--ds-surface-2) !important;
    border: 1.5px solid var(--ds-border-emphasis) !important;
    color: var(--ds-text-primary) !important;
    border-radius: var(--ds-radius-sm) !important;
    padding: 12px 16px !important;
    transition: all var(--ds-duration-normal) var(--ds-ease-out) !important;
    cursor: pointer !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15) !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d4af37' d='M6 8.825L0.575 3.4l1.05-1.05L6 6.725l4.375-4.375 1.05 1.05z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: left 14px center !important;
    padding-left: 36px !important;
}

[dir="ltr"] select,
html:not([dir="rtl"]) select {
    background-position: right 14px center !important;
    padding-left: 16px !important;
    padding-right: 36px !important;
}

select:hover {
    border-color: rgba(212, 175, 55, 0.45) !important;
    background-color: var(--ds-surface-3) !important;
}

select:focus {
    border-color: var(--ds-gold-500) !important;
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.1),
        0 0 0 3px rgba(212, 175, 55, 0.15) !important;
}

select option {
    background: var(--ds-surface-2) !important;
    color: var(--ds-text-primary) !important;
    padding: 10px !important;
}

select:disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
}

/* ==================== BUTTON REDESIGN ==================== */
.btn {
    padding: 10px 20px;
    border-radius: var(--ds-radius-sm);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--ds-duration-normal) var(--ds-ease-out);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 60%);
    pointer-events: none;
    border-radius: inherit;
}

.btn:hover {
    transform: translateY(-1px) !important;
    filter: brightness(1.1);
}

.btn:active {
    transform: translateY(0) !important;
    filter: brightness(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, var(--ds-gold-500) 0%, #b8941f 100%);
    color: var(--ds-surface-0) !important;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.25);
    border: none;
}

.btn-primary:hover {
    box-shadow: 0 4px 18px rgba(212, 175, 55, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    border: none;
    color: white !important;
    box-shadow: 0 2px 10px rgba(72, 187, 120, 0.2);
}

.btn-danger {
    background: linear-gradient(135deg, #fc5c65 0%, #eb3b5a 100%);
    border: none;
    color: white !important;
    box-shadow: 0 2px 10px rgba(235, 59, 90, 0.2);
}

.btn-info {
    background: linear-gradient(135deg, #45aaf2 0%, #2d98da 100%);
    border: none;
    color: white !important;
    box-shadow: 0 2px 10px rgba(45, 152, 218, 0.2);
}

.btn-warning {
    background: linear-gradient(135deg, #f7b731 0%, #e6a020 100%);
    border: none;
    color: var(--ds-surface-0) !important;
    box-shadow: 0 2px 10px rgba(247, 183, 49, 0.2);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12.5px;
}

/* Icon-only buttons: center the icon */
.btn-sm:has(> i:only-child),
.btn-sm:has(> .fas:only-child),
.btn-sm:has(> .far:only-child),
.btn-sm:has(> .fab:only-child) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    line-height: 1;
}

.btn-logout {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
    border: none !important;
    box-shadow: 0 2px 12px rgba(231, 76, 60, 0.25);
}

.btn-logout:hover {
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.4) !important;
}

/* ==================== SIDEBAR REDESIGN ==================== */
.sidebar {
    background: linear-gradient(180deg, var(--ds-surface-1) 0%, var(--ds-teal-700) 60%, var(--ds-teal-800) 100%);
    box-shadow: 3px 0 24px rgba(0, 0, 0, 0.35);
    border-right: 1px solid var(--ds-border-subtle);
}

.sidebar-header {
    position: relative;
    padding: 22px 18px;
    border-bottom: 1px solid var(--ds-border-default);
}

.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ds-gold-500), transparent);
}

.sidebar-title {
    font-size: 15px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.93);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.sidebar-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    margin-top: 4px;
}

.menu-item {
    padding: 11px 18px;
    margin: 2px 8px;
    border-radius: var(--ds-radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.78);
    transition: all var(--ds-duration-normal) var(--ds-ease-out);
    position: relative;
}

.menu-item:hover {
    background: rgba(212, 175, 55, 0.08);
    color: #ffffff;
    padding-left: 22px;
    transform: none;
}

.menu-item.active {
    background: rgba(212, 175, 55, 0.12);
    color: var(--ds-gold-500);
    border-right: none;
    border-bottom: none;
    box-shadow: inset 3px 0 0 var(--ds-gold-500);
}

.menu-item.active .menu-icon {
    color: var(--ds-gold-500);
}

.menu-icon {
    font-size: 17px;
    margin-right: 14px;
    width: 22px;
    text-align: center;
    opacity: 0.8;
    transition: all var(--ds-duration-normal) ease;
}

.menu-item:hover .menu-icon {
    opacity: 1;
    color: var(--ds-gold-500);
    transform: none;
}

/* Sidebar Footer */
.sidebar-footer {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.25) 100%);
    border-top: 1px solid var(--ds-border-default);
    padding: 16px;
    backdrop-filter: blur(10px);
}

.sidebar-footer .user-info {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--ds-border-subtle);
    border-radius: var(--ds-radius-md);
    padding: 10px 12px;
    margin-bottom: 14px;
    transition: all var(--ds-duration-normal) ease;
}

.sidebar-footer .user-info:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--ds-border-default);
}

.sidebar-footer .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ds-gold-500) 0%, var(--ds-warm-500) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 18px;
    color: var(--ds-surface-0);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.25);
}

/* ==================== MODAL REDESIGN ==================== */
.modal-content {
    background: linear-gradient(160deg, var(--ds-surface-3) 0%, var(--ds-surface-2) 100%);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-xl);
    box-shadow: var(--ds-shadow-xl), 0 0 60px rgba(0, 0, 0, 0.3);
    animation: ds-scaleIn 0.25s var(--ds-ease-spring) both;
}

.modal-header {
    background: linear-gradient(135deg, var(--ds-surface-1) 0%, var(--ds-surface-2) 100%);
    border-bottom: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-xl) var(--ds-radius-xl) 0 0;
    padding: 18px 24px;
    position: relative;
}

.modal-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
}

.modal-title {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--ds-gold-500) 0%, var(--ds-warm-400) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.3px;
}

/* ==================== STATUS BADGES REDESIGN ==================== */
.status-badge {
    padding: 5px 12px;
    border-radius: var(--ds-radius-pill);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid transparent;
    transition: all var(--ds-duration-fast) ease;
}

.status-badge:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

/* ==================== ALERT REDESIGN ==================== */
.alert {
    border-radius: var(--ds-radius-md);
    padding: 14px 20px;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid transparent;
    box-shadow: var(--ds-shadow-sm);
    animation: ds-slideDown 0.3s var(--ds-ease-out);
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-danger {
    background: rgba(235, 59, 90, 0.15);
    border-color: rgba(235, 59, 90, 0.3);
    color: #fc5c65;
}

.alert-success {
    background: rgba(38, 222, 129, 0.15);
    border-color: rgba(38, 222, 129, 0.3);
    color: #26de81;
}

/* ==================== DROPDOWN REDESIGN ==================== */
.dropdown-menu {
    background: var(--ds-surface-2);
    border: 1px solid var(--ds-border-emphasis);
    border-radius: var(--ds-radius-md);
    box-shadow: var(--ds-shadow-lg);
    padding: 6px;
    animation: ds-slideDown 0.2s var(--ds-ease-out);
}

.dropdown-item {
    padding: 10px 14px;
    border-radius: var(--ds-radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    transition: all var(--ds-duration-fast) ease;
    border-bottom: none;
    margin: 2px 0;
}

.dropdown-item:hover {
    background: rgba(212, 175, 55, 0.1);
    color: var(--ds-gold-500) !important;
    transform: none;
}

/* ==================== FILTERS REDESIGN ==================== */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
    padding: 18px 20px;
    background: var(--ds-surface-1);
    border-radius: var(--ds-radius-md);
    border: 1px solid var(--ds-border-subtle);
    align-items: end;
}

.filter-item {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.filter-item label {
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .filters {
        grid-template-columns: 1fr;
    }
}

.filters input,
.filters select {
    background: var(--ds-surface-2) !important;
    border: 1.5px solid var(--ds-border-emphasis) !important;
    color: var(--ds-text-primary) !important;
    padding: 11px 16px;
    border-radius: var(--ds-radius-sm);
    font-size: 13.5px;
    transition: all var(--ds-duration-normal) ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.filters input:hover,
.filters select:hover {
    border-color: rgba(212, 175, 55, 0.45) !important;
}

.filters input:focus,
.filters select:focus {
    border-color: var(--ds-gold-500) !important;
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.1),
        0 0 0 3px rgba(212, 175, 55, 0.12) !important;
}

/* ==================== NOTIFICATION WIDGET ==================== */
.notification-widget .notification-bell {
    transition: all var(--ds-duration-normal) var(--ds-ease-spring);
}

.notification-widget .notification-bell:hover {
    transform: scale(1.1);
}

/* ==================== LOADING OVERLAY ==================== */
.loading-overlay {
    background: rgba(15, 37, 40, 0.85);
    backdrop-filter: blur(8px);
}

/* ==================== PAGE FOOTER ==================== */
.page-footer {
    background: linear-gradient(180deg, var(--ds-surface-1) 0%, var(--ds-teal-700) 100%);
    border-top: 1px solid var(--ds-border-default);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
}

/* ==================== KPI DETAIL PAGE COMPONENTS ==================== */
/* Override for detail KPI cards on KPI sub-pages */
.kpi-detail-card {
    border-radius: var(--ds-radius-xl) !important;
    padding: 22px 20px !important;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all var(--ds-duration-normal) var(--ds-ease-spring);
    animation: ds-slideUp 0.4s var(--ds-ease-out) both;
}

.kpi-detail-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(165deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0.02) 40%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    border-radius: inherit;
}

.kpi-detail-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), 0 0 24px rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.22) !important;
}

/* Stagger KPI detail cards */
.kpi-summary-row .kpi-detail-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-summary-row .kpi-detail-card:nth-child(2) { animation-delay: 0.10s; }
.kpi-summary-row .kpi-detail-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-summary-row .kpi-detail-card:nth-child(4) { animation-delay: 0.20s; }
.kpi-summary-row .kpi-detail-card:nth-child(5) { animation-delay: 0.25s; }
.kpi-summary-row .kpi-detail-card:nth-child(6) { animation-delay: 0.30s; }
.kpi-summary-row .kpi-detail-card:nth-child(7) { animation-delay: 0.35s; }
.kpi-summary-row .kpi-detail-card:nth-child(8) { animation-delay: 0.40s; }

.kpi-card-label {
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.82) !important;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
}

.kpi-card-value {
    font-size: 30px !important;
    font-weight: 900 !important;
    color: #ffffff !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    line-height: 1.1;
    margin-bottom: 4px;
    position: relative;
    z-index: 2;
}

.kpi-card-sublabel {
    font-size: 11.5px !important;
    font-weight: 600 !important;
    color: rgba(255, 255, 255, 0.6) !important;
    position: relative;
    z-index: 2;
}

/* KPI Summary Row grid */
.kpi-summary-row {
    gap: 16px !important;
}

/* ==================== CHART CONTAINER REDESIGN ==================== */
.chart-container {
    background: var(--ds-surface-2) !important;
    border: 1px solid var(--ds-border-default) !important;
    border-radius: var(--ds-radius-lg) !important;
    padding: 22px !important;
    box-shadow: var(--ds-shadow-md);
    transition: all var(--ds-duration-normal) ease;
    animation: ds-slideUp 0.5s var(--ds-ease-out) both;
}

.chart-container:hover {
    box-shadow: var(--ds-shadow-lg);
    border-color: var(--ds-border-emphasis) !important;
}

.chart-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--ds-gold-500) !important;
    margin-bottom: 16px !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid var(--ds-border-subtle) !important;
}

/* ==================== WORKFLOW FUNNEL ==================== */
.workflow-funnel {
    background: var(--ds-surface-2);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-lg);
    padding: 22px;
    box-shadow: var(--ds-shadow-md);
}

.funnel-step {
    background: var(--ds-surface-3);
    border-radius: var(--ds-radius-md);
    padding: 14px;
    text-align: center;
    transition: all var(--ds-duration-normal) ease;
    border: 1px solid var(--ds-border-subtle);
}

.funnel-step:hover {
    background: var(--ds-surface-4);
    border-color: var(--ds-border-default);
    transform: translateY(-2px);
}

.funnel-count {
    font-size: 24px;
    font-weight: 900;
    color: var(--ds-gold-500);
}

.funnel-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ds-text-tertiary);
    margin-top: 4px;
}

/* ==================== PROGRESS BARS ==================== */
.progress-bar-container {
    background: var(--ds-surface-1);
    border-radius: var(--ds-radius-pill);
    overflow: hidden;
    height: 10px;
    border: 1px solid var(--ds-border-subtle);
}

.progress-fill {
    height: 100%;
    border-radius: var(--ds-radius-pill);
    transition: width 1.2s var(--ds-ease-out);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 60%);
    border-radius: inherit;
}

.progress-fill.green { background: linear-gradient(90deg, #38a169, #48bb78); }
.progress-fill.purple { background: linear-gradient(90deg, #805ad5, #9f7aea); }
.progress-fill.orange { background: linear-gradient(90deg, #dd6b20, #ed8936); }

/* ==================== EMPTY / LOADING STATES ==================== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--ds-text-tertiary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* ==================== PAGINATION ==================== */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    padding: 16px 0;
}

.pagination button,
.pagination a {
    min-width: 36px;
    height: 36px;
    border-radius: var(--ds-radius-sm);
    background: var(--ds-surface-3);
    border: 1px solid var(--ds-border-subtle);
    color: var(--ds-text-secondary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--ds-duration-fast) ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination button:hover,
.pagination a:hover {
    background: rgba(212, 175, 55, 0.12);
    border-color: var(--ds-border-emphasis);
    color: var(--ds-gold-500);
}

.pagination button.active,
.pagination a.active {
    background: linear-gradient(135deg, var(--ds-gold-500), #b8941f);
    color: var(--ds-surface-0);
    border-color: var(--ds-gold-500);
}

/* ==================== USER CARDS (KPI Users page) ==================== */
.user-card {
    background: var(--ds-surface-2);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-lg);
    padding: 18px;
    transition: all var(--ds-duration-normal) var(--ds-ease-out);
}

.user-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ds-shadow-md);
    border-color: var(--ds-border-emphasis);
}

/* ==================== TASK PAGE ==================== */
.task-page-item {
    background: var(--ds-surface-2);
    border-left: 3px solid var(--ds-gold-500);
    border-radius: var(--ds-radius-md);
    box-shadow: var(--ds-shadow-sm);
    transition: all var(--ds-duration-normal) var(--ds-ease-out);
}

.task-page-item:hover {
    transform: translateX(6px);
    box-shadow: var(--ds-shadow-md), var(--ds-shadow-glow-gold);
    border-left-color: var(--ds-gold-400);
}

.task-page-group {
    background: var(--ds-surface-2);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-lg);
    box-shadow: var(--ds-shadow-md);
}

/* ==================== BACK / EXPORT BUTTONS ==================== */
.back-btn {
    background: var(--ds-surface-3) !important;
    border: 1px solid var(--ds-border-default) !important;
    border-radius: var(--ds-radius-sm) !important;
    color: var(--ds-text-secondary) !important;
    font-weight: 600 !important;
    transition: all var(--ds-duration-normal) ease !important;
}

.back-btn:hover {
    border-color: var(--ds-border-emphasis) !important;
    color: var(--ds-gold-500) !important;
    background: var(--ds-surface-4) !important;
}

.export-btn {
    background: linear-gradient(135deg, var(--ds-gold-500), #b8941f) !important;
    color: var(--ds-surface-0) !important;
    border: none !important;
    border-radius: var(--ds-radius-sm) !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.25);
    transition: all var(--ds-duration-normal) ease !important;
}

.export-btn:hover {
    box-shadow: 0 4px 18px rgba(212, 175, 55, 0.4) !important;
    transform: translateY(-1px);
}

/* ==================== LOGIN PAGE ENHANCEMENT ==================== */
.login-box {
    background: rgba(30, 61, 66, 0.6);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-2xl);
    box-shadow: var(--ds-shadow-xl), 0 0 80px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
}

.login-container {
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(90, 181, 189, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(212, 175, 55, 0.06) 0%, transparent 50%),
        linear-gradient(160deg, #1a3a40 0%, #2a6169 40%, #244951 100%);
}

/* ==================== RESPONSIVE ADJUSTMENTS ==================== */
@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
    
    .kpi-card {
        padding: 16px 14px;
        border-radius: var(--ds-radius-lg);
    }
    
    .kpi-value {
        font-size: 26px !important;
    }
    
    .kpi-title {
        font-size: 11px;
    }
    
    .kpi-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .header {
        padding: 14px 18px;
    }
    
    .header-title {
        font-size: 20px;
    }
    
    .card-header {
        padding: 14px 16px;
    }
    
    .card-body {
        padding: 14px 16px;
    }

    .card-body:has(> .table-container) {
        padding: 0;
    }
    
    .section-header {
        font-size: 14px !important;
    }
    
    .kpi-detail-card {
        padding: 16px 14px !important;
    }
    
    .kpi-card-value {
        font-size: 24px !important;
    }
    
    .chart-container {
        padding: 14px !important;
    }
}

@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    
    .kpi-card {
        padding: 14px 12px;
    }
    
    .kpi-value {
        font-size: 22px !important;
    }
    
    .kpi-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== PRINT ==================== */
@media print {
    .sidebar, .page-footer, .header-actions, .btn-logout, #langToggle { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .kpi-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
    body { background: white !important; color: black !important; }
}

/* ==================== TABLE CARD BODY — NO PADDING, MATCHED BG ==================== */
.table-card {
    background: var(--ds-surface-2) !important;
    overflow: hidden !important;
}

.table-card-body {
    padding: 0 !important;
    background: var(--ds-surface-2) !important;
}

.table-card-body > .table-container {
    border-radius: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: var(--ds-surface-2) !important;
}
