/* ═══════════════════════════════════════════════════════════════
   QuadraBay Data — App Stylesheet
   Material 3 via MudBlazor + custom design tokens
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ───────────────────────────────────────────── */
:root {
    /* Elevation / shadows (M3 style) */
    --app-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --app-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --app-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.04);
    --app-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    --app-shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);

    /* Radii */
    --app-radius-sm: 8px;
    --app-radius-md: 12px;
    --app-radius-lg: 16px;
    --app-radius-xl: 20px;

    /* Transitions */
    --app-transition-fast: 0.12s ease;
    --app-transition-normal: 0.2s ease;

    /* Spacing scale (matches MudBlazor pa-/ma- values) */
    --app-gap-xs: 4px;
    --app-gap-sm: 8px;
    --app-gap-md: 16px;
    --app-gap-lg: 24px;
    --app-gap-xl: 32px;

    /* Theme-aware surfaces & gradients */
    --app-hero-surface: color-mix(in srgb, #045c98 6%, #ffffff);
    --app-login-gradient: linear-gradient(135deg, #f8fafc 0%, #e8f0fe 50%, #f0f4f8 100%);
}

/* Dark mode overrides */
.mud-theme-dark {
    --app-hero-surface: color-mix(in srgb, #3381bd 8%, #1e293b);
    --app-login-gradient: linear-gradient(135deg, #0f172a 0%, #1a2a4a 50%, #1e293b 100%);
}

/* ── Base ─────────────────────────────────────────────────────── */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Remove MudBlazor default 64px top padding (no MudAppBar used) */
.mud-main-content {
    padding-top: 0 !important;
}

/* ── Education chart edit-mode affordances ───────────────────── */
/* Bottom anchor grows on hover to signal "grab me" + active states bump
   further so the drag origin stays visible through the motion. */
.edu-anchor-source:hover {
    transform: scale(1.4);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35), 0 2px 6px rgba(0,0,0,0.18) !important;
}
.edu-anchor-source:active {
    transform: scale(1.25);
    cursor: grabbing !important;
}

/* While a connection drag is in flight, every card becomes a candidate drop
   target. Hovering over a card lights up its outline + its top anchor so the
   user has two cues that the drop will land there. */
body.edu-dragging { cursor: crosshair; }
body.edu-dragging [data-card-id] { transition: outline 80ms; }
[data-card-id].edu-drop-hover {
    outline: 3px dashed #6366f1;
    outline-offset: -3px;
}
[data-card-id].edu-drop-hover ~ .edu-anchor-target,
body.edu-dragging .edu-anchor-target {
    background: #e0e7ff !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3) !important;
}

/* ── Global page-enter animation ─────────────────────────────── */
/* Opacity-only fade — an earlier translateY() end state persisted on the element
   via animation-fill-mode: both, creating a new containing block for every
   descendant and breaking `position: fixed` (right-click context menu, etc.).
   Fade only — no transform leaks. */
@keyframes page-enter {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.mud-main-content > div > * {
    animation: page-enter 0.3s ease-out both;
}

.page-header {
    animation: page-enter 0.25s ease-out both;
}

@media (prefers-reduced-motion: reduce) {
    .mud-main-content > div > *,
    .page-header {
        animation: none;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Sidebar
   ═══════════════════════════════════════════════════════════════ */
.sidebar .mud-drawer-content {
    background: var(--mud-palette-surface) !important;
    border-right: 1px solid var(--mud-palette-divider);
}

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 14px 12px;
    cursor: pointer;
    user-select: none;
}

.sidebar-brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgb(2, 106, 167);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(2, 106, 167, 0.38);
}

.sidebar-brand-name {
    font-weight: 800 !important;
    font-size: 1rem !important;
    letter-spacing: -0.4px !important;
    color: var(--mud-palette-text-primary) !important;
}

/* Spacer between sidebar nav groups */
.sidebar-spacer {
    height: 8px;
}

/* Section labels */
.sidebar-section-label {
    padding: 16px 16px 3px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--mud-palette-text-disabled);
}

/* Nav links */
.sidebar-nav .mud-nav-link {
    border-radius: var(--app-radius-sm);
    margin: 2px 8px;
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    color: var(--mud-palette-drawer-text) !important;
    transition: background var(--app-transition-normal),
                color var(--app-transition-normal);
}

.sidebar-nav .mud-nav-link .mud-icon-root {
    color: var(--mud-palette-drawer-icon) !important;
    font-size: 1.15rem !important;
}

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

.sidebar-nav .mud-nav-link:hover .mud-icon-root {
    color: var(--mud-palette-text-primary) !important;
}

/* Active: solid primary pill */
.sidebar-nav .mud-nav-link.active {
    background: var(--mud-palette-primary) !important;
    color: #ffffff !important;
    font-weight: 600;
}

.sidebar-nav .mud-nav-link.active .mud-icon-root {
    color: #ffffff !important;
}


/* ── Mini/collapsed sidebar badge counts ── */
.sidebar-mini-badge-wrap {
    position: relative;
}

.sidebar-mini-count {
    position: absolute;
    top: 2px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: #fff;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.sidebar-mini-count--primary {
    background: var(--mud-palette-primary);
}

.sidebar-mini-count--error {
    background: var(--mud-palette-error);
}

/* ═══════════════════════════════════════════════════════════════
   Sticky Content Topbar  (inside MudMainContent — sidebar full height)
   ═══════════════════════════════════════════════════════════════ */
.content-topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    height: 56px;
    background: var(--mud-palette-surface);
    border-bottom: 1px solid var(--mud-palette-divider);
    flex-shrink: 0;
    animation: none !important;
}

/* Hamburger menu toggle */
.topbar-menu-btn {
    flex-shrink: 0;
    margin-right: 4px;
    opacity: 0.65;
    transition: opacity var(--app-transition-fast);
}

.topbar-menu-btn:hover {
    opacity: 1;
}

/* Search wrap */
.topbar-search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 480px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--mud-palette-lines-inputs);
    border-radius: 20px;
    background: var(--mud-palette-background);
    transition: border-color var(--app-transition-normal),
                box-shadow var(--app-transition-normal);
    position: relative;
}

