@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ===== CSS Custom Properties (HSL-based) ===== */
:root {
    --background: 210 20% 98%;
    --foreground: 220 20% 10%;

    --card: 0 0% 100%;
    --card-foreground: 220 20% 10%;

    --popover: 0 0% 100%;
    --popover-foreground: 220 20% 10%;

    --primary: 230 70% 52%;
    --primary-foreground: 0 0% 100%;

    --secondary: 210 18% 94%;
    --secondary-foreground: 220 20% 20%;

    --muted: 210 14% 95%;
    --muted-foreground: 220 10% 46%;

    --accent: 230 50% 94%;
    --accent-foreground: 230 60% 32%;

    --destructive: 0 72% 51%;
    --destructive-foreground: 0 0% 100%;

    --border: 214 20% 90%;
    --input: 214 20% 90%;
    --ring: 230 70% 52%;

    --radius: 0.625rem;

    --sidebar-background: 220 20% 6%;
    --sidebar-foreground: 210 14% 83%;
    --sidebar-primary: 230 70% 58%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 220 18% 12%;
    --sidebar-accent-foreground: 210 14% 90%;
    --sidebar-border: 220 14% 16%;
    --sidebar-ring: 230 70% 58%;

    /* Custom tokens */
    --gradient-primary: linear-gradient(135deg, hsl(230 70% 52%), hsl(250 65% 58%));
    --gradient-hero: linear-gradient(160deg, hsl(220 20% 6%) 0%, hsl(225 24% 12%) 50%, hsl(235 20% 14%) 100%);
    --gradient-card: linear-gradient(135deg, hsl(0 0% 100%) 0%, hsl(210 20% 98%) 100%);
    --shadow-sm: 0 1px 2px 0 hsl(220 20% 10% / 0.04);
    --shadow-md: 0 4px 16px -2px hsl(220 20% 10% / 0.08);
    --shadow-lg: 0 12px 40px -8px hsl(220 20% 10% / 0.12);
    --shadow-glow: 0 0 24px -4px hsl(230 70% 52% / 0.3);

    /* Chart colors */
    --chart-1: 230 70% 52%;
    --chart-2: 250 65% 58%;
    --chart-3: 210 60% 50%;
    --chart-4: 280 50% 55%;
    --chart-5: 340 65% 55%;

    /* Stat colors */
    --success: 152 60% 42%;
    --success-foreground: 0 0% 100%;
    --warning: 38 92% 50%;
    --warning-foreground: 0 0% 100%;
    --info: 210 70% 50%;
    --info-foreground: 0 0% 100%;
}

/* Dark mode overrides */
.dark {
    --background: 220 20% 6%;
    --foreground: 210 14% 93%;

    --card: 220 18% 10%;
    --card-foreground: 210 14% 93%;

    --popover: 220 18% 10%;
    --popover-foreground: 210 14% 93%;

    --primary: 230 70% 58%;
    --primary-foreground: 220 20% 6%;

    --secondary: 220 14% 16%;
    --secondary-foreground: 210 14% 83%;

    --muted: 220 14% 14%;
    --muted-foreground: 210 10% 55%;

    --accent: 230 30% 16%;
    --accent-foreground: 230 60% 68%;

    --destructive: 0 62% 50%;
    --destructive-foreground: 0 0% 100%;

    --border: 220 14% 16%;
    --input: 220 14% 16%;
    --ring: 230 70% 58%;

    --sidebar-background: 220 24% 4%;
    --sidebar-foreground: 210 14% 83%;
    --sidebar-primary: 230 70% 58%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 220 18% 10%;
    --sidebar-accent-foreground: 210 14% 90%;
    --sidebar-border: 220 14% 12%;
    --sidebar-ring: 230 70% 58%;
}

