/* ═══════════════════════════════════════════════════════════════
   WarelyPOS Admin — Warely Design System (WDS v1)
   Values mirror Theme/WarelyTheme.cs — change both together (doc 97)
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens (doc 97 §3) ── */
:root {
    /* Brand (warely.ai, doc 97 §1) */
    --w-brand: #E11D27;
    --w-brand-dark: #B80800;
    --w-brand-light: #FB3640;
    --w-brand-subtle: #FDF1F1;
    --w-brand-alpha-12: rgba(225, 29, 39, 0.12);
    --w-brand-alpha-06: rgba(225, 29, 39, 0.06);

    /* Accent — warely.ai orange (Secondary) */
    --w-accent: #F26522;
    --w-accent-dark: #D14E0E;
    --w-accent-light: #F58B4C;
    --w-accent-subtle: #FEF0E7;

    /* Teal (legacy chart accent — no doc 97 counterpart) */
    --w-teal: #14b8a6;
    --w-teal-dark: #0d9488;
    --w-teal-subtle: #F0FDFA;

    /* Semantic (doc 97 §3.3) — subtle = 10% chip tint, strong = chip text */
    --w-info: #2E90FA;
    --w-info-subtle: #EFF8FF;
    --w-info-strong: #175CD3;
    --w-success: #12B76A;
    --w-success-subtle: #ECFDF3;
    --w-success-strong: #067647;
    --w-warning: #F79009;
    --w-warning-subtle: #FFFAEB;
    --w-warning-strong: #B54708;
    --w-error: #D92D20;
    --w-error-subtle: #FEF3F2;
    --w-error-strong: #B42318;

    /* Ink — warm near-black text (doc 97 §1) */
    --w-ink: #160B0B;
    --w-ink-secondary: #313131;
    --w-ink-muted: #5A5A5A;

    /* Neutral ramp (doc 97 §3.1) */
    --w-neutral-25: #FCFCFD;
    --w-neutral-50: #FAFAFA;
    --w-neutral-100: #F4F4F5;
    --w-neutral-200: #E4E4E7;
    --w-neutral-300: #D4D4D8;
    --w-neutral-400: #A1A1AA;
    --w-neutral-500: #71717A;
    --w-neutral-600: #52525B;
    --w-neutral-700: #3F3F46;
    --w-neutral-800: #27272A;
    --w-neutral-900: #18181B;

    /* Hairlines */
    --w-line: #ECECEE;
    --w-line-soft: #F4F4F5;

    /* Surfaces */
    --w-bg: #F7F7F8;
    --w-surface: #ffffff;
    --w-surface-raised: #ffffff;
    --w-surface-overlay: rgba(255, 255, 255, 0.85);

    /* Sidebar — light drawer (doc 97 §4; no longer dark navy) */
    --w-sidebar-bg: var(--w-surface);
    --w-sidebar-text: var(--w-neutral-700);
    --w-sidebar-text-active: var(--w-brand);
    --w-sidebar-icon: var(--w-neutral-500);
    --w-sidebar-hover: var(--w-neutral-100);
    --w-sidebar-active: var(--w-brand-subtle);

    /* Spacing scale (4px base) */
    --w-space-0: 0px;
    --w-space-1: 4px;
    --w-space-2: 8px;
    --w-space-3: 12px;
    --w-space-4: 16px;
    --w-space-5: 20px;
    --w-space-6: 24px;
    --w-space-8: 32px;
    --w-space-10: 40px;
    --w-space-12: 48px;
    --w-space-16: 64px;

    /* Radii (doc 97 §3.5 — inputs/buttons 10px, cards 14px, dialogs 16px) */
    --w-radius-sm: 6px;
    --w-radius-md: 10px;
    --w-radius: 12px;
    --w-radius-lg: 14px;
    --w-radius-xl: 16px;
    --w-radius-2xl: 20px;
    --w-radius-full: 9999px;

    /* Shadows (doc 97 §3.5 — warm-tinted, no heavy material) */
    --w-shadow-xs: 0 1px 2px rgba(16, 11, 11, 0.05);
    --w-shadow-sm: 0 1px 2px rgba(16, 11, 11, 0.05), 0 1px 3px rgba(16, 11, 11, 0.06);
    --w-shadow-md: 0 4px 6px -1px rgba(16, 11, 11, 0.06), 0 2px 4px -2px rgba(16, 11, 11, 0.04);
    --w-shadow-lg: 0 12px 24px rgba(16, 11, 11, 0.12);
    --w-shadow-focus: 0 0 0 3px var(--w-brand-alpha-12);

    /* Borders — theme-aware via MudBlazor palette vars (light + dark) */
    --w-border: 1px solid var(--mud-palette-lines-default, var(--w-line));
    --w-border-light: 1px solid var(--mud-palette-divider, var(--w-line));

    /* Transitions */
    --w-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --w-ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
    --w-duration-fast: 120ms;
    --w-duration: 200ms;
    --w-duration-slow: 300ms;

    /* Typography — Sora display + Inter body (doc 97 §3.4) */
    --w-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --w-font-display: 'Sora', sans-serif;
    --w-font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}


