/* NordicWarden: one design for every page (front page, map, account, admin).
   The accent colour comes from branding/site.json through /brand.css. */

:root {
  --accent: #0f5c8c;
  --accent-ink: #fff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --text: #17202b;
  --muted: #5a6573;
  --line: #d8dee5;
  --bad: #b42318; --bad-soft: #fdecea;
  --ok: #1d7a3a;  --ok-soft: #e8f5ec;
  --warn: #9a6200; --warn-soft: #fff4dc;
  /* risk bands, the same on the map, in lists and chips */
  --risk-none: #8a94a6; --risk-low: #d9a400; --risk-mid: #ee7a12; --risk-high: #d62a2f;
  --naval: #3557d6; --gov: #0b7a75;
  --radius: 10px; --radius-s: 6px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.06);
  --bar-h: 60px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light dark;
}
/* dark colours: the device's own setting, or the button in the top bar (html[data-theme], set by a11y.js) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1118; --surface: #141c25; --surface-2: #1c2632; --text: #e7ecf2; --muted: #9aa6b4; --line: #2a3644;
    --bad: #ff8a80; --bad-soft: #3a1d1d; --ok: #7ad69a; --ok-soft: #173326; --warn: #f2c063; --warn-soft: #3a2f16;
    --link: #7cc0ee;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1118; --surface: #141c25; --surface-2: #1c2632; --text: #e7ecf2; --muted: #9aa6b4; --line: #2a3644;
  --bad: #ff8a80; --bad-soft: #3a1d1d; --ok: #7ad69a; --ok-soft: #173326; --warn: #f2c063; --warn-soft: #3a2f16;
  --link: #7cc0ee;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.55 var(--font); background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--link, var(--accent)); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(26px, 3vw, 34px); letter-spacing: -.01em; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 1em; }
code { font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 2000; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-s); }
.skip:focus { left: 8px; }

/* ---------- top bar ---------- */
.topbar { height: var(--bar-h); display: flex; align-items: center; gap: 28px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1000; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.01em;
  color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 15px; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--text); text-decoration: none; font-weight: 600; padding: 8px 12px; border-radius: var(--radius-s); }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--link, var(--accent)); background: var(--accent-soft); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.btn.topbar-apply { gap: 0; }
.topbar-apply .long::before { content: "\00a0"; }   /* one space, also inside the flex button */

/* user menu: a <details> dropdown */
.usermenu { position: relative; }
.usermenu > summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px;
  border-radius: 999px; border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu > summary::after { content: "▾"; color: var(--muted); font-size: 12px; }
.usermenu[open] > summary { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid;
  place-items: center; font-size: 13px; font-weight: 700; }
.usermenu .menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 1100; }
.usermenu .menu .who { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; font-size: 14px; }
.usermenu .menu .who b { display: block; }
.usermenu .menu a, .usermenu .menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: var(--radius-s);
  color: var(--text); text-decoration: none; font: inherit; font-size: 15px; background: none; border: 0; cursor: pointer; }
.usermenu .menu a:hover, .usermenu .menu button:hover { background: var(--surface-2); }
.usermenu .menu form { margin: 6px 0 0; border-top: 1px solid var(--line); padding-top: 6px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border-radius: var(--radius-s); font: inherit; font-weight: 650; font-size: 15px; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; line-height: 1.2; white-space: nowrap; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-quiet { background: none; color: var(--link, var(--accent)); padding-left: 8px; padding-right: 8px; }
.btn-quiet:hover { background: var(--accent-soft); }
.btn-danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 14px; }
.btn-lg { min-height: 48px; padding: 12px 22px; font-size: 17px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 20px; }

