/* Cute neo-brutalism, printed as a two-ink risograph zine, layered over MudBlazor.
 *
 * The idea: figures are crisp soy-black ink on uncoated paper; colour lives on plates.
 * The neo-brutalist hard shadow is not a black slab any more but a second ink plate
 * that slipped off register — pink under blue, blue under pink.
 *
 * The palette that feeds every --mud-palette-* variable lives in App.razor. What is
 * here is what Material has no vocabulary for. index.html loads this after
 * MudBlazor.min.css, so equal-specificity rules win on order; where MudBlazor's own
 * selector is more specific, the selector below matches its shape exactly rather than
 * reaching for !important.
 *
 * AdminWeb carries a copy of this file (wwwroot/css/neobrutalism.css there). Identity's
 * site.css and Mobile's Colors.xaml repeat the tokens. Change one, change all four. */

:root {
    --nb-ink: #15131A;      /* soy black — every figure and rule */
    --nb-paper: #F7F3EA;    /* uncoated stock — page */
    --nb-sheet: #FFFDF8;    /* brighter sheet — cards, inputs */
    --nb-muted: #5E5866;

    /* riso drum colours */
    --nb-pink: #FF48B0;     /* fluorescent pink */
    --nb-blue: #0078BF;     /* medium blue */
    --nb-yellow: #FFE800;   /* yellow */

    /* tints: the same inks printed at a light screen */
    --nb-pink-tint: #FFD9EE;
    --nb-blue-tint: #D3E8F6;
    --nb-yellow-tint: #FFF6A8;

    /* The law: these two mean gain and loss and nothing else. */
    --nb-gain: #067A43;
    --nb-loss: #D0283C;

    --nb-rule: 2px solid var(--nb-ink);
    --nb-radius: 14px;

    --nb-display: "Bricolage Grotesque", "Onest", system-ui, sans-serif;
    --nb-text: "Onest", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;

    /* Material's blurred elevation ramp, replaced with off-register plates. Every
     * MudBlazor surface reads its shadow from these, so MudPaper, MudCard, MudDialog,
     * menus and popovers all print the same way, including components added later.
     * Low elevations are the everyday card: blue plate. High ones (menus, dialogs)
     * float, so they get the louder pink. */
    --mud-elevation-0: none;
    --mud-elevation-1: 3px 3px 0 var(--nb-blue);
    --mud-elevation-2: 4px 4px 0 var(--nb-blue);
    --mud-elevation-3: 4px 4px 0 var(--nb-blue);
    --mud-elevation-4: 5px 5px 0 var(--nb-blue);
    --mud-elevation-5: 5px 5px 0 var(--nb-blue);
    --mud-elevation-6: 5px 5px 0 var(--nb-blue);
    --mud-elevation-7: 6px 6px 0 var(--nb-pink);
    --mud-elevation-8: 6px 6px 0 var(--nb-pink);
    --mud-elevation-9: 6px 6px 0 var(--nb-pink);
    --mud-elevation-10: 6px 6px 0 var(--nb-pink);
    --mud-elevation-11: 6px 6px 0 var(--nb-pink);
    --mud-elevation-12: 7px 7px 0 var(--nb-pink);
    --mud-elevation-13: 7px 7px 0 var(--nb-pink);
    --mud-elevation-14: 7px 7px 0 var(--nb-pink);
    --mud-elevation-15: 7px 7px 0 var(--nb-pink);
    --mud-elevation-16: 7px 7px 0 var(--nb-pink);
    --mud-elevation-17: 7px 7px 0 var(--nb-pink);
    --mud-elevation-18: 7px 7px 0 var(--nb-pink);
    --mud-elevation-19: 7px 7px 0 var(--nb-pink);
    --mud-elevation-20: 7px 7px 0 var(--nb-pink);
    --mud-elevation-21: 7px 7px 0 var(--nb-pink);
    --mud-elevation-22: 7px 7px 0 var(--nb-pink);
    --mud-elevation-23: 7px 7px 0 var(--nb-pink);
    --mud-elevation-24: 8px 8px 0 var(--nb-pink);
    --mud-elevation-25: 8px 8px 0 var(--nb-pink);
}

/* ---------- paper & type ---------- */

