/* ============================================================================
   MIRACLE DESIGN SYSTEM  ·  prefix: mds-  ·  CORE
   ----------------------------------------------------------------------------
   Token-driven, mobile-first, BEM-named, low-specificity CSS kit. Modules
   restyle by COMPOSING these classes (write no new CSS). Namespaced 'mds-' so
   it coexists with Bootstrap / Kendo and depends on neither.

   This file is the CORE only: tokens + reusable CONTENT primitives + the
   loading/empty states. The app chrome lives in shell.css, the Knowledgebase
   reading shell in kb.css, and per-feature tweaks in <feature>.css — all
   linked in index.html after this file. See docs/DESIGN-SYSTEM.md.

   Breakpoint contract (Tailwind defaults): sm 640 · md 768 · lg 1024.
   Tokens mirror a Tailwind theme so a later ASP.NET-Core + Tailwind move is a
   config copy.
   ============================================================================ */

/* ---- 1. TOKENS ---------------------------------------------------------- */
/* Quiet (redesign #100, round 28; rolled out app-wide in #114). A white sheet, graphite ink,
   warm-grey structure, and ChemServe teal for exactly one meaning: "act on" (and the one
   primary action). Structure comes from space and faint rules, not from grey tiles (those are
   Milbros' signature). The night palette is the same system with inverted lightness: dark,
   dimmed, safety colours still distinguishable (redesign-intent.md, Feel). Primitive names are
   kept so every existing component follows; their VALUES are the Quiet palette. */
:root {
    color-scheme: light;

    /* primitive palette */
    --mds-teal-50:    #EEF6F7;
    --mds-teal-500:   #127A86;   /* ChemServe teal: 5.1:1 on white */
    --mds-teal-600:   #0F6872;
    --mds-teal-700:   #127A86;   /* ink on white and on the raised grey (4.6:1) */
    --mds-navy-700:   #1D425D;   /* the "check" mark */
    --mds-gray-100:   #F5F4F1;   /* raised: inputs, hover, the selected row */
    --mds-gray-200:   #E3E1DC;   /* border */
    --mds-gray-500:   #585C64;   /* muted text: 6.6:1 on white */
    --mds-gray-900:   #22252A;   /* graphite ink */
    --mds-green-700:  #1E7B4F;
    --mds-amber-700:  #B45309;
    --mds-amber-800:  #92400E;
    --mds-red-600:    #C4242A;
    --mds-orange-500: #E87722;
    --mds-gold-300:   #FFD700;
    --mds-gold-400:   #FFB347;

    /* semantic aliases (components reference ONLY these) */
    --mds-accent:      var(--mds-teal-500);
    --mds-accent-ink:  var(--mds-teal-700);
    --mds-title:       var(--mds-gray-900);
    --mds-on-accent:   #FFFFFF;
    --mds-text:        var(--mds-gray-900);
    --mds-muted:       var(--mds-gray-500);
    --mds-line:        var(--mds-gray-200);
    --mds-surface:     #FFFFFF;
    --mds-canvas:      #FAF9F7;
    --mds-tint:        var(--mds-gray-100);
    --mds-raised:      var(--mds-gray-100);
    --mds-active:      #E4E2DD;
    --mds-control:     #CAC7C0;   /* input outlines, checkbox frames */
    --mds-rule:        #EFEEEA;   /* hairline inside a group */
    --mds-rule-strong: #D3D0C9;   /* the topic rule (Quiet) */
    --mds-check:       var(--mds-navy-700);
    --mds-chrome:      #1D425D;   /* the rail and the footer: a surface, never text */
    --mds-success:     var(--mds-green-700);
    --mds-warning:     var(--mds-amber-800);
    --mds-danger:      var(--mds-red-600);
    --mds-danger-bg:   #FFEDEA;
    --mds-success-bg:  #E3F5EA;
    --mds-warning-bg:  #FFF7E6;

    /* spacing (Tailwind scale: 1=4px … 8=32px, 11=44px) */
    --mds-space-0-5: 2px;  --mds-space-1: 4px;   --mds-space-1-5: 6px;
    --mds-space-2: 8px;    --mds-space-2-5: 10px; --mds-space-3: 12px;
    --mds-space-4: 16px;   --mds-space-5: 20px;  --mds-space-6: 24px;
    --mds-space-7: 28px;   --mds-space-8: 32px;  --mds-space-11: 44px;

    /* radii: marks 2 · frames 4 · tiles and controls 8 (round 24 "finish") */
    --mds-radius-sm: 2px; --mds-radius: 4px; --mds-radius-lg: 8px;

    /* z-index layers (low → high). One source of truth for the stacking order:
       combo < pane < topbar < menu < scrim < overlay < rail */
    --mds-z-combo: 10; --mds-z-pane: 40; --mds-z-topbar: 45; --mds-z-menu: 50;
    --mds-z-scrim: 55; --mds-z-overlay: 60; --mds-z-rail: 70;

    /* type: Manrope (self-hosted, lib/manrope/manrope.css). Small on purpose: legacy MIRACLE
       and Milbros both set data at 12 px; values carry weight, labels carry colour. */
    --mds-font:     'Manrope', 'Segoe UI', Arial, sans-serif;
    --mds-text-xs:  12px;
    --mds-text-sm:  14px;
    --mds-text-lg:  16px;
    --mds-text-2xl: 22px;

    /* the measure a paragraph inside a card keeps, however wide the card gets — a line longer
       than this loses the reader on the way back to the left edge. (.mds-prose, the long-form
       READING mode at 16px, sets its own 68ch: same 65–75 character band, other type size.) */
    --mds-measure:  70ch;
}

