/* Essential Order primitives. Membria owns the token and base layers above this file.
   Layout, lists and screen-specific styles live in their own files; no legacy overrides. */
@font-face {
    font-family: Inter;
    src: url('/fonts/InterVariable.woff2') format('woff2');
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --eo-content-inset: var(--mb-sidebar-width);
    --eo-bottom-nav-height: 0px;
}

/* Membria admin typography, with 44px controls for the field team's touch use. */
.eo-app, .login-page {
    --rz-input-height: 44px;
    --rz-input-size-md: 44px;
    --rz-input-font-size: 16px;
    --rz-input-font-size-md: 16px;
    --rz-input-padding-block: 10px;
    --rz-input-padding-block-md: 10px;
    --rz-input-padding-inline: 12px;
    --rz-input-padding-inline-md: 12px;
    --rz-input-line-height: 20px;
    --rz-button-size-md: 44px;
    --rz-button-font-size: var(--mb-fs-sm);
}

button, input, select, textarea { font-family: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
.eo-icon { flex: none; vertical-align: middle; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--mb-text-2); }
.small { font-size: var(--mb-fs-sm); }
.full-width { width: 100%; }

.button, .icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    gap: var(--mb-space-2);
    min-height: 44px;
    padding: 0 var(--mb-space-4);
    border: 1px solid var(--mb-border-strong);
    border-radius: var(--mb-radius);
    background: var(--mb-surface);
    color: var(--mb-text);
    font: 500 var(--mb-fs-sm)/1.25 var(--mb-font);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.button:hover, .icon-button:hover { border-color: var(--mb-text-2); background: var(--mb-surface); text-decoration: none; }
.button.primary { border-color: var(--mb-primary); background: var(--mb-primary); color: var(--mb-on-primary); }
.button.primary:hover { background: var(--mb-primary-strong); }
.button.danger { border-color: var(--mb-danger); color: var(--mb-danger-text); }
.button.danger:hover { background: var(--mb-danger-soft); }
.button.small { padding-inline: var(--mb-space-3); }
.icon-button { width: 44px; padding: 0; border-color: transparent; background: transparent; }
.icon-button.danger { color: var(--mb-danger-text); }
.text-link, .back-link { display: inline-flex; align-items: center; gap: var(--mb-space-2); min-height: 44px; font-size: var(--mb-fs-sm); }
.back-link { margin-bottom: var(--mb-space-3); color: var(--mb-text-2); }

.panel {
    min-width: 0;
    border: 1px solid var(--mb-border);
    border-radius: var(--mb-radius-lg);
    background: var(--mb-surface);
    box-shadow: var(--mb-shadow);
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--mb-space-3);
    padding: var(--mb-space-4) var(--mb-space-5);
    border-bottom: 1px solid var(--mb-border);
}
.panel-head > div { min-width: 0; }
.panel-head h2 { font-size: var(--mb-fs-md); }
.panel-head p { margin-top: var(--mb-space-1); color: var(--mb-text-2); font-size: var(--mb-fs-sm); }
.panel-body { padding: var(--mb-space-5); }

/* One form rhythm across native controls and Radzen components. */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--mb-space-4); }
.form-span { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: var(--mb-space-1); min-width: 0; }
.field label { color: var(--mb-text); font-size: var(--mb-fs-sm); font-weight: 500; }
.field input:not([type=checkbox]):not([type=radio]), .field select, textarea,
.login-card input {
    width: 100%;
    min-height: 44px;
    padding: 10px var(--mb-space-3);
    border: var(--rz-input-border);
    border-radius: var(--mb-radius);
    background: var(--mb-surface);
    color: var(--mb-text);
    font-size: 16px;
    line-height: 20px;
}
textarea { resize: vertical; min-height: 96px; }
.field input:focus-visible, .field select:focus-visible, textarea:focus-visible, .login-card input:focus-visible {
    outline: none;
    border: var(--rz-input-focus-border);
    box-shadow: var(--rz-input-focus-shadow);
}
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--mb-space-2); margin-top: var(--mb-space-5); }
.check-label { display: flex; align-items: center; gap: var(--mb-space-2); min-height: 44px; font-size: var(--mb-fs-sm); }
input[type=checkbox] { accent-color: var(--mb-primary); width: 18px; height: 18px; flex: none; margin: 0; }
.validation-message { color: var(--mb-danger-text); font-size: var(--mb-fs-sm); }

