/* Layout: one app window. Deep Lane rail on the left, a top bar, and one working screen at a time. */
:root {
  --teal: #11756d;
  --teal-ink: #0e625b;
  --signal: #19a498;
  --rail: #0c4f4a;
  --rail-fg: #d7ece9;
  --rail-strong: #ffffff;
  --rail-muted: #7fafa9;
  --rail-sub: #7fd3c9;
  --rail-hover: rgba(255, 255, 255, 0.06);
  --rail-on-bg: rgba(25, 164, 152, 0.22);
  --rail-on-fg: #ffffff;
  --rail-icon-on: #5fe0d2;
  --rail-line: rgba(255, 255, 255, 0.1);
  --rail-badge: rgba(255, 255, 255, 0.12);
  --rail-edge: transparent;
  --hello-bg: linear-gradient(135deg, transparent 0 84%, rgba(25, 164, 152, 0.85) 84% 100%),
    linear-gradient(120deg, #11756d, #0c4f4a);
  --hello-fg: #ffffff;
  --hello-muted: #bfe3de;
  --hello-pad: 20px 22px;
  --bg: #f3f7f6;
  --surface: #ffffff;
  --sunk: #e8f0ee;
  --line: #d6e2df;
  --fg: #14211f;
  --muted: #5a6d6a;
  --tint: #e1f2ef;
  --tint-fg: #0e625b;
  --ok: #2e7d46;
  --ok-bg: #e3f3e7;
  --warn: #a65f00;
  --warn-bg: #fcefd9;
  --bad: #b83a2a;
  --bad-bg: #fbe4e0;
  --info: #2b62a6;
  --info-bg: #e2ecf8;
  --scrim: rgba(8, 24, 22, 0.55);
  --toast-bg: #0c4f4a;
  --toast-fg: #ffffff;
  --merge-bg: #fcefd9;
  --merge-fg: #7a4600;
  --shadow: 0 1px 2px rgba(12, 79, 74, 0.06), 0 4px 16px rgba(12, 79, 74, 0.06);
  --display: 'Outfit', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --body: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']):not([data-mode='signature']):not([data-mode='light']) {
    --teal: #1c9c90;
    --teal-ink: #23b3a5;
    --signal: #3cc7b9;
    --rail: #0a2f2c;
    --rail-fg: #bfdad6;
    --rail-muted: #6f9a95;
    --rail-sub: #6fc7bc;
    --rail-hover: rgba(255, 255, 255, 0.05);
    --rail-on-bg: rgba(60, 199, 185, 0.18);
    --rail-line: rgba(255, 255, 255, 0.08);
    --rail-badge: rgba(255, 255, 255, 0.1);
    --rail-edge: #1c302d;
    --hello-bg: linear-gradient(135deg, transparent 0 84%, rgba(60, 199, 185, 0.35) 84% 100%),
      linear-gradient(120deg, #0e4a45, #0a2f2c);
    --hello-fg: #ffffff;
    --hello-muted: #9fcfc8;
    --bg: #0d1716;
    --surface: #132220;
    --sunk: #0f1c1b;
    --line: #223835;
    --fg: #e3eeec;
    --muted: #93aaa6;
    --tint: #173a36;
    --tint-fg: #7fd9ce;
    --ok: #6cc78a;
    --ok-bg: #16301f;
    --warn: #f0b35a;
    --warn-bg: #352611;
    --bad: #f08a7b;
    --bad-bg: #3a1c17;
    --info: #86b2ea;
    --info-bg: #17273b;
    --scrim: rgba(0, 0, 0, 0.6);
    --toast-bg: #23403c;
    --merge-bg: #3a2a10;
    --merge-fg: #f6c978;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme='dark']:not([data-mode='signature']):not([data-mode='light']),
:root[data-mode='dark'] {
  --teal: #1c9c90;
  --teal-ink: #23b3a5;
  --signal: #3cc7b9;
  --rail: #0a2f2c;
  --rail-fg: #bfdad6;
  --rail-muted: #6f9a95;
  --rail-sub: #6fc7bc;
  --rail-hover: rgba(255, 255, 255, 0.05);
  --rail-on-bg: rgba(60, 199, 185, 0.18);
  --rail-line: rgba(255, 255, 255, 0.08);
  --rail-badge: rgba(255, 255, 255, 0.1);
  --rail-edge: #1c302d;
  --hello-bg: linear-gradient(135deg, transparent 0 84%, rgba(60, 199, 185, 0.35) 84% 100%),
    linear-gradient(120deg, #0e4a45, #0a2f2c);
  --hello-fg: #ffffff;
  --hello-muted: #9fcfc8;
  --bg: #0d1716;
  --surface: #132220;
  --sunk: #0f1c1b;
  --line: #223835;
  --fg: #e3eeec;
  --muted: #93aaa6;
  --tint: #173a36;
  --tint-fg: #7fd9ce;
  --ok: #6cc78a;
  --ok-bg: #16301f;
  --warn: #f0b35a;
  --warn-bg: #352611;
  --bad: #f08a7b;
  --bad-bg: #3a1c17;
  --info: #86b2ea;
  --info-bg: #17273b;
  --scrim: rgba(0, 0, 0, 0.6);
  --toast-bg: #23403c;
  --merge-bg: #3a2a10;
  --merge-fg: #f6c978;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}
:root[data-mode='light'] {
  --bg: #f5f6f6;
  --sunk: #eef1f0;
  --line: #e0e5e4;
  --fg: #171c1b;
  --muted: #5f6867;
  --rail: #ffffff;
  --rail-fg: #3b4645;
  --rail-strong: #11756d;
  --rail-muted: #8a9493;
  --rail-sub: #19a498;
  --rail-hover: #f1f4f3;
  --rail-on-bg: #e1f2ef;
  --rail-on-fg: #0e625b;
  --rail-icon-on: #11756d;
  --rail-line: #e0e5e4;
  --rail-badge: #eef1f0;
  --rail-edge: #e0e5e4;
  --hello-bg: transparent;
  --hello-fg: var(--fg);
  --hello-muted: var(--muted);
  --hello-pad: 0;
  --toast-bg: #1f2726;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.04);
  color-scheme: light;
}
:root[data-mode='signature'] {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
.form > .field {
  flex: none;
}
.brand b {
  white-space: nowrap;
}
td.nw,
span.nw {
  white-space: nowrap;
}
html,
body {
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: break-word;
}
h1,
h2,
h3,
h4 {
  font-family: var(--display);
  margin: 0;
  text-wrap: balance;
  letter-spacing: -0.01em;
}
p {
  margin: 0;
}
button {
  font: inherit;
  color: inherit;
}
.num,
td,
.fig {
  font-variant-numeric: tabular-nums;
}
.label {
  font-family: var(--display);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}
svg.i {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== shell ===== */
.app {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100%;
}
.rail {
  background: var(--rail);
  color: var(--rail-fg);
  border-right: 1px solid var(--rail-edge);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: calc(100vh / var(--zm, 1));
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-inline: 8px;
}
.brand img {
  width: 24px;
  height: auto;
}
.brand b {
  font-family: var(--display);
  font-weight: 800;
  font-size: 17px;
  color: var(--rail-strong);
  letter-spacing: 0.02em;
  line-height: 1;
}
.brand small {
  display: block;
  font-family: var(--display);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--rail-sub);
  margin-top: 3px;
}
.brand .lt {
  display: none;
}
:root[data-mode='light'] .brand .lw {
  display: none;
}
:root[data-mode='light'] .brand .lt {
  display: block;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav .label {
  color: var(--rail-muted);
  padding: 12px 10px 4px;
  font-size: 10px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--rail-fg);
  text-decoration: none;
  font-weight: 500;
}
.nav a svg {
  opacity: 0.85;
}
.nav a:hover {
  background: var(--rail-hover);
}
.nav a.on {
  background: var(--rail-on-bg);
  color: var(--rail-on-fg);
}
.nav a.on svg {
  opacity: 1;
  color: var(--rail-icon-on);
}
.nav a .count {
  margin-left: auto;
  font-size: 11px;
  background: var(--rail-badge);
  border-radius: 20px;
  padding: 0 7px;
}
.me {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--rail-line);
}
.me b {
  color: var(--rail-strong);
  display: block;
  line-height: 1.2;
}
.me span {
  font-size: 12px;
  color: var(--rail-muted);
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--signal);
  color: #06302c;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  flex: none;
}
.avatar.sm {
  width: 26px;
  height: 26px;
  font-size: 11px;
}
.avatar.h {
  background: var(--info-bg);
  color: var(--info);
}
.avatar.r {
  background: var(--warn-bg);
  color: var(--warn);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.top {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
}
.search {
  flex: 1 1 260px;
  position: relative;
}
.search label {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 8px 12px;
  color: var(--muted);
}
.search input {
  border: 0;
  background: none;
  outline: none;
  font: inherit;
  color: var(--fg);
  width: 100%;
}
.search label:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--tint);
}
.results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.16);
  padding: 6px;
  max-height: calc(60vh / var(--zm, 1));
  overflow: auto;
  z-index: 30;
}
.results button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.results button:hover,
.results button:focus-visible {
  background: var(--sunk);
}
.results small {
  color: var(--muted);
  font-size: 12px;
}
.results .none {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}
.modes {
  display: inline-flex;
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 3px;
  gap: 2px;
}
.modes > button {
  border: 0;
  background: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.modes > .zoombtn {
  border-left: 1px solid var(--line);
  border-radius: 0 7px 7px 0;
  min-width: 48px;
}
.modes {
  position: relative;
}
.zoompop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}
.zoomhead,
.zoomrow,
.zoomfoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.zoomrow {
  margin: 10px 0 6px;
}
.zoomrow input {
  flex: 1;
  accent-color: var(--teal);
}
.zoomhead span {
  font-weight: 700;
  color: var(--teal);
}
.zoompop .small {
  margin: 0 0 10px;
}
.modes > button.on {
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow);
}
/* "All saved" at the top: quiet when saved, amber while saving or waiting for a connection */
.savestate {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ok);
  background: var(--ok-bg);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.savestate[data-s='saving'],
