/* ==========================================================================
   New EIT App - EIT house design system (from the Jobtracker rebuilds)
   A dense, keyboard-friendly business UI. The density is deliberate: this
   replaces a WinForms MDI application whose users work in long grids all day.
   ========================================================================== */

/* --------------------------------------------------------------- theming --

   Colours are declared once as tokens. The light palette lives on :root, and
   the dark palette overrides the same tokens - so every component is written
   against a token and nothing needs a dark-mode variant of its own.

   Three states: an explicit choice stamps data-theme on <html>, and the default
   "system" setting follows prefers-color-scheme.
   -------------------------------------------------------------------------- */

:root {
    /* Brand, taken from the Weldcraft Pro logo: its navy, with the logo's red as the second colour (--red below).
       The navy is too dark to show on a dark surface, so --brand-tint is the same colour lifted for the sidebar
       (dark in both themes) and for everything in dark mode, where it stands in for --brand. */
    --brand: #002963;
    --brand-dark: #001a44;
    --brand-ink: #002963;
    --brand-tint: #7fa8ea;
    --on-brand: #ffffff;

    --navy-900: #12253a;
    --navy-800: #17304a;
    --navy-700: #1f3b57;
    --navy-600: #2a4f72;
    --navy-500: #37628c;
    --accent: #2f80ed;
    --accent-dark: #1f66c4;
    --accent-soft: #e8f1fd;
    --on-accent: #ffffff;

    --ink-900: #16202b;
    --ink-700: #3a4b5c;
    --ink-500: #61758a;
    --ink-300: #97a7b6;

    --line: #dde4ec;
    --line-strong: #c3ceda;
    --surface: #ffffff;
    --surface-2: #f4f7fa;
    --surface-3: #eaeff5;
    --page: #eef2f7;

    --green: #1f9d55;
    --green-bg: #e6f6ec;
    --amber: #b7791f;
    --amber-bg: #fdf3e0;
    --red: #ff0000;
    --red-bg: #fdeaea;
    --blue-bg: #e8f1fd;

    /* Alert text and borders. These used to be hard-coded in the .alert rules,
       which meant the backgrounds flipped with the theme and the text did not -
       dark ink on a dark panel, effectively unreadable. */
    --green-ink: #14663a;
    --green-line: #bfe6cd;
    --amber-ink: #8a5a12;
    --amber-line: #f0dcb4;
    --red-ink: #8a2020;
    --red-line: #f3c6c6;
    --blue-ink: #1a4d8f;
    --blue-line: #c9dffa;

    /* Sidebar keeps its dark treatment in both themes. */
    --nav-bg: #12253a;
    --nav-ink: #cfdbe8;
    --nav-ink-dim: #6d859e;
    --nav-hover: rgba(255, 255, 255, .06);
    --nav-line: rgba(255, 255, 255, .08);

    --shadow-sm: 0 1px 2px rgba(18, 37, 58, .08);
    --shadow: 0 2px 8px rgba(18, 37, 58, .10);
    --shadow-lg: 0 12px 32px rgba(18, 37, 58, .18);

    --radius: 6px;
    --radius-lg: 10px;

    --sidebar-w: 232px;
    --topbar-h: 52px;

    --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "Cascadia Mono", "Consolas", "SF Mono", monospace;

    color-scheme: light;
}

/* Dark palette: same tokens, re-pointed. Applied when the user has chosen dark,
   or when they are on the system default and their OS is dark. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --brand: var(--brand-tint);
        --brand-dark: #a3c0f0;
        --brand-ink: var(--brand);
        --on-brand: #08111c;
        --accent: #5aa2ff;
        --accent-dark: #7ab4ff;
        --accent-soft: #16304d;
        --on-accent: #08111c;

        --ink-900: #e6edf5;
        --ink-700: #b9c6d4;
        --ink-500: #8b9bad;
        --ink-300: #67788c;

        --line: #223145;
        --line-strong: #31445d;
        --surface: #131c28;
        --surface-2: #182231;
        --surface-3: #1e2a3b;
        --page: #0d141d;

        --green: #4ec98a;
        --green-bg: #10301f;
        --amber: #e0a94a;
        --amber-bg: #33260f;
        --red: #ff0000;
        --red-bg: #3a1a1a;
        --blue-bg: #16304d;

        /* Light ink on the dark panels, borders lifted just clear of them. */
        --green-ink: #8fe3b4;
        --green-line: #1d5537;
        --amber-ink: #f0c987;
        --amber-line: #5a4520;
        --red-ink: #ffb3b3;
        --red-line: #5e2b2b;
        --blue-ink: #a9cdf7;
        --blue-line: #27507c;

        --nav-bg: #0a121c;
        --nav-line: rgba(255, 255, 255, .06);

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
        --shadow: 0 2px 10px rgba(0, 0, 0, .55);
        --shadow-lg: 0 14px 40px rgba(0, 0, 0, .65);

        color-scheme: dark;
    }
}

/* The explicit choice wins over the system preference in both directions. */
:root[data-theme="dark"] {
    --brand: var(--brand-tint);
    --brand-dark: #a3c0f0;
    --brand-ink: var(--brand);
    --on-brand: #08111c;
    --accent: #5aa2ff;
    --accent-dark: #7ab4ff;
    --accent-soft: #16304d;
    --on-accent: #08111c;

    --ink-900: #e6edf5;
    --ink-700: #b9c6d4;
    --ink-500: #8b9bad;
    --ink-300: #67788c;

    --line: #223145;
    --line-strong: #31445d;
    --surface: #131c28;
    --surface-2: #182231;
    --surface-3: #1e2a3b;
    --page: #0d141d;

    --green: #4ec98a;
    --green-bg: #10301f;
    --amber: #e0a94a;
    --amber-bg: #33260f;
    --red: #ff0000;
    --red-bg: #3a1a1a;
    --blue-bg: #16304d;

    /* Light ink on the dark panels, borders lifted just clear of them. */
    --green-ink: #8fe3b4;
    --green-line: #1d5537;
    --amber-ink: #f0c987;
    --amber-line: #5a4520;
    --red-ink: #ffb3b3;
    --red-line: #5e2b2b;
    --blue-ink: #a9cdf7;
    --blue-line: #27507c;

    --nav-bg: #0a121c;
    --nav-line: rgba(255, 255, 255, .06);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow: 0 2px 10px rgba(0, 0, 0, .55);
    --shadow-lg: 0 14px 40px rgba(0, 0, 0, .65);

    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--font);
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--ink-900);
    background: var(--page);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 19px; }
/* FocusOnNavigate (Routes.razor) moves focus to the page heading for screen readers; the browser then drew a
   focus box round every page title. The heading is not a control, so no outline is needed. */
h1:focus { outline: none; }
/* MudBlazor's reset sets every border width to 0, which made <hr> invisible. */
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; height: 0; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }

/* ---------------------------------------------------------------- shell -- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--nav-bg);
    color: var(--nav-ink);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-h);
    padding: 0 16px;
    border-bottom: 1px solid var(--nav-line);
    flex: 0 0 auto;
}

.sidebar-brand .mark {
    width: 26px; height: 26px;
    border-radius: 6px;
    display: grid; place-items: center;
    overflow: hidden;
    flex: 0 0 auto;
}
.sidebar-brand .mark img,
.login-panel .brand .mark img { width: 100%; height: 100%; object-fit: contain; display: block; }

.sidebar-brand .name { color: #fff; font-weight: 600; font-size: 14px; line-height: 1.1; }
.sidebar-brand .tenant { color: var(--nav-ink-dim); font-size: 11px; }

.sidebar-scroll { flex: 1 1 auto; overflow-y: auto; padding: 8px 0 16px; }
.sidebar-scroll::-webkit-scrollbar { width: 8px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }

.nav-section {
    padding: 12px 16px 4px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--nav-ink-dim);
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    color: var(--nav-ink);
    font-size: 13px;
    border-left: 3px solid transparent;
    cursor: pointer;
}
.nav-link:hover { background: var(--nav-hover); color: #fff; text-decoration: none; }
/* The sidebar is dark in both themes, so the active link wears the lifted brand (--brand-tint), not the navy itself. */
.nav-link.active { background: linear-gradient(90deg, color-mix(in srgb, var(--brand-tint) 38%, transparent), color-mix(in srgb, var(--brand-tint) 12%, transparent)); border-left: 4px solid var(--brand-tint); padding-left: 15px; color: #fff; font-weight: 700; }
.nav-link.active .ico { opacity: 1; color: var(--brand-tint); }
.nav-link .ico { width: 16px; height: 16px; flex: 0 0 16px; opacity: .85; }
.nav-link .count { margin-left: auto; font-size: 11px; color: var(--nav-ink-dim); }

.sidebar-footer {
    flex: 0 0 auto;
    border-top: 1px solid var(--nav-line);
    padding: 10px 16px;
    font-size: 11px;
    color: var(--nav-ink-dim);
    display: grid;
    gap: 2px;
}

/* ------------------------------------------------- sidebar: collapse / drawer */

.nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; flex: 0 0 30px;
    border: 1px solid transparent; border-radius: var(--radius);
    background: transparent; color: var(--ink-700); cursor: pointer;
}
.nav-toggle:hover { background: var(--surface-3); }
.nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.nav-backdrop { display: none; }

/* Desktop: collapse to an icon rail. */
@media (min-width: 901px) {
    .app-shell.nav-collapsed { --sidebar-w: 54px; }
    .app-shell.nav-collapsed .nav-link { justify-content: center; padding-left: 0; padding-right: 0; border-left-width: 2px; }
    .app-shell.nav-collapsed .nav-link .label,
    .app-shell.nav-collapsed .nav-link .count,
    .app-shell.nav-collapsed .nav-section,
    .app-shell.nav-collapsed .sidebar-brand .who,
    .app-shell.nav-collapsed .sidebar-footer { display: none; }
    .app-shell.nav-collapsed .sidebar-brand { justify-content: center; padding: 0; }
}

/* Mobile and tablet: the sidebar becomes an overlay drawer. */
@media (max-width: 900px) {
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        z-index: 120;
        transform: translateX(-100%);
        transition: transform .18s ease-out;
        box-shadow: var(--shadow-lg);
    }
    .app-shell.nav-open .sidebar { transform: translateX(0); }

    .app-shell.nav-open .nav-backdrop {
        display: block;
        position: fixed; inset: 0; z-index: 110;
        background: rgba(18, 37, 58, .45);
    }

    .main { width: 100%; }
    .content { padding: 12px; }
    .global-search { width: auto; flex: 1 1 auto; min-width: 0; }
    .user-chip .who { display: none; }
    .page-head .actions { width: 100%; }
    .toolbar { gap: 6px; }
}

@media (max-width: 560px) {
    .topbar { padding: 0 10px; gap: 8px; }
    .page-head h1 { font-size: 17px; }
    .btn { height: 32px; }              /* comfortable tap target */
    .btn-sm { height: 28px; }
    .modal-backdrop { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar { transition: none; }
}

/* ---------------------------------------------------------------- main --- */

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-h);
    flex: 0 0 var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar .spacer { flex: 1 1 auto; }

.global-search {
    position: relative;
    width: min(420px, 40vw);
}

/* The type selector is needed so this beats the generic input rule further down
   the sheet - without it the left padding is lost and the magnifier sits on top
   of the placeholder text. */
.global-search input[type=search],
.global-search input[type=text] {
    width: 100%;
    height: 32px;
    min-height: 32px;
    padding: 0 30px 0 32px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface-2);
    font-size: 13px;
}
.global-search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--surface); }
.global-search .ico {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px; height: 15px;
    color: var(--ink-300);
    pointer-events: none;
}

.user-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    cursor: pointer;
}
.user-chip .avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--brand); color: var(--on-brand);
    display: grid; place-items: center;
    font-size: 11px; font-weight: 700;
}
.user-chip .who { line-height: 1.15; text-align: left; }
.user-chip .who strong { display: block; font-size: 12.5px; font-weight: 600; }
.user-chip .who span { font-size: 11px; color: var(--ink-500); }

.content { flex: 1 1 auto; padding: 20px 24px 28px; min-width: 0; }
/* Text flow inside a page. MudBlazor's reset (loaded only for the feedback widget) zeroes every margin and list
   indent, so ported pages ran paragraphs, lists and tables into each other. :where() keeps these at zero
   specificity: any component rule still wins. */
:where(.content) :where(p, ul, ol, dl, blockquote, pre) { margin: 0 0 10px; }
:where(.content) :where(ul, ol) { padding-left: 22px; }
:where(.content) :where(li) + :where(li) { margin-top: 2px; }
:where(.content) :where(p, ul, ol, dl, blockquote, pre):last-child { margin-bottom: 0; }
/* Section headings inside a card body (the LOC sheets, help pages): space above and below, none at the top. */
.content .card-body :where(h2, h3, h4) { margin: 18px 0 8px; }
.content .card-body :where(h2, h3, h4):first-child { margin-top: 0; }
:where(.content) :where(.card, .table-wrap, .player-frame, form) + :where(.card, .table-wrap, .player-frame, p, h2, h3) { margin-top: 16px; }
.page-message { max-width: 620px; margin: 60px auto; text-align: center; }
.page-message h2 { margin-bottom: 8px; }

/* -------------------------------------------------------------- headers -- */

.page-head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.page-head .titles { min-width: 0; }
.page-head .eyebrow {
    font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--ink-500); font-weight: 600;
}
.page-head h1 { margin-top: 2px; }
.page-head .sub { color: var(--ink-500); font-size: 12.5px; margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Actions on the record itself, then a rule, then Back and Save. Both groups sit
   right, so the auto margin belongs to the first of them - give it to both and
   they would share the free space and drift apart. */
.page-head .record-actions { margin-left: auto; }
.page-head .record-actions + .actions {
    margin-left: 0;
    padding-left: 14px;
    border-left: 1px solid var(--line-strong);
}

/* Flex breaks a line before it shrinks anything, so a long job title would claim
   its full width and push Back and Save onto a row of their own. Only heads that
   carry record actions need the room, so only those give the title a basis to
   work from. */
.page-head:has(.record-actions) .titles { flex-basis: 22rem; }

/* --------------------------------------------------------------- cards --- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card + .card { margin-top: 14px; }
.card-head {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}
.card-head h2, .card-head h3 { font-size: 13.5px; }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* The dashboard's tile board: six across, with the tiles scaled down to suit -
   a sixth of the width will not carry the four-across size of number. Three
   across on a narrow screen and two on a phone, so a row of six still reads
   as pairs of related tiles rather than a column. */
.grid-6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.grid-6 .stat { padding: 10px 12px; }
.grid-6 .stat .label { font-size: 10.5px; letter-spacing: .06em; }
.grid-6 .stat .value { font-size: 20px; margin-top: 3px; }
.grid-6 .stat .foot { font-size: 11px; }
@media (max-width: 1300px) { .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* --------------------------------------------------------------- stats --- */

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
}
.stat .label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-500); font-weight: 600; }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 4px; letter-spacing: -.02em; }
.stat .value.small { font-size: 19px; }
.stat .foot { font-size: 11.5px; color: var(--ink-500); margin-top: 2px; }
.stat.accent { border-left: 3px solid var(--accent); }
.stat.good { border-left: 3px solid var(--green); }
.stat.warn { border-left: 3px solid var(--amber); }
.stat.bad { border-left: 3px solid var(--red); }