/* ---------- layout ---------- */
main { flex: 1; }
.page { max-width: 1120px; margin: 0 auto; padding: 40px 24px 56px; }
.page-narrow { max-width: 760px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid3 > .card + .card, .tiles > * + * { margin-top: 0; }   /* side by side: level with each other */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.stack > * + * { margin-top: 16px; }
.section { margin-top: 48px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }

/* ---------- auth pages (log in, apply, two-factor, password) ---------- */
.auth { max-width: 460px; margin: 48px auto; padding: 0 20px; }
.auth.wide { max-width: 620px; }
.auth-head { text-align: center; margin-bottom: 20px; }
.auth-head h1 { font-size: 26px; margin-bottom: 6px; }
.auth-head p { color: var(--muted); margin: 0; }
.auth .card { padding: 28px; }
.auth-foot { text-align: center; margin-top: 18px; color: var(--muted); font-size: 15px; }
.auth-foot a { font-weight: 600; }

/* ---------- forms ---------- */
.field { margin-top: 16px; }
.field:first-child { margin-top: 0; }
label, .label { display: block; font-weight: 650; font-size: 15px; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], textarea, select {
  width: 100%; padding: 10px 12px; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-s); min-height: 42px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: 3px solid var(--accent-soft); outline-offset: 0; }
