﻿/* Tailwind's layer order with one layer of our own, declared here because this sheet loads before dist.css (the
   first declaration fixes the order). app-base sits above Tailwind's preflight and below its utilities: our
   element defaults beat `button { color: inherit }`, while a `text-white` on the element still wins. Unlayered,
   they beat every utility — a dark button with `text-white` drew dark grey text. */
@layer properties, theme, base, app-base, components, utilities;

@font-face {
    font-family: appfont;
    src: url(../fonts/OpenSans-VariableFont_wdth_wght.ttf);
}

    :root {
    --border-radius: 8px;
    --box-shadow: 0 0 7px rgba(0, 0, 0, 0.2);
    --box-shadow-hover: 0 0 10px rgba(0, 0, 0, 0.5);
    --primary-color: #00385e;
    --accent-color: #0d6cac;
    --accent-yellow: #ffc107;
    --accent-red: #e63946;
    --accent-green: #2a9d8f;
    --accent-purple: #9b5de5;
    --accent-orange: #f4a261;
    --accent-brown: #8d6e63;
    --accent-violet: #8a2889;
    --neutral-white: #f1f1f1;
    --accent-coral: #ff6f61;
    --accent-forest: #6a994e;
    --accent-gold: #ffd166;
    --accent-teal: #009fbe;
    --accent-terra: #e07a5f;
    --neutral-gray: #e0e0e0;
    --small-screen: 640px;
    --large-screen: 1024px;
    --small-padding: 10px;
    --large-padding: 30px;

    /* ── Surfaces ────────────────────────────────────────────────────────────
       The page ground is a cool light blue; content sits on white surfaces with a
       large radius and a soft, low shadow rather than a frame. */
    --page-ground: #eef3f8;
    --surface-radius: 14px;
    --surface-shadow: 0 1px 3px rgba(16, 40, 64, 0.06), 0 4px 14px rgba(16, 40, 64, 0.04);
    --surface-shadow-hover: 0 2px 6px rgba(16, 40, 64, 0.08), 0 8px 22px rgba(16, 40, 64, 0.08);
    --surface-sunken: #eef3f8;
    --surface-line: #edf1f5;
    --text-ink: #17283a;
    --text-muted: #5a6878;

    /* ── Menus ───────────────────────────────────────────────────────────────
       One look for every panel that drops out of a control — the ⋮ menus, Select and its
       comboboxes, the autocomplete lists, the table and document toolbar panels: a frosted white
       card (the page shows blurred through it) with an inset row list, a rounded sunken hover and
       an accent tint for the chosen row. Hover and selection are tints, not fills, so the frost
       stays even under them. The surface stays see-through enough and the blur small enough that the
       content behind reads as soft shapes: over the white cards a denser surface or a wider blur
       washes thin text out entirely and the frost is gone. */
    --menu-surface: rgba(255, 255, 255, 0.58);
    --menu-backdrop: blur(10px) saturate(1.6);
    --menu-radius: 12px;
    --menu-shadow: 0 10px 30px rgba(16, 40, 64, 0.16), 0 1px 3px rgba(16, 40, 64, 0.08);
    --menu-padding: 6px;
    --menu-item-padding: 8px 10px;
    --menu-item-min-height: 36px;
    --menu-item-gap: 10px;
    --menu-item-radius: 8px;
    --menu-item-ink: var(--text-ink);
    --menu-item-hover: rgba(16, 40, 64, 0.06);
    --menu-item-selected: color-mix(in srgb, var(--accent-color) 12%, transparent);
    --menu-item-selected-hover: color-mix(in srgb, var(--accent-color) 18%, transparent);
    --menu-item-selected-ink: var(--primary-color);
    --menu-item-danger: #b42318;
    --menu-line: var(--surface-line);

    /* ── Type scale ──────────────────────────────────────────────────────────
       Canonical font sizes for all app text. Root is 14px (1rem), so these map
       to Tailwind's default scale and the generated --text-* tokens. Snap every
       text font-size to the nearest token; icon glyph sizes stay off this scale. */
    --fs-2xs: 0.65rem;    /* badges, micro uppercase labels */
    --fs-xs: 0.75rem;     /* captions, meta, chips, kickers, breadcrumbs */
    --fs-sm: 0.875rem;    /* secondary text, buttons, nav text, form inputs */
    --fs-base: 1rem;      /* body, table cells, list items, data-card values */
    --fs-md: 1.125rem;    /* emphasized values, card subtitles */
    --fs-lg: 1.25rem;     /* card / section titles (h3), dialog titles */
    --fs-xl: 1.5rem;      /* page-header title (h2), KPI value */
    --fs-2xl: 1.875rem;   /* page hero (h1 / welcome) */
}