.topbar-search-wrap:focus-within {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
}

.topbar-search-icon {
    color: var(--mud-palette-text-disabled);
    flex-shrink: 0;
}

.topbar-search-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--mud-palette-text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
}

.topbar-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: -6px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.topbar-search-btn:hover {
    background: var(--mud-palette-primary-darken);
    transform: scale(1.05);
}

.topbar-search-btn:active {
    transform: scale(0.95);
}

.topbar-search-input::placeholder {
    color: var(--mud-palette-text-disabled);
}

/* Search suggestions dropdown */
.search-suggestions-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-inputs);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 380px;
    overflow-y: auto;
    z-index: 1300;
    animation: searchDropIn 0.15s ease-out;
}

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

.search-suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-bottom: 1px solid var(--mud-palette-divider);
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--mud-palette-text-primary);
    transition: background 0.12s ease;
    user-select: none;
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestion-item:hover {
    background: var(--mud-palette-action-default-hover);
}

.search-type-badge {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 6px;
    min-width: 64px;
    text-align: center;
    white-space: nowrap;
}

.badge-country       { background: #e3f2fd; color: #1565c0; }
.badge-institution   { background: #e8f5e9; color: #2e7d32; }
.badge-qualification { background: #fff8e1; color: #b36b00; }
.badge-framework     { background: #fff3e0; color: #e65100; }
.badge-subject     { background: #e0f7fa; color: #00838f; }
.badge-grading     { background: #f3e5f5; color: #7b1fa2; }
.badge-qtf         { background: #fce4ec; color: #c62828; }

.search-suggestion-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.search-suggestion-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-suggestion-secondary {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-suggestion-flag {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

.search-suggestion-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    font-size: 0.82rem;
    color: var(--mud-palette-text-secondary);
}

/* Right cluster */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--mud-palette-divider);
    margin: 0 4px;
}

/* User trigger */
.topbar-user-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 4px 4px;
    border-radius: var(--app-radius-md);
    cursor: pointer;
    transition: background var(--app-transition-normal);
}

.topbar-user-trigger:hover {
    background: var(--mud-palette-action-default-hover);
}

.topbar-user-avatar {
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    flex-shrink: 0;
}

.topbar-user-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

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

.topbar-user-email {
    font-size: 0.7rem;
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    max-width: 180px;
    text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════
   Auth / Login
   ═══════════════════════════════════════════════════════════════ */
.login-bg {
    min-height: 100vh;
    background: var(--app-login-gradient);
}

.login-card {
    width: 420px;
    max-width: 95vw;
    background: var(--mud-palette-surface);
    border-radius: var(--app-radius-lg);
    padding: 36px 32px 28px;
    box-shadow: var(--app-shadow-lg);
}

.login-header {
    margin-bottom: var(--app-gap-lg);
    text-align: center;
}

.login-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: rgb(2, 106, 167);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 6px 20px rgba(2, 106, 167, 0.30);
}

.login-footer {
    margin-top: var(--app-gap-lg);
    padding-top: var(--app-gap-md);
    border-top: 1px solid var(--mud-palette-divider);
    text-align: center;
}


/* ═══════════════════════════════════════════════════════════════
   Dashboard
   ═══════════════════════════════════════════════════════════════ */

/* ── Action Strip: Pick Up Work CTA + Stats ── */
.dash-action-strip {
    display: flex;
    align-items: stretch;
    gap: 16px;
}

.dash-pickup-cta {
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--mud-palette-primary) 0%, var(--mud-palette-primary-darken) 100%);
    border-radius: var(--app-radius-lg);
    padding: 22px 28px;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-width: 220px;
    cursor: pointer;
    transition: transform var(--app-transition-fast), box-shadow var(--app-transition-fast);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px color-mix(in srgb, var(--mud-palette-primary) 35%, transparent);
}

.dash-pickup-cta::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.dash-pickup-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--mud-palette-primary) 40%, transparent);
}

.dash-pickup-count {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
}

.dash-pickup-label {
    font-size: 0.8125rem;
    font-weight: 600;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dash-pickup-resume {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 4px 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--app-transition-fast);
    width: fit-content;
}

.dash-pickup-resume:hover {
    background: rgba(255,255,255,0.25);
}

/* Stat cards row */
.dash-stat-cards {
    display: flex;
    gap: 12px;
    flex: 1;
}

.dash-stat-card {
    flex: 1;
    background: var(--mud-palette-surface);
    border: 1.5px solid var(--mud-palette-divider);
    border-radius: var(--app-radius-md);
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform var(--app-transition-fast), box-shadow var(--app-transition-fast),
                border-color var(--app-transition-fast);
}

.dash-stat-card--has-value {
    border-color: transparent;
    box-shadow: var(--app-shadow-sm);
}

.dash-stat-card--has-value:hover {
    transform: translateY(-1px);
    box-shadow: var(--app-shadow-md);
}

.dash-stat-card--zero {
    opacity: 0.5;
    border-style: dashed;
}

.dash-stat-card--zero:hover {
    opacity: 0.7;
}

/* Clickable arrow indicator (top-right, appears on hover) */
.dash-stat-arrow {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.875rem !important;
    color: var(--mud-palette-text-disabled);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity var(--app-transition-fast), transform var(--app-transition-fast),
                color var(--app-transition-fast);
}

.dash-stat-card:hover .dash-stat-arrow {
    opacity: 1;
    transform: translateX(0);
    color: var(--mud-palette-primary);
}

.dash-stat-num {
    font-size: 1.625rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.5px;
    color: var(--mud-palette-text-primary);
}

.dash-stat-card--zero .dash-stat-num {
    color: var(--mud-palette-text-disabled);
    font-size: 1.375rem;
}