.help, .helptext { color: var(--muted); font-size: 14px; margin-top: 6px; }
.help ul { margin: 4px 0 0; padding-left: 18px; }
.errorlist { color: var(--bad); margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.field.has-error input, .field.has-error textarea { border-color: var(--bad); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin: 12px 0 0; }
.check input { width: 18px; height: 18px; margin-top: 3px; flex: none; }   /* never squeezed by a long label */
/* a longer explanation goes under the label, not beside it in a ragged column */
.check { flex-wrap: wrap; }
.check > .help { flex: 0 0 100%; margin: 0 0 4px; padding-left: 28px; font-weight: 400; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.code-input { font-size: 22px; letter-spacing: .3em; text-align: center; max-width: 220px; }

/* ---------- messages and alerts ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li, .alert { padding: 12px 14px; border-radius: var(--radius-s); border: 1px solid; font-size: 15px; }
.messages li + li { margin-top: 8px; }
.messages li.success, .alert-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); }
.messages li.error, .alert-error, .alert { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--bad); }
.messages li.warning, .alert-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
.messages li.info, .alert-info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--text); }

/* ---------- tables, badges, risk ---------- */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 650; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 650; background: var(--surface-2); color: var(--muted); }
.badge-ok { background: var(--ok-soft); color: var(--ok); } .badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.risk { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; padding: 2px 9px; border-radius: 999px;
  color: #fff; background: var(--risk-none); font-variant-numeric: tabular-nums; }
/* text that reads on each colour (WCAG AA): dark on grey, yellow and orange, white on red, blue and green */
.risk-none, .risk:not([class*="risk-"]) { color: #10151c; }
.risk-low { background: var(--risk-low); color: #241a00; } .risk-mid { background: var(--risk-mid); color: #241a00; } .risk-high { background: var(--risk-high); color: #fff; }
.risk-naval { background: var(--naval); color: #fff; } .risk-gov { background: var(--gov); color: #fff; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--risk-none); vertical-align: baseline; }
.dot.receiving, .dot.ok, .dot.done { background: var(--ok); } .dot.connecting, .dot.old { background: var(--risk-low); }
.dot.no-data, .dot.error { background: var(--bad); } .dot.running { background: var(--accent); }
.bar { height: 8px; background: var(--accent); border-radius: 4px; min-width: 1px; }
.big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.stats { display: flex; gap: 28px; flex-wrap: wrap; }

/* ---------- front page ---------- */
/* a sea chart at night: deep navy, a faint graticule, the ships as points of light */
.hero { color: #fff; background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 100% 56px,
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 56px 100%,
    radial-gradient(1100px 520px at 78% 30%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%),
    linear-gradient(170deg, #071a2c 0%, #0a2238 55%, #06131f 100%); }
.hero .page { padding-top: 64px; padding-bottom: 28px; }
.hero .hero-figures { padding-top: 0; padding-bottom: 56px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(30px, 3.8vw, 44px); letter-spacing: -.02em; }
.hero p.lead { font-size: 19px; max-width: 560px; opacity: .92; }
.hero .kicker { font-size: 13px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; opacity: .8; margin-bottom: 14px; }
.hero-map { position: relative; display: block; border-radius: 14px; overflow: hidden; border: 1px solid rgba(255,255,255,.16);
  background: rgba(3,12,22,.55); box-shadow: 0 20px 60px rgba(0,0,0,.45); aspect-ratio: 900 / 886; max-width: 470px; justify-self: end; width: 100%; }
.hero-map img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero-map:hover { border-color: rgba(255,255,255,.4); }
.hero-map-cap { position: absolute; left: 12px; bottom: 10px; font-size: 13px; font-weight: 600; color: #fff; background: rgba(3,12,22,.7);
  padding: 4px 10px; border-radius: 999px; }
.hero .btn-secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.55); }
.hero .btn-secondary:hover { background: rgba(255,255,255,.1); }
.hero .btn-primary { background: #fff; color: #0a2238; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 28px; }
.figure { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-top: 3px solid #7fc4ee;
  border-radius: var(--radius); padding: 14px 16px; }
.fig-mid { border-top-color: var(--risk-mid); } .fig-high { border-top-color: var(--risk-high); } .fig-naval { border-top-color: #8aa2ff; }
.figure b { display: block; font-size: 30px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.figure span { font-size: 14px; opacity: .85; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; margin-right: 6px;
  box-shadow: 0 0 0 3px rgba(74,222,128,.25); }
.feature h3 { display: flex; gap: 10px; align-items: center; }
.feature { border-top: 3px solid var(--feat, var(--accent)); }
.feature .icon { flex: none; width: 36px; height: 36px; border-radius: 9px; background: color-mix(in srgb, var(--feat, var(--accent)) 16%, transparent);
  color: var(--feat, var(--accent)); display: grid; place-items: center; font-size: 18px; }
.feat-risk { --feat: var(--risk-mid); } .feat-cable { --feat: #7b4fd0; } .feat-naval { --feat: var(--naval); }
.eventlist { list-style: none; margin: 0; padding: 0; }
.eventlist li { display: flex; gap: 12px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--line); }
.eventlist li:last-child { border-bottom: 0; }
.eventlist .when { color: var(--muted); font-size: 14px; white-space: nowrap; min-width: 64px; }
.prose { max-width: 720px; } .prose h2 { margin-top: 36px; } .prose li { margin-bottom: 6px; }
.note { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 12px 16px; border-radius: 0 var(--radius-s) var(--radius-s) 0; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 14px; }
.footer .page { padding-top: 22px; padding-bottom: 22px; display: flex; gap: 16px 32px; flex-wrap: wrap; justify-content: space-between; }
.footer a { color: var(--muted); }

/* ---------- auth extras ---------- */
.steps { padding-left: 20px; margin: 0 0 8px; } .steps li { margin-bottom: 12px; }
.qr { display: block; margin: 10px 0 6px; background: #fff; border-radius: var(--radius-s); padding: 6px; }
.key, .codes { user-select: all; }
.codes { font-size: 18px; line-height: 1.8; background: var(--surface-2); padding: 12px 16px; border-radius: var(--radius-s); margin: 0; }
.auth .card + .card, .auth .card + p { margin-top: 16px; }
.auth .card h2 { font-size: 18px; }
.auth-head .badge { vertical-align: 1px; }

/* ---------- admin area ---------- */
.adminlayout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - var(--bar-h)); }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px; }
.sidebar-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 0 12px 8px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; position: sticky; top: calc(var(--bar-h) + 20px); }
.sidebar a { display: block; padding: 9px 12px; border-radius: var(--radius-s); color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; }
.sidebar a:hover { background: var(--surface-2); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.admincontent { padding: 28px 32px 56px; max-width: 1180px; min-width: 0; }
.adminhead { margin-bottom: 20px; } .adminhead h1 { font-size: 28px; margin-bottom: 4px; } .adminhead p { margin: 0; }
.admincontent > .alert, .admincontent > .messages { margin-bottom: 16px; }
.card.flush { padding: 0; overflow-x: auto; } .card.flush table th:first-child, .card.flush table td:first-child { padding-left: 20px; }
.card h2 { font-size: 19px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--text); text-decoration: none; }
a.tile:hover { border-color: var(--accent); }
.tile b { display: block; font-size: 30px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 14px; }
.tile small { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.tile small.up { color: var(--bad); } .tile small.down { color: var(--ok); }
.tile-listed { border-left: 4px solid var(--risk-high); } .tile-naval { border-left: 4px solid var(--naval); }
.tile-risk { border-left: 4px solid var(--risk-mid); }
.problems { list-style: none; margin: 0; padding: 0; }
.problem { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 12px 14px; border-radius: var(--radius-s); margin-bottom: 8px;
  border-left: 4px solid var(--accent); background: var(--surface-2); }
.problem-error { border-left-color: var(--bad); } .problem-warn { border-left-color: var(--risk-low); }
.toolbar { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.segmented { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 9px; }
.segmented a { padding: 7px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 650; font-size: 14px; }
.segmented a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.segmented .count { color: var(--muted); font-weight: 500; margin-left: 2px; }
.searchform input { width: 280px; }
.facts th { width: 38%; text-transform: none; letter-spacing: 0; font-size: 14px; }
.actionlist { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
details.danger { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
details.danger summary { color: var(--bad); cursor: pointer; font-weight: 600; }
.keyrow { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(140px, .8fr) minmax(260px, 1.4fr); gap: 12px 20px; align-items: start;
  padding: 14px 0; border-bottom: 1px solid var(--line); }
.keyrow:last-child { border-bottom: 0; }
.keyrow label { margin-bottom: 2px; }
.keystate code { font-size: 13px; }
.keyedit { display: flex; gap: 8px; align-items: center; }
.keyedit input { min-height: 34px; padding: 6px 10px; }
.actions.top { margin: 0 0 6px; }
.feedrow, .switchrow { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.feedrow:last-child, .switchrow:last-of-type { border-bottom: 0; }
.feedrow form, .switchrow > button { flex: none; }
.warn { color: var(--warn); }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form label { margin: 0; }
.inline-form select { width: auto; max-width: 100%; }
.inline-form.compact select { min-height: 34px; padding: 4px 8px; }
.numgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 20px; }
.numgrid .field { margin-top: 16px; }
.weights td:last-child { width: 140px; } .weights input { width: 100px; text-align: right; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 16px; }
fieldset { border: 0; padding: 0; margin: 16px 0 0; }
.regiongroup legend { font-weight: 700; font-size: 15px; padding: 0; margin-bottom: 2px; }
.regiongroup .check { font-weight: 400; }
.jobline { margin-top: 4px; }
.recgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 24px; margin-top: 14px; align-items: start; }
.recgrid input[type=number] { width: 110px; min-height: 34px; padding: 4px 8px; }
.recgrid .inline-form label { width: 100%; margin-bottom: 2px; }
meter.usage { width: 100%; height: 10px; }
.barcol { width: 30%; }

/* ---------- how membership works ---------- */
.joinsteps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px;
  counter-reset: step; }
.joinsteps li { counter-increment: step; margin: 0; }
.joinsteps .card + .card { margin-top: 0; }
.joinsteps + p { margin-top: 14px; }
.joinsteps li > b { display: flex; gap: 10px; align-items: center; font-size: 17px; }
.joinsteps li > b::before { content: counter(step); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent);
  color: var(--accent-ink); display: grid; place-items: center; font-size: 15px; }
.joinsteps p { margin: 10px 0 0; color: var(--muted); font-size: 15px; }

/* ---------- what visitors and members can see ---------- */
.access th[scope=row] { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--text); font-weight: 400; width: 60%; }
.access th[scope=row] b { display: block; }
.access th[scope=row] .help { display: block; margin-top: 2px; }
.access .c { text-align: center; vertical-align: middle; white-space: nowrap; }
.access .yes { color: var(--ok); font-weight: 800; font-size: 18px; } .access .no { color: var(--muted); }
.access tr.extra td:last-child { background: var(--accent-soft); }
.access tbody tr:last-child th, .access tbody tr:last-child td { border-bottom: 0; }
.hero .small-lead { font-size: 17px; opacity: .85; }
.memberbox { background: var(--accent-soft); border-radius: var(--radius-s); padding: 14px 16px; margin-bottom: 20px; }
.memberbox h2 { font-size: 16px; margin-bottom: 8px; }
.extras { margin: 0; padding-left: 18px; } .extras li { margin-bottom: 8px; } .extras .help { display: block; margin-top: 1px; }

/* ---------- accessibility mode (the Aa button in the top bar) ---------- */
.a11ybtn { min-width: 40px; height: 36px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
.a11ybtn:hover { background: var(--surface-2); }
.a11ybtn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.themebtn { font-size: 17px; font-weight: 400; }
html.a11y { font-size: 112.5%; }
html.a11y body { font-size: 18px; line-height: 1.65; }
html.a11y { --muted: #3b4552; --line: #8792a0; --surface-2: #e3e8ee; }
@media (prefers-color-scheme: dark) { html.a11y:not([data-theme="light"]) { --muted: #d0d8e2; --line: #7a8796; --surface-2: #26313e; } }
html.a11y[data-theme="dark"] { --muted: #d0d8e2; --line: #7a8796; --surface-2: #26313e; }
html.a11y a { text-decoration: underline; text-underline-offset: 3px; }
html.a11y .btn, html.a11y a.btn { text-decoration: none; min-height: 46px; font-size: 16px; }
html.a11y .btn-sm { min-height: 40px; }
html.a11y :focus-visible { outline-width: 4px; outline-offset: 3px; }
html.a11y input, html.a11y select, html.a11y textarea { border-width: 2px; min-height: 48px; font-size: 17px; }
html.a11y .card, html.a11y .tile, html.a11y .usermenu > summary { border-width: 2px; }
html.a11y .nav a, html.a11y .sidebar a { padding-top: 11px; padding-bottom: 11px; }
html.a11y .small, html.a11y .help, html.a11y .badge, html.a11y th { font-size: 15px; }
html.a11y *, html.a11y *::before, html.a11y *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {   /* tablets and narrow windows: the top bar no longer ran off the screen (761-1000 px) */
  .topbar { gap: 14px; }
  .topbar-apply .long { display: none; }
  .nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav a { white-space: nowrap; }
}
@media (max-width: 480px) { .themebtn { display: none; } }   /* the phone's own dark setting decides there */
@media (max-width: 420px) {
  .topbar-apply { display: none; }       /* on the smallest phones: Log in stays, applying is on the front page */
  .nav a[href="/about/"], .nav a[href="/contact/"] { display: none; }   /* both are in the footer */
  .langswitch button { min-width: 32px; }
  .nav { gap: 0; } .nav a { padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 760px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand span.brand-name { display: none; }
  .nav a { padding: 8px 8px; }
  .topbar-end { gap: 6px; }
  .topbar-end .btn-quiet { padding-left: 8px; padding-right: 8px; }
  .topbar-apply .long { display: none; }
  .nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav a { white-space: nowrap; }
  .page { padding: 28px 16px 40px; }
  .eventlist li { flex-direction: column; gap: 2px; }   /* the time above the event: they ran into each other */
  .eventlist .when { min-width: 0; font-size: 13px; }
  /* the visitor/member table: one block per row - the text on top, the two answers side by side below it */
  .access thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .access, .access tbody { display: block; }
  .access tr { display: grid; grid-template-columns: 1fr 1fr; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .access tbody tr:last-child { border-bottom: 0; }
  .access th[scope=row] { grid-column: 1 / -1; width: auto; padding: 0 0 10px !important; border: 0; }
  .access td.c { border: 0; padding: 8px 10px; text-align: left; white-space: normal; font-size: 14px; background: var(--surface-2);
    display: flex; flex-direction: column; gap: 2px; }
  .access td.c:first-of-type { border-radius: var(--radius-s) 0 0 var(--radius-s); }
  .access td.c:last-child { border-radius: 0 var(--radius-s) var(--radius-s) 0; }
  .access td.c::before { content: attr(data-label); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); }
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero-map { justify-self: stretch; max-width: none; }
  .hero .page { padding-top: 40px; }
  .hero .hero-figures { padding-bottom: 36px; }
  .figures { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }
  .figure b { font-size: 24px; } .figure span { font-size: 13px; }
  .row2 { grid-template-columns: 1fr; }
  .adminlayout { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; overflow-x: auto; }
  .sidebar-title { display: none; }
  .sidebar ul { display: flex; gap: 4px; position: static; }
  .sidebar a { white-space: nowrap; }
  .admincontent { padding: 20px 16px 40px; }
  .keyrow { grid-template-columns: 1fr; }
  .keyedit { flex-wrap: wrap; }
}

/* messages to the admins: the member's own list on the contact page, and the admin's view of one */
.msgitem { padding: .75rem 0; border-top: 1px solid var(--line, #d0d7de); }
.msgitem:first-of-type { border-top: 0; }
.msgitem p { margin: .25rem 0; }
.msgtext, .msgreply { white-space: normal; overflow-wrap: anywhere; }
blockquote.msgtext, .msgreply { margin: .5rem 0; padding: .5rem .75rem; border-left: 3px solid var(--line, #d0d7de); }
.msgreply { border-left-color: var(--accent); }

/* statistics page: bar charts drawn as SVG on the server, the gate table, the latest passages */
.bars { margin: 8px 0 0; }
.bars svg { width: 100%; height: 160px; display: block; }
.bars rect { fill: var(--bar, var(--accent)); }
.bars rect:hover { fill: color-mix(in srgb, var(--bar, var(--accent)) 70%, #000); }
.parts { width: fit-content; max-width: 100%; margin: 4px 0 18px; }
.facts-now { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.facts-now li { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--risk-high); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); }
.facts-now b { display: block; font-size: 28px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.facts-now span { color: var(--muted); font-size: 14.5px; }
.facts-now .fact-gate-tankers { border-left-color: var(--risk-mid); } .facts-now .fact-naval-week { border-left-color: var(--naval); }
.count { color: var(--muted); font-weight: 500; font-size: .8em; }
.chart-listed { --bar: var(--risk-high); } .chart-naval { --bar: var(--naval); }
.barvals { list-style: none; margin: 6px 0 0; padding: 0; display: flex; }
.barvals li { flex: 1; min-width: 0; text-align: center; font-size: 13px; line-height: 1.3; }
.barvals b { display: block; font-variant-numeric: tabular-nums; }
.barvals span { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; }
@media (max-width: 760px) { .barvals li:nth-child(even) span { visibility: hidden; } }
.bars figcaption { display: flex; justify-content: space-between; margin-top: 4px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.transits { list-style: none; padding: 0; margin: 0; }
.transits li { padding: 6px 0; border-top: 1px solid var(--line); }
.transits li:first-child { border-top: 0; }

/* ship page */
.shipline { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 16px; }
.badge-quiet { background: var(--surface-2); color: var(--text); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* alerts: the bell in the top bar, new alerts on the page */
.bell { position: relative; display: inline-flex; align-items: center; text-decoration: none; font-size: 18px; padding: 4px 6px; }
.bell-count { position: absolute; top: -2px; right: -6px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  background: var(--bad); color: #fff; font: 700 11px/18px system-ui, sans-serif; text-align: center; }
.alert-new { background: var(--accent-soft); }

/* the NO / EN switch in the top bar */
.langswitch { margin: 0; }
.langswitch button { font: 700 13px/1 system-ui, sans-serif; min-width: 38px; height: 38px; border: 1px solid var(--line);
  border-radius: var(--radius-s); background: var(--surface); color: var(--text); cursor: pointer; }
.langswitch button:hover { background: var(--surface-2); }

/* company network: server-drawn SVG */
.network { padding: 8px; overflow-x: auto; }
.network svg { width: 100%; max-width: 1160px; height: auto; display: block; margin: 0 auto; }
.net-edge { stroke: var(--line); stroke-width: 1; }
.net-main { stroke: var(--accent); stroke-width: 2; }
.net-ship { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
.net-party { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; }
.net-bad { stroke: var(--bad); fill: var(--bad-soft); }
.net-root { fill: var(--accent); }
.net-label { font: 11px system-ui, sans-serif; fill: var(--text); }
.net-label, .net-plabel, .net-rlabel { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.net-plabel { font: 600 11px system-ui, sans-serif; fill: var(--text); }
.net-rlabel { font: 700 14px system-ui, sans-serif; fill: var(--text); }
.network a:hover .net-ship { stroke-width: 3; }

.flag { width: 20px; height: 15px; margin-right: 6px; vertical-align: -2px; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); object-fit: cover; }
.shipphoto-page { margin: 0 0 16px; }
.shipphoto-page img { width: 100%; max-height: 360px; object-fit: cover; border-radius: var(--radius); display: block; }