/* ── Reset & Base ── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-family: var(--w-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    background: var(--w-bg);
    color: var(--w-ink);
    line-height: 1.5;
}

::selection {
    background: var(--w-brand-alpha-12);
    color: var(--w-brand-dark);
}


/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--w-neutral-300);
    border-radius: 3px;
    transition: background var(--w-duration) var(--w-ease);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--w-neutral-400);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--w-neutral-300) transparent;
}


/* ────────────────────────────────────────
   Loading Screen
   ──────────────────────────────────────── */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--w-bg);
    font-family: var(--w-font);
    gap: var(--w-space-4);
}

.loading-logo-wrapper {
    position: relative;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-logo {
    width: 40px;
    height: 40px;
    z-index: 1;
}

.loading-ring {
    position: absolute;
    inset: 0;
    border: 2px solid var(--w-neutral-200);
    border-top-color: var(--w-brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-brand {
    font-family: var(--w-font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--w-ink);
    letter-spacing: -0.02em;
}

.loading-subtitle {
    font-size: 0.8125rem;
    color: var(--w-ink-muted);
    font-weight: 400;
}

.loading-dots {
    display: flex;
    gap: 6px;
    margin-top: var(--w-space-2);
}

.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--w-neutral-300);
    animation: dot-bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.32s;
}

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

@keyframes dot-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}


/* ────────────────────────────────────────
   Error UI
   ──────────────────────────────────────── */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--w-space-3) var(--w-space-6);
    background: var(--w-error-subtle);
    color: var(--w-error-strong);
    font-family: var(--w-font);
    font-size: 0.8125rem;
    text-align: center;
    z-index: 9999;
    border-top: 2px solid rgba(217, 45, 32, 0.25);
    backdrop-filter: blur(8px);
}

#blazor-error-ui .reload {
    color: var(--w-error);
    text-decoration: underline;
    text-underline-offset: 2px;
    margin-left: var(--w-space-2);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: var(--w-space-4);
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.6;
    transition: opacity var(--w-duration-fast) var(--w-ease);
}

#blazor-error-ui .dismiss:hover {
    opacity: 1;
}


/* ────────────────────────────────────────
   Login Page
   ──────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--w-space-6);
    background: var(--w-neutral-900);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(225, 29, 39, 0.16) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(242, 101, 34, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(46, 144, 250, 0.08) 0%, transparent 50%);
    animation: login-bg-shift 20s ease-in-out infinite alternate;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='m36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm-30 30v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

@keyframes login-bg-shift {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.login-card {
    position: relative;
    max-width: 420px;
    width: 100%;
    border-radius: var(--w-radius-2xl);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 20px 50px rgba(0, 0, 0, 0.3),
        0 0 100px rgba(225, 29, 39, 0.05);
    z-index: 1;
}

.login-form-section {
    padding: 40px 36px;
    display: flex;
    flex-direction: column;
}

/* Logo row */
.login-logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 4px;
}

.login-logo-section img {
    width: 36px;
    height: 36px;
}

.login-logo-section .brand-text {
    font-family: var(--w-font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

/* Field labels */
.login-field-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

/* Form inputs - override MudBlazor defaults for dark glassmorphic card */
.login-form-section .mud-input-control {
    margin-bottom: 0;
}

.login-form-section .mud-typography {
    color: rgba(255, 255, 255, 0.9) !important;
}

.login-form-section .mud-input-label {
    color: rgba(255, 255, 255, 0.5) !important;
}

.login-form-section .mud-input {
    color: rgba(255, 255, 255, 0.9) !important;
}

.login-form-section .mud-input-slot {
    color: rgba(255, 255, 255, 0.4) !important;
}

.login-form-section .mud-input-outlined .mud-input-outlined-border {
    border-color: rgba(255, 255, 255, 0.15) !important;
}

.login-form-section .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: rgba(255, 255, 255, 0.3) !important;
}

.login-form-section .mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--w-brand-light) !important;
}