.savestate[data-s='retry'] {
  color: var(--warn);
  background: var(--warn-bg);
}
.savestate[data-s='stuck'],
.savestate[data-s='refused'] {
  color: #fff;
  background: var(--bad);
}

.content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1320px;
  width: 100%;
}
.pagehead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.pagehead h1 {
  font-size: 26px;
  font-weight: 600;
}
.pagehead p {
  color: var(--muted);
  max-width: 64ch;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== building blocks ===== */
.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
}
.cardhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.cardhead h3 {
  font-size: 16px;
  font-weight: 600;
}
.link {
  color: var(--teal);
  font-weight: 600;
  font-size: 13px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}
.link:hover {
  text-decoration: underline;
}
/* an icon in a link sits level with its words, not on their baseline (owner, 23/11/2026: nothing "not inline") */
.link > svg.i {
  vertical-align: -0.3em;
}
.btn {
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--r);
  padding: 9px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
  white-space: nowrap;
}
.btn svg.i {
  width: 16px;
  height: 16px;
}
.btn.primary {
  background: var(--teal);
  color: #fff;
}
.btn.primary:hover {
  background: var(--teal-ink);
}
.btn.secondary {
  background: var(--surface);
  color: var(--teal);
  border-color: var(--teal);
}
.btn.secondary:hover {
  background: var(--tint);
}
.btn.quiet {
  background: var(--sunk);
  color: var(--fg);
  border-color: var(--line);
}
.btn.quiet:hover {
  border-color: var(--muted);
}
.btn.sm {
  font-size: 12.5px;
  padding: 6px 11px;
  border-radius: 8px;
}
.iconbtn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: var(--sunk);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}
.iconbtn:hover {
  background: var(--tint);
  color: var(--tint-fg);
}
/* status labels are coloured text, never a filled pill (Abaan's colour rule: coloured text only) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 0;
  border-radius: 999px;
  white-space: nowrap;
}
.pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill.ok {
  background: none;
  color: var(--ok);
}
.pill.warn {
  background: none;
  color: var(--warn);
}
.pill.bad {
  background: none;
  color: var(--bad);
}
.pill.info {
  background: none;
  color: var(--info);
}
.pill.teal {
  background: none;
  color: var(--tint-fg);
}
.pill.grey {
  background: none;
  color: var(--muted);
}
.seg {
  display: inline-flex;
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 3px;
  flex-wrap: wrap;
}
.seg button {
  border: 0;
  background: none;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
}
.seg button.on {
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow);
}
.seg button em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  margin-left: 4px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chips button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.chips button.on {
  background: var(--tint);
  border-color: var(--teal);
  color: var(--tint-fg);
}
.chips button em {
  font-style: normal;
  font-weight: 500;
  margin-left: 4px;
  opacity: 0.8;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.filter {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 7px 12px;
  color: var(--muted);
  flex: 0 1 280px;
  min-width: 0;
}
.filter input {
  border: 0;
  background: none;
  outline: none;
  font: inherit;
  color: var(--fg);
  width: 100%;
  min-width: 0;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  border: 0;
  background: none;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--muted);
  padding: 9px 12px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
}
.tabs button.on {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi .v {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 6px;
}
.kpi .v small {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}
.kpi .s {
  font-size: 12.5px;
  color: var(--muted);
}
.bar {
  height: 6px;
  border-radius: 6px;
  background: var(--sunk);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--signal));
  border-radius: 6px;
}
.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.hello {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--hello-bg);
  color: var(--hello-fg);
  padding: var(--hello-pad);
  border-radius: var(--r-lg);
}
.hello h1 {
  font-size: 24px;
  font-weight: 600;
}
.hello p {
  color: var(--hello-muted);
}
.hello .btn.primary {
  background: var(--surface);
  color: var(--teal);
}
:root[data-mode='light'] .hello .btn.primary {
  background: var(--teal);
  color: #fff;
}

.list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}
.list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.list li:first-child {
  border-top: 0;
  padding-top: 0;
}
.list li b {
  font-weight: 600;
  min-width: 0;
}
.list li p {
  grid-column: 1;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 0;
}
.list li > .side {
  grid-row: 1 / span 2;
  grid-column: 2;
  text-align: right;
}
.list li.click {
  cursor: pointer;
}
.list li.click:hover b {
  color: var(--teal);
}
.alert {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.alert:first-child {
  border-top: 0;
  padding-top: 0;
}
.alert .sev {
  align-self: stretch;
  border-radius: 4px;
  background: var(--info);
}
.alert .sev.bad {
  background: var(--bad);
}
.alert .sev.warn {
  background: var(--warn);
}
.alert b {
  font-weight: 600;
}
.alert p {
  font-size: 12.5px;
  color: var(--muted);
}
.slot {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 12px;
  padding: 6px 0;
}
.slot time {
  font-family: var(--display);
  font-weight: 600;
  padding-top: 6px;
}
.slot .ev {
  border-left: 3px solid var(--signal);
  background: var(--tint);
  border-radius: 0 8px 8px 0;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.slot .ev.sale {
  border-color: var(--info);
  background: var(--info-bg);
}
.slot .ev b {
  display: block;
  font-weight: 600;
}
.slot .ev span {
  font-size: 12.5px;
  color: var(--muted);
}
.whos {
  display: flex;
  gap: 3px;
}

.tablewrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 680px;
}
th {
  font-family: var(--display);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted);
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
td.r,
th.r {
  text-align: right;
}
td small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
tbody tr.click {
  cursor: pointer;
}
tbody tr.click:hover {
  background: var(--sunk);
}
tfoot td {
  font-weight: 700;
  border-top: 1px solid var(--line);
  border-bottom: 0;
  background: var(--sunk);
}
.cut {
  color: var(--teal);
  font-weight: 700;
}
.nameCell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nameCell b {
  font-weight: 600;
  display: block;
}

/* properties */
.pgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 14px;
}
.prop {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-lg);
}
.prop:hover {
  border-color: var(--teal);
}
.prop .ph {
  height: 104px;
  position: relative;
  background: linear-gradient(135deg, transparent 0 64%, var(--signal) 64% 100%),
    linear-gradient(160deg, var(--teal), var(--rail));
}
.prop .ph.let {
  background: linear-gradient(135deg, transparent 0 64%, var(--signal) 64% 100%),
    linear-gradient(160deg, #2c7a8c, #16454f);
}
.prop .ph.land {
  background: linear-gradient(135deg, transparent 0 64%, #d69a3c 64% 100%), linear-gradient(160deg, #7a6a3a, #4a3f22);
}
.prop .ph.com {
  background: linear-gradient(135deg, transparent 0 64%, #8fa3b8 64% 100%), linear-gradient(160deg, #3d5568, #22323f);
}
.prop .ph .pill {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 2px 9px;
  background: var(--surface);
}
.prop .ph .ref {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.85);
}
.prop .bd {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.prop .bd > .pill {
  align-self: flex-start;
}
.prop h4 {
  font-size: 16px;
  font-weight: 600;
}
.prop .area {
  font-size: 12.5px;
  color: var(--muted);
}
.prop .facts {
  display: flex;
  gap: 12px;
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.price {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  color: var(--teal);
}
.price small {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* pipeline */
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(230px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: start;
}
.col {
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 220px;
}
.col.over {
  border-color: var(--teal);
  background: var(--tint);
}
.colhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 2px 4px 4px;
}
.colhead b {
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
}
.colhead span {
  font-size: 12px;
  color: var(--muted);
}
.deal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: grab;
  box-shadow: var(--shadow);
}
.deal:active {
  cursor: grabbing;
}
.deal.dragging {
  opacity: 0.4;
}
.deal b {
  font-weight: 600;
}
.deal p {
  font-size: 12.5px;
  color: var(--muted);
}
.deal .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.deal .fee {
  font-family: var(--display);
  font-weight: 600;
  color: var(--teal);
}
.deal .mv {
  display: flex;
  gap: 4px;
}
.deal .mv button {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.deal .mv button:hover:not([disabled]) {
  border-color: var(--teal);
  color: var(--teal);
}
.deal .mv button[disabled] {
  opacity: 0.35;
  cursor: default;
}
.deal .mv svg.i {
  width: 14px;
  height: 14px;
}

/* accounts */
.chart svg {
  width: 100%;
  height: auto;
  display: block;
}
.chart text {
  font-family: var(--body);
  font-size: 11px;
  fill: var(--muted);
}
.chart .grid {
  stroke: var(--line);
}
.chart .b1 {
  fill: var(--teal);
}
.chart .b2 {
  fill: var(--signal);
}
.chart .b3 {
  fill: #d69a3c;
}
.legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.pkgs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.pkg {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pkg .fig {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 600;
  color: var(--teal);
}
.pkg .fig small {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.pkg ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}
.calc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.out {
  background: var(--sunk);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.out .line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
}
.out .line.total {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 4px;
  font-weight: 700;
  font-size: 15px;
}
/* a total on its own (Take payment, Bank cash) has no line and empty band above it (owner, 23/11/2026: nothing
   "wonky") */
.out > .line.total:first-child {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}
.note {
  font-size: 12.5px;
  color: var(--muted);
}

/* forms */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.frow {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
/* an empty box waiting to be filled takes no room in a form: three of them left a 42px hole in Upload document
   (owner, 23/11/2026: nothing "wonky") */
.form > :is(div, p, span):empty {
  display: none;
}
/* a field paired with an empty <span></span> takes half the row, like the fields paired with another one, and the
   whole row on a phone (it used to come out 12px narrower than the boxes above and below it) */
.frow > span:empty {
  flex: 1 1 180px;
}
@media (max-width: 600px) {
  .frow > span:empty {
    display: none;
  }
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1 1 180px;
}
.field label {
  font-weight: 600;
  font-size: 13px;
}
.field input,
.field select,
.field textarea {
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 9px 12px;
  width: 100%;
  min-width: 0;
}
.field textarea {
  min-height: 76px;
  resize: vertical;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--tint);
}
.field .hint {
  font-size: 12px;
  color: var(--muted);
}
.field.err input {
  border-color: var(--bad);
}
.field.err .hint {
  color: var(--bad);
}
.prefix {
  position: relative;
}
.prefix input {
  padding-left: 24px;
}
.prefix::before {
  content: '£';
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

/* templates */
.tsplit {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.tlist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tlist button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  cursor: pointer;
  align-items: center;
}
.tlist button.on {
  border-color: var(--teal);
  background: var(--tint);
}
.tlist button b {
  font-weight: 600;
}
.tlist button small {
  grid-column: 2;
  font-size: 12px;
  color: var(--muted);
}
.tic {
  grid-row: 1 / span 2;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--sunk);
  color: var(--teal);
}
.doc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.dochead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.dochead h3 {
  font-size: 18px;
  font-weight: 600;
}
.docbar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: var(--sunk);
  border-bottom: 1px solid var(--line);
}
.docbar .field {
  flex: 0 1 260px;
}
.paper {
  padding: 28px 32px;
  font-size: 14.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  max-width: 72ch;
}
.paper .lh {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--teal);
  white-space: normal;
}
.paper .lh img {
  width: 22px;
}
.paper .lh b {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--teal);
}
.paper .lh span {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
.mf {
  background: var(--merge-bg);
  color: var(--merge-fg);
  border-radius: 4px;
  padding: 0 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.filled {
  background: var(--tint);
  color: var(--tint-fg);
  border-radius: 4px;
  padding: 0 2px;
  font-weight: 600;
}

/* settings */
.ssplit {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.snav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 84px;
  /* on a short screen the last sections (Activity log) scroll in the menu instead of being cut off */
  max-height: calc(100vh / var(--zm, 1) - 100px);
  overflow-y: auto;
}
.snav button {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 0;
  background: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.snav button:hover {
  background: var(--sunk);
  color: var(--fg);
}
.snav button.on {
  background: var(--tint);
  color: var(--tint-fg);
}
.sbody {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.sbody > header h2 {
  font-size: 20px;
  font-weight: 600;
}
.sbody > header p {
  color: var(--muted);
  max-width: 68ch;
}
.srow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.srow:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.srow > div {
  min-width: 0;
  flex: 1 1 180px;
}
/* a £ box on its own sits on the right like the others, not stretched into the middle of the row */
.srow > div.prefix {
  flex: none;
}
.cardhead + .srow {
  border-top: 0;
  padding-top: 0;
}
body:has(#savebar:not([hidden])) .toast {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 86px);
}
.srow b {
  font-weight: 600;
  display: block;
}
.srow span.d {
  font-size: 12.5px;
  color: var(--muted);
}
.srow select,
.srow input:not(.sw) {
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 0;
}
.srow .prefix input {
  padding-left: 24px;
  width: 120px;
}
.srow input.pct {
  width: 84px;
}
/* a time needs room for the clock button too ("09:00" was cut to "09:0") */
.srow input.pct[type='time'] {
  width: 120px;
}
.sw {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  height: 23px;
  border-radius: 12px;
  background: var(--line);
  position: relative;
  cursor: pointer;
  flex: none;
  margin: 0;
  transition: background 0.15s;
}
.sw::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: left 0.15s;
}
.sw:checked {
  background: var(--teal);
}
.sw:checked::after {
  left: 20px;
}
.sw:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.savebar {
  position: sticky;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--toast-bg);
  color: var(--toast-fg);
  border-radius: var(--r-lg);
  padding: 10px 14px 10px 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  z-index: 15;
}
.savebar .btn.quiet {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}
.lock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.meter {
  height: 10px;
  border-radius: 10px;
  background: var(--sunk);
  overflow: hidden;
  display: flex;
}
.meter i {
  display: block;
  height: 100%;
}
.conn {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 2px 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.conn:first-child {
  border-top: 0;
  padding-top: 0;
}
.conn .tic {
  grid-row: 1 / span 2;
}
.conn p {
  grid-column: 2;
  font-size: 12.5px;
  color: var(--muted);
}
.conn > .side {
  grid-row: 1 / span 2;
  grid-column: 3;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
@media (prefers-reduced-motion: reduce) {
  .sw,
  .sw::after {
    transition: none;
  }
}
@media (max-width: 900px) {
  .ssplit {
    grid-template-columns: minmax(0, 1fr);
  }
  .snav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
  }
  .snav button {
    white-space: nowrap;
  }
}

/* panel + modal: close only with their own buttons */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--scrim);
  display: flex;
  justify-content: flex-end;
}
.scrim.center {
  justify-content: center;
  align-items: center;
  padding: 16px;
}
.panel {
  width: min(560px, 100%);
  height: 100%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.25);
  animation: slide 0.22s ease-out;
}
.panelhead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-top: calc(env(safe-area-inset-top, 0px) + 18px);
}
.panelhead h2 {
  font-size: 21px;
  font-weight: 600;
}
.panelhead p {
  color: var(--muted);
  font-size: 13px;
}
.panelbody {
  flex: 1;
  overflow: auto;
  padding: 18px 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(calc(100vh / var(--zm, 1)) - 32px);
  overflow: auto;
  background: var(--surface);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 6px solid var(--signal);
  animation: pop 0.2s ease-out;
}
.modal .mhead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.modal h2 {
  font-size: 20px;
  font-weight: 600;
}
.modal .mfoot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
/* set by formModal when the buttons don't fit on one line */
.modal .mfoot.stack {
  flex-direction: column-reverse;
  align-items: stretch;
}
.modal .mfoot.stack > * {
  justify-content: center;
}
@keyframes slide {
  from {
    transform: translateX(40px);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes pop {
  from {
    transform: scale(0.96);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes nudge {
  0%,
  100% {
    transform: none;
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}
.nudge {
  animation: nudge 0.25s ease-in-out;
}
.kv {
  display: grid;
  /* the label column is as wide as its longest label, but never more than three fifths of the list: a long label
     wraps onto a second line and the answer always keeps room to be read (owner, 21/11/2026: the Applicant details
     answers were breaking up letter by letter beside a long question) */
  grid-template-columns: fit-content(60%) minmax(0, 1fr);
  gap: 6px 16px;
  font-size: 13.5px;
  margin: 0;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  text-align: right;
}
/* a drop-down with long choices never pushes the page wider than a phone screen */
.kv dd select {
  max-width: 100%;
}
.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.timeline li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
}
.timeline li b {
  font-weight: 600;
}
.timeline time {
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px;
}
.timeline p {
  font-size: 13px;
}
.addnote {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.addnote textarea {
  flex: 1;
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 9px 12px;
  resize: vertical;
  min-height: 42px;
  min-width: 0;
}
.addnote textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--tint);
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
  min-width: 0;
}
.stat b {
  display: block;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 600;
}
.stat span {
  font-size: 12px;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--toast-bg);
  color: var(--toast-fg);
  border-radius: var(--r);
  padding: 10px 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  max-width: calc(calc(100vw / var(--zm, 1)) - 32px);
}
.toast svg.i {
  color: #5fe0d2;
}
.empty {
  border: 1.5px dashed var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  text-align: center;
  color: var(--muted);
}
.empty b {
  display: block;
  color: var(--fg);
  font-family: var(--display);
  font-size: 16px;
  margin-bottom: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .modal,
  .nudge {
    animation: none;
  }
}
@media (max-width: 1100px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid2,
  .grid3,
  .calc {
    grid-template-columns: minmax(0, 1fr);
  }
  .tsplit {
    grid-template-columns: minmax(0, 1fr);
  }
  .pkgs {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 820px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .rail {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 10px 16px;
    gap: 12px;
    overflow-x: auto;
  }
  .nav {
    flex-direction: row;
  }
  .nav .label,
  .me,
  .nav a .count,
  .brand small {
    display: none;
  }
  .nav a {
    white-space: nowrap;
  }
  .top {
    padding: 10px 16px;
    position: static;
  }
  .content {
    padding: 18px 16px;
  }
}
@media (max-width: 480px) {
  .kpis {
    grid-template-columns: minmax(0, 1fr);
  }
  .stats {
    grid-template-columns: minmax(0, 1fr);
  }
  .paper {
    padding: 20px 18px;
  }
  .hello h1 {
    font-size: 21px;
  }
  .modes > button {
    padding: 5px 8px;
  }
}

/* Big screens: paper is never made bigger (see NL.fitScreen in js/app/core.js) */
@media print {
  html {
    zoom: 1 !important;
  }
}