/* Without backdrop blur a see-through menu would let the page read through it: there it stays solid white. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root {
        --menu-surface: #fff;
    }
}

/* The width of the desktop's dark icon rail (AppRail), for whatever spans the content beside it (the
   navigation progress bar). Zero below the desktop, which has no rail. The app bar's height is shared with the
   rail, whose logo sits in the bar's band so mark, crumbs and avatar share one centre line. */
:root {
    --app-rail-w: 64px;
    --app-topbar-h: 56px;
}

/* The height of the phone/tablet tab bar (MobileTabBar), for whatever has to rest on it — the bottom sheet.
   Zero on the desktop, which has no tab bar. */
@media (max-width: 1024px) {
    :root {
        --app-tabbar-h: calc(70px + env(safe-area-inset-bottom, 0px));
        --app-rail-w: 0px;
    }
}

body {
    margin: 0;
    overflow: auto;
    height: 100%;
    width: 100%;
    background: var(--page-ground);
}

html {
    font-size: 14px;
    height: 100%;
}

@layer app-base {
    html, p, input, button, select, option {
        color: rgb(50, 50, 50);
        font-family: appfont;
    }
}

input {
    font-weight: 600;
}

.box {
    background-color: white;
    border: 1px solid rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

button.box {
    cursor: pointer;
    transition: all 0.3s;
}

    button.box:hover {
        background-color: rgba(0, 0, 0, 0.1);
        filter: contrast(95%);
        border: 2px solid rgba(0, 0, 0, 0.5);
        border-radius: 255px 12px 225px 12px/12px 230px 12px 250px;
    }

input.box {
    transition: all 0.3s;
    padding: 10px;
    outline: none;
}

    input.box:focus {
        border: 2px solid rgba(0, 0, 0, 0.8);
    }

main {
    display: grid;
    overflow: auto;
}

content {
    padding: 10px;
    max-width: 100vw;
}

.handdrawn {
    background-color: rgba(0, 0, 0, 0.05);
    filter: contrast(90%);
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
}

button.handdrawn {
    cursor: pointer;
    transition: all 0.3s;
}

    button.handdrawn:hover {
        background-color: rgba(0, 0, 0, 0.1);
        filter: contrast(95%);
        border: 2px solid rgba(0, 0, 0, 0.5);
        border-radius: 255px 12px 225px 12px/12px 230px 12px 250px;
    }

input.handdrawn {
    transition: all 0.3s;
    padding: 10px;
    outline: none;
}

    input.handdrawn:focus {
        border: 2px solid rgba(0, 0, 0, 0.8);
    }

.handdrawnicon {
    color: rgb(50, 50, 50);
}

.center-v {
    display: flex;
    align-items: center;
}

@media (max-width:500px) {
    content {
        padding: 10px;
    }
}
h1 {
    margin: 0px 0 0 0;
    padding: 0;
    font-size: var(--fs-2xl);
    font-weight: 600;
}
h2 {
    font-size: var(--fs-xl);
    margin-bottom: .5rem;
    font-weight: 600;
    color: #222;
}h3 {
    font-size: var(--fs-lg);
    margin: 0;
    margin-left: var(--border-radius);
    margin-bottom: .5rem;
    font-weight: 600;
}

/* ── Split-view panes: fill-the-pane tables ──────────────────────────────────────
   Global (non-isolated) because the flex chain spans three isolated components:
   SplitView (.view-pane), Card (.card/.card-content) and Table (.table/.list). The split
   panes are bounded scrollers on every viewport (see PageLayout/SplitView .razor.css),
   so a pane's table card is as tall as its rows and scrolls its own body once they run past the
   pane — flex: 0 1 auto: a tall table compresses to the pane, a short one or an empty one keeps
   its own height instead of standing as a large empty white box. The vh cap from Table.razor.css
   is lifted here; layouts whose chain isn't flex simply keep that cap.

   Both panes take part. The main pane is a column unconditionally — it is the page's
   primary content and always leads with its table; the aside only becomes one when it
   actually hosts a scroll-body list, so asides made of detail grids, prose or forms keep
   their plain block flow (and with it the margin collapsing their spacing was tuned
   against). That guard is also what keeps the `overflow: hidden` below off cards whose
   pane never established the height bound in the first place.

   Both of the Table component's renderings take part: .table is the classic one, .list the
   mobile/toggled one, and .scroll-body marks either as the pane's primary. They are matched
   together throughout so the chain never breaks on a list⇄table switch — only the last rule
   below is table-only, being about the grid .table happens to be. */
.view-pane.left,
.view-pane.right:has(:is(.table, .list).scroll-body) {
    display: flex;
    flex-direction: column;
}

/* In overlay mode the aside's content hangs off .aside-inner — the absolutely positioned
   clip window that holds the panel at its final width (see SplitView.razor.css) — so that,
   not the pane, is where the chain starts. The pane's own declaration above is inert there:
   every one of its children is out of flow. */
.view-pane.right > .aside-inner:has(:is(.table, .list).scroll-body) {
    display: flex;
    flex-direction: column;
}

.view-pane .card:has(> .card-content > :is(.table, .list).scroll-body) {
    flex: 0 1 auto;
    min-height: 0;
    overflow: hidden;               /* the inner .table-wrapper / .list-items scrolls, not the card */
    display: flex;
    flex-direction: column;
}

.view-pane .card > .card-content:has(> :is(.table, .list).scroll-body) {
    flex: 1 1 auto;
    min-height: 0;
}

.view-pane :is(.table, .list).scroll-body {
    --table-body-max-height: none;  /* shrink with the flex chain instead of the vh cap */
    flex: 1 1 auto;
    min-height: 0;
}

/* .table is a grid; let its single row shrink with the flex-constrained height so the wrapper
   scrolls instead of overflowing. (.list is already a flex column — see Table.razor.css.) */
.view-pane .table.scroll-body {
    grid-template-rows: minmax(0, 1fr);
}

/* A Pivot hosting the pane's table (WarehouseDetails' section tabs in the main pane, the tab
   strip every aside is built from) puts the Card one level deeper than the direct-Card case
   above: .view-pane[ > .aside-inner] > .pivot-root > .pivot-content > .card. The pivot's own
   content wrappers (.pivot-content/-all, .pivot-panel) already shrink (see Pivot.razor.css),
   but .pivot-root sits outside that chain — so the pane-height bound never reached the Card and
   the table grew unbounded, scrolling the whole pane instead of its body.
   Fold the pivot-root into the shrink chain whenever it hosts a scroll-body table *or* list. */
:is(.view-pane, .view-pane.right > .aside-inner) > .pivot-root:has(:is(.table, .list).scroll-body) {
    flex: 1 1 auto;
    min-height: 0;
}

/* ── A list page's head above its split view ─────────────────────────────────────
   ListHead takes the PageHeader's place on list pages but sits in the page content, before the
   .view, so it is not sticky. The content becomes a column: the head keeps its height, the split
   view gets the rest and stays the bounded scroller it is on every other page. Global because it
   spans PageLayout, ListHead and SplitView. */
.page-content:has(> .list-head) {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.page-content:has(> .list-head) > .list-head {
    flex: none;
}

.page-content:has(> .list-head) > .view {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
}

/* ── Split-view header alignment ─────────────────────────────────────────────────
   Global (non-isolated) for the same reason as the block above: it spans SplitView
   (.view-pane), Card (a Title renders its <h3> *outside* the card box), TitleHeader
   (<h2>) and Pivot (its tab bar likewise sits above the card). Those headers have
   different natural heights — an h3 is one 1.25rem line, a tab bar is a line plus
   0.55rem of button padding, and the tabs themselves drop to 1.125rem when collapsed
   — so on a details page with a titled main table and a tabbed aside the two cards
   started at different y.

   Where a page has a header on both sides, pin them to one shared height so both
   cards start on the same line, and centre each header's *text* in that height so the
   title and the tab labels land on the same line as each other. Centring is what makes
   the two exact: a tab's own align-items:center puts its label's line box on the
   button's centre, the bar's align-items:center puts the button on the header's centre,
   and --split-head-lead puts the title's line box there too — none of which depends on
   the tab font size, which differs between the collapsed (1.125rem) and uncollapsed
   (1.25rem) pivot variants.

   --split-head-h must clear the *tallest* natural header — the uncollapsed pivot-xl bar
   at 1.1rem of button padding + 1.875rem of line box = 2.975rem — or that side
   overshoots and the alignment breaks; --split-head-gap mirrors .pivot-content's
   padding-top, so the bar's share of the height is the total minus that gap. The custom
   properties exist only when the guard matches — everywhere else the calc()s below are
   invalid at computed-value time and fall back to min-height:auto / padding-top:0, i.e.
   the untouched natural layout. */
.view-scroll:has(> .view-pane.left > :is(h2, h3, .pivot-root):first-child):has(.view-pane.right .pivot-bar) {
    --split-head-h: 3.75rem;
    --split-head-gap: 0.75rem;
    /* Half the slack left over once the title's single line box is placed. */
    --split-head-lead: calc((var(--split-head-h) - var(--split-head-gap) - var(--fs-lg) * 1.5) / 2);
}

/* Only the pane's leading header takes part — a second titled Card further down the
   main pane keeps its normal spacing. Padding rather than flex centring on purpose:
   a flex h3 turns its leading icon into a sibling flex item and knocks it off the
   text baseline that inline flow puts it on. */
.view-pane > :is(h2, h3):first-child {
    min-height: calc(var(--split-head-h) - var(--split-head-gap));
    padding-top: var(--split-head-lead);
    margin-bottom: var(--split-head-gap, 0.5rem);
}

.view-pane > .pivot-root:first-child > .pivot-bar,
.view-pane > .aside-inner > .pivot-root:first-child > .pivot-bar {
    min-height: calc(var(--split-head-h) - var(--split-head-gap));
    align-items: center;
}