/* ==========================================================================
   ORC Sailor Services — the site stylesheet (css/sas.css)

   orc.org's look (Craft source D:\daytwo, source/src/scss): flat, square,
   two-colour — navy #000122 on periwinkle #EDF0FF — with 1px navy rules, the
   Neue Haas Grotesk faces of Typekit kit ale7veo, no radius, no shadow, no
   gradient. Application density where orc.org is a magazine: boxed inputs
   and compact tables, as orc.org's own application forms (appForm-init).
   Contract: Certificates/WebSaS/sassrv-api.md §5.7–§5.8.

   Shared components only. An area's own styles live in css/<area>.css during
   the build, every class with the area's prefix (.acct- .boats- .vpp- .prod-
   .ed- .certs- .info- .light-); the lead folds them into the marked AREA sections at
   the end of this file in phase (c). No class here uses an area prefix.

   Sections:
     1  Tokens                    9  Panels, chips, badges, tabs
     2  Base and type            10  Messages and notices
     3  Layout                   11  Dialogs
     4  Header and navigation    12  Menus
     5  Footer                   13  Icons
     6  Buttons                  14  Money: balance strip, spend panel
     7  Forms                    15  Utilities, loading, motion, print
     8  Tables and pager         16  AREA sections (merged by the lead)
   ========================================================================== */


/* ==========================================================================
   1. Tokens
   ========================================================================== */

:root {
  --orc-navy: #000122;          /* text, 1px rules, primary buttons, footer, nav hover */
  --orc-logo: #0D0F21;          /* the logo only */
  --orc-page: #EDF0FF;          /* page background, dialogs */
  --orc-header: #ECF0FF;        /* header bar */
  --orc-tint: #DBE3FF;          /* zebra rows, panels */
  --orc-tint-hover: #D4DBFF;    /* hover on light surfaces */
  --orc-white: #FFFFFF;         /* inputs, secondary buttons, text on navy */
  --orc-accent: #005FCC;        /* link hover, the focus ring */
  --orc-error: #DC3545;         /* error borders and icons */
  --sas-error-text: #B02A37;    /* error text: 5.7:1 on the page (#DC3545 is 4.0:1) */
  --sas-ok: #0F6B3E;
  --sas-ok-bg: #E3F2EA;
  --sas-warn: #7A4D00;
  --sas-warn-bg: #FFF4D6;
  --sas-muted: rgba(0, 1, 34, .72);   /* secondary text: about 8:1 on the page */
  --orc-rule: 1px solid #000122;
  --orc-rule-soft: 1px solid rgba(0, 1, 34, .5);
  --orc-overlay: rgba(0, 1, 34, .5);
  --orc-focus: 0 0 0 3px #005FCC;
  --orc-font-text: "neue-haas-grotesk-text", sans-serif;       /* 400, 700 */
  --orc-font-display: "neue-haas-grotesk-display", sans-serif; /* 500 (declared 500, never 600) */
  --orc-gutter: 20px;
  --orc-max: 1470px;
  --sas-header-h: 60px;         /* 70 from 768 */
  --sas-control-h: 32px;        /* 44 on coarse pointers */
}

@media (max-width: 479.98px) {
  :root { --orc-gutter: 16px; }
}

@media (min-width: 768px) {
  :root { --sas-header-h: 70px; }
}

@media (pointer: coarse) {
  :root { --sas-control-h: 44px; }
}


/* ==========================================================================
   2. Base and type
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--orc-page);
  color: var(--orc-navy);
  font-family: var(--orc-font-text);
  font-size: 14px;
  line-height: 17.5px;
  font-weight: 400;
  font-variant-ligatures: none;
  font-variant-numeric: tabular-nums;   /* figures line up everywhere */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (min-width: 768px) {
  body { font-size: 16px; line-height: 21px; }
}

body.menu-open { overflow: hidden; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--orc-font-display);
  font-weight: 500;                     /* never bold */
  margin: 0 0 .5em;
}

h1 { font-size: 32px; line-height: 1.175; }
h2 { font-size: 24px; line-height: 1.2; }
h3 { font-size: 20px; line-height: 1.2; }
h4 { font-size: 16px; line-height: 1.3; }

@media (min-width: 768px) {
  h1 { font-size: 40px; }
}

p { margin: 0 0 1em; }

small, .small { font-size: 12px; line-height: 16px; }

strong, b { font-weight: 700; }

/* Links are underlined: in tables they would otherwise read as plain text. */
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color .2s, background-color .2s;
}

a:hover { color: var(--orc-accent); }

hr { border: 0; border-top: var(--orc-rule); margin: 20px 0; }

img, svg { max-width: 100%; }

code, kbd { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; }

/* Keyboard focus is always visible: orc.org's ring. */
*:focus-visible {
  outline: 0;
  box-shadow: var(--orc-focus);
}

/* The skip link's target takes the focus without a ring around the page. */
main:focus,
main:focus-visible { box-shadow: none; outline: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 8px;
  top: -200px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--orc-navy);
  color: var(--orc-white);
  font-family: var(--orc-font-display);
  font-weight: 500;
  text-decoration: none;
}

