/* ===========================================================
   Aonfinn — wireframe stylesheet
   4M Controls brand palette (light)
   Matches the deck (theme1.xml extracted from the 4MC template)
   and 4mcontrols.com.
   ----------------------------------------------------------- */

/* Encode Sans (OFL-1.1), the 4M Controls logo face, served from the site for figures. */
@font-face {
  font-family: "Encode Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url("../vendor/encode-sans/encode-sans-latin-wght-normal.a340e0e63fbe.woff") format("woff");
}
/* Inter (OFL-1.1), served from the site so every device shows the same type. */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../vendor/inter/inter-latin-wght-normal.260c81a4759b.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ----- Brand colours (from 4MC theme) ----- */
  --navy:         #0E2841;   /* dk2 — headings, primary text */
  --navy-soft:    #1F3D5F;
  --steel:        #1D6FB8;   /* the 4M Controls blue, darkened to read as text on white */
  --steel-light:  #389DE7;
  --sky:          #1D6FB8;   /* links and accents as text */
  --sky-light:    #7BBCEE;
  --sky-pale:     #E3F0FB;
  --orange:       #E97132;   /* accent2 — warm signal */
  --green:        #4EA72E;   /* accent6 — OK / healthy */
  --red:          #C0392B;   /* error / critical */

  /* ----- Surfaces ----- */
  --bg:           #FFFFFF;
  --bg-soft:      #F7F9FC;
  --bg-pale:      #F2F5F8;
  --bg-ice:       #EFF4F9;

  /* ----- Text ----- */
  --ink:          #0E2841;
  --ink-soft:     #1F3D5F;
  --muted:        #566372;   /* grey text: 5.6:1 or better on every light surface */
  --muted-2:      #647180;   /* fainter grey text, still 4.5:1 */

  /* ----- States ----- */
  --ok:           var(--green);
  --warn:         var(--orange);
  --bad:          var(--red);

  /* ----- Lines & shadows ----- */
  --border:       #D6DEE7;
  --border-soft:  #E5EAF0;
  --shadow-sm:    0 1px 2px rgba(14, 40, 65, 0.06);
  --shadow:       0 4px 16px rgba(14, 40, 65, 0.10);

  /* ----- Layout ----- */
  --radius-sm:    4px;
  --radius:       6px;
  --radius-lg:    10px;
  --topbar-h:     64px;
  --page-max:     1280px;

  /* ----- Page ground, top bar and the saved-fuel figure ----- */
  --page-bg:      #F3F5F8;   /* cards sit white on it, so they need no border */
  --bar-bg:       #0E2841;   /* the top bar: navy on a light page, graphite on a dark one */
  --bar-fg:       #FFFFFF;
  --bar-fg-soft:  #C9D6E3;
  --bar-hover:    rgba(255, 255, 255, 0.12);
  --saved-fg:     #2F7A18;   /* green text for fuel saved: 4.5:1 on white */

  /* ----- Type ----- */
  --font-sans:    "Inter Variable", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-head:    "Encode Sans", "Inter Variable", "Segoe UI", system-ui, sans-serif;  /* the logo face */
  --font-mono:    "JetBrains Mono", "Consolas", monospace;
  --font-num:     "Encode Sans", "Inter Variable", "Segoe UI", system-ui, sans-serif;  /* the 4M Controls logo face, for figures */
  --brand:        #389DE7;   /* the 4M Controls blue, the same in both themes */

  /* ----- Semantic surfaces that flip explicitly in dark mode ----- */
  /* These raw pastels can't be derived from the brand vars, so status pills,
     compliance verdicts and flash messages read them by name and the dark
     block below re-points each one. */
  --invert-bg:    var(--navy);   /* dark chip / tooltip on a light page */
  --ok-bg:        #E8F4DD;  --ok-fg:   #2E6B17;  --ok-bd:   #C5E2A8;
  --warn-bg:      #FCE9D6;  --warn-fg: #A8500F;  --warn-bd: #F5C194;
  --bad-bg:       #F8DAD5;  --bad-fg:  #8B1F11;  --bad-bd:  #EBA29A;

  /* Buttons: solid dark chips (high contrast). Inputs: soft pale inset fields. */
  --btn-bg:            #0E2841;
  --btn-bg-hover:      #163554;
  --btn-border:        #0E2841;
  --btn-fg:            #ffffff;
  --btn-primary-bg:    #0E2841;
  --btn-primary-fg:    #ffffff;
  --btn-primary-hover: #163554;
  --btn-shadow:        none;
  --btn-shadow-hover:  none;
  /* One size for every .btn (page head, equipment toolbar, forms). */
  --btn-height:        40px;
  --btn-pad-y:         8px;
  --btn-pad-x:         16px;
  --btn-font-size:     15.5px;
  --btn-min-width:     10.5rem; /* clusters of peer actions sit closer in size */
}

/* ---------- Dark theme ----------
   Light (:root above) is the default — the 4M Controls brand palette. Adding
   `class="dark"` on <html> re-points the same custom properties to dark
   values; every rule reads the variables, so this one block re-skins the whole
   UI. Set per user via the topbar toggle (users.User.theme), rendered on the
   <html> tag server-side — no flash, no JS, CSP-safe. */
html.dark {
  color-scheme: dark;

  --navy:         #EFF0F1;   /* heading ink, light on dark */
  --navy-soft:    #C7C9CC;
  --steel:        #389DE7;
  --steel-light:  #6CB6EE;
  --sky:          #389DE7;
  --sky-light:    #6CB6EE;
  --sky-pale:     #1F2A35;

  --bg:           #1A1B1D;
  --bg-soft:      #202224;
  --bg-pale:      #26282B;
  --bg-ice:       #2C2F33;

  --ink:          #E7E8EA;
  --ink-soft:     #C7C9CC;
  --muted:        #9C9FA4;
  --muted-2:      #8E9298;

  --green:        #5FBF3E;
  --red:          #E0574A;

  --page-bg:      #131415;
  --bar-bg:       #0E0F10;
  --saved-fg:     #7FD05E;

  --border:       #36393D;
  --border-soft:  #2C2F32;
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow:       0 6px 20px rgba(0, 0, 0, 0.55);

  --invert-bg:    #2C2F33;
  --ok-bg:   rgba(78, 167, 46, 0.16);   --ok-fg:   #7FD05E;  --ok-bd:   rgba(78, 167, 46, 0.38);
  --warn-bg: rgba(233, 113, 50, 0.16);  --warn-fg: #EEA26E;  --warn-bd: rgba(233, 113, 50, 0.38);
  --bad-bg:  rgba(192, 57, 43, 0.20);   --bad-fg:  #EE897C;  --bad-bd:  rgba(192, 57, 43, 0.42);

  /* Light chips on dark UI so controls don't blend with pale inputs. */
  --btn-bg:            #26282B;
  --btn-bg-hover:      #2C2F33;
  --btn-border:        #36393D;
  --btn-fg:            #E7E8EA;
  --btn-primary-bg:    #389DE7;
  --btn-primary-fg:    #0E0F10;
  --btn-primary-hover: #5AAEEC;
  --btn-shadow:        none;
  --btn-shadow-hover:  none;
  /* Height/padding tokens inherited from :root — same across themes. */
}

* { box-sizing: border-box; }
html { color-scheme: light; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--sky); text-decoration: none; }
a:hover { color: var(--navy); }

h1, h2, h3, h4 { font-family: var(--font-head); color: var(--navy); }

/* ---------- Layout shell ----------
   One navy bar across the top (brand, the main pages, account), then a single
   centred column. Pages lead with one large figure; cards carry no border. */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--page-bg);
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center;
  gap: 32px;
  padding: 0 32px;
  background: var(--bar-bg);
  color: var(--bar-fg);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  flex: none;
}
.brand-mark {
  width: 34px; height: 34px;
  flex-shrink: 0;
  background: url("../brand/aonfinn-mark.1b5ba033d5e5.svg") center/contain no-repeat;
}
.brand-name {
  font-weight: 700; letter-spacing: -0.01em; font-size: 19px;
  color: var(--bar-fg);
  font-family: var(--font-head);
}
a.brand, a.brand:hover { text-decoration: none; color: var(--bar-fg); }

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy-soft);
  display: grid; place-items: center;
  font-weight: 700; color: #fff; font-size: 14px;
}

/* Top-right dropdown menus — native details/summary, CSS-only (CSP-safe) */
.topmenu { position: relative; }
.topmenu > summary {
  list-style: none; cursor: pointer; user-select: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid transparent;
  background: var(--bar-hover); color: var(--bar-fg); font-size: 16px;
}
.topmenu > summary::-webkit-details-marker { display: none; }
.topmenu > summary:hover { border-color: var(--bar-fg-soft); }
.topmenu[open] > summary { border-color: var(--bar-fg); }
.topmenu > summary.avatar {
  background: #1F3D5F;
  color: #fff; font-weight: 700; font-size: 14px;
}
.topmenu-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 200px; z-index: 40;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 6px;
}
.topmenu-head {
  padding: 7px 10px 8px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}
.topmenu-panel a {
  display: block; padding: 8px 10px; border-radius: var(--radius);
  color: var(--ink); font-size: 14px;
}
.topmenu-panel a:hover { background: var(--bg-pale); color: var(--navy); }
/* Theme toggle sits in the settings panel and mimics the menu links. */
.theme-toggle { margin: 0; }
.theme-toggle button {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: var(--radius);
  border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 14px; color: var(--ink);
}
.theme-toggle button:hover { background: var(--bg-pale); color: var(--navy); }
.btn-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--steel);
  cursor: pointer;
  font-size: 15px;
}
.btn-icon:hover { background: var(--bg-pale); border-color: var(--steel-light); }

/* ---------- Main ---------- */
.main {
  flex: 1;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 32px 48px 40px;
}

.main-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px; color: var(--muted-2);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.main-foot a { color: var(--steel); }

/* 4M Controls co-brand mark in footers. The logo is a navy wordmark on a
   transparent ground, so in dark mode it sits on a light chip to stay legible
   (same treatment as the app-shell brand mark). */
.foot-brand { display: inline-flex; align-items: center; gap: 8px; }
.foot-logo { height: 22px; width: auto; display: block; }
html.dark .foot-logo {
  background: #fff; border-radius: 5px; padding: 3px; box-sizing: content-box;
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 600;
  color: var(--navy);
}
.page-head .eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
  margin-bottom: 8px;
}
.page-head p { color: var(--ink-soft); margin: 10px 0 0; max-width: 70ch; font-size: 17px; line-height: 1.55; }
.page-actions,
.equip-actions,
.access-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.page-actions { justify-content: flex-start; }
.equip-actions { justify-content: flex-end; }

/* ---------- Buttons ----------
   One height and padding for every .btn (page head, equipment toolbar,
   form submits, ghost). Peer groups share a min-width so close labels
   land at matching chip sizes. Distinct from soft inset text fields. */