/* Night (ECDIS night table): user choice wins (data-theme on <html>, set by index.html before
   first paint); without a choice the system preference decides. Both selectors carry the same
   values; the two blocks must stay identical (a test checks it). */
:root[data-theme="dark"] {
    color-scheme: dark;
    --mds-teal-50:    #1C2A2C;
    --mds-teal-500:   #4FB6C1;
    --mds-teal-600:   #6CC4CE;
    --mds-teal-700:   #4FB6C1;
    --mds-navy-700:   #8FB3D1;
    --mds-gray-100:   #26282C;
    --mds-gray-200:   #34363A;
    --mds-gray-500:   #AAA9A5;
    --mds-gray-900:   #ECEBE8;
    --mds-green-700:  #3FC07A;
    --mds-amber-700:  #E5A93B;
    --mds-amber-800:  #E5A93B;
    --mds-red-600:    #FF7A70;
    --mds-on-accent:  #18191C;
    --mds-surface:    #1F2124;
    --mds-canvas:     #1A1C1F;
    --mds-active:     #2E3034;
    --mds-control:    #45474C;
    --mds-rule:       #2A2C30;
    --mds-rule-strong:#45474C;
    --mds-danger-bg:  #2C1A1A;
    --mds-success-bg: #172A1D;
    --mds-warning-bg: #2B2414;
    --mds-chrome:     #182430;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --mds-teal-50:    #1C2A2C;
        --mds-teal-500:   #4FB6C1;
        --mds-teal-600:   #6CC4CE;
        --mds-teal-700:   #4FB6C1;
        --mds-navy-700:   #8FB3D1;
        --mds-gray-100:   #26282C;
        --mds-gray-200:   #34363A;
        --mds-gray-500:   #AAA9A5;
        --mds-gray-900:   #ECEBE8;
        --mds-green-700:  #3FC07A;
        --mds-amber-700:  #E5A93B;
        --mds-amber-800:  #E5A93B;
        --mds-red-600:    #FF7A70;
        --mds-on-accent:  #18191C;
        --mds-surface:    #1F2124;
        --mds-canvas:     #1A1C1F;
        --mds-active:     #2E3034;
        --mds-control:    #45474C;
        --mds-rule:       #2A2C30;
        --mds-rule-strong:#45474C;
        --mds-danger-bg:  #2C1A1A;
        --mds-success-bg: #172A1D;
        --mds-warning-bg: #2B2414;
        --mds-chrome:     #182430;
    }
}
html { background: var(--mds-canvas); color: var(--mds-text); -webkit-font-smoothing: antialiased;
    /* Manrope's standard ligatures turn "(c)" into a copyright sign, and the IBC column letters
       are printed exactly like that: "Pollution category (c)". Ligatures and contextual
       alternates off everywhere (checked in the browser: "calt" alone does not stop it). */
    font-feature-settings: "liga" 0, "calt" 0; }

/* ---- 2. SCAFFOLD: panel + title ---------------------------------------- */
.mds-panel {
    background: var(--mds-surface);
    padding: var(--mds-space-4);
    font-family: var(--mds-font);
    font-size: var(--mds-text-sm);
    line-height: 1.5;
    letter-spacing: -0.005em;
    color: var(--mds-text);
    max-width: var(--mds-content-max, 1200px);   /* content stays readable; no infinite spread */
}
@media (min-width: 768px) { .mds-panel { padding: var(--mds-space-11); } }
/* On viewports wider than the capped panel, a hairline marks the content edge —
   the shell beyond it stays white (whitespace, not a gray void). */
@media (min-width: 1300px) { .mds-panel { border-right: 1px solid var(--mds-line); } }

.mds-title {
    display: flex; align-items: baseline; justify-content: space-between;
    flex-wrap: wrap; gap: var(--mds-space-1) var(--mds-space-3);
    margin: 0 0 var(--mds-space-3); padding-bottom: var(--mds-space-1-5);
    border-bottom: 1px solid var(--mds-rule-strong);   /* Quiet: a faint topic rule, not a teal bar */
}
.mds-title__name { margin: 0; font-size: var(--mds-text-lg); font-weight: 650; letter-spacing: -0.02em; color: var(--mds-title); }
.mds-title__meta { font-size: var(--mds-text-sm); color: var(--mds-muted); }
@media (min-width: 768px) { .mds-title__name { font-size: var(--mds-text-2xl); } }

/* ---- 3. CARD LAYOUT: responsive grid (1 → 2 → 3 columns) --------------- */
/* A grid, not a column-count masonry: cards keep source order left-to-right and
   top-aligned, so a short card never strands a tall column with whitespace beside it.
   A card may span the full row with grid-column: 1 / -1. */