.dash-stat-card--warning .dash-stat-num { color: var(--mud-palette-warning); }
.dash-stat-card--error .dash-stat-num   { color: var(--mud-palette-error); }
.dash-stat-card--info .dash-stat-num    { color: var(--mud-palette-info); }

.dash-stat-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--mud-palette-text-secondary);
    margin-top: 4px;
}

.dash-stat-sub {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--mud-palette-text-disabled);
    margin-top: 1px;
}

/* ── Dashboard Grid (two-column, fills remaining viewport) ── */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    align-items: stretch;
    min-height: calc(100vh - 340px);
}

.dash-grid > .dash-attention-panel,
.dash-grid > .dash-activity-panel {
    min-height: 0;
    max-height: calc(100vh - 340px);
}

.dash-grid > .dash-attention-panel .dash-attention-list,
.dash-grid > .dash-activity-panel .dash-timeline {
    flex: 1;
    overflow-y: auto;
}

@media (max-width: 960px) {
    .dash-grid {
        grid-template-columns: 1fr;
        min-height: unset;
    }
    .dash-grid > .dash-attention-panel,
    .dash-grid > .dash-activity-panel {
        max-height: 500px;
    }
    .dash-action-strip { flex-direction: column; }
    .dash-stat-cards { flex-wrap: wrap; }
    .dash-stat-card { min-width: calc(33% - 8px); }
}

/* ── Needs Attention Panel (urgency) ── */
.dash-attention-panel {
    background: var(--mud-palette-surface);
    border: 1.5px solid color-mix(in srgb, var(--mud-palette-error) 25%, var(--mud-palette-divider));
    border-radius: var(--app-radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--mud-palette-error) 8%, transparent),
                var(--app-shadow-sm);
}

.dash-attention-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: color-mix(in srgb, var(--mud-palette-error) 5%, var(--mud-palette-surface));
    border-bottom: 1px solid color-mix(in srgb, var(--mud-palette-error) 15%, var(--mud-palette-divider));
}

.dash-pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--mud-palette-error);
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    animation: dash-pending-pulse 2s ease-in-out infinite;
}

@keyframes dash-pending-pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--mud-palette-error) 30%, transparent); }
    50%      { box-shadow: 0 0 0 6px transparent; }
}

/* Attention list items */
.dash-attention-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--mud-palette-divider) transparent;
}

.dash-attention-list::-webkit-scrollbar { width: 4px; }
.dash-attention-list::-webkit-scrollbar-track { background: transparent; }
.dash-attention-list::-webkit-scrollbar-thumb { background: var(--mud-palette-divider); border-radius: 4px; }

.dash-attention-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    gap: 12px;
    cursor: pointer;
    transition: background var(--app-transition-fast);
    border-left: 3px solid transparent;
}

.dash-attention-item:hover {
    background: var(--mud-palette-action-default-hover);
    border-left-color: var(--mud-palette-primary);
}

.dash-attention-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dash-attention-dot--error   { background: var(--mud-palette-error); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mud-palette-error) 15%, transparent); }
.dash-attention-dot--warning { background: var(--mud-palette-warning); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mud-palette-warning) 15%, transparent); }
.dash-attention-dot--success { background: var(--mud-palette-success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mud-palette-success) 15%, transparent); }
.dash-attention-dot--default { background: var(--mud-palette-text-disabled); }

.dash-attention-arrow {
    color: var(--mud-palette-text-disabled);
    flex-shrink: 0;
    transition: transform var(--app-transition-fast), color var(--app-transition-fast);
}

.dash-attention-item:hover .dash-attention-arrow {
    transform: translateX(2px);
    color: var(--mud-palette-primary);
}

/* Item tags (inline badges) */
.dash-item-tag {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

.dash-item-tag--error {
    background: color-mix(in srgb, var(--mud-palette-error) 10%, transparent);
    color: var(--mud-palette-error);
    border: 1px solid color-mix(in srgb, var(--mud-palette-error) 20%, transparent);
}

.dash-item-tag--warning {
    background: color-mix(in srgb, var(--mud-palette-warning) 10%, transparent);
    color: var(--mud-palette-warning-darken);
    border: 1px solid color-mix(in srgb, var(--mud-palette-warning) 20%, transparent);
}

.dash-item-tag--default {
    background: var(--mud-palette-action-default-hover);
    color: var(--mud-palette-text-secondary);
}

.dash-item-body {
    flex: 1;
    min-width: 0;
}

.dash-item-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-item-sub {
    display: block;
    font-size: 0.72rem;
    color: var(--mud-palette-text-secondary);
    display: flex;
    align-items: center;
    margin-top: 2px;
}

.dash-panel-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}

.dash-panel-footer {
    border-top: 1px solid var(--mud-palette-divider);
    padding: 4px 8px;
    text-align: center;
}

/* Job category micro-badges */
.dash-item-category {
    display: inline-block;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}

.dash-item-category--institution {
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 20%, transparent);
}

.dash-item-category--country {
    background: color-mix(in srgb, var(--mud-palette-tertiary) 10%, transparent);
    color: var(--mud-palette-tertiary);
    border: 1px solid color-mix(in srgb, var(--mud-palette-tertiary) 20%, transparent);
}

/* Date display in attention items */
.dash-item-date {
    margin-left: auto;
    font-size: 0.65rem;
    color: var(--mud-palette-text-disabled);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Review progress indicator */
.dash-item-progress {
    font-size: 0.65rem;
    color: var(--mud-palette-info);
    white-space: nowrap;
}

/* Country extraction target type micro-badge */
.dash-item-target {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
    background: color-mix(in srgb, var(--mud-palette-info) 10%, transparent);
    color: var(--mud-palette-info);
    border: 1px solid color-mix(in srgb, var(--mud-palette-info) 20%, transparent);
}

/* ── AI Ready for Review divider ── */
.dash-review-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--mud-palette-success);
}