.login-form-section .mud-input-adorned-start .mud-input-adornment-start {
    color: rgba(255, 255, 255, 0.4) !important;
}

.login-form-section .mud-input-adorned-end .mud-input-adornment-end {
    color: rgba(255, 255, 255, 0.4) !important;
}

.login-form-section .mud-input-adorned-end .mud-input-adornment-end:hover {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* Placeholder text */
.login-form-section .mud-input > input::placeholder {
    color: rgba(255, 255, 255, 0.3) !important;
}

/* Validation error text */
.login-form-section .mud-input-helper-text {
    color: var(--w-brand-light) !important;
}

@media (max-width: 480px) {
    .login-card {
        max-width: 100%;
        border-radius: var(--w-radius-xl);
    }
    .login-form-section {
        padding: 32px 24px;
    }
}


/* ────────────────────────────────────────
   Sidebar / Drawer — light surface (doc 97 §4)
   Colors come from the theme palette so dark mode stays correct.
   ──────────────────────────────────────── */

/* Drawer base */
.mud-drawer {
    border-right: none !important;
}

.mud-drawer-content {
    background: var(--mud-palette-drawer-background, var(--w-sidebar-bg)) !important;
    border-right: 1px solid var(--mud-palette-lines-default, var(--w-line)) !important;
}

/* Sidebar content flex layout */
.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-nav-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
}

.sidebar-nav-scroll::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb {
    background: var(--mud-palette-action-disabled, var(--w-neutral-300));
    border-radius: 2px;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--mud-palette-action-default, var(--w-neutral-500));
}

/* Nav menu base */
.nav-menu-main {
    padding: 0 10px;
}

/* Section labels */
.nav-section-label {
    padding: 20px 12px 6px;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary, var(--w-ink-muted));
    user-select: none;
    line-height: 1;
}

.nav-section-label--platform {
    color: var(--mud-palette-primary, var(--w-brand)) !important;
}

/* Nav items */
.mud-navmenu .mud-nav-link {
    margin: 1px 0;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    color: var(--mud-palette-drawer-text, var(--w-sidebar-text)) !important;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 150ms var(--w-ease);
    gap: 10px;
    min-height: 36px;
}

.mud-navmenu .mud-nav-link:hover {
    background: var(--mud-palette-action-default-hover, var(--w-sidebar-hover)) !important;
    color: var(--mud-palette-text-primary, var(--w-ink)) !important;
}

.mud-navmenu .mud-nav-link .mud-nav-link-icon {
    color: var(--mud-palette-drawer-icon, var(--w-sidebar-icon)) !important;
    font-size: 1.25rem !important;
    transition: color 150ms var(--w-ease);
}

.mud-navmenu .mud-nav-link:hover .mud-nav-link-icon {
    color: var(--mud-palette-text-primary, var(--w-ink)) !important;
}

/* Active nav link — PrimaryTint pill + Primary text + 3px indicator (doc 97 §4) */
.mud-nav-link.active {
    position: relative;
    background: var(--w-sidebar-active) !important;
    color: var(--mud-palette-primary, var(--w-brand)) !important;
    border-radius: 8px !important;
    font-weight: 600;
}

.mud-nav-link.active .mud-nav-link-icon {
    color: var(--mud-palette-primary, var(--w-brand)) !important;
}

.mud-nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    border-radius: 3px;
    background: var(--mud-palette-primary, var(--w-brand));
}

/* Nav group header */
.mud-navmenu .mud-nav-group-text {
    font-weight: 600;
    font-size: 0.8125rem;
}

/* Nav group children */
.mud-nav-group .mud-nav-link {
    font-size: 0.8125rem;
    padding-left: 42px !important;
    min-height: 32px;
    color: var(--mud-palette-text-secondary, var(--w-ink-muted)) !important;
}

.mud-nav-group .mud-nav-link:hover {
    color: var(--mud-palette-text-primary, var(--w-ink)) !important;
}