.mds-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--mds-space-4) var(--mds-space-7);
    align-items: start;
}
@media (min-width: 768px)  { .mds-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .mds-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mds-card { min-width: 0; }   /* let cards shrink inside grid tracks */

/* ---- 3b. GROUP GRID: a set of titled groups that flow into responsive columns
   (a manufacturer's accordion list, a section of cards) — fills wide screens,
   collapses to one column on mobile, each group kept intact. The group heading
   is the uppercase-muted label above the group. ------------------------------ */
.mds-groups { display: grid; align-items: start;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: var(--mds-space-5) var(--mds-space-6); }
.mds-group { min-width: 0; }
.mds-group__name { margin: 0 0 var(--mds-space-1); color: var(--mds-muted);
    font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; }

/* ---- 3c. GROUPS AS PAGE SECTIONS (MdsGroup): the modifier for a view whose groups ARE the
   page structure — Summary (#57/#58), Stowage (#68). Three differences to the plain group grid
   above: the groups STACK (each one holds a full-width body, so flowing them into 340px columns
   would squeeze that body while it still asks for the full width), the head is a page heading
   instead of an uppercase micro-caption, and it carries the accent rule plus one icon badge.

   One icon level and one accent rule per page SECTION, not per card: repeating both on every
   card turns a grouped page into a lightly-labelled card carpet where the group titles are the
   quietest thing on it (the #58 finding). The head is the label of the section, so it gets the
   emphasis; a view quiets its own card heads underneath (see summary.css / stowage.css). */
.mds-groups--sections { grid-template-columns: 1fr; gap: var(--mds-space-6); }
.mds-groups--sections .mds-group__name {
    display: flex;
    align-items: center;
    gap: var(--mds-space-2);
    margin: 0 0 var(--mds-space-3);
    padding-bottom: 7px;
    border-bottom: 1px solid var(--mds-rule-strong);   /* Quiet topic rule (round 28) */
    color: var(--mds-title);
    font-size: var(--mds-text-lg);
    font-weight: 650;
    text-transform: none;               /* the plain group label is an uppercase micro-caption … */
    letter-spacing: -0.01em;            /* … this one is a page heading */
}
/* A single-colour line icon in the ink, no badge: teal means "act on" and nothing else (Quiet). */
.mds-group__icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--mds-muted);
    font-size: 15px;
}
/* A section with nothing to say for THIS cargo keeps its place and says so (issue #58). */
.mds-group__empty { margin: 0; color: var(--mds-muted); font-size: var(--mds-text-sm); }

/* ---- 4. CARD HEADER: icon badge + title + optional info link ----------- */
.mds-card__head {
    display: flex; align-items: center; gap: var(--mds-space-2);
    margin-bottom: var(--mds-space-1); padding-bottom: 0;
    color: var(--mds-muted); font-size: 10.5px; font-weight: 650; line-height: 20px;
    text-transform: uppercase; letter-spacing: .08em;   /* tracked caps: a different letterform from the pairs */
}
/* the subhead runs out into a leader to the column edge (Quiet) */
.mds-card__head::after { content: ""; flex: 1 1 auto; border-top: 1px solid var(--mds-rule); }
.mds-card__info { order: 2; }
.mds-card__icon {
    flex: none; width: 16px; height: 16px;
    display: inline-flex; align-items: center; justify-content: center;
}
.mds-card__icon img { width: 13px; height: 13px; object-fit: contain;
    filter: brightness(0); opacity: .55; }               /* glyph in muted ink, no badge */
:root[data-theme="dark"] .mds-card__icon img { filter: brightness(0) invert(1); opacity: .6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mds-card__icon img { filter: brightness(0) invert(1); opacity: .6; } }
.mds-card__info { margin-left: auto; font-weight: 400; color: var(--mds-muted);
    font-size: var(--mds-text-xs); text-decoration: none; }
.mds-card__info:hover { color: var(--mds-accent-ink); }

/* ---- 5. DATA LIST: label · value · unit  (replaces border-table) -------- */
.mds-data { width: 100%; border-collapse: collapse; }
.mds-data tr { line-height: 19px; }
.mds-data td { padding-top: var(--mds-space-0-5); padding-bottom: var(--mds-space-0-5);
    border-bottom: 1px solid var(--mds-rule); vertical-align: top; }
.mds-data tr:last-child td { border-bottom: none; }
/* These rows are INERT until the seminar articles are ported: no pointer cursor and no
   hover tint (each would promise a click that does nothing — on a safety tool a dead
   control costs trust). The ⓘ still reveals on hover as a quiet teaser; give row--link
   its pointer + tint back when the targets exist. */
.mds-data__row--link .mds-info { visibility: hidden; }
.mds-data__row--link:hover .mds-info { visibility: visible; }
@media (hover: none) { .mds-data__row--link .mds-info { visibility: visible; } }
/* Milbros-style: label column shrinks to the widest label, value sits left
   right after it; unit is an inline muted span inside the value cell. The gap
   lives on the value cell (padding-left) so it shows even for the widest label. */