/* ── Recent Activity Panel (timeline feed) ── */
.dash-activity-panel {
    background: var(--mud-palette-surface);
    border: 1.5px solid var(--mud-palette-divider);
    border-radius: var(--app-radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dash-activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: color-mix(in srgb, var(--mud-palette-background-gray) 50%, var(--mud-palette-surface));
    border-bottom: 1px solid var(--mud-palette-divider);
}

/* Timeline items */
.dash-timeline {
    padding: 8px 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--mud-palette-divider) transparent;
}

.dash-timeline::-webkit-scrollbar { width: 4px; }
.dash-timeline::-webkit-scrollbar-track { background: transparent; }
.dash-timeline::-webkit-scrollbar-thumb { background: var(--mud-palette-divider); border-radius: 4px; }

.dash-timeline-item {
    display: flex;
    gap: 12px;
    padding: 10px 20px;
    position: relative;
}

.dash-timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 29px;
    top: 28px;
    bottom: -2px;
    width: 1.5px;
    background: var(--mud-palette-divider);
}

.dash-timeline-item--clickable {
    cursor: pointer;
}

.dash-timeline-item--clickable:hover {
    background: var(--mud-palette-action-default-hover);
}

.dash-timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    border: 2px solid var(--mud-palette-surface);
    outline: 1.5px solid var(--mud-palette-divider);
}

.dash-timeline-body {
    flex: 1;
    min-width: 0;
}

.dash-timeline-title {
    font-size: 0.8125rem;
    font-weight: 600;
}

.dash-timeline-meta {
    font-size: 0.72rem;
    color: var(--mud-palette-text-disabled);
    margin-top: 1px;
}

.dash-timeline-time {
    font-size: 0.68rem;
    color: var(--mud-palette-text-disabled);
    white-space: nowrap;
    margin-top: 3px;
    flex-shrink: 0;
}

/* ── Dashboard Animations ──────────────────────────────────── */