.mud-nav-group .mud-nav-link.active {
    color: var(--mud-palette-primary, var(--w-brand)) !important;
    background: transparent !important;
    font-weight: 600;
}

.mud-nav-group .mud-nav-link.active::before {
    content: '';
    position: absolute;
    left: 26px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--mud-palette-primary, var(--w-brand));
}

/* Nav group expand icon */
.mud-navmenu .mud-nav-group .mud-collapse-entering,
.mud-navmenu .mud-nav-group .mud-collapse-entered {
    border-left: none;
}

/* Sidebar status dot */
.sidebar-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--w-success);
    box-shadow: 0 0 6px rgba(18, 183, 106, 0.4);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Sidebar footer */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--mud-palette-lines-default, var(--w-line));
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

/* Mini drawer overrides */
.mud-drawer--mini .nav-section-label {
    display: none;
}

.mud-drawer--mini .mud-nav-group-text {
    display: none;
}

.mud-drawer--mini .sidebar-footer {
    justify-content: center;
    padding: 12px 8px;
}

.mud-drawer--mini .sidebar-footer .mud-typography {
    display: none;
}

.mud-drawer--mini .mud-navmenu .mud-nav-link {
    justify-content: center;
    padding: 8px !important;
}

/* Overline typography in sidebar */
.mud-navmenu .mud-typography-overline {
    display: none;
}


/* ────────────────────────────────────────
   App Bar — 64px surface with hairline (doc 97 §4)
   ──────────────────────────────────────── */
.app-bar-border {
    border-bottom: var(--w-border);
}

.mud-appbar {
    background: var(--mud-palette-appbar-background, var(--w-surface)) !important;
    border-bottom: 1px solid var(--mud-palette-lines-default, var(--w-line)) !important;
}

/* Brand icon in appbar */
.brand-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--w-brand) 0%, var(--w-brand-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Search bar in appbar */
.appbar-search-container {
    max-width: 400px;
    width: 100%;
}

.appbar-search .mud-input-outlined .mud-input-outlined-border {
    border-color: var(--mud-palette-lines-inputs, var(--w-neutral-300)) !important;
    border-radius: var(--w-radius-md) !important;
    background: var(--mud-palette-background, var(--w-bg)) !important;
}

.appbar-search .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: var(--w-neutral-400) !important;
}

.appbar-search .mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--mud-palette-primary, var(--w-brand)) !important;
    background: var(--mud-palette-surface, var(--w-surface)) !important;
}

.appbar-search .mud-input {
    font-size: 0.8125rem !important;
}

/* User menu trigger */
.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: var(--w-radius-md);
    cursor: pointer;
    transition: background 150ms var(--w-ease);
}

.user-menu-trigger:hover {
    background: var(--mud-palette-action-default-hover, var(--w-neutral-100));
}

.user-menu-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.user-menu-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.user-menu-role {
    font-size: 0.6875rem;
    color: var(--mud-palette-text-secondary);
}


/* ────────────────────────────────────────
   Content Area
   ──────────────────────────────────────── */
.mud-main-content {
    transition: margin-left var(--w-duration) var(--w-ease);
    background: var(--mud-palette-background, var(--w-bg));
}


/* ────────────────────────────────────────
   Page Header
   ──────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--w-space-4);
    margin-bottom: var(--w-space-6);
}

.page-header-title {
    display: flex;
    flex-direction: column;
    gap: var(--w-space-1);
}

.page-header-title h1,
.page-header-title .mud-typography-h4,
.page-header-title .mud-typography-h5 {
    font-family: var(--w-font-display);
    letter-spacing: -0.02em;
}


/* ────────────────────────────────────────
   Cards
   ──────────────────────────────────────── */
.mud-paper {
    border: var(--w-border) !important;
    box-shadow: none !important;
    border-radius: var(--w-radius-lg) !important;
    transition: border-color var(--w-duration) var(--w-ease),
                transform var(--w-duration) var(--w-ease-spring);
}

.mud-card {
    border: var(--w-border) !important;
    box-shadow: none !important;
    border-radius: var(--w-radius-lg) !important;
}

/* Section headers inside cards */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--w-space-4);
    margin-bottom: var(--w-space-4);
    border-bottom: var(--w-border-light);
}


/* ────────────────────────────────────────
   Stat Cards
   ──────────────────────────────────────── */
