/**
 * Global consistency and accessibility layer.
 *
 * Loaded after every page stylesheet so it can normalise shared patterns
 * without editing 60+ files. It only changes things that should look the same
 * everywhere; page-specific layout and colour remain in their own files.
 *
 * All values come from the design tokens defined in style.css (:root).
 */

/* ------------------------------------------------------------------
 * 1. Keyboard focus
 * Many older stylesheets remove the outline without putting anything back.
 * This restores a visible focus ring for keyboard users. Mouse and touch
 * users are unaffected because :focus-visible only matches keyboard focus.
 * ------------------------------------------------------------------ */
:focus-visible {
    outline: 3px solid rgba(230, 0, 35, 0.55) !important;
    outline-offset: 2px !important;
}

/* ------------------------------------------------------------------
 * 2. `hidden` actually hides
 * A few components set display:flex/grid on elements that also use the
 * hidden attribute, which left them visible. This makes the attribute win.
 * ------------------------------------------------------------------ */
[hidden] {
    display: none !important;
}

/* ------------------------------------------------------------------
 * 3. Shared text utilities
 * `.muted` is used across customer and admin pages but was only defined in
 * two stylesheets, so most pages rendered it as normal body text.
 * ------------------------------------------------------------------ */
.muted {
    color: var(--text-secondary);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ------------------------------------------------------------------
 * 4. Status pills
 * One shape for every status badge, age pill and count pill. Colours stay
 * with the page that owns them, so semantic colouring is unchanged.
 * ------------------------------------------------------------------ */
.status-badge,
.sla-pill,
.ac-count-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    vertical-align: middle;
}

/* ------------------------------------------------------------------
 * 5. Buttons
 * Consistent corner radius and weight. Heights stay compact inside tables
 * because .btn-sm is excluded.
 * ------------------------------------------------------------------ */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.btn:not(.btn-sm):not(.btn-ghost-icon) {
    min-height: 40px;
}

/* ------------------------------------------------------------------
 * 6. Form controls
 * Inputs inherit the page font and share a radius. Height is only enforced
 * on actual typed fields, not on selects inside dense table toolbars.
 * ------------------------------------------------------------------ */
.form-control,
input[type="date"],
input[type="datetime-local"] {
    font-family: inherit;
    border-radius: var(--radius-sm);
}

.form-control {
    min-height: 42px;
}

/* ------------------------------------------------------------------
 * 7. Touch targets
 * On touch screens, interactive controls should be at least 44px tall.
 * Desktop density is unchanged.
 * ------------------------------------------------------------------ */
@media (pointer: coarse) {
    .btn,
    .mobile-nav-item,
    .time-slot,
    .date-chip,
    .filter-chip {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ------------------------------------------------------------------
 * 8. Reduced motion
 * Respect the operating system setting for people who get motion sick.
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