@keyframes dash-section-enter {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Staggered section entry */
.dash-section {
    animation: dash-section-enter 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.dash-section--0 { animation-delay: 0.00s; }
.dash-section--1 { animation-delay: 0.07s; }
.dash-section--2 { animation-delay: 0.13s; }

/* Stat card pop-in */
@keyframes dash-stat-pop {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}

.dash-stat-card {
    animation: dash-stat-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.dash-stat-card:nth-child(1) { animation-delay: 0.06s; }
.dash-stat-card:nth-child(2) { animation-delay: 0.10s; }
.dash-stat-card:nth-child(3) { animation-delay: 0.14s; }
.dash-stat-card:nth-child(4) { animation-delay: 0.18s; }
.dash-stat-card:nth-child(5) { animation-delay: 0.22s; }

/* Staggered timeline item entry */
@keyframes dash-timeline-enter {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

.dash-timeline-item {
    animation: dash-timeline-enter 0.3s ease-out both;
}

.dash-timeline-item:nth-child(1) { animation-delay: 0.16s; }
.dash-timeline-item:nth-child(2) { animation-delay: 0.20s; }
.dash-timeline-item:nth-child(3) { animation-delay: 0.24s; }
.dash-timeline-item:nth-child(4) { animation-delay: 0.28s; }
.dash-timeline-item:nth-child(5) { animation-delay: 0.32s; }
.dash-timeline-item:nth-child(n+6){ animation-delay: 0.34s; }

/* Staggered attention item entry */
.dash-attention-item {
    animation: dash-timeline-enter 0.3s ease-out both;
}

.dash-attention-item:nth-child(1) { animation-delay: 0.16s; }
.dash-attention-item:nth-child(2) { animation-delay: 0.20s; }
.dash-attention-item:nth-child(3) { animation-delay: 0.24s; }
.dash-attention-item:nth-child(4) { animation-delay: 0.28s; }
.dash-attention-item:nth-child(5) { animation-delay: 0.32s; }

/* Pulse on most recent timeline dot */
@keyframes dash-dot-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

.dash-timeline-item:first-child .dash-timeline-dot {
    animation: dash-dot-pulse 2s ease-in-out infinite;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .dash-section,
    .dash-stat-card,
    .dash-timeline-item,
    .dash-attention-item { animation: none; }
    .dash-timeline-item:first-child .dash-timeline-dot { animation: none; }
    .dash-pending-badge { animation: none; }
}


/* ── Activity History Page ── */
.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Tabs
   ═══════════════════════════════════════════════════════════════ */
.mud-tabs .mud-tab {
    text-transform: none;
    font-weight: 600;
    font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════════════
   Page Cards (unified wrapper for tabs + toolbar + grid)
   ═══════════════════════════════════════════════════════════════ */
.queue-card,
.crud-card {
    background: var(--mud-palette-surface);
}

.queue-card-tabs {
    border-bottom: 1px solid var(--mud-palette-divider);
}

/* ── Tab label with inline count pill ── */
.queue-tab-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.queue-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: var(--mud-palette-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.queue-tab-count--warning {
    background: var(--mud-palette-warning);
    color: var(--mud-palette-warning-text);
}

/* ── Toolbar strip inside the card ── */
.page-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--mud-palette-background-gray);
    border-bottom: 1px solid var(--mud-palette-divider);
}

/* Remove default MudBlazor margin on input controls inside toolbar */
.page-toolbar .mud-input-control {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* White background on container, visible border on fieldset */
.page-toolbar .mud-input-outlined {
    background: var(--mud-palette-surface);
    border-radius: 6px;
}

.page-toolbar .mud-input-outlined .mud-input-outlined-border {
    background: transparent !important;
    border-color: var(--mud-palette-divider) !important;
    border-radius: 6px;
}

.page-toolbar .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: var(--mud-palette-text-secondary) !important;
}

.page-toolbar .mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--mud-palette-primary) !important;
    box-shadow: 0 0 0 2px rgba(4, 92, 152, 0.10);
}

/* Slightly smaller font for toolbar inputs */
.page-toolbar .mud-input.mud-input-outlined {
    font-size: 0.8125rem;
}

.page-toolbar .mud-input.mud-input-outlined input,
.page-toolbar .mud-input.mud-input-outlined .mud-select-input {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    font-size: 0.8125rem;
}

/* Ensure placeholder is always visible */
.page-toolbar .mud-input.mud-input-outlined input::placeholder {
    color: var(--mud-palette-text-secondary) !important;
    opacity: 1 !important;
}

.page-toolbar .mud-input-slot:empty + .mud-input-placeholder,
.page-toolbar .mud-input-outlined .mud-input-slot[placeholder] {
    opacity: 1 !important;
}

.page-toolbar .mud-input-label {
    font-size: 0.8125rem;
}

.page-toolbar .mud-input-adornment-start .mud-icon-root {
    font-size: 1.15rem;
    color: var(--mud-palette-text-secondary);
}

/* Compact chips inside toolbar */
.page-toolbar .mud-chip {
    font-size: 0.75rem;
    height: 28px;
}

/* Fix select dropdown label/text alignment when collapsed */
.page-toolbar .mud-select .mud-input-label-outlined {
    font-size: 0.8125rem;
    transform: translate(14px, 9px) scale(1);
}
.page-toolbar .mud-select .mud-input-label-outlined.mud-input-label-inputcontrol {
    transform: translate(14px, -9px) scale(0.75);
}

/* Fix collapsed select text alignment */
.page-toolbar .mud-select .mud-select-input {
    min-height: unset;
    line-height: 1.4;
}

/* Toolbar select – auto-size to content, with sensible bounds */
.toolbar-select {
    min-width: 140px;
    max-width: 220px;
    flex-shrink: 0;
}

/* Switch label inside toolbar */
.page-toolbar .mud-switch {
    margin: 0;
}

.toolbar-switch {
    flex-shrink: 0;
    white-space: nowrap;
}

.toolbar-switch .mud-switch-label {
    font-size: 0.8125rem;
}

/* Toolbar toggle group (Active/Deleted segmented control) */
.toolbar-toggle {
    flex-shrink: 0;
}

.toolbar-toggle .mud-toggle-group {
    height: 32px;
}

.toolbar-toggle .mud-toggle-item {
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    padding: 0 14px !important;
    min-width: unset !important;
    text-transform: none !important;
}

/* Remove extra elevation from grids nested inside the card */
.queue-card > .mud-data-grid,
.crud-card > .mud-data-grid,
.queue-card .mud-table,
.crud-card .mud-table,
.crud-card .mud-data-grid,
.crud-card .mud-data-grid .mud-table {
    box-shadow: none !important;
}

.queue-card > .mud-data-grid > .mud-table > .mud-table-container,
.crud-card > .mud-data-grid > .mud-table > .mud-table-container,
.crud-card .mud-data-grid > .mud-table > .mud-table-container {
    border-radius: 0;
}

/* Fix border alignment in MudDataGrid - ensure consistent cell borders */
.crud-card .mud-table-cell,
.queue-card .mud-table-cell {
    border-bottom: 1px solid var(--mud-palette-divider) !important;
}

.crud-card .mud-table-row:last-child .mud-table-cell,
.queue-card .mud-table-row:last-child .mud-table-cell {
    border-bottom: none !important;
}

/* ── Detail tabs inside crud-card ── */
.detail-tabs .mud-tabs-header {
    border-bottom: 1px solid var(--mud-palette-divider);
}
.detail-tabs .mud-tab {
    min-width: unset;
    padding: 12px 20px;
    letter-spacing: normal;
    text-transform: none;
}
.detail-tabs .mud-tabs-panels {
    padding: 0;
}
.detail-tabs .mud-tab-panel {
    padding: 0;
}

/* ── Help panel bullets ── */
.help-bullets {
    list-style: none;
    margin: 0;
    padding: 0;
}
.help-bullets > li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    line-height: 1.5;
}
.help-bullets > li + li {
    border-top: 1px solid var(--mud-palette-divider);
}
.help-bullets .help-bullet-icon {
    flex-shrink: 0;
    margin-top: 2px;
    opacity: 0.75;
}

/* ═══════════════════════════════════════════════════════════════
   Countries – Card Grid
   ═══════════════════════════════════════════════════════════════ */
.country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1px;
    background: var(--mud-palette-divider);
}

.country-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    cursor: pointer;
    background: var(--mud-palette-surface);
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.country-card:hover {
    background: color-mix(in srgb, var(--mud-palette-primary) 5%, var(--mud-palette-surface));
}

.country-card:hover .country-card-chevron {
    opacity: 1;
    color: var(--mud-palette-primary);
}