.mds-data__k { width: 1%; white-space: nowrap; color: var(--mds-muted); }
.mds-data__v { text-align: left; font-weight: 600; padding-left: var(--mds-space-4); }
.mds-data__u { margin-left: var(--mds-space-1); font-weight: 400; color: var(--mds-muted); }
/* Prose variant: the value is a sentence/paragraph, not a short value (step instructions, a long
   remark) — so it reads as regular-weight prose, with the short key as the bold marker. The opposite
   emphasis to the default (light key · bold value), which is right for numbers/values but turns a
   step's instruction text into a wall of bold. */
.mds-data--prose .mds-data__k { font-weight: 700; color: var(--mds-title); }
.mds-data--prose .mds-data__v { font-weight: 400; }

/* ---- 6. DATA TABLE: multi-column with header row ----------------------- */
.mds-table { width: 100%; border-collapse: collapse; }
.mds-table th { text-align: left; padding: var(--mds-space-1) var(--mds-space-2);
    color: var(--mds-muted); font-size: var(--mds-text-xs); font-weight: 700;
    text-transform: uppercase; letter-spacing: .3px; border-bottom: 1px solid var(--mds-line); }
.mds-table td { padding: var(--mds-space-1) var(--mds-space-2); border-bottom: 1px solid var(--mds-line);
    vertical-align: top; }
.mds-table tr.mds-table__row--link { cursor: pointer; }
.mds-table tr.mds-table__row--link:hover td { background: var(--mds-tint); }

/* ---- 6b. DEFINITION LIST: term + body, stack on mobile (notes/glossary) - */
.mds-deflist__row { padding: var(--mds-space-2) var(--mds-space-1); border-bottom: 1px solid var(--mds-line); }
.mds-deflist__term { margin-bottom: var(--mds-space-0-5); font-weight: 700; color: var(--mds-title); }
@media (min-width: 640px) {
    .mds-deflist__row { display: grid; grid-template-columns: 160px 1fr;
        gap: var(--mds-space-3); align-items: start; }
    .mds-deflist__term { margin-bottom: 0; }
}

/* ---- 6c. LIST: a plain bulleted list inside a card/panel (promoted from app.css,
   which restyled it from outside the system) ------------------------------------ */
.mds-list { margin: 0; padding-left: 1.1rem; }
.mds-list li { margin: 0.15rem 0; }

/* ---- 7. STATUS VALUE --------------------------------------------------- */
.mds-status { font-weight: 700; }
.mds-status--ok   { color: var(--mds-success); }
.mds-status--no   { color: var(--mds-danger); }
.mds-status--warn { color: var(--mds-warning); }

/* ---- 8. CHIP ----------------------------------------------------------- */
.mds-chip { display: inline-block; margin: 0 var(--mds-space-1) var(--mds-space-1) 0;
    padding: var(--mds-space-0-5) var(--mds-space-2); border-radius: var(--mds-radius);
    background: var(--mds-tint); color: var(--mds-text); font-size: var(--mds-text-xs); }

/* Interactive FILTER chips (promoted from the Cleaning standard chips, issues #18/#24):
   a horizontal bar of pill buttons, one active — the bar itself is the overview. */
.mds-chipbar { display: flex; gap: var(--mds-space-2); overflow-x: auto;
    -webkit-overflow-scrolling: touch; }
.mds-chipbar::-webkit-scrollbar { height: 0; }
.mds-chipbtn { display: inline-flex; align-items: center; gap: var(--mds-space-1-5);
    flex: none; border: 1px solid var(--mds-line); border-radius: 999px; min-height: 36px;
    padding: var(--mds-space-1-5) var(--mds-space-3); background: var(--mds-surface);
    color: var(--mds-muted); font-family: inherit; font-size: var(--mds-text-sm); cursor: pointer; }
.mds-chipbtn:hover { border-color: var(--mds-accent); }
.mds-chipbtn.is-active { background: var(--mds-tint); border-color: var(--mds-text);
    color: var(--mds-accent-ink); font-weight: 600; }
.mds-chipbtn__count { color: var(--mds-muted); font-size: var(--mds-text-xs); }

/* ---- 9. BADGE ---------------------------------------------------------- */
.mds-badge { display: inline-flex; align-items: center; gap: var(--mds-space-1);
    padding: 5px var(--mds-space-2-5); border-radius: var(--mds-radius);
    background: var(--mds-accent); color: var(--mds-on-accent);
    font-size: var(--mds-text-xs); font-weight: 700; }
