/* Django glue for the V05 shell (Tweak 019).
   Small app-specific adjustments that don't belong in the ported prototype CSS
   (wireframe.css / v05-shell.css / mobile.css are kept as source-of-truth). */

/* F122 (WCAG 2.4.1 Bypass Blocks): visually-hidden (sr-only) utility — content is
   available to assistive tech but clipped from the visual layout. Used for the
   skip link (revealed on focus) and any sr-only headings. */
.visually-hidden:not(:focus):not(:focus-within) {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* F122: skip-to-content link — first focusable element in the body. Visually
   hidden until focused (keyboard Tab), then it appears in the top-left corner
   so a keyboard/AT user can jump straight past the sidebar nav to <main>.
   Hidden via clip-path, NOT an off-canvas translate — anything parked above
   the viewport top gets revealed by overscroll rubber-banding. */
.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  clip-path: inset(50%);
  /* a11y-visual-02: white 13px label needs >=4.5:1 — green-700 CTA fill (5.64:1). */
  background: var(--cta-bg);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 16px;
  /* controller-role mobile pass: the 44px tap-target floor applies to every
     focusable element, including this one once it springs into view. */
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: var(--shadow-md);
}
.skip-link:focus {
  clip-path: none;
  outline: 2px solid var(--enroute-green-50);
  outline-offset: 2px;
  box-shadow: var(--focus-ring), var(--shadow-md);
}
/* The <main> landmark is a script-focus target (tabindex=-1) so jumping to it
   doesn't draw a persistent focus ring around the whole content region. */
#main:focus { outline: none; }

/* Anonymous pages (login, password reset, error pages) have no sidebar, so the
   .hf-shell 2-column grid collapses to a single full-width column. */
.hf-shell--anon { grid-template-columns: 1fr; }

/* F023: generic in-content hyperlinks read in the BRAND link colour (--link,
   green-700), not the ad-hoc cobalt some page CSS still uses. Scoped to
   class-less links inside the main content region so it touches ONLY generic
   prose links — every chrome/nav link (.hf-*), button (.btn), status pill,
   role pill and page-CSS-classed link carries its own class and is untouched,
   so neither status nor nav colour is recoloured. Underline-on-hover keeps the
   affordance without shouting at rest. */
.hf-main a:not([class]) {
  color: var(--link);
  text-decoration: none;
}
.hf-main a:not([class]):hover {
  color: var(--link-hover);
  text-decoration: underline;
}
.hf-main a:not([class]):focus-visible {
  outline: none;
  border-radius: var(--radius-xs);
  box-shadow: var(--focus-ring);
}

/* The brand link is an interactive tap target — give it a >=44px hit area
   (ADR 0005), vertically centred within the 55px header. */
.hf-header__title { display: inline-flex; align-items: center; min-height: 44px; }

/* Sign-out must be a POST form (CSRF), rendered as a button but styled as the
   sidebar's signout link. Reset only the button chrome; colour/hover come from
   .hf-side__signout in v05-shell.css. */
button.hf-side__signout {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.hf-side__account form { margin: 0; padding: 0; }

/* Form field/banner error styling — the V05 prototypes omitted error states, but
   Django forms need them. Shared by all re-skinned form pages (Tweaks 020+). */
.fld__err { color: var(--enroute-rose-700); font-size: 12px; line-height: 1.4; margin-top: 4px; }
.fld [aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--enroute-rose-500); }
.form-banner--error {
  background: var(--enroute-rose-50);
  color: var(--enroute-rose-700);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: inset 0 0 0 1px var(--enroute-rose-200);
  font-size: 13px;
  margin-bottom: 16px;
}
.form-banner--error p { margin: 0; }
.form-banner--error p + p { margin-top: 4px; }
.form-banner--success {
  background: var(--enroute-green-50);
  color: var(--enroute-green-700);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: inset 0 0 0 1px var(--enroute-green-200);
  font-size: 13px;
  margin-bottom: 16px;
}
.form-banner--info {
  background: var(--enroute-ink-50);
  color: var(--enroute-ink-700);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: inset 0 0 0 1px var(--enroute-ink-200);
  font-size: 13px;
  margin-bottom: 16px;
}
/* release-management (#24): a small, non-blocking gantry-mismatch badge on a
   release_note row (load detail + document centre). A DEDICATED class — NOT
   .st-pill (the conformance-pinned status vocabulary). Amber = advisory; the
   full reason is the title= tooltip. */
.od-doc__badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
  white-space: nowrap;
  background: var(--enroute-amber-100);
  color: var(--enroute-amber-800);
  cursor: help;
}
/* emergency badge (#31 SP5): the dedicated "Urgent" marker, modeled on
   .od-doc__badge — a DEDICATED class, NOT an .st-pill / s-* status modifier
   (urgency and lifecycle are orthogonal). A SIBLING of the status pill on every
   surface (list, work-queue, detail header, dashboard). Rose tokens (the
   higher-severity family; amber is taken by the gantry-mismatch advisory). */