.stat-card {
    border: var(--w-border) !important;
    border-radius: var(--w-radius-lg) !important;
    transition: border-color var(--w-duration) var(--w-ease),
                transform var(--w-duration-slow) var(--w-ease-spring),
                box-shadow var(--w-duration) var(--w-ease);
    position: relative;
    overflow: hidden;
    padding: 20px;
}

.stat-card:hover {
    border-color: var(--mud-palette-lines-inputs, var(--w-neutral-300)) !important;
    transform: translateY(-2px);
    box-shadow: var(--w-shadow-md);
}

.stat-card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--w-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card-icon.brand {
    background: linear-gradient(135deg, var(--w-brand) 0%, var(--w-brand-dark) 100%);
    color: #ffffff;
}

.stat-card-icon.success {
    background: linear-gradient(135deg, var(--w-success) 0%, #039855 100%);
    color: #ffffff;
}

.stat-card-icon.info {
    background: linear-gradient(135deg, var(--w-info) 0%, #1570EF 100%);
    color: #ffffff;
}

.stat-card-icon.accent {
    background: linear-gradient(135deg, var(--w-accent) 0%, var(--w-accent-dark) 100%);
    color: #ffffff;
}

.stat-card-icon.warning {
    background: linear-gradient(135deg, var(--w-warning) 0%, #DC6803 100%);
    color: #ffffff;
}

.stat-card-icon.teal {
    background: linear-gradient(135deg, var(--w-teal) 0%, var(--w-teal-dark) 100%);
    color: #ffffff;
}

/* Home dashboard KPI icon tiles (doc 97 §6) — token vars only, no raw hex in pages */
.kpi-icon--revenue {
    background: var(--w-success-subtle);
    color: var(--w-success-strong);
}

.kpi-icon--orders {
    background: var(--w-info-subtle);
    color: var(--w-info-strong);
}

.kpi-icon--tables {
    background: var(--w-warning-subtle);
    color: var(--w-warning-strong);
}

.kpi-icon--avg {
    background: var(--w-accent-subtle);
    color: var(--w-accent-dark);
}


/* ────────────────────────────────────────
   Dashboard
   ──────────────────────────────────────── */
.dashboard-card {
    border: var(--w-border) !important;
    border-radius: var(--w-radius-lg) !important;
    transition: border-color var(--w-duration) var(--w-ease);
}

.dashboard-card:hover {
    border-color: var(--mud-palette-lines-inputs, var(--w-neutral-300)) !important;
}

/* Chart placeholder with animated bars */
.chart-placeholder {
    height: 260px;
    position: relative;
    background: var(--mud-palette-background, var(--w-bg));
    border-radius: var(--w-radius-md);
    overflow: hidden;
}

.chart-placeholder-bars {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding: 0 16px 0;
    height: 100%;
}

.chart-bar {
    width: 7%;
    min-width: 24px;
    background: linear-gradient(180deg, rgba(225, 29, 39, 0.25) 0%, rgba(225, 29, 39, 0.08) 100%);
    border-radius: 4px 4px 0 0;
    animation: chartBarGrow 0.6s var(--w-ease-spring) both;
}

@keyframes chartBarGrow {
    from { height: 0 !important; }
}

.chart-placeholder-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--mud-palette-text-secondary, var(--w-ink-muted));
}

/* Quick Stats panel */
.quick-stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}

.quick-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--w-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Top Products list */
.top-product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.top-product-rank {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--w-neutral-100);
    color: var(--w-neutral-500);
    flex-shrink: 0;
}

.top-product-rank.top-three {
    background: var(--w-brand-subtle);
    color: var(--w-brand-dark);
}


/* ────────────────────────────────────────
   Tables (MudDataGrid / MudTable)
   ──────────────────────────────────────── */
.mud-table .mud-table-head .mud-table-cell {
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--mud-palette-text-secondary, var(--w-ink-muted));
    background: var(--mud-palette-table-striped, var(--w-neutral-50));
    border-bottom: var(--w-border) !important;
    padding: var(--w-space-3) var(--w-space-4);
    white-space: nowrap;
}

.mud-table .mud-table-body .mud-table-row {
    transition: background-color var(--w-duration-fast) var(--w-ease);
}

.mud-table .mud-table-body .mud-table-row:hover {
    background-color: var(--mud-palette-table-hover, var(--w-brand-alpha-06)) !important;
}

