:root {
    --c-ink: #1b2440;
    --c-ink-soft: #5a6383;
    --c-paper: #f3f5fa;
    --c-surface: #ffffff;
    --c-line: #e3e7f0;
    --c-blue: #316cf9;
    --c-blue-wash: #eaf0ff;
    --c-deep: #00589c;
    --c-violet: #a04de4;
    --c-violet-wash: #f4ebfc;
    --c-green: #1f9d6b;
    --c-amber: #c98a1b;
    --c-red: #d14343;
    --c-spine: linear-gradient(180deg, #316cf9 0%, #00589c 46%, #a04de4 100%);
    --c-font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

body.admin-body {
    margin: 0;
    background: var(--c-paper);
    color: var(--c-ink);
    font-family: var(--c-font);
    font-feature-settings: "tnum" 1;
    -webkit-font-smoothing: antialiased;
}

/* ─── Shell of the Perial template (its app.css) ───────────── */
/* The page never scrolls: the main content does, under the app bar. A drawer's overlay then holds still everything
   it covers, and no scrollbar shows beside it. */
body.admin-body {
    height: 100dvh;
    overflow: hidden;
}

.vh-100 {
    height: 100vh;
    height: 100dvh;
}

.min-h-full {
    min-height: 100%;
}

.mud-layout {
    --app-sim-banner-height: 0px;
    display: flex;
    flex-direction: column;
}

.mud-layout .mud-main-content {
    flex: 1 1 0%;
    min-height: 0;
    padding-top: 0;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

/* The app bar is in the flow with its two rows: the theme's app bar height is theirs, and only places the drawer of a
   section's pages under it. The simulation strip above the app bar pushes that drawer down as well. */
.mud-layout.has-role-simulation {
    --app-sim-banner-height: 40px;
}

.mud-layout .mud-drawer.mud-drawer-clipped-always {
    top: calc(var(--mud-appbar-height) + var(--app-sim-banner-height));
    height: calc(100% - var(--mud-appbar-height) - var(--app-sim-banner-height));
}

.app-sim-banner {
    flex-shrink: 0;
    height: var(--app-sim-banner-height);
}

.app-sim-banner > .mud-paper,
.app-sim-banner > .mud-paper > * {
    height: 100%;
}

.app-header .mud-toolbar-appbar {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    min-height: auto;
    padding: 0;
}

.mud-drawer {
    border-radius: 0;
}

/* ─── Top navigation tabs ──────────────────────────────────── */
/* Its first row is 88px high, the logo's: with this one, the app bar is the theme's 128px. */
.nav-row {
    height: 40px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.nav-tab.mud-button-root {
    flex-shrink: 0;
    min-width: auto;
    padding: 8px 16px;
    border-radius: 0;
    font-size: 0.8125rem;
    font-weight: 400;
    white-space: nowrap;
    opacity: 0.7;
    transition: opacity 0.2s, background-color 0.2s;
}

.nav-tab.mud-button-root .mud-button-icon-start {
    margin-right: 4px;
}

.nav-tab.mud-button-root:hover:not(:disabled) {
    background-color: rgba(128, 128, 128, 0.12);
    opacity: 1;
}

.nav-tab-active.mud-button-root {
    font-weight: 500;
    opacity: 1;
    box-shadow: inset 0 -3px 0 0 currentColor;
}

/* ─── Lists shown as tables: a row opens its drawer ────────── */
.list-table {
    overflow-x: auto;
    border: 1px solid var(--c-line);
    border-radius: 12px;
    background: var(--c-surface);
}

.list-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.list-table th {
    padding: 12px 16px;
    border-bottom: 1px solid var(--c-line);
    color: var(--c-ink-soft);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.list-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--c-line);
    vertical-align: middle;
}

.list-table tbody tr {
    cursor: pointer;
}

.list-table tbody tr:last-child td {
    border-bottom: 0;
}

.list-table tbody tr:hover {
    background: var(--c-paper);
}

.list-table tbody tr.selected {
    background: var(--c-blue-wash);
}

/* The button of a row, the one the keyboard reaches: its title. */
.list-table .row-title {
    padding: 0;
    border: 0;
    background: none;
    color: var(--c-ink);
    font: 700 0.875rem var(--c-font);
    text-align: left;
    cursor: pointer;
}

.list-table .row-title:focus-visible {
    outline: 2px solid var(--c-blue);
    outline-offset: 2px;
}

.list-table tr.selected .row-title {
    color: var(--c-blue);
}

.list-table .muted {
    color: var(--c-ink-soft);
    font-size: 0.8125rem;
}

.list-table .nowrap {
    white-space: nowrap;
}

/* ─── Grouped choices: a select's options under titles ─────── */
/* The titles name a group and are not chosen: small, grey, pinned while their group scrolls; the choices stand under them. */
.grouped-select .mud-list-subheader {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 6px;
    border-top: 1px solid var(--c-line);
    background: var(--c-surface);
    color: var(--c-ink-soft);
    font-size: 0.75rem;
    font-weight: 700;
}

.grouped-select .mud-list-subheader:first-child {
    border-top: 0;
}

.grouped-select .mud-list-item {
    padding-top: 6px;
    padding-bottom: 6px;
    padding-left: 44px;
}

/* ─── Rows moved by dragging (DragReorder) ─────────────────── */
.row-dragging {
    opacity: 0.4;
}

.row-drop-before,
.row-drop-after {
    position: relative;
}

.row-drop-before::before,
.row-drop-after::after {
    content: "";
    position: absolute;
    right: 8px;
    left: 8px;
    z-index: 1;
    height: 2px;
    border-radius: 2px;
    background: var(--c-blue);
}

.row-drop-before::before {
    top: -1px;
}

.row-drop-after::after {
    bottom: -1px;
}

/* A table row draws the line on its cells. */
tr.row-drop-before::before,
tr.row-drop-after::after {
    content: none;
}

tr.row-drop-before > td {
    box-shadow: inset 0 2px 0 var(--c-blue);
}

tr.row-drop-after > td {
    box-shadow: inset 0 -2px 0 var(--c-blue);
}

.mud-table-root .mud-table-cell {
    font-family: var(--c-font);
}

/* MudBlazor ships the asterisk of a required field without a colour. */
.mud-input-required .mud-input-label::after {
    color: var(--mud-palette-error);
}