/* A drop-down with a swatch alongside, the way the desktop paints the job
   status. An option element cannot be coloured reliably across browsers, so the
   colour sits beside the control rather than inside the list. */
.field-with-swatch { display: flex; align-items: center; gap: 8px; }
.field-with-swatch select { flex: 1 1 auto; min-width: 0; }

.status-chip {
    flex: 0 0 auto;
    width: 22px; height: 22px;
    border-radius: 4px;
    border: 1px solid var(--line-strong);
}

/* A compact tile for the strip above a list - the dashboard's card at about
   two-thirds the size, so four of them sit above the grid without pushing it
   off the screen. */
.stat.compact { padding: 7px 11px; }
.stat.compact .label { font-size: 10px; letter-spacing: .06em; }
.stat.compact .value { font-size: 16px; margin-top: 1px; }

/* Padded rather than margined, so the strip lines up with the toolbar above it -
   the toolbar is padded 9px 12px and the tiles were running flush to the card's
   edges on all sides. */
.list-totals {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 12px 12px 0;
    margin-bottom: 12px;
}

@media (max-width: 900px) { .list-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Dashboard tiles that link somewhere are anchors, so they need the link
   decoration stripped back off and a hover affordance putting on. */
a.stat {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
a.stat:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
a.stat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    a.stat { transition: none; }
    a.stat:hover { transform: none; }
}

/* -------------------------------------------------------------- buttons -- */

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 30px; padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink-900);
    font-size: 12.5px; font-weight: 500; font-family: inherit;
    cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn .ico { width: 14px; height: 14px; }

.btn-primary { background: var(--accent); border-color: var(--accent-dark); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); color: var(--on-accent); }
.btn-dark { background: var(--navy-700); border-color: var(--navy-800); color: #fff; }
.btn-dark:hover:not(:disabled) { background: var(--navy-800); }

.btn-brand { background: var(--brand); border-color: var(--brand-dark); color: var(--on-brand); font-weight: 600; }
.btn-brand:hover:not(:disabled) { background: var(--brand-dark); color: var(--on-brand); }
.btn-danger { background: var(--red); border-color: #a52a2a; color: #fff; }

/* Says a filter is on rather than that something is wrong, so amber rather than
   the red of btn-danger - clearing a date range breaks nothing. */
.btn-warn {
    background: var(--amber-bg);
    border-color: var(--amber-line);
    color: var(--amber-ink);
    font-weight: 600;
}
.btn-warn:hover:not(:disabled) { background: var(--amber-line); color: var(--amber-ink); }
.btn-danger:hover:not(:disabled) { background: #a52a2a; }
/* For an action that settles something rather than undoing it - paying an
   invoice off, next to the red of crediting it away. */
.btn-success { background: var(--green); border-color: var(--green-ink); color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--green-ink); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn-sm { height: 25px; padding: 0 8px; font-size: 12px; }
.btn-icon { width: 30px; padding: 0; justify-content: center; }
.btn-icon.btn-sm { width: 25px; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

.toolbar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 9px 12px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}
.toolbar .sep { width: 1px; height: 20px; background: var(--line-strong); margin: 0 2px; }
/* The same divider on a list's head actions, standing between the page's own
   buttons and the New/Export pair that sits in the same spot on every list. */
.page-head .actions .sep { width: 1px; height: 20px; background: var(--line-strong); margin: 0 2px; align-self: center; }
.toolbar .grow { flex: 1 1 auto; }

/* --------------------------------------------------------------- forms --- */

/* align-content: start - in a form row, a field with a hint under it is taller; without this the grid stretched
   the shorter fields' rows and their inputs sat lower than their neighbours'. */
.field { display: grid; gap: 4px; margin-bottom: 14px; min-width: 0; align-content: start; }
.field > label { font-size: 11.5px; font-weight: 600; color: var(--ink-700); }
.field .hint { font-size: 11px; color: var(--ink-500); }
/* Several inputs under one label (address lines): a small gap rather than touching. */
.field > :is(input, select, textarea) + :is(input, select, textarea) { margin-top: 2px; }
.field.inline { grid-template-columns: 150px 1fr; align-items: center; gap: 10px; }

input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=search], input[type=tel], input[type=url], select, textarea {
    width: 100%;
    min-height: 30px;
    padding: 5px 8px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    font-family: inherit;
    font-size: 13px;
    color: var(--ink-900);
}
textarea { min-height: 68px; resize: vertical; line-height: 1.45; }

/* File pickers (weld photos, uploads): the browser's grey button restyled as a house button. */
input[type=file] { font-size: 12.5px; color: var(--ink-700); max-width: 100%; }
input[type=file]::file-selector-button {
    margin-right: 10px; padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: var(--surface); color: var(--ink-900); font: inherit; font-weight: 600; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--surface-2); }

/* A legacy three-part date (day list, month list, year box) on one line. Inputs are full width by default, which
   stacked the three parts as three full-width rows. */
/* Day, month and year stay on one line everywhere (.date-parts, the legacy LegacyDateInput and the sheet date cells):
   split over lines they read as three separate fields. */
.date-parts, .legacy-date { display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 6px; white-space: nowrap; max-width: 100%; }
.date-parts > select, .date-parts > input, .legacy-date > select, .legacy-date > input { width: auto; flex: 0 0 auto; }
.date-parts > :nth-child(1), .legacy-date > :nth-child(1) { min-width: 64px; }
.date-parts > :nth-child(2), .legacy-date > :nth-child(2) { min-width: 96px; }
.date-parts > input[type=text], .legacy-date > input[type=text] { width: 72px; }

/* Sheet tables (E4 and the other legacy sheets): controls stacked in one cell get a small gap instead of touching. */
.table-wrap td > :is(input, select, textarea) + :is(input, select, textarea, .date-parts) { margin-top: 4px; }
.table-wrap td { vertical-align: middle; }
/* An input with the legacy "?" hover help beside it, kept on one line. */
.input-with-help { display: flex; align-items: center; gap: 6px; }
.input-with-help > input { flex: 1 1 auto; min-width: 0; }
/*
   The legacy "?" (schoolstyle.css .infolink / a.tooltip): a filled round mark, and
   a 240px bordered, shadowed callout with a pointer that shows on hover. Focus
   opens it too, so it works from the keyboard and on a tap; it opens leftwards
   because the marks sit at the right of the sheet, as the old one did.
*/
.help-callout { position: relative; flex: 0 0 auto; display: inline-flex; }
.help-mark {
    display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%;
    background: var(--accent); color: var(--on-accent); font: 700 13px/1 var(--font); cursor: help;
}
.help-callout-text {
    display: none; position: absolute; top: calc(100% + 10px); right: -8px; z-index: 20; width: 240px; max-width: calc(100vw - 32px); padding: 12px;
    border: 2px solid var(--accent); border-radius: var(--radius); background: var(--surface); color: var(--ink-900);
    box-shadow: var(--shadow-lg); font-size: 12.5px; font-weight: 400; line-height: 1.5; text-align: left; white-space: normal;
}
.help-callout-text::before {
    content: ""; position: absolute; top: -8px; right: 12px; width: 12px; height: 12px; transform: rotate(45deg);
    border-top: 2px solid var(--accent); border-left: 2px solid var(--accent); background: var(--surface);
}
.help-callout:hover .help-callout-text, .help-callout:focus-within .help-callout-text { display: block; }

/*
   The E4 page's field colours (weldTestEdit.js backNormal / backHighlight /
   backRed): green as served, orange once a field with a change handler is
   changed, red when "Form Complete" found it missing. Theme tints rather than
   the old fixed colours, and background-color only so a select keeps its chevron.
*/
.table-wrap :is(input[type="text"], select).e4-hl { background-color: var(--green-bg); }
.table-wrap :is(input[type="text"], select).e4-hl-changed { background-color: var(--amber-bg); border-color: var(--amber); }
.table-wrap :is(input[type="text"], select).e4-hl-missing { background-color: var(--red-bg); border-color: var(--red); }
/* The examiner boxes had no green; a ticked box keeps the accent fill. */
.table-wrap input[type="checkbox"].e4-hl-changed:not(:checked) { background-color: var(--amber-bg); border-color: var(--amber); }
.table-wrap input[type="checkbox"].e4-hl-missing:not(:checked) { background-color: var(--red-bg); border-color: var(--red); }

/*
   Selects kept the native control, so the drop-down button was drawn by the
   browser: a grey slab in light mode and a mismatched one in dark, lighting up
   on hover in a colour the app never chose. appearance:none removes it and the
   chevron below replaces it, drawn in currentColor so it follows the theme.

   The arrow is an inline SVG data URI rather than a background image file: no
   extra request, and the stroke colour can be swapped per theme.
*/
select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 28px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2361758a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px 14px;
    cursor: pointer;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) select {
        background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b9bad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    }
}

:root[data-theme="dark"] select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b9bad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

select:hover:not(:disabled) { border-color: var(--line-strong); }
select:disabled { cursor: default; }

/* The options list is still drawn by the browser; without this it inherits the
   page background on some platforms and renders white-on-white in dark mode. */
select option { background: var(--surface); color: var(--ink-900); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
/* background-color, not the shorthand: on a select the shorthand resets repeat,
   size and position while the chevron image survives from the per-theme rule
   above, and the arrow tiles across the whole box. */
input:disabled, select:disabled, textarea:disabled, input[readonly], textarea[readonly] {
    background-color: var(--surface-3); color: var(--ink-700); cursor: default;
}
input.numeric, td.numeric input { text-align: right; font-variant-numeric: tabular-nums; }

.check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; }

.check input { min-height: 0; margin: 0; }

/* -------------------------------------------------- checkboxes and radios --- */

/*
   One rule for every checkbox and radio in the application - around thirty of
   them, across forms, modals, toolbars and table cells - so none can drift back
   to the browser default.

   The type selectors are deliberate: the generic `input` rule above sets
   width:100% and a 30px min-height, which a bare control outside a .check label
   was picking up and being stretched by. Matching on [type=...] outranks it
   without needing !important anywhere.

   The two share everything but their shape and their indicator: a square with a
   tick, a circle with a dot.
*/
input[type="checkbox"],
input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    display: inline-grid;
    place-content: center;
    width: 16px;
    height: 16px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    vertical-align: middle;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
}

input[type="checkbox"] { border-radius: 4px; }
input[type="radio"] { border-radius: 50%; }

/*
   The indicators are drawn, not images: they cost no request, stay crisp at any
   zoom, and take their colour from --on-accent, which the dark theme already
   flips to a near-black so they stay readable on the lighter accent blue.
*/
input[type="checkbox"]::before,
input[type="radio"]::before {
    content: "";
    background: var(--on-accent);
    transform: scale(0);
    transition: transform .1s ease-in-out;
}

input[type="checkbox"]::before {
    width: 10px;
    height: 10px;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

input[type="radio"]::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

input[type="checkbox"]:checked::before,
input[type="radio"]:checked::before { transform: scale(1); }

/* A "some but not all" header box, if a grid ever sets one. */
input[type="checkbox"]:indeterminate {
    background: var(--accent);
    border-color: var(--accent);
}

input[type="checkbox"]:indeterminate::before {
    width: 9px;
    height: 2px;
    border-radius: 1px;
    clip-path: none;
    transform: scale(1);
}

input[type="checkbox"]:hover:not(:disabled),
input[type="radio"]:hover:not(:disabled) { border-color: var(--accent); }

input[type="checkbox"]:active:not(:disabled),
input[type="radio"]:active:not(:disabled) { transform: scale(.92); }

input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
    background: var(--surface-3);
    border-color: var(--line);
    cursor: default;
    opacity: .7;
}

/*
   The shared input:focus rule draws its outline inset, which on a 16px control
   lands on top of the indicator. These take it outside instead, and only for
   keyboard users - a ring on every mouse click reads as an error state.
*/
input[type="checkbox"]:focus,
input[type="radio"]:focus { outline: none; }

input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/*
   Edit grids blank the border and background of their inputs so the cells read
   as a spreadsheet. That would erase these controls entirely, so they opt back
   out. The stock item supplier grid is the one that matters - it holds the only
   radio in the application.
*/
table.editable td input[type="checkbox"],
table.editable td input[type="radio"],
table.data td input[type="checkbox"],
table.data td input[type="radio"] {
    border-color: var(--line-strong);
    background: var(--surface);
    min-height: 0;
    padding: 0;
}

table.editable td input[type="checkbox"]:checked,
table.editable td input[type="radio"]:checked,
table.data td input[type="checkbox"]:checked,
table.data td input[type="radio"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}

table.editable td input[type="checkbox"]:disabled,
table.editable td input[type="radio"]:disabled,
table.data td input[type="checkbox"]:disabled,
table.data td input[type="radio"]:disabled {
    background: var(--surface-3);
    border-color: var(--line);
}

