/* ── Back Office look ───────────────────────────────────────────────────────────────────────────
   Tokens first; Mud's palette (Layout/BackOfficeTheme.cs) carries the same colours, and this file
   covers what a Mud theme cannot express: the drawer, pill tabs, mono tags, hairline cards.
   Loaded after app.css, which keeps only the Blazor framework pieces. ───────────────────────────── */

:root {
    --bo-orange: #ff5a1f;
    --bo-orange-soft: #fde9df;
    --bo-orange-ink: #c2410c;
    --bo-ink: #1b1a17;
    --bo-muted: #7a746b;
    --bo-line: #e8e3da;
    --bo-line-input: #ddd7cb;
    --bo-cream: #f6f3ee;
    --bo-cream-2: #f1ede6;
    --bo-night: #0b0b0b;
    --bo-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

html, body {
    background: var(--bo-cream);
    color: var(--bo-ink);
    font-family: Inter, Roboto, Helvetica, Arial, sans-serif;
}

code { color: var(--bo-orange-ink); }

.bo-muted { color: var(--bo-muted); }
.bo-spacer { flex: 1 1 auto; }

/* ── Drawer ─────────────────────────────────────────────────────────────────────────────────── */

.bo-drawer.mud-drawer {
    background: var(--bo-night);
    color: #e9e6df;
    border: 0;
    padding: 20px 16px;
}

.bo-drawer .mud-drawer-content { overflow-y: auto; }

.bo-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 18px;
    color: #fff;
}

.bo-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--bo-orange);
    color: #fff;
    flex: 0 0 auto;
}

.bo-brand-name { font-size: 1rem; font-weight: 500; letter-spacing: -0.005em; }
.bo-brand-dark { color: var(--bo-ink); padding-bottom: 24px; }

.bo-nav-label {
    padding: 22px 12px 8px;
    font-family: var(--bo-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bo-orange);
}

.bo-nav .mud-nav-link {
    margin: 2px 0;
    padding: 10px 14px;
    border-radius: 10px;
    color: #e9e6df;
    font-size: 0.9375rem;
}