body,
.mud-layout {
    background-color: var(--nb-paper);
}

body,
.mud-typography,
.mud-input-control,
.mud-button-root,
.mud-table,
.mud-nav-link,
input, textarea, select, button {
    font-family: var(--nb-text);
}

/* Every figure in the app lines up in columns: money is the content. */
body {
    font-weight: 500;
    color: var(--nb-ink);
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

.mud-typography-h1, .mud-typography-h2, .mud-typography-h3,
.mud-typography-h4, .mud-typography-h5, .mud-typography-h6 {
    font-family: var(--nb-display);
    font-weight: 800;
    letter-spacing: -.025em;
}

/* h5 is how every page prints a headline figure, so it gets the display cut. */
.mud-typography-h5 { font-size: 1.65rem; line-height: 1.15; }

.mud-typography-subtitle1, .mud-typography-subtitle2 { font-weight: 700; }

.mud-typography-caption { font-weight: 600; letter-spacing: .01em; }

::selection { background: var(--nb-pink); color: var(--nb-ink); }

:focus-visible { outline: 3px solid var(--nb-blue); outline-offset: 2px; }

* { scrollbar-color: var(--nb-ink) transparent; scrollbar-width: thin; }

a { text-underline-offset: 3px; text-decoration-thickness: 2px; }

/* ---------- surfaces ---------- */

.mud-paper {
    border: var(--nb-rule);
    border-radius: 16px;
}

.mud-paper-outlined { border: var(--nb-rule); }

/* A table already inside a card is part of it: one outline, not two. */
.mud-paper .mud-table,
.mud-paper .mud-paper.mud-elevation-0 {
    border: 0;
    box-shadow: none;
}

.mud-appbar {
    border-bottom: var(--nb-rule);
}

.mud-appbar .mud-toolbar { font-weight: 700; }

.mud-drawer {
    border-right: var(--nb-rule);
}

.mud-dialog {
    border: var(--nb-rule);
    border-radius: 20px;
}

/* Popovers and menus are papers too, but tiny ones; a full plate is too heavy. */
.mud-popover.mud-paper { border-radius: 12px; }

/* ---------- the wordmark ---------- */

/* Two discs, pink and blue, overprinted: where they cross, multiply gives the violet a
 * real riso sheet gets. Pure CSS in MainLayout's brand span, no asset. */
.nb-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--nb-display);
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -.03em;
}

.nb-brand__mark {
    position: relative;
    width: 30px;
    height: 22px;
    flex: none;
}

.nb-brand__mark::before,
.nb-brand__mark::after {
    content: "";
    position: absolute;
    top: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    mix-blend-mode: multiply;
}

.nb-brand__mark::before { left: 0; background: var(--nb-pink); }
.nb-brand__mark::after { left: 8px; top: 1px; background: var(--nb-blue); }

/* ---------- buttons ---------- */

/* Filled and outlined buttons are the printed objects. Text buttons stay type, and icon
 * buttons are excluded because MudBlazor reuses .mud-button-root for select arrows,
 * picker arrows and dialog close buttons. */
.mud-button-filled,
.mud-button-outlined {
    border: var(--nb-rule);
    border-radius: 12px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: 3px 3px 0 var(--nb-blue);
    transition: transform .09s cubic-bezier(.2, .8, .2, 1), box-shadow .09s cubic-bezier(.2, .8, .2, 1);
}

.mud-button-filled:hover,
.mud-button-outlined:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--nb-blue);
}

.mud-button-filled:active,
.mud-button-outlined:active {
    transform: translate(3px, 3px);
    box-shadow: 0 0 0 transparent;
}

.mud-button-outlined { background-color: var(--nb-sheet); }

.mud-button-text { font-weight: 700; text-transform: none; letter-spacing: 0; border-radius: 10px; }

/* Disabled prints as a hatch, not as grey: an unprinted area of the sheet. */
.mud-button-filled.mud-button-disabled,
.mud-button-outlined.mud-button-disabled,
.mud-input.mud-disabled {
    background-image: repeating-linear-gradient(-45deg, transparent 0 5px, rgba(21, 19, 26, .12) 5px 6px);
    box-shadow: none;
    transform: none;
}