fieldset { border: none; margin: 0; padding: 0; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-row .span-2 { grid-column: span 2; min-width: 0; }
@media (max-width: 900px) { .form-row, .form-row.three, .form-row.four { grid-template-columns: 1fr; } .form-row .span-2 { grid-column: auto; } }

.validation-message, .field-error { color: var(--red); font-size: 11.5px; }

/* --------------------------------------------------------------- tables -- */

.table-wrap { overflow: auto; max-width: 100%; }

table.data {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
}
table.data thead th {
    position: sticky; top: 0; z-index: 2;
    background: var(--surface-3);
    text-align: left;
    font-weight: 600;
    font-size: 11.5px;
    color: var(--ink-700);
    padding: 7px 9px;
    border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
    user-select: none;
}
table.data thead th.sortable { cursor: pointer; }
table.data thead th.sortable:hover { background: var(--line); }
table.data thead th .dir { color: var(--accent); margin-left: 3px; }
table.data tbody td {
    padding: 5px 9px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
table.data tbody tr:hover td { background: var(--blue-bg); }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.selected td { background: var(--accent-soft); }
table.data tbody tr.muted td { color: var(--ink-500); }
table.data td.numeric, table.data th.numeric { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.narrow, table.data th.narrow { width: 1%; white-space: nowrap; }
table.data tfoot td {
    padding: 7px 9px;
    background: var(--surface-2);
    border-top: 2px solid var(--line-strong);
    font-weight: 600;
}
table.data.compact tbody td { padding: 3px 8px; }
table.data .row-actions { display: flex; gap: 3px; justify-content: flex-end; }

/* Drag to reorder the lines of a document. The handle is what carries
   draggable, not the row: a draggable row swallows text selection inside the
   description and the numeric cells. */
table.data td.drag-cell { padding-left: 4px; padding-right: 2px; }
table.data .drag-handle {
    display: inline-block;
    cursor: grab;
    color: var(--ink-500);
    letter-spacing: -3px;
    padding: 0 4px;
    user-select: none;
}
table.data .drag-handle:hover { color: var(--accent); }
table.data .drag-handle:active { cursor: grabbing; }
table.data tbody tr.dragging td { opacity: .45; }
/* The line lands where the marker is, so the marker goes on the side the line is
   travelling towards - above when dragging up the list, below when dragging down. */
table.data tbody tr.drop-above td { box-shadow: inset 0 2px 0 0 var(--accent); }
table.data tbody tr.drop-below td { box-shadow: inset 0 -2px 0 0 var(--accent); }

/* Column menus (HouseTable): the small ☰ beside a heading opens that column's filter and
   sort, as on a DataTables grid - the web's stand-in for the desktop grids' filter bar.
   Muted, and darker when the heading is hovered (there is no hover on a phone, so it is
   never hidden); the accent-coloured filter mark while the column is filtered, so a
   filtered list says so. The menu is fixed under its button, outside
   .table-wrap (whose sideways scroll would clip it), and above a modal's backdrop so a
   table in a dialog works too. */
table.data thead th .col-head { display: inline-flex; align-items: center; gap: 2px; }
.col-head-menu {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 18px; height: 18px; padding: 0;
    border: 0; border-radius: var(--radius); background: transparent;
    color: var(--ink-500); cursor: pointer;
}
table.data thead th:hover .col-head-menu,
.col-head-menu:focus-visible,
.col-head-menu.open { opacity: 1; color: var(--ink-700); }
.col-head-menu:hover { background: var(--line); }
.col-head-menu:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.col-head-menu.active { opacity: 1; color: var(--accent); }

.col-menu-backdrop { position: fixed; inset: 0; z-index: 299; }
.col-menu {
    position: fixed; z-index: 300; overflow-y: auto;
    width: 280px; max-width: calc(100vw - 16px);
    display: flex; flex-direction: column; gap: 6px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: 13px; font-weight: 400; color: var(--ink-900);
}
.col-menu-row {
    display: grid; grid-template-columns: 18px 1fr; align-items: center; gap: 8px;
    color: var(--ink-500);
}
.col-menu-row.labelled { grid-template-columns: 36px 1fr; font-size: 12px; }
/* The house input and select styles apply as they are; the menu only sizes them. */
.col-menu select,
.col-menu input[type=text],
.col-menu input[type=date] { width: 100%; min-width: 0; }
.col-menu-options { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.col-menu-options label { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: var(--radius); cursor: pointer; }
.col-menu-options label:hover { background: var(--surface-2); }
.col-menu-options input { accent-color: var(--accent); }
.col-menu hr { border: 0; border-top: 1px solid var(--line); margin: 2px -10px; }
.col-menu-item {
    display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%;
    padding: 6px 8px;
    border: 0; border-radius: var(--radius); background: transparent;
    color: var(--ink-900); font: inherit; text-align: left; cursor: pointer;
}
.col-menu-item .ico { color: var(--ink-500); }
.col-menu:focus { outline: none; }
.col-menu-item:hover:not(:disabled), .col-menu-item:focus-visible { background: var(--surface-2); outline: 0; }
.col-menu-item.selected, .col-menu-item.selected .ico { color: var(--accent); font-weight: 600; }
.col-menu-item:disabled, .col-menu-item:disabled .ico { color: var(--ink-300); cursor: default; }

.empty {
    padding: 34px 16px;
    text-align: center;
    color: var(--ink-500);
}
.empty h3 { color: var(--ink-700); margin-bottom: 4px; }

/* ------------------------------------------------------------ edit grid -- */

table.editable td { padding: 2px 3px; }
/* background-color rather than the background shorthand. The shorthand also
   resets repeat, size and position, which left a drop-down's chevron tiling
   across the whole box as a row of arrows sitting over the text - the image
   itself survived, because the per-theme select rule outranks this one. */
table.editable td input, table.editable td select, table.editable td textarea {
    border-color: transparent;
    background-color: transparent;
    min-height: 26px;
    padding: 3px 6px;
}
/* and the room the chevron needs back, since the padding above dropped it */
table.editable td select { padding-right: 24px; }

/* The chevron's geometry, said again after every rule that puts a background on a
   drop-down. Those all use background-color now, but the shorthand is an easy
   mistake to make and it does not fail loudly - the image survives and tiles into
   a row of arrows across the text. This is the backstop, so the next one is
   invisible rather than a bug report. */
select,
select:disabled,
select[disabled],
table.editable td select {
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px 14px;
}
table.editable td input:hover, table.editable td select:hover, table.editable td textarea:hover {
    border-color: var(--line-strong); background-color: var(--surface);
}
table.editable td input:focus, table.editable td select:focus, table.editable td textarea:focus {
    border-color: var(--accent); background-color: var(--surface);
}
/* The joined lookup field opts back out of the blanking the same way the
   checkboxes do: its button half carries a real border, so a blanked input
   half reads as a button floating alone (the BOM part code field). The right
   edge stays transparent - that is where the button joins on. */
table.editable td .field-with-action input {
    border-color: var(--line-strong);
    border-right-color: transparent;
    background-color: var(--surface);
}
table.editable td .field-with-action input:hover,
table.editable td .field-with-action input:focus { border-right-color: transparent; }

/* ...unless nothing joins on. The batch entry Net cell only grows its button
   once an order is chosen, and until then the field keeps a whole edge, in the
   same colours the other three take. */
table.editable td .field-with-action input:last-child,
table.editable td .field-with-action input:last-child:hover {
    border-right-color: var(--line-strong);
    border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius);
}
table.editable td .field-with-action input:last-child:focus { border-right-color: var(--accent); }
table.editable td.readonly { background: var(--surface-3); color: var(--ink-700); padding: 5px 9px; }
table.editable tbody tr:hover td { background: transparent; }
table.editable tbody tr.new-row td { background: var(--surface-2); }

/* --------------------------------------------------------------- pills --- */

.pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px; font-weight: 600;
    background: var(--surface-3); color: var(--ink-700);
    white-space: nowrap;
}
.pill.good { background: var(--green-bg); color: var(--green); }
.pill.warn { background: var(--amber-bg); color: var(--amber); }
.pill.bad { background: var(--red-bg); color: var(--red); }
.pill.info { background: var(--blue-bg); color: var(--accent-dark); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.status-swatch {
    display: inline-flex; align-items: center; gap: 6px;
}
.status-swatch .chip {
    width: 10px; height: 10px; border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, .18);
    flex: 0 0 10px;
}

.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--ink-500); }
.small { font-size: 11.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.neg { color: var(--red); }
.pos { color: var(--green); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- tabs --- */

/* Wraps rather than scrolls. A job carries eighteen tabs and the strip's
   scrollbar was easy to miss entirely, so tabs off the end were tabs nobody
   knew were there. */
.tabs {
    display: flex; column-gap: 2px; row-gap: 0;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    padding: 0 8px;
}
.tab {
    padding: 9px 13px;
    font-size: 12.5px; font-weight: 500;
    color: var(--ink-700);
    border-bottom: 2px solid transparent;
    cursor: pointer; white-space: nowrap;
    background: none; border-top: none; border-left: none; border-right: none;
    font-family: inherit;
}
.tab:hover { color: var(--ink-900); background: var(--surface-2); }
.tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 600; }
/* A count beside a heading. Was only ever styled inside a tab, so the same
   markup in a card head rendered as a bare number stuck to the word before it. */
.badge {
    display: inline-block; margin-left: 5px;
    background: var(--surface-3); color: var(--ink-700);
    border-radius: 999px; padding: 0 6px; font-size: 10.5px; font-weight: 600;
    vertical-align: middle;
}

.card-head .badge { font-size: 11px; padding: 1px 7px; }

.tab .badge {
    display: inline-block; margin-left: 5px;
    background: var(--surface-3); color: var(--ink-700);
    border-radius: 999px; padding: 0 6px; font-size: 10.5px; font-weight: 600;
}
.tab.active .badge { background: var(--blue-bg); color: var(--accent-dark); }

/* Wrapping costs height, and a record with eighteen tabs can spend a third of a
   phone screen on them before any content. Tighter here so it wraps into fewer,
   shorter rows. */
@media (max-width: 760px) {
    .tab { padding: 7px 9px; font-size: 12px; }
    .tab .badge { margin-left: 4px; padding: 0 5px; }
}

/* A supplier's comment against a quoted price. An icon alone did not say what
   it was, and hovering to find out is no use when the point of the grid is
   comparing prices at a glance - so the note says so, and carries its text. */
.quote-note {
    display: inline-block; margin-left: 6px;
    background: var(--amber-bg); color: var(--amber-ink);
    border: 1px solid var(--amber-line);
    border-radius: 999px; padding: 0 7px;
    font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
    cursor: help; vertical-align: middle;
}

/* The cheapest answer on a line. It was asking for "good", which only means
   anything on a stat or a pill, so the winning price looked like every other
   price. Weight as well as colour: which supplier won a line should not be
   something only a reader who sees the green can pick out. */
.quote-best { background: var(--green-bg); color: var(--green-ink); font-weight: 600; }

/* Buttons in a table cell. Two verbs side by side with nothing between them
   read as one control, and these two do very different things. */
td .actions { display: flex; gap: 8px; align-items: center; }

/* --------------------------------------------------------------- modal --- */

.modal-backdrop {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(18, 37, 58, .45);
    display: grid; place-items: center;
    padding: 20px;
}
.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: min(760px, 100%);
    max-height: 88vh;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.modal.wide { width: min(1080px, 100%); }
.modal.narrow { width: min(460px, 100%); }
.modal-head {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}
.modal-head h2 { flex: 1 1 auto; font-size: 15px; }
.modal-body { padding: 16px; overflow: auto; flex: 1 1 auto; }
.modal-body.tight { padding: 0; }
.modal-foot {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 11px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
}

/* A footer that carries a navigation button as well as Cancel and Save pushes
   the pair apart, so Up a level is nowhere near Save. */
.modal-foot .grow { flex: 1 1 auto; }

/* -------------------------------------------------------------- toasts --- */

/*
   Notifications sit above everything, carry a solid coloured band and icon so
   they read at a glance against a white page, and retire themselves after a few
   seconds. Errors stay put until dismissed - those are the ones you must not
   miss. Progress along the bottom edge shows how long is left.
*/

.toast-host {
    position: fixed; right: 18px; bottom: 18px; z-index: 400;
    display: flex; flex-direction: column-reverse; gap: 10px;
    width: min(390px, calc(100vw - 32px));
    pointer-events: none;
}

/* Lifted clear of the EIT feedback button, which is fixed in the same corner.
   Applied by MainLayout only when a feedback key is configured, so the toasts
   stay where they always were while the widget is dark. */
.toast-host.with-fab { bottom: 92px; }

.toast {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0;
    display: flex; align-items: stretch;
    pointer-events: auto;
    animation: toast-in .22s cubic-bezier(.21, 1.02, .73, 1);
}
.toast.leaving { animation: toast-out .22s ease-in forwards; }

/* The coloured band and the matching icon chip. */
.toast .rail { width: 5px; flex: 0 0 5px; background: var(--ink-300); }
.toast .glyph {
    flex: 0 0 auto;
    display: grid; place-items: center;
    width: 34px;
    color: #fff;
}
.toast .glyph span {
    width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--ink-300);
}

.toast .body { flex: 1 1 auto; min-width: 0; padding: 11px 10px 11px 2px; }
.toast .body strong { display: block; font-size: 13.5px; font-weight: 600; }
.toast .body span.detail { display: block; font-size: 12px; color: var(--ink-500); margin-top: 1px; word-break: break-word; }

.toast .close {
    align-self: flex-start;
    background: none; border: none; cursor: pointer;
    color: var(--ink-300); font-size: 18px; line-height: 1;
    padding: 9px 11px 0 0;
}
.toast .close:hover { color: var(--ink-700); }

.toast.success { border-color: var(--green); background: var(--green-bg); }
.toast.success .rail, .toast.success .glyph span { background: var(--green); }
.toast.success .body strong { color: var(--green); }

.toast.warning { border-color: var(--amber); background: var(--amber-bg); }
.toast.warning .rail, .toast.warning .glyph span { background: var(--amber); }
.toast.warning .body strong { color: var(--amber); }

.toast.error { border-color: var(--red); background: var(--red-bg); }
.toast.error .rail, .toast.error .glyph span { background: var(--red); }
.toast.error .body strong { color: var(--red); }

.toast.info { border-color: var(--accent); background: var(--accent-soft); }
.toast.info .rail, .toast.info .glyph span { background: var(--accent); }
.toast.info .body strong { color: var(--accent-dark); }

/* Time-remaining bar; errors have no timer so they get none. */
.toast .timer {
    position: absolute; left: 0; bottom: 0; height: 2px;
    background: currentColor; opacity: .45;
    animation: toast-timer linear forwards;
}
.toast.success .timer { color: var(--green); }
.toast.warning .timer { color: var(--amber); }
.toast.info .timer { color: var(--accent); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px) scale(.97); }
    to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
    from { opacity: 1; transform: none; max-height: 200px; }
    to   { opacity: 0; transform: translateX(24px); max-height: 0; margin-top: -10px; }
}
@keyframes toast-timer {
    from { width: 100%; }
    to   { width: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .toast, .toast.leaving { animation: none; }
    .toast .timer { animation: none; width: 0; }
}

/* ----------------------------------------------------------- pagination -- */

.pager {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    font-size: 12px;
}
.pager .grow { flex: 1 1 auto; }
/* The shorthand here used to reset padding outright, which took away the space
   the chevron sits in and left it on top of the number. */
.pager select { width: auto; min-height: 26px; padding: 2px 26px 2px 6px; }

/* --------------------------------------------------------------- login --- */

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 460px;
    background: var(--navy-900);
}
@media (max-width: 900px) { .login-page { grid-template-columns: 1fr; } .login-hero { display: none !important; } }