.skip:focus,
.skip:focus-visible { top: 8px; color: var(--orc-white); }

/* reCAPTCHA's floating badge is hidden; every page's footer carries Google's
   notice instead, which its terms allow. */
.grecaptcha-badge { visibility: hidden; }


/* ==========================================================================
   3. Layout
   ========================================================================== */

.wrap {
  width: 100%;
  max-width: var(--orc-max);
  margin: 0 auto;
  padding-left: var(--orc-gutter);
  padding-right: var(--orc-gutter);
}

main#main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--orc-max);
  margin: 0 auto;
  padding: 30px var(--orc-gutter) 0;
}

@media (min-width: 768px) {
  main#main { padding-top: 40px; }
}

/* A narrow column for forms and reading pages. */
.narrow { max-width: 640px; }
.narrower { max-width: 480px; }

.page-head { margin-bottom: 20px; }
.page-head h1 { margin-bottom: 5px; }
.page-head .lead { font-size: 16px; line-height: 21px; color: var(--sas-muted); margin: 0; }

/* Breadcrumbs: "My Boats › Moonbeam". */
.crumbs { margin: 0 0 10px; }
.crumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.crumbs li:not(:last-child)::after {
  content: "›";
  padding: 0 6px;
  color: var(--sas-muted);
}
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* Two columns from 992 px (the boat page), one below. */
.cols-2 {
  display: grid;
  gap: 30px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 992px) {
  .cols-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cols-2.wide-left { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}

.stack > * + * { margin-top: 20px; }
.stack-tight > * + * { margin-top: 10px; }

.section { margin-top: 40px; }
.section:first-child { margin-top: 0; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 15px;
  margin-bottom: 20px;
}

/* An action bar that stays at the bottom while a long form scrolls. */
.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  background: var(--orc-page);
  border-top: var(--orc-rule);
}


/* ==========================================================================
   4. Header and navigation (layout.js draws it)
   One row from 1200 px; below, a menu button and a full-screen list.
   ========================================================================== */

#site-header {
  position: relative;
  z-index: 10;
  background: var(--orc-header);
  border-bottom: var(--orc-rule);
}

.hdr-bar {
  display: flex;
  align-items: center;
  gap: 10px 16px;
  min-height: var(--sas-header-h);
  padding-top: 10px;
  padding-bottom: 10px;
}

.hdr-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-right: auto;
  color: var(--orc-navy);
  text-decoration: none;
}

.hdr-brand:hover { color: var(--orc-navy); }

.hdr-logo {
  display: block;
  height: 40px;
  width: auto;
  flex: none;
}

.hdr-title {
  font-family: var(--orc-font-display);
  font-weight: 500;
  font-size: 20px;
  line-height: 24px;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .hdr-logo { height: 50px; }
  .hdr-title { font-size: 24px; line-height: 28px; }
}

@media (max-width: 359.98px) {
  .hdr-title { font-size: 18px; }
}

/* Navigation items: display face, a 1px navy underline; hover and the current
   page invert to a navy fill. */
.hdr-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hdr-links a,
.hdr-userbtn {
  display: block;
  padding: 5px;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: none;
  color: var(--orc-navy);
  font-family: var(--orc-font-display);
  font-weight: 500;
  font-size: 16px;
  line-height: 21px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}

.hdr-links a:hover,
.hdr-links a[aria-current="page"],
.hdr-userbtn:hover,
.hdr-userbtn[aria-expanded="true"],
.hdr-userbtn.is-current {
  background: var(--orc-navy);
  color: var(--orc-white);
}

/* The balance badge: Available, and from 992 px a small "10 held" line. */
.hdr-badge {
  display: none;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-height: var(--sas-control-h);
  padding: 3px 8px;
  border: var(--orc-rule);
  background: var(--orc-white);
  color: var(--orc-navy);
  font-family: var(--orc-font-display);
  font-weight: 500;
  font-size: 15px;
  line-height: 18px;
  text-decoration: none;
  white-space: nowrap;
}

.hdr-badge.is-shown { display: inline-flex; }

.hdr-badge:hover,
.hdr-badge[aria-current="page"] {
  background: var(--orc-navy);
  color: var(--orc-white);
}

.hdr-badge-held {
  display: none;
  font-family: var(--orc-font-text);
  font-size: 12px;
  line-height: 14px;
}

@media (min-width: 992px) {
  .hdr-badge.has-held .hdr-badge-held { display: block; }
}

/* The small-screen copy of the badge, inside the menu panel. */
.hdr-badge-inline { display: none; }

/* The hamburger: three 2px bars, turning into an X. */
.hdr-menubtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--orc-navy);
  cursor: pointer;
}

.hdr-menubtn-bars {
  position: relative;
  display: block;
  width: 24px;
  height: 14px;
}