.country-card-flag {
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.country-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.country-card-name {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--mud-palette-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.country-card-region {
    display: inline-block;
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    color: var(--mud-palette-primary);
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.7rem;
    line-height: 1.6;
    width: fit-content;
}

.country-card-counts {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--mud-palette-text-disabled);
}

.country-card-counts-sep {
    color: var(--mud-palette-divider);
}

.country-card-chevron {
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease;
    color: var(--mud-palette-text-disabled);
}

.country-card-manage {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
}

.country-card--deleted {
    opacity: 0.5;
    background: repeating-linear-gradient(
        -45deg,
        var(--mud-palette-surface),
        var(--mud-palette-surface) 10px,
        color-mix(in srgb, var(--mud-palette-error) 5%, var(--mud-palette-surface)) 10px,
        color-mix(in srgb, var(--mud-palette-error) 5%, var(--mud-palette-surface)) 20px
    );
}

.country-card--deleted .country-card-manage {
    opacity: 1;
}

.country-card--hidden {
    opacity: 0.7;
}

.country-card-deleted-badge {
    display: inline-block;
    background: color-mix(in srgb, var(--mud-palette-error) 15%, transparent);
    color: var(--mud-palette-error);
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.7rem;
    line-height: 1.6;
    width: fit-content;
}


/* ═══════════════════════════════════════════════════════════════
   Shared Utilities
   ═══════════════════════════════════════════════════════════════ */

/* Page header */
.page-header .mud-typography-h4 {
    font-size: 1.6rem;
    line-height: 1.3;
}

/* Breadcrumbs */
.mud-breadcrumbs .mud-breadcrumb-item a {
    color: var(--mud-palette-text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s ease;
}

.mud-breadcrumbs .mud-breadcrumb-item a:hover {
    color: var(--mud-palette-primary);
    text-decoration: underline;
}

.mud-breadcrumbs .mud-breadcrumb-item:last-child .mud-breadcrumb-item-disabled {
    color: var(--mud-palette-primary) !important;
    font-weight: 700;
    opacity: 1;
}

/* Page header flag */
.page-header-flag {
    width: 48px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

/* Section label (reusable) */
.section-label {
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 700;
    color: var(--mud-palette-text-secondary);
    font-size: 0.7rem;
}


/* ═══════════════════════════════════════════════════════════════
   Review Page
   ═══════════════════════════════════════════════════════════════ */

.review-ai-reasoning {
    border-radius: var(--app-radius-md);
    background-color: #f3e8ff;
    color: #6b21a8;
    border-left: 3px solid #9333ea;
    font-size: 0.8125rem;
}

.enrichment-time-ago {
    font-size: 0.8125rem;
    color: var(--mud-palette-text-secondary);
}

.btn-grid-action {
    text-transform: none;
    font-size: 0.75rem;
}

.review-field-empty {
    color: var(--mud-palette-text-disabled);
    font-style: italic;
}

.enrichment-step-avatar {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
}

.review-confidence-chip {
    font-size: 0.7rem;
    height: 20px;
    min-height: 20px;
    padding: 0 6px;
}

.review-confidence-badge {
    font-size: 0.7rem;
    font-weight: 600;
    height: 22px;
}

.review-confidence-note {
    font-size: 0.82rem;
}

/* ── Review column tints ── */
.review-col-existing {
    background: color-mix(in srgb, var(--mud-palette-info) 7%, transparent);
}

.review-col-extracted {
    background: color-mix(in srgb, #9c27b0 7%, transparent);
}

th.review-col-existing {
    border-bottom: 2px solid color-mix(in srgb, var(--mud-palette-info) 40%, transparent) !important;
}

th.review-col-extracted {
    border-bottom: 2px solid color-mix(in srgb, #9c27b0 35%, transparent) !important;
}

.review-col-final {
    background: color-mix(in srgb, var(--mud-palette-success) 5%, transparent);
}

/* ── Clickable source cells ── */
.review-cell-clickable {
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.review-cell-clickable:hover {
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent) !important;
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--mud-palette-primary) 30%, transparent);
}

/* ── Active selection indicator ── */
.review-cell-active {
    box-shadow: inset 0 0 0 2px var(--mud-palette-success) !important;
}

.review-col-existing.review-cell-active {
    background: color-mix(in srgb, var(--mud-palette-info) 12%, transparent) !important;
}

.review-col-extracted.review-cell-active {
    background: color-mix(in srgb, #9c27b0 12%, transparent) !important;
}

/* ── Cell content layout (value + check icon) ── */
.review-cell-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

.review-cell-value {
    flex: 1;
    min-width: 0;
}

.review-check-icon {
    flex-shrink: 0;
    opacity: 0.85;
}

/* ── Final column wrapper (control + edit icon) ── */
.review-final-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.review-final-control {
    flex: 1;
    min-width: 0;
}

.review-check-icon-final {
    flex-shrink: 0;
    opacity: 0.7;
}

/* ── Section note (AI note inline bar) ── */
.review-section-note {
    border-left: 3px solid color-mix(in srgb, #9c27b0 60%, transparent);
    background: color-mix(in srgb, #9c27b0 6%, transparent);
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
}

.review-ai-icon {
    color: #9c27b0;
    opacity: 0.7;
    flex-shrink: 0;
}

/* ── Top-level AI summary banner ── */
.review-ai-summary {
    border-left: 3px solid color-mix(in srgb, #9c27b0 60%, transparent);
    background: color-mix(in srgb, #9c27b0 6%, transparent);
    padding: 12px 16px;
    border-radius: 6px;
}

/* ── Required field validation ── */
.review-field-required .mud-input-outlined .mud-input-outlined-border {
    border-color: var(--mud-palette-error) !important;
}

.review-field-required-text {
    color: var(--mud-palette-error);
    font-size: 0.75rem;
    margin-top: 2px;
}

/* ── Accreditation cards ── */
.review-accreditation-card {
    border-radius: var(--app-radius-sm);
}

.review-accreditation-field {
    min-width: 0;
}

.review-accreditation-field-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

/* ── Historical/TNE link cards ── */
.review-link-card {
    border-radius: var(--app-radius-sm);
}

.review-link-card-removed {
    opacity: 0.4;
}

/* ── Match indicator column ── */
.review-col-match {
    text-align: center !important;
    vertical-align: middle !important;
    padding: 2px !important;
    background: transparent !important;
}

td.review-col-match .mud-tooltip-root {
    display: flex !important;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

th.review-col-match {
    text-align: center !important;
    vertical-align: middle !important;
}

.review-match-header-icon {
    color: var(--mud-palette-text-secondary);
    opacity: 0.6;
}

.review-match-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
    cursor: default;
    transition: transform 0.15s ease;
}

.review-match-badge:hover {
    transform: scale(1.15);
}

.review-match-exact {
    background: color-mix(in srgb, var(--mud-palette-success) 18%, transparent);
    color: var(--mud-palette-success);
    border: 2px solid color-mix(in srgb, var(--mud-palette-success) 50%, transparent);
}

.review-match-fuzzy {
    background: color-mix(in srgb, var(--mud-palette-warning) 20%, transparent);
    color: var(--mud-palette-warning-darken);
    border: 2px solid color-mix(in srgb, var(--mud-palette-warning) 50%, transparent);
}

.review-match-conflict {
    background: color-mix(in srgb, var(--mud-palette-error) 18%, transparent);
    color: var(--mud-palette-error);
    border: 2px solid color-mix(in srgb, var(--mud-palette-error) 50%, transparent);
}

.review-match-newvalue {
    background: color-mix(in srgb, var(--mud-palette-info) 18%, transparent);
    color: var(--mud-palette-info);
    border: 2px solid color-mix(in srgb, var(--mud-palette-info) 50%, transparent);
}

.review-match-empty {
    background: transparent;
    color: var(--mud-palette-text-disabled);
    border: 1.5px dashed color-mix(in srgb, var(--mud-palette-text-disabled) 30%, transparent);
}

/* ── Row-level match state styling ── */
.review-row-matched > td {
    opacity: 0.75;
    transition: opacity 0.2s ease;
}

.review-row-matched > td.review-col-match {
    opacity: 1;
}

.review-row-matched:hover > td {
    opacity: 1;
}

.review-row-conflict > td:first-child {
    border-left: 3px solid var(--mud-palette-error);
}

.review-row-conflict > td.review-col-match {
    background: color-mix(in srgb, var(--mud-palette-error) 4%, transparent) !important;
}

.review-row-fuzzy > td:first-child {
    border-left: 3px solid var(--mud-palette-warning);
}

.review-row-fuzzy > td.review-col-match {
    background: color-mix(in srgb, var(--mud-palette-warning) 4%, transparent) !important;
}

.review-row-new > td:first-child {
    border-left: 3px solid var(--mud-palette-info);
}

.review-row-new > td.review-col-extracted {
    background: color-mix(in srgb, var(--mud-palette-success) 6%, transparent);
}

.review-row-conflict > td.review-col-extracted {
    background: color-mix(in srgb, var(--mud-palette-warning) 6%, transparent);
}

/* ── Inline diff highlighting ── */
.diff-inline {
    font-size: 0.875rem;
    line-height: 1.5;
}

.diff-deleted {
    background: color-mix(in srgb, var(--mud-palette-error) 18%, transparent);
    color: var(--mud-palette-error);
    text-decoration: line-through;
    padding: 1px 2px;
    border-radius: 2px;
}

.diff-inserted {
    background: color-mix(in srgb, var(--mud-palette-success) 18%, transparent);
    color: var(--mud-palette-success-darken);
    font-weight: 600;
    padding: 1px 2px;
    border-radius: 2px;
}

/* ── Subject chips in qualification review ── */
.qual-subjects-area {
    min-height: 42px;
    padding: 4px 0;
}

.qual-subject-removed {
    opacity: 0.5;
    text-decoration: line-through;
}


/* ═══════════════════════════════════════════════════════════════
   Fields of Study Tree
   ═══════════════════════════════════════════════════════════════ */

/* ── Row layout ───────────────────────────────────────────────── */
.fos-row {
    display: flex;
    align-items: center;
    gap: var(--app-gap-sm);
    width: 100%;
    padding: 6px 8px 6px 0;
    border-radius: var(--app-radius-sm);
    transition: background var(--app-transition-fast);
}

/* ── ISCED code badge ─────────────────────────────────────────── */
.fos-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 2px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: 'Roboto Mono', 'Consolas', monospace;
    letter-spacing: 0.5px;
    border-radius: var(--app-radius-sm);
    flex-shrink: 0;
}

.fos-code--level-0 {
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent);
    color: var(--mud-palette-primary);
    border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 22%, transparent);
    font-size: 0.75rem;
    font-weight: 800;
}

.fos-code--level-1 {
    background: color-mix(in srgb, var(--mud-palette-info) 10%, transparent);
    color: var(--mud-palette-info);
    border: 1px solid color-mix(in srgb, var(--mud-palette-info) 18%, transparent);
}

.fos-code--level-2 {
    background: color-mix(in srgb, var(--mud-palette-secondary) 8%, transparent);
    color: var(--mud-palette-text-secondary);
    border: 1px solid color-mix(in srgb, var(--mud-palette-secondary) 14%, transparent);
    font-size: 0.7rem;
}

/* ── Name text ────────────────────────────────────────────────── */
.fos-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fos-name--level-0 {
    font-weight: 700;
    font-size: 0.92rem;
}

.fos-name--level-1 {
    font-weight: 600;
    font-size: 0.87rem;
}

.fos-name--level-2 {
    font-weight: 500;
    font-size: 0.84rem;
    color: var(--mud-palette-text-secondary);
}

/* ── Metadata (child count badge) ─────────────────────────────── */
.fos-meta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--mud-palette-text-disabled);
    flex-shrink: 0;
    padding: 2px 6px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--mud-palette-action-default) 6%, transparent);
}

.fos-meta .mud-icon-root {
    font-size: 0.85rem !important;
}

/* ── Status + actions cluster ─────────────────────────────────── */
.fos-status-actions {
    display: flex;
    align-items: center;
    gap: var(--app-gap-xs);
    flex-shrink: 0;
    margin-left: auto;
    padding-left: var(--app-gap-sm);
}

/* ── Action button group ──────────────────────────────────────── */
.fos-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 4px;
    border-radius: var(--app-radius-sm);
    background: color-mix(in srgb, var(--mud-palette-action-default) 5%, transparent);
}