/* ===== Base Styles ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border-color: hsl(var(--border));
}

/* Prevent Blazor enhanced navigation from showing focus rings on non-interactive elements */
h1:focus, h2:focus, h3:focus, h4:focus, h5:focus, h6:focus,
p:focus, div:focus, section:focus, article:focus, main:focus, header:focus, footer:focus, nav:focus, span:focus {
    outline: none;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: hsl(var(--primary));
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== Utility Classes ===== */
.text-gradient {
    background-image: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.bg-hero {
    background-image: var(--gradient-hero);
}

.bg-card-gradient {
    background-image: var(--gradient-card);
}

.shadow-glow {
    box-shadow: var(--shadow-glow);
}

.glass {
    background-color: hsl(var(--card) / 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid hsl(var(--border) / 0.5);
}

.glass-dark {
    background: hsl(220 20% 10% / 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid hsl(210 14% 20% / 0.5);
}

/* ===== Form Styles ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    margin-bottom: 0.375rem;
}

.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-family: inherit;
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    color: hsl(var(--foreground));
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.form-input:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.1);
}

.form-input::placeholder {
    color: hsl(var(--muted-foreground));
}

.form-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: hsl(var(--primary));
    border-radius: 0.25rem;
}

.form-error {
    color: hsl(var(--destructive));
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ===== Button Styles ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.5;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.btn-primary:hover {
    background-color: hsl(230 70% 46%);
}

.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.3);
}

.btn-ghost {
    background-color: transparent;
    color: hsl(var(--muted-foreground));
    border: none;
}

.btn-ghost:hover {
    background-color: hsl(var(--muted));
    color: hsl(var(--foreground));
}

.btn-full {
    width: 100%;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* ===== Alert / Status Message ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.alert-danger {
    background-color: hsl(var(--destructive) / 0.1);
    color: hsl(var(--destructive));
    border: 1px solid hsl(var(--destructive) / 0.2);
}

.alert-success {
    background-color: hsl(var(--success) / 0.1);
    color: hsl(var(--success));
    border: 1px solid hsl(var(--success) / 0.2);
}

/* ===== Card ===== */
.card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* ===== Validation styles ===== */
.validation-message {
    color: hsl(var(--destructive));
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.valid.modified:not([type=checkbox]) {
    outline: none;
    border-color: hsl(var(--success));
}

.invalid {
    outline: none;
    border-color: hsl(var(--destructive));
}

/* ===== Auth Layout ===== */
.auth-wrapper {
    display: flex;
    min-height: 100vh;
}

.auth-hero {
    display: none;
    width: 50%;
    background-image: var(--gradient-hero);
    position: relative;
    overflow: hidden;
}

.auth-hero-blur-1 {
    position: absolute;
    top: 25%;
    left: 25%;
    width: 24rem;
    height: 24rem;
    border-radius: 50%;
    background: hsl(var(--primary) / 0.2);
    filter: blur(80px);
    opacity: 0.2;
}

.auth-hero-blur-2 {
    position: absolute;
    bottom: 25%;
    right: 25%;
    width: 16rem;
    height: 16rem;
    border-radius: 50%;
    background: hsl(var(--primary) / 0.1);
    filter: blur(80px);
    opacity: 0.2;
}

.auth-hero-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    padding: 0 4rem;
}

.auth-hero-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    text-decoration: none;
}

.auth-hero-logo:hover {
    text-decoration: none;
}

.auth-hero-logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    background-color: hsl(var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-hero-logo-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    color: hsl(var(--primary-foreground));
}

.auth-hero-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: hsl(var(--primary-foreground));
}

.auth-hero h2 {
    font-size: 2.25rem;
    font-weight: 700;
    color: hsl(var(--primary-foreground));
    margin-bottom: 1rem;
    line-height: 1.2;
}

.auth-hero p {
    font-size: 1.125rem;
    color: hsl(var(--primary-foreground) / 0.6);
    max-width: 28rem;
}

.auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-form-container {
    width: 100%;
    max-width: 28rem;
}

.auth-mobile-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    text-decoration: none;
}

.auth-mobile-logo:hover {
    text-decoration: none;
}

.auth-mobile-logo-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background-color: hsl(var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-mobile-logo-icon svg {
    width: 1rem;
    height: 1rem;
    color: hsl(var(--primary-foreground));
}

.auth-mobile-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}

.auth-form-container h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-form-container .subtitle {
    color: hsl(var(--muted-foreground));
    margin-bottom: 2rem;
}

.auth-form-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.auth-form-footer a {
    color: hsl(var(--primary));
    font-weight: 500;
}

@media (min-width: 1024px) {
    .auth-hero {
        display: flex;
    }

    .auth-mobile-logo {
        display: none;
    }
}

/* ===== Dashboard Layout ===== */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    background-color: hsl(var(--background));
}

