/* Utility Trade Lead Capture - operational workspace styling.
   Design rules: strong contrast (no faded text), no decorative effects, fine borders, restrained depth.
   Every colour, radius and shadow used below comes from the tokens in :root, so the look can be adjusted in one place. */
:root {
  /* workspace and surfaces */
  --bg: #70747a;            /* mid-grey workspace (lightened 25% toward white at Ed's request, from #40454c; before that from the original #272a2e) */
  /* text that sits directly on the grey workspace (white 4.70:1, secondary white 4.70:1, links 4.47:1, hairlines 3.16:1; on the old #40454c these were 9.7, 7.9, 7.2 and 2.9). Mid-grey cannot give more than 4.7:1 to any text colour; text on the light surfaces keeps the dark --ink tokens below */
  --on-bg: #ffffff;
  --on-bg-2: #ffffff;
  --on-bg-link: #fff8f2;    /* links on the grey: the faintest orange tint that stays near-white (4.47:1, just under 4.5); links are also bold and underlined */
  --on-bg-line: #d0d4d9;    /* hairlines on the grey */
  --surface: #ffffff;       /* cards, tables, toolbars */
  --surface-2: #f5f6f7;     /* table headers, quiet panels */
  --border: #bcc1c7;        /* fine borders and dividers */
  --border-soft: #e3e5e8;   /* row separators */
  --border-strong: #737880; /* form controls (3:1 against the surfaces) */
  --row-alt: #eef1f4;       /* every second row of a lead list: a faint cool grey on the white surface (dark text stays 15:1) */
  --row-hover: #dde3ea;     /* hover on a lead-list row: darker than both row tones, so it shows on either (dark text 13.9:1) */

  /* text */
  --ink: #16171a;           /* near-black body text */
  --ink-2: #33363c;         /* secondary text (8:1 on the workspace) */
  --ink-3: #363940;         /* labels and captions (7:1 or better on every surface) */
  --link: #5f2800;          /* links: a dark tone of the logo orange, 8:1 or better on every surface */

  /* top navigation bar: pure white with black text */
  --bar: #ffffff;
  --bar-ink: #000000;
  --bar-hover: #eceef1;     /* hover on a tab */
  --bar-line: #bcc1c7;      /* hairline under the bar */
  /* charcoal accent: Demo label, dialogue headers, the open help button */
  --nav: #25272b;

  /* brand orange, taken from the logo (#F68121). Text on orange is black (8.1:1; white on this orange is only 2.6:1).
     Hover and pressed states get LIGHTER, so the text keeps more than 7:1 on them too. */
  --orange: #f68121;
  --orange-hover: #ff9540;
  --orange-press: #fbb27a;
  --orange-edge: #cf6609;   /* border of an orange button */
  --orange-ink: #000000;
  --orange-tint: #fdebd9;   /* soft tint for hover and selection, used sparingly */

  /* statuses: no green anywhere. Sold and other success states use charcoal (solid, white text); success banners use the orange tint with an orange edge.
     Red is kept for destructive actions and Lost; the meaning is always in the words as well as the colour. */
  --good: #25272b;          /* charcoal: the Sold button and badge (white text, 15:1) */
  --good-hover: #3a3d43;
  --good-bg: #fdebd9;       /* success banner: the orange tint */
  --good-edge: #cf6609;     /* success banner edge: the orange edge */
  --bad: #8a1c1c;
  --hot: #9f1d12;
  --focus-in: #16171a;
  --focus-out: #ffffff;

  /* shape and depth */
  --radius: 8px;            /* cards and tables */
  --radius-sm: 6px;         /* controls */
  --shadow-sm: 0 1px 2px rgba(20, 26, 34, 0.07);
  --shadow-md: 0 1px 2px rgba(20, 26, 34, 0.07), 0 4px 12px rgba(20, 26, 34, 0.07);
  --gutter: 24px;           /* page side padding */
  --strip-h: 29px;          /* height of the demo strip above everything */
  --control-h: 34px;
}
* { box-sizing: border-box; }
html { font-size: 16px; scroll-padding-top: calc(var(--topbar-h, 0px) + 8px); } /* keyboard focus and scrolled-to targets stop short of the fixed navigation bar (--topbar-h is set by app.js) */
body {
  margin: 0;
  background: var(--bg);
  color: var(--on-bg);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.45;
}
a { color: var(--on-bg-link); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
a:hover { color: var(--on-bg); }
/* Light surfaces (cards, forms, tables, notices, dialogues) keep dark text and dark links, whatever sits behind them. */
:is(.panel, .card, .filters, .counts, .table-wrap, .notice, .empty, .toast, .lead-alert-bar, .help-note, dialog.modal) { color: var(--ink); }
:is(.panel, .card, .filters, .counts, .table-wrap, .notice, .empty, .toast, .lead-alert-bar, .help-note, dialog.modal) a { color: var(--link); }
:is(.panel, .card, .filters, .counts, .table-wrap, .notice, .empty, .toast, .lead-alert-bar, .help-note, dialog.modal) a:hover { color: var(--ink); }
:is(.panel, .card, .filters, .counts, .table-wrap, .notice, .empty, .toast, .lead-alert-bar, .help-note, dialog.modal) :is(.hint, .lede) { color: var(--ink-2); }
/* A two-part ring (light inside, dark outside) that stays visible on the charcoal navigation and on the light surfaces. */
:focus-visible { outline: 2px solid var(--focus-in); outline-offset: 2px; box-shadow: 0 0 0 2px var(--focus-out); }

/* ---- demo notice: one slim neutral line with a clear Demo label ---- */
.build-banner {
  background: #e9ebee;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
  height: var(--strip-h);
  padding: 4px var(--gutter);
  font-size: 12.5px;
  line-height: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.build-banner .demo-tag {
  background: var(--nav);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 16px;
  padding: 1px 7px;
  border-radius: 4px;
}

/* ---- shell ---- */
/* The navigation bar stays at the top of the window while the page scrolls. (Sticky, not fixed: it keeps its place in the page, so nothing needs a
   spacer, and when the demo strip above it scrolls away the bar settles at the very top.) Dropdowns and the Sign out button stay reachable. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bar);
  color: var(--bar-ink);
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0 20px;
  padding: 0 var(--gutter);
  min-height: 60px;
  border-bottom: 1px solid var(--bar-line);
  box-shadow: var(--shadow-sm);
}
.topbar .product { display: flex; align-items: center; gap: 12px; padding: 8px 0; margin-right: 8px; }
/* The logo sits directly on the white bar: no tile, border or shadow. (Its own background is white, so it blends in.) */
.topbar .logo-tile { display: flex; align-items: center; }
.topbar .logo-tile img { display: block; height: 44px; width: auto; } /* the SVG carries its own margin, so 44 px keeps the artwork the size it was */
.topbar nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; align-items: stretch; }
.topbar nav a {
  display: flex; align-items: center;
  color: var(--bar-ink); text-decoration: none; padding: 0 16px; font-weight: 600;
  border-radius: 0; box-shadow: inset 0 -3px 0 transparent;
}
.topbar nav a:hover { background: var(--bar-hover); color: var(--bar-ink); }
.topbar nav a[aria-current="page"] { color: var(--bar-ink); box-shadow: inset 0 -3px 0 var(--orange); }
.topbar nav a:focus-visible { outline-offset: -3px; }
.topbar .who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 4px 0; }
.topbar .who span { font-weight: 600; color: var(--bar-ink); font-size: 13.5px; }
.topbar .btn { background: #fff; color: var(--bar-ink); border-color: var(--bar-ink); box-shadow: none; }
.topbar .btn:hover:not(:disabled) { background: var(--bar-hover); border-color: var(--bar-ink); }

main { max-width: 1600px; margin: 0 auto; padding: 10px var(--gutter) 28px; min-width: 0; }
h1 { font-size: 22px; line-height: 1.25; font-weight: 650; margin: 0 0 2px; letter-spacing: -0.005em; }
h2 { font-size: 16px; font-weight: 650; margin: 24px 0 8px; }
h3 { font-size: 15px; font-weight: 650; margin: 18px 0 6px; }
.lede { margin: 0 0 12px; color: var(--on-bg-2); max-width: 90ch; }
.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--on-bg-line); margin: 8px 0 14px; flex-wrap: wrap; }
.subnav a { text-decoration: none; color: var(--on-bg-2); padding: 8px 14px; margin-bottom: -1px; font-weight: 600; border-bottom: 3px solid transparent; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.subnav a[aria-current="page"] { color: var(--on-bg); border-bottom-color: var(--orange); }
.subnav a:hover { background: var(--orange-tint); color: var(--ink); } /* hover: a soft orange tint with dark text */
/* Administrator workspace: two labelled groups of tabs side by side (Leads and reporting | System settings); they wrap on a narrow screen. */
.subnav-grouped { border-bottom: 0; gap: 4px 28px; margin-top: 10px; }
.subnav-group { display: flex; flex-direction: column; border-bottom: 1px solid var(--on-bg-line); min-width: 0; }
.subnav-label { font-size: 12.5px; font-weight: 700; color: var(--on-bg-2); padding: 0 14px 2px; }
.subnav-links { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---- buttons & forms ---- */
.btn {
  font: inherit; font-weight: 650; cursor: pointer; padding: 0 14px; min-height: var(--control-h);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--ink-2); }
.btn:disabled { cursor: not-allowed; background: #e4e6e9; color: var(--ink-3); border-style: dashed; box-shadow: none; }
.btn-primary { background: var(--orange); border-color: var(--orange-edge); color: var(--orange-ink); }
.btn-primary:hover:not(:disabled) { background: var(--orange-hover); border-color: var(--orange-edge); }
.btn-primary:active:not(:disabled) { background: var(--orange-press); }
.btn-good { background: var(--good); border-color: #000; color: #fff; }
.btn-good:hover:not(:disabled) { background: var(--good-hover); border-color: #000; }
.btn-bad { background: var(--bad); border-color: #5b1010; color: #fff; }
.btn-bad:hover:not(:disabled) { background: #6b1414; border-color: #5b1010; }
.btn-small { padding: 0 11px; min-height: 28px; font-size: 13.5px; }
.btn-primary:disabled, .btn-good:disabled, .btn-bad:disabled { background: #e4e6e9; color: var(--ink-3); }

label { display: block; font-weight: 650; margin-bottom: 3px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 5px 9px; min-width: 0;
}
input:not([type="checkbox"]), select { min-height: var(--control-h); }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input[type="checkbox"] { width: 18px; height: 18px; vertical-align: middle; accent-color: var(--ink); }
textarea { width: 100%; min-height: 90px; }
.field { margin-bottom: 12px; }
.hint { margin: 3px 0 0; font-size: 13.5px; color: var(--on-bg-2); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { margin-bottom: 0; }
/* A form row whose field has helper text (Add a source code): the helper hangs beneath its own field instead of making that field taller, so every
   control and the button share one baseline. Room is kept for it below the row, and between rows if the row wraps. On a narrow screen the helper
   goes back into the flow, where wrapping is ordinary. */
.form-row-hint-below { row-gap: 30px; padding-bottom: 22px; }
/* Submit a lead (Internal Lead Gen): rows of fields with their hints and errors in normal flow, so nothing overlaps the Submit button. */
.lead-gen-form .form-row { margin-bottom: 16px; align-items: flex-start; }
.lead-gen-form .field { min-width: 220px; flex: 1 1 220px; }
.lead-gen-form input, .lead-gen-form select { width: 100%; }
.form-row-hint-below .field { position: relative; }
.form-row-hint-below .field > .hint { position: absolute; top: 100%; left: 0; margin-top: 3px; width: max-content; max-width: 100%; }
@media (max-width: 640px) {
  .form-row-hint-below { row-gap: 12px; padding-bottom: 0; }
  .form-row-hint-below .field > .hint { position: static; width: auto; }
}
.event-code { color: var(--ink-3); font-size: 12px; }
/* Filters: one compact toolbar */
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 10px 14px 12px; margin-bottom: 14px; }
.filters label { font-size: 12.5px; font-weight: 650; color: var(--ink-3); margin-bottom: 2px; }
.filters .form-row { gap: 10px 12px; }
.filters input, .filters select { font-size: 14px; }
.form-actions { display: flex; gap: 12px; }
/* Cost per lead editors in Administration (source codes and providers): a pound sign, the amount and Save on one line, aligned with the table text. */
.cost-editor { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.cost-pound { font-weight: 650; }
input.cost-input { width: 92px; text-align: right; font-size: 14px; min-height: 30px; }
.cost-field { width: 120px; } /* the optional cost box in the Add forms: standard control height, like its neighbours */
.hint-inline { color: var(--ink-3); }
.search-input { width: 200px; max-width: 100%; } /* the search box in the filter bar: same height, border and type as the other controls */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px 16px; margin: 12px 0; }
.panel h3:first-child { margin-top: 0; }
.field-error { color: #7f1d1d; font-weight: 700; margin: 3px 0 0; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; }
.checks label { font-weight: 600; display: inline-flex; gap: 6px; align-items: center; margin: 0; }

/* ---- notices ---- */
.notice { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 14px; margin: 10px 0; background: var(--surface); }
.notice p { margin: 0 0 6px; }
.notice p:last-child { margin-bottom: 0; }
.notice-info { background: #e8eef8; border-color: #6f8fbf; }
.notice-success { background: var(--good-bg); border-color: var(--good-edge); }
.notice-warning { background: #fff1c7; border-color: #b58a12; }
.notice-error { background: #fde7e4; border-color: #c0483c; }
.empty { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 24px; text-align: center; background: var(--surface); }
.empty-title { font-weight: 650; font-size: 16px; margin: 0 0 6px; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); background: var(--surface); margin: 8px 0 16px; }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; }
table.data caption { text-align: left; font-weight: 650; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
table.data th { text-align: left; background: var(--surface-2); color: var(--ink-3); font-size: 13px; font-weight: 700; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
table.data td { padding: 8px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; background: var(--surface); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: #f1f3f5; }
table.data .num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .nowrap { white-space: nowrap; }
table.data .actions { white-space: nowrap; }
table.data .actions .btn { margin-right: 4px; }
/* The action column (Claim, status buttons, edit/activate) stays in view while the rest of a wide table scrolls sideways. */
table.data th.actions-col, table.data td.actions { position: sticky; right: 0; background: var(--surface); box-shadow: -1px 0 0 var(--border); }
table.data th.actions-col { background: var(--surface-2); }
table.data tbody tr:hover td.actions { background: #f1f3f5; }
/* Lead lists (Green Room, My Leads, All leads): alternate rows are tinted, including the sticky action column, and hover is stronger than the tint. Status badges, buttons and focus rings are untouched. */
table.data.lead-list tbody tr:nth-child(even) td { background: var(--row-alt); }
table.data.lead-list tbody tr:hover td { background: var(--row-hover); }
.customer strong { display: block; }
.customer strong + br { display: none; }

/* ---- badges ---- */
.badge { display: inline-block; padding: 1px 9px; border: 1px solid var(--ink-2); font-weight: 650; font-size: 12.5px; line-height: 18px; border-radius: 999px; white-space: nowrap; }
.badge-hot { text-transform: uppercase; background: var(--hot); color: #fff; border-color: var(--hot); letter-spacing: 0.05em; font-size: 11.5px; }
.st-allocated { background: #e1e9f5; color: #1d3557; border-color: #8aa3c7; }
.st-quoted { background: #fde7b0; color: #6b3d00; border-color: #d1a33a; }
.st-sold { background: var(--good); color: #fff; border-color: var(--good); }
.st-lost { background: #fde2de; color: #7a1a12; border-color: #d98f86; }
.badge-off { background: var(--surface); color: var(--ink); border-style: dashed; border-color: var(--border-strong); }
.badge-warn { background: #fff1c7; color: #5c3a00; border-color: #c79a2c; }

/* ---- counts: the figures read as one summary strip, divided by fine lines ---- */
.counts { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; margin: 8px 0; }
.count { background: var(--surface); padding: 10px 16px 12px; display: flex; flex-direction: column; min-width: 0; }
.count .l { order: -1; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; color: var(--ink-3); min-height: 24px; }
.count .l::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex: none; }
.count-available .l::before { background: var(--hot); }
.count-in-progress .l::before { background: #5b7fb5; }
.count-quoted .l::before { background: #d1a33a; }
.count-sold .l::before { background: var(--good); }
.count-lost .l::before { background: #c0483c; }
.count .n { font-size: 28px; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; }
/* The figures and agent names open the records behind them: they read as links (an orange underline) without changing the look of the strip. */
.counts .count-link, .table-wrap .drill-link { color: var(--ink); text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 2px; text-underline-offset: 4px; font-weight: inherit; }
.counts .count-link:hover, .table-wrap .drill-link:hover { color: var(--ink); background: var(--orange-tint); }
.drill-note { background: var(--orange-tint); border: 1px solid var(--orange-edge); border-radius: var(--radius-sm); color: var(--ink); padding: 8px 12px; margin: 0 0 10px; }
.drill-note p { margin: 0; } .drill-note p + p { margin-top: 6px; }
.drill-note a { color: var(--link); }
.count .d { font-size: 13px; color: var(--ink-2); }
.counts .help-btn { margin-left: 2px; }
@media (max-width: 900px) { .counts { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .counts { grid-template-columns: repeat(2, 1fr); } .count { padding: 8px 12px 10px; } }
/* Allocation problems on the Overview: two figures in the same tile style as the six above, under their own heading. */
.alloc-heading { margin: 18px 0 8px; font-size: 16px; }
.counts.counts-allocation { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 440px; }
.count-warn .l::before { background: var(--orange); }
.alloc-hint { margin: 8px 0 18px; }
/* Report sections (By agent, By source): each sits on its own defined surface */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin: 0 0 16px; overflow: hidden; }
.card > h2 { margin: 0; padding: 11px 14px 10px; font-size: 15px; border-bottom: 1px solid var(--orange-edge); background: var(--orange); color: #000; }
.card > .hint { margin: 0; padding: 8px 14px; border-bottom: 1px solid var(--border-soft); }
.card > .help-notes { padding: 0 14px; }
.card > .help-notes .help-note { margin: 8px 0; }
.card .table-wrap { margin: 0; border: none; border-radius: 0; box-shadow: none; }
.card table.data td:first-child { white-space: nowrap; } /* names stay on one line; a narrow screen scrolls the table instead */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 8px 0; }
dl.facts dt { font-weight: 650; }
dl.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
dl.facts dd .badge { white-space: normal; } /* long job states wrap inside their panel instead of running past its edge */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; }
code, pre { font-family: Consolas, "Courier New", monospace; font-size: 13px; }
pre.detail { margin: 0; white-space: pre-wrap; word-break: break-word; }

/* ---- login ---- */
/* Sign-in screen: the heading, form and (when present) the Staff preview or demo-accounts card are centred together, horizontally and
   vertically, in the space below the demo strip. When they do not fit, the screen grows and the page scrolls normally. */
.login-screen { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: calc(100vh - var(--strip-h)); min-height: calc(100dvh - var(--strip-h)); padding: 24px 0; box-sizing: border-box; }
.login-screen h1 { text-align: center; margin-bottom: 8px; }
.login-wrap > :last-child { margin-bottom: 0; } /* no trailing margin, so the visible group is what gets centred */
/* The massive recessed UT symbol: decorative, behind everything, never takes a click. Sized to the screen (which grows with the content) and never narrower than the cards, so its shape shows around them. */
.login-backdrop { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); height: 118%; min-height: 820px; width: auto; aspect-ratio: 87 / 107.4; overflow: visible; pointer-events: none; user-select: none; z-index: 0; }
@media (forced-colors: active) { .login-backdrop { display: none; } }
/* The same background, fixed to the window behind the signed-in application (js/backdrop.js puts it directly in <body>). The symbol is the very same
   element and size rule as on the sign-in screen (.login-backdrop above), centred in the window and clipped to it. Behind everything (z-index -1, above only
   the grey of the page itself), never takes a click, and does not move when the content scrolls. The white panels, tables and forms are opaque and
   sit on top of it, so nothing that holds customer data is ever laid over the shading. */
.app-backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; user-select: none; }
/* Where the symbol sits. On the sign-in screen the symbol is sized and centred against the screen below the demo strip (118% of it, centred). Signed in, the
   same relationship must hold against the area the person actually sees at the top of the page: below the demo strip AND the navigation bar. Measured against the
   whole window instead, the symbol came out about 4% too large and 14% too high, which put its top bar entirely behind the strip and the bar. So the
   symbol keeps the identical rule (118% of its area, centred in it, the same minimum size), but its area starts below the strip and the bar (--topbar-h is
   published by app.js). The layer itself still covers the whole window and the symbol is clipped only by the window, so it does not move when the page scrolls. */
.app-backdrop .login-backdrop {
  --canvas-top: calc(var(--strip-h) + var(--topbar-h, 61px));
  --canvas-h: calc(100% - var(--canvas-top));
  top: calc(var(--canvas-top) + var(--canvas-h) / 2);
  height: calc(var(--canvas-h) * 1.18);
}
@media print { .app-backdrop { display: none; } }
.login-wrap { position: relative; z-index: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; } /* one shared width for the sign-in and demo-accounts cards */
.login-wrap .panel { background: var(--surface); }
/* Sign-in panel: the fields on the left, the orange UT symbol centred in the blank space to their right. */
.login-panel { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); align-items: center; gap: 0; }
.login-panel form input { width: 100%; }
.login-mark { display: flex; align-items: center; justify-content: center; }
.login-mark img { display: block; width: 82px; height: auto; } /* upright, original artwork and proportions; a vector, so it stays sharp at any size */
/* Sign in button: a small upright UT mark beside the text. Only the mark moves (a small lift on hover, a slight press when activated); the text never shifts,
   the mark never rotates, and with reduced motion it does not move at all (the button's own colour changes still show). */
.btn-signin { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-signin .btn-mark { flex: none; display: block; width: 15px; height: 18.5px; fill: currentColor; transform-origin: 50% 60%; transition: transform 140ms ease-out; }
.btn-signin:hover:not(:disabled) .btn-mark { transform: translateY(-2px) scale(1.08); }
.btn-signin:active:not(:disabled) .btn-mark { transform: translateY(0) scale(0.9); transition-duration: 60ms; }
@media (prefers-reduced-motion: reduce) {
  .btn-signin .btn-mark { transition: none; }
  .btn-signin:hover:not(:disabled) .btn-mark, .btn-signin:active:not(:disabled) .btn-mark { transform: none; }
}
@media (max-width: 480px) { .login-panel { grid-template-columns: minmax(0, 1fr); } .login-mark { display: none; } } /* a phone has no room beside the fields */

/* Staff preview picker (a private local review): one compact row per role, so it fits the sign-in card at any width without scrolling. */
.staff-preview .hint { margin: 0 0 8px; }
.staff-rows { border-top: 1px solid var(--border-soft); }
.staff-row { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.staff-row:last-child { border-bottom: 0; }
.staff-row label, .staff-label { margin: 0; font-weight: 650; }
.staff-control { min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.staff-control select { width: 100%; text-overflow: ellipsis; }
.staff-status:empty { display: none; }
@media (max-width: 480px) { .staff-row { grid-template-columns: minmax(0, 1fr); } }

/* Demo accounts: no sticky action column and no sideways scrolling. Account, role and the Use button share each row; on a narrower screen the row stacks. */
.dev-accounts { min-width: 0; table-layout: auto; }
table.data.dev-accounts th, table.data.dev-accounts td { padding: 7px 10px; }
table.data.dev-accounts thead th { background: var(--orange); color: #000; border-bottom: 1px solid var(--orange-edge); } /* the whole header row in the logo orange */
table.data.dev-accounts td { overflow-wrap: break-word; vertical-align: middle; }
table.data.dev-accounts td:nth-child(2) { white-space: nowrap; } /* role names are short: keep them whole */
table.data.dev-accounts th.col-action, table.data.dev-accounts td.demo-action { text-align: right; }
.dev-accounts td.demo-action .btn { white-space: normal; text-align: center; }
@media (max-width: 640px) {
  table.data.dev-accounts thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } /* headings stay for screen readers */
  table.data.dev-accounts, table.data.dev-accounts tbody { display: block; }
  table.data.dev-accounts tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: start; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
  table.data.dev-accounts tbody tr:last-child { border-bottom: none; }
  table.data.dev-accounts td { display: block; padding: 0; border: 0; background: transparent; }
  table.data.dev-accounts tbody tr:hover td { background: transparent; }
  table.data.dev-accounts td:nth-child(2) { text-align: right; font-weight: 600; color: var(--ink-2); white-space: normal; }
  table.data.dev-accounts td.demo-action { grid-column: 1 / -1; text-align: left; }
  .dev-accounts td.demo-action .btn { width: 100%; }
}

/* ---- routine success notifications: compact, in normal page flow (never over tables or buttons) ---- */
.notifications { display: flow-root; min-height: 44px; } /* reserved: one message (bar + gap) with headroom for fractional heights, so appearing/expiring moves nothing */
.toast { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; border: 1px solid var(--good-edge); border-left: 6px solid var(--orange); border-radius: var(--radius-sm); background: var(--good-bg); color: var(--ink); padding: 3px 10px 3px 12px; margin: 0 0 8px; }
.toast-body { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }

/* ---- in-application modal dialogue ---- */
dialog.modal { border: 1px solid var(--border); border-radius: 10px; padding: 0; width: min(540px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 18px 48px rgba(20, 18, 14, 0.35); overflow: hidden; }
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.68); }
dialog.modal header { background: var(--nav); color: #fff; padding: 11px 16px; }
dialog.modal header h2 { margin: 0; font-size: 17px; }
dialog.modal .modal-body { padding: 14px 16px 4px; }
dialog.modal footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 16px 16px; flex-wrap: wrap; }
dialog.modal .modal-form { margin: 0; }
dialog.modal dl.facts { margin: 0 0 10px; }
.modal-error { margin-top: 10px; }
.modal-error:not(:empty) { border: 1px solid #c0483c; border-radius: var(--radius-sm); background: #fde7e4; padding: 8px 12px; }
.btn[aria-disabled="true"] { cursor: not-allowed; background: #e4e6e9; color: var(--ink-3); border-style: dashed; }

/* ---- Administration -> Integrations: a delivery's technical detail is collapsed until asked for ---- */
.delivery-note { margin: 6px 0 0; font-weight: 600; max-width: 34ch; }
details.delivery-details { margin-top: 6px; }
details.delivery-details > summary { cursor: pointer; font-weight: 700; padding: 2px 0; }
.delivery-action { margin-top: 8px; }
#integration-jobs table.data .badge { white-space: normal; } /* long status words wrap on narrow screens so the table fits */
@media (max-width: 640px) { #integration-jobs table.data th, #integration-jobs table.data td { padding-left: 5px; padding-right: 5px; } }
/* Stacked label-over-value. Labels wrap only at spaces; long technical values (IDs, errors) may wrap anywhere, so nothing widens the page. */
details.delivery-details dl.facts { display: block; margin: 8px 0 4px; }
details.delivery-details dl.facts dt { margin-top: 8px; }
details.delivery-details dl.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---- Overview: one timing line, and inline help that opens on demand (real buttons, visible text) ---- */
.timing-line { margin: 4px 0 16px; font-size: 14px; color: var(--on-bg-2); }
.timing-line strong { color: var(--on-bg); }
.help-btn { font: inherit; font-weight: 700; font-size: 12px; line-height: 1; min-width: 22px; min-height: 22px; padding: 2px 6px; margin-left: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); cursor: pointer; border-radius: 999px; vertical-align: middle; }
.help-btn:hover { background: var(--orange-tint); }
.help-btn[aria-expanded="true"] { background: var(--nav); border-color: var(--nav); color: #fff; }
.help-note { margin: 6px 0 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); max-width: 90ch; }
.help-note[hidden] { display: none; }

/* ---- new-lead alert: compact banner in normal page flow (never floats over the table) ---- */
.lead-alert-region:empty { display: none; }
.lead-alert-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; border: 1px solid var(--border); border-left: 6px solid var(--hot); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); background: var(--surface); padding: 8px 12px; margin: 0 0 12px; }
.lead-alert-text { flex: 1 1 320px; min-width: 0; overflow-wrap: anywhere; }
.lead-alert-detail { color: var(--ink-2); }
.lead-alert-actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* ---- available-lead count on the Green Room link, desktop-notification control, and the lead a notification opened ---- */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nav-count { display: inline-block; min-width: 20px; margin-left: 7px; padding: 1px 6px; border-radius: 10px; background: var(--hot); color: #fff; font-size: 12px; font-weight: 700; line-height: 1.4; text-align: center; }
.nav-count[hidden] { display: none; }
.desktop-alerts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 12px; margin: 0 0 10px; }
.desktop-alerts .hint { margin: 0; flex: 1 1 320px; }
.desktop-alerts .btn { flex: 0 0 auto; }
table.data.lead-list tbody tr.lead-flash td { background: var(--orange-tint); }
table.data.lead-list tbody tr.lead-flash td:first-child { box-shadow: inset 6px 0 0 var(--orange); }

/* ---- Green Room: dense enough to scan several leads at once; Lead ref leads each row on one line ---- */
.green-room table.data { font-size: 13.5px; line-height: 1.35; min-width: 1000px; } /* below this a narrow screen scrolls inside the table instead of squeezing every column */
.green-room table.data th { padding: 8px; white-space: normal; line-height: 1.25; } /* headings may wrap, so the table fits ordinary laptop widths without scrolling */
.green-room table.data th:first-child, .green-room table.data th.actions-col { white-space: nowrap; }
.green-room table.data td { padding: 7px 8px; vertical-align: middle; }
.green-room table.data td:first-child { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.green-room table.data td.received { white-space: normal; }
.green-room table.data td.customer, .green-room table.data td.wrap { overflow-wrap: break-word; }
.green-room table.data td.actions { padding-left: 10px; padding-right: 12px; }
.green-room table.data td.actions .btn { margin-right: 0; min-width: 68px; }
/* A soft edge on the pinned Claim column shows that the table continues beneath it when it scrolls. */
.green-room table.data th.actions-col, .green-room table.data td.actions { box-shadow: -1px 0 0 var(--border), -8px 0 8px -8px rgba(20, 26, 34, 0.2); }

@media (max-width: 900px) {
  :root { --gutter: 14px; }
  .topbar { gap: 0 12px; }
  .topbar .product { flex: 1 1 100%; margin-right: 0; padding: 8px 0 6px; }
  .topbar nav { flex: 1 1 auto; }
  .topbar nav a { padding: 0 12px; min-height: 44px; }
  .topbar .who { padding: 4px 0; margin-left: auto; }
}
@media (max-width: 640px) {
  main { padding: 10px var(--gutter) 24px; }
  table.data td.actions { white-space: normal; }
  table.data td.actions .btn { display: block; width: 100%; margin: 0 0 6px; }
  table.data td.actions .btn:last-child { margin-bottom: 0; }
  .lead-alert-actions { width: 100%; }
  .lead-alert-actions .btn { flex: 1 1 0; }
  .toast .toast-close { flex: 1 1 100%; }
  /* Phone header: logo + Sign out on the first row; tabs and the signed-in name share the second. */
  .topbar { gap: 0 10px; }
  .topbar .product { flex: 1 1 auto; order: 1; padding: 7px 0 5px; gap: 10px; }
  .topbar .logo-tile img { height: 35px; }
    .topbar .who { display: contents; }
  .topbar .who .btn { order: 2; align-self: center; }
  .topbar nav { order: 3; flex: 0 0 auto; flex-wrap: nowrap; }
  .topbar .who span { order: 4; flex: 1 1 100px; min-width: 0; align-self: center; text-align: right; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .filters { padding: 10px 12px; }
  .filters .field { flex: 1 1 140px; }
  .filters .field input, .filters .field select { width: 100%; }
}

/* Lead page: management actions and the record of what happened */
.lead-actions-row { display: flex; flex-wrap: wrap; gap: 8px; }
.lead-actions .hint { margin-top: 8px; }
.report-notes { margin: 6px 0 14px; padding-left: 20px; }
.history-note { margin: 0; overflow-wrap: anywhere; }
.history-note + .history-note { margin-top: 4px; }
details.deletion-panel summary { font-weight: 700; cursor: pointer; }
details.deletion-panel ul { margin: 6px 0 12px; padding-left: 20px; }
.modal-form textarea { min-height: 72px; }
.edit-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 14px; }
.edit-fields input, .edit-fields select { width: 100%; box-sizing: border-box; }
@media (max-width: 600px) {
  .lead-actions-row .btn { flex: 1 1 100%; }
}
/* A tall dialogue scrolls its body and keeps its buttons in view, including on a narrow screen. */
dialog.modal[open] { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
dialog.modal .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
dialog.modal > footer { flex: none; }

/* Administration -> Integrations -> Lead suppliers */
code.secret { display: block; word-break: break-all; padding: 10px; background: var(--bg-2, #f4f5f7); border: 1px solid var(--border-strong); border-radius: var(--radius); user-select: all; font-size: 15px; }
tr.row-selected td { background: var(--orange-tint); }
ul.readiness { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
ul.readiness li .hint { margin-left: 0; }
.supplier-head h3 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