/* ── Deleted item treatment ───────────────────────────────────── */
.fos-row--deleted {
    opacity: 0.55;
}

.fos-row--deleted .fos-name {
    text-decoration: line-through;
    text-decoration-color: var(--mud-palette-error);
}

.fos-row--deleted .fos-code {
    background: color-mix(in srgb, var(--mud-palette-error) 8%, transparent);
    color: var(--mud-palette-error);
    border-color: color-mix(in srgb, var(--mud-palette-error) 15%, transparent);
}

/* ── Inactive (hidden from website) ───────────────────────────── */
.fos-row--inactive .fos-name {
    color: var(--mud-palette-text-disabled);
}

.fos-row--inactive .fos-code {
    opacity: 0.6;
}

/* ── Visibility indicator dot ─────────────────────────────────── */
.fos-visibility-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.fos-visibility-dot--visible {
    background: var(--mud-palette-success);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--mud-palette-success) 20%, transparent);
}

.fos-visibility-dot--hidden {
    background: var(--mud-palette-text-disabled);
}

/* Touch devices & reduced motion */
@media (hover: none), (prefers-reduced-motion: reduce) {
    .fos-actions {
        opacity: 1;
        transition: none;
    }
}


/* ═══════════════════════════════════════════════════════════════
   Reports Page
   ═══════════════════════════════════════════════════════════════ */