/* The app bar sits on paper; its currency toggle keeps the outline but a small press. */
.mud-appbar .mud-button-root:not(.mud-icon-button) {
    border: var(--nb-rule);
    border-radius: 10px;
    font-weight: 800;
    box-shadow: 2px 2px 0 var(--nb-pink);
}

/* ---------- inputs ---------- */

.mud-input.mud-input-outlined .mud-input-outlined-border {
    border-width: 2px;
    border-color: var(--nb-ink);
    border-radius: 12px;
}

.mud-input.mud-input-outlined:hover .mud-input-outlined-border {
    border-width: 2px;
    border-color: var(--nb-ink);
}

/* Focus prints the pink plate under the field. */
.mud-input.mud-input-outlined.mud-focused .mud-input-outlined-border {
    border-width: 2px;
    border-color: var(--nb-ink);
    box-shadow: 3px 3px 0 var(--nb-pink);
}

.mud-input.mud-input-outlined { background-color: var(--nb-sheet); border-radius: 12px; }

.mud-input-control { font-weight: 500; }

.mud-input.mud-input-filled {
    border: var(--nb-rule);
    border-radius: 12px;
}

.mud-input-label { font-weight: 600; }

/* ---------- tables ---------- */

/* Tables are the dense passage: printed straight onto the paper, no box, no plate, no
 * header fill. The ink rule under the header and the hairlines between rows are the only
 * structure; the data gets the contrast, not the chrome. */
.mud-table {
    border: 0;
    box-shadow: none;
    background-color: transparent;
}

/* MudBlazor styles the header cell through `.mud-table-root .mud-table-head
 * .mud-table-cell`; anything shorter loses, so this matches it. */
