:root {
  --ink: #102a2c;
  --ink-soft: #46605f;
  --sand: #f6f1e8;
  --card: #ffffff;
  --line: #ddd5c6;
  --teal: #0f5257;
  --teal-dark: #0b3f43;
  --sea: #14808a;
  --link: #0f6f78;
  --coral: #c2410c;
  --ok: #166534;
  --ok-bg: #dcfce7;
  --lock-bg: #fdf3ea;
  --field-edge: #8f8473;
  --focus: #0f5257;
  /* Who may open each locked part. Each text colour has at least 4.5:1 contrast with its
     badge background. */
  --operators: #24508f;
  --operators-bg: #e3ebf7;
  --operators-tint: #f5f8fd;
  --owner: #0f5257;
  --owner-bg: #d5ebe7;
  --owner-tint: #f2f9f8;
  --authority: #6b3b6c;
  --authority-bg: #f0e4f0;
  --authority-tint: #fbf6fb;
  /* The health meters. Each fill has at least 3:1 contrast with the track, and the edge
     with the panel. */
  --meter-track: #e1e9e7;
  --meter-edge: #708f8b;
  --meter-good: #1f7a4c;
  --meter-worn: #b45309;
  --meter-weak: #b42318;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--sand);
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
a { color: var(--link); text-underline-offset: 2px; }
button { font: inherit; border: 0; border-radius: 8px; padding: 10px 16px; background: var(--teal); color: #ffffff; cursor: pointer; }
button:hover { background: var(--teal-dark); }
input, select { font: inherit; padding: 9px 10px; border: 1px solid var(--field-edge); border-radius: 8px; background: #ffffff; color: var(--ink); width: 100%; }
input[aria-invalid="true"] { border-color: var(--coral); box-shadow: inset 0 0 0 1px var(--coral); }
label { font-weight: 600; display: block; margin-bottom: 4px; }

/* A visible ring on whatever has keyboard focus. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.masthead a:focus-visible { outline-color: #ffffff; }

/* The links to the five demo sites, the same on every PassportLoop site. */
.network-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 7px 16px; background: #11161d; color: #c9d1d9; font-size: 0.8rem; line-height: 1.4; }
.network-bar-label { color: #9aa4b1; }
.network-bar-sites { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; }
.network-bar a { color: #e6edf3; text-decoration: none; }
.network-bar a:hover { text-decoration: underline; }
.network-bar a:focus-visible { outline: 2px solid #e6edf3; outline-offset: 2px; border-radius: 2px; }
.network-bar a[aria-current="page"] { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.network-bar-code { margin-left: auto; }

.masthead { background: var(--teal); color: #ffffff; }
.masthead-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: #ffffff; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-name { display: block; font-weight: 800; letter-spacing: 0.2px; }
.brand-sub { display: block; font-size: 0.85rem; opacity: 0.85; }
.demo-flag { border: 1px solid rgba(255, 255, 255, 0.6); border-radius: 999px; padding: 2px 10px; font-size: 0.8rem; white-space: nowrap; }

.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin: 0 0 8px; line-height: 1.2; }
.hero > p { max-width: 70ch; color: var(--ink-soft); }
.lookup { margin-top: 16px; max-width: 520px; }
.lookup-row { display: flex; gap: 8px; }
.lookup-row input { min-width: 0; }
.lookup-row button { white-space: nowrap; }
.hint, .note, .form-note { font-size: 0.9rem; color: var(--ink-soft); }
.form-error { color: var(--coral); font-weight: 600; }

.passport { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 18px 0; box-shadow: 0 1px 2px rgba(16, 42, 44, 0.06); }
.passport-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.passport-head > div { min-width: 0; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; color: var(--sea); font-weight: 700; }
.passport-head h2 { margin: 2px 0; font-size: 1.5rem; line-height: 1.25; }
.subtitle { margin: 0; color: var(--ink-soft); font-size: 0.92rem; }

/* Tier badges: "Public" on the passport, and who may open each locked part. */
.tier-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 11px 3px 9px; font-size: 0.8rem; font-weight: 700; line-height: 1.35; white-space: nowrap; }
.lock-icon { width: 13px; height: 13px; flex: none; }
.tier-badge.open { background: var(--ok-bg); color: var(--ok); }
.tier-badge.tier-operators { background: var(--operators-bg); color: var(--operators); }
.tier-badge.tier-owner { background: var(--owner-bg); color: var(--owner); }
.tier-badge.tier-authority { background: var(--authority-bg); color: var(--authority); }

/* Two columns on wide screens, so the four groups sit in two even rows. */
.fact-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 8px 32px; margin-top: 8px; }
.fact-groups h3 { font-size: 1rem; margin: 14px 0 6px; color: var(--teal); }
.facts { margin: 0; display: grid; gap: 6px; }
.facts div { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 8px; border-bottom: 1px dashed #eee6d8; padding-bottom: 6px; }
.facts dt { color: var(--ink-soft); font-size: 0.9rem; }
.facts dd { margin: 0; font-size: 0.95rem; overflow-wrap: anywhere; }
.data-facts { font-size: 0.8rem; color: var(--ink-soft); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere; }

.restricted, .owner { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.restricted h3, .owner h3 { margin: 0 0 6px; }
.locked-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; margin: 12px 0; }
/* Each card has a stripe and a light tint in its tier's colour. */
.locked-card { --tier-accent: #e0b58f; --tier-tint: var(--lock-bg); background: var(--tier-tint); border: 1px solid var(--line); border-radius: 10px; padding: 16px 14px 12px; box-shadow: inset 0 4px 0 var(--tier-accent); }
.locked-card.tier-operators { --tier-accent: var(--operators); --tier-tint: var(--operators-tint); }
.locked-card.tier-owner { --tier-accent: var(--owner); --tier-tint: var(--owner-tint); }
.locked-card.tier-authority { --tier-accent: var(--authority); --tier-tint: var(--authority-tint); }
.locked-card h4 { margin: 0 0 6px; font-size: 0.95rem; }
.locked-card p { margin: 4px 0; font-size: 0.88rem; }
.locked-card .locked-card-tier { margin: 0 0 8px; }
.locked-card .basis { color: var(--ink-soft); font-size: 0.78rem; }

.owner-form { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(220px, 2fr) auto; gap: 12px; align-items: end; margin-top: 10px; }
.owner-form button:disabled { opacity: 0.7; cursor: progress; }
.health { margin-top: 14px; background: #f3faf9; border: 1px solid #cfe6e3; border-radius: 10px; padding: 14px 16px 16px; }
.health-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 10px; }
.health h4 { margin: 0; }

/* The two health meters, side by side when there is room. */
.soh-meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 14px 28px; }
.soh { display: grid; gap: 4px; align-content: start; }
.soh .soh-name { margin: 0; font-size: 0.92rem; }
.soh-reading { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; }
.soh-value { font-size: 1.8rem; font-weight: 800; line-height: 1.15; color: var(--teal); }
.soh-band { border-radius: 999px; padding: 1px 9px; font-size: 0.8rem; font-weight: 700; }
.soh-band:empty { display: none; }
.band-good { background: #dcfce7; color: #14532d; }
.band-worn { background: #ffedd5; color: #7c2d12; }
.band-weak { background: #fee2e2; color: #7f1d1d; }
.soh-scale { margin: 10px 0 12px; font-size: 0.85rem; color: var(--ink-soft); }

/* Without appearance: none, Chromium and Firefox each draw their own meter and ignore
   these colours. Chromium styles the parts with ::-webkit-meter-*, Firefox with
   ::-moz-meter-bar and its :-moz-meter-* states. A browser drops a rule with a selector it
   does not know, so each selector has its own rule. Chromium ignores a percentage height
   on its bar, so the bar gets the meter's inner height in pixels: 14px less two 1px
   borders. */
.soh-meter { display: block; width: 100%; height: 14px; margin: 4px 0 0; -webkit-appearance: none; -moz-appearance: none; appearance: none; background: var(--meter-track); border: 1px solid var(--meter-edge); border-radius: 999px; overflow: hidden; }
.soh-meter::-webkit-meter-bar { height: 12px; background: transparent; border: 0; border-radius: 999px; }
.soh-meter::-webkit-meter-optimum-value { background: var(--meter-good); border-radius: 999px; }
.soh-meter::-webkit-meter-suboptimum-value { background: var(--meter-worn); border-radius: 999px; }
.soh-meter::-webkit-meter-even-less-good-value { background: var(--meter-weak); border-radius: 999px; }
.soh-meter::-moz-meter-bar { background: var(--meter-good); border-radius: 999px; }
.soh-meter:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--meter-worn); }
.soh-meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--meter-weak); }

.footer { padding: 18px 16px 40px; font-size: 0.85rem; color: var(--ink-soft); }

/* The owner's share window (bridge/health-window.js). */
.window-main { max-width: 720px; margin: 0 auto; padding: 16px 16px 32px; }
.window-intro h1 { font-size: 1.4rem; line-height: 1.25; margin: 12px 0 6px; }
.window-intro p { margin: 0; color: var(--ink-soft); }
.window-card { margin: 14px 0; }
.window-card h2 { font-size: 1.1rem; margin: 0 0 10px; }
/* The recipient and the purpose come first, in two tinted boxes in Tidewheel's teal. */
.window-key-facts { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 10px; margin-bottom: 14px; }
.facts.window-key-facts div { display: block; background: var(--owner-tint); border: 1px solid #cfe6e3; border-left: 4px solid var(--teal); border-radius: 8px; padding: 8px 12px; }
.window-key-facts dt { color: var(--teal); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.window-key-facts dd { margin-top: 2px; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.window-subhead { margin: 0 0 6px; font-size: 0.95rem; }
.window-card .shared-fields { margin: 0 0 14px; padding: 10px 12px 10px 30px; background: #fbf9f5; border: 1px solid var(--line); border-radius: 8px; }
.shared-fields li { margin: 3px 0; }
.shared-fields li::marker { color: var(--teal); }
.window-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.window-actions button { min-height: 44px; padding: 10px 18px; font-weight: 600; }
.window-result { border-left: 4px solid var(--ok); }
.window-result.declined { border-left-color: var(--ink-soft); }
.window-result h2 { color: var(--ok); }
.window-result.declined h2 { color: var(--ink); }
button.secondary { background: transparent; color: var(--teal); border: 1px solid var(--teal); }
button.secondary:hover { background: #e7f1f0; }
.field { margin-top: 6px; }
.demo-fill, #owner-demo-fill { padding: 6px 12px; font-size: 0.88rem; margin: 8px 6px 0 0; }

@media (max-width: 700px) {
  /* The badge goes above the eyebrow, so the title and its details get the card's full width. */
  .passport-head { flex-direction: column-reverse; gap: 6px; }
  .owner-form { grid-template-columns: 1fr; }
  .facts div { grid-template-columns: 1fr; gap: 0; }
  .brand-sub { display: none; }
}

/* Forced colours replace the meter's colours with system ones, which would hide the fill.
   Keep the fill and track colours, which contrast with each other. */
@media (forced-colors: active) {
  .soh-meter { forced-color-adjust: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none; transition: none; scroll-behavior: auto; }
}