.mud-table .mud-table-body .mud-table-cell {
    padding: var(--w-space-3) var(--w-space-4);
    font-size: 0.8125rem;
    font-feature-settings: "tnum";
    border-bottom: var(--w-border-light) !important;
    color: var(--mud-palette-text-primary, var(--w-ink));
}

.mud-table .mud-table-foot .mud-table-cell {
    font-weight: 600;
    font-size: 0.75rem;
    border-top: var(--w-border) !important;
}

/* Table container border */
.mud-table-container {
    border-radius: var(--w-radius-lg);
    border: var(--w-border);
    overflow: hidden;
}


/* ────────────────────────────────────────
   Status Badges — 10% tint bg + Darken text (doc 97 §3.3)
   ──────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--w-radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
}

.status-active,
.status-badge.active {
    color: var(--w-success-strong);
    background: var(--w-success-subtle);
    padding: 3px 10px;
    border-radius: var(--w-radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
}

.status-inactive,
.status-badge.inactive {
    color: var(--w-error-strong);
    background: var(--w-error-subtle);
    padding: 3px 10px;
    border-radius: var(--w-radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
}

.status-pending,
.status-badge.pending {
    color: var(--w-warning-strong);
    background: var(--w-warning-subtle);
    padding: 3px 10px;
    border-radius: var(--w-radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
}

.status-badge.info {
    color: var(--w-info-strong);
    background: var(--w-info-subtle);
}

.status-badge.draft {
    color: var(--w-neutral-600);
    background: var(--w-neutral-100);
}

/* Dot indicator variant */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.active { background: var(--w-success); }
.status-dot.inactive { background: var(--w-error); }
.status-dot.pending { background: var(--w-warning); }
.status-dot.info { background: var(--w-info); }


/* ────────────────────────────────────────
   Form Inputs (MudBlazor enhancements)
   ──────────────────────────────────────── */
.mud-input-outlined .mud-input-outlined-border {
    border-radius: var(--w-radius-md) !important;
    border-color: var(--mud-palette-lines-inputs, var(--w-neutral-300)) !important;
    border-width: 1px !important;
    transition: border-color var(--w-duration) var(--w-ease),
                box-shadow var(--w-duration) var(--w-ease);
}

.mud-input-outlined:hover .mud-input-outlined-border {
    border-color: var(--w-neutral-400) !important;
}

.mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--mud-palette-primary, var(--w-brand)) !important;
    box-shadow: 0 0 0 3px var(--w-brand-alpha-06);
}


/* ────────────────────────────────────────
   Buttons (enhancements)
   ──────────────────────────────────────── */
.mud-button-root {
    border-radius: var(--w-radius-md) !important;
    text-transform: none !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em;
    transition: all var(--w-duration) var(--w-ease) !important;
}

.mud-button-filled {
    box-shadow: var(--w-shadow-xs) !important;
}

.mud-button-filled:hover {
    box-shadow: var(--w-shadow-sm) !important;
}

.mud-button-outlined {
    border-width: 1px !important;
}


/* ────────────────────────────────────────
   Dialogs
   ──────────────────────────────────────── */
.mud-dialog {
    border-radius: var(--w-radius-xl) !important;
    border: var(--w-border) !important;
    box-shadow: var(--w-shadow-lg) !important;
}

.mud-dialog .mud-dialog-title {
    font-family: var(--w-font-display);
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
}

.mud-dialog .mud-input-control {
    margin-bottom: var(--w-space-2);
}

.mud-overlay {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}


/* ────────────────────────────────────────
   Chips
   ──────────────────────────────────────── */
.mud-chip {
    border-radius: var(--w-radius-full) !important;
    font-weight: 500;
    font-size: 0.75rem;
}


/* ────────────────────────────────────────
   Tabs
   ──────────────────────────────────────── */
.mud-tabs-panels {
    padding: 0 !important;
}

.mud-tab {
    text-transform: none !important;
    font-weight: 500 !important;
    letter-spacing: 0;
    font-size: 0.8125rem !important;
}


/* ────────────────────────────────────────
   Snackbar / Alerts
   ──────────────────────────────────────── */
.mud-snackbar {
    border-radius: var(--w-radius-lg) !important;
    box-shadow: var(--w-shadow-lg) !important;
    border: var(--w-border) !important;
}


/* ────────────────────────────────────────
   Tooltips
   ──────────────────────────────────────── */