.bo-nav .mud-nav-link .mud-nav-link-icon { color: #bdb8ae; margin-inline-end: 12px; }

.bo-nav .mud-nav-link:hover:not(.active) { background: rgba(255, 255, 255, 0.07); }

.bo-drawer .bo-nav .mud-nav-link.active:not(.mud-nav-link-disabled),
.bo-drawer .bo-nav .mud-nav-link.active:not(.mud-nav-link-disabled):hover {
    background: var(--bo-orange) !important;
    color: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
}

.bo-drawer .bo-nav .mud-nav-link.active .mud-nav-link-icon,
.bo-drawer .bo-nav .mud-nav-link.active .mud-nav-link-text { color: #fff !important; }

.bo-nav .mud-nav-link.active::after,
.bo-nav .mud-nav-link.active::before { display: none; }

/* ── Frame ──────────────────────────────────────────────────────────────────────────────────── */

.bo-main.mud-main-content {
    background: var(--bo-cream);
    min-height: 100vh;
    padding-top: 0;
}

.bo-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 28px 40px 0;
    font-size: 0.875rem;
}

.bo-content {
    padding: 22px 40px 56px;
    width: 100%;
}

.bo-tag {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 6px;
    background: var(--bo-orange-soft);
    color: var(--bo-orange-ink);
    font-family: var(--bo-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bo-tag-user { text-transform: none; letter-spacing: 0; font-size: 0.75rem; }

.bo-link-button {
    border: 0;
    background: none;
    padding: 4px 0;
    color: var(--bo-muted);
    font: inherit;
    cursor: pointer;
}

.bo-link-button:hover { color: var(--bo-ink); }

.bo-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.bo-page-head-aside { color: var(--bo-muted); font-size: 0.875rem; }

/* ── Dashboard tiles ────────────────────────────────────────────────────────────────────────── */

.bo-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
}

.bo-stat {
    background: #fff;
    border: 1px solid var(--bo-line);
    border-radius: 16px;
    padding: 22px 24px;
}

.bo-stat .bo-stat-icon { margin-bottom: 18px; }

.bo-stat-value {
    font-family: var(--bo-mono);
    font-size: 1.875rem;
    font-weight: 500;
    line-height: 1.15;
    color: var(--bo-ink);
}

.bo-stat-label { margin-top: 4px; color: var(--bo-muted); font-size: 0.875rem; }

/* ── Sign-in ────────────────────────────────────────────────────────────────────────────────── */

.bo-auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background: var(--bo-cream);
}

.bo-auth-card {
    width: min(440px, 100%);
    background: #fff;
    border: 1px solid var(--bo-line);
    border-radius: 20px;
    padding: 36px 36px 32px;
}

/* ── Mud components, re-skinned ─────────────────────────────────────────────────────────────── */

/* Cards: hairline border instead of a shadow. Popovers, menus and dialogs keep theirs. */
.bo-main .mud-paper.mud-elevation-1,
.bo-main .mud-paper.mud-elevation-2,
.bo-main .mud-paper.mud-elevation-3 {
    box-shadow: none;
    border: 1px solid var(--bo-line);
    border-radius: 16px;
}

.mud-dialog { border-radius: 16px; }
.mud-alert { border-radius: 12px; }

/* Tables */
.bo-main .mud-table { background: #fff; overflow: hidden; }

.bo-main .mud-table-head .mud-table-cell {
    background: var(--bo-cream-2);
    color: var(--bo-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    border-bottom: 1px solid var(--bo-line);
}

.bo-main .mud-table-body .mud-table-cell { border-bottom: 1px solid #efebe3; }
.bo-main .mud-table-body .mud-table-row:last-child .mud-table-cell { border-bottom: 0; }
.bo-main .mud-table-hover .mud-table-body .mud-table-row:hover { background: #fbf8f3; }
.bo-main .mud-table-pagination { border-top: 1px solid var(--bo-line); }

/* Buttons */
.mud-button-root { border-radius: 10px; }
.mud-button-filled { box-shadow: none; }
.mud-button-filled:hover { box-shadow: none; }
.mud-button-outlined { border-color: var(--bo-line-input); }
.mud-button-filled.mud-button-filled-primary:hover { background: #e84e17; }

/* Inputs: white boxes with a quiet border, orange on focus */
.mud-input.mud-input-outlined { background: #fff; border-radius: 10px; }
.mud-input-outlined .mud-input-outlined-border { border-radius: 10px; border-color: var(--bo-line-input); }
.mud-input-label { color: var(--bo-muted); }

/* Tags */
.mud-chip {
    border-radius: 6px;
    height: 24px;
    font-family: var(--bo-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mud-chip.mud-chip-filled.mud-chip-color-default { background: var(--bo-orange-soft); color: var(--bo-orange-ink); }

/* Tabs as pills */
.bo-main .mud-tabs-tabbar { background: transparent; box-shadow: none; }
.bo-main .mud-tabs-tabbar-inner { gap: 6px; padding-bottom: 4px; }
.bo-main .mud-tab-slider { display: none; }

.bo-main .mud-tab {
    min-height: 38px;
    padding: 6px 18px;
    border-radius: 999px;
    text-transform: none;
    font-weight: 500;
    color: var(--bo-muted);
    opacity: 1;
}

.bo-main .mud-tab.mud-tab-active { background: var(--bo-orange); color: #fff; }
.bo-main .mud-tab:hover:not(.mud-tab-active) { background: var(--bo-cream-2); }

/* ── Small screens ──────────────────────────────────────────────────────────────────────────── */

@media (max-width: 960px) {
    .bo-topbar { padding: 16px 16px 0; }
    .bo-content { padding: 16px 16px 40px; }
    .bo-page-head { flex-direction: column; align-items: flex-start; }
}

/* Pagination: centred under every table, in pages and dialogs alike. */
/* Mud renders it inline-flex (shrink-wrapped), so there is no free space to centre in; make it a full-width flex row. */
.mud-pagination { display: flex; justify-content: center; }

.bo-mono-text { font-family: var(--bo-mono); font-size: 0.8125rem; }