.notice {
    display: flex;
    align-items: flex-start;
    gap: var(--mb-space-2);
    padding: var(--mb-space-3) var(--mb-space-4);
    margin-bottom: var(--mb-space-4);
    border: 1px solid var(--mb-border);
    border-radius: var(--mb-radius);
    font-size: var(--mb-fs-sm);
    overflow-wrap: anywhere;
}
.notice p + p { margin-top: var(--mb-space-1); }
.notice.info { background: var(--mb-info-soft); color: var(--mb-info-text); border-color: color-mix(in srgb, var(--mb-info-text) 25%, var(--mb-info-soft)); }
.notice.warning { background: var(--mb-warning-soft); color: var(--mb-warning-text); border-color: color-mix(in srgb, var(--mb-warning-text) 25%, var(--mb-warning-soft)); }
.notice.error, .notice.danger { background: var(--mb-danger-soft); color: var(--mb-danger-text); border-color: color-mix(in srgb, var(--mb-danger-text) 25%, var(--mb-danger-soft)); }
.notice.success { background: var(--mb-accent-soft); color: var(--mb-accent-text); border-color: color-mix(in srgb, var(--mb-accent-text) 25%, var(--mb-accent-soft)); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid var(--mb-border); border-radius: var(--mb-radius-pill); font-size: var(--mb-fs-xs); font-weight: 500; white-space: nowrap; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-pill.neutral, .status-pill.muted { background: var(--mb-surface-2); color: var(--mb-text-2); border-color: color-mix(in srgb, var(--mb-text-2) 25%, var(--mb-surface-2)); }
.status-pill.warning { background: var(--mb-warning-soft); color: var(--mb-warning-text); border-color: color-mix(in srgb, var(--mb-warning-text) 25%, var(--mb-warning-soft)); }
.status-pill.success { background: var(--mb-accent-soft); color: var(--mb-accent-text); border-color: color-mix(in srgb, var(--mb-accent-text) 25%, var(--mb-accent-soft)); }
.status-pill.info { background: var(--mb-info-soft); color: var(--mb-info-text); border-color: color-mix(in srgb, var(--mb-info-text) 25%, var(--mb-info-soft)); }
.loading { padding: var(--mb-space-6); color: var(--mb-text-2); text-align: center; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: var(--mb-space-3); padding: var(--mb-space-6); text-align: center; }
.empty-state h2 { font-size: var(--mb-fs-md); }
.empty-state p { max-width: 42ch; color: var(--mb-text-2); font-size: var(--mb-fs-sm); }
.empty-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--mb-radius-lg); background: var(--mb-surface-2); color: var(--mb-text-2); }

/* Native dialog keeps the browser's focus trap; spacing follows Membria MbDialog. */
.eo-dialog {
    width: min(100% - 32px, 44rem);
    max-height: calc(100dvh - 64px);
    padding: 0;
    border: 1px solid var(--mb-border);
    border-radius: var(--mb-radius-xl);
    background: var(--mb-surface);
    color: var(--mb-text);
    box-shadow: var(--mb-shadow-float);
    overflow: hidden;
}
.eo-dialog[open] { display: flex; flex-direction: column; }
.eo-dialog::backdrop { background: var(--mb-scrim); }
.eo-dialog > header { display: flex; align-items: center; justify-content: space-between; gap: var(--mb-space-3); flex: none; padding: var(--mb-space-4) var(--mb-space-5); border-bottom: 1px solid var(--mb-border); }
.eo-dialog > header h2 { font-size: var(--mb-fs-lg); min-width: 0; overflow-wrap: anywhere; }
.modal-body { min-height: 0; overflow: auto; padding: var(--mb-space-5); overscroll-behavior: contain; }
body:has(dialog[open]) { overflow: hidden; }
.amount-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--mb-space-3); margin-top: var(--mb-space-5); padding: var(--mb-space-4); border-radius: var(--mb-radius); background: var(--mb-surface-2); font-size: var(--mb-fs-sm); }
.amount-summary strong { font-size: var(--mb-fs-xl); font-variant-numeric: tabular-nums; }

.login-page { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--mb-space-5); padding: var(--mb-space-5); background: var(--mb-bg); }
.login-brand { font-weight: 600; font-size: var(--mb-fs-xl); }
.login-card { width: min(100%, 420px); padding: var(--mb-space-6); border: 1px solid var(--mb-border); border-radius: var(--mb-radius-lg); background: var(--mb-surface); box-shadow: var(--mb-shadow); }
.login-card h1 { margin-bottom: var(--mb-space-1); }
.login-card form { display: flex; flex-direction: column; gap: var(--mb-space-2); margin-block: var(--mb-space-5); }
.login-card label { font-size: var(--mb-fs-sm); font-weight: 500; }
.login-card label:not(:first-of-type) { margin-top: var(--mb-space-2); }
.login-card button { margin-top: var(--mb-space-3); }
.login-card .notice { margin-top: var(--mb-space-4); }
.login-footnote { color: var(--mb-text-2); font-size: var(--mb-fs-sm); }
.public-main { max-width: 60rem; margin: auto; padding: var(--mb-space-5); }
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000; padding: var(--mb-space-3) var(--mb-space-5); background: var(--mb-danger-soft); color: var(--mb-danger-text); }
#blazor-error-ui .dismiss { margin-left: var(--mb-space-4); border: 0; background: transparent; font-size: 20px; }

@media (min-width: 768px) and (max-width: 1099.98px) {
    :root { --eo-content-inset: var(--mb-sidebar-rail-width); }
}
@media (max-width: 767.98px) {
    :root { --eo-content-inset: 0px; }
    .panel-head, .panel-body { padding: var(--mb-space-4); }
}
@media (max-width: 639.98px) {
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .eo-dialog { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
    .eo-dialog > header, .modal-body { padding: var(--mb-space-4); }
    .form-actions { justify-content: stretch; }
    .form-actions > * { flex: 1 1 auto; }
    .login-card { padding: var(--mb-space-5); }
}
@media (forced-colors: active) {
    .panel, .status-pill, .eo-dialog { border: 1px solid CanvasText; }
}

/* Consistent action feedback, visible even in long tables and native dialogs. */
.action-toast-region { position: fixed; top: 72px; right: 24px; width: min(420px, calc(100vw - 32px)); z-index: 1200; pointer-events: none; }
.action-toast { align-items: center; gap: var(--mb-space-3); margin: 0; padding: var(--mb-space-2) var(--mb-space-3); border: 1px solid currentColor; box-shadow: var(--mb-shadow-float); pointer-events: auto; }
.action-toast-message { flex: 1; min-width: 0; line-height: 1.5; }
.action-toast .icon-button { color: inherit; font-size: 24px; }
.notice.error:focus { outline: 2px solid var(--mb-danger); outline-offset: 3px; }
a[aria-busy=true] { cursor: progress; opacity: .65; }
@media (max-width: 639.98px) { .action-toast-region { right: 16px; } }