.login-hero {
    display: flex; flex-direction: column; justify-content: center;
    padding: 56px;
    color: #cfdbe8;
    background:
        radial-gradient(900px 480px at 20% 10%, rgba(47,128,237,.28), transparent 60%),
        radial-gradient(700px 500px at 80% 90%, rgba(111,177,255,.16), transparent 60%),
        var(--navy-900);
}
.login-hero .hero-mark { display: block; margin-bottom: 18px; }
/* The legacy Weldcraft Pro wordmark: a GIF drawn at 204x56, so shown at its own size to stay sharp. */
.login-hero .hero-logo { width: 204px; height: 56px; border-radius: 6px; }
.login-hero h1 { color: #fff; font-size: 34px; letter-spacing: -.02em; }
.login-hero p { max-width: 460px; margin-top: 12px; font-size: 14.5px; line-height: 1.6; }
.login-hero ul { margin-top: 22px; padding: 0; list-style: none; display: grid; gap: 9px; }
.login-hero li { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; }
.login-hero li .tick { color: #6fb1ff; flex: 0 0 auto; }

.login-panel {
    background: var(--surface);
    display: flex; flex-direction: column; justify-content: center;
    padding: 40px 44px;
}
.login-panel .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.login-panel .brand .mark {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    overflow: hidden;
}
.login-panel h2 { font-size: 20px; }
.login-panel .sub { color: var(--ink-500); margin: 4px 0 22px; font-size: 13px; }
.login-panel .btn { width: 100%; justify-content: center; height: 38px; font-size: 14px; }
.login-panel .foot { margin-top: 22px; font-size: 11.5px; color: var(--ink-500); }
/* The Home link back to the public site, small and to the left (after .login-panel .btn, which is full width). */
.login-panel .login-home { width: auto; height: 32px; padding: 0 12px; margin-bottom: 18px; font-size: 13px; }
.login-more-info:hover img, .login-more-info:focus-visible img { content: url(/i/btn-more-infoo.gif); }

.alert {
    padding: 9px 11px;
    border-radius: var(--radius);
    font-size: 12.5px;
    margin-bottom: 12px;
    border: 1px solid transparent;
}
.alert-error { background: var(--red-bg); border-color: var(--red-line); color: var(--red-ink); }
.alert-warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-ink); }
.alert-info { background: var(--blue-bg); border-color: var(--blue-line); color: var(--blue-ink); }
.alert-success { background: var(--green-bg); border-color: var(--green-line); color: var(--green-ink); }

/* Anything nested in an alert - a bold lead-in, a link - keeps the alert's ink
   rather than falling back to the page's body colour. */
.alert strong, .alert b { color: inherit; }
.alert a { color: inherit; text-decoration: underline; }

/* ------------------------------------------------------------- lookups --- */

.lookup { position: relative; }

/* Result lists are positioned in the viewport, not in the flow, so they can
   escape the overflow clipping on cards, table wrappers and modals. The exact
   coordinates are set by eit.dropdown.anchor(). */
.lookup-results {
    position: fixed; z-index: 500;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 290px; overflow: auto;
}
.lookup-results .item { padding: 6px 10px; cursor: pointer; font-size: 12.5px; }
.lookup-results .item:hover, .lookup-results .item.active { background: var(--blue-bg); }
.lookup-results .item .meta { font-size: 11px; color: var(--ink-500); }
.lookup-results .none { padding: 10px; color: var(--ink-500); font-size: 12.5px; }

.picked {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 4px 6px 4px 9px;
    background: var(--surface-2);
    min-height: 30px;
}
.picked .text { flex: 1 1 auto; min-width: 0; font-size: 13px; }
.picked .text small { display: block; color: var(--ink-500); font-size: 11px; }

/* ---------------------------------------------------------------- misc --- */