.hdr-menubtn-bars span {
  position: absolute;
  left: 0;
  width: 24px;
  height: 2px;
  border-radius: 25px;
  background: currentColor;
  transition: transform .2s, opacity .2s;
}

.hdr-menubtn-bars span:nth-child(1) { top: 0; }
.hdr-menubtn-bars span:nth-child(2) { top: 6px; }
.hdr-menubtn-bars span:nth-child(3) { top: 12px; }

#site-header.is-open .hdr-menubtn-bars span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
#site-header.is-open .hdr-menubtn-bars span:nth-child(2) { opacity: 0; }
#site-header.is-open .hdr-menubtn-bars span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* The account menu and the signed-out buttons. */
.hdr-user { position: relative; }

.hdr-userbtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.hdr-userbtn .icon { width: 16px; height: 16px; }

.hdr-userlist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hdr-userlist a,
.hdr-userlist button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-bottom: var(--orc-rule-soft);
  background: none;
  color: var(--orc-navy);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.hdr-userlist li:last-child a,
.hdr-userlist li:last-child button { border-bottom: 0; }

.hdr-userlist a:hover,
.hdr-userlist button:hover,
.hdr-userlist a[aria-current="page"] {
  background: var(--orc-navy);
  color: var(--orc-white);
}

.hdr-userhead {
  margin: 0 0 10px;
  font-family: var(--orc-font-display);
  font-weight: 500;
  font-size: 16px;
}

.hdr-auth {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Below 1200 px: brand, badge (from 576 px) and the menu button in the bar.
   Open, the header itself becomes the full-screen list: the links, then the
   account. DOM order (brand, menu button, links, badge, account) is the
   focus order. */
@media (max-width: 1199.98px) {
  .hdr-brand { order: 0; }
  .hdr-badge { order: 1; }
  .hdr-menubtn { order: 2; }

  .hdr-nav,
  .hdr-user { display: none; }

  #site-header.is-open {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    overflow-y: auto;
    background: var(--orc-page);
  }

  #site-header.is-open .hdr-bar {
    flex-wrap: wrap;
    align-content: flex-start;
    border-bottom: 0;
  }

  #site-header.is-open .hdr-nav,
  #site-header.is-open .hdr-user {
    display: block;
    flex: 0 0 100%;
  }

  #site-header.is-open .hdr-nav {
    order: 3;
    margin-top: 10px;
    border-top: var(--orc-rule);
  }

  #site-header.is-open .hdr-user {
    order: 4;
    margin-top: 30px;
    padding-bottom: 40px;
  }

  .hdr-links a {
    padding: 10px 5px;
    border-bottom: var(--orc-rule);
  }

  .hdr-userbtn { display: none; }

  .hdr-userlist { border-top: var(--orc-rule); }

  .hdr-userlist a,
  .hdr-userlist button {
    padding: 10px 5px;
    border-bottom: var(--orc-rule);
    font-family: var(--orc-font-display);
    font-weight: 500;
    font-size: 16px;
  }

  .hdr-userlist li:last-child a,
  .hdr-userlist li:last-child button { border-bottom: var(--orc-rule); }

  .hdr-auth .btn { flex: 1 1 140px; }
}

@media (max-width: 575.98px) {
  .hdr-badge.is-shown { display: none; }
  .hdr-badge-inline.is-shown {
    display: block;
    margin: 0 0 20px;
    padding: 10px 12px;
    background: var(--orc-tint);
  }
}

@media (min-width: 1200px) {
  .hdr-menubtn { display: none; }

  .hdr-brand { margin-right: 20px; }
  .hdr-nav { margin-right: auto; }

  .hdr-links {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .hdr-userhead { display: none; }

  .hdr-userlist {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 30;
    min-width: 240px;
    border: var(--orc-rule);
    background: var(--orc-white);
  }

  .hdr-user.is-open .hdr-userlist { display: block; }
}


/* ==========================================================================
   5. Footer (layout.js draws it): navy band, ruled links, Google's notice
   ========================================================================== */

#site-footer {
  margin-top: 80px;
  padding: 40px 0 44px;
  background: var(--orc-navy);
  color: var(--orc-white);
}

#site-footer *:focus-visible { box-shadow: 0 0 0 3px var(--orc-white); }

.ftr-inner {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
  .ftr-inner {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 40px;
  }
  .ftr-logo-link { grid-row: span 2; }
}

.ftr-logo-link { display: inline-block; justify-self: start; }

.ftr-logo {
  display: block;
  height: 60px;
  width: auto;
}