.mds-badge--premium { background: linear-gradient(var(--mds-gold-300), var(--mds-gold-400)); color: #5A4500; }

/* ---- 10. BUTTON -------------------------------------------------------- */
.mds-btn { display: inline-flex; align-items: center; gap: var(--mds-space-2);
    padding: var(--mds-space-1-5) var(--mds-space-4); border: 1px solid transparent;
    border-radius: var(--mds-radius); font-size: var(--mds-text-sm); font-family: var(--mds-font);
    cursor: pointer; background: var(--mds-canvas); color: var(--mds-text); text-decoration: none; }
.mds-btn:hover { filter: brightness(.97); }
.mds-btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.mds-btn--primary { background: var(--mds-accent); color: var(--mds-on-accent); }
.mds-btn--outline { background: transparent; border-color: var(--mds-accent); color: var(--mds-accent-ink); }
.mds-btn--ghost   { background: var(--mds-canvas); border-color: var(--mds-line); color: var(--mds-text); }
.mds-btn--sm { padding: var(--mds-space-1) var(--mds-space-2-5); font-size: var(--mds-text-xs); }

/* ---- 10b. ICON BUTTON: a bare, borderless small action glyph (edit/delete/actions ⋯) —
   promoted from the Notes tool buttons once Account and Admin needed the same look. --- */
.mds-icon-btn { border: none; background: none; cursor: pointer; color: var(--mds-muted);
    font-size: var(--mds-text-sm); line-height: 1; padding: 0 var(--mds-space-1); }
.mds-icon-btn:hover { color: var(--mds-accent-ink); }

/* ---- 11. ALERT --------------------------------------------------------- */
.mds-alert { padding: var(--mds-space-2) var(--mds-space-3); border-left: 3px solid var(--mds-accent);
    background: var(--mds-canvas); color: var(--mds-text); }
.mds-alert--success { border-left-color: var(--mds-success); }
.mds-alert--warning { border-left-color: var(--mds-warning); }
.mds-alert--danger  { border-left-color: var(--mds-danger); }

/* ---- 11b. DISCLAIMER: app-wide "please note" / liability notice -------- */
/* One consistent look for every legal/guidance disclaimer (acceptance, adjacent-cargo, …):
   a muted, tinted box with a leading info icon. Use the <MdsDisclaimer> component. */
.mds-disclaimer { display: flex; gap: var(--mds-space-3); align-items: flex-start;
    margin-top: var(--mds-space-5); padding: var(--mds-space-3) var(--mds-space-4);
    background: var(--mds-tint); border: 1px solid var(--mds-line);
    border-radius: var(--mds-radius); color: var(--mds-muted);
    font-size: var(--mds-text-sm); line-height: 1.55; }
.mds-disclaimer__icon { flex: none; margin-top: .15em; color: var(--mds-teal-600); }
.mds-disclaimer__text { margin: 0; }
.mds-disclaimer__text strong { color: var(--mds-title); font-weight: 600; }

/* ---- 12. ICON ROW: pictograms (PPE, GHS) ------------------------------- */
.mds-icons { display: flex; flex-wrap: wrap; gap: var(--mds-space-2); margin: var(--mds-space-2) 0; }
.mds-icons img { width: 38px; height: 38px; object-fit: contain; }

/* ---- 13. FIELD: the reusable search/input chassis ---------------------- */
/* One search/input look, composed by the shell's cargo anchor (.mds-cargobar /
   .mds-cargosel__field) and the KB search fields. Core so both layers share it. */
.mds-field { display: flex; align-items: center; gap: var(--mds-space-2);
    padding: 9px 14px; background: var(--mds-surface);
    border: 1px solid var(--mds-line); border-radius: var(--mds-radius-lg); }
.mds-field i { color: var(--mds-muted); }
.mds-field__input { flex: 1; border: 0; outline: 0; background: none; font-family: inherit;
    font-size: var(--mds-text-sm); color: var(--mds-title); }
/* The input's own outline is off (the chassis IS the field) — so the chassis must show
   keyboard focus itself, or focus on the app's primary control is invisible. */
.mds-field:focus-within { border-color: var(--mds-accent);
    box-shadow: 0 0 0 3px var(--mds-tint); }

/* ---- 13b. TOOLBAR: a view's search/filter strip above a list — a .mds-field
   that grows + inline controls (a "compatible only" toggle, etc.). ---------- */
.mds-toolbar { display: flex; flex-wrap: wrap; gap: var(--mds-space-3);
    align-items: center; margin-bottom: var(--mds-space-4); }
.mds-toolbar .mds-field { flex: 1 1 240px; }

/* ---- 13c. ASKBAR: a view's ad-hoc question strip above its cards — hosts a
   CargoSecondField (next/adjacent cargo) + an optional progress hint.
   Used by Cleaning and AdjacentCargo. ---------------------------------------- */
.mds-askbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--mds-space-3); }
.mds-askbar__hint { font-size: var(--mds-text-sm); color: var(--mds-muted); }

/* ---- 13d. TABS: content tab bar — a row of tabs (link or button) with an accent underline
   on the active one. Promoted out of the chrome group-tab-bar (shell.css's .mds-tabsbar /
   CargoTabs, the original consumer, still supplies its own wrapper + the __short/__full
   responsive-label swap) once Cleaning and Account needed the identical look for a plain
   in-page tab strip. A feature composes it verbatim, or scopes a delta the sanctioned way
   (e.g. `.academy-tabs .mds-tab { … }`, see academy.css). --------------------------------- */
.mds-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--mds-line);
    overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 var(--mds-space-5); }
.mds-tabs::-webkit-scrollbar { height: 0; }
.mds-tab { flex: none; padding: 12px 14px; color: var(--mds-muted); cursor: pointer;
    font-size: var(--mds-text-sm); white-space: nowrap; text-decoration: none;
    border-bottom: 2px solid transparent; }
.mds-tab:hover { color: var(--mds-title); }
.mds-tab.is-active { color: var(--mds-title); font-weight: 700; border-bottom-color: var(--mds-text); }
/* A tab bar built on <button>s (not <a>, like the chrome tab bar) needs its own UA button
   chrome undone — background/border/font are button-only concerns, is-active/:hover above
   already work for either element. */