.spinner {
    width: 15px; height: 15px;
    border: 2px solid var(--line-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}
.spinner-on-btn { width: 12px; height: 12px; margin-right: 6px; vertical-align: -2px; border-color: rgba(255,255,255,.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-bar {
    height: 2px; background: var(--surface-3); overflow: hidden; position: relative;
}
.loading-bar::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    animation: slide 1.1s ease-in-out infinite;
}
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.tree { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.tree ul { list-style: none; margin: 0; padding-left: 18px; border-left: 1px dotted var(--line-strong); }
.tree li { padding: 2px 0; }
.tree .node { display: flex; align-items: center; gap: 6px; }
.tree .node .qty { color: var(--ink-500); font-variant-numeric: tabular-nums; }
.tree .node .price { margin-left: auto; font-variant-numeric: tabular-nums; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 12.5px; }
.kv dt { color: var(--ink-500); }
.kv dd { margin: 0; font-weight: 500; }

.address-block { white-space: pre-line; font-size: 12.5px; }

@media print {
    .sidebar, .topbar, .toolbar, .pager, .toast-host, .page-head .actions { display: none !important; }
    .content { padding: 0; }
    .card { border: none; box-shadow: none; }
}

/* ---------------------------------------------------- two-factor sign-in --- */

.totp-qr {
    display: flex;
    justify-content: center;
    padding: 14px;
    margin-bottom: 14px;
    background: #fff;                 /* quiet zone: scanners need light around it,
                                         so this stays white in the dark theme too */
    border: 1px solid var(--line);
    border-radius: 8px;
}

.totp-qr img { display: block; width: 220px; height: 220px; image-rendering: pixelated; }

.totp-manual { margin-bottom: 16px; }
.totp-manual summary { font-size: 12px; color: var(--ink-500); cursor: pointer; }
.totp-manual p { margin: 8px 0 6px; }

.totp-secret {
    display: block;
    padding: 8px 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    letter-spacing: 0.06em;
    word-break: break-all;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 6px;
}

.totp-cancel { margin-top: 10px; text-align: center; }
.totp-cancel .btn { width: auto; }

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
    margin: 16px 0 20px;
    padding: 16px;
    list-style: none;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.recovery-codes code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 14px;
    letter-spacing: 0.08em;
}

@media (max-width: 560px) { .recovery-codes { grid-template-columns: 1fr; } }

@media print {
    .app-nav, .app-header, .page-head .actions, .row-actions, .alert { display: none !important; }
    .recovery-codes { border-color: #000; }
}

/* ------------------------------------------------- remember this device --- */

.login-panel .remember-device {
    display: flex; align-items: center; gap: 8px;
    margin: 2px 0 4px; font-size: 12.5px; cursor: pointer;
}

.login-panel .remember-device input { margin: 0; }
.login-panel .remember-note { margin: 0 0 14px; }

/* ----------------------------------------------------------- user menu --- */

/* A native <details> disclosure, so it behaves identically on the statically
   rendered account page and on the interactive ones - see MainLayout. */

.user-menu { position: relative; }

/* The default disclosure triangle, removed in both the standard and the older
   WebKit form. */
.user-menu > summary { list-style: none; cursor: pointer; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary::marker { content: ""; }

.user-menu > summary .caret { color: var(--ink-500); margin-left: 2px; transition: transform .12s ease; }
.user-menu[open] > summary .caret { transform: rotate(180deg); }

.user-menu-panel {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 500;
    min-width: 190px;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.user-menu-panel a,
.user-menu-panel button {
    /* Flex rather than block: every item now leads with an icon, and they want
       to line up whatever the label under them says. Alignment stated, because a
       button centres its content by default here and an anchor does not - which
       left the three of them stepped, each shorter label starting further in. */
    display: flex; align-items: center; justify-content: flex-start; gap: 9px;
    width: 100%;
    padding: 7px 10px;
    border: 0; border-radius: 6px;
    background: none;
    font: inherit; font-size: 13px; text-align: left; color: var(--ink-900);
    text-decoration: none; cursor: pointer;
}

.user-menu-panel a svg,
.user-menu-panel button svg { flex: none; color: var(--ink-500); }

.user-menu-panel a:hover svg,
.user-menu-panel button:hover svg { color: var(--accent); }

/* Groups the three things this menu does rather than decorating it: what the
   account is, how it looks, and leaving. */
.user-menu-panel .menu-sep {
    height: 1px;
    margin: 5px 4px;
    background: var(--line);
}

.user-menu-panel a:hover,
.user-menu-panel button:hover { background: var(--surface-2); }
.user-menu-panel form { margin: 0; }

/* ------------------------------------------------------ reconnect dialog --- */

/*
   Blazor's own reconnect dialog is unstyled by the app and renders near-white
   text in dark mode. This replaces it: same tokens as everything else, so it
   follows the theme. Blazor toggles the classes; the CSS decides what shows.
*/

.reconnect {
    display: none;
    position: fixed; inset: 0; z-index: 2000;
    align-items: center; justify-content: center;
    padding: 16px;
    background: rgba(6, 14, 24, .55);
    backdrop-filter: blur(2px);
}

.reconnect.components-reconnect-show,
.reconnect.components-reconnect-failed,
.reconnect.components-reconnect-rejected { display: flex; }

.reconnect-card {
    width: min(430px, 100%);
    padding: 18px;
    background: var(--surface);
    color: var(--ink-900);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.reconnect-body { display: none; align-items: flex-start; gap: 12px; }
.reconnect-body strong { display: block; font-size: 14px; margin-bottom: 3px; }
.reconnect-body .detail { display: block; font-size: 12.5px; color: var(--ink-500); line-height: 1.5; }
.reconnect-body .btn { margin-top: 12px; }
.reconnect-body .spinner { margin-top: 3px; flex: 0 0 auto; }

/* One state visible at a time. Blazor adds exactly one of these classes. */
.components-reconnect-show .reconnect-when-show,
.components-reconnect-failed .reconnect-when-failed,
.components-reconnect-rejected .reconnect-when-rejected { display: flex; }

/* Failed supersedes show - Blazor leaves both classes on in some transitions. */
.components-reconnect-failed .reconnect-when-show,
.components-reconnect-rejected .reconnect-when-show,
.components-reconnect-rejected .reconnect-when-failed { display: none; }

/* --------------------------------------------------- contact links --------- */

/* Telephone numbers, email addresses and websites are actions, not text. Used in
   list cells and read-only displays; the form equivalent is .field-with-action. */
.contact-link {
    display: inline-flex; align-items: center; gap: 5px;
    color: var(--accent); text-decoration: none;
    max-width: 100%;
}
.contact-link:hover { text-decoration: underline; }
.contact-link .ico { flex: 0 0 auto; opacity: .7; }
.contact-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* An input with its action - call, mail, open - fixed to the trailing edge. */
.field-with-action { display: flex; align-items: stretch; gap: 0; }

/* Width and min-width are set here rather than relied on from the shared input
   rule: that rule lists input types explicitly, and a type missing from it left
   the field at its intrinsic size with the button floating off to one side. */
.field-with-action input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    border-top-right-radius: 0; border-bottom-right-radius: 0;
    border-right-color: transparent;
}

/* A field with nothing joined to it keeps its own right edge. The batch entry
   Net cell only grows its button once an order is chosen; until then the field
   was sitting there with its right border blanked out for a button that never
   came. */
.field-with-action input:last-child {
    border-right-color: var(--line-strong);
    border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius);
}

.field-with-action .field-action {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto; width: 32px; min-height: 30px;
    border: 1px solid var(--line-strong); border-left: 0;
    border-top-right-radius: var(--radius); border-bottom-right-radius: var(--radius);
    background: var(--surface-2);
    color: var(--accent);
    text-decoration: none;
}
.field-with-action .field-action:hover { background: var(--surface-3); }

/* The same joined button, when it does something rather than goes somewhere. A
   button brings its own font and chrome, which has to be turned off for it to sit
   flush against the field the way the anchor version does - without this it has
   no border, and the field's own right edge is already transparent expecting one. */
.field-with-action button.field-action { font: inherit; cursor: pointer; padding: 0; }
.field-with-action button.field-action:disabled { color: var(--ink-300); cursor: default; }

/* Kept in place rather than removed, so the field does not resize as you type. */
.field-with-action .field-action.disabled { color: var(--ink-300); cursor: default; }

.field-with-action input:focus + .field-action,
.field-with-action input:focus ~ .field-action { border-color: var(--accent); }

/* ------------------------------------------------- account alert flag ------ */

/* [account].flagImage, as the desktop shows it. The colour is the customer's own
   convention, so it is deliberately just a colour - the message is the tooltip. */
.alert-flag { display: inline-flex; align-items: center; vertical-align: middle; }

/* Filled as well as stroked, so the colour reads at a glance in a list row
   rather than being a thin outline. */
.alert-flag .ico { fill: currentColor; }

.alert-flag-blue   { color: var(--accent); }
.alert-flag-green  { color: var(--green); }
.alert-flag-red    { color: var(--red); }
.alert-flag-yellow { color: var(--amber); }

/* The banner takes the colour of the flag it is reporting, so the strip at the
   top of the account and the marker in the list are obviously the same thing. */
.alert.alert-flagged { display: flex; align-items: center; gap: 9px; }
.alert.alert-flagged .alert-flag .ico { width: 18px; height: 18px; }

.alert-flagged-blue   { background: var(--blue-bg);  border-color: var(--blue-line);  color: var(--blue-ink); }
.alert-flagged-green  { background: var(--green-bg); border-color: var(--green-line); color: var(--green-ink); }
.alert-flagged-red    { background: var(--red-bg);   border-color: var(--red-line);   color: var(--red-ink); }
.alert-flagged-yellow { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-ink); }

/* No colour chosen, but a message written: fall back to the neutral warning. */
.alert-flagged-none   { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-ink); }

/* The flag beside a picked account, or beside a job's customer: a button in
   the flag's colour and nothing else, so it reads as the marker it is. */
.alert-flag-badge {
    background: none; border: 0; padding: 0 2px; margin: 0;
    cursor: pointer; display: inline-flex; align-items: center; vertical-align: middle; line-height: 1;
}
.alert-flag-badge:hover { filter: brightness(1.15); }
.alert-flag-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.lookup-results .item .name { display: flex; align-items: center; gap: 6px; }

/* The alert put up on its own when a flagged account is chosen: the flag
   large, the account named, the message the thing to read. The same colours as
   the banner on the account record, so the two are obviously one alert. */
.account-alert-callout {
    display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start;
    padding: 14px 16px; border: 1px solid; border-radius: var(--radius);
}
.account-alert-callout .alert-flag .ico { width: 26px; height: 26px; }
.account-alert-callout .who { font-weight: 600; font-size: 14px; }
.account-alert-callout .who .number { font-weight: 400; opacity: .75; font-size: 12px; margin-left: 6px; }
.account-alert-callout .what { margin: 6px 0 0; font-size: 14px; line-height: 1.5; }

/* The picker on the account form. */
.alert-flag-picker { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.alert-flag-picker .choice {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 9px;
    border: 1px solid var(--line-strong); border-radius: 999px;
    background: var(--surface);
    font-size: 12px; cursor: pointer;
}
.alert-flag-picker .choice:hover:not(.disabled) { border-color: var(--accent); }
.alert-flag-picker .choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.alert-flag-picker .choice.disabled { cursor: default; opacity: .6; }

/* Office › Home Page Design: one card per design, the radio and its wording on the left, Preview on the right. */
.design-choices { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.design-choices legend { margin-bottom: 10px; font-weight: 600; }
.design-choice {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
    padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
}
.design-choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.design-choice label { flex: 1 1 320px; display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.design-choice label input { margin-top: 4px; }
.design-choice label > span { display: flex; flex-direction: column; gap: 2px; }
.design-choice .badge { align-self: flex-start; }

/* The Inactive pill follows the name directly. The name is a bare text node, so
   the pill is the cell's first ELEMENT child and :not(:first-child) would never
   match it - hence a class of its own rather than a positional selector. */
.pill.row-flag { margin-left: 8px; }

/* The primary-contact star. Filled gold when set, and a hollow outline when not,
   so which contact is primary is obvious from across the table. */
.primary-star { display: inline-flex; cursor: pointer; color: var(--amber); }
.primary-star .ico { fill: currentColor; width: 18px; height: 18px; }

.primary-star.unset { color: var(--ink-300); }
.primary-star.unset .ico { fill: none; }
.primary-star.unset:hover { color: var(--amber); }

/* An inactive contact cannot hold the star, so it does not invite a click. */
.primary-star.disabled { cursor: default; opacity: .35; }
.primary-star.disabled:hover { color: var(--ink-300); }

/* Attachment file-kind glyph. Muted so a column of them reads as a margin mark
   rather than competing with the file names beside it. */
.file-kind { color: var(--ink-500); text-align: center; }
.file-kind .ico { display: block; margin: 0 auto; }

/* Activity details keep the line breaks they were typed with. */
.preserve-lines { white-space: pre-wrap; }

/* Trail across the levels of a bill of materials. */
.bom-trail { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.bom-trail .sep { color: var(--ink-500); flex: none; }
.bom-trail .here { font-weight: 600; color: var(--ink-900); }
.bom-trail .link {
    background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
    color: var(--accent); text-decoration: underline; text-underline-offset: 2px;
}
.bom-trail .link:hover { color: var(--accent-dark); }

/* A row with nothing beneath it still offers the button, just quietly. */
.ico.faded { opacity: .4; }

/* Glyph: a house icon in a table cell where the old site put an <img> (ticks, crosses, the summary matrix). It takes
   the link's colour inside <a>; the tones are the old site's green tick, red cross and grey "not available" images. */
.glyph { display: inline-flex; align-items: center; vertical-align: middle; line-height: 0; }
.glyph.good { color: var(--green); }
.glyph.bad { color: var(--red); }
.glyph.dim { color: var(--ink-300); }

/* Estimated / Actual dividers inside the profit and loss tables, each carrying
   its own total. Set apart from the lines beneath so the eye finds the split. */
.data.compact tr.section-row td { background: var(--surface-2); border-top: 1px solid var(--line); }
.data.compact tr.section-row strong { color: var(--ink-900); }

/* ------------------------------------------------- email composer --------- */

/* Recipients and files as rows to tick. The address or size sits at the right
   in the quieter ink and is always shown whole; it is the name that gives way,
   with an ellipsis, when the row runs short of room. */
.pick-list {
    display: grid; gap: 2px;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); padding: 6px 10px;
    max-height: 190px; overflow-y: auto; overflow-x: hidden;
}
.pick-list .check {
    display: grid; grid-template-columns: auto minmax(0, 1fr) max-content;
    gap: 8px 12px; align-items: center; padding: 3px 0;
}
.pick-list .check > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-list .pick-detail {
    color: var(--ink-500); font-size: 11.5px; white-space: nowrap; justify-self: end;
    display: inline-flex; align-items: center; gap: 6px;
}

/* ------------------------------------------------- sage export wizard ---- */

/* The desktop's "Step n of 3" strip along the top of the wizard card, and the
   Previous / Next / Finish rail along the bottom. */
.wizard-steps {
    display: flex; flex-wrap: wrap;
    padding: 0 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}
.wizard-steps .step {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 14px 9px 0; margin-right: 14px;
    font-size: 12.5px; color: var(--ink-500);
    border-bottom: 2px solid transparent;
}
.wizard-steps .step .n {
    width: 20px; height: 20px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600;
    background: var(--surface-3); color: var(--ink-700);
}
.wizard-steps .step.current { color: var(--ink-900); font-weight: 600; border-bottom-color: var(--accent); }
.wizard-steps .step.current .n { background: var(--accent); color: var(--on-accent); }
.wizard-steps .step.done .n { background: var(--green-bg); color: var(--green); }

.wizard-foot {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
}
.wizard-foot .grow { flex: 1 1 auto; }

/* One produced file: its name, the download, and the confirmation the desktop
   asked for before it would mark anything as exported. */
.sage-file {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.sage-file:last-child { border-bottom: 0; }
.sage-file .name { font-weight: 600; min-width: 220px; }
.sage-file .check { margin-left: auto; }

/* ------------------------------------------------------- sage agents ----- */

/* The facts on an agent card, and the text an agent sends back from a probe
   or a test connection, shown as it arrived. */
.agent-facts { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 12.5px; }
.agent-facts dt { color: var(--ink-500); font-weight: 600; }
.agent-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.agent-detail {
    margin: 6px 0 0; padding: 8px 10px; max-height: 220px; overflow: auto;
    font-size: 11.5px; line-height: 1.45; white-space: pre-wrap;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
}
.agent-card .card-head .pill { margin-left: 4px; }

/* ---------------------------------------------------------- public site --- */
/* The anonymous public pages (legacy default.asp, products/, training/ ...).
   Same tokens as the portal, roomier type; no horizontal scroll at 375 px. */
.pub-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--page); color: var(--ink-900); font-family: var(--font); }
.pub-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.pub-brand { font-size: 1.35rem; font-weight: 700; color: var(--brand-ink); text-decoration: none; }
.pub-brand em { color: var(--red); }
/* The Speciality Enterprises logo and line sit between the brand and the menu; the line goes first as the screen narrows. */
.pub-se { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
.pub-se img { display: block; height: 32px; width: auto; max-width: 100%; }
.pub-se-line { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 1.05rem; color: #1b6aa5; white-space: nowrap; }
@media (max-width: 1280px) { .pub-se-line { display: none; } }
@media (max-width: 520px) { .pub-se { display: none; } }
.pub-menu { display: none; }
.pub-menu > summary { list-style: none; cursor: pointer; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.pub-menu > summary::-webkit-details-marker { display: none; }
.pub-nav, .pub-mnav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; }
.pub-nav a:not(.btn), .pub-mnav a:not(.btn) { color: var(--ink-700); text-decoration: none; }
.pub-nav a:not(.btn):hover, .pub-mnav a:not(.btn):hover { color: var(--brand); }
.pub-group { position: relative; }
.pub-group > summary { list-style: none; cursor: pointer; color: var(--ink-700); }
.pub-group > summary::-webkit-details-marker { display: none; }
.pub-group > summary::after { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 2px 3px 7px; border: solid var(--ink-500); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.pub-group > summary:hover, .pub-group[open] > summary { color: var(--brand); }
.pub-panel { position: absolute; top: 100%; left: 0; z-index: 20; min-width: 220px; margin-top: 6px; padding: 8px 14px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.pub-panel a { white-space: nowrap; padding: 2px 0; }
/* The signed-in user's menu in the public header: initials, then a panel back to their area, account and log-out. */
.pub-user > summary { display: inline-flex; align-items: center; gap: 8px; }
.pub-avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.pub-user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-user .pub-panel { left: auto; right: 0; }
.pub-user .pub-panel a, .pub-user .pub-panel button { display: inline-flex; align-items: center; gap: 8px; }
.pub-user .pub-panel form { margin: 0; padding-top: 6px; border-top: 1px solid var(--line); }
.pub-user .pub-panel button { padding: 2px 0; border: 0; background: none; font: inherit; color: var(--ink-700); cursor: pointer; }
.pub-user .pub-panel button:hover { color: var(--brand); }
/* Full width, on the same 24px left and right edges as the header and footer, not a centred column. */
.pub-main { flex: 1; width: 100%; padding: 24px; }
/* The home page slider: full width under the menu. The negative margins cancel .pub-main's padding (24px, 16px on
   a phone) so the pictures run edge to edge without a 100vw scrollbar overflow. Swipes and tabs with no script;
   carousel.js marks it .is-live and adds the arrows, dots and autoplay. */
.pub-carousel { position: relative; margin: -24px -24px 28px; background: var(--ink-900); }
.pub-carousel-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.pub-carousel-track::-webkit-scrollbar { display: none; }
.pub-carousel-track img { flex: 0 0 100%; width: 100%; height: clamp(240px, 38vw, 540px); object-fit: cover; scroll-snap-align: start; }
/* The logo and contact details centred over every picture, on a soft dark wash so the white text reads on any photo.
   Clicks fall through to the strip (so it still swipes) except on the links themselves. */
.pub-carousel-caption { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px 64px; text-align: center; color: #fff; pointer-events: none; background: radial-gradient(ellipse at center, rgba(0, 0, 0, .5), rgba(0, 0, 0, .1) 70%); text-shadow: 0 1px 6px rgba(0, 0, 0, .8); }
.pub-carousel-caption img { width: min(400px, 60%); height: auto; margin-bottom: 8px; }
.pub-carousel-caption p { margin: 0; font-size: clamp(1rem, 2.2vw, 1.7rem); font-weight: 500; }
.pub-carousel-caption a, .pub-shell .pub-main .pub-carousel-caption a { color: #fff; text-decoration: none; pointer-events: auto; }
.pub-carousel-caption a:hover { text-decoration: underline; }
.pub-carousel-btn, .pub-carousel-dots { display: none; }
.pub-carousel.is-live .pub-carousel-btn { display: grid; }
.pub-carousel.is-live .pub-carousel-dots { display: flex; }
.pub-carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); place-items: center; width: 44px; height: 44px; padding: 0 0 4px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.pub-carousel-btn:hover, .pub-carousel-btn:focus-visible { background: rgba(0, 0, 0, .75); }
.pub-carousel-btn.prev { left: 16px; }
.pub-carousel-btn.next { right: 16px; }
.pub-carousel-dots { position: absolute; left: 0; right: 0; bottom: 14px; justify-content: center; gap: 8px; }
.pub-carousel-dots button { width: 10px; height: 10px; padding: 0; border: 1px solid #fff; border-radius: 50%; background: rgba(255, 255, 255, .35); cursor: pointer; }
.pub-carousel-dots button[aria-current=true] { background: #fff; }
@media (max-width: 720px) { .pub-carousel { margin: -16px -16px 20px; } .pub-carousel-btn { width: 36px; height: 36px; font-size: 26px; } }
/* Every public page's content is a centred column with 15% empty on the left and right (70% wide). Not the home
   slider (full width under the menu) and not the fixed pop-ups. Below 1100px a 70% column is too narrow to read, so the
   pages go back to the full width. */
.pub-main > :not(.pub-carousel, .pub-modal, .pub-modal-backdrop) { width: 70%; margin-inline: auto; }
@media (max-width: 1100px) { .pub-main > :not(.pub-carousel, .pub-modal, .pub-modal-backdrop) { width: 100%; } }
.pub-hero { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; margin-bottom: 28px; }
.pub-hero h1 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.2; margin: 0 0 12px; }
/* The legacy headline marks "craft" in red italic; the CMS keeps the span but not its class, so the first span is that word. */
.pub-hero h1 span:first-of-type { color: var(--red); font-style: italic; }
.pub-strip { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; margin-bottom: 28px; }
/* The photos share the row edge to edge on the full-width page (no gap on the right); a lone photo keeps a sensible width. */
.pub-strip img { flex: 1 1 260px; min-width: 200px; height: 200px; object-fit: cover; border-radius: var(--radius-lg); scroll-snap-align: start; }
.pub-strip img:only-child { flex: 0 1 auto; width: min(560px, 100%); height: auto; aspect-ratio: 16 / 10; }
.pub-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin: 20px 0; }
.pub-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.pub-card h2, .pub-card h3 { margin-top: 0; }
.pub-prose { line-height: 1.65; }
.pub-hero .pub-prose { max-width: none; }
.pub-hero .pub-prose h3 { margin: 1.2em 0 .4em; color: var(--brand-ink); }
.pub-hero .pub-prose p:first-of-type img { float: left; margin: 0 14px 8px 0; }
.pub-hero .pub-cards { grid-template-columns: 1fr; margin: 0; }
.pub-red { color: var(--red); font-style: italic; }
.pub-main h2 { font-size: 1.3rem; line-height: 1.3; }
.pub-card h2 { color: var(--brand-ink); margin-bottom: .5em; }
.pub-pair { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin: 0 0 20px; align-items: start; }
/* Rows of short boxes (the home page's pairs, Underwater Welding's log-in / book / Speciality row) are the same height,
   so a shorter one never leaves a ragged gap under it on the full-width page; a picture box centres its content. */
.pub-pair.pub-even { align-items: stretch; }
.pub-pair.pub-even > .pub-card-media:not(.pub-feature) { align-items: center; }
/* A CMS page's text blocks: in pairs, each pair the same height; an odd last block (Underwater Welding's long course
   outline, Firefly's specifications, or a page's only block) spans both columns, so no block leaves a tall empty box
   or a blank area beside it on the full-width page. On the sidebar layout that long outline reads in two text columns.
   One column on a phone. */
.pub-blocks { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.pub-blocks > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.pub-split .pub-blocks > :last-child:nth-child(odd) > .pub-flow { columns: 2 340px; column-gap: 32px; }
.pub-split .pub-blocks > :last-child:nth-child(odd) > .pub-flow :is(h2, h3, h4) { break-after: avoid-column; }
.pub-split .pub-blocks > :last-child:nth-child(odd) > .pub-flow :is(ul, ol, img, table) { break-inside: avoid-column; }
@media (max-width: 900px) {
    .pub-blocks { grid-template-columns: 1fr; }
    .pub-split .pub-blocks > :last-child:nth-child(odd) > .pub-flow { columns: 1; }
}
.pub-flow { line-height: 1.6; }
.pub-flow > :first-child { margin-top: 0; }
.pub-flow > :last-child { margin-bottom: 0; }
.pub-card-media { display: flex; gap: 14px; align-items: flex-start; }
.pub-card-media > a, .pub-card-media > img { flex: 0 0 auto; width: 110px; max-width: 34%; }
.pub-pair .pub-card-media > img { width: 220px; max-width: 40%; }
/* The home page's products box beside the video: the photo fills the top of the box (however tall the row is) and the
   text sits under it, so the box is never a small picture in a large empty card. */
.pub-pair .pub-feature { flex-direction: column; align-items: stretch; }
.pub-pair .pub-feature > img { flex: 1 1 0; width: 100%; max-width: none; min-height: 200px; object-fit: cover; }
.pub-card-media img { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.pub-card-media > div { min-width: 0; }
/* 16:9 and no wider than a normal player, so a full-width box does not become a wide black band. */
.pub-video { display: block; width: 100%; max-width: 720px; aspect-ratio: 16 / 9; margin-top: 12px; background: #000; border-radius: var(--radius); }
.pub-cta { text-align: center; margin: 12px 0 8px; padding: 28px 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.pub-cta h2 { margin: 0 0 8px; color: var(--brand-ink); }
.pub-prose img { max-width: 100%; height: auto; border-radius: var(--radius); }
.pub-prose table { display: block; overflow-x: auto; max-width: 100%; }
.pub-docs { list-style: none; padding: 0; display: grid; gap: 8px; }
.pub-docs a { color: var(--brand); }
.pub-logos { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; align-items: center; margin: 28px 0; }
.pub-logos img { max-height: 56px; width: auto; padding: 4px; border-radius: var(--radius); filter: grayscale(0.2); }
.pub-footer { padding: 36px 24px 20px; background: #16202b; color: #c9d1d9; font-size: 13.5px; line-height: 1.6; }
.pub-footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px 40px; max-width: 1100px; margin: 0 auto; }
.pub-footer h2 { margin: 0 0 8px; font-size: 1.25rem; color: #fff; }
.pub-footer h2 em { color: #ff6b6b; }
.pub-footer h3 { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8b98a5; }
.pub-footer p { margin: 4px 0; }
.pub-footer a { color: #fff; text-decoration: none; }
.pub-footer a:hover, .pub-footer a:focus-visible { text-decoration: underline; }
.pub-footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pub-footer-legal { max-width: 1100px; margin: 28px auto 0 !important; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .14); font-size: 12px; color: #8b98a5; text-align: center; }
/* CMS pages (training/, products/, Certification/, articles/Welders-Mate-Book): headline, story, blocks, extras. */
.pub-article h1 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.2; margin: 0 0 12px; }
.pub-article h1 span:first-of-type { color: var(--red); font-style: italic; }
.pub-article h2, .pub-article h3 { color: var(--brand-ink); }
.pub-story > p:first-child img { float: left; margin: 0 14px 8px 0; }
.pub-story::after { content: ""; display: block; clear: both; }
.pub-extras { margin-top: 20px; }
/* A CMS page with side boxes (Underwater Welding): the text in a main column, the boxes in a sidebar that stays in view,
   on the same 20px spacing as the rest of the page. The story reads in two columns there, so its lines stay a readable
   length on a wide screen. One column below 1100px, the sidebar after the text. */
.pub-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.pub-split-side { position: sticky; top: 76px; }
.pub-split-side .pub-extras { margin-top: 0; }
.pub-side-stack { display: flex; flex-direction: column; gap: 20px; }
.pub-side-stack .pub-card h2 { font-size: 1.1rem; margin-top: 0; }
.pub-side-stack .pub-card p { margin: 0 0 12px; }
.pub-side-stack .pub-card-media > a, .pub-side-stack .pub-card-media > img { width: 96px; }
.pub-split .pub-story { columns: 2 340px; column-gap: 32px; }
.pub-split .pub-story :is(img, ul, ol, table) { break-inside: avoid-column; }
.pub-split .pub-story :is(h2, h3, h4) { break-after: avoid-column; margin-top: 0; }
.pub-split .pub-story > p:first-child { margin-top: 0; }
.pub-split .pub-blocks { margin: 20px 0 0; }
@media (max-width: 1100px) {
    .pub-split { grid-template-columns: 1fr; }
    .pub-split-side { position: static; }
    .pub-split .pub-story { columns: 1; }
}
.pub-extras .pub-strip { margin-bottom: 20px; }
.pub-extras .pub-card-media > img { width: 160px; max-width: 34%; }
.pub-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 20px 0; }
.pub-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; text-align: center; color: var(--brand-ink); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.pub-tile:hover { border-color: var(--brand); text-decoration: underline; }
.pub-tile img { display: block; max-width: 100%; max-height: 180px; width: auto; height: auto; object-fit: contain; border-radius: var(--radius); }
.pub-prices { display: grid; gap: 4px; margin: 12px 0; }
.pub-price { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pub-price form { margin: 0; }
.pub-contact { margin: 20px 0; line-height: 1.6; }
.pub-list { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.pub-list .pub-card-media > a { width: 150px; max-width: 38%; }
.pub-list .pub-card-media h3 { margin: 0 0 .4em; color: var(--brand-ink); }
.pub-list .pub-card-media p { margin: 0 0 .6em; overflow-wrap: anywhere; }
/* The card's button (Training Centres' Enquire) sits on the bottom edge, so a row of cards lines its buttons up
   however long each centre's name or website runs. */
.pub-list .pub-card-media > div { align-self: stretch; display: flex; flex-direction: column; }
.pub-list .pub-card-media > div > .btn:last-child { margin-top: auto; align-self: flex-start; }
.pub-products .pub-cards, .pub-products .pub-card-media { max-width: 100%; }
.pub-products .pub-list { grid-template-columns: 1fr; }
.pub-dim { background: var(--surface-2); }
.pub-dim img { opacity: .75; }
.pub-article h1 span { font-style: italic; }
.pub-article.pub-book h1 span:first-of-type { color: inherit; }
.pub-faq h1 { margin-bottom: 16px; }
.pub-faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 8px; box-shadow: var(--shadow-sm); }
.pub-faq summary { cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--brand-ink); }
.pub-faq details[open] summary { border-bottom: 1px solid var(--line); }
.pub-faq details p { margin: 0; padding: 12px 16px; line-height: 1.6; }
.pub-faq details p + p { padding-top: 0; }
.pub-book h3 { margin: 1.4em 0 .4em; }
.pub-book .pub-cover { float: left; width: 110px; margin: 0 14px 8px 0; }
.pub-book .pub-figure { text-align: center; }
.pub-pager { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 18px; margin: 12px 0; }
.pub-pager span { color: var(--ink-500); }
.pub-pager a { color: var(--brand); }
.pub-articles { list-style: none; padding: 0; }
.pub-articles .pub-card-media > img { width: 150px; max-width: 38%; }
.pub-meta { color: var(--ink-500); }
.pub-pdf { display: block; width: 100%; height: 80vh; margin: 12px 0; border: 1px solid var(--line); border-radius: var(--radius); }
.pub-ocr { max-width: none; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font); }
@media (max-width: 900px) {
    .pub-nav { display: none; }
    .pub-menu { display: block; }
    .pub-menu[open] .pub-mnav { position: absolute; right: 16px; top: 56px; z-index: 20; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px; box-shadow: var(--shadow-lg); max-height: 80vh; overflow-y: auto; }
    .pub-panel { position: static; min-width: 0; margin: 4px 0 0; padding: 0 0 0 12px; border: 0; box-shadow: none; background: transparent; }
    .pub-panel a { white-space: normal; }
    .pub-hero { grid-template-columns: 1fr; }
    .pub-main { padding: 16px; }
    .pub-header { padding-inline: 16px; }
    .pub-footer { padding-inline: 16px; }
}
@media (max-width: 600px) {
    .pub-hero .pub-prose p:first-of-type img { float: none; display: block; width: 100%; max-width: 220px; margin: 0 0 12px; }
    .pub-story > p:first-child img { float: none; display: block; width: 100%; max-width: 240px; margin: 0 0 12px; }
}
/* Quiz (training/quiz.asp): one card per question, the choices stacked. */
.pub-quiz-head { margin-bottom: 24px; padding: 24px 28px; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--brand); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.pub-quiz-head h1 { margin: 4px 0 12px; }
.pub-quiz-head p { margin: 0 0 8px; max-width: 70ch; }
.pub-quiz-kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-500); }
.pub-quiz-score { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); position: sticky; top: 68px; z-index: 5; box-shadow: var(--shadow-sm); }
.pub-quiz-score strong { font-size: 1.6rem; color: var(--brand-ink); }
.pub-quiz .pub-question { margin: 0 0 16px; min-width: 0; padding: 18px 22px 20px; border-left: 4px solid var(--line-strong); }
.pub-quiz legend { float: left; width: 100%; padding: 0; margin-bottom: 14px; display: flex; gap: 12px; align-items: flex-start; font-size: 1.02rem; font-weight: 600; line-height: 1.4; color: var(--ink-900); }
.pub-quiz legend + * { clear: both; }
.pub-q-num { flex: none; display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 15px; background: var(--brand); color: var(--on-brand); font-size: 13px; font-weight: 700; }
.pub-q-options { display: flex; flex-wrap: wrap; gap: 10px; }
.pub-quiz .pub-q-options label { display: flex; align-items: center; gap: 8px; flex: 1 1 140px; max-width: 280px; padding: 10px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; font-weight: 500; transition: background .12s, border-color .12s; }
.pub-quiz .pub-q-options label:hover { border-color: var(--brand); }
.pub-quiz .pub-q-options label:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); box-shadow: inset 0 0 0 1px var(--brand); font-weight: 700; }
.pub-quiz .pub-q-options label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.pub-quiz .pub-question.is-right { border-left-color: #2e8540; }
.pub-quiz .pub-question.is-wrong { border-left-color: #c0392b; }
.pub-q-mark { margin: 12px 0 0; font-size: 13px; font-weight: 700; }
.is-right .pub-q-mark { color: #2e8540; }
.is-wrong .pub-q-mark { color: #c0392b; }
.pub-quiz-submit { display: block; width: 100%; max-width: 320px; margin: 24px auto 8px; min-height: 46px; font-size: 1rem; }
/* Instructor info pack (Info-Login.asp, More-Info.asp): the PIN card and the document list. */
.pub-pin { max-width: 360px; margin: 16px 0; }
.pub-info .pub-docs { margin: 16px 0; }
.pub-info .pub-docs li { display: flex; align-items: center; gap: 14px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.pub-info .pub-docs li > a:first-child { flex: 0 0 auto; width: 72px; }
.pub-info .pub-docs img { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.pub-info .pub-docs li > a:last-child { min-width: 0; overflow-wrap: anywhere; }
/* Training-centre Website Enquiry popup (legacy jqModal): rendered open by the server, so it needs no script.
   The backdrop is a link that closes it; the panel scrolls on its own on a short screen. */
.pub-modal-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, .55); }
.pub-modal { position: fixed; z-index: 901; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 6px solid var(--ink-900); border-radius: var(--radius-lg); padding: 22px 22px 18px; box-shadow: var(--shadow-lg); }
.pub-modal h2 { margin: 4px 36px 12px 0; color: var(--brand-ink); font-size: 1.15rem; }
.pub-modal p { line-height: 1.5; }
.pub-modal .field input { width: 100%; }
.pub-modal .alert { margin-bottom: 14px; }
.pub-modal-close { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink-900); color: var(--surface); font-size: 1.3rem; line-height: 1; text-decoration: none; }
.pub-modal-close:hover, .pub-modal-close:focus-visible { background: var(--brand-ink); color: var(--on-brand); }
.pub-honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ------------------------------------------------------------ school area --- */
.school-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 8px 0 12px; border-bottom: 4px solid var(--brand); margin-bottom: 14px; }
.school-header-centre { text-align: center; margin: 0; color: var(--ink-700); }
.school-header-right { text-align: right; font-size: 12px; color: var(--ink-500); }
.school-header-demo { color: var(--red); font-weight: 700; margin: 0 0 10px; }
@media (max-width: 640px) { .school-header { grid-template-columns: 1fr; text-align: center; } .school-header-right { text-align: center; } }
.nav-link.disabled { opacity: .5; cursor: default; }
.nav-link.disabled:hover { background: none; }
.nav-school { padding: 10px 14px; font-weight: 600; color: #fff; }
button.nav-link { width: 100%; background: none; border: 0; border-left: 3px solid transparent; font: inherit; font-size: 13px; text-align: left; justify-content: flex-start; }
/* School Summary: the class sub-header in a light band, centred icons, the test number after the name. */
table.summary-table th.icon-col { white-space: normal; text-align: center; width: 72px; }
table.summary-table td.icon-col { text-align: center; }
table.summary-table tbody tr.group-head td { background: var(--surface-2); padding-top: 7px; padding-bottom: 7px; }
table.summary-table tbody tr.group-head:hover td { background: var(--surface-2); }
/* HouseTable GroupBy: the heading row drawn when the group changes. */
table.data.grouped tbody tr.group-head td { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand-ink); box-shadow: inset 3px 0 0 var(--brand); padding-top: 8px; padding-bottom: 8px; }
table.data.grouped tbody tr.group-head:hover td { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
table.summary-table .student-no { margin-left: 10px; color: var(--ink-700); font-variant-numeric: tabular-nums; }

/* ------------------------------------------- registration/audit sheet ------ */
/* The old regEdit pages' tables, backRed / backWarn colours and greyed welder-test block. */
.sheet table { border-collapse: collapse; width: 100%; }
.sheet td, .sheet th { border: 1px solid var(--line); padding: 3px 6px; text-align: left; }
.sheet select, .sheet textarea { max-width: 100%; }
.sheet textarea { width: 100%; }
.sheet .is-red { background: #ff6666; color: #000; }
.sheet .is-amber { background: #ffcd77; color: #000; }
.sheet .faint { color: var(--ink-500); }
.sheet .greyed { color: #999; }
.sheet .sheet-title { font-weight: 600; }
.sheet .alert ul { margin: 0; padding-left: 18px; }
.sheet .btn-image { background: none; border: 0; padding: 0; cursor: pointer; }
.sheet .centred { text-align: center; }
.sheet input.exam-grade { width: auto; }
.photo-pair { display: flex; flex-wrap: wrap; gap: 24px; }
/* The school student page: the fields on the left, the photograph beside them; stacked on a phone. */
.student-top { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 0 28px; align-items: start; }
.student-photo img { display: block; margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--radius); object-fit: cover; }
.student-photo input[type=file] { max-width: 100%; font-size: 12px; }
@media (max-width: 900px) { .student-top { grid-template-columns: 1fr; } }
/* Read-only values and tick boxes sitting in a form beside its inputs. */
.field-value { min-height: 30px; display: flex; align-items: center; gap: 8px; color: var(--ink-700); }
.check-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; margin-top: 4px; }
.check-row .check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; color: var(--ink-700); }
/* The class page's tick boxes: each with its hint beneath, side by side while there is room. */
.class-flags { align-items: flex-start; gap: 4px 40px; }
.class-flags .field { margin-bottom: 0; }
/* A fixed prefix ("WP") sitting in front of a text box, and a row of buttons under a card's values. */
.input-prefix { display: flex; align-items: center; gap: 8px; }
.input-prefix span { color: var(--ink-700); font-size: 13px; }
.input-prefix input { flex: 1 1 auto; min-width: 0; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
/* The introductory form: the result and tick on one line with room to breathe, and Save set apart below. */
.intro-result { gap: 8px 32px; margin-top: 8px; }
.intro-save { margin-top: 20px; }
/* A small heading that groups the fields of a dialog form. */
.form-section { margin: 4px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-500); }
.form-section:not(:first-child) { margin-top: 16px; }
/* A line of help under a dialog row or tick boxes: set off from what it explains, and from the next group. */
.form-note { display: block; margin: 2px 0 14px; font-size: 12px; color: var(--ink-500); }
.check-row + .form-note { margin-top: 10px; }

/* A slot is as wide as its photograph, so a lone Delete matches the image rather than stretching across the card. */
.photo-slot { width: max-content; max-width: 100%; }
.photo-slot input[type=file] { max-width: 180px; }
.btn-upload-dry { background: #3a8f3a; color: #fff; }
.btn-upload-wet { background: #2f6db5; color: #fff; }

/* Update List: the category heading in a light band, the note shown on hover over the date or ref. */
table.updates-table th.icon-col, table.updates-table td.icon-col { width: 48px; text-align: center; }
table.updates-table tbody tr.group-head td { background: var(--surface-2); padding-top: 7px; padding-bottom: 7px; }
table.updates-table tbody tr.group-head:hover td { background: var(--surface-2); }
.notfound { margin: 0; padding: 14px 16px; }
.popuptext { position: relative; }
.popuptext span { display: none; position: absolute; left: 0; top: 1.4em; z-index: 20; min-width: 18rem; padding: .5rem .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink-900, inherit); font-weight: 400; }
.popuptext:hover span, .popuptext:focus span { display: block; }
.popuptext span:empty { display: none !important; }

/* Help and Student Training: the document lists, thumbnail rows and the video list. */
.training-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.training-menu { border-collapse: collapse; width: 100%; }
.training-menu td { padding: 8px 16px 8px 0; vertical-align: middle; border-bottom: 1px solid var(--line); }
.training-menu tr:last-child td { border-bottom: 0; }
.training-menu td.thumb { width: 96px; }
/* The legacy thumbnails come in many sizes; a fixed box keeps every row the same height and the links in line. */
.training-menu td.thumb img { display: block; width: 80px; height: 56px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.training-videos-menu { display: flex; gap: 48px; flex-wrap: wrap; }
.training-videos-menu .item { display: flex; flex-direction: column; align-items: center; gap: 6px; }
h3.training-group { margin: 18px 0 6px; }
.training-row { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.training-row:first-of-type { border-top: 1px solid var(--line); }
.training-main { display: flex; gap: 16px; align-items: flex-end; flex: 1 1 22rem; }
.training-main .training-thumb { flex: 0 0 auto; min-width: 140px; }
.training-extras { display: flex; flex-direction: column; gap: 8px; flex: 1 1 12rem; }
.training-extra { display: flex; gap: 6px; align-items: flex-end; }
.training-thumb img { max-width: 100%; height: auto; }
.training-video { display: flex; gap: 16px; align-items: flex-start; padding: 8px 0; }
.training-video img { flex: 0 0 auto; }
.training-video h3 { margin: 0 0 6px; }
.textitalic { font-style: italic; }
.faq-heading { margin: 0 0 8px; }
.faq-answer { margin: 0 0 10px; }

/* ----------------------------------------------------------- student area --- */
.student-header-block { margin: 0 0 14px; border-collapse: collapse; }
.student-header-block .label { color: var(--ink-500); padding: 2px 10px 2px 0; white-space: nowrap; }
.student-header-block .value { font-weight: 600; padding: 2px 24px 2px 0; }
.student-header-block .photo { vertical-align: top; width: 140px; }
.student-frame-page { max-width: 1000px; margin: 0 auto; padding: 0 16px 24px; }
.student-cards { border-collapse: separate; border-spacing: 8px; width: 100%; max-width: 760px; }
.student-cards td { vertical-align: top; }
.student-video { width: 100%; max-width: 960px; }
.student-cards-done { background: var(--amber-bg); border-radius: 8px; margin-top: 12px; }
.player-frame { overflow: auto; max-width: 100%; }
/* The iSpring packages are built for 720x540 (the legacy iframe size). MudBlazor's stylesheet, loaded for the
   feedback widget, sets every iframe to 100% x 100%, which stretched them full width and 150px tall. */
.player-frame iframe { width: 720px; height: 540px; max-width: none; }
.text-red { color: var(--red-ink); }
.text-green { color: var(--green-ink); }
.text-bold { font-weight: 700; }
.centred { text-align: center; }
.loc-status-1 { color: var(--amber-ink); }
.loc-status-2 { color: var(--green-ink); }
.loc-review { margin-left: 24px; }
.loc-rank { display: inline-block; min-width: 2.5em; }
.text-right { text-align: right; }
.loc-sheet input[type=text] { width: 100%; }
.loc-sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 16px; align-items: end; }  /* inputs line up when a label wraps */
.loc-sheet label { display: block; font-size: 13px; }
.loc-sheet textarea { width: 100%; }
.loc-pass-table input[type=text] { min-width: 4em; }
.loc7-minimum { columns: 2; max-width: 640px; }
.loc7-prefix { font-weight: 600; margin-right: 4px; }
.loc7-sketches { display: flex; gap: 24px; flex-wrap: wrap; }
.loc7-sketches img { display: block; margin-top: 6px; max-width: 100%; }
.loc-photo { display: flex; gap: 12px; align-items: flex-end; margin: 12px 0; flex-wrap: wrap; }
.loc9-exercise { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0 16px; }
.loc9-exercise > p { flex-basis: 100%; margin: 0; }
.loc9-finish { margin-top: 16px; }
.loc-grid td { vertical-align: top; height: 30px; }              /* studentLOC-v2.asp:278 */
.loc-grid td.loc-rule { border-bottom: 1px solid var(--line-strong); }   /* BorderBottom under LOC 8 and LOC 9 Dry */
.lightbox-thumb { border: 0; padding: 0; background: none; cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; background: rgb(0 0 0 / 80%); display: flex; align-items: center; justify-content: center; z-index: 1000; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; }
@media (max-width: 640px) { .student-header-block .photo { display: none; } }
.upload-list { display: flex; flex-direction: column; gap: 6px; }
.upload-item { display: grid; grid-template-columns: 110px 1fr 90px 90px; align-items: center; gap: 8px; }
@media (max-width: 640px) { .upload-item { grid-template-columns: 110px 1fr; } }

/* ---- CMS editor (Shared/HtmlEditor.razor) and article thumbnails ---- */
.html-editor { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.html-editor-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.html-editor-bar select { width: auto; }
.html-editor-surface, .html-editor-source { display: block; width: 100%; padding: 10px 12px; overflow: auto; resize: vertical; color: var(--ink-900); background: var(--surface); }
.html-editor-surface:focus, .html-editor-source:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.html-editor-source { font-family: var(--mono); font-size: 12.5px; border: 0; }
.html-editor-surface img { max-width: 100%; height: auto; }
.html-editor [hidden] { display: none !important; }
.cms-thumb { width: 80px; height: auto; border-radius: 4px; }

/* Office part 4: audits and the office LOC grid */
.text-strike { text-decoration: line-through; }
.text-grey { color: var(--ink-500); }
.office-form textarea { width: 100%; }
.office-form .input-short { width: 3.5em; text-align: center; }
.office-form select { width: auto; }
.office-form .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.office-form .form-grid > label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-700); }
.office-form .form-grid > label > input[type="text"] { flex: 1 1 12em; min-width: 0; }
.office-form .form-grid > label > span { font-weight: 400; color: var(--ink-900); }
.office-form .form-grid > label > span.text-bold { font-weight: 700; }
@media (max-width: 720px) { .office-form .form-grid { grid-template-columns: minmax(0, 1fr); } }
.loc-small-icon { vertical-align: middle; margin-right: 4px; }
/* The line without a tick keeps the tick's width, so the comment lines stay aligned. */
.loc-small-blank { display: inline-block; width: 14px; margin-right: 4px; }

/* ---------------------------------------------------------------------------------------------------------------
   Public site polish. One layer over the public pages (PublicChrome): readable 16px text with a sensible line length,
   stronger headings, framed pictures, cards that lift, bigger buttons and menu, a friendlier FAQ. Scoped to .pub-shell
   so the portals are untouched; colours come from the tokens so dark mode follows. */
.pub-shell { font-size: 16px; line-height: 1.65; }
.pub-shell .pub-header { padding-block: 14px; box-shadow: 0 2px 12px rgba(18, 37, 58, .08); }
.pub-shell .pub-nav, .pub-shell .pub-mnav { font-size: 15px; gap: 4px 22px; }
.pub-shell .pub-nav a:not(.btn), .pub-shell .pub-mnav a:not(.btn), .pub-shell .pub-group > summary { font-weight: 500; }
.pub-shell .pub-main { padding-top: 32px; padding-bottom: 56px; }

/* Headings */
.pub-main h1 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); font-weight: 800; line-height: 1.15; letter-spacing: -.015em; color: var(--ink-900); margin: 0 0 22px; }
.pub-main h1::after { content: ""; display: block; width: 64px; height: 5px; margin-top: 14px; border-radius: 3px; background: var(--brand); }
.pub-hero h1::after, .pub-quiz-head h1::after { display: none; }
.pub-main h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.25; color: var(--brand-ink); margin: 1.6em 0 .5em; }
.pub-main h3 { font-size: 1.15rem; font-weight: 700; line-height: 1.3; color: var(--ink-900); margin: 1.4em 0 .4em; }
.pub-main :is(.pub-prose, .pub-article, .pub-faq) > h1 + h2 { margin-top: 0; }
.pub-card :is(h2, h3), .pub-cta h2, .pub-side-stack :is(h2, h3) { margin-top: 0; }

/* Text: a comfortable line length on the wide page, and room between paragraphs */
.pub-main p, .pub-main li { overflow-wrap: break-word; }
.pub-main :is(.pub-prose, .pub-article) > :is(p, ul, ol, blockquote) { max-width: 86ch; }
.pub-main :is(.pub-prose, .pub-article, .pub-flow) :is(ul, ol) { padding-left: 1.4em; }
.pub-main :is(.pub-prose, .pub-article, .pub-flow) li { margin: .3em 0; }
.pub-main :is(.pub-prose, .pub-article, .pub-flow) p { margin: 0 0 1em; }
.pub-main a:not(.btn, .pub-tile, .pub-logos a) { color: var(--accent-dark); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.pub-main a:not(.btn, .pub-tile):hover { text-decoration-thickness: 2px; }
.pub-main blockquote { margin: 1.2em 0; padding: 4px 0 4px 18px; border-left: 4px solid var(--brand); color: var(--ink-700); }
.pub-main hr { margin: 28px 0; }

/* Pictures: framed, with a soft shadow */
.pub-main :is(.pub-prose, .pub-article, .pub-flow) img { border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.pub-main :is(.pub-logos, .pub-tile, .pub-card-media, .pub-docs) img { box-shadow: none; }
.pub-strip img { box-shadow: var(--shadow); }

/* Cards */
.pub-shell .pub-card { padding: 24px 26px; border-radius: 14px; box-shadow: var(--shadow-sm); transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease; }
.pub-shell .pub-list .pub-card:hover, .pub-shell .pub-articles .pub-card:hover, .pub-shell .pub-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--line-strong); }
.pub-shell .pub-cards { gap: 24px; }
.pub-shell .pub-card h2 { font-size: 1.3rem; color: var(--brand-ink); }
.pub-shell .pub-card p { margin: 0 0 .8em; }
.pub-shell .pub-tile { border-radius: 12px; transition: box-shadow .15s ease, transform .15s ease; }
.pub-shell .pub-cta { padding: 36px 24px; border-radius: 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 22%, var(--surface)), var(--surface-2)); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.pub-shell .pub-cta h2 { font-size: 1.6rem; margin-bottom: 10px; }
.pub-shell .pub-logos { padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; gap: 22px 28px; }
.pub-shell .pub-logos img { filter: none; max-height: 52px; }

/* Buttons */
.pub-shell .btn { min-height: 42px; padding: 0 20px; font-size: .95rem; font-weight: 600; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; transition: background .12s, box-shadow .12s, transform .12s; }
.pub-shell .btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }
.pub-shell .btn-primary { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.pub-shell .btn-primary:hover { background: color-mix(in srgb, var(--brand-ink) 85%, #000); border-color: transparent; color: #fff; }

/* FAQ */
.pub-shell .pub-faq details { border-radius: 12px; margin-bottom: 10px; transition: box-shadow .15s ease; }
.pub-shell .pub-faq details:hover { box-shadow: var(--shadow); }
.pub-shell .pub-faq summary { padding: 16px 52px 16px 20px; font-size: 1.02rem; list-style: none; position: relative; }
.pub-shell .pub-faq summary::-webkit-details-marker { display: none; }
.pub-shell .pub-faq summary::after { content: "+"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; font-weight: 400; line-height: 1; color: var(--ink-500); }
.pub-shell .pub-faq details[open] summary { background: var(--surface-2); border-radius: 12px 12px 0 0; }
.pub-shell .pub-faq details[open] summary::after { content: "\2212"; }
.pub-shell .pub-faq details p { padding: 14px 20px; }

/* Lists of documents, pagers, footer links */
.pub-shell .pub-info .pub-docs li { border-radius: 12px; padding: 12px 16px; }
.pub-shell .pub-pager { margin: 20px 0; }
.pub-shell .pub-footer { font-size: 14px; }

/* The menu marks where you are: the current page's link (aria-current) and the group it sits in (.is-active). In the
   top bar an underline; in a dropdown panel a tinted row with a bar down its left edge. */
.pub-shell :is(.pub-nav, .pub-mnav) > a[aria-current=page],
.pub-shell :is(.pub-nav, .pub-mnav) > .pub-group.is-active > summary { color: var(--brand-ink); font-weight: 700; text-decoration: underline; text-decoration-color: var(--brand); text-decoration-thickness: 3px; text-underline-offset: 9px; }
.pub-shell :is(.pub-nav, .pub-mnav) > :is(a[aria-current=page], .pub-group.is-active > summary) { padding-block: 6px; }
.pub-shell .pub-group.is-active > summary::after { border-color: var(--brand-ink); }
.pub-shell .pub-panel a[aria-current=page] { margin-inline: -8px; padding: 6px 8px 6px 6px; border-left: 3px solid var(--brand); border-radius: 0 var(--radius) var(--radius) 0; background: color-mix(in srgb, var(--brand) 16%, var(--surface)); color: var(--brand-ink); font-weight: 700; }
.pub-shell .pub-panel a:not([aria-current=page]) { padding-left: 9px; }

/* ---------------------------------------------------------------------------------------------------------------
   Sign-in page polish: a photo behind the welcome side, a centred card for the form, larger inputs and button.
   Scoped to what Login.razor adds, so the other pages that share .login-page (forgot / reset / two-factor) only pick up
   the shared panel and input sizing. */
.login-page { grid-template-columns: minmax(0, 1fr) minmax(420px, 520px); }
.login-hero {
    position: relative; padding: 64px;
    background:
        linear-gradient(115deg, rgba(10, 28, 48, .92) 0%, rgba(10, 28, 48, .72) 55%, rgba(10, 28, 48, .45) 100%),
        url(/Images/Slider/Diver-Welding-Underwater.jpg) center / cover no-repeat,
        var(--navy-900);
}
.login-hero-inner { max-width: 520px; }
.login-hero .hero-logo-large { display: block; width: min(300px, 80%); height: auto; margin-bottom: 36px; border-radius: 0; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .45)); }
.login-hero h1 { font-size: clamp(2rem, 3.2vw, 2.8rem); font-weight: 800; line-height: 1.12; letter-spacing: -.02em; margin: 0 0 14px; }
.login-hero p { max-width: 460px; margin: 0 0 26px; font-size: 1.05rem; line-height: 1.6; color: #e1e9f2; }
.login-hero ul { margin: 0; gap: 12px; }
.login-hero li { align-items: center; font-size: 1rem; color: #e1e9f2; }
.login-hero li .tick { display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #12253a; font-size: 13px; font-weight: 800; }

.login-panel { padding: 32px; align-items: center; background: var(--surface-2); }
.login-card { width: 100%; max-width: 400px; padding: 36px 36px 30px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); }
.login-card .login-home { margin-bottom: 22px; }
.login-card .brand-mobile { display: none; margin-bottom: 22px; }
.login-card .brand-mobile img { display: block; width: 200px; height: auto; }
.login-card h2 { margin: 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -.01em; }
.login-card .sub { margin: 6px 0 24px; font-size: .95rem; }
.login-card .field { margin-bottom: 18px; }
.login-card .field > label { font-size: 13px; font-weight: 600; color: var(--ink-900); }
.login-card input[type=text], .login-card input[type=password] { min-height: 46px; padding: 10px 14px; border-radius: 10px; font-size: 15px; background: var(--surface); transition: border-color .12s, box-shadow .12s; }
.login-card input:focus { outline: none; border-color: var(--brand-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 40%, transparent); }
.login-card .login-forgot { justify-self: end; font-size: 13px; color: var(--accent-dark); }
.login-card .btn-primary { height: 48px; margin-top: 6px; border-radius: 10px; background: var(--brand-ink); border-color: var(--brand-ink); font-size: 1rem; font-weight: 700; }
.login-card .btn-primary:hover { background: color-mix(in srgb, var(--brand-ink) 85%, #000); }
.login-more { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-500); }
.login-more img { display: block; }
.login-help { margin: 18px 0 0; font-size: 12px; line-height: 1.5; color: var(--ink-500); }
@media (max-width: 900px) {
    .login-page { grid-template-columns: 1fr; background: var(--surface-2); }
    .login-panel { padding: 20px 16px; align-items: flex-start; }
    .login-card { padding: 28px 22px 24px; margin-top: 8px; }
    .login-card .brand-mobile { display: block; }
}

/* The sign-in card's two links, Home on the left and More info on the right: equal outline buttons side by side. */
.login-links { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.login-link { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 14px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink-900); font-size: 14px; font-weight: 600; text-decoration: none; transition: background .12s, border-color .12s, color .12s, box-shadow .12s; }
.login-link:hover, .login-link:focus-visible { border-color: var(--brand-ink); background: color-mix(in srgb, var(--brand) 16%, var(--surface)); color: var(--brand-ink); text-decoration: none; box-shadow: var(--shadow-sm); }
.login-link:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }
.login-link.login-more-info { border-color: var(--brand-ink); color: var(--brand-ink); }
.login-link.login-more-info:hover, .login-link.login-more-info:focus-visible { background: var(--brand-ink); color: #fff; }

/* The Summary tables nest three levels: school (office only), class, student. Each reads differently: the school is a
   dark band, a class a bold green-tinted row with a bar down its left edge, and the students under it are plain rows,
   indented. */
table.summary-table tbody tr.school-head td { background: var(--navy-700); color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 14px; letter-spacing: .01em; }
table.summary-table tbody tr.school-head:hover td { background: var(--navy-700); }
table.summary-table tbody tr.class-head td { background: color-mix(in srgb, var(--brand) 20%, var(--surface)); border-top: 1px solid color-mix(in srgb, var(--brand) 55%, var(--line)); font-weight: 700; color: var(--brand-ink); padding-top: 9px; padding-bottom: 9px; }
table.summary-table tbody tr.class-head:hover td { background: color-mix(in srgb, var(--brand) 20%, var(--surface)); }
table.summary-table tbody tr.class-head td:first-child { box-shadow: inset 5px 0 0 var(--brand); padding-left: 16px; }
table.summary-table tbody tr.class-head a { color: var(--brand-ink); font-weight: 700; }
table.summary-table tbody tr.class-head a:hover { text-decoration: underline; }
table.summary-table tbody tr.class-head .muted { font-weight: 500; }
table.summary-table tbody tr:not(.group-head) td:first-child { padding-left: 34px; }

/* ---------------------------------------------------------------------------------------------------------------
   Portal polish (office, school and student pages: everything in .content). One layer over the house design system:
   slightly larger text, a page header with a rule under it, rounder cards, roomier lists with clearer headings and
   quiet striping, larger form controls with a focus ring. Controls inside table cells (the registration and test
   sheets) and .compact tables keep their dense sizes. */
.content { font-size: 14px; padding-top: 24px; }

/* Page header */
.content .page-head { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.content .page-head h1 { font-size: 25px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.content .page-head .eyebrow { font-size: 11.5px; letter-spacing: .1em; color: var(--accent-dark); }
.content .page-head .sub { font-size: 13.5px; }

/* Cards */
.content .card { border-radius: 12px; box-shadow: 0 1px 3px rgba(18, 37, 58, .07); }
.content .card-head { padding: 13px 20px; }
.content .card-head :is(h2, h3) { font-size: 15px; font-weight: 700; letter-spacing: -.005em; }
.content .card-body { padding: 20px; }
.content .stat { border-radius: 10px; padding: 12px 16px; }
.content .stat .value { font-size: 26px; font-weight: 700; }

/* Lists */
.content table.data:not(.compact) { font-size: 13.5px; }
.content table.data:not(.compact) thead th { padding: 11px 14px; background: var(--surface-2); border-bottom: 2px solid var(--line-strong); font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-700); }
.content table.data:not(.compact) tbody td { padding: 9px 14px; }
.content table.data:not(.compact) tbody tr:nth-child(even):not(.group-head, .selected, .dragging, :hover) td { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.content table.data:not(.compact) tbody tr:hover td { background: var(--blue-bg); }
.content table.data tbody tr.clickable:hover td { background: var(--accent-soft); }
.content table.data:not(.compact) tfoot td { padding: 10px 14px; }

/* Form controls: bigger, rounder, a clear focus ring. Controls inside table cells stay compact. */
.content .field { gap: 6px; margin-bottom: 18px; }
.content .field > label, .content .office-form .form-grid > label { font-size: 13px; font-weight: 600; color: var(--ink-900); }
.content .field .hint, .content .field .muted.small { font-size: 12px; }
.content :is(input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], input[type=tel], input[type=url], select, textarea) {
    min-height: 38px; padding: 8px 12px; border-radius: 8px; font-size: 14px; border-color: var(--line-strong);
    transition: border-color .12s, box-shadow .12s;
}
.content textarea { min-height: 84px; }
.content :is(input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], input[type=tel], input[type=url], select, textarea):hover:not(:disabled) { border-color: var(--ink-300); }
.content :is(input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], input[type=tel], input[type=url], select, textarea):focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.content :is(input, select, textarea):disabled { background: var(--surface-2); color: var(--ink-500); }
.content :is(td, th) :is(input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], input[type=tel], input[type=url], select, textarea) { min-height: 30px; padding: 4px 8px; border-radius: var(--radius); font-size: 13px; }
.content .date-parts :is(input, select) { min-height: 38px; }
.content :is(td, th) .date-parts :is(input, select) { min-height: 30px; }
.content .office-form .form-grid { gap: 16px 28px; }
.content input[type=checkbox], .content input[type=radio] { accent-color: var(--accent); }
/* The list search boxes (HouseTable) sit in .content too, so the form-control padding above would put the magnifier on top of the
   placeholder text. Keep the room the icon needs on the left, in every list across the app. */
.content .global-search :is(input[type=search], input[type=text]) { padding: 8px 32px 8px 34px; }
/* Controls placed in a list toolbar (the From/To range on test numbers, date pickers, selects) sit inline at their own size, beside
   their label and buttons, instead of taking the full width the general form-control rule gives them. */
.toolbar > :is(input[type=text], input[type=number], input[type=date], select),
.toolbar > .field :is(input[type=text], input[type=number], input[type=date], select) { width: auto; }
.content .toolbar > :is(input[type=text], input[type=number], input[type=date], select) { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.toolbar > label { font-size: 12px; font-weight: 600; color: var(--ink-700); }

/* Buttons */
.content .btn { height: 34px; padding: 0 14px; font-size: 13.5px; font-weight: 600; border-radius: 8px; }
.content .btn-sm, .content :is(td, th) .btn, .content .card-head .btn { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.content .btn-icon { width: 34px; padding: 0; }
.content .btn-icon.btn-sm { width: 28px; }
.content .btn-primary { box-shadow: 0 1px 2px rgba(18, 37, 58, .18); }

/* Messages sit a little more comfortably */
.content .alert { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; }

/* Two-factor, recovery-code and error pages inside the sign-in card (AuthShell). */
.login-account { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 18px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--ink-700); }
.login-card .totp-cancel { margin-top: 10px; }
.login-card .totp-cancel .btn { height: 40px; font-weight: 600; color: var(--ink-700); }
.login-card .totp-qr { display: grid; place-items: center; margin: 0 0 14px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.login-card .totp-qr img { display: block; width: 200px; height: 200px; }
.login-card .totp-manual { margin: 0 0 18px; font-size: 13px; }
.login-card .totp-secret { display: block; margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); word-break: break-all; font-size: 13px; }
.login-card .recovery-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.login-card .recovery-codes li { margin: 0; }
.login-card .recovery-codes code { display: block; padding: 9px 10px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--surface-2); text-align: center; font-size: 14px; letter-spacing: .04em; }
.login-card .row-actions { display: grid; gap: 10px; }
.login-card .remember-device { margin-top: 4px; }

/* Authenticator pages: numbered steps, a framed QR code, a large centred code box. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.login-step { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 12px; }
.login-step .step-num { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-ink); color: #fff; font-size: 14px; font-weight: 700; }
.login-step strong { display: block; font-size: 15px; line-height: 1.3; color: var(--ink-900); }
.login-step span:not(.step-num) { display: block; font-size: 12.5px; line-height: 1.4; color: var(--ink-500); }
.login-card .totp-qr { margin: 0 0 12px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); }
.login-card .totp-qr img { width: 100%; max-width: 210px; height: auto; aspect-ratio: 1; }
.login-card .totp-manual { margin: 0 0 24px; text-align: center; }
.login-card .totp-manual summary { display: inline-block; padding: 4px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-dark); list-style: none; }
.login-card .totp-manual summary::-webkit-details-marker { display: none; }
.login-card .totp-manual summary:hover { background: var(--surface-2); }
.login-card .totp-manual[open] { text-align: left; }
.login-card form + .login-step, .login-card form .login-step { margin-top: 4px; }
.login-card .code-input { min-height: 56px; padding: 8px 14px; text-align: center; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 26px; font-weight: 600; letter-spacing: .3em; text-indent: .3em; }
.login-card .code-input::placeholder { color: var(--ink-300); font-weight: 400; }
.login-card .totp-cancel { text-align: center; }
.login-card .totp-cancel .btn { width: auto; padding: 0 18px; }

/* Drop-downs: keep the right-hand room the chevron needs, in every place a select is used.
   The form-control rules for .content, table cells and list toolbars each set a shorter padding on all four sides, which
   is how the arrow ended up drawn over the last character of narrow selects ("21", "No comment"). This comes last and is as
   specific as any of them, so the chevron (14px, 8px in from the edge) always has its own space and never sits on the data. */
select:not([multiple]):not([size]),
.content select:not([multiple]):not([size]),
.content :is(td, th) select:not([multiple]):not([size]),
.content .toolbar > select:not([multiple]):not([size]),
.pager select:not([multiple]):not([size]) { padding-right: 30px; }
