  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --bg: #ffffff;
    --bg2: #f5f7fa;
    --bg3: #eaecf2;
    --border: #dde2ee;
    --border-bright: #c4ccde;
    /* ── Brand accent ──────────────────────────────────────────────────────
       --brand-primary is the ONLY colour the runtime overrides: the branding
       bootstrap in each page's <head> and applyBranding() in app.js set it as an
       inline style on <html>, which beats this :root declaration on the same
       element. Every other accent token derives from it here in CSS, so one
       injected value reaches all 85 var(--teal*) uses plus the literals that
       used to bypass them.

       Leaving it unset is the supported default and reproduces the original
       Curious Code teal exactly — which is why no Python or JS anywhere repeats
       this hex. #007f67 measures 4.96:1 against white; agents/branding.py clamps
       every company colour to at least 4.5:1 so a tenant's accent can never
       carry white text less legibly than this one does.

       color-mix() replaces the hand-written rgba() literals: it takes the alpha
       from a variable that is not known until runtime. Mixing with `transparent`
       in srgb is premultiplied per CSS Color 5, so 6% here is identical to the
       rgba(0,127,103,0.06) it replaces. */
    --brand-primary: #007f67;
    --brand-primary-hover: #006655;

    --teal: var(--brand-primary);
    --teal-dim: color-mix(in srgb, var(--brand-primary) 6%, transparent);
    --teal-glow: 0 0 0 1px var(--brand-primary),
                 0 0 24px color-mix(in srgb, var(--brand-primary) 14%, transparent);

    /* Semantic status green — NOT the brand accent, and deliberately not derived
       from it. It sits in a traffic light with --amber and --red (the favicon's
       done/running/error badges read these three straight out of this file), so
       letting a red- or orange-branded tenant paint "done" in their brand red
       would make it indistinguishable from "failed". Pinned for every company. */
    --ok: #007f67;

    --amber: #b36b00;
    --red: #c0392b;
    --grey: #6b7a99;
    --text: #1a2332;
    --text-dim: #6b7a99;
    --mono: 'Montserrat', sans-serif;
    --sans: 'Montserrat', sans-serif;
  }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    padding: 0 0 80px;
  }

  /* ── Header ── */
  header {
    border-bottom: 1px solid var(--border);
    padding: 20px 40px;
    display: flex;
    align-items: center;
    gap: 16px;
  }
  .logo-mark {
    width: 32px; height: 32px;
    border: 1.5px solid var(--teal);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--teal);
    letter-spacing: -1px;
  }
  /* Company logo. Painted as a background on the existing mark element rather than
     swapped in as an <img>, so the branding bootstrap in each page's <head> can
     apply it before first paint — an <img> could only be inserted once app.js
     parses at end of body, which guarantees the default mark flashes first.
     Two selectors because the toolbox home has its own brand markup.

     `contain` plus a hairline of padding letterboxes an arbitrary company asset
     instead of distorting it; the header's fixed 32px flex box means no layout
     shift while the image loads. */
  html[data-brand-logo] .logo-mark,
  html[data-brand-logo] .tb-brand-mark {
    background-image: var(--brand-logo);
    background-position: left center;
    background-repeat: no-repeat;
    background-size: contain;
    border: none;
    color: transparent;   /* hides the "CC" text without editing eight page headers */
    padding: 1px;
    /* The box keeps its 32px height and widens to the artwork's real aspect
       ratio. Many companies publish no square icon — Hydro-Quebec's only asset is
       a 3:1 wordmark — and forcing one into a 32px square renders it 32x10 and
       illegible. applyBranding() measures the loaded image and sets the ratio;
       until then 1 keeps the original square, so nothing jumps on a cold load. */
    width: calc(32px * var(--brand-logo-aspect, 1));
    max-width: 132px;
  }
  /* The home page's default mark is an inline <svg> inside the box, and a
     background paints behind it — so take it out of flow when a logo is present. */
  html[data-brand-logo] .tb-brand-mark > svg { display: none; }

  .header-title {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
  }
  .header-title span { color: var(--text); }

  .back-link {
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color .2s;
    white-space: nowrap;
    margin-right: 4px;
  }
  .back-link:hover { color: var(--teal); }
  .back-link::before { content: '←'; font-size: 13px; }
  /* Right-hand header group (language toggle + icon buttons). Mirrors the toolbox
     home's header so every page presents the same controls at the same spacing. */
  .header-actions { margin-left: auto; display: flex; gap: 12px; align-items: center; }

  /* Segmented toggle — the EN/FR switch, and the Tools/Projects switch on the home
     page. Shared here so the two stay identical; the vars below resolve to the same
     values as the home page's --rule / --ink-3 / --accent set. */
  .tb-view-toggle {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow: hidden;
  }
  .tb-toggle-btn {
    background: transparent;
    border: none;
    padding: 5px 14px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-dim);
    cursor: pointer;
    transition: background .15s, color .15s;
  }
  .tb-toggle-btn + .tb-toggle-btn { border-left: 1px solid var(--border); }
  .tb-toggle-btn.active { background: var(--teal); color: #fff; }
  .tb-toggle-btn:not(.active):hover { background: var(--bg2); color: var(--text); }

  /* Outlined header button — the EN/FR toggle used to wear this before moving to the
     segmented .tb-view-toggle above. Still used for one-off header actions such as
     project.html's "Edit details". */
  .lang-btn {
    background: none; border: 1px solid var(--border); border-radius: 3px;
    padding: 3px 10px; font-family: var(--mono); font-size: 11px;
    font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--text-dim); cursor: pointer; transition: border-color 0.15s, color 0.15s;
  }

  /* Icon-only header buttons (settings, sign out). The glyph is a CSS mask rather than
     inline SVG so it tracks currentColor and the artwork lives here instead of being
     copy-pasted into all nine page headers. Icons carry no text, so they must be
     labelled with data-i18n-title / data-i18n-aria-label — never data-i18n, which
     setLanguage() would use to overwrite the element's content. */
  .icon-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 5px;
    color: var(--text-dim);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
  }
  .icon-btn:hover { border-color: var(--border-bright); color: var(--text); }
  .icon-btn::before {
    content: '';
    width: 15px;
    height: 15px;
    background-color: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
  }
  .icon-settings {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E");
  }
  .icon-signout {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
  }
  .icon-profile {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
  }

  /* User menu — the panel the header's profile icon opens (toggleUserMenu in app.js).
     Fixed-positioned and anchored from JS rather than absolutely placed inside the
     header, because the two header layouts differ: the toolbox home's .tb-header is
     sticky and every other page's <header> is not. positionUserMenu() re-anchors it
     on scroll and resize, so both behave identically. */
  .user-pop {
    position: fixed;
    z-index: 200;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    min-width: 220px;
    max-width: 320px;
    padding: 12px 14px;
  }
  .user-pop-row + .user-pop-row { margin-top: 10px; }
  .user-pop-label {
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 2px;
  }
  .user-pop-value {
    font-size: 13px;
    color: var(--text);
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  /* ── Main layout ── */
  main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 40px 0;
  }

  /* ── Section label ── */
  .section-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
  }

  /* ── Drop zone ── */
  .dropzone {
    border: 1.5px dashed var(--border-bright);
    background: var(--bg2);
    border-radius: 6px;
    padding: 36px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
  }
  .dropzone:hover, .dropzone.drag-over {
    border-color: var(--teal);
    background: var(--teal-dim);
  }
  .dropzone input[type=file] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
  }
  .dropzone-icon { font-size: 32px; margin-bottom: 10px; opacity: 0.5; }
  .dropzone-label {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 4px;
  }
  .dropzone-sub { font-size: 11px; color: var(--text-dim); opacity: 0.6; }
  .dropzone.has-file .dropzone-icon { opacity: 1; }
  .file-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .file-list-item {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--teal);
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .file-list-item::before { content: '·'; opacity: 0.5; }
  .file-remove-btn {
    background: none;
    border: none;
    color: var(--teal);
    opacity: 0.45;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
  }
  .file-remove-btn:hover { opacity: 1; }

  /* ── Run button ── */
  #step-pipeline-run { margin-bottom: 40px; display: flex; gap: 12px; align-items: center; margin-top: 24px; }
  .btn-run {
    background: var(--teal);
    color: #0a0f14;
    border: none;
    border-radius: 4px;
    padding: 12px 32px;
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
  }
  .btn-run:disabled {
    opacity: 0.28;
    cursor: not-allowed;
    transform: none;
  }
  .btn-run:not(:disabled):hover { opacity: 0.88; }
  .btn-run:not(:disabled):active { transform: scale(0.97); }

  .btn-cancel {
    background: transparent;
    color: var(--red);
    border: 1px solid rgba(192,57,43,0.35);
    border-radius: 4px;
    padding: 8px 20px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    margin-top: 14px;
    display: none;
  }
  .btn-cancel:hover {
    border-color: var(--red);
    background: rgba(192,57,43,0.06);
  }

  .btn-reset {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border-bright);
    border-radius: 4px;
    padding: 12px 24px;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    display: none;
  }
  .btn-reset:hover { border-color: var(--text-dim); color: var(--text); }

  /* ── Progress ── */
  #progress-section { display: none; margin-bottom: 40px; }
  .progress-bar-track {
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    overflow: hidden;
    margin-bottom: 14px;
  }
  .progress-bar-fill {
    height: 100%;
    width: 30%;
    background: var(--teal);
    border-radius: 1px;
    animation: indeterminate 1.8s ease-in-out infinite;
  }
  .progress-bar-fill.determinate {
    animation: none;
    width: 0%;
    transition: width 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  }
  @keyframes indeterminate {
    0%   { transform: translateX(-100%); width: 40%; }
    50%  { width: 60%; }
    100% { transform: translateX(350%); width: 40%; }
  }
  .progress-status {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--teal);
    letter-spacing: 0.06em;
  }
  .progress-status::before { content: '▶ '; opacity: 0.6; }

  /* ── Step indicator ── */
  .step-list {
    display: flex;
    align-items: flex-start;
    margin-top: 22px;
    margin-bottom: 4px;
  }
  .step-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
  }
  /* connector line between steps */
  .step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 13px;
    left: calc(50% + 14px);
    right: calc(-50% + 14px);
    height: 1.5px;
    background: var(--border);
    z-index: 0;
    transition: background 0.4s;
  }
  .step-item.done:not(:last-child)::after  { background: var(--teal); }
  .step-item.active:not(:last-child)::after {
    background: linear-gradient(to right, var(--teal) 0%, var(--border) 100%);
  }
  .step-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    font-family: var(--mono);
    position: relative; z-index: 1;
    border: 1.5px solid var(--border-bright);
    background: var(--bg2);
    color: var(--text-dim);
    transition: border-color 0.3s, background 0.3s, color 0.3s;
  }
  .step-item.done .step-dot {
    border-color: var(--teal);
    background: var(--teal);
    color: #fff;
    font-size: 13px;
  }
  .step-item.active .step-dot {
    border-color: var(--teal);
    background: var(--bg);
    color: var(--teal);
    animation: pulse-step 1.6s ease-in-out infinite;
  }
  @keyframes pulse-step {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-primary) 35%, transparent); }
    50%       { box-shadow: 0 0 0 7px transparent; }
  }
  .step-spinner {
    width: 12px; height: 12px;
    border: 2px solid color-mix(in srgb, var(--brand-primary) 25%, transparent);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .step-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-top: 9px;
    text-align: center;
    transition: color 0.3s;
  }
  .step-item.done .step-label   { color: var(--teal); }
  .step-item.active .step-label { color: var(--teal); font-weight: 500; }
  .step-time {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 3px;
    text-align: center;
    min-height: 14px;
    transition: color 0.3s;
  }
  .step-item.done .step-time   { color: var(--teal); opacity: 0.7; }
  .step-item.active .step-time { color: var(--teal); }
  .step-desc {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--teal);
    letter-spacing: 0.05em;
    margin-top: 18px;
    text-align: center;
    opacity: 0.85;
  }
  .step-desc::before { content: '▶ '; opacity: 0.5; }

  /* ── Error ── */
  #error-section {
    display: none;
    background: rgba(192,57,43,0.07);
    border: 1px solid rgba(192,57,43,0.3);
    border-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 32px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--red);
  }
  /* error prefix is set programmatically for i18n */

  /* ── Results ── */
  #results-section { display: none; }
  .wx-input {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 9px 12px;
    font-family: var(--sans);
    font-size: 14px;
    color: var(--text);
    width: 100%;
    max-width: 460px;
    box-sizing: border-box;
  }
  .wx-input:focus { outline: none; border-color: var(--teal); }
  .btn-chart-control {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border-bright);
    background: var(--bg);
    color: var(--text-dim);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
  }
  .btn-chart-control:hover, .btn-chart-control.open { border-color: var(--teal); color: var(--teal); }
  .btn-chart-control.active { background: var(--teal); border-color: var(--teal); color: #fff; }
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-family: var(--mono);
  }
  thead tr {
    border-bottom: 1px solid var(--border-bright);
  }
  th {
    padding: 8px 12px;
    text-align: left;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 500;
    white-space: nowrap;
  }
  td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
  }
  tbody tr { opacity: 0; animation: row-in 0.3s ease forwards; }
  @keyframes row-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  tbody tr:last-child td { border-bottom: none; }
  tbody tr:hover td { background: var(--bg3); }

  .ahu-merge-overlay {
    display: flex; position: fixed; inset: 0; z-index: 200;
    align-items: center; justify-content: center;
    background: rgba(0,0,0,.4);
  }
  .ahu-merge-box {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; padding: 22px 26px 20px;
    max-width: 560px; width: 92%; max-height: 82vh;
    display: flex; flex-direction: column;
  }
  .ahu-merge-box h3 { margin: 0 0 4px; font-size: 15px; }
  .ahu-merge-hint { font-size: 12px; color: var(--text-dim); margin-bottom: 14px; }
  .ahu-merge-fields { overflow-y: auto; flex: 1; margin-bottom: 16px; }
  .ahu-merge-field-label {
    display: block; font-size: 11px; font-weight: 600;
    color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em;
    margin-bottom: 6px;
  }
  .ahu-merge-actions { display: flex; gap: 10px; justify-content: flex-end; }

  /* ── Estimate provenance indicators ──
     Moved out of cost_estimator.html's page-local <style> when the building
     profile's read-only estimate dialog started drawing the same two marks. A
     traffic light duplicated per page is a traffic light that eventually means
     two different things. */
  .match-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    cursor: help;
    flex-shrink: 0;
  }
  .match-dot.exact        { background: #1D5C3A; }
  .match-dot.interpolated { background: #B08030; }
  .match-dot.ai_estimate  { background: #B03030; }

  /* Engineering-rule indicator. Brand-coloured rather than part of the match traffic
     light: it answers a different question ("which company standard produced this
     line?") and is independent of how well the cost matched the catalog. */
  .rule-mark {
    display: inline-block;
    margin-left: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    color: var(--teal);
    cursor: help;
    flex-shrink: 0;
  }

  /* ── Read-only estimate dialog (building profile → Estimates) ──
     Borrows the merge dialog's overlay/box for the same reason the zone picker
     does, and for one more: the profile's full-screen Escape handler stands down
     while an .ahu-merge-overlay is on screen, so Escape closes the dialog instead
     of also collapsing the pane behind it. Wider than 560px because a line-item
     table with seven columns cannot be read at the merge dialog's width. */
  .estimate-view-box { max-width: 900px; }
  .estimate-view-hint { display: flex; align-items: center; gap: 10px; }
  .estimate-view-body { padding-right: 4px; }
  .estimate-view-empty {
    font-size: 12.5px; color: var(--text-dim); padding: 14px 0;
  }
  .estimate-view-section { margin-bottom: 18px; }
  .estimate-view-section:last-child { margin-bottom: 4px; }
  .estimate-view-desc {
    font-size: 13px; line-height: 1.55; white-space: pre-wrap;
  }
  .estimate-view-docs { display: flex; flex-wrap: wrap; gap: 6px; }
  .estimate-view-doc {
    display: inline-block; padding: 2px 8px;
    border: 1px solid var(--border); border-radius: 10px;
    font-size: 11.5px; color: var(--text-dim); white-space: nowrap;
  }

  .estimate-view-answer {
    display: flex; align-items: baseline; gap: 10px;
    padding: 5px 0; border-bottom: 1px solid var(--border);
    font-size: 12.5px;
  }
  .estimate-view-answer:last-child { border-bottom: none; }
  .estimate-view-answer-q { flex: 1; color: var(--text-dim); }
  .estimate-view-answer-v { font-weight: 600; text-align: right; }
  .estimate-view-src {
    font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
    white-space: nowrap; min-width: 96px; text-align: right;
    color: var(--text-dim);
  }
  /* An assumption and a waived question are the two the reader has to be able to
     pick out — they are the values nobody confirmed. */
  .estimate-view-src-assumed { color: var(--amber); }
  .estimate-view-src-waived  { color: var(--red); }

  .estimate-view-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
  .estimate-view-table th {
    text-align: left; font-size: 10px; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim);
    padding: 0 8px 6px 0; border-bottom: 1px solid var(--border);
  }
  .estimate-view-table td { padding: 5px 8px 5px 0; vertical-align: top; }
  .estimate-view-table .num { text-align: right; padding-right: 8px; }
  .estimate-view-cat td {
    padding-top: 12px; font-weight: 600;
    border-bottom: 1px solid var(--border);
  }
  .estimate-view-num { color: var(--text-dim); text-align: center; width: 28px; }
  .estimate-view-item-desc { white-space: normal; }
  .estimate-view-item-total { font-weight: 600; }
  .estimate-view-flags { white-space: nowrap; width: 34px; }

  .estimate-view-totals {
    display: flex; justify-content: flex-end; gap: 22px;
    padding: 12px 0 14px; margin-top: 4px;
    border-top: 1px solid var(--border);
  }
  .estimate-view-total { display: flex; align-items: baseline; gap: 6px; font-size: 12.5px; }
  .estimate-view-total-label { color: var(--text-dim); }
  .estimate-view-total-value { font-weight: 600; }
  .estimate-view-grand .estimate-view-total-value { font-size: 15px; color: var(--teal); }
  /* Over/under a recorded actual. Deliberately NOT --ok/--red: those drive the match-type
     traffic light two columns away, and an overrun is not a data-quality warning. */
  .estimate-view-over  .estimate-view-total-value,
  .estimate-view-item-actual.estimate-view-over  { color: #c00; }
  .estimate-view-under .estimate-view-total-value,
  .estimate-view-item-actual.estimate-view-under { color: #1D5C3A; }
  .estimate-view-item-actual { font-family: 'Montserrat', monospace; white-space: nowrap; }
  /* The footer link wears the primary-button pill, so it needs the two things an <a>
     does not get from it. It is an anchor rather than a button so it can be opened in a
     new tab, which leaves the profile where the engineer left it. */
  .estimate-view-open { display: inline-block; text-decoration: none; }
  @keyframes cell-reject {
    0%, 60% { background: rgba(192,57,43,0.16); box-shadow: inset 0 0 0 1px var(--red); }
    100%    { background: transparent;          box-shadow: none; }
  }
  @keyframes save-bar-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
  }
  .save-float-btn {
    padding: 6px 18px;
    border: none;
    border-radius: 999px;
    background: var(--brand-primary);
    color: #fff;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    /* "Save to <project>" carries a name of any length, and in French carries a
       longer verb with it. Truncate rather than let the pill wrap to two lines. */
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .save-float-btn:hover:not(:disabled) { background: var(--brand-primary-hover); }
  .save-float-btn:disabled { opacity: 0.6; cursor: default; }
  .save-float-pop-cancel {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg2);
    color: var(--text);
    font-family: var(--mono);
    font-size: 11px;
    cursor: pointer;
  }
  .save-float-pop-cancel:hover { border-color: var(--border-bright); }

  /* ── Confidence badges ── */
  .badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 2px;
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 500;
    font-family: var(--mono);
  }

/* ── Project context bar ── */
.project-bar {
  position: relative;
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  background: var(--bg2);
  display: flex;
  align-items: stretch;
}
.project-bar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 8px 0;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: color .2s;
}
.project-bar-btn:hover { color: var(--teal); }
.project-bar-link {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 16px;
  padding: 8px 0 8px 16px;
  border-left: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color .2s;
}
.project-bar-link:hover { color: var(--teal); }
.project-bar-link:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.project-bar-link[hidden] { display: none; }
.project-bar-link svg { flex-shrink: 0; }
.project-bar-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-right: 2px;
}
.project-dropdown {
  position: absolute;
  top: 100%;
  left: 40px;
  z-index: 50;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  min-width: 240px;
  max-width: 360px;
}
.project-dropdown-item {
  display: block;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-dropdown-item:hover { background: var(--bg2); }
.project-dropdown-item.active { color: var(--teal); font-weight: 600; }
.project-dropdown-sub {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
  margin-top: 1px;
}
.project-dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }
.project-dropdown-manage { color: var(--teal); font-size: 12px; }
.profile-empty {
  padding: 20px 16px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}