.ftr-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0 30px;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 576px) {
  .ftr-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 992px) {
  .ftr-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.ftr-links a {
  display: block;
  padding: 4px 0;
  border-bottom: 1px solid var(--orc-white);
  color: var(--orc-white);
  font-size: 16px;
  line-height: 21px;
  text-decoration: none;
  transition: background-color .2s, color .2s;
}

@media (min-width: 992px) {
  .ftr-links a { padding: 5px 0; }
}

.ftr-links a:hover {
  background: var(--orc-white);
  color: var(--orc-navy);
}

.ftr-recaptcha {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
}

.ftr-recaptcha a { color: var(--orc-white); }
.ftr-recaptcha a:hover { color: var(--orc-tint); }


/* ==========================================================================
   6. Buttons — which on which surface
   .btn primary (navy) · .btn.secondary on light surfaces · .btn.light only on
   navy or tinted bands · .btn.link tertiary · .btn.danger destructive.
   Disabled: 40% and a reason in words beside it (.disabled-reason).
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--sas-control-h);
  margin: 0;
  padding: 6px 12px;
  border: 1px solid var(--orc-navy);
  border-radius: 0;
  background: var(--orc-navy);
  color: var(--orc-white);
  box-shadow: none;
  font-family: var(--orc-font-display);
  font-weight: 500;
  font-size: 14px;
  line-height: 18px;
  text-align: left;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color .2s, color .2s, opacity .2s;
}

@media (min-width: 768px) {
  .btn { font-size: 16px; line-height: 21px; }
}

.btn:hover { color: var(--orc-white); opacity: .9; }

.btn.secondary {
  background: var(--orc-white);
  border-color: var(--orc-navy);
  color: var(--orc-navy);
}

.btn.secondary:hover {
  background: var(--orc-navy);
  color: var(--orc-white);
  opacity: 1;
}

.btn.light {
  background: var(--orc-page);
  border-color: var(--orc-page);
  color: var(--orc-navy);
}

.btn.light:hover {
  background: var(--orc-navy);
  border-color: var(--orc-navy);
  color: var(--orc-white);
  opacity: 1;
}

/* On a tinted panel #EDF0FF on #DBE3FF is 1.13:1: the border gives the
   button its shape (WCAG 1.4.11). On navy it needs none. */
.panel:not(.white):not(.ruled) .btn.light { border-color: var(--orc-navy); }

.btn.link {
  min-height: 0;
  padding-left: 0;
  padding-right: 0;
  border-color: transparent;
  background: none;
  color: inherit;
  font-family: var(--orc-font-text);
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn.link:hover { color: var(--orc-accent); opacity: 1; }

.btn.danger {
  background: var(--orc-white);
  border-color: var(--sas-error-text);
  color: var(--sas-error-text);
}

.btn.danger:hover {
  background: var(--sas-error-text);
  color: var(--orc-white);
  opacity: 1;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: .4;
  cursor: not-allowed;
}

.btn:disabled:hover,
.btn[aria-disabled="true"]:hover { opacity: .4; }

.btn.secondary:disabled:hover,
.btn.secondary[aria-disabled="true"]:hover {
  background: var(--orc-white);
  color: var(--orc-navy);
}

.btn.danger:disabled:hover {
  background: var(--orc-white);
  color: var(--sas-error-text);
}

.btn[aria-busy="true"] { cursor: progress; }

.btn .icon { width: 18px; height: 18px; vertical-align: 0; }

/* An icon-only button carries an aria-label. */
.btn.icon-only {
  min-width: var(--sas-control-h);
  padding: 6px;
}

.btn.small {
  min-height: 26px;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 16px;
}

@media (pointer: coarse) {
  .btn.small { min-height: 44px; }
}

.btn.full { width: 100%; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.disabled-reason {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 16px;
  color: var(--sas-muted);
}


/* ==========================================================================
   7. Forms — boxed inputs, labels above, help and errors below
   ========================================================================== */

.field { margin-top: 20px; }
.field:first-child { margin-top: 0; }

.field > label,
.field > .label,
legend {
  display: block;
  padding: 0 0 4px;
  font-weight: 700;
}

.field .optional { font-weight: 400; color: var(--sas-muted); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
input:not([type]),
select,
textarea,
.input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: var(--sas-control-h);
  margin: 0;
  padding: 5px;
  border: 1px solid var(--orc-navy);
  border-radius: 0;
  background: var(--orc-white);
  color: var(--orc-navy);
  box-shadow: none;
  font-family: var(--orc-font-text);
  font-size: 14px;
  line-height: 1.2;
}

/* iOS zooms the page on an input under 16px. */
@media (max-width: 767.98px), (pointer: coarse) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  input[type="number"],
  input[type="date"],
  input:not([type]),
  select,
  textarea,
  .input { font-size: 16px; }
}

input.inline,
select.inline { display: inline-block; width: auto; }

textarea { min-height: 100px; resize: vertical; }

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23000122' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 12px 8px;
}

input:disabled,
select:disabled,
textarea:disabled {
  background-color: var(--orc-tint);
  opacity: .7;
  cursor: not-allowed;
}

input[readonly],
textarea[readonly] { background-color: var(--orc-page); }

::placeholder { color: var(--sas-muted); opacity: 1; }

[aria-invalid="true"] {
  border-color: var(--orc-error) !important;
  box-shadow: inset 3px 0 0 var(--orc-error);
}

[aria-invalid="true"]:focus-visible { box-shadow: inset 3px 0 0 var(--orc-error), var(--orc-focus); }

.help {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 16px;
  color: var(--sas-muted);
}

.field-error {
  display: flex;
  gap: 5px;
  align-items: flex-start;
  margin-top: 4px;
  color: var(--sas-error-text);
  font-size: 14px;
  line-height: 18px;
}

.field-error .icon { margin-top: 1px; }

/* Square checkboxes and round radios, as orc.org's (a navy square or dot). */
input[type="checkbox"],
input[type="radio"] {
  -webkit-appearance: none;
  appearance: none;
  display: inline-grid;
  place-content: center;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--orc-navy);
  border-radius: 0;
  background: var(--orc-white);
  vertical-align: -3px;
  cursor: pointer;
}