/* Sidebar */
.sidebar {
    position: fixed;
    inset: 0;
    right: auto;
    z-index: 50;
    width: 16rem;
    background-color: hsl(var(--sidebar-background));
    color: hsl(var(--sidebar-foreground));
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
    padding: 0 1.5rem;
    border-bottom: 1px solid hsl(var(--sidebar-border));
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.sidebar-logo:hover {
    text-decoration: none;
}

.sidebar-logo-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background-color: hsl(var(--sidebar-primary));
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo-icon svg {
    width: 1rem;
    height: 1rem;
    color: hsl(var(--sidebar-primary-foreground));
}

.sidebar-logo-text {
    font-weight: 700;
    font-size: 1.125rem;
    color: hsl(var(--sidebar-primary-foreground));
}

.sidebar-close {
    display: block;
    background: none;
    border: none;
    color: hsl(var(--sidebar-foreground));
    cursor: pointer;
    padding: 0.25rem;
}

.sidebar-close svg {
    width: 1.25rem;
    height: 1.25rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--sidebar-foreground));
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-nav-link:hover {
    background-color: hsl(var(--sidebar-accent));
    color: hsl(var(--sidebar-accent-foreground));
    text-decoration: none;
}

.sidebar-nav-link.active {
    background-color: hsl(var(--sidebar-accent));
    color: hsl(var(--sidebar-primary));
}

.sidebar-nav-link svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid hsl(var(--sidebar-border));
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
}

.sidebar-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: hsl(var(--sidebar-accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(var(--sidebar-primary));
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--sidebar-primary-foreground));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    font-size: 0.75rem;
    color: hsl(var(--sidebar-foreground));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout {
    background: none;
    border: none;
    color: hsl(var(--sidebar-foreground));
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.15s ease;
    flex-shrink: 0;
}

.sidebar-logout:hover {
    color: hsl(var(--sidebar-primary-foreground));
}

.sidebar-logout svg {
    width: 1rem;
    height: 1rem;
}

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 40;
    background-color: hsl(var(--foreground) / 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.sidebar-overlay.visible {
    display: block;
}

/* Main content */
.dashboard-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dashboard-header {
    height: 4rem;
    border-bottom: 1px solid hsl(var(--border));
    background-color: hsl(var(--card) / 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 30;
}

.hamburger-btn {
    display: block;
    background: none;
    border: none;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    padding: 0.25rem;
    margin-right: 1rem;
    transition: color 0.15s ease;
}

.hamburger-btn:hover {
    color: hsl(var(--foreground));
}

.hamburger-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.dashboard-header-spacer {
    flex: 1;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    background: none;
    border: none;
    cursor: default;
}

.dashboard-content {
    flex: 1;
    padding: 1rem;
}

@media (min-width: 1024px) {
    .sidebar {
        position: static;
        transform: translateX(0);
        z-index: auto;
    }

    .sidebar-close {
        display: none;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .hamburger-btn {
        display: none;
    }

    .dashboard-header {
        padding: 0 2rem;
    }

    .dashboard-content {
        padding: 2rem;
    }
}

/* ===== Dashboard Page ===== */
.dashboard-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.dashboard-subtitle {
    color: hsl(var(--muted-foreground));
    margin-bottom: 2rem;
}

/* Stat Cards Grid */
.stat-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .stat-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .stat-cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Stat Card */
.stat-card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.stat-card-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    background-color: hsl(var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-icon svg {
    width: 1.25rem;
    height: 1.25rem;
    color: hsl(var(--accent-foreground));
}

.stat-card-badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
}

.stat-card-badge.positive {
    background-color: hsl(var(--success) / 0.1);
    color: hsl(var(--success));
}

.stat-card-badge.negative {
    background-color: hsl(var(--destructive) / 0.1);
    color: hsl(var(--destructive));
}

.stat-card-badge.neutral {
    background-color: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}

.stat-card-title {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

/* Recent Activity */
.activity-card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    overflow: hidden;
}

.activity-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid hsl(var(--border));
}

.activity-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.activity-list {
    list-style: none;
}

.activity-item {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid hsl(var(--border));
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.activity-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: hsl(var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(var(--accent-foreground));
    flex-shrink: 0;
}

.activity-text .user-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.activity-text .action {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.activity-time {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    white-space: nowrap;
}

/* Quick Actions */
.quick-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.quick-action-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    text-decoration: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.quick-action-card:hover {
    border-color: hsl(var(--primary) / 0.3);
    box-shadow: var(--shadow-sm);
}

.quick-action-card svg {
    color: hsl(var(--muted-foreground));
    flex-shrink: 0;
}

/* ===== Blazor Error Boundary ===== */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ===== Setup Wizard ===== */
.setup-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: hsl(var(--background));
}

.setup-card {
    width: 100%;
    max-width: 38rem;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
}

.setup-header {
    text-align: center;
    padding: 2rem 2rem 0;
}

.setup-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.setup-logo-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    background-color: hsl(var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--primary-foreground));
}

.setup-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.setup-subtitle {
    color: hsl(var(--muted-foreground));
    font-size: 0.9375rem;
    margin-bottom: 0;
}

/* Step Indicator */
.setup-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 2rem;
    gap: 0;
}