.btn,
a.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--btn-height);
  height: var(--btn-height);
  margin: 0;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: var(--btn-pad-y) var(--btn-pad-x);
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  font-size: var(--btn-font-size);
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: var(--btn-shadow);
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s, transform .12s;
}
.btn:hover,
a.btn:hover,
button.btn:hover {
  border-color: var(--btn-primary-hover);
  background: var(--btn-bg-hover);
  color: var(--btn-fg);
  box-shadow: var(--btn-shadow-hover);
}
.btn.primary {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
}
.btn.primary:hover {
  background: var(--btn-primary-hover);
  border-color: var(--btn-primary-hover);
  color: var(--btn-primary-fg);
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn.warn  {
  background: #A8500F; border-color: #A8500F; color: #fff;  /* white on it reads at 5:1 */
}
.btn.warn:hover { background: #8F440C; border-color: #8F440C; color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { background: var(--bad-fg); border-color: var(--bad-fg); color: #fff; }
/* A quiet bordered button for an action that should not outshine the page's figures. */
.btn.outline,
a.btn.outline {
  background: transparent;
  border-color: var(--border);
  color: var(--navy);
  box-shadow: none;
}
.btn.outline:hover,
a.btn.outline:hover { background: var(--bg-soft); border-color: var(--muted-2); color: var(--navy); box-shadow: none; }
.btn.outline .ico { color: var(--brand); }
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--steel);
  box-shadow: none;
  font-weight: 600;
  /* Same height as solid buttons; only the fill is lighter. */
}
.btn.ghost:hover {
  background: var(--bg-pale);
  border-color: transparent;
  color: var(--ink);
  transform: none;
  box-shadow: none;
}
/* Side-by-side toolbars: equalise near-length labels (Download/Upload, etc.). */
.page-actions .btn,
.equip-actions .btn,
.access-actions .btn {
  min-width: var(--btn-min-width);
}
/* Two (or more) access choices share the row width so they match. */
.access-actions .btn {
  flex: 1 1 var(--btn-min-width);
}

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 18px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-12-8 { grid-template-columns: 1.5fr 1fr; }
.cols-8-4 { grid-template-columns: 2fr 1fr; }

.card {
  background: var(--bg);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
/* The page column stacks its blocks without a gap of its own, so a card placed straight on the
   page (or in the optimisation results) carries the same 20px the other blocks do. */
.main > .card, #opt-body > .card { margin-bottom: 20px; }
.fig-row + .fig-row { margin-top: 16px; }
.main > .fig-row + .crossing-health { margin-top: 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}
.card-head h3 {
  margin: 0; font-size: 15px; font-weight: 600;
  color: var(--navy); letter-spacing: 0.1px;
  font-family: var(--font-head);
}
.card-head .meta { color: var(--muted); font-size: 13px; }
@media (max-width: 640px) {
  /* A long meta line drops below the heading rather than squeezing it to one word a line. */
  .card-head { flex-wrap: wrap; }
}
/* A card folded to its heading line: the heading opens it, with a chevron that turns. */
.voy-fold { padding-top: 14px; padding-bottom: 14px; }
.voy-fold > summary { list-style: none; cursor: pointer; margin-bottom: 0; min-height: 24px; }
.voy-fold > summary::-webkit-details-marker { display: none; }
.voy-fold > summary h3::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 10px 2px 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s;
}
.voy-fold[open] > summary h3::before { transform: rotate(45deg); }
.voy-fold[open] > summary { margin-bottom: 16px; }
.voy-fold > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 4px; }

/* KPI tile */
.kpi {
  background: var(--bg);
  border-radius: 14px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.kpi-label {
  color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: 1.1px; font-weight: 700;
}
.kpi-value {
  font-size: 30px; font-weight: 700;
  margin: 8px 0 2px; letter-spacing: -0.6px;
  color: var(--navy); font-family: var(--font-head);
}
.kpi-unit { color: var(--muted); font-size: 15px; font-weight: 500; margin-left: 4px; }
.kpi-delta { font-size: 12.5px; font-weight: 600; }
.kpi-delta.up { color: var(--ok); }
.kpi-delta.down { color: var(--bad); }
.kpi-delta.flat { color: var(--muted); }
.kpi-accent {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--sky);
}
.kpi.warn .kpi-accent { background: var(--orange); }
.kpi.ok   .kpi-accent { background: var(--ok); }

/* Status pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--bg-pale); color: var(--ink-soft);
  border: 1px solid var(--border-soft);
}
.pill.ok    { background: var(--ok-bg);   color: var(--ok-fg);   border-color: var(--ok-bd); }
.pill.warn  { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-bd); }
.pill.bad   { background: var(--bad-bg);  color: var(--bad-fg);  border-color: var(--bad-bd); }
.pill.new   { background: var(--sky-pale); color: var(--steel); border-color: var(--sky-light); }
.pill.muted { background: var(--bg-pale); color: var(--muted); border-color: var(--border-soft); }

/* ---------- Table ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--border);
  background: var(--bg-pale);
}
.tbl td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--ink);
  vertical-align: middle;
}
.tbl tbody tr:hover { background: var(--bg-pale); }
.tbl tbody tr.clickable-row { cursor: pointer; }
/* Make empty/padding areas of cells easy to hit for whole-row navigation. */
.tbl tbody tr.clickable-row > td { cursor: pointer; }
.tbl tbody tr.clickable-row:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: -2px;
}
.tbl td.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- Mini chart helpers ---------- */
.sparkline { display: block; width: 100%; height: 36px; }
.chart-wrap {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px;
}

/* legend */
.legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i {
  width: 10px; height: 10px; border-radius: 2px;
  display: inline-block; background: var(--steel-light);
}
.legend i.acc  { background: var(--sky); }
.legend i.acc2 { background: var(--orange); }
.legend i.ok   { background: var(--ok); }
.legend i.bad  { background: var(--bad); }

/* ---------- Architecture builder ---------- */
.builder {
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 140px);
  min-height: 560px;
}
.palette, .inspector {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 14px;
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.palette h4, .inspector h4 {
  margin: 14px 0 8px;
  font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--muted); font-family: var(--font-sans);
}
.palette h4:first-child, .inspector h4:first-child { margin-top: 0; }
.palette-group { margin-bottom: 14px; }
.palette-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  background: var(--bg-pale);
  margin-bottom: 4px;
  cursor: grab;
  border: 1px solid transparent;
  font-size: 14px;
  color: var(--ink);
}
.palette-item:hover { border-color: var(--steel-light); background: var(--bg-ice); }
.palette-item .ic {
  width: 22px; height: 22px; border-radius: 4px;
  background: var(--steel-light);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 12px;
}
.palette-item .ic.gen   { background: var(--orange); }
.palette-item .ic.bess  { background: var(--sky); }
.palette-item .ic.mot   { background: var(--steel); }
.palette-item .ic.bus   { background: var(--muted); }
.palette-item .ic.conv  { background: var(--steel-light); }

.canvas {
  background:
    radial-gradient(circle at 1px 1px, var(--border) 1px, transparent 0) 0 0 / 24px 24px,
    var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.canvas-toolbar {
  position: absolute; top: 12px; left: 12px; right: 12px;
  display: flex; justify-content: space-between; align-items: center;
  pointer-events: none;
}
.canvas-toolbar > * { pointer-events: auto; }
.zoom-ctrls { display: flex; gap: 4px; }

/* inspector */
.field { margin-bottom: 12px; }
.field label {
  display: block; color: var(--muted);
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 4px;
}
.field input, .field select {
  width: 100%;
  background: var(--bg-pale);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 7px 10px;
  border-radius: var(--radius);
  font: inherit;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--sky); background: var(--bg);
}
.field .row { display: flex; gap: 8px; }
.field .row > * { flex: 1; }
.kv {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13.5px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-soft);
}
.kv .k { color: var(--muted); }
.kv .v { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Footer ---------- */
.foot {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--muted-2);
  display: flex;
  justify-content: space-between;
}

/* ===========================================================
   Index page (landing)
   ----------------------------------------------------------- */
.landing {
  min-height: 100vh;
  background: var(--bg) linear-gradient(180deg, var(--bg-ice) 0%, var(--bg) 600px) no-repeat;
  padding: 0;
}
.landing-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 48px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg);
}
.landing-bar .brand-block {
  display: flex; align-items: center; gap: 14px;
}
.landing-bar .brand-block .mark {
  width: 44px; height: 44px;
  background: url("../brand/aonfinn-mark.1b5ba033d5e5.svg") center/contain no-repeat;
}
.landing-bar .brand-block .name {
  font-family: var(--font-head); font-weight: 700;
  font-size: 17px; color: var(--navy); letter-spacing: 0.2px;
  line-height: 1.1;
}
.landing-bar .brand-block .name .small {
  display: block; font-family: var(--font-sans); font-weight: 400;
  font-size: 12px; color: var(--muted); letter-spacing: 0.5px;
  margin-top: 3px;
}
.landing-bar .pillars {
  font-size: 14px; color: var(--steel); font-weight: 500;
  letter-spacing: 0.5px;
}
.landing-bar .pillars span { color: var(--sky); margin: 0 6px; }

.hero {
  padding: 70px 48px 60px;
  max-width: 1400px;
  margin: 0 auto;
}
.hero .eyebrow {
  display: inline-block; font-size: 12px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--orange); margin-bottom: 18px;
  padding: 4px 10px; background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: 99px;
}
/* The same heading scale as the ship and fleet pages, so the front door matches them. */
.hero h1 {
  font-family: var(--font-head);
  font-size: 40px; line-height: 1.12; letter-spacing: -0.025em;
  margin: 0 0 16px; color: var(--navy); font-weight: 600; max-width: 22ch;
}
@media (max-width: 640px) { .hero h1 { font-size: 30px; } .hero { padding: 40px 20px 32px; } }
.hero h1 .accent { color: var(--sky); }
.hero .lede {
  font-size: 19px; color: var(--ink-soft);
  max-width: 60ch; line-height: 1.55; margin: 0 0 36px;
}
.hero .meta {
  display: flex; gap: 28px; flex-wrap: wrap;
  color: var(--muted); font-size: 14px;
}
.hero .meta strong { color: var(--navy); }

.section-title {
  padding: 24px 48px 0;
  max-width: 1400px;
  margin: 0 auto;
}
.section-title h2 {
  font-family: var(--font-head);
  font-size: 22px; font-weight: 700; color: var(--navy);
  margin: 0 0 4px;
}
.section-title p { color: var(--muted); margin: 0; font-size: 15px; }

