*, *::before, *::after {
    box-sizing: border-box;
}

/* Native form controls (<input type=date>, <select>, scrollbars) follow the theme — default light,
   flip to dark with the OS or the manual data-theme hook (mirrors the dark blocks in mileage-tokens.css).
   Without this, native controls stay light-on-dark (e.g. the Reports date pickers). #blazor-error-ui
   keeps its own color-scheme: light only below. */
:root { color-scheme: light; }
@media (prefers-color-scheme: dark) { :root { color-scheme: dark; } }
:root[data-theme="dark"] { color-scheme: dark; }

html, body, #app {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--mileage-page-bg);
    color: var(--mileage-text-primary);
}

input, textarea, select, button {
    font-family: inherit;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    padding: 1rem;
    background: var(--mileage-error);
    color: white;
    border-radius: 6px;
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--mileage-outline);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--mileage-brand);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* Sidebar nav links — GLOBAL on purpose (moved out of NavItem.razor.css). Blazor component-scoped
   CSS does not decorate the <a> that <NavLink> (a child component) renders, so a scoped
   `.nav-item-link` selector never matches it and the flex layout (icon + label inline) dies. */
.nav-item-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--mileage-text-secondary);
    text-decoration: none;
    border-radius: 6px;
    margin: 1px 8px;
    transition: background 0.1s, color 0.1s;
}

.nav-item-link:hover {
    background: var(--mileage-surface-variant);
    color: var(--mileage-text-primary);
    text-decoration: none;
}

.nav-item-link.active {
    background: var(--mileage-business-bg);
    color: var(--mileage-brand);
    font-weight: 600;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* The month MudDatePicker is opened programmatically from the .month-label span, so its own input
   must be hidden. GLOBAL (not Home.razor.css) for the same reason as .nav-item-link above: scoped CSS
   never decorates a child component's (MudDatePicker's) rendered root, so the scoped rule never matched
   and the input rendered visibly — a duplicate "Month YYYY". !important beats MudBlazor's own sizing. */
.month-picker-mud {
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0;
    pointer-events: none;
}