.setup-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.setup-step-dot {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    border: 2px solid hsl(var(--border));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.setup-step.active .setup-step-dot {
    border-color: hsl(var(--primary));
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.setup-step.completed .setup-step-dot {
    border-color: hsl(var(--success));
    background-color: hsl(var(--success));
    color: hsl(var(--success-foreground));
}

.setup-step-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
}

.setup-step.active .setup-step-label {
    color: hsl(var(--foreground));
}

.setup-step.completed .setup-step-label {
    color: hsl(var(--success));
}

.setup-step-line {
    width: 2.5rem;
    height: 2px;
    background-color: hsl(var(--border));
    margin: 0 0.5rem;
    transition: background-color 0.2s ease;
}

.setup-step-line.active {
    background-color: hsl(var(--success));
}

/* Step Content */
.setup-content {
    padding: 0 2rem 1.5rem;
}

.setup-step-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.setup-step-subtitle {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* Form hint text */
.form-hint {
    display: block;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.25rem;
}

/* Logo Preview */
.setup-logo-preview {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background-color: hsl(var(--muted));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.setup-logo-preview img {
    max-height: 3rem;
    max-width: 100%;
    object-fit: contain;
}

/* Navigation */
.setup-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem 1.5rem;
    border-top: 1px solid hsl(var(--border));
}

/* Skip message */
.setup-skip-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background-color: hsl(var(--muted));
    border-radius: var(--radius);
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

/* SMTP hints */
.setup-smtp-hints {
    margin-top: 1rem;
    font-size: 0.8125rem;
}

.setup-smtp-hints summary {
    cursor: pointer;
    color: hsl(var(--primary));
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.setup-smtp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    margin-top: 0.5rem;
}

.setup-smtp-table th,
.setup-smtp-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid hsl(var(--border));
}

.setup-smtp-table th {
    font-weight: 600;
    color: hsl(var(--foreground));
    background-color: hsl(var(--muted));
}

.setup-smtp-table td {
    color: hsl(var(--muted-foreground));
}

/* Completion icon */
.setup-complete-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background-color: hsl(var(--success) / 0.1);
    color: hsl(var(--success));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

/* Spinner */
.setup-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid hsl(var(--primary-foreground) / 0.3);
    border-top-color: hsl(var(--primary-foreground));
    border-radius: 50%;
    animation: setup-spin 0.6s linear infinite;
}

@keyframes setup-spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 640px) {
    .setup-wrapper {
        padding: 1rem;
    }

    .setup-card {
        border: none;
        box-shadow: none;
        background: transparent;
    }

    .setup-step-label {
        display: none;
    }

    .setup-content {
        padding: 0 1rem 1rem;
    }

    .setup-nav {
        padding: 1rem;
    }

    .setup-header {
        padding: 1.5rem 1rem 0;
    }
}

/* ===== Database Setup ===== */
.db-auth-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.db-auth-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.db-auth-option input[type="radio"] {
    accent-color: hsl(var(--primary));
}