.surfaces {
  padding: 28px 48px 60px;
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}
.surface {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 28px 28px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  position: relative;
  overflow: hidden;
}
.surface:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--sky-light);
}
.surface .num {
  position: absolute; right: 24px; top: 22px;
  font-family: var(--font-head); font-size: 13px; font-weight: 700;
  color: var(--steel-light); letter-spacing: 1.2px;
}
.surface .swatch {
  width: 56px; height: 56px;
  border-radius: 12px;
  background: var(--sky-pale);
  display: grid; place-items: center;
  margin-bottom: 18px;
  font-size: 24px; color: var(--sky);
}
.surface .swatch .ico { width: 26px; height: 26px; }
.surface.s2 .swatch { background: #FDEEE2; color: var(--orange); }
.surface.s3 .swatch { background: #DAEAD0; color: var(--green); }
.surface.s4 .swatch { background: #E1ECF3; color: var(--steel); }
.surface h2 {
  font-family: var(--font-head); font-size: 22px;
  margin: 0 0 6px; color: var(--navy); font-weight: 700;
}
.surface .tag {
  display: inline-block; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--sky); margin-bottom: 14px;
}
.surface.s2 .tag { color: var(--orange); }
.surface.s3 .tag { color: var(--green); }
.surface.s4 .tag { color: var(--steel); }
.surface p {
  color: var(--ink-soft); font-size: 15px; line-height: 1.55;
  margin: 0 0 18px;
}
.surface ul {
  list-style: none; padding: 0; margin: 0 0 22px;
  font-size: 14px; color: var(--ink-soft);
}
.surface ul li {
  padding: 4px 0 4px 22px; position: relative;
}
.surface ul li::before {
  content: ""; position: absolute; left: 0; top: 10px;
  width: 12px; height: 2px; background: var(--sky);
}
.surface.s2 ul li::before { background: var(--orange); }
.surface.s3 ul li::before { background: var(--green); }
.surface.s4 ul li::before { background: var(--steel); }
.surface .go {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 14px; color: var(--sky);
  padding-top: 6px; border-top: 1px solid var(--border-soft);
}
.surface.s2 .go { color: var(--orange); }
.surface.s3 .go { color: var(--green); }
.surface.s4 .go { color: var(--steel); }

.callout {
  background: var(--invert-bg);
  color: #fff;
  padding: 26px 32px;
  border-radius: 12px;
  margin: 32px 48px 60px;
  max-width: 1400px;
  margin-left: auto; margin-right: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}
.callout .text { flex: 1; min-width: 360px; }
.callout h3 {
  font-family: var(--font-head); font-size: 18px;
  color: #fff; margin: 0 0 6px;
}
.callout p {
  color: rgba(255,255,255,0.85);
  font-size: 15px; margin: 0; max-width: 90ch;
}
.callout .mini-tag {
  background: var(--sky); color: #fff;
  padding: 6px 14px; border-radius: 99px;
  font-size: 12px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase;
}

.landing-foot {
  padding: 22px 48px 36px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px; color: var(--muted-2);
  display: flex; justify-content: space-between; gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
}
.landing-foot a { color: var(--steel); }

/* Landing hero CTA + value cards (leak-free redesign) */
.landing-cta { margin-top: 26px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.landing-note { color: var(--muted); font-size: 14px; }
.values { max-width: 1400px; margin: 0 auto; padding: 12px 48px 48px; }
.values .surface h2 { font-size: 19px; }
.values .surface p { color: var(--ink-soft); margin: 8px 0 0; line-height: 1.5; }
@media (max-width: 900px) { .values.cols-3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .values { padding: 8px 20px 40px; } }

/* Front page sections. The footer navy is the 4M Controls site's, so Aonfinn reads as its product. */
.landing-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 26px; font-size: 15px; font-weight: 500; }
.landing-nav a:not(.btn) { color: var(--navy); text-decoration: none; }
.landing-nav a:not(.btn):hover { color: var(--sky); }
.lp-eyebrow { display: block; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sky); margin-bottom: 14px; }
.lp-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 48px; }
.lp-hero-text { flex: 1 1 440px; min-width: 0; }
.lp-hero .lede { margin-bottom: 0; }
.lp-btn { min-height: 46px; padding: 0 22px; font-size: 15px; }
a.btn.lp-btn-line { background: transparent; border: 1px solid var(--navy); color: var(--navy); }
a.btn.lp-btn-line:hover { background: var(--bg); border-color: var(--sky); color: var(--sky); }
.lp-shot { flex: 1 1 460px; min-width: 0; margin: 0; }
.lp-shot-frame { border-radius: 14px; border: 1px solid var(--border-soft); background: #fff; box-shadow: 0 18px 40px rgba(14, 40, 65, 0.12); overflow: hidden; }
.lp-shot-bar { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px; background: #0E2841; color: #E3F0FB; font-size: 12px; }
.lp-shot-bar span { width: 9px; height: 9px; border-radius: 50%; background: #7BBCEE; }
.lp-shot img { display: block; width: 100%; height: auto; }
.lp-shot figcaption { margin-top: 12px; font-size: 13px; color: var(--muted); }
.lp-band { padding: 80px 0; }
.lp-wrap { max-width: 1400px; margin: 0 auto; padding: 0 48px; }
.lp-head { max-width: 46em; margin-bottom: 36px; }
.lp-head h2, .lp-contact h2 { font-family: var(--font-head); font-size: 34px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 12px; color: var(--navy); font-weight: 600; }
.lp-head p, .lp-contact p { margin: 0; font-size: 18px; line-height: 1.55; color: var(--ink-soft); }
.lp-grid, .lp-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.lp-rules { background: #0E2841; }
.lp-rules .lp-eyebrow { color: #7BBCEE; }
.lp-rules .lp-head h2 { color: #fff; }
.lp-rules .lp-head p { color: #C9D8E8; }
.lp-rule { background: #1F3D5F; border-radius: 12px; padding: 28px; }
.lp-rule h3 { font-family: var(--font-head); font-size: 20px; font-weight: 600; margin: 0 0 10px; color: #fff; }
.lp-rule p { margin: 0; font-size: 16px; line-height: 1.55; color: #E3F0FB; }
.lp-rule p.lp-rule-ours { margin-top: 14px; padding-top: 12px; border-top: 1px solid #36597D; font-size: 15px; color: #9CC9F2; }
.lp-steps { list-style: none; margin: 0; padding: 0; }
.lp-steps li { padding-top: 18px; border-top: 3px solid var(--sky); }
.lp-step-no { font-family: var(--font-head); font-weight: 700; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--sky); }
.lp-steps h3 { font-family: var(--font-head); font-size: 19px; font-weight: 600; margin: 8px 0; color: var(--navy); }
.lp-steps p { margin: 0; font-size: 16px; line-height: 1.55; color: var(--ink-soft); }
.lp-contact { background: var(--sky-pale); }
.lp-contact-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 28px; }
.lp-contact-row > div:first-child { flex: 1 1 480px; min-width: 0; }
.lp-contact .landing-cta { margin-top: 0; }
.lp-foot { background: #36438B; color: #D5DBF2; padding: 52px 0 36px; font-size: 15px; line-height: 1.5; }
.lp-foot a { color: #B9DDF8; }
.lp-foot-cols { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 28px; }
.lp-foot-cols > * { display: flex; flex-direction: column; gap: 6px; flex: 1 1 240px; font-style: normal; }
.lp-foot-cols strong, .lp-foot-name { color: #fff; font-weight: 600; }
.lp-foot-name { font-family: var(--font-head); font-size: 18px; letter-spacing: 0.04em; text-transform: uppercase; }
.lp-foot-logo { width: 44px; height: auto; background: #fff; border-radius: 8px; padding: 6px; }
.lp-foot-base { margin-top: 32px; padding-top: 18px; border-top: 1px solid #4E5BA3; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; font-size: 14px; }
@media (max-width: 640px) {
  .landing-bar { padding: 16px 20px; flex-wrap: wrap; gap: 12px; }
  .lp-wrap { padding: 0 20px; }
  .lp-band { padding: 56px 0; }
  .lp-head h2, .lp-contact h2 { font-size: 26px; }
}

/* Legal pages (privacy, terms) — standalone readable column */
.legal { max-width: 760px; margin: 0 auto; padding: 32px 48px 48px; color: var(--ink-soft); }
.legal h1 { font-size: 30px; margin: 8px 0 6px; }
.legal .legal-lead { color: var(--muted); font-size: 15px; margin: 0 0 24px; }
.legal h2 { font-size: 18px; margin: 26px 0 8px; color: var(--navy); }
.legal p, .legal li { font-size: 15px; line-height: 1.6; }
.legal ul { padding-left: 20px; }
.legal li { margin: 4px 0; }
.legal .legal-note {
  margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border-soft);
  color: var(--muted); font-size: 13.5px;
}
@media (max-width: 640px) { .legal { padding: 24px 20px 40px; } }

/* ===========================================================
   v0.2 additions — Phase 1+2 wireframes (signin, vessels,
   vessel, scenario, maintenance) and phase-staged navigation
   =========================================================== */

/* Stage tag on internal-only menu items. */
.badge.phase {
  background: var(--bg-pale);
  color: var(--muted);
  border: 1px solid var(--border-soft);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.3px;
  padding: 1px 6px;
  flex-shrink: 0;
}

/* Phase chip used inline in page heads / content */
.phase-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg-pale);
  color: var(--muted);
  border: 1px solid var(--border-soft);
  font-size: 12px; font-weight: 600; letter-spacing: 0.4px;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 8px;
}
.phase-chip.live {
  background: var(--sky-pale); color: var(--steel);
  border-color: var(--sky-light);
}

/* Coming-soon stub pages */
.card.stub { max-width: 640px; }
.card.stub .phase-chip { margin-left: 0; margin-bottom: 14px; }
.card.stub p { color: var(--ink-soft); font-size: 15px; max-width: 60ch; margin: 0 0 10px; }
.card.stub p.foot { color: var(--muted); font-size: 13.5px; margin: 0; }

.card.soft { background: var(--bg-soft); }
.card.off { opacity: 0.55; }
.card.off .card-head h3 { color: var(--muted); }
.card.off p.foot { color: var(--muted); font-size: 13.5px; margin: 0; }

/* One equipment card: summary + table always on; upload/fit expand in place */
/* .equip-actions sizing comes from the shared .btn rules above. */
.equip-summary { margin-bottom: 4px; }
.equip-panel {
  margin: 4px 0 16px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
.equip-panel[hidden] { display: none !important; }
.equip-inline-form { margin: 0; }
.equip-table-block {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

.card.soft-inner {
  background: var(--bg-soft);
  box-shadow: none;
}

/* ---------- Signin page (standalone, no app shell) ---------- */
.signin-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-ice) 0%, var(--bg-pale) 100%);
  padding: 24px;
}
.signin-card {
  width: 100%; max-width: 420px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}
.signin-card .brand {
  margin-bottom: 22px;
  display: flex; align-items: center; gap: 12px;
}
.signin-card h1 {
  margin: 0 0 6px; font-size: 22px;
}
.signin-card p.lede {
  color: var(--muted); margin: 0 0 22px; font-size: 14.5px;
}

/* ---------- Forms (used on signin + scenario) ---------- */
.form-row {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 14px;
}
.form-row label {
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  letter-spacing: 0.2px;
}
.form-row .hint {
  font-size: 12.5px; color: var(--muted); margin-top: 2px;
}
/* One-line form: label, a dropdown sized to its options, and a normal button. */
.inline-form,
.tabbed .tabpanel > form.inline-form {
  display: flex; flex-direction: row; align-items: center; align-self: flex-start;
  flex-wrap: wrap; gap: 10px; margin: 16px 0 0;
}
.inline-form label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.inline-form .select { width: auto; min-width: 12em; max-width: 100%; }
.input, .select {
  width: 100%; padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans); font-size: 15px;
  color: var(--ink);
}
.input:focus, .select:focus {
  outline: none; border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(56, 157, 231, 0.18);
}
.input.sm { padding: 6px 8px; font-size: 13.5px; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }

.form-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px;
}

/* ---------- Tabs (used on scenario page) ---------- */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.tabs a {
  padding: 10px 16px;
  color: var(--muted);
  font-weight: 600; font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--navy); }
.tabs a.active {
  color: var(--navy); border-bottom-color: var(--sky);
}

/* ---------- Scenario page split layout ---------- */
.scenario-split {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  align-items: start;
}
.scenario-split .scenario-form .card { margin-bottom: 14px; }

/* ---------- Compliance rows ---------- */
.compliance-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px; align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.compliance-row:last-child { border-bottom: none; }
.compliance-row .label { font-weight: 600; color: var(--ink); font-size: 14.5px; }
.compliance-row .desc { color: var(--muted); font-size: 12.5px; }
.compliance-row .verdict {
  padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.3px;
}
.compliance-row .verdict.pass { background: var(--ok-bg);   color: var(--ok-fg); }
.compliance-row .verdict.fail { background: var(--bad-bg);  color: var(--bad-fg); }
.compliance-row .verdict.warn { background: var(--warn-bg); color: var(--warn-fg); }

/* ---------- Strategy comparison (Stage 10.5) ---------- */
.tbl tr.row-best td { background: var(--ok-bg); }

/* ---------- Scenario compare (Stage 10.5) ---------- */
.compare-pickers { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.pick-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pick-row .pick-lab {
  width: 20px; height: 20px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 6px; background: var(--bg-pale); color: var(--muted);
  font-size: 12px; font-weight: 700;
}
.compare-pickers .pick {
  padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border-soft);
  background: var(--bg-soft); color: var(--ink-soft); font-size: 13.5px; font-weight: 600;
}
.compare-pickers .pick.on { background: var(--sky-pale); color: var(--steel); border-color: var(--sky-light); }
.tbl td.cell-best { background: var(--ok-bg); color: var(--ok-fg); font-weight: 700; }

/* ---------- Regulatory reporting (Stage 10.6) ---------- */
.vessel-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.vessel-picker .pick {
  padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--border-soft); background: var(--bg-soft);
  color: var(--ink-soft); font-size: 13.5px; font-weight: 600;
}
.vessel-picker .pick.on {
  background: var(--sky-pale); color: var(--steel); border-color: var(--sky-light);
}
.reg-subject { margin-bottom: 16px; font-size: 15px; color: var(--ink); }
.reg-subject .muted { font-weight: 500; }

.card.regime { margin-bottom: 14px; }
.regime-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.regime-head h3 { margin: 0; font-size: 15.5px; }
.regime-short {
  font-family: var(--font-sans); font-weight: 600; font-size: 12px;
  color: var(--muted); letter-spacing: 0.5px; margin-left: 6px;
}
.regime-what { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; max-width: 62ch; }
.regime-reason { margin: 12px 0 0; font-size: 14px; color: var(--ink-soft); }
.regime-detail { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.regime-obligation { margin: 0 0 8px; font-size: 14px; color: var(--ink); }
.regime-timeline { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; }
.regime-timeline li { margin: 2px 0; }
.regime-figs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.regime-figs .fig {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 12px; border: 1px solid var(--border-soft);
  border-radius: var(--radius); background: var(--bg-soft); min-width: 120px;
}
.regime-figs .fig-label { font-size: 12px; color: var(--muted); }
.regime-figs .fig-value { font-size: 15px; font-weight: 700; color: var(--navy); }
.regime-figs .figs-label { flex-basis: 100%; color: var(--muted); }
.regime-figs.measured { border-left: 3px solid var(--navy); padding-left: 10px; }
.reg-period { color: var(--muted); margin: 0 0 8px; }
.small { font-size: 12.5px; }
.reg-foot { margin-top: 6px; }

/* ---------- Placeholder tiles for later-phase surfaces ---------- */
.later-card { margin-top: 18px; }
.later-grid { margin-top: 4px; }
.tile-soft {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--bg);
  display: block;
}
.tile-soft h4 {
  margin: 0 0 6px; font-size: 14.5px; color: var(--ink-soft);
  font-weight: 600;
}
.tile-soft h4 .phase-chip { margin-left: 6px; }
.tile-soft p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
a.tile-soft-link {
  text-decoration: none; color: inherit;
  transition: border-color 0.12s ease, background 0.12s ease;
}
a.tile-soft-link:hover {
  border-color: var(--steel);
  background: var(--sky-pale);
}
a.tile-soft-link:hover h4 { color: var(--navy); }

/* ---------- Vessel topology summary inline ---------- */
.topology-strip {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.topology-strip .chip {
  background: var(--bg-pale); border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 13px; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.topology-strip .chip strong { color: var(--navy); font-weight: 700; }

/* ---------- Data table (vessels list, scenarios list) ---------- */
.tbl {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}
.tbl th {
  text-align: left; font-weight: 600;
  font-size: 12.5px; letter-spacing: 0.4px;
  text-transform: uppercase; color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.tbl td {
  padding: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr:hover td { background: var(--bg-pale); }
.tbl a { font-weight: 500; }
.tbl .row-name { font-weight: 600; color: var(--navy); }

/* ===========================================================
   Aonfinn app additions — forms + auth pages (appended)
   =========================================================== */

/* Editable forms in the app shell (scenario, invite). */
.scenario-form input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
.scenario-form select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 15px;
  color: var(--ink);
}
.scenario-form input:focus, .scenario-form select:focus {
  outline: none; border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(56, 157, 231, 0.18);
}
.scenario-form .form-row { margin-bottom: 12px; }

/* Auth pages (allauth login / signup / MFA / password) inside .signin-card. */
.signin-card h1 { font-size: 22px; margin: 0 0 14px; }
.signin-card p { color: var(--ink-soft); font-size: 14.5px; }
.signin-card form { margin: 6px 0; }
.signin-card input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
.signin-card select {
  width: 100%; padding: 9px 12px; margin: 6px 0 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); font: inherit; font-size: 15px; color: var(--ink);
}
.signin-card input:focus, .signin-card select:focus {
  outline: none; border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(56, 157, 231, 0.18);
}
.signin-card label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.signin-card button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--btn-height); height: var(--btn-height);
  background: var(--sky); border: 2px solid var(--sky); color: #fff;
  padding: var(--btn-pad-y) var(--btn-pad-x); border-radius: 8px;
  font: inherit; font-weight: 700; font-size: var(--btn-font-size);
  line-height: 1.2; cursor: pointer; appearance: none; -webkit-appearance: none;
  box-shadow: var(--btn-shadow);
}
.signin-card button:hover { background: var(--steel); border-color: var(--steel); }
.signin-card a { color: var(--sky); }
.signin-card hr { border: none; border-top: 1px solid var(--border-soft); margin: 16px 0; }
.signin-card img { max-width: 100%; }   /* MFA QR code */
.auth-messages { list-style: none; padding: 0; margin: 0 0 14px; }
.auth-messages li {
  padding: 8px 12px; border-radius: var(--radius); font-size: 14px;
  background: var(--sky-pale); color: var(--steel); border: 1px solid var(--sky-light);
  margin-bottom: 6px;
}
.auth-nav {
  margin-top: 20px; padding-top: 14px;
  border-top: 1px solid var(--border-soft); font-size: 14px;
}

/* Topology editor — compact class-specific (extra) fields inside table cells. */
.inline-extra { display: inline-flex; align-items: center; gap: 6px; margin: 2px 10px 2px 0; font-size: 13px; color: var(--muted); }
.inline-extra .input, .inline-extra select, .inline-extra input { width: auto; max-width: 160px; padding: 5px 8px; margin: 0; }
.inline-extra select { min-width: 9em; }

/* App-wide save notifications (Django messages). */
.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.messages .msg {
  padding: 10px 14px; border-radius: var(--radius); font-size: 14px;
  margin-bottom: 8px; border: 1px solid var(--border-soft);
}
.messages .success { background: var(--ok-bg);  color: var(--ok-fg);  border-color: var(--ok-bd); }
.messages .error   { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-bd); }
.messages .info, .messages .warning { background: var(--sky-pale); color: var(--steel); border-color: var(--sky-light); }

/* Scenario / vessel tabs — CSS-only (radio + labels), no JS, CSP-safe.
   Optimisation uses a real link so the server only runs sizing/MC when requested. */
.tabbed .tabr { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tabbed .tabpanel {
  display: none;
  flex-direction: column;
  gap: 18px; /* space between stacked cards (topology upload / fit / table, etc.) */
}
.tabbed #t-summary:checked ~ #p-summary,
.tabbed #t-topology:checked ~ #p-topology,
.tabbed #t-duty:checked ~ #p-duty,
.tabbed #t-optimisation:checked ~ #p-optimisation,
.tabbed #t-assumptions:checked ~ #p-assumptions,
.tabbed #t-costs:checked ~ #p-costs,
.tabbed #t-reporting:checked ~ #p-reporting,
.tabbed #t-equipment:checked ~ #p-equipment,
.tabbed #t-attributes:checked ~ #p-attributes,
.tabbed #t-scenarios:checked ~ #p-scenarios,
.tabbed #t-regulatory:checked ~ #p-regulatory,
.tabbed #t-voyages:checked ~ #p-voyages,
.tabbed #t-reports:checked ~ #p-reports,
.tabbed #t-ryear:checked ~ #p-ryear,
.tabbed #t-rvoy:checked ~ #p-rvoy,
.tabbed #t-rsub:checked ~ #p-rsub,
.tabbed #t-report:checked ~ #p-report,
.tabbed #t-engineering:checked ~ #p-engineering { display: flex; }

/* Forms that wrap a card (slot table save) still sit in the panel gap. */
.tabbed .tabpanel > form { display: flex; flex-direction: column; gap: 18px; }
.tabs label,
.tabs a.tab-link {
  display: inline-block; padding: 10px 18px; margin-bottom: -1px;
  color: var(--muted); font-weight: 600; font-size: 14.5px;
  border-bottom: 2px solid transparent; cursor: pointer;
  text-decoration: none;
}
.tabs label:hover,
.tabs a.tab-link:hover { color: var(--navy); }
/* No-JS fallback: highlight from the checked radio. */
.tabbed:not(.js-tabs) #t-summary:checked ~ .tabs label[for="t-summary"],
.tabbed:not(.js-tabs) #t-topology:checked ~ .tabs label[for="t-topology"],
.tabbed:not(.js-tabs) #t-duty:checked ~ .tabs label[for="t-duty"],
.tabbed:not(.js-tabs) #t-optimisation:checked ~ .tabs label[for="t-optimisation"],
.tabbed:not(.js-tabs) #t-assumptions:checked ~ .tabs label[for="t-assumptions"],
.tabbed:not(.js-tabs) #t-costs:checked ~ .tabs label[for="t-costs"],
.tabbed:not(.js-tabs) #t-reporting:checked ~ .tabs label[for="t-reporting"],
.tabbed:not(.js-tabs) #t-equipment:checked ~ .tabs label[for="t-equipment"],
.tabbed:not(.js-tabs) #t-attributes:checked ~ .tabs label[for="t-attributes"],
.tabbed:not(.js-tabs) #t-scenarios:checked ~ .tabs label[for="t-scenarios"],
.tabbed:not(.js-tabs) #t-regulatory:checked ~ .tabs label[for="t-regulatory"],
.tabbed:not(.js-tabs) #t-voyages:checked ~ .tabs label[for="t-voyages"],
.tabbed:not(.js-tabs) #t-reports:checked ~ .tabs label[for="t-reports"],
.tabbed:not(.js-tabs) #t-ryear:checked ~ .tabs label[for="t-ryear"],
.tabbed:not(.js-tabs) #t-rvoy:checked ~ .tabs label[for="t-rvoy"],
.tabbed:not(.js-tabs) #t-rsub:checked ~ .tabs label[for="t-rsub"],
.tabbed:not(.js-tabs) #t-report:checked ~ .tabs label[for="t-report"],
.tabbed:not(.js-tabs) #t-engineering:checked ~ .tabs label[for="t-engineering"] {
  color: var(--navy); border-bottom-color: var(--sky);
}
/* With JS: only one label has .is-active (avoids dual-selected chrome). */
.tabbed.js-tabs .tabs label.is-active {
  color: var(--navy);
  border-bottom-color: var(--sky);
}

/* Optimisation async calculating state */
.opt-loading { min-height: 220px; display: flex; align-items: center; justify-content: center; }
.opt-loading-inner { text-align: center; max-width: 28rem; padding: 28px 16px; }
.opt-loading-title { font-weight: 600; color: var(--navy); margin: 14px 0 6px; }
.opt-spinner {
  width: 40px; height: 40px; margin: 0 auto;
  border: 3px solid var(--border-soft);
  border-top-color: var(--sky);
  border-radius: 50%;
  animation: opt-spin 0.8s linear infinite;
}
@keyframes opt-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .opt-spinner { animation: none; border-top-color: var(--sky); opacity: 0.85; }
}

/* Full-page busy overlay for Save & run / duty re-run (blocks double-submit). */
.run-busy {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(14, 40, 65, 0.45);
  backdrop-filter: blur(2px);
}
.run-busy[hidden] { display: none !important; }
.run-busy-panel {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px 32px;
  max-width: 28rem;
  text-align: center;
}
html.run-busy-active { cursor: progress; }
html.run-busy-active body { pointer-events: none; }
html.run-busy-active .run-busy { pointer-events: auto; }
.add-slot { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.add-slot label {
  display: inline-flex; flex-direction: column; gap: 4px; margin: 0;
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
}
.scenario-form .add-slot select { width: 260px; }
.scenario-form .add-slot input:not([type="checkbox"]):not([type="radio"]) { width: 110px; }

/* Scenario picker — clickable rows at a readable width, not a full-width
   table with the link stranded on the right. */
.scenario-picker { display: flex; flex-direction: column; gap: 8px; max-width: 720px; }
.scenario-item {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 16px;
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); color: var(--ink); text-decoration: none;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.scenario-item:hover {
  border-color: var(--sky); background: var(--bg-soft);
  box-shadow: var(--shadow-sm); color: var(--ink);
}
.scenario-item .si-name { font-weight: 600; color: var(--navy); flex: 1 1 auto; }
.scenario-item .si-meta { color: var(--muted); font-size: 14px; }
.scenario-item .si-strategy {
  color: var(--steel); font-size: 12.5px;
  background: var(--bg-pale); padding: 2px 9px; border-radius: 99px;
}
.scenario-item .si-go { color: var(--sky); font-weight: 700; font-size: 16px; }

/* ===========================================================
   Charts + assumption tooltips (cost-benefit Summary / Duty)
   ----------------------------------------------------------- */
.chart { width: 100%; height: 280px; }
.chart.tall { height: 340px; }
.chart-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.chart-grid .chart { height: 220px; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }

.form-row label { display: inline-flex; align-items: center; gap: 6px; }

/* Small "i" the user hovers for an assumption's plain-English explanation. */
.info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--bg-ice); color: var(--steel);
  border: 1px solid var(--border);
  font-size: 12px; font-style: normal; font-weight: 700;
  cursor: help; position: relative;
}
.info:hover { background: var(--sky-pale); color: var(--navy); }
.info::after {
  content: attr(data-tip);
  position: absolute; left: 50%; bottom: 140%; transform: translateX(-50%);
  width: min(230px, 70vw); padding: 8px 10px;
  background: var(--invert-bg); color: #fff;
  font-size: 12.5px; font-weight: 400; line-height: 1.4; text-align: left;
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: none; z-index: 20;
  pointer-events: none;
}
.info:hover::after, .info:focus::after { display: block; }
.info:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ===========================================================
   Compact + modern pass — soft, low-chrome inputs and dense tables
   ----------------------------------------------------------- */
/* Text fields: soft inset wells — deliberately unlike raised solid buttons. */
.input, .select,
.scenario-form input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
.scenario-form select {
  padding: 8px 12px;
  min-height: 40px;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: inset 0 1px 2px rgba(14, 40, 65, 0.06);
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
html.dark .input,
html.dark .select,
html.dark .scenario-form input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
html.dark .scenario-form select {
  background: #0A1522;
  border-color: var(--border);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
}
.input::placeholder, .scenario-form input::placeholder { color: var(--muted-2); }
.input:hover, .select:hover,
.scenario-form input:hover, .scenario-form select:hover { border-color: var(--steel-light); }
/* Disabled and read-only fields must not look like editable ones. */
.input:disabled, .select:disabled, .input[readonly],
.scenario-form input:disabled, .scenario-form select:disabled, .scenario-form input[readonly] {
  background: var(--bg-pale); border-style: dashed; color: var(--muted); box-shadow: none; cursor: not-allowed;
}
html.dark .input:disabled, html.dark .select:disabled, html.dark .input[readonly],
html.dark .scenario-form input:disabled, html.dark .scenario-form select:disabled,
html.dark .scenario-form input[readonly] { background: transparent; }
html.dark .input:hover,
html.dark .select:hover,
html.dark .scenario-form input:hover,
html.dark .scenario-form select:hover { background: #0C1A28; }
.input:focus, .select:focus,
.scenario-form input:focus, .scenario-form select:focus {
  outline: none;
  background: var(--bg);
  border-color: var(--steel);
  box-shadow: inset 0 1px 2px rgba(14, 40, 65, 0.06), 0 0 0 2px rgba(29, 111, 184, 0.22);
}
html.dark .input:focus,
html.dark .select:focus,
html.dark .scenario-form input:focus,
html.dark .scenario-form select:focus {
  background: var(--bg);
  border-color: var(--steel);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 0 2px rgba(56, 157, 231, 0.3);
}

/* Tighter vertical rhythm on stacked forms. */
.form-row { gap: 4px; margin-bottom: 10px; }
.scenario-form .form-row { margin-bottom: 10px; }
.form-row label { font-size: 12.5px; }

/* Denser tables. */
.tbl th { padding: 6px 10px; }
.tbl td { padding: 4px 10px; }

/* Editable tables shrink to their content rather than stretching the inputs
   across the whole card — this is what made the duty cycle look so spread out.
   Inside a row the inputs are seamless (transparent until hover/focus) so the
   table reads as values in cells, not a wall of boxes. */
/* Every table fills its card; a table sized to its content bunched to the left. */
.tbl td .input,
.tbl td input:not([type="checkbox"]):not([type="radio"]),
.tbl td select,
.scenario-form .tbl td input:not([type="checkbox"]):not([type="radio"]),
.scenario-form .tbl td select {
  width: 100%; max-width: none; box-sizing: border-box;
  padding: 5px 8px; font-size: 14px;
  background: var(--bg-ice); border: 1px solid transparent;
}
.tbl td .input:hover,
.tbl td input:hover, .tbl td select:hover { background: var(--bg-pale); }
.tbl td .input:focus,
.tbl td input:focus, .tbl td select:focus { background: var(--bg); border-color: var(--sky); }
.tbl td .input::placeholder, .tbl td input::placeholder { color: var(--muted-2); }
.tbl td.num input { text-align: right; font-variant-numeric: tabular-nums; }

/* Duty-cycle assumptions sit inline, not as stacked full-width rows. */
.duty-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 14px; }
.duty-meta .form-row { margin-bottom: 0; }
.duty-meta .input { width: 110px; max-width: 110px; }

/* Topology: one full-width table, grouped into class sections with a header
   row (like the income/tax/bills layout) so every column lines up. The
   equipment column absorbs the slack; everything else is tight. */
/* Sized to its content and left-aligned — NOT stretched across the page. */
.topo-table { width: auto; }
.topo-table thead th { padding: 6px 10px; white-space: nowrap; }
.topo-table td { padding: 4px 10px; vertical-align: middle; white-space: nowrap; }
.topo-table tr.section-row td {
  background: var(--bg-pale); border-top: 1px solid var(--border);
  font-weight: 700; color: var(--navy);
  font-size: 12px; letter-spacing: 0.6px; text-transform: uppercase;
  padding: 7px 10px;
}
.topo-table tr.section-row .count {
  float: right; color: var(--muted); font-weight: 600;
  letter-spacing: 0; text-transform: none; font-size: 12px;
}
.topo-table tr.slot-tr.off { opacity: 0.5; }
.topo-table .slot-cell strong { color: var(--navy); font-size: 13.5px; }
.topo-table td.fit-cell { width: 36px; text-align: center; }
.topo-table td.fit-cell input { margin: 0; }
/* Scoped to beat the generic ".scenario-form .tbl td input" width. */
.scenario-form .topo-table td.eq-cell input:not([type="checkbox"]) { width: 230px; max-width: 230px; }
.scenario-form .topo-table td.num input:not([type="checkbox"]) { width: 80px; max-width: 80px; }
.scenario-form .topo-table td.bus-cell input:not([type="checkbox"]),
.scenario-form .topo-table td.bus-cell select { width: 92px; max-width: 92px; }
.topo-table .f-x { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-right: 10px; }
.topo-table .f-x .input, .topo-table .f-x input, .topo-table .f-x select { width: 64px; max-width: 64px; }

/* ---------- Phone and tablet layout ----------
   Below 900 px grids stack to one column and wide tables scroll inside their
   card instead of the page. */
@media (max-width: 900px) {
  .topbar { padding: 0 12px; gap: 12px; }
  .brand-name { font-size: 17px; }
  .topbar-actions { gap: 8px; }
  /* min-width: 0 keeps a wide table from widening the page. */
  .main { padding: 18px 14px 32px; min-width: 0; }
  .page-head h1 { font-size: 28px; }

  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-3, .cols-2, .cols-12-8, .cols-8-4,
  .builder, .surfaces, .form-grid-2, .scenario-split, .compliance-row { grid-template-columns: 1fr; }

  .tbl { display: block; max-width: 100%; overflow-x: auto; }
  /* iOS zooms into any field under 16 px when it is tapped, and stays zoomed. */
  body input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), body select, body textarea { font-size: 16px !important; }
  footer a { display: inline-block; padding: 6px 0; }
  .topcrumbs a { padding: 12px 0; }
  .tbl td.num, .tbl th.num { white-space: nowrap; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs a, .tabs label { white-space: nowrap; flex: none; }
}

@media (max-width: 560px) {
  .cols-4 { grid-template-columns: 1fr; }
  .topbar-actions { gap: 8px; }
  /* A scrolling tab bar hid its last tab with no hint; on a phone the tabs wrap instead. */
  .tabs { flex-wrap: wrap; overflow-x: visible; }
  .tabs a, .tabs label { padding: 8px 12px; }
}

/* ===========================================================
   The new look: one leading figure per page, line icons, cards
   only where people choose between things or read key figures.
   =========================================================== */

/* Line icons ({% icon %}): stroke only, in the text colour - grey by default. */
.ico {
  width: 20px; height: 20px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: middle;
}
.ico.sm { width: 16px; height: 16px; }
.ico.lg { width: 24px; height: 24px; }
.icon-chip {
  width: 40px; height: 40px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: var(--bg-pale); color: var(--muted);
}

/* The one figure a page leads with. Green only when it is fuel saved. */
.lead-figure {
  display: block;
  font-family: var(--font-num); font-size: 64px; line-height: 1; font-weight: 500;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.lead-figure.md { font-size: 40px; }
.lead-figure.muted { color: var(--muted); }
/* Measured against predicted: green better, red worse, plain ink within tolerance. The arrow
   keeps the meaning for readers who cannot tell the two colours apart. */
/* Plotly paints the series-name box beside a hover label white in every theme; on a dark
   page it takes the label's own surface so the two read as one. */
html.dark .js-plotly-plot .hoverlayer .hovertext rect { fill: #202224 !important; stroke: #36393D !important; }
.tone-good, .tone-bad { font-weight: 600; }
.tone-good { color: var(--saved-fg); }
.tone-bad  { color: var(--bad-fg); }
.tone-good::before { content: "\25B2\00A0"; font-size: 0.7em; vertical-align: 0.15em; }
.tone-bad::before  { content: "\25BC\00A0"; font-size: 0.7em; vertical-align: 0.15em; }
.saved { color: var(--saved-fg); }
.lead-caption { display: block; margin-top: 6px; font-size: 16px; color: var(--ink-soft); }
.lead-title {
  margin: 0; font-size: 44px; line-height: 1.08; font-weight: 600;
  color: var(--navy);
}

/* Plain grey label chip: example ship, simulated data, not yet counted. */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--bg-pale); color: var(--ink-soft);
  font-size: 13px; font-weight: 500; white-space: nowrap;
}
/* Where data came from, noted without competing with the ship's own tags. */
.tag.quiet { background: none; padding: 4px 2px; color: var(--muted); font-size: 12px; }

/* Key-figure cards: icon, number, what it means. */
.fig-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.fig-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fig-card {
  background: var(--bg); border-radius: 16px; padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-sm);
}
.fig-card .fig-value { font-family: var(--font-num); font-size: 30px; font-weight: 500; color: var(--navy); font-variant-numeric: tabular-nums; }
.fig-card .fig-label { font-size: 14px; color: var(--muted); }
/* What a figure was before the last save: green when it moved the good way, red the bad. */
.fig-delta { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.fig-delta.ok { color: var(--ok-fg); }
.fig-delta.bad { color: var(--bad-fg); }

/* Choice cards: one per thing a person picks (a ship, a crossing). */
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.choice-card {
  background: var(--bg); border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.choice-card .choice-body { padding: 24px 28px 28px; display: flex; flex-direction: column; gap: 20px; flex: 1; }
.choice-card .choice-body > .tag { align-self: flex-start; }
.choice-card h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.choice-card .choice-sub { font-size: 15px; color: var(--muted); }
.choice-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-top: auto;
}
.go-link { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; color: var(--steel); }
.go-link:hover { color: var(--navy); }

/* The four steps every vessel goes through. */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.step {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 20px; border-radius: 14px; background: var(--bg);
  box-shadow: var(--shadow-sm);
}
.step .step-n { font-size: 13px; font-weight: 600; color: var(--muted); }
.step .step-name { display: block; font-size: 17px; font-weight: 700; color: var(--navy); }
.step p { margin: 4px 0 0; font-size: 14px; line-height: 1.45; color: var(--ink-soft); }
.step.current { outline: 2px solid var(--steel); outline-offset: -2px; }

@media (max-width: 900px) {
  .fig-row, .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .choice-grid { grid-template-columns: minmax(0, 1fr); }
  .lead-figure { font-size: 48px; }
  .lead-title { font-size: 30px; }
  .choice-card .choice-body { padding: 20px; }
}
@media (max-width: 560px) {
  .steps { grid-template-columns: minmax(0, 1fr); }
  .fig-row { gap: 12px; }
  .fig-row.three { grid-template-columns: minmax(0, 1fr); }
  .fuel-year .fuel-saved { grid-template-columns: minmax(0, 1fr); }
  .fig-card { padding: 16px; gap: 8px; }
  .fig-card .fig-value { font-size: 22px; }
}

/* ---------- Study page: the answer first ---------- */
.study-head { margin-bottom: 14px; }
.study-head .eyebrow {
  display: block; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.4px; color: var(--muted); margin-bottom: 4px;
}
.study-head h2 { margin: 0; font-size: 20px; font-weight: 700; }

.answer {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 40px;
  background: var(--bg); border-radius: 20px; padding: 40px 44px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.answer.answer-empty { grid-template-columns: minmax(0, 1fr); }
.answer-text { display: flex; flex-direction: column; gap: 18px; }
.answer-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--muted); }
.answer-basis { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; font-size: 16px; color: var(--ink-soft); }
.answer .btn .ico { margin-right: 6px; }

.fuel-year {
  display: flex; flex-direction: column; gap: 18px;
  padding: 28px; border-radius: 16px; background: var(--bg-soft);
}
.fuel-year h3 { margin: 0; font-size: 15px; font-weight: 700; }
.fuel-bar { display: flex; flex-direction: column; gap: 8px; }
.fuel-bar-label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--ink-soft); }
.fuel-bar-label strong { color: var(--navy); }
.fuel-bar-track { display: flex; height: 22px; border-radius: 6px; overflow: hidden; }
.fuel-bar-track .seg { display: block; height: 100%; }
.fuel-bar-track .seg.diesel { background: #8A97A6; }
.fuel-bar-track .seg.hybrid { background: var(--steel); }
.fuel-bar-track .seg.saved-seg { background: var(--green); }
.fuel-saved {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
  padding-top: 16px; border-top: 1px solid var(--border-soft);
}
.fuel-saved .lead-figure.md { font-size: 30px; white-space: nowrap; }

.answer-grid {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px;
  margin: 20px 0;
}
.answer-charts { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.fuel-goes { display: flex; flex-direction: column; gap: 16px; }
.fuel-goes .card-head { margin-bottom: 0; }
.mode-row { display: flex; flex-direction: column; gap: 6px; }
.mode-row-label { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.mode-row-label span { font-weight: 600; color: var(--navy); }
.mode-track { height: 10px; border-radius: 5px; background: var(--bg-pale); overflow: hidden; }
.mode-track span { display: block; height: 100%; border-radius: 5px; background: var(--steel); }
.mode-sub { font-size: 13px; color: var(--muted); }


@media (max-width: 900px) {
  .answer { grid-template-columns: minmax(0, 1fr); padding: 24px 20px; gap: 24px; }
  .answer-grid { grid-template-columns: minmax(0, 1fr); }
}
/* Where the saving comes from, in percentage points of the diesel-only fuel. */
/* Where the saving comes from: one bar shared out by lever, in shades of the one blue. */
.split-bar { display: flex; height: 12px; max-width: 440px; margin: 2px 0 12px; border-radius: 6px; overflow: hidden; background: var(--border-soft); }
.split-seg { display: block; height: 100%; }
.split-seg + .split-seg { border-left: 2px solid var(--bg); }
.split-seg.s1, .split-key.s1 { background: #1D6FB8; }
.split-seg.s2, .split-key.s2 { background: #389DE7; }
.split-seg.s3, .split-key.s3 { background: #9CCDF2; }
.split-key { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; vertical-align: 2px; }
.answer-invest { display: flex; flex-direction: column; gap: 2px; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.answer-invest strong { font-family: var(--font-num); font-size: 22px; font-weight: 500; color: var(--navy); }
.answer-invest span { font-size: 13px; color: var(--muted); }
.answer-split { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.answer-split > div { display: flex; flex-direction: column; }
.answer-split strong { font-size: 22px; font-weight: 700; color: var(--navy); }
.answer-split span { font-size: 13px; color: var(--muted); }

/* ---------- Fleet page ---------- */
.fleet-head { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 20px; }
.fleet-head h1 { margin: 0; font-size: 34px; font-weight: 600; }
.fleet-head .btn { white-space: nowrap; }
.fleet-head .btn .ico { margin-right: 6px; }

/* The four steps as numbers: how far the fleet has got. Zero is grey. */
/* Logged against expected: one line under a ship's numbers, or atop a crossing's check. */
.step-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
a.step-stat { color: inherit; }
a.step-stat:hover { box-shadow: var(--shadow); }
.step-stat {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg); border-radius: 16px; padding: 20px 22px; box-shadow: var(--shadow-sm);
}
.step-stat-name { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.step-stat-num { font-family: var(--font-num); font-size: 48px; line-height: 1; font-weight: 500; color: var(--navy); font-variant-numeric: tabular-nums; }
.step-stat-num small { font-size: 20px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.step-stat-cap { font-size: 14px; color: var(--ink-soft); }
.step-stat.zero .step-stat-num { color: var(--muted-2); }
.step-stat.zero .step-stat-cap { color: var(--muted); }

.stage-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; background: var(--bg);
  font-size: 13px; font-weight: 600; color: var(--steel);
}
.ship-figs, .equip-figs { display: flex; flex-wrap: wrap; gap: 14px 28px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.ship-figs > div, .equip-figs > div > div { display: flex; flex-direction: column; gap: 2px; }
.ship-figs strong, .equip-figs strong { font-size: 20px; font-weight: 700; color: var(--navy); }
.ship-figs span, .equip-figs span:not(.icon-chip) { font-size: 13px; color: var(--muted); }
.equip-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.equip-figs > div { display: flex; gap: 12px; align-items: center; }

@media (max-width: 900px) {
  .step-stats { gap: 10px; }
  .step-stat { padding: 14px; }
  .step-stat-num { font-size: 32px; }
  .step-stat-num small { display: block; font-size: 15px; margin-top: 4px; }
  .step-stat-name .ico { display: none; }
  .fleet-head h1 { font-size: 28px; }
}
@media (max-width: 560px) {
  .equip-figs { grid-template-columns: minmax(0, 1fr); }
}

/* Fleet: a plain band of figures, then one row per ship with its figures in columns, grouped
   Measured, Modelled, Set up, so ships compare straight down the page. */
.fleet-band {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft);
  margin-bottom: 28px;
}
.band-fig {
  display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 6px;
  padding: 16px 20px; border-left: 1px solid var(--border-soft);
}
.band-fig:first-child { border-left: 0; padding-left: 0; }
.band-num { font-family: var(--font-num); font-size: 30px; line-height: 1.05; font-weight: 500; color: var(--navy); font-variant-numeric: tabular-nums; }
.band-cap { font-size: 14px; color: var(--muted); }
.band-name { grid-column: 1 / -1; margin-top: 6px; font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.band-fig.zero .band-num { color: var(--muted-2); }

.fleet-list { background: var(--bg); border: 1px solid var(--border-soft); border-radius: 8px; overflow: hidden; margin-bottom: 32px; }
.fleet-row {
  display: grid; align-items: center; column-gap: 24px;
  grid-template-columns: minmax(0, 2.4fr) 84px 112px 76px minmax(150px, 1.3fr) 88px minmax(0, 1.6fr);
  padding: 12px 20px; border-top: 1px solid var(--border-soft);
}
.list-head {
  border-top: 0; padding-top: 11px; padding-bottom: 11px;
  font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap;
}
.c-num { text-align: right; }
.c-num small { display: none; }
/* The bar column's heading is its key: a green bar is measured, a blue tick modelled. */
.list-head .fleet-scale { display: flex; justify-content: flex-start; gap: 14px; text-transform: none; letter-spacing: 0; font-size: 12px; }
.fleet-scale .key { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.key-meas { display: inline-block; width: 14px; height: 4px; border-radius: 2px; background: var(--saved-fg); }
.key-pred { display: inline-block; width: 2px; height: 12px; background: var(--brand); }
.fleet-group {
  margin: 0; padding: 9px 20px; background: var(--bg-soft); border-top: 1px solid var(--border-soft);
  font-family: var(--font-sans); font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.fleet-group b { margin-left: 6px; font-weight: 600; color: var(--navy); }
a.ship-row { color: inherit; text-decoration: none; }
a.ship-row:hover { background: var(--bg-soft); }
a.ship-row:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
.c-ship, .c-rep { min-width: 0; }
.ship-name { display: block; font-family: var(--font-num); font-size: 15px; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ship-meta { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ship-row .c-num strong { font-family: var(--font-num); font-size: 18px; font-weight: 500; color: var(--navy); font-variant-numeric: tabular-nums; }
.ship-row .c-num strong.meas { color: var(--saved-fg); }
.ship-row .c-num strong.tone-bad { color: var(--bad-fg); }
.ship-row .c-num.empty strong { color: var(--muted-2); }
.ship-row .c-date { font-size: 13px; color: var(--muted); }
.ship-report { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ship-report .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: currentColor; }
.ship-report.ok { color: var(--ok-fg); }
.ship-report.warn { color: var(--warn-fg); }
.ship-report.bad { color: var(--bad-fg); }
/* Measured as a bar, modelled as a tick, both on the fleet's one scale. */
.saving-track { position: relative; display: block; height: 4px; border-radius: 2px; background: var(--border-soft); }
.saving-meas { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--saved-fg); }
.saving-pred { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--brand); }
@media (max-width: 900px) {
  .list-head { display: none; }
  .fleet-row { padding: 12px 14px; }
  .ship-row { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 12px; row-gap: 8px; }
  .ship-row .c-ship, .ship-row .c-rep { grid-column: 1 / -1; }
  .ship-row .c-bar, .ship-row .c-date, .ship-row .c-rep:empty { display: none; }
  .ship-row .c-num { text-align: left; }
  .ship-row .c-num small { display: block; font-size: 12px; color: var(--muted); }
  .fleet-group { padding: 9px 14px; }
}
@media (max-width: 560px) {
  .band-fig { padding: 12px 14px; }
  .band-num { font-size: 22px; }
  .band-fig:nth-child(odd) { border-left: 0; padding-left: 0; }
}

/* Voyages: the fleet list's rows with a voyage's columns; voyages that need work lead. */
.voy-panel { margin-bottom: 24px; }
.voyage-list .fleet-row { grid-template-columns: minmax(0, 1.7fr) 84px 76px 76px minmax(130px, 1.2fr) 80px 72px minmax(0, 1.4fr); column-gap: 20px; }
.voyage-list.laps .fleet-row { grid-template-columns: minmax(0, 1.9fr) 88px 80px 80px minmax(150px, 1.3fr) minmax(0, 1.4fr); }
.fleet-group.warn b { color: var(--warn-fg); }
.fleet-sub { margin: 0; padding: 7px 20px; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--muted); }
.ship-name a { color: inherit; text-decoration: none; }
.ship-name a:hover { text-decoration: underline; }
.voy-tag {
  margin-left: 8px; padding: 0 5px; border: 1px solid var(--border); border-radius: 4px;
  font-family: var(--font-sans); font-size: 12px; font-weight: 500; color: var(--muted); vertical-align: 1px;
}
.voy-note { font-size: 12px; color: var(--warn-fg); }
.voy-note::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.voy-act { margin-left: 6px; font-size: 13px; font-weight: 600; color: var(--brand); white-space: nowrap; }
.fleet-strip { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 22px; margin: 0; padding: 12px 20px; border-top: 1px solid var(--border-soft); font-size: 13px; color: var(--muted); }
.fleet-strip > span { white-space: nowrap; }
.fleet-strip a { color: var(--navy); }
@media (max-width: 900px) {
  .voyage-list .fleet-row, .voyage-list.laps .fleet-row { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 12px; }
  .voyage-list .list-head { display: none; }
  .ship-row .c-opt { display: none; }
  .fleet-sub, .fleet-strip { padding-left: 14px; padding-right: 14px; }
}

/* Studies: the fleet list's rows with a study's columns; the final study leads and every bar
   ticks where it stands. */
.study-list .fleet-row { grid-template-columns: minmax(0, 2fr) 92px 80px 108px 84px minmax(140px, 1.3fr); }
.study-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.study-head h3 { margin: 0; font: inherit; color: inherit; letter-spacing: inherit; }
.study-head h3 b { margin-left: 6px; font-weight: 600; color: var(--navy); }
.study-pick { display: flex; align-items: center; gap: 8px; margin: 0; min-width: 0; text-transform: none; letter-spacing: 0; }
.study-pick label { font-size: 13px; font-weight: 500; color: var(--muted); }
.study-pick .select { width: auto; min-width: 0; max-width: 22em; height: 34px; padding-top: 4px; padding-bottom: 4px; }
.study-pick .btn { height: 34px; min-height: 34px; padding: 4px 12px; }
.voy-tag.final { color: var(--brand); border-color: var(--brand); }
.study-list { margin-bottom: 0; }
.study-ems { margin: 10px 2px 0; font-size: 13px; }
.key-study { display: inline-block; width: 14px; height: 4px; border-radius: 2px; background: var(--brand); opacity: 0.55; }
.key-final { display: inline-block; width: 2px; height: 12px; background: var(--navy); }
.saving-track.study .saving-meas { background: var(--brand); opacity: 0.55; }
.saving-track.study .saving-pred { background: var(--navy); }
@media (max-width: 900px) {
  .study-list .fleet-row { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 12px; }
  .study-list .list-head { display: none; }
  .study-pick { flex: 1 1 100%; }
  .study-pick .select { flex: 1 1 auto; }
}

/* The net benefit item by item: each bar floats from where the last one ended (Paul, 15 Oct). */
.breakdown, .payback-card { margin-top: 20px; }
.bd-head { margin: 14px 0 2px; font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.bd-row { display: grid; grid-template-columns: minmax(150px, 230px) minmax(0, 1fr) 112px; align-items: center; gap: 16px; padding: 6px 0; }
.bd-label strong { display: block; font-size: 14px; font-weight: 600; color: var(--navy); }
.bd-label span { display: block; font-size: 12px; color: var(--muted); }
.bd-track { position: relative; height: 18px; }
.bd-bar { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: #8A97A6; }
.bd-row.brings .bd-bar, .bd-row.carbon .bd-bar { background: var(--green); }
.bd-row.total, .bd-row.upside-total { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.bd-row.total .bd-bar { background: var(--brand); }
.bd-row.upside .bd-bar { background: #9CCDF2; }
.bd-row.upside-total .bd-bar { background: transparent; border: 2px dashed var(--brand); }
.bd-row.total .bd-label strong, .bd-row.upside-total .bd-label strong { font-size: 15px; }
.bd-value { text-align: right; white-space: nowrap; font-family: var(--font-num); font-size: 15px; font-weight: 500; color: var(--navy); font-variant-numeric: tabular-nums; }
.bd-row.brings .bd-value, .bd-row.carbon .bd-value { color: var(--saved-fg); }
@media (max-width: 560px) {
  .bd-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .bd-track { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- Vessel page ---------- */
.vessel-head { align-items: flex-end; }
.vessel-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.vessel-tags .tag { background: var(--bg); }
.new-study-panel .equip-panel { background: var(--bg); border-radius: 14px; padding: 20px 24px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.step-stat-num.saved { color: var(--saved-fg); }
.vessel-equipment { margin-bottom: 24px; }
.vessel-equipment .equip-figs { grid-template-columns: repeat(4, minmax(0, 1fr)); padding-top: 0; border-top: 0; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 22px; font-weight: 700; }
.vessel-studies { margin-bottom: 24px; }
.reg-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.reg-row > div { display: flex; flex-direction: column; gap: 2px; }

@media (max-width: 900px) {
  .vessel-equipment .equip-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vessel-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  .vessel-equipment .equip-figs { grid-template-columns: minmax(0, 1fr); }
}

/* Asks before a ship or a crossing is deleted. */
.confirm-delete { display: flex; flex-direction: column; gap: 18px; }
.confirm-delete h1 { margin: 0; font-size: 24px; }
.confirm-delete .page-actions { display: flex; gap: 12px; }

/* ---------- Equipment file and part dialogs ---------- */
.equip-file { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.link-btn {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--steel);
}
.link-btn:hover { color: var(--navy); }
.slot-id { align-self: center; min-width: 64px; font-size: 12px; font-weight: 600; color: var(--muted-2); }
.eq-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.eq-field .input, .eq-field input, .eq-field select { width: 100%; }

/* ---------- Single-line diagram ---------- */
/* Wide layouts scroll sideways inside the card, never the page. */
.sld-wrap { overflow-x: auto; }
.sld { display: block; max-width: 100%; height: auto; margin: 0 auto; font-family: var(--font-sans); }
.sld-bus { stroke: var(--navy); stroke-width: 6; stroke-linecap: round; }
.sld-line, .sld-tie-line { stroke: var(--muted); stroke-width: 2; fill: none; }
.sld-sym { fill: var(--bg); stroke: var(--navy); stroke-width: 2; }
.sld-conv { fill: var(--bg); stroke: var(--muted); stroke-width: 2; }
.sld-icon { fill: none; stroke: var(--navy); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sld-letter { font-size: 16px; font-weight: 700; fill: var(--navy); }
.sld-label { font-size: 12px; font-weight: 600; fill: var(--ink); }
.sld-small { font-size: 12px; fill: var(--muted); }
.sld-bus-label { font-size: 12px; font-weight: 700; fill: var(--navy); }
.sld-left { text-anchor: start; }
@media (max-width: 900px) {
  /* Keep labels readable on a phone: draw at full size and let the card scroll. */
  .sld { max-width: none; }
}
.sld-dot { fill: var(--navy); }

/* Diagram parts are links to their edit box. */
.sld-link { cursor: pointer; }
.sld-link:hover .sld-sym, .sld-link:focus .sld-sym,
.sld-link:hover .sld-conv, .sld-link:focus .sld-conv { stroke: var(--steel); stroke-width: 3; }
.sld-link:hover .sld-bus, .sld-link:focus .sld-bus { stroke: var(--steel); }
.sld-link:focus { outline: none; }
.sld-link:focus-visible .sld-label { text-decoration: underline; }

/* Edit box for one part. */
.slot-dialog {
  width: min(560px, calc(100vw - 32px)); border: 0; border-radius: 16px; padding: 22px 24px;
  background: var(--bg); color: var(--ink); box-shadow: var(--shadow);
}
.slot-dialog::backdrop { background: rgba(14, 40, 65, 0.45); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.dialog-head h3 { margin: 0; font-size: 18px; }
.dialog-head .slot-id { margin-left: 6px; }
.dialog-close { color: var(--muted); display: inline-flex; }
/* Groups a form's fields so one attribute makes them read-only, without a box of its own. */
fieldset.bare { border: 0; padding: 0; margin: 0; min-width: 0; }
.dialog-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.dialog-fields .eq-wide { grid-column: 1 / -1; }
.dialog-check { display: flex; align-items: center; gap: 8px; font-size: 14px; grid-column: 1 / -1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* Fleet card: the name opens the ship, the figure opens its study. */
.ship-link { color: inherit; }
.ship-link:hover { color: var(--steel); text-decoration: underline; }
.figure-link { display: block; color: inherit; }
.figure-link:hover .lead-caption { color: var(--steel); text-decoration: underline; }
.section-head h2 .tag { margin-left: 8px; vertical-align: middle; font-size: 12px; }
.vessel-crossings { margin-bottom: 24px; }

/* A study whose equipment differs from its ship's. */
.diff-box { background: var(--bg-soft); border-radius: 12px; padding: 14px 18px; margin-bottom: 16px; }
.diff-box ul { margin: 8px 0 12px; padding-left: 18px; font-size: 14px; color: var(--ink-soft); }
.diff-box form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
a.tag:hover { color: var(--navy); background: var(--bg-ice); }

/* ---------- Ship page tabs ---------- */
.tab-count {
  display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px;
  border-radius: 999px; background: var(--steel); color: #fff;
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
.tab-count.zero { background: var(--bg-pale); color: var(--muted); }
.ship-tabs .tabpanel { flex-direction: column; gap: 20px; }
.ship-tabs { margin-bottom: 32px; }
.ship-tabs .tabpanel > .card, .ship-tabs .tabpanel > section { margin-bottom: 0; }
.ship-tabs .section-head { margin-bottom: 0; }

/* Something not created yet: an icon, one line, and the action that creates it. */
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 36px 24px; text-align: center; color: var(--muted);
}
.empty-state > .ico { width: 36px; height: 36px; color: var(--muted-2); }
.empty-state .btn .ico { margin-right: 6px; }
.empty-state strong { font-size: 17px; color: var(--navy); }
.empty-state span { font-size: 14px; max-width: 46ch; }
.empty-state .btn { margin-top: 8px; }

/* Where you are, in the top bar: Fleet > ship > study. One line; on a narrow
   screen it is cut short rather than wrapping. */
.topcrumbs {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 15px; color: var(--bar-fg-soft);
}
.topcrumbs a { color: var(--bar-fg-soft); font-weight: 600; }
.topcrumbs a:hover { color: var(--bar-fg); }
.topcrumbs strong { color: var(--bar-fg); font-weight: 600; }
@media (max-width: 560px) {
  .brand-name { display: none; }
  .topcrumbs { font-size: 14px; }
}

/* ---------- Drag and drop on the diagram ---------- */
.sld-palette {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px; margin-bottom: 12px; border-radius: 12px;
  background: var(--bg-soft); border: 2px dashed transparent;
}
.sld-palette-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.sld-palette-part {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); color: var(--navy); font: inherit; font-size: 13px; font-weight: 600;
  cursor: grab; touch-action: none;
}
.sld-palette-part:hover { border-color: var(--steel); }
.sld-palette-part.on { border-color: var(--steel); background: var(--steel); color: var(--bg); }
.sld.sld-picking { cursor: copy; }
.sld-drop-remove { display: none; font-size: 13px; font-weight: 600; color: var(--muted); }
.sld-palette.sld-can-remove { border-color: var(--muted-2); }
.sld-palette.sld-can-remove .sld-drop-remove { display: inline; }
.sld-status { margin-left: auto; font-size: 13px; color: var(--muted); }
.sld-rate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.sld-rate[hidden], .sld-rate [hidden] { display: none; }
.sld-rate label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.sld-rate .input { width: 8em; }
@media (min-width: 701px) {
  .sld .sld-part[data-slot] { cursor: grab; touch-action: none; }
}
.sld-target .sld-bus { stroke: var(--steel); stroke-width: 10; }
body.sld-dragging, body.sld-dragging * { cursor: grabbing !important; user-select: none; }
.sld-ghost {
  position: fixed; z-index: 100; pointer-events: none;
  padding: 6px 10px; border-radius: 8px; background: var(--navy); color: var(--bg);
  font-size: 13px; font-weight: 700; box-shadow: var(--shadow);
}
/* Dragging needs room and a pointer; a phone keeps the diagram to read and click. */
@media (max-width: 700px) {
  .sld-palette { display: none; }
}

/* ---------- Crossing page ---------- */
.mode-track.saved-track span { background: var(--green); }
.crossing-engineers { display: flex; flex-direction: column; gap: 20px; margin-bottom: 20px; }
.crossing-engineers h4, .eng-charts h4 { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.crossing-engineers h4 .meta, .eng-charts h4 .meta { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
.crossing-charts, .crossing-health { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 900px) { .crossing-charts, .crossing-health { grid-template-columns: 1fr; } }
.route-map { height: 340px; border-radius: 10px; overflow: hidden; background: var(--bg-pale); }
.route-map .leaflet-tooltip { font: 600 12px Inter, "Segoe UI", system-ui, sans-serif; }

/* ---------- Fleet card: predicted beside measured ---------- */
.crossing-prediction { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }

/* ---------- Links shown as buttons beside text ---------- */
.card-head-end { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.link-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tabpanel > .page-actions { margin-bottom: 16px; }
.card.stub .btn { margin-top: 6px; }
.reg-subject .btn { margin-left: 12px; vertical-align: middle; }

/* ===== Reports (ems-core ADR-0147): the year as positions against a line ===== */
.rep-tabs { display: flex; flex-direction: column; gap: 18px; }
.rep-subtabs { display: flex; align-items: baseline; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.rep-when { margin-left: auto; color: var(--muted); font-size: 13px; padding: 10px 0; }
/* Cards in a row share one height; type size, not card size, puts the verdict first. */
.rep-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.rep-card { display: flex; flex-direction: column; gap: 8px; }
.rep-head { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.rep-verdict { margin: 0; font-size: 22px; font-weight: 700; color: var(--navy); }
.rep-sub { margin: 0; color: var(--ink-soft); }
.rep-list { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 6px 0 0; }
.rep-list dt { color: var(--muted); }
.rep-list dd { margin: 0; text-align: right; color: var(--navy); font-variant-numeric: tabular-nums; }
.rep-missing, .rep-muted { color: var(--muted); }
.rep-note { margin: auto 0 0; color: var(--muted); font-size: 12.5px; }
.rep-more { margin-top: auto; font-size: 13px; }
/* A D or E rating, a required plan or a FuelEU deficit: the caution hatch on the card edge, plus words. */
.rep-caution { border-left: 4px solid var(--muted); }
.rep-scale { position: relative; height: 18px; margin: 26px 0 0; background: var(--bg-pale); }
.rep-band { position: absolute; top: 0; height: 100%; background: var(--bg-pale);
  border-right: 1px solid var(--border); color: var(--muted); font-size: 12px; text-align: center; line-height: 18px; }
.rep-band.hatch { background: repeating-linear-gradient(45deg, var(--bg-pale) 0 5px, var(--border) 5px 7px);
  color: var(--navy); font-weight: 700; }
.rep-line { position: absolute; top: -6px; bottom: -6px; width: 2px; margin-left: -1px; background: var(--navy); }
.rep-mark { position: absolute; top: -14px; margin-left: -7px; width: 0; height: 0;
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 11px solid var(--navy); }
.rep-mark.ems { border-top-color: var(--sky); }
.rep-mark.without::after { content: ""; position: absolute; left: -5px; top: -10px;
  border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 8px solid var(--bg); }
.rep-mark.without { border-top: 11px solid var(--navy); }
.rep-ticks { position: relative; height: 16px; margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.rep-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.rep-ticks span:first-child[style*="left:0"] { transform: none; }
.rep-ticks span[style*="left:100%"] { transform: translateX(-100%); }
.rep-avoided .tbl { margin-top: 6px; }
.rep-ems { color: var(--sky); font-weight: 600; }
.rep-empty .rep-list { max-width: 640px; }
@media (max-width: 900px) { .rep-row { grid-template-columns: 1fr; } }
/* One voyage, laid out as a report (the crossing page). */
.voy-head { display: flex; flex-direction: column; gap: 10px; position: relative; padding-right: 56px; }
.voy-head > .more-menu { position: absolute; top: 0; right: 0; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.rep-section { margin: 8px 0 0; font-size: 16px; color: var(--navy); }

/* Leaflet stacks its panes up to z-index 1000; kept inside the map, they never cover a page menu. */
.leaflet-container { isolation: isolate; }

/* A page's occasional actions behind one button; a native details element, no menu script. */
.more-menu { position: relative; }
.more-btn {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg); color: var(--navy); font-size: 18px; font-weight: 600; letter-spacing: 1px;
}
.more-btn::-webkit-details-marker { display: none; }
.more-menu[open] > .more-btn, .more-btn:hover { border-color: var(--steel); }
.more-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px;
  display: flex; flex-direction: column; padding: 6px; border-radius: 12px;
  background: var(--bg); box-shadow: var(--shadow); border: 1px solid var(--border-soft);
}
.more-list a { padding: 10px 12px; border-radius: 8px; color: var(--navy); font-weight: 600; font-size: 14px; text-decoration: none; }
.more-list a:hover { background: var(--bg-soft); }
.more-list a.danger { color: var(--bad-fg); }
/* On a phone the head stacks and its actions sit at the left: the menu opens from there. */
@media (max-width: 700px) {
  .head-actions { position: relative; }
  .head-actions > .more-menu { position: static; }
  .head-actions .more-list { left: 0; right: auto; }
}
.voy-head, .voy-head ~ .rep-row { margin-bottom: 18px; }
.rep-card .route-map { height: 240px; }
.rep-submissions strong { color: var(--navy); }
.rep-caution-word { text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.rep-days { font-size: 20px; }
.rep-footnote { margin: 0 0 12px; }
.opt-updating { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
/* The voyage measured beside each ticked study re-run on its stretch. */
.voy-compare { margin-bottom: 18px; }
.study-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 0 0 14px; }
.study-pick-item { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink-soft); }
.study-pending { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; color: var(--muted); font-weight: 600; }
.study-pending form { margin: 0; }
.compare-tbl th .meta { display: block; font-weight: 400; }
/* Totals beside phases: two tables, each the width of its half of the card. */
.compare-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 32px; align-items: start; }
.compare-split .compare-tbl { width: 100%; }
.compare-tbl th:first-child { width: 44%; }
@media (max-width: 900px) { .compare-split { grid-template-columns: minmax(0, 1fr); } }
.compare-tbl td.num { white-space: nowrap; }
@media (max-width: 600px) { .compare-tbl td.num { white-space: normal; } }
/* The reports in one line, on the ship head and the fleet card. */
.tabbed .tabpanel > form.voy-filter, .voy-filter { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin: 0 0 12px; }
.voy-filter label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.rep-years { margin: 0 0 12px; }
.report-line { display: block; margin: 6px 0 0; color: var(--ink-soft); font-weight: 600; font-size: 14px; }
.report-line.ok { color: var(--ok-fg); }
.report-line.warn { color: var(--warn-fg); }
.report-line.bad { color: var(--bad-fg); }
/* A number column's heading sits over its numbers. */
.tbl th.num { text-align: right; }

/* A link inside a sentence is underlined, so it does not rely on colour alone. */
p a:not(.btn):not(.link-btn):not(.go-link), li a:not(.btn):not(.link-btn):not(.go-link), .legal a, footer span a {
  text-decoration: underline; text-underline-offset: 2px;
}