.od-emergency-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
  white-space: nowrap;
  background: var(--emergency-bg);
  color: var(--emergency-fg);
  cursor: help;
}
/* #32 missing-file-identification: the internal order-list "missing required
   documents" icon — a DEDICATED class (NOT an s-* status modifier), a SIBLING
   rendered immediately BEFORE the .st-pill (mobile.js clones it alongside the
   pill). Severity-graded by count of missing docs: --warn (1) / --mid (2) /
   --danger (3+). Light-tint chip + dark-ink glyph (the .od-emergency-badge
   model) so the hue is distinguishable AND the 15px glyph clears WCAG 1.4.11
   (3:1, non-text graphic). The tooltip/aria-label names the missing docs. */
.od-missing-docs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  border-radius: var(--r-sm);
  vertical-align: middle;
  cursor: help;
}
.od-missing-docs svg { display: block; }
.od-missing-docs--warn   { background: var(--missing-docs-warn-bg);   color: var(--missing-docs-warn-fg); }
.od-missing-docs--mid    { background: var(--missing-docs-mid-bg);    color: var(--missing-docs-mid-fg); }
.od-missing-docs--danger { background: var(--missing-docs-danger-bg); color: var(--missing-docs-danger-fg); }

/* finance-tracking (§6): internal order-list per-row finance status dots —
   client invoice paid · supplier invoice captured in Xero · supplier invoice
   paid. A FILLED green dot = done; a HOLLOW muted ring = pending. Shape + fill
   differ (not colour alone), so the state is not conveyed by colour only
   (WCAG 1.4.1); each dot also carries its own `title`, and the cluster an
   aria-label naming all three states. */
.fin-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  vertical-align: middle;
}
.fin-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-sizing: border-box;
}
.fin-dot--on  { background: var(--fin-dot-on); }
.fin-dot--off { background: transparent; border: 1.5px solid var(--fin-dot-off); }
/* document-soft-delete (#25): a rose "Deleted by … on …" badge (prose, not the
   uppercase advisory pill) + the greyed row treatment, shown only to internal +
   the deleting org (the view already filtered non-retained users out). */
.od-doc__badge--deleted {
  background: var(--enroute-rose-100);
  color: var(--enroute-rose-700);
  text-transform: none;
  letter-spacing: 0;
  cursor: default;
}
/* The "Deleted by … on …" detail is a wrapping meta line (compact pill stays
   "Deleted"); rose-tinted so it reads as the deletion record. */
.od-doc__meta--deleted,
.m-ol-card__meta--deleted {
  color: var(--enroute-rose-600);
}
.od-doc--deleted,
.dc-row--deleted,
.m-ol-card--deleted {
  opacity: 0.62;
}
.od-doc--deleted .od-doc__icon {
  background: var(--enroute-rose-100);
  color: var(--enroute-rose-700);
}
/* Row-action icon buttons (edit pencil / delete trash) + the inline restore form.
   The icons open the page-level delete/edit modals (document-actions.js). */
.od-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-1);
  border-radius: var(--r-sm);
  background: var(--bg-paper);
  color: var(--fg-3);
  cursor: pointer;
  vertical-align: middle;
}
.od-act svg { width: 15px; height: 15px; }
.od-act:hover { background: var(--bg-canvas); color: var(--fg-1); }
.od-act--delete:hover {
  color: var(--enroute-rose-700);
  border-color: var(--enroute-rose-400);
}
.od-act--edit:hover { color: var(--enroute-cobalt-600, var(--fg-1)); }
.od-act__restore { display: inline-block; }

/* Document delete/edit modal bodies (the .v05-modal shell is modal.css). */
.od-modal__note { font-size: 13px; color: var(--fg-2); margin: 0 0 var(--space-3); }
.od-modal__field {
  display: block;
  font-size: 13px;
  color: var(--fg-2);
}
.od-modal__field input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-1);
  background: var(--bg-paper);
  color: var(--fg-1);
}
/* status-rework #22: load-detail status-advance controls + the Delivering X/Y rollup */
.detail-statusbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.detail-rollup { color: var(--enroute-ink-500); font-weight: 500; }

/* Django messages banner (V05 — replaces the legacy .app-banner at cutover). */
.msg-stack { max-width: 640px; margin: 0 auto 20px; display: flex; flex-direction: column; gap: 8px; }
.msg-banner { border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.45; box-shadow: inset 0 0 0 1px var(--border-1); }
.msg-banner--error { background: var(--enroute-rose-50); color: var(--enroute-rose-700); box-shadow: inset 0 0 0 1px var(--enroute-rose-200); }
.msg-banner--warning { background: var(--enroute-amber-50); color: var(--enroute-amber-800); box-shadow: inset 0 0 0 1px var(--enroute-amber-200); }
.msg-banner--success { background: var(--enroute-green-50); color: var(--enroute-green-800); box-shadow: inset 0 0 0 1px var(--enroute-green-200); }
.msg-banner--info { background: var(--enroute-ink-50); color: var(--fg-2); }