button.mds-tab { background: none; border-top: 0; border-left: 0; border-right: 0;
    font-family: inherit; }
@media (max-width: 767px) { .mds-tabs { padding: 0 var(--mds-space-4); } }

/* ----------------------------------------------------------------------------
   14. PROSE  ·  long-form reading mode (Knowledgebase articles, page intros)
   ----------------------------------------------------------------------------
   The app is a dense data cockpit (14px, tight rhythm). An article is a reading
   surface: bigger type, generous line-height, a capped measure. These tokens
   live in the .mds-prose scope ONLY, so the cockpit views stay untouched.
   Generic reading mode — used by the KB shell (kb.css) and elsewhere (Home,
   Placeholder). Consumes raw semantic HTML (h2/ul/table/figure...) — WordPress
   block classes are stripped upstream; we style the bare elements.
   ---------------------------------------------------------------------------- */
.mds-prose {
    --mds-prose-text: 16px; --mds-prose-lh: 1.65;
    --mds-prose-h1: 28px; --mds-prose-h2: 22px; --mds-prose-h3: 18px;
    --mds-prose-gap: var(--mds-space-4);
    max-width: 68ch;        /* ~65–75 char measure */
    font-size: var(--mds-prose-text); line-height: var(--mds-prose-lh);
    color: var(--mds-text);
}
.mds-prose p { margin: 0 0 var(--mds-prose-gap); }
.mds-prose h1, .mds-prose h2, .mds-prose h3 { color: var(--mds-title); line-height: 1.25; }
.mds-prose h1 { font-size: var(--mds-prose-h1); font-weight: 400;
    margin: 0 0 var(--mds-space-5); padding-bottom: var(--mds-space-1);
    border-bottom: 1px solid var(--mds-rule-strong); }
.mds-prose h2 { font-size: var(--mds-prose-h2); font-weight: 700; margin: var(--mds-space-8) 0 var(--mds-space-3); }
.mds-prose h3 { font-size: var(--mds-prose-h3); font-weight: 700; margin: var(--mds-space-6) 0 var(--mds-space-2); }
.mds-prose a { color: var(--mds-text); text-decoration: underline; text-decoration-color: var(--mds-control); text-underline-offset: 2px; }
.mds-prose a:hover { color: var(--mds-accent-ink); text-decoration-color: currentColor; }
.mds-prose strong { font-weight: 700; }
.mds-prose em { font-style: italic; }
.mds-prose ul, .mds-prose ol { margin: 0 0 var(--mds-prose-gap); padding-left: var(--mds-space-6); }
.mds-prose li { margin-bottom: var(--mds-space-2); }
.mds-prose blockquote { margin: var(--mds-prose-gap) 0; padding-left: var(--mds-space-4);
    border-left: 3px solid var(--mds-line); color: var(--mds-muted); font-style: italic; }
.mds-prose code { padding: 1px var(--mds-space-1); border-radius: var(--mds-radius-sm);
    background: var(--mds-tint); font-family: 'Consolas', monospace; font-size: .9em; }
/* tables: a readable look, NOT the compact .mds-table of the cockpit */
.mds-prose table { width: 100%; border-collapse: collapse; margin: var(--mds-prose-gap) 0; }
.mds-prose th { text-align: left; padding: var(--mds-space-2) var(--mds-space-3);
    background: var(--mds-tint); color: var(--mds-title); font-weight: 700; }
.mds-prose td { padding: var(--mds-space-2) var(--mds-space-3); border-bottom: 1px solid var(--mds-line); }
/* figures + images */
.mds-prose figure { margin: var(--mds-prose-gap) 0; }
.mds-prose img { max-width: 100%; height: auto; border-radius: var(--mds-radius); }
.mds-prose figcaption { margin-top: var(--mds-space-1); text-align: center;
    color: var(--mds-muted); font-size: var(--mds-text-sm); }
/* ---- reading-prose element rules the article content relies on (gaps in the
   base .mds-prose above): floated/centred images, video embeds, and the native
   <details> disclosures the KB normaliser rebuilds from theme accordions. ---- */
.mds-prose img[align="right"] { float: right; margin: 4px 0 var(--mds-space-3) var(--mds-space-5); }
.mds-prose img[align="left"]  { float: left;  margin: 4px var(--mds-space-5) var(--mds-space-3) 0; }
.mds-prose img[align="center"],
.mds-prose > p > img:only-child,
.mds-prose figure > img { display: block; margin: var(--mds-prose-gap) auto; clear: both; float: none; }
.mds-prose td img, .mds-prose a img { display: inline-block; margin: 0; float: none; clear: none; }
.mds-prose h2, .mds-prose h3 { clear: both; }   /* a floated image never bleeds into the next section */
.mds-prose iframe { display: block; width: 100%; max-width: 720px; aspect-ratio: 16 / 9;
    height: auto; margin: var(--mds-prose-gap) 0; border: 0; border-radius: var(--mds-radius); }
.mds-prose details { border-bottom: 1px solid var(--mds-line); clear: both; }
.mds-prose summary { cursor: pointer; list-style: none; display: flex; align-items: center;
    gap: var(--mds-space-2); padding: var(--mds-space-3) 0; font-weight: 700; color: var(--mds-title); }