/* KPI stat cards row */
.report-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.report-kpi-card {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: var(--app-radius-md);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: transform var(--app-transition-fast),
                box-shadow var(--app-transition-fast),
                border-color var(--app-transition-fast);
}

.report-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--app-shadow-sm);
    border-color: var(--mud-palette-primary-lighten);
}

.report-kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.report-kpi-icon--primary  { background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent); }
.report-kpi-icon--success  { background: color-mix(in srgb, var(--mud-palette-success) 12%, transparent); }
.report-kpi-icon--info     { background: color-mix(in srgb, var(--mud-palette-info) 12%, transparent); }
.report-kpi-icon--warning  { background: color-mix(in srgb, var(--mud-palette-warning) 12%, transparent); }

.report-kpi-body {
    flex: 1;
    min-width: 0;
}

.report-kpi-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--mud-palette-text-disabled);
    margin-bottom: 4px;
}

.report-kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
    color: var(--mud-palette-text-primary);
}

.report-kpi-sub {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
    margin-top: 4px;
}

/* Section heading */
.report-section {
    margin-bottom: 24px;
    animation: dash-section-enter 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.report-section--0 { animation-delay: 0.00s; }
.report-section--1 { animation-delay: 0.10s; }
.report-section--2 { animation-delay: 0.18s; }

.report-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.report-section-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.report-section-icon--user    { background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent); }
.report-section-icon--admin   { background: color-mix(in srgb, var(--mud-palette-info) 12%, transparent); }

.report-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}

.report-section-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    background: color-mix(in srgb, var(--mud-palette-text-secondary) 8%, transparent);
    color: var(--mud-palette-text-secondary);
}

/* Chart card */
.report-chart-card {
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-divider);
    border-radius: var(--app-radius-md);
    padding: 24px;
    height: 100%;
    transition: box-shadow var(--app-transition-normal),
                transform var(--app-transition-normal);
}

.report-chart-card:hover {
    box-shadow: var(--app-shadow-sm);
    transform: translateY(-1px);
}

.report-chart-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
    margin-bottom: 2px;
}

.report-chart-desc {
    font-size: 0.78rem;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 16px;
}

/* Legend for pie/donut charts */
.report-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--mud-palette-divider);
}

.report-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--mud-palette-text-secondary);
}

.report-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.report-legend-value {
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}

@media (prefers-reduced-motion: reduce) {
    .report-section { animation: none; }
    .report-kpi-card { transition: none; }
    .report-chart-card { transition: none; }
}

/* ═══════════════════════════════════════════════════════════════
   Markdown Content
   ═══════════════════════════════════════════════════════════════ */

/* ── Markdown Editor split view ── */

.md-editor-split {
    display: flex;
    gap: 16px;
    align-items: stretch;
}

.md-editor-split-pane {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.md-editor-split-input {
    flex: 1;
}

.md-editor-split-input .mud-input-control {
    height: 100%;
}

.md-editor-split-input .mud-input-outlined-border {
    height: 100%;
}

.md-editor-split-input textarea {
    min-height: 300px;
    resize: vertical;
}

.md-editor-split-preview {
    flex: 1;
    min-height: 300px;
    overflow-y: auto;
}

/* ── Markdown rendered content ── */

.markdown-content p {
    margin-bottom: 1em;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

.markdown-content li {
    margin-bottom: 0.25em;
}

/* ── Compact markdown in review table cells ── */
.review-cell-markdown {
    font-size: 0.8125rem;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
}

.review-cell-markdown p {
    margin-bottom: 0.6em;
}

.review-cell-markdown p:last-child {
    margin-bottom: 0;
}

.review-cell-markdown ul,
.review-cell-markdown ol {
    margin-bottom: 0.6em;
    padding-left: 1.25em;
}

.review-cell-markdown li {
    margin-bottom: 0.15em;
}

/* Transparent dialog backdrop — used by AppDialogOptions.SidePanelRight so the
   curator can still see the chart underneath while editing a level. */
.mud-overlay-transparent {
    background-color: transparent !important;
}

/* Highlight pulse for the chart card currently being edited (Edit dialog open). */
.edu-card-being-edited {
    outline: 3px solid #2563eb !important;
    outline-offset: -3px;
    animation: edu-edit-pulse 1.6s ease-in-out infinite;
    z-index: 4;
}
@keyframes edu-edit-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45); }
    50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
}


/* When the body is in browser fullscreen for the education chart:
   - The chart outer (`.edu-chart-fullscreen-target`) covers the viewport at
     z-index 1399 — above MudAppBar (1300) but below MudDialog (1400) and
     bulk-action bar (9999) so dialogs + side-panel edits + selection bar all
     stay clickable and visible.
   - MudAppBar + MudDrawer hide so the chart owns the viewport visually.
   - Body padding zeroed so the chart aligns flush to viewport edges. */
body.edu-chart-fullscreen .edu-chart-fullscreen-target {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1399 !important;
    border-radius: 0 !important;
    margin: 0 !important;
}
body.edu-chart-fullscreen .mud-appbar,
body.edu-chart-fullscreen .mud-drawer {
    visibility: hidden !important;
}
body.edu-chart-fullscreen {
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}