.db-test-section {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.db-test-result {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    flex: 1;
    min-width: 200px;
}

.db-test-result.success {
    background-color: hsl(var(--success) / 0.1);
    color: hsl(var(--success));
}

.db-test-result.error {
    background-color: hsl(var(--destructive) / 0.1);
    color: hsl(var(--destructive));
}

.db-test-result svg {
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.db-restart-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background-color: hsl(var(--muted));
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 1.5rem;
}

.db-restart-indicator .setup-spinner {
    border-color: hsl(var(--muted-foreground) / 0.3);
    border-top-color: hsl(var(--muted-foreground));
}

.db-restart-hint {
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
}

.db-restart-hint code,
.db-restart-fallback code {
    background-color: hsl(var(--muted));
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.8125rem;
}

.db-restart-fallback {
    font-size: 0.875rem;
    color: hsl(var(--destructive));
    font-weight: 500;
}

/* ===== Error Pages ===== */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: hsl(var(--background));
}

.error-page-card {
    text-align: center;
    max-width: 28rem;
    width: 100%;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    padding: 3rem 2rem;
}

.error-page-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background-color: hsl(var(--destructive) / 0.1);
    color: hsl(var(--destructive));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.error-page-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
}

.error-page-card p {
    color: hsl(var(--muted-foreground));
    margin-bottom: 2rem;
    font-size: 0.9375rem;
}

.error-page-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

/* Error boundary inline (inside layouts) */
.error-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    min-height: 50vh;
}

.error-card {
    text-align: center;
    max-width: 28rem;
    width: 100%;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    padding: 2.5rem 2rem;
}

.error-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background-color: hsl(var(--warning) / 0.1);
    color: hsl(var(--warning));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.error-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
}

.error-card p {
    color: hsl(var(--muted-foreground));
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.btn-outline {
    background-color: transparent;
    color: hsl(var(--foreground));
    border: 1px solid hsl(var(--border));
}

.btn-outline:hover {
    background-color: hsl(var(--muted));
}

@media (max-width: 640px) {
    .error-page-card,
    .error-card {
        padding: 2rem 1.5rem;
    }

    .error-page-actions,
    .error-actions {
        flex-direction: column;
    }
}

/* ===== User Dashboard — App Card Grid ===== */
.app-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
    .app-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .app-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* App Card */
.app-card {
    display: flex;
    flex-direction: column;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-decoration: none;
    color: hsl(var(--card-foreground));
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.app-card:hover {
    border-color: hsl(var(--primary) / 0.4);
    box-shadow: var(--shadow-md);
}

.app-card:focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
}

.app-card-icon-container {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    background-color: hsl(var(--primary) / 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: hsl(var(--primary));
}

.app-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 0.375rem;
}

.app-card-description {
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.app-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid hsl(var(--border));
}

.app-card-page-count {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.app-card-arrow {
    color: hsl(var(--muted-foreground));
    transition: transform 0.2s ease;
}

.app-card:hover .app-card-arrow {
    transform: translateX(2px);
    color: hsl(var(--primary));
}

/* Group Headers */
.app-group-header {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.app-group-header span {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--muted-foreground));
}

/* Empty State */
.app-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
}

.app-empty-state-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 0.75rem;
    background-color: hsl(var(--muted));
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--muted-foreground));
    margin-bottom: 1.25rem;
}

.app-empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 0.5rem;
}

.app-empty-state-text {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    max-width: 24rem;
    line-height: 1.5;
}

/* Error State */
.app-error-state {
    padding: 3rem;
    text-align: center;
}

.app-error-state h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.app-error-state p {
    color: hsl(var(--muted-foreground));
    margin-bottom: 1rem;
}

/* Skeleton Loading */
.app-card-skeleton {
    pointer-events: none;
}

.skeleton-pulse {
    background-color: hsl(var(--muted));
    border-radius: 0.375rem;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-line {
    height: 0.75rem;
}

.skeleton-line-title {
    width: 60%;
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-line-desc {
    width: 90%;
    margin-bottom: 0.375rem;
}

.skeleton-line-desc-short {
    width: 65%;
}

.skeleton-line-footer {
    width: 4rem;
    height: 0.625rem;
}

@keyframes skeleton-shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== Reconnect modal override ===== */
#components-reconnect-modal {
    z-index: 9999;
}
