html, body {
    margin: 0;
    padding: 0;
    background: var(--fr-bg);
    color: var(--fr-text);
    font-family: -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

/* Phase 11 Slice D — accessibility primitives.
   Visible focus ring on every focusable surface that gets keyboard focus. Defaults
   to a terracotta outline against the cream background (contrast ratio safe). The
   browser default outline is suppressed only for mouse-driven focus via :focus
   without :focus-visible — keyboard users still see the ring. */
:focus { outline: none; }

:focus-visible {
    outline: 2px solid var(--fr-terracotta);
    outline-offset: 2px;
    border-radius: 3px;
}

/* Skip-to-main link in MainLayout: visually hidden until it receives keyboard
   focus, then docks at the top-left so a screen-reader / Tab user can jump past
   the chrome straight into the conversation. */
.fr-skip-link {
    position: absolute;
    left: -10000px;
    top: 0;
    z-index: 1000;
    background: var(--fr-walnut);
    color: var(--fr-cream);
    padding: 0.5rem 1rem;
    border-radius: 0 0 var(--fr-radius) 0;
    text-decoration: none;
}

.fr-skip-link:focus {
    left: 0;
}

/* Screen-reader-only utility for icon-only buttons that need a label exposed
   to assistive tech but kept off the rendered chrome. */
.fr-sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

a {
    color: var(--fr-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    color: var(--fr-walnut);
    margin-top: 0;
    line-height: 1.25;
}

code {
    background: var(--fr-surface);
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid var(--fr-border);
    font-size: 0.92em;
}

.fr-form {
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* DM disclosure — quiet, terracotta-bordered aside on /dm/new and inside each DM
   view. Surfaces the spec §6 policy ("a participant can report a DM to an admin")
   so participants aren't surprised later. */
.fr-dm-disclosure {
    border-left: 3px solid var(--fr-terracotta);
    padding: 0.4rem 0.7rem;
    background: rgba(194, 90, 59, 0.05);
    border-radius: var(--fr-radius);
    font-size: 0.88rem;
}

/* Phase 11 Slice C — shared empty-state + loading-skeleton primitives.
   Pages reach for these rather than inline ad-hoc styles so empties + loaders
   read consistently across the app. */
.fr-empty {
    border: 1px dashed var(--fr-border);
    border-radius: var(--fr-radius);
    padding: 1.25rem 1rem;
    color: var(--fr-text-muted);
    text-align: center;
    background: var(--fr-cream);
}

.fr-empty strong {
    color: var(--fr-walnut);
    display: block;
    margin-bottom: 0.25rem;
}

/* Skeleton blocks shimmer subtly so the user knows "this is loading", not "this
   is empty". Used by pages that swap them in while their first DB round-trip
   runs. Honor reduced-motion preferences — pulse becomes a static tint. */
.fr-skeleton {
    background: linear-gradient(90deg,
        rgba(58, 36, 24, 0.04) 0%,
        rgba(58, 36, 24, 0.10) 50%,
        rgba(58, 36, 24, 0.04) 100%);
    background-size: 200% 100%;
    border-radius: var(--fr-radius);
    animation: fr-skeleton-pulse 1.4s ease-in-out infinite;
}

.fr-skeleton-row {
    height: 1em;
    margin: 0.4rem 0;
}

.fr-skeleton-card {
    height: 5rem;
    margin: 0.5rem 0;
}

@keyframes fr-skeleton-pulse {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .fr-skeleton {
        animation: none;
        background: rgba(58, 36, 24, 0.07);
    }
}

.fr-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.fr-field-inline {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.fr-field label {
    font-weight: 500;
    color: var(--fr-walnut);
    font-size: 0.93rem;
}

.fr-field input[type="text"],
.fr-field input[type="password"],
.fr-field input[type="email"],
.fr-field input:not([type]) {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--fr-border);
    border-radius: var(--fr-radius);
    background: var(--fr-surface);
    color: var(--fr-text);
    font: inherit;
}

.fr-field input:focus {
    outline: 2px solid var(--fr-terracotta);
    outline-offset: 1px;
    border-color: var(--fr-terracotta);
}

.fr-button {
    align-self: flex-start;
    padding: 0.55rem 1.1rem;
    background: var(--fr-terracotta);
    color: #fff;
    border: 0;
    border-radius: var(--fr-radius);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.fr-button:hover {
    filter: brightness(0.95);
}

.fr-button-secondary {
    background: var(--fr-surface);
    color: var(--fr-walnut);
    border: 1px solid var(--fr-border);
}

.fr-error {
    color: #a4392b;
    font-size: 0.9rem;
}

.fr-table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

.fr-table th, .fr-table td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--fr-border);
}

.fr-table th {
    background: var(--fr-cream);
    font-weight: 600;
}

.fr-callout {
    background: #fff8e1;
    border: 1px solid #f0c36d;
    color: var(--fr-walnut);
    padding: 0.75rem 1rem;
    border-radius: var(--fr-radius);
    margin: 1rem 0;
}

.fr-callout code {
    background: rgba(0,0,0,0.05);
    word-break: break-all;
}

.fr-muted { color: var(--fr-text-muted); }

.fr-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    background: var(--fr-surface);
    border-bottom: 1px solid var(--fr-border);
    box-shadow: var(--fr-shadow);
}

.fr-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fr-mark {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--fr-terracotta);
    display: inline-block;
}

.fr-wordmark {
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    color: var(--fr-walnut);
}

/* .fr-main is the scroll container (sized to fill the body row in MainLayout.razor.css).
   The inner wrapper carries padding + readable max-width so the scrollbar lives on the
   viewport's right edge while content stays centered. */
.fr-main-inner {
    padding: 2rem 1.25rem;
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

#blazor-error-ui {
    background: #fff8e1;
    border-top: 1px solid #f0c36d;
    color: var(--fr-walnut);
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    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;
}