.mds-prose summary::-webkit-details-marker { display: none; }
.mds-prose summary::before { content: "\f054"; font-family: "Font Awesome 7 Free"; font-weight: 900;
    font-size: 11px; color: var(--mds-accent); transition: transform .15s ease; }   /* chevron-right */
.mds-prose details[open] > summary::before { transform: rotate(90deg); }
.mds-prose summary:hover { color: var(--mds-accent-ink); }
.mds-prose details > div { padding: 0 0 var(--mds-space-4) var(--mds-space-6); }
.mds-prose details > div > :first-child { margin-top: 0; }

/* callouts: boxed note (info=teal) / warning (amber) — tint + left bar + icon */
.mds-callout { margin: var(--mds-prose-gap) 0; padding: var(--mds-space-3) var(--mds-space-4);
    border-left: 4px solid var(--mds-accent); border-radius: var(--mds-radius); background: var(--mds-tint); }
.mds-callout__label { display: flex; align-items: center; gap: var(--mds-space-2);
    margin-bottom: var(--mds-space-1); font-weight: 700; color: var(--mds-accent-ink); }
.mds-callout > :last-child { margin-bottom: 0; }
.mds-callout--warning { border-left-color: var(--mds-warning); background: var(--mds-warning-bg); }
.mds-callout--warning .mds-callout__label { color: var(--mds-warning); }

/* ---- 14b. PROSE HELPERS ------------------------------------------------- */
.mds-muted   { color: var(--mds-muted); font-size: var(--mds-text-xs); line-height: 14px; }
.mds-accent  { color: var(--mds-accent-ink); font-weight: 700; }
/* Quiet: links are ink with a thin underline, so teal means "act on" and nothing else. */
.mds-link    { color: var(--mds-text); text-decoration: underline; text-decoration-color: var(--mds-control); text-underline-offset: 2px; }
.mds-link:hover { color: var(--mds-accent-ink); text-decoration-color: currentColor; }
.mds-link:hover { text-decoration: underline; }
/* inline help link: the small "ⓘ" after a field label -> seminar article.
   cursor: help (not pointer) while the articles are not ported — it hints at
   information, without promising a navigation that does not happen yet. */
.mds-info { margin-left: var(--mds-space-1); color: var(--mds-muted);
    font-size: 10px; line-height: 1; text-decoration: none; cursor: help; }
.mds-info:hover { color: var(--mds-accent-ink); }
/* Small layout utilities — reach for these instead of an inline style="…". */
.mds-prewrap { white-space: pre-line; }
.mds-mt-4 { margin-top: var(--mds-space-4); }

/* ---- 14c. CARD TEXT: short prose inside a cockpit card — 14px and tight, the
   cockpit counterpart to the 16px reading-mode .mds-prose. Keeps text cards
   (description, hazards, cleaning, PPE) at the same size as the data cards. --- */
.mds-cardtext { font-size: var(--mds-text-sm); line-height: 1.5; }
.mds-cardtext p { margin: 0 0 var(--mds-space-2); }
.mds-cardtext > :last-child { margin-bottom: 0; }
.mds-cardtext a { color: var(--mds-text); text-decoration: underline; text-decoration-color: var(--mds-control); text-underline-offset: 2px; }
.mds-cardtext a:hover { text-decoration: underline; }
.mds-cardtext ul { margin: 0; padding-left: var(--mds-space-5); list-style: disc; }
.mds-cardtext li { margin-bottom: var(--mds-space-1); list-style: inherit; }
.mds-cardtext li:last-child { margin-bottom: 0; }

/* ---- 15. CHIP GROUP: collapse a long set to ~2 rows + show-all toggle --- */
.mds-chips--collapsed { max-height: 24px; overflow: hidden; }   /* exactly one row of mds-chip (26px pitch) */
.mds-chips-toggle { margin-top: var(--mds-space-1); }   /* behaviour hook; styled by .mds-toggle */

/* ---- 15b. TOGGLE: the one "reveal more" control — a subtle accent text button
   with an optional chevron. Used by every Show all / Update history / Show more,
   and by <summary>. Contrast with .mds-btn, which is for real actions. -------- */
.mds-toggle { display: inline-flex; align-items: center; gap: var(--mds-space-1);
    background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
    color: var(--mds-accent-ink); font-family: var(--mds-font); font-size: var(--mds-text-xs);
    text-decoration: none; }
.mds-toggle:hover { text-decoration: underline; }
.mds-toggle__chev { font-size: 9px; transition: transform .15s ease; }
summary.mds-toggle { list-style: none; width: fit-content; }
summary.mds-toggle::-webkit-details-marker { display: none; }
details[open] > summary.mds-toggle .mds-toggle__chev { transform: rotate(180deg); }
/* a native <details> disclosure block (e.g. the update history) */
.mds-disclosure { margin-top: var(--mds-space-4); }
.mds-disclosure__body { margin-top: var(--mds-space-2); }

/* ACCORDION: a list of native <details> rows that collapse to a one-line header and
   expand to a body. Generic — a feature supplies a lead element (icon/number/badge)
   before the title and any body formatting. Single-line rows use __flat (no expander). */