.profile-empty a { color: var(--teal); text-decoration: none; }
.profile-empty a:hover { text-decoration: underline; }

/* ── Project list cards ── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.project-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.project-card:hover {
  border-color: var(--teal);
  box-shadow: 0 3px 10px rgba(0,0,0,.07);
}
.project-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.project-card-meta {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}
.project-card-date {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ── Paywall ──────────────────────────────────────────────────────────────
   The free-run limit is enforced on the backend with a 402; this is what the
   user sees when one comes back. It lives in style.css rather than in a page's
   own <style> because every run page can raise it — index.html's .tb-modal-*
   vocabulary is page-local and reaches none of them. */
.paywall-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 35, 50, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}
.paywall-overlay.open { display: flex; }
.paywall-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 28px 30px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(26, 35, 50, 0.18);
}
.paywall-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.paywall-box h3 { margin: 0 0 12px; font-size: 17px; font-weight: 600; color: var(--text); }
.paywall-box p  { margin: 0 0 20px; font-size: 13px; line-height: 1.6; color: var(--text-dim); }
.paywall-actions { display: flex; gap: 10px; justify-content: flex-end; }
.paywall-error {
  font-size: 12px;
  color: var(--red);
  margin: 0 0 14px;
  display: none;
}

/* Free-run counter on a toolbox card and beside a run button.
   Just "2/3" — the sentence it stands for is the element's title, which is what the
   help cursor and the dotted underline are there to advertise. Both are on the badge
   rather than a wrapper so the hover target is exactly the thing being explained. */
.run-quota {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  cursor: help;
  /* Tight, so the underline hugs the digits rather than floating below them. */
  line-height: 1.2;
  border-bottom: 1px dotted currentColor;
}
.run-quota.spent { color: var(--red); }