input[type="radio"] { border-radius: 50%; }

input[type="checkbox"]::before,
input[type="radio"]::before {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--orc-navy);
  transform: scale(0);
  transition: transform .15s cubic-bezier(.4, 0, .2, 1);
}

input[type="radio"]::before { border-radius: 50%; }

input[type="checkbox"]:checked::before,
input[type="radio"]:checked::before { transform: scale(1); }

input[type="checkbox"]:hover:not(:checked):not(:disabled)::before,
input[type="radio"]:hover:not(:checked):not(:disabled)::before { transform: scale(.5); }

input[type="checkbox"]:disabled,
input[type="radio"]:disabled { opacity: .4; cursor: not-allowed; }

@media (pointer: coarse) {
  input[type="checkbox"],
  input[type="radio"] { width: 22px; height: 22px; }
  input[type="checkbox"]::before,
  input[type="radio"]::before { width: 12px; height: 12px; }
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

fieldset {
  margin: 20px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
}

/* A label and its input side by side from 768 px (dense settings). */
.field-row {
  display: grid;
  gap: 4px 15px;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}

@media (min-width: 768px) {
  .field-row { grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr); }
}


/* ==========================================================================
   8. Tables and pager (table.js)
   No vertical rules, 1px navy row rules, even rows tinted; sortable headers
   italic with a triangle; columns hide by priority and stay readable in a
   row's Details; card mode below 768 px.
   Priorities: 1 always · 2 from 768 · 3 from 992 · 4 from 1280 · 5 Details only.
   ========================================================================== */

/* relative: table.js's visually hidden texts (the Details header, a button's
   boat name) are absolutely positioned, and must stay inside the scrolling
   wrapper - else a wide table scrolls the whole page sideways. */
.tbl-wrap {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
}

.tbl th,
.tbl td {
  padding: 5px;
  border-bottom: var(--orc-rule);
  text-align: left;
  vertical-align: top;
}

.tbl thead th {
  font-weight: 700;
  white-space: nowrap;
  vertical-align: bottom;
}

.tbl thead th.is-sortable { font-weight: 400; font-style: italic; }

.tbl caption {
  caption-side: top;
  padding: 0 0 10px;
  text-align: left;
  font-family: var(--orc-font-display);
  font-weight: 500;
  font-size: 20px;
  line-height: 24px;
}

.tbl tbody tr.even > td { background: var(--orc-tint); }

.tbl .right,
.tbl .num { text-align: right; }

.tbl .center { text-align: center; }

.tbl .nowrap { white-space: nowrap; }

.tbl tr.is-selected > td { font-weight: 700; }
.tbl tr.is-selected > td:first-child { box-shadow: inset 3px 0 0 var(--orc-navy); }

.tbl-empty td {
  padding: 15px 5px;
  font-style: italic;
}

/* Sort buttons in the headers. */
.tbl-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-style: italic;
  text-align: left;
  cursor: pointer;
}

.tbl th.right .tbl-sort,
.tbl th.num .tbl-sort { flex-direction: row-reverse; }

.tbl-sort:hover { color: var(--orc-accent); }

.tbl-sort-mark {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid currentColor;
  opacity: .3;
}

th[aria-sort="ascending"] .tbl-sort-mark { opacity: 1; }
th[aria-sort="descending"] .tbl-sort-mark { opacity: 1; transform: rotate(180deg); }

/* Priority columns and their Details copies. */
.tbl .tbl-p2,
.tbl .tbl-p3,
.tbl .tbl-p4,
.tbl .tbl-p5 { display: none; }

.tbl-details-row > td { padding: 5px 5px 10px; }

.tbl-details {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 15px;
  margin: 0;
}

.tbl-details > div { display: contents; }
.tbl-details dt { font-style: italic; }
.tbl-details dd { margin: 0; }

.tbl-details-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 2px 4px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
  white-space: nowrap;
}

.tbl-details-btn .icon { width: 14px; height: 14px; transition: transform .2s; }
.tbl-details-btn[aria-expanded="true"] .icon { transform: rotate(180deg); }

@media (pointer: coarse) {
  .tbl-details-btn { min-height: 44px; }
}

@media (min-width: 768px) {
  .tbl .tbl-p2 { display: table-cell; }
  .tbl-details .tbl-dp2 { display: none; }
  .tbl .tbl-dmax-2 { display: none; }
}