.mud-table-root .mud-table-head .mud-table-cell {
    background-color: transparent;
    border-bottom: var(--nb-rule);
    color: var(--nb-muted);
    font-family: var(--nb-text);
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.mud-table-cell { border-bottom: 1px solid rgba(21, 19, 26, .12); }

.mud-table-row:last-child .mud-table-cell { border-bottom: 0; }

/* The footer row is a total: rule above, figures in bold. */
.mud-table-root .mud-table-foot .mud-table-cell {
    border-top: var(--nb-rule);
    font-weight: 800;
}

.mud-table-hover .mud-table-container .mud-table-root .mud-table-body .mud-table-row:hover {
    background-color: var(--nb-yellow-tint);
}

/* ---------- chips, alerts, progress ---------- */

/* Chips are stamps: flat ink on a tint, no outline, no shadow. */
.mud-chip {
    border: 0;
    font-weight: 700;
    box-shadow: none;
    letter-spacing: .01em;
}

.mud-chip.mud-chip-color-default { background-color: var(--nb-yellow-tint); color: var(--nb-ink); }

.mud-alert {
    border: var(--nb-rule);
    border-radius: 14px;
    font-weight: 600;
    box-shadow: none;
}

.mud-progress-linear {
    border: var(--nb-rule);
    border-radius: 99px;
    overflow: hidden;
    background-color: var(--nb-sheet);
}

.mud-progress-linear.horizontal.mud-progress-linear-small { height: 12px; }
.mud-progress-linear.horizontal.mud-progress-linear-medium { height: 14px; }
.mud-progress-linear.horizontal.mud-progress-linear-large { height: 20px; }

/* ---------- nav ---------- */

.mud-nav-link {
    font-weight: 600;
    border: 2px solid transparent;
    border-radius: 12px;
    margin: 3px 10px;
}

.mud-navmenu.mud-navmenu-default .mud-nav-link:hover:not(.mud-nav-link-disabled) {
    background-color: var(--nb-pink-tint);
}

/* The page you are on is printed: yellow sheet, ink rule, pink plate. Matches
 * MudBlazor's own selector shape so it wins on load order. */
.mud-navmenu.mud-navmenu-default .mud-nav-link.active:not(.mud-nav-link-disabled) {
    background-color: var(--nb-yellow);
    border-color: var(--nb-ink);
    color: var(--nb-ink);
    font-weight: 800;
    box-shadow: 3px 3px 0 var(--nb-pink);
}

.mud-navmenu.mud-navmenu-default .mud-nav-link.active:not(.mud-nav-link-disabled):hover {
    background-color: var(--nb-yellow);
}

.mud-navmenu.mud-navmenu-default .mud-nav-link.active .mud-nav-link-icon { color: var(--nb-ink); }

/* ---------- stat plates (Dashboard) ---------- */

.nb-stat { height: 100%; }

.nb-stat .mud-typography-caption {
    display: block;
    color: var(--nb-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: 6px;
}

.nb-stat .mud-typography-h5 {
    font-size: clamp(1.5rem, 1.1rem + 1.1vw, 2.2rem);
    line-height: 1.05;
    letter-spacing: -.03em;
    overflow-wrap: anywhere;
}

/* The one figure that matters most sits on the pink plate, blue printed under it, and is
 * set a size up from its neighbours so it reads first by scale, not just colour. */
.nb-stat--hero .mud-typography-h5 {
    font-size: clamp(1.9rem, 1.2rem + 2vw, 3.1rem);
}

.nb-stat--hero.mud-paper {
    background-color: var(--nb-pink);
    box-shadow: 5px 5px 0 var(--nb-blue);
}

.nb-stat--hero .mud-typography-caption { color: var(--nb-ink); }

/* On a phone the bar also holds the currency toggle and two icons; the wordmark gives way
 * and the overprinted mark alone carries the brand. */
@media (max-width: 420px) {
    .nb-brand__word { display: none; }
}

/* Expansion panels draw a blurred Material shadow of their own, outside the elevation
 * variables. Same printed card as a MudPaper. */
.mud-expansion-panels .mud-expand-panel {
    border: var(--nb-rule);
    border-radius: 16px;
    box-shadow: 3px 3px 0 var(--nb-blue);
}
/* A group of controls that needs no box of its own: the fields keep their outlines, the
 * wrapper prints nothing, so there is one rule per visible thing. */
.mud-paper.nb-bare {
    border: 0;
    box-shadow: none;
    background-color: transparent;
}

/* Rows print on whatever sheet the table sits on: the card inside a paper, the page
 * outside one. A white body under an unboxed table would float as a strip. */
.mud-table .mud-table-container,
.mud-table-root .mud-table-body .mud-table-row,
.mud-table-root .mud-table-body .mud-table-empty-row {
    background-color: transparent;
}

/* Market chips: one ink per market so ID and US separate down a long table. The default
 * yellow screen covers any market added later. Solid inks, not tints: this is the one
 * chip whose colour carries meaning. Never green or red; those belong to gain and loss. */
.mud-chip.nb-market { background-color: var(--nb-yellow-tint); color: var(--nb-ink); min-width: 38px; justify-content: center; }
.mud-chip.nb-market--id { background-color: var(--nb-pink); color: var(--nb-ink); }
.mud-chip.nb-market--us { background-color: var(--nb-blue); color: #FFFFFF; }

/* The notes popover (Savings): a printed card of reading, not a menu of actions. Wide
 * enough for a sentence, capped on a phone, rows split by the same hairline as tables. */
.nb-notes { width: min(440px, calc(100vw - 32px)); }

.nb-notes__list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.nb-notes__list li {
    padding: 12px 16px;
    font-size: .875rem;
    line-height: 1.5;
    border-bottom: 1px solid rgba(21, 19, 26, .12);
}

.nb-notes__list li:last-child { border-bottom: 0; }

/* ---------- stamps & empty states ---------- */

/* A ticker is a stamped code, not a word: display face, caps, yellow screen, no outline. */
.nb-ticker {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 6px;
    background-color: var(--nb-yellow-tint);
    font-family: var(--nb-display);
    font-weight: 800;
    font-size: .8rem;
    letter-spacing: .01em;
    text-transform: uppercase;
}

.nb-empty {
    padding: 14px 16px;
    color: var(--nb-muted);
    font-weight: 500;
}

/* Stacked on a phone, the hero's plate would crowd the card below it. */
@media (max-width: 600px) {
    .nb-stat--hero.mud-paper { box-shadow: 4px 4px 0 var(--nb-blue); margin-bottom: 6px; }
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
    .mud-button-filled,
    .mud-button-outlined { transition: none; }

    .mud-button-filled:hover,
    .mud-button-outlined:hover,
    .mud-button-filled:active,
    .mud-button-outlined:active { transform: none; }
}