.mud-tooltip {
    border-radius: var(--w-radius-sm) !important;
    font-size: 0.75rem !important;
    font-weight: 500;
    padding: var(--w-space-1) var(--w-space-2) !important;
}


/* ────────────────────────────────────────
   Skeleton Loading Animations
   ──────────────────────────────────────── */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--w-neutral-100) 25%,
        var(--w-neutral-200) 37%,
        var(--w-neutral-100) 63%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--w-radius-sm);
}

.skeleton-text {
    height: 14px;
    margin-bottom: var(--w-space-2);
    border-radius: 4px;
}

.skeleton-text.sm { height: 10px; width: 60%; }
.skeleton-text.md { height: 14px; width: 80%; }
.skeleton-text.lg { height: 20px; width: 50%; }

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
    border-radius: var(--w-radius-lg);
}

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


/* ────────────────────────────────────────
   Product Image Placeholder
   ──────────────────────────────────────── */
.product-image-placeholder {
    width: 48px;
    height: 48px;
    border-radius: var(--w-radius-md);
    background: var(--w-neutral-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--w-neutral-400);
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px dashed var(--w-neutral-200);
}


/* ────────────────────────────────────────
   Glass Morphism Utility
   ──────────────────────────────────────── */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px) saturate(1.5);
    -webkit-backdrop-filter: blur(16px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-dark {
    background: rgba(24, 24, 27, 0.75);
    backdrop-filter: blur(16px) saturate(1.5);
    -webkit-backdrop-filter: blur(16px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
}


/* ────────────────────────────────────────
   Utility Classes
   ──────────────────────────────────────── */

/* Text */
.text-primary { color: var(--mud-palette-text-primary, var(--w-ink)) !important; }
.text-secondary { color: var(--mud-palette-text-secondary, var(--w-ink-muted)) !important; }
.text-muted { color: var(--w-neutral-400) !important; }
.text-brand { color: var(--w-brand) !important; }
.text-success { color: var(--w-success) !important; }
.text-error { color: var(--w-error) !important; }
.text-warning { color: var(--w-warning) !important; }
.text-info { color: var(--w-info) !important; }

/* Display font */
.font-display { font-family: var(--w-font-display) !important; }

/* Font weight */
.font-medium { font-weight: 500 !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }

/* Tracking */
.tracking-tight { letter-spacing: -0.02em; }
.tracking-tighter { letter-spacing: -0.03em; }

/* Tabular numerics for data cells (doc 97 §3.4) */
.tnum { font-feature-settings: "tnum"; }

/* Truncation */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Gap utilities */
.gap-1 { gap: var(--w-space-1); }
.gap-2 { gap: var(--w-space-2); }
.gap-3 { gap: var(--w-space-3); }
.gap-4 { gap: var(--w-space-4); }
.gap-6 { gap: var(--w-space-6); }
.gap-8 { gap: var(--w-space-8); }

/* Rounded */
.rounded-full { border-radius: var(--w-radius-full) !important; }

/* Fade-in animation */
.fade-in {
    animation: fadeIn var(--w-duration-slow) var(--w-ease) both;
}

.fade-in-up {
    animation: fadeInUp var(--w-duration-slow) var(--w-ease) both;
}

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

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

/* Staggered children animation */
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 50ms; }
.stagger-children > *:nth-child(3) { animation-delay: 100ms; }
.stagger-children > *:nth-child(4) { animation-delay: 150ms; }
.stagger-children > *:nth-child(5) { animation-delay: 200ms; }
.stagger-children > *:nth-child(6) { animation-delay: 250ms; }


/* ────────────────────────────────────────
   Responsive
   ──────────────────────────────────────── */
@media (max-width: 599px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .hide-on-mobile {
        display: none !important;
    }
}

@media (min-width: 600px) {
    .hide-on-desktop {
        display: none !important;
    }
}


/* ────────────────────────────────────────
   Print Styles
   ──────────────────────────────────────── */
@media print {
    .mud-drawer,
    .mud-appbar,
    .no-print,
    #blazor-error-ui {
        display: none !important;
    }

    .mud-main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    body {
        background: white;
        color: black;
    }

    .mud-paper,
    .mud-card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        break-inside: avoid;
    }

    .stat-card:hover {
        transform: none;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.75rem;
        color: #666;
    }
}