@media (min-width: 992px) {
  .tbl .tbl-p3 { display: table-cell; }
  .tbl-details .tbl-dp3 { display: none; }
  .tbl .tbl-dmax-3 { display: none; }
}

@media (min-width: 1280px) {
  .tbl .tbl-p4 { display: table-cell; }
  .tbl-details .tbl-dp4 { display: none; }
  .tbl .tbl-dmax-4 { display: none; }
}

/* Card mode below 768 px: each row a block, each cell with its label; the
   roles set by table.js keep the table semantics. */
.tbl-label { display: none; }

@media (max-width: 767.98px) {
  .tbl.tbl-cards thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
  }

  .tbl.tbl-cards,
  .tbl.tbl-cards tbody,
  .tbl.tbl-cards tr { display: block; width: 100%; }

  .tbl.tbl-cards tr:not(.tbl-details-row) { border-bottom: var(--orc-rule); padding: 5px 0; }

  .tbl.tbl-cards td {
    display: grid;
    grid-template-columns: minmax(90px, 35%) minmax(0, 1fr);
    gap: 10px;
    border-bottom: 0;
    text-align: left;
  }

  .tbl.tbl-cards td.tbl-p2,
  .tbl.tbl-cards td.tbl-p3,
  .tbl.tbl-cards td.tbl-p4,
  .tbl.tbl-cards td.tbl-p5,
  .tbl.tbl-cards td.tbl-blank { display: none; }

  .tbl.tbl-cards .tbl-label { display: block; font-style: italic; }

  /* a status chip as wide as its words, not the card's value column */
  .tbl.tbl-cards td > .chip { justify-self: start; }

  .tbl.tbl-cards td.tbl-dcol { display: block; }

  /* the Details row's list and the empty table's text take the whole card,
     not the label column */
  .tbl.tbl-cards .tbl-details-row > td,
  .tbl.tbl-cards .tbl-empty > td { display: block; }
}

/* The pager. */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.pager-status { color: var(--sas-muted); }

@media (max-width: 575.98px) {
  .pager-status { order: -1; flex-basis: 100%; }
}


/* ==========================================================================
   9. Panels, chips, badges, tabs
   ========================================================================== */

.panel {
  padding: 20px;
  background: var(--orc-tint);
}

.panel.white { background: var(--orc-white); }

.panel.ruled {
  background: none;
  padding: 0;
}

.panel + .panel { margin-top: 20px; }

.panel-title {
  margin: 0 0 15px;
  padding-bottom: 5px;
  border-bottom: var(--orc-rule);
  font-family: var(--orc-font-display);
  font-weight: 500;
  font-size: 20px;
  line-height: 24px;
}

.panel > :last-child { margin-bottom: 0; }

/* Status chips: text and icon, never colour alone. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border: 1px solid var(--orc-navy);
  background: var(--orc-white);
  color: var(--orc-navy);
  font-size: 12px;
  line-height: 14px;
  white-space: nowrap;
  vertical-align: middle;
}

.chip .icon { width: 14px; height: 14px; }

.chip.ok { border-color: var(--sas-ok); background: var(--sas-ok-bg); color: var(--sas-ok); }
.chip.warn { border-color: var(--sas-warn); background: var(--sas-warn-bg); color: var(--sas-warn); }
.chip.error { border-color: var(--orc-error); color: var(--sas-error-text); }
.chip.info { background: var(--orc-tint); }
.chip.muted { border-color: var(--sas-muted); color: var(--sas-muted); }

.chips { display: inline-flex; flex-wrap: wrap; gap: 5px; }

/* Tabs (role=tablist, or links with aria-current). */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 10px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  border-bottom: var(--orc-rule);
}

.tabs [role="tab"],
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--sas-control-h);
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--orc-navy);
  font-family: var(--orc-font-display);
  font-weight: 500;
  font-size: 16px;
  line-height: 21px;
  text-decoration: none;
  cursor: pointer;
}

.tabs [role="tab"]:hover,
.tabs a:hover { background: var(--orc-tint-hover); color: var(--orc-navy); }

.tabs [role="tab"][aria-selected="true"],
.tabs a[aria-current]:not([aria-current="false"]) {
  background: var(--orc-navy);
  color: var(--orc-white);
}

/* A definition list of facts (the boat card, the account page). */
.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 5px 20px;
  margin: 0 0 1em;
}

.facts dt { color: var(--sas-muted); }
.facts dd { margin: 0; }


/* ==========================================================================
   10. Messages and notices (messages.js, layout.js)
   ========================================================================== */

.msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 20px;
  padding: 10px 12px;
  border-left: 4px solid var(--orc-navy);
  background: var(--orc-tint);
  color: var(--orc-navy);
}

.msg .icon { flex: none; margin-top: 1px; }

.msg-text { min-width: 0; }
.msg-text p { margin: 0; }
.msg-text p + p { margin-top: 5px; }