.mds-accordion { list-style: none; margin: 0; padding: 0; }
.mds-accordion__item { border-top: 1px solid var(--mds-line); }
.mds-accordion__item:first-child { border-top: none; }
.mds-accordion__head,
.mds-accordion__flat { display: flex; align-items: baseline; gap: var(--mds-space-3);
    padding: var(--mds-space-2) 0; }
.mds-accordion__head { cursor: pointer; list-style: none; }
.mds-accordion__head::-webkit-details-marker { display: none; }
.mds-accordion__title { flex: 1 1 auto; color: var(--mds-title); }
.mds-accordion__head:hover .mds-accordion__title { color: var(--mds-accent-ink); }
.mds-accordion__chev { flex: none; font-size: 11px; color: var(--mds-muted);
    transition: transform .15s ease; }
details[open] > .mds-accordion__head .mds-accordion__chev { transform: rotate(180deg); }
.mds-accordion__body { padding-bottom: var(--mds-space-3); color: var(--mds-text); }

/* ---- 16. NOTES  ·  small helpers on top of the deflist (importance, meta, edit) - */
.mds-notes__icon { margin-right: var(--mds-space-1); }
.mds-notes__icon--red   { color: var(--mds-danger); }
.mds-notes__icon--amber { color: var(--mds-warning); }
.mds-notes__row--user .mds-deflist__term { color: var(--mds-accent-ink); }
.mds-notes .mds-deflist__row { position: relative; }
.mds-notes__meta { margin-top: var(--mds-space-1); font-size: var(--mds-text-xs); }
/* edit: hover-revealed pencil at the row's top-right — adds no row height */
.mds-notes__edit { position: absolute; top: var(--mds-space-2); right: var(--mds-space-1);
    font-size: var(--mds-text-xs); visibility: hidden; }
.mds-notes .mds-deflist__row:hover .mds-notes__edit { visibility: visible; }
@media (hover: none) { .mds-notes__edit { visibility: visible; } }

/* ---- 17. EMPTY STATE: the no-data / not-found / "nothing selected" panel.
   A centred icon + title + text, used by every page's not-found / no-cargo
   state and the cargo-selector's "no cargo selected" view. --------------- */
.mds-empty { max-width: 420px; margin: var(--mds-space-11) auto; text-align: center; }
.mds-empty__icon { font-size: 40px; color: var(--mds-accent); opacity: .5; }
.mds-empty__title { margin: var(--mds-space-4) 0 var(--mds-space-2);
    font-size: var(--mds-text-2xl); font-weight: 600; color: var(--mds-title); }
.mds-empty__text { margin: 0; color: var(--mds-muted); line-height: 1.5; }

/* ---- 17b. NO-RESULTS: a quiet inline "nothing matched / none on record"
   message under a toolbar (contrast with .mds-empty, the big centred state). - */
.mds-noresults { color: var(--mds-muted); padding: var(--mds-space-3) 0; }

/* ---- 18. SKELETON: loading placeholder (shimmer) ----------------------- */
/* A neutral shimmer used while a view's data loads. Sized to the card masonry so
   the layout holds its shape. Drives the MdsSkeleton component. */
.mds-skel {
    display: block;
    border-radius: var(--mds-radius);
    background: linear-gradient(100deg,
        var(--mds-gray-100) 30%, var(--mds-gray-200) 50%, var(--mds-gray-100) 70%);
    background-size: 200% 100%;
    animation: mds-shimmer 1.3s ease-in-out infinite;
}
.mds-skel--chip { display: inline-block; height: 18px;
    margin: 0 var(--mds-space-1) var(--mds-space-1) 0; }
.mds-skel--head { height: 20px; width: 55%; margin-bottom: var(--mds-space-3); }
.mds-skel--row  { height: 14px; margin: var(--mds-space-2) 0; }
.mds-skel--row:nth-child(3n)   { width: 80%; }
.mds-skel--row:nth-child(4n+1) { width: 65%; }
@keyframes mds-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) { .mds-skel { animation: none; } }

/* Screen-reader-only text (announce loading without showing a label). */
.mds-visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ----------------------------------------------------------------------------
   19. FRAMEWORK INTEGRATION  ·  the two spots where mds- meets Bootstrap / Alpine.
   ----------------------------------------------------------------------------
   Focus ring: Bootstrap (B3 bootstrap.css + B5 frontpage/main.css) draws an
   outline / box-shadow on :focus that lingers after a mouse click. Suppress it
   for pointer focus, keep it for :focus-visible (keyboard) — the modern, a11y-
   correct default.
   x-cloak: Alpine convention — keep [x-cloak] elements hidden until Alpine
   initialises (it then strips the attribute) so templated markup never flashes.
   ---------------------------------------------------------------------------- */
:focus:not(:focus-visible) { outline: none !important; box-shadow: none !important; }
/* FocusOnNavigate (App.razor) parks focus on each page's first h1 for screen readers;
   a heading is not interactive, so the UA ring carries no information — never draw it
   (some browsers treat that programmatic focus as :focus-visible). Issue #21. */
h1:focus { outline: none !important; box-shadow: none !important; }
[x-cloak] { display: none !important; }

/* Visually hidden, read by screen readers (labels for marks and search fields). */
.mds-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