.msg-error {
  border-left-color: var(--orc-error);
  background: var(--orc-white);
  color: var(--sas-error-text);
}

.msg-error .icon { background-color: var(--orc-error); }

.msg-ok {
  border-left-color: var(--sas-ok);
  background: var(--sas-ok-bg);
  color: var(--sas-ok);
}

.msg-warn {
  border-left-color: var(--sas-warn);
  background: var(--sas-warn-bg);
  color: var(--sas-warn);
}

.msg-info {
  border-left-color: var(--orc-navy);
  background: var(--orc-tint);
  color: var(--orc-navy);
}

.msg a { color: inherit; }

/* The standard notice that replaces a page's content (the human check
   failed, the service can't be reached). */
.notice {
  max-width: 720px;
  padding: 20px;
  border-top: 3px solid var(--orc-navy);
  background: var(--orc-tint);
}

.notice h2 { font-size: 24px; }
.notice .btn-row { margin-top: 20px; }

/* An empty list or table. */
.empty {
  margin: 0;
  padding: 15px 0;
  font-style: italic;
}

/* A stub page's line. */
.being-built {
  margin: 0;
  padding: 20px;
  background: var(--orc-tint);
  font-style: italic;
}


/* ==========================================================================
   11. Dialogs (dialog.js): native <dialog>, square, on the page colour
   ========================================================================== */

dialog.dlg {
  width: 100%;
  max-width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);   /* the visible height, toolbars aside (vh: older browsers) */
  margin: auto;
  padding: 0;
  border: var(--orc-rule);
  border-radius: 0;
  background: var(--orc-page);
  color: var(--orc-navy);
  box-shadow: none;
  overflow: hidden;
}

dialog.dlg.wide { max-width: min(1100px, calc(100vw - 32px)); }

dialog.dlg::backdrop { background: var(--orc-overlay); }

.dlg-box {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 34px);
  max-height: calc(100dvh - 34px);
  padding: 24px;
}

.dlg-title {
  margin: 0 0 15px;
  font-size: 24px;
  line-height: 1.2;
}

.dlg-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  /* room for the 3px focus ring of a full-width input inside the scroller */
  padding: 3px;
  margin: -3px;
}

.dlg-body > :last-child { margin-bottom: 0; }

.dlg-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 575.98px) {
  dialog.dlg,
  dialog.dlg.wide {
    max-width: 100%;
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;   /* the action row stays above a phone browser's toolbar */
    margin: auto 0 0;
    border-width: 1px 0 0;
  }

  .dlg-box {
    max-height: 100vh;
    max-height: 100dvh;
    padding: 20px var(--orc-gutter) calc(20px + env(safe-area-inset-bottom));
  }

  .dlg-actions .btn { flex: 1 1 auto; }
}


/* ==========================================================================
   12. Menus (menu.js): a small popup list of actions ("More ▾")
   ========================================================================== */

.menu {
  position: fixed;
  z-index: 50;
  min-width: 180px;
  max-width: calc(100vw - 16px);
  overflow-y: auto;
  padding: 0;
  border: var(--orc-rule);
  background: var(--orc-white);
}

.menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: var(--sas-control-h);
  padding: 6px 12px;
  border: 0;
  background: none;
  color: var(--orc-navy);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.menu button:hover,
.menu button:focus { background: var(--orc-tint); }

.menu button:focus-visible { box-shadow: inset var(--orc-focus); }

.menu button:disabled { opacity: .4; cursor: not-allowed; }

.menu button.danger { color: var(--sas-error-text); }

.menu-sep { border-top: var(--orc-rule-soft); margin: 2px 0; }

.menu-heading {
  padding: 6px 12px 2px;
  font-size: 12px;
  font-style: italic;
  color: var(--sas-muted);
}

.menu-tick { display: inline-block; width: 1em; }


/* ==========================================================================
   13. Icons: RaceFlow's set (img/icons) as masks over currentColor, so an
   icon takes the colour of its text. Drawn here: upload, run, sail,
   speedguide, targetspeeds, user, signout, menu, external, info, warning,
   clock, stop, lock, chevron-down, file (24x24, 2px round strokes).
   back.svg and the save icons paint their own colours: shown as images.
   error.svg and scratch.svg have filled shapes a mask turns solid: error is
   left out (use stop), scratch shows as a silhouette.
   ========================================================================== */

.icon {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  vertical-align: -4px;
  background-color: var(--icon-color, currentColor);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.icon.lg { width: 24px; height: 24px; }
.icon.sm { width: 14px; height: 14px; vertical-align: -2px; }

.icon-add          { --icon: url("../img/icons/add.svg"); }
.icon-chevron-down { --icon: url("../img/icons/chevron-down.svg"); }
.icon-clock        { --icon: url("../img/icons/clock.svg"); }
.icon-close        { --icon: url("../img/icons/close.svg"); }
.icon-copy         { --icon: url("../img/icons/copy.svg"); }
.icon-delete       { --icon: url("../img/icons/delete.svg"); }
.icon-download     { --icon: url("../img/icons/download.svg"); }
.icon-edit         { --icon: url("../img/icons/edit.svg"); }
.icon-external     { --icon: url("../img/icons/external.svg"); }
.icon-file         { --icon: url("../img/icons/file.svg"); }
.icon-import       { --icon: url("../img/icons/import.svg"); }
.icon-info         { --icon: url("../img/icons/info.svg"); }
.icon-lock         { --icon: url("../img/icons/lock.svg"); }
.icon-menu         { --icon: url("../img/icons/menu.svg"); }
.icon-ok           { --icon: url("../img/icons/ok.svg"); }
.icon-paste        { --icon: url("../img/icons/paste.svg"); }
.icon-print        { --icon: url("../img/icons/print.svg"); }
.icon-refresh      { --icon: url("../img/icons/refresh.svg"); }
.icon-run          { --icon: url("../img/icons/run.svg"); }
.icon-sail         { --icon: url("../img/icons/sail.svg"); }
.icon-scratch      { --icon: url("../img/icons/scratch.svg"); }
.icon-search       { --icon: url("../img/icons/search.svg"); }
.icon-share        { --icon: url("../img/icons/share.svg"); }
.icon-signout      { --icon: url("../img/icons/signout.svg"); }
.icon-speedguide   { --icon: url("../img/icons/speedguide.svg"); }
.icon-stop         { --icon: url("../img/icons/stop.svg"); }
.icon-targetspeeds { --icon: url("../img/icons/targetspeeds.svg"); }
.icon-upload       { --icon: url("../img/icons/upload.svg"); }
.icon-user         { --icon: url("../img/icons/user.svg"); }
.icon-warning      { --icon: url("../img/icons/warning.svg"); }
.icon-wind         { --icon: url("../img/icons/wind.svg"); }

.icon-back,
.icon-save,
.icon-saved,
.icon-saving {
  background-color: transparent;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  -webkit-mask: none;
  mask: none;
}

.icon-back   { background-image: url("../img/icons/back.svg"); }
.icon-save   { background-image: url("../img/icons/save.svg"); }
.icon-saved  { background-image: url("../img/icons/saved.svg"); }
.icon-saving { background-image: url("../img/icons/saving.svg"); }


/* ==========================================================================
   14. Money: the balance strip (layout.js) and the spend panel (spend.js)
   ========================================================================== */

.balance-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 0;
  margin: 0 0 20px;
  padding: 10px 12px;
  background: var(--orc-tint);
}

.balance-strip > span:not(:last-child)::after {
  content: "·";
  padding: 0 10px;
}

.balance-strip strong { font-weight: 700; }

.spend {
  margin-top: 10px;
  padding: 15px;
  border: var(--orc-rule);
  background: var(--orc-white);
}

.spend-title {
  margin: 0 0 10px;
  font-size: 20px;
}

.spend-price {
  margin: 0 0 10px;
  font-family: var(--orc-font-display);
  font-weight: 500;
  font-size: 20px;
  line-height: 24px;
}

.spend .facts { margin: 10px 0; }

.spend-note { margin: 0 0 10px; }

.spend .btn-row { margin-top: 15px; }


/* ==========================================================================
   15. Utilities, loading, motion, print
   ========================================================================== */

.muted { color: var(--sas-muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.num { text-align: right; }
.break { overflow-wrap: anywhere; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* Placeholder lines while something loads (layout.js loadInto). */
.loading { padding: 5px 0; }

.loading-line {
  height: 14px;
  margin: 10px 0;
  background: var(--orc-tint);
  animation: sas-pulse 1.4s ease-in-out infinite;
}

.loading-line:nth-child(2n) { width: 85%; }
.loading-line:nth-child(3n) { width: 65%; }

@keyframes sas-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  #site-header .hdr-nav,
  #site-header .hdr-user,
  #site-header .hdr-menubtn,
  #site-header .hdr-badge,
  .skip,
  #site-footer,
  .sticky-actions { display: none !important; }

  body { background: #fff; }
}


/* ==========================================================================
   16. AREA sections — the lead folds css/<area>.css in here in phase (c).
   Each area's rules stay inside its own section, every class with its
   prefix; shared needs go to the sections above (a shared-change request).
   ========================================================================== */

/* ----- AREA A · Accounts (css/account.css · .acct-) ---------------------- */

/* ----- AREA B · My Boats (css/boats.css · .boats-) ----------------------- */

/* ----- AREA C · Test runs (css/vpp.css · .vpp-) -------------------------- */

/* ----- AREA D · Products and credits (css/products.css · .prod-) --------- */

/* ----- AREA E · Editor (css/editor.css · .ed-) --------------------------- */

/* ----- AREA F · Certificates (css/certs.css · .certs-) ------------------- */

/* ----- AREA G · Home and software (css/info.css · .info-) ---------------- */

/* ----- AREA H · Light certificates (css/light.css · .light-) ------------- */
