/* SLD Builder — ported from Daniel's sld-builder prototype
   (https://github.com/Wen-Jie-112/sld-builder), recoloured to JET Charge
   brand tokens (jetcharge.css). EVERYTHING in this file must stay nested
   inside .sld-builder: the :app bundle loads every stylesheet on every page,
   so a top-level selector here would restyle the whole app.

   That bundling also means this file's ~40 KB ships to every user on every
   page, flag on or off. Accepted, not overlooked: it's a one-off cost on an
   already-cached bundle, and splitting it into its own stylesheet_link_tag
   trades that for a second request on the two SLD pages plus a namespacing
   rule the linter can't enforce. Revisit if the file grows materially. */

.sld-builder {
  /* Text ink only — no background or font-family on purpose: the tool sits
     on the app's standard page background and inherits the standard UI font
     (matching the admin surfaces), not the proposal brand styling. */
  color: var(--jc-ink);
  line-height: 1.45;

  /* Upstream's palette tokens (application.css :root), mapped onto JET Charge
     colours so upstream rules can be taken verbatim on future updates. */
  --colour-ink: var(--jc-ink);
  --colour-text: var(--jc-warm-900);
  --colour-muted: var(--jc-warm-700);
  --colour-brand: var(--jc-orange);
  --colour-brand-hover: var(--jc-orange-deep);
  --colour-brand-soft: #fff1ea;
  --colour-header: var(--jc-warm-900);
  --colour-border: var(--jc-warm-200);
  --colour-border-strong: var(--jc-warm-300);
  --colour-surface: #ffffff;
  --colour-surface-subtle: var(--jc-warm-050);
  --colour-workspace: var(--jc-warm-100);
  --radius-small: 0.375rem;
  --radius-medium: 0.625rem;
  --shadow-panel: 0 0.3rem 1rem rgb(24 34 48 / 8%);
  --shadow-raised: 0 0.45rem 1.25rem rgb(24 34 48 / 14%);

  button,
  input,
  select {
    font: inherit;
  }

  button {
    min-height: 2rem;
    padding: 0.4rem 0.65rem;
    color: white;
    background: var(--colour-brand);
    border: 1px solid transparent;
    border-radius: var(--radius-small);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
  }

  button:hover {
    background: var(--colour-brand-hover);
  }

  button:active:not(:disabled) {
    transform: translateY(1px);
  }

  button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
  }

  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  summary:focus-visible {
    outline: 3px solid #f0ad32;
    outline-offset: 2px;
  }

  input,
  select {
    color: var(--colour-ink);
    background: var(--colour-surface);
    border-color: var(--colour-border-strong);
  }

  input::placeholder {
    color: #8a96a6;
    opacity: 1;
  }

  .diagram-page {
    min-height: 100vh;
    box-sizing: border-box;
    padding: 1.5rem 1rem;
  }

  .application-header {
    display: flex;
    width: min(100%, 110rem);
    box-sizing: border-box;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 auto 1rem;
    padding: 1rem 1.15rem;
    color: white;
    background: linear-gradient(115deg, #1d2c3f 0%, #274d78 72%, #205ea8 100%);
    border: 1px solid rgb(255 255 255 / 10%);
    border-radius: var(--radius-medium);
    box-shadow: var(--shadow-raised);
  }

  .application-header h1 {
    margin: 0;
    font-size: clamp(1.35rem, 3vw, 2rem);
    font-weight: 760;
    letter-spacing: -0.025em;
    line-height: 1.05;
  }

  .application-header p {
    margin: 0.2rem 0 0;
    color: #d9e6f4;
    font-size: 0.84rem;
  }

  .prototype-badge {
    flex: 0 0 auto;
    padding: 0.34rem 0.62rem;
    color: #fff4d6;
    background: rgb(13 26 43 / 34%);
    border: 1px solid rgb(255 229 161 / 55%);
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.045em;
    text-transform: uppercase;
  }

  .application-status {
    width: min(100%, 110rem);
    box-sizing: border-box;
    margin: 0 auto 1rem;
    padding: 0.65rem 0.8rem;
    color: #274461;
    background: #eaf3fb;
    border: 1px solid #8ab3d5;
    border-left-width: 5px;
    border-radius: var(--radius-small);
    font-size: 0.78rem;
    font-weight: 700;
  }

  .application-status.status-warning {
    color: #65430b;
    background: #fff7e4;
    border-color: #dcae4d;
  }

  .application-status.status-success {
    color: #245b32;
    background: #edf8ef;
    border-color: #79aa84;
  }

  .application-status.status-error {
    color: #7b1f2b;
    background: #fdf0f1;
    border-color: #c56b77;
  }

  .builder {
    display: grid;
    /* full width: the layout opts this page out of its max-w-7xl container,
       so the prototype's own 110rem cap is dropped here too */
    width: 100%;
    grid-template-columns: minmax(28rem, 39rem) minmax(24rem, 1fr);
    gap: 1.4rem;
    margin: 0 auto;
  }

  .inspector-section,
  .editor-panel,
  .preview-panel {
    --workspace-panel-accent: var(--colour-header);

    box-sizing: border-box;
    min-width: 0;
    padding: 0.8rem;
    background: var(--colour-surface);
    border: 1px solid var(--colour-border);
    border-radius: var(--radius-medium);
    box-shadow: var(--shadow-panel);
  }

  .editor-panel {
    --workspace-panel-accent: var(--colour-header);
  }

  .preview-panel {
    --workspace-panel-accent: var(--colour-header);
  }

  .editor-column {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 1.4rem;
  }

  .output-column {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 1.4rem;
  }

  .project-details-panel {
    --workspace-panel-accent: var(--colour-header);

    box-sizing: border-box;
    min-width: 0;
    padding: 0.6rem;
    background: var(--colour-surface);
    border: 1px solid var(--colour-border);
    border-radius: var(--radius-medium);
    box-shadow: var(--shadow-panel);
  }

  .project-details-panel .workspace-panel-heading {
    margin: -0.6rem -0.6rem 0.55rem;
    padding: 0.45rem 0.65rem;
  }

  .project-file-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  .project-file-actions button {
    padding: 0.27rem 0.5rem;
    color: var(--colour-header);
    background: rgb(255 255 255 / 90%);
    border: 1px solid rgb(255 255 255 / 65%);
    font-size: 0.68rem;
    white-space: nowrap;
  }

  .project-file-actions button:hover {
    color: var(--colour-ink);
    background: white;
    border-color: white;
  }

  .project-file-actions .project-load-button {
    color: white;
    background: transparent;
    border-color: rgb(255 255 255 / 50%);
  }

  .project-file-actions .project-load-button:hover {
    color: var(--colour-header);
    background: white;
  }

  .project-details-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem 0.6rem;
  }

  .project-storage-note {
    margin: 0 0 0.55rem;
    padding: 0.4rem 0.5rem;
    color: #475467;
    background: var(--colour-surface-subtle);
    border: 1px solid var(--colour-border);
    border-left: 4px solid #7c8da2;
    border-radius: var(--radius-small);
    font-size: 0.72rem;
  }

  .project-detail-field {
    display: grid;
    min-width: 0;
    gap: 0.15rem;
    color: var(--colour-text);
    font-size: 0.75rem;
    font-weight: 700;
  }

  .project-detail-field input,
  .project-detail-field select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 2.15rem;
    padding: 0.38rem 0.48rem;
    color: var(--colour-ink);
    background: var(--colour-surface);
    border: 1px solid var(--colour-border-strong);
    border-radius: var(--radius-small);
    font-size: 0.82rem;
    font-weight: 400;
  }

  .object-details-panel {
    --selected-object-accent: #5f7088;
    --selected-object-background: #edf2f7;

    box-sizing: border-box;
    min-width: 0;
    padding: 0.7rem;
    background: white;
    border: 1px solid color-mix(in srgb, var(--selected-object-accent) 50%, #d0d9e4);
    border-radius: var(--radius-medium);
    box-shadow: 0 0.35rem 1rem rgb(23 32 51 / 13%);
    transition: background-color 120ms ease, border-color 120ms ease;
  }

  .inspector-section {
    min-width: 0;
    padding: 0.8rem;
    background: #f3f6f9;
    border: 1px solid var(--colour-border);
    border-radius: var(--radius-medium);
    box-shadow: var(--shadow-panel);
  }

  .inspector-heading {
    margin: -0.8rem -0.8rem 0.75rem;
    padding: 0.62rem 0.8rem;
    background: var(--colour-header);
    border-radius: calc(var(--radius-medium) - 1px) calc(var(--radius-medium) - 1px) 0 0;
  }

  .inspector-heading p {
    margin: 0.14rem 0 0;
    color: #cbd7e5;
    font-size: 0.7rem;
  }

  .inspector-section .inspector-heading h2 {
    margin: 0;
    color: #f4f7fa;
    font-size: 1.05rem;
    font-weight: 750;
    letter-spacing: 0.02em;
  }

  .inspector-section .object-details-panel {
    box-shadow: 0 0.35rem 1rem rgb(23 32 51 / 13%);
  }

  .inspector-section .inspector-navigation-card {
    box-shadow: 0 0.15rem 0.45rem rgb(23 32 51 / 9%);
  }

  .selected-object-heading {
    margin: -0.7rem -0.7rem 0.7rem;
    padding: 0.55rem 0.7rem 0.6rem;
    color: white;
    background: var(--selected-object-accent);
    border-radius: calc(var(--radius-medium) - 1px) calc(var(--radius-medium) - 1px) 0 0;
    box-shadow: none;
  }

  .selected-object-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    margin-bottom: 0.32rem;
    padding: 0.22rem 0.42rem;
    color: var(--selected-object-accent);
    background: white;
    border: 1px solid rgb(255 255 255 / 75%);
    border-radius: 0.22rem;
    box-shadow: 0 1px 3px rgb(23 32 51 / 16%);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.075em;
    line-height: 1.1;
    text-transform: uppercase;
  }

  .selected-object-heading h3 {
    margin: 0;
    color: white;
    font-size: 0.95rem;
    font-weight: 850;
    letter-spacing: 0.015em;
  }

  .object-details-panel.selected-kind-board {
    --selected-object-accent: #5f7088;
    --selected-object-background: #edf2f7;
  }

  .object-details-panel.selected-kind-bus {
    --selected-object-accent: #a64039;
    --selected-object-background: #fdf0ef;
  }

  .object-details-panel.selected-kind-charger {
    --selected-object-accent: #397a48;
    --selected-object-background: #edf7ef;
  }

  .object-details-panel.selected-kind-chargerGroup {
    --selected-object-accent: #28727a;
    --selected-object-background: #eaf6f7;
  }

  .object-details-panel.selected-kind-otherCircuit {
    --selected-object-accent: #75559b;
    --selected-object-background: #f5f1f9;
  }

  .object-details-panel.selected-kind-existingCircuits {
    --selected-object-accent: #416f75;
    --selected-object-background: #eef4f5;
  }

  .object-details-panel.selected-kind-spareSpace {
    --selected-object-accent: #667085;
    --selected-object-background: #f2f4f7;
  }

  .object-details-panel.selected-kind-spareSpacesSummary {
    --selected-object-accent: #5d6678;
    --selected-object-background: #f1f3f6;
  }

  .selected-object-details {
    --object-section-border: #9baabd;
    --object-section-text: #35455b;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .selected-object-details > .object-card-section,
  .selected-object-details > div:last-child {
    grid-column: 1 / -1;
  }

  .selected-object-details > div:last-child > .object-card-section:first-child {
    margin-top: 0;
  }

  .details-for-bus {
    --object-section-border: #d99a95;
    --object-section-text: #82342f;
  }

  .details-for-charger {
    --object-section-border: #8dbb97;
    --object-section-text: #276738;
  }

  .details-for-otherCircuit {
    --object-section-border: #bba7d1;
    --object-section-text: #61427f;
  }

  .details-for-existingCircuits {
    --object-section-border: #6f969b;
    --object-section-text: #315d63;
  }

  .details-for-spareSpace {
    --object-section-border: #98a2b3;
    --object-section-text: #475467;
  }

  .details-for-spareSpacesSummary {
    --object-section-border: #8d96a6;
    --object-section-text: #3f4756;
  }

  .inspector-flow {
    display: grid;
    gap: 0;
  }

  .inspector-navigation-slot,
  .inspector-current-stage {
    position: relative;
  }

  .inspector-flow-link {
    display: grid;
    position: relative;
    height: 2.4rem;
    place-items: center;
  }

  .inspector-flow-link::before {
    position: absolute;
    top: 0;
    bottom: 0.28rem;
    left: 50%;
    width: 3px;
    background: #718096;
    content: "";
    transform: translateX(-50%);
  }

  .inspector-flow-link::after {
    position: absolute;
    bottom: 0.05rem;
    left: 50%;
    width: 0;
    height: 0;
    border-top: 0.48rem solid #718096;
    border-right: 0.36rem solid transparent;
    border-left: 0.36rem solid transparent;
    content: "";
    transform: translateX(-50%);
  }

  .inspector-flow-link span {
    z-index: 1;
    padding: 0.15rem 0.45rem;
    color: #526174;
    background: #f3f6f9;
    border: 1px solid #bcc7d3;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 850;
    letter-spacing: 0.055em;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .inspector-navigation {
    --direction-accent: #718096;
    --direction-background: white;
    --direction-heading-background: #e7ecf2;
    --direction-heading-text: #344054;

    margin: 0;
    overflow: hidden;
    background: var(--direction-background);
    border: 2px solid var(--direction-accent);
    border-radius: var(--radius-medium);
    box-shadow: 0 0.25rem 0.65rem rgb(23 32 51 / 11%);
  }

  .inspector-navigation-upstream {
    --direction-accent: #bd8a2f;
    --direction-background: #fffdf8;
    --direction-heading-background: #f8e8bf;
    --direction-heading-text: #5d4215;
  }

  .inspector-navigation-downstream {
    --direction-accent: #4d9aa3;
    --direction-background: #f9fdfd;
    --direction-heading-background: #d8f0f2;
    --direction-heading-text: #245d63;
  }

  .inspector-current-stage {
    --direction-accent: var(--colour-brand);

    overflow: hidden;
    background: #eef4fb;
    border: 3px solid var(--colour-brand);
    border-radius: var(--radius-medium);
    box-shadow: 0 0.45rem 1.1rem rgb(32 94 168 / 18%);
  }

  .inspector-current-stage-heading {
    --direction-accent: var(--colour-brand);

    color: white;
    background: var(--direction-accent);
  }

  .inspector-current-stage-heading strong,
  .inspector-current-stage-heading small {
    display: block;
  }

  .inspector-current-stage-heading strong {
    font-size: 0.8rem;
    font-weight: 850;
    letter-spacing: 0.045em;
    text-transform: uppercase;
  }

  .inspector-current-stage-heading small {
    margin-top: 0.08rem;
    color: rgb(255 255 255 / 80%);
    font-size: 0.68rem;
  }

  .inspector-current-stage > .object-details-panel {
    margin: 0.68rem;
  }

  .inspector-stage-heading,
  .inspector-current-stage-heading {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.62rem 0.68rem;
  }

  .inspector-stage-heading {
    color: var(--direction-heading-text);
    background: var(--direction-heading-background);
  }

  .inspector-stage-number {
    display: inline-grid;
    width: 1.65rem;
    height: 1.65rem;
    flex: 0 0 auto;
    place-items: center;
    color: var(--direction-accent);
    background: rgb(255 255 255 / 82%);
    border: 2px solid color-mix(in srgb, var(--direction-accent) 35%, white);
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1;
  }

  .inspector-stage-heading-copy {
    min-width: 0;
  }

  .inspector-navigation h4 {
    margin: 0;
    color: inherit;
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.045em;
    text-transform: uppercase;
  }

  .inspector-navigation-relationship {
    margin: 0.08rem 0 0;
    color: color-mix(in srgb, var(--direction-heading-text) 78%, white);
    font-size: 0.68rem;
  }

  .inspector-navigation-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.4rem;
    padding: 0.65rem;
    background: color-mix(in srgb, var(--direction-background) 80%, #e9eef4);
  }

  .inspector-navigation-upstream .inspector-navigation-cards {
    grid-template-columns: 1fr;
  }

  .inspector-navigation-card {
    --navigation-accent: #5f7088;
    --navigation-background: #edf2f7;

    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    position: relative;
    min-width: 0;
    gap: 0.28rem;
    padding: 0.62rem 0.65rem;
    color: #26364b;
    background: var(--navigation-background);
    border: 1px solid color-mix(in srgb, var(--navigation-accent) 58%, white);
    border-left: 4px solid var(--navigation-accent);
    border-radius: var(--radius-small);
    box-shadow: 0 0.15rem 0.45rem rgb(23 32 51 / 9%);
    text-align: left;
    transition: background-color 100ms ease, box-shadow 100ms ease, transform 100ms ease;
  }

  .inspector-navigation-card:hover {
    color: var(--jc-ink);
    background: color-mix(in srgb, var(--navigation-background) 68%, white);
    box-shadow: 0 0.3rem 0.75rem rgb(23 32 51 / 14%);
    transform: translateY(-1px);
  }

  .inspector-navigation-card:focus-visible {
    outline: 3px solid #f0ad32;
    outline-offset: 2px;
  }

  .inspector-navigation-card.nav-kind-bus {
    --navigation-accent: #a64039;
    --navigation-background: #fdf0ef;
  }

  .inspector-navigation-card.nav-kind-charger {
    --navigation-accent: #397a48;
    --navigation-background: #edf7ef;
  }

  .inspector-navigation-card.nav-kind-chargerGroup {
    --navigation-accent: #28727a;
    --navigation-background: #eaf6f7;
  }

  .inspector-navigation-card.nav-kind-otherCircuit {
    --navigation-accent: #75559b;
    --navigation-background: #f5f1f9;
  }

  .inspector-navigation-card.nav-kind-existingCircuits {
    --navigation-accent: #416f75;
    --navigation-background: #eef4f5;
  }

  .inspector-navigation-card.nav-kind-spareSpace {
    --navigation-accent: #667085;
    --navigation-background: #f2f4f7;
  }

  .inspector-navigation-card.nav-kind-spareSpacesSummary {
    --navigation-accent: #5d6678;
    --navigation-background: #f1f3f6;
  }

  .inspector-navigation-type {
    grid-column: 1;
    grid-row: 1;
    width: fit-content;
    padding: 0.16rem 0.32rem;
    color: white;
    background: var(--navigation-accent);
    border-radius: 0.18rem;
    font-size: 0.64rem;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .inspector-navigation-card strong {
    grid-column: 1;
    grid-row: 2;
    overflow: hidden;
    color: #1f2f43;
    font-size: 0.78rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .inspector-navigation-action {
    align-self: center;
    grid-column: 2;
    grid-row: 1 / 3;
    padding: 0.28rem 0.4rem;
    color: var(--navigation-accent);
    background: white;
    border: 1px solid color-mix(in srgb, var(--navigation-accent) 40%, white);
    border-radius: var(--radius-small);
    font-size: 0.66rem;
    font-weight: 850;
    white-space: nowrap;
  }

  .inspector-navigation-card:hover .inspector-navigation-action {
    color: white;
    background: var(--navigation-accent);
    border-color: var(--navigation-accent);
  }

  .inspector-navigation-empty {
    margin: 0;
    padding: 0.45rem 0.55rem;
    color: var(--colour-muted);
    background: white;
    border: 1px dashed color-mix(in srgb, var(--direction-accent) 70%, transparent);
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-style: italic;
  }

  .panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .editor-view-controls {
    display: flex;
    gap: 0.3rem;
  }

  .editor-view-controls button {
    padding: 0.3rem 0.45rem;
    color: var(--colour-text);
    background: #eef2f6;
    border-color: var(--colour-border);
    font-size: 0.72rem;
  }

  .editor-view-controls button:hover {
    background: #d8e0e9;
  }

  .undo-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0.55rem 0;
    padding: 0.45rem 0.55rem;
    color: #35455b;
    background: #fff7df;
    border: 1px solid #d5aa42;
    border-radius: 0.3rem;
    font-size: 0.78rem;
  }

  .undo-bar[hidden] {
    display: none;
  }

  .undo-bar button {
    padding: 0.25rem 0.5rem;
  }

  .editor-panel h2,
  .preview-panel h2 {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
  }

  .preview-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .preview-heading h2 {
    margin-bottom: 0.75rem;
  }

  .workspace-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: -0.8rem -0.8rem 0.8rem;
    padding: 0.68rem 0.8rem;
    color: white;
    background: var(--workspace-panel-accent);
    border-radius: calc(var(--radius-medium) - 1px) calc(var(--radius-medium) - 1px) 0 0;
  }

  .editor-sections-toggle-all {
    padding: 0.28rem 0.55rem;
    color: #24364c;
    background: rgb(255 255 255 / 88%);
    border: 1px solid rgb(255 255 255 / 65%);
    font-size: 0.7rem;
  }

  .editor-sections-toggle-all:hover {
    background: white;
  }

  .workspace-panel-heading h2,
  .editor-panel .workspace-panel-heading h2,
  .preview-panel .workspace-panel-heading h2,
  .inspector-section .workspace-panel-heading h2 {
    margin: 0;
    color: white;
    font-size: 1.05rem;
    font-weight: 750;
    letter-spacing: 0.015em;
  }

  /* The four primary work areas share a strong outer hierarchy while their
     internal controls retain the quieter visual language used elsewhere. */
  .super-section {
    --super-section-accent: #718096;

    padding: 0.85rem;
    background: var(--colour-surface);
    border: 2px solid #b9c5d2;
    border-top: 5px solid var(--super-section-accent);
    border-radius: 0.8rem;
    box-shadow: 0 0.55rem 1.4rem rgb(24 34 48 / 13%), 0 1px 2px rgb(24 34 48 / 9%);
  }

  .super-section-selected {
    --super-section-accent: #76529d;
  }

  .super-section-builder {
    --super-section-accent: #2f7d86;
  }

  .super-section-project {
    --super-section-accent: #94651f;
  }

  .super-section-output {
    --super-section-accent: #2868b2;
  }

  .super-section > .super-section-heading {
    min-height: 3.35rem;
    margin: -0.85rem -0.85rem 0.85rem;
    padding: 0.72rem 0.9rem;
    color: white;
    background: linear-gradient(105deg, #1f3044, #2b4058);
    border-bottom: 1px solid #142337;
    border-radius: 0.48rem 0.48rem 0 0;
    box-shadow: inset 5px 0 var(--super-section-accent), 0 3px 8px rgb(24 34 48 / 16%);
  }

  .super-section-heading-copy {
    min-width: 0;
  }

  .super-section-kicker {
    display: block;
    margin-bottom: 0.12rem;
    color: color-mix(in srgb, var(--super-section-accent) 32%, white);
    font-size: 0.62rem;
    font-weight: 850;
    letter-spacing: 0.085em;
    line-height: 1.15;
    text-transform: uppercase;
  }

  .super-section > .super-section-heading h2,
  .inspector-section > .super-section-heading h2 {
    margin: 0;
    color: white;
    font-size: 1.15rem;
    font-weight: 780;
    letter-spacing: -0.01em;
    line-height: 1.15;
  }

  .super-section > .super-section-heading p {
    margin: 0.18rem 0 0;
    color: #cbd7e5;
    font-size: 0.72rem;
    line-height: 1.3;
  }

  .super-section > .super-section-heading > button,
  .super-section > .super-section-heading > .project-file-actions {
    flex: 0 0 auto;
  }

  .output-tabs {
    display: flex;
    overflow-x: auto;
    gap: 0;
    background: var(--colour-surface-subtle);
    border: 1px solid var(--colour-border);
    border-radius: var(--radius-small) var(--radius-small) 0 0;
  }

  .output-tabs button {
    flex: 0 0 auto;
    min-height: 2.45rem;
    padding-inline: 0.85rem;
    color: var(--colour-muted);
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
  }

  .output-tabs button:hover {
    color: var(--colour-ink);
    background: #edf2f7;
  }

  .output-tabs button[aria-selected="true"] {
    color: var(--colour-brand);
    background: white;
    border-bottom-color: var(--colour-brand);
  }

  .output-toolbar {
    display: flex;
    min-height: 2.5rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0.15rem 0.45rem;
    border-bottom: 1px solid #e5eaf0;
  }

  .output-toolbar > span {
    color: var(--colour-text);
    font-size: 0.9rem;
    font-weight: 750;
  }

  .output-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }

  .output-interaction-hint {
    margin: 0.55rem 0 0.7rem;
    padding: 0.4rem 0.55rem;
    color: #4d6279;
    background: #f2f6fb;
    border-left: 3px solid #8aa9cb;
    border-radius: 0 var(--radius-small) var(--radius-small) 0;
    font-size: 0.75rem;
  }

  .download-pdf-button {
    padding: 0.35rem 0.65rem;
    white-space: nowrap;
  }

  .download-pdf-button:disabled {
    cursor: wait;
    opacity: 0.65;
  }

  .download-package-button {
    padding: 0.32rem 0.65rem;
    color: #183c72;
    background: white;
    border: 1px solid rgb(255 255 255 / 75%);
    font-size: 0.72rem;
    font-weight: 750;
    white-space: nowrap;
  }

  .download-package-button:hover {
    color: #102b54;
    background: #eaf1fb;
  }

  .download-package-button:disabled {
    cursor: wait;
    opacity: 0.7;
  }

  .symbol-legend {
    margin-bottom: 0.75rem;
    padding: 0.6rem;
    background: var(--colour-surface-subtle);
    border: 1px solid var(--colour-border);
    border-radius: var(--radius-small);
  }

  .symbol-legend h3 {
    margin: 0 0 0.45rem;
    color: var(--colour-text);
    font-size: 0.72rem;
    letter-spacing: 0.055em;
    text-transform: uppercase;
  }

  .symbol-legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(6.4rem, 1fr));
    gap: 0.4rem;
  }

  .symbol-legend-item {
    display: grid;
    grid-template-rows: 3.5rem auto;
    align-items: center;
    padding: 0.4rem;
    color: var(--colour-text);
    background: white;
    border: 1px solid #dbe2ea;
    border-radius: var(--radius-small);
    font-size: 0.72rem;
    font-weight: 650;
    text-align: center;
  }

  .symbol-legend-item svg {
    display: block;
    width: 100%;
    height: 3.5rem;
  }

  .legend-terminal-symbol .legend-symbol-code {
    font-size: 12px;
    font-weight: 700;
    text-anchor: middle;
  }

  .zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.18rem;
    background: #eef2f6;
    border: 1px solid var(--colour-border);
    border-radius: var(--radius-small);
  }

  .zoom-controls button {
    min-width: 2rem;
    padding: 0.3rem 0.5rem;
    color: var(--colour-text);
    background: white;
    border-color: var(--colour-border);
    font-size: 1rem;
    line-height: 1;
  }

  .zoom-controls button:hover {
    color: var(--colour-ink);
    background: #dfe7f0;
  }

  .zoom-controls output {
    min-width: 3.25rem;
    color: var(--colour-text);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    text-align: center;
  }

  .communications-output {
    min-height: 16rem;
    box-sizing: border-box;
    padding: 1rem;
    color: #5b6980; /* AA 4.5:1 on #fbfcfd; upstream #718198 fell short */
    background: #fbfcfd;
    border: 1px solid #e3e7ed;
  }

  .cable-schedule-output {
    min-height: 16rem;
    box-sizing: border-box;
    padding: 0.75rem 0;
    background: #fbfcfd;
  }

  .cable-schedule-scroll {
    max-width: 100%;
    overflow: auto;
    border: 1px solid var(--colour-border);
    border-radius: var(--radius-small);
  }

  .cable-schedule-table {
    width: 100%;
    min-width: 80rem;
    border-collapse: collapse;
    background: white;
    font-size: 0.72rem;
  }

  .cable-schedule-table th,
  .cable-schedule-table td {
    padding: 0.5rem;
    border-right: 1px solid #d8dee8;
    border-bottom: 1px solid #d8dee8;
    text-align: left;
    vertical-align: top;
  }

  .cable-schedule-table th {
    position: sticky;
    top: 0;
    color: white;
    background: #344b66;
    font-size: 0.68rem;
    letter-spacing: 0.025em;
    white-space: nowrap;
  }

  .cable-schedule-table tbody tr:nth-child(even) {
    background: #f5f8fb;
  }

  .cable-schedule-table tbody tr:hover {
    background: #eaf2fb;
  }

  .cable-schedule-table td:nth-child(2),
  .cable-schedule-table td:nth-child(3) {
    min-width: 12rem;
    font-weight: 650;
  }

  .cable-schedule-empty {
    padding: 1.5rem !important;
    color: #607086;
    font-style: italic;
    text-align: center !important;
  }

  .communications-output p {
    margin: 0;
    font-size: 0.85rem;
  }

  .communications-canvas {
    overflow: auto;
    min-height: 16rem;
    background-color: #fbfcfd;
    background-image: radial-gradient(circle, #cbd5e1 0.75px, transparent 0.8px);
    background-size: 18px 18px;
    border: 1px solid var(--colour-border);
    border-radius: var(--radius-small);
  }

  .communications-diagram {
    display: block;
    max-width: none;
  }

  .communications-cable {
    fill: none;
    stroke: #47778f;
    stroke-width: 2;
    stroke-dasharray: 5 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
  }

  .communications-board-symbol .location-boundary {
    fill: #edf2f7;
    stroke: #718198;
    stroke-width: 2;
    stroke-dasharray: 7 5;
  }

  .communications-board-symbol .location-separator,
  .communications-charger-symbol .location-separator {
    stroke: #b9c6d5;
    stroke-width: 1;
  }

  .communications-charger-symbol .location-boundary {
    fill: #edf7ef;
    stroke: #6da47a;
    stroke-width: 2;
  }

  .communications-board-symbol .location-title,
  .communications-charger-symbol .location-title {
    fill: #26364b;
    font-size: 14px;
    font-weight: 700;
  }

  .communications-charger-symbol .location-title {
    fill: #1f512c;
  }

  .communications-equipment rect {
    fill: white;
    stroke: #9ba8ba;
    stroke-width: 1.5;
  }

  .communications-equipment.lms rect,
  .communications-equipment.network_switch rect {
    stroke: #347b83;
  }

  .communications-equipment.energy_meter_lms rect {
    stroke: #75559b;
  }

  .communications-equipment.virtual_meter rect {
    fill: #f7f3fb;
    stroke: #75559b;
    stroke-dasharray: 5 3;
  }

  .communications-equipment.charger rect {
    stroke: #397a48;
  }

  .communications-equipment .equipment-label {
    fill: #26364b;
    font-size: 11px;
    font-weight: 600;
  }

  .communications-equipment .equipment-detail {
    fill: #526077;
    font-size: 10px;
    text-anchor: end;
  }

  .empty-location {
    fill: #718198;
    font-size: 11px;
  }

  .panel-heading h2 {
    margin-bottom: 0;
    color: var(--colour-text);
    font-size: 0.95rem;
    font-weight: 750;
  }

  .editor-section-toggle {
    min-width: 3.4rem;
    padding: 0.25rem 0.45rem;
    color: var(--colour-text);
    background: #f3f6f9;
    border: 1px solid var(--colour-border);
    font-size: 0.7rem;
  }

  .editor-section-toggle:hover {
    background: #dfe6ee;
    border-color: #7f90a5;
  }

  .editor-section-content {
    padding-top: 0.4rem;
  }

  .editor-section-content[hidden] {
    display: none;
  }

  .editor-help {
    margin: 0 0 0.45rem;
    color: var(--colour-muted);
    font-size: 0.8rem;
  }

  .editor-section + .editor-section {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--colour-border);
  }

  .communications-settings {
    display: grid;
    grid-template-columns: auto minmax(10rem, 1fr);
    align-items: end;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
    padding: 0.55rem;
    background: #f1f8f9;
    border: 1px solid #9cc3c7;
    border-left: 4px solid #347b83;
    border-radius: var(--radius-small);
  }

  .communications-settings > label {
    grid-column: 1 / -1;
  }

  .communications-requirement-warning {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0.48rem 0.55rem;
    color: #733a18;
    background: #fff1d8;
    border: 1px solid #d89b45;
    border-left: 4px solid #b76a28;
    border-radius: 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
  }

  .communications-settings label span {
    display: block;
    margin-bottom: 0.2rem;
    color: #3d6970;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .communications-settings select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.4rem;
    background: white;
    border: 1px solid #70a8ae;
    border-radius: 0.25rem;
    font: inherit;
    font-size: 0.8rem;
  }

  .network-switches-editor {
    grid-column: 1 / -1;
    padding-top: 0.45rem;
    border-top: 1px solid #b8d7da;
  }

  .network-switches-editor h3 {
    margin: 0 0 0.4rem;
    color: #285e64;
    font-size: 0.8rem;
  }

  .network-switch-list {
    display: grid;
    gap: 0.6rem;
  }

  .network-switch-row {
    display: grid;
    grid-template-columns: minmax(7rem, 1fr) 5rem auto;
    align-items: end;
    gap: 0.35rem;
    padding: 0.35rem;
    background: white;
    border: 1px solid #a8c8cb;
    border-left: 4px solid #5b969c;
    border-radius: var(--radius-small);
    box-shadow: none;
  }

  .network-switch-row strong {
    align-self: center;
    color: #285e64;
    font-size: 0.78rem;
  }

  .cable-run-list {
    display: grid;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .cable-run-row {
    display: grid;
    gap: 0.24rem;
    padding: 0.32rem 0.38rem;
    background: var(--colour-surface-subtle);
    border: 1px solid var(--colour-border);
    border-left: 4px solid #526f91;
    border-radius: var(--radius-small);
  }

  .cable-run-route {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.4rem;
  }

  .cable-run-reference {
    display: inline-grid;
    width: 1.55rem;
    height: 1.55rem;
    flex: 0 0 auto;
    place-items: center;
    color: white;
    background: #526f91;
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 800;
  }

  .cable-run-end {
    display: grid;
    min-width: 0;
    gap: 0.12rem;
  }

  .cable-run-end strong {
    overflow: hidden;
    color: #26364b;
    font-size: 0.76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cable-run-type {
    color: #607086;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.045em;
    text-transform: uppercase;
  }

  .cable-run-arrow {
    color: #526f91;
    font-size: 1.15rem;
    font-weight: 800;
  }

  .cable-run-fields {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    gap: 0.28rem;
    padding-top: 0.25rem;
    border-top: 1px solid #d4dbe4;
  }

  .cable-run-field span {
    display: block;
    margin-bottom: 0.08rem;
    color: #526077;
    font-size: 0.68rem;
    font-weight: 700;
  }

  .cable-run-field input,
  .cable-run-field select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.24rem 0.32rem;
    background: white;
    border: 1px solid var(--colour-border-strong);
    border-radius: var(--radius-small);
    font-size: 0.72rem;
  }

  .cable-run-field:last-child {
    grid-column: auto;
  }

  .cable-run-marker circle {
    fill: #526f91;
    stroke: #526f91;
    stroke-width: 2;
  }

  .cable-run-marker text {
    fill: white;
    font-size: 12px;
    font-weight: 800;
    text-anchor: middle;
  }

  .cable-schedule-run-reference {
    text-align: center;
  }

  .add-network-switch-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem;
    margin-top: 0.4rem;
  }

  .add-network-switch-controls button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
  }

  .board-editor {
    --object-section-border: #9baabd;
    --object-section-text: #35455b;
    --card-selection-accent: #526f91;

    padding: 0.45rem;
    background: #edf2f7;
    border: 1px solid #8c9caf;
    border-left: 4px solid #5f7088;
    border-radius: var(--radius-small);
    box-shadow: 0 0.15rem 0.45rem rgb(23 32 51 / 8%);
  }

  .editor-type-badge {
    display: inline-block;
    margin: 0 0 0.3rem;
    padding: 0.12rem 0.38rem;
    color: white;
    background: #5f7088;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .board-editor-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem;
    margin: -0.45rem -0.45rem 0;
    padding: 0.45rem;
    background: #dce5ef;
    border-bottom: 1px solid #aebbc9;
    border-radius: 0.3rem 0.3rem 0 0;
  }

  .board-editor-actions {
    display: flex;
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    justify-content: flex-end;
    gap: 0.35rem;
  }

  .board-editor.is-collapsed .board-editor-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .collapsed-node-name {
    width: 100%;
    min-width: 0;
    align-self: center;
    justify-self: start;
    overflow: hidden;
    color: #26364b;
    font-size: 0.82rem;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .object-card {
    cursor: pointer;
  }

  .tree-card-actions {
    display: flex;
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    justify-content: flex-end;
    gap: 0.35rem;
  }

  .board-editor.is-collapsed .collapsed-node-name {
    grid-column: 1;
    grid-row: 1;
  }

  .board-editor.is-collapsed .board-editor-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .collapsed-switchboard-names {
    display: grid;
    gap: 0.08rem;
  }

  .collapsed-main-bus-name {
    overflow: hidden;
    color: #7a450d;
    font-size: 0.7rem;
    font-weight: 650;
    text-overflow: ellipsis;
  }

  .board-editor-heading .editor-field {
    grid-column: auto;
  }

  .board-editor-heading .switchboard-name-field {
    grid-column: 1;
    grid-row: 1;
  }

  .board-editor-heading .main-bus-name-field {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 0.5rem;
    padding-top: 0.55rem;
    border-top: 5px solid #526279;
  }

  .board-editor-heading .main-bus-badge {
    background: #9a5b13;
  }

  .board-editor-heading .editor-field label {
    color: #35455b;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .board-editor-heading .editor-field input {
    color: var(--jc-ink);
    background: white;
    border-color: #718198;
    font-weight: 700;
  }

  .bus-editor {
    --object-section-border: #d2a363;
    --object-section-text: #7a450d;

    padding: 0.4rem;
    background: #fff8ec;
    border: 1px solid #d2a363;
    border-left: 4px solid #9a5b13;
    border-radius: var(--radius-small);
    box-shadow: none;
  }

  .bus-editor > .bus-editor-heading .editor-type-badge {
    background: #9a5b13;
  }

  .embedded-main-bus {
    margin-top: 0.65rem;
    padding-top: 0.6rem;
    border-top: 2px solid #d2a363;
  }

  .embedded-main-bus.is-structure-only {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .bus-editor-heading,
  .bus-actions {
    display: grid;
    gap: 0.35rem;
  }

  .bus-editor-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    margin: -0.4rem -0.4rem 0;
    padding: 0.4rem;
    background: #f7e6ca;
    border-bottom: 1px solid #d2a363;
    border-radius: 0.2rem 0.2rem 0 0;
  }

  .bus-editor-heading-actions {
    display: flex;
    align-self: start;
    justify-content: flex-end;
    gap: 0.35rem;
  }

  .bus-editor.is-collapsed > .bus-editor-heading {
    align-items: center;
    padding-block: 0.35rem;
    margin: 0;
    border: 1px solid #c77c76;
    border-left: 4px solid #a64039;
    border-radius: var(--radius-small);
  }

  .bus-editor-heading .editor-field label {
    color: #7a450d;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .bus-editor-heading .editor-field input {
    background: white;
    border-color: #c38a45;
    font-weight: 650;
  }

  .bus-editor.is-child-bus {
    --object-section-border: #d99a95;
    --object-section-text: #82342f;
    --card-selection-accent: #a64039;

    background: #fdf0ef;
    border-color: #c66f68;
    border-left-color: #a64039;
    box-shadow: none;
  }

  .bus-editor.is-child-bus > .bus-editor-heading {
    background: #f5d8d5;
    border-bottom-color: #d99a95;
  }

  .bus-editor.is-child-bus > .bus-editor-heading .editor-field label {
    color: #82342f;
  }

  .bus-editor.is-child-bus > .bus-editor-heading .editor-type-badge {
    background: #a64039;
  }

  .bus-editor.is-child-bus > .bus-editor-heading .editor-field input {
    border-color: #c66f68;
  }

  .bus-editor.is-child-bus > .bus-editor-heading .toggle-bus {
    color: #82342f;
    background: #f3d2cf;
  }

  .bus-editor.is-child-bus > .bus-editor-heading .toggle-bus:hover {
    background: #eabcb8;
  }

  .bus-actions {
    grid-template-columns: auto;
    margin-top: 0.35rem;
  }

  .add-object-menu {
    position: relative;
    width: fit-content;
  }

  .add-object-menu > summary {
    width: fit-content;
    padding: 0.4rem 0.65rem;
    color: white;
    background: var(--colour-brand);
    border: 1px solid transparent;
    border-radius: var(--radius-small);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    list-style: none;
  }

  .add-object-menu > summary::-webkit-details-marker {
    display: none;
  }

  .add-object-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.35rem;
    padding: 0.4rem;
    background: white;
    border: 1px solid var(--colour-border-strong);
    border-radius: var(--radius-small);
    box-shadow: var(--shadow-raised);
  }

  .bus-details > .incoming-devices {
    margin-top: 0.6rem;
  }

  .object-card-section {
    margin-top: 0.65rem;
    padding-top: 0.15rem;
    background: transparent;
    border: 0;
    border-top: 5px solid color-mix(in srgb, var(--object-section-border, #aeb8c5) 58%, #101827);
  }

  .object-card-section > h4 {
    margin: 0;
    padding: 0.35rem 0;
    color: var(--object-section-text, #35455b);
    background: transparent;
    border: 0;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.055em;
    text-transform: uppercase;
  }

  .object-card-section-body {
    padding: 0;
  }

  .outgoing-supplies-section .bus-actions {
    margin-top: 0;
  }

  .outgoing-supplies-section > .object-card-section-body > .downstream-objects {
    margin-top: 0.65rem;
  }

  .incoming-devices {
    padding: 0.35rem;
    background: rgb(255 255 255 / 65%);
    border: 1px solid var(--colour-border-strong);
    border-radius: var(--radius-small);
  }

  .incoming-devices summary {
    color: #35455b;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
  }

  .incoming-device-list {
    display: grid;
    gap: 0.28rem;
    margin-top: 0.35rem;
  }

  .incoming-device-groups {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.55rem;
  }

  .incoming-device-group {
    min-width: 0;
    padding: 0.32rem;
    background: rgb(255 255 255 / 45%);
    border: 1px solid #b7c0cd;
    border-radius: var(--radius-small);
  }

  .incoming-device-group h5 {
    margin: 0 0 0.35rem;
    color: #40536c;
    font-size: 0.72rem;
    letter-spacing: 0.045em;
    text-transform: uppercase;
  }

  .incoming-device-row {
    display: grid;
    grid-template-columns: minmax(5.5rem, 1fr) minmax(5rem, 0.7fr) auto auto;
    align-items: center;
    gap: 0.25rem;
    padding: 0.22rem 0.25rem;
    background: white;
    border: 1px solid var(--colour-border);
    border-radius: var(--radius-small);
    box-shadow: none;
  }

  .incoming-device-row strong {
    align-self: center;
    grid-column: 1;
    min-width: 0;
    overflow: hidden;
    color: #35455b;
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .incoming-device-row > .order-controls {
    grid-column: 3;
    justify-self: start;
  }

  .incoming-device-row > .remove-item {
    grid-column: 4;
    justify-self: end;
  }

  .incoming-device-row > .incoming-device-settings {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .incoming-device-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr));
    gap: 0.3rem;
  }

  .incoming-device-row.has-extra-settings {
    grid-template-columns: minmax(7rem, 0.8fr) minmax(16rem, 2fr) auto auto;
  }

  .incoming-device-row.has-no-setting strong {
    grid-column: 1 / 3;
  }

  .incoming-device-settings > .editor-field label {
    margin-bottom: 0.08rem;
    overflow: hidden;
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .incoming-device-settings > .editor-field input,
  .incoming-device-settings > .editor-field select {
    padding: 0.25rem 0.32rem;
    font-size: 0.75rem;
  }

  .add-device-menu {
    margin-bottom: 0.4rem;
  }

  .editor-field label {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--colour-muted);
    font-size: 0.72rem;
    font-weight: 600;
  }

  .editor-field input,
  .editor-field select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0.4rem 0.5rem;
    color: var(--colour-ink);
    background: white;
    border: 1px solid var(--colour-border-strong);
    border-radius: var(--radius-small);
  }

  .editor-field input.is-invalid {
    border-color: #b42334;
    box-shadow: 0 0 0 2px rgb(180 35 52 / 12%);
  }

  .field-error {
    display: block;
    margin-top: 0.2rem;
    color: #a0182a;
    font-size: 0.68rem;
    font-weight: 700;
  }

  .editor-context {
    display: block;
    margin: -0.1rem 0 0.3rem;
    color: #526077;
    font-size: 0.68rem;
    font-weight: 600;
  }

  .order-controls {
    display: inline-flex;
    align-self: end;
    gap: 0.15rem;
  }

  .order-controls button {
    min-width: 1.85rem;
    padding: 0.35rem 0.3rem;
    color: var(--colour-text);
    background: #eef2f6;
    border-color: var(--colour-border);
    font-weight: 800;
  }

  .order-controls button:hover:not(:disabled) {
    background: #d4dde8;
  }

  .order-controls button:disabled {
    cursor: default;
    opacity: 0.3;
  }

  .downstream-objects {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.7rem;
    padding: 0.15rem 0 0.15rem 1rem;
    border-left: 1px dashed #b8c3cf;
  }

  .charger-editor {
    --card-selection-accent: #397a48;

    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.35rem;
    padding: 0.4rem;
    background: #edf7ef;
    border: 1px solid #8dbb97;
    border-left: 4px solid #397a48;
    border-radius: var(--radius-small);
    box-shadow: none;
  }

  .charger-group-editor {
    --card-selection-accent: #28727a;

    padding: 0.35rem 0.4rem;
    background: #eaf6f7;
    border: 1px solid #8eb8bc;
    border-left: 4px solid #28727a;
    border-radius: var(--radius-small);
    box-shadow: none;
  }

  .charger-group-editor > .terminal-editor-heading {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }

  .charger-group-count,
  .spare-space-count {
    color: #426c72;
    font-size: 0.68rem;
    font-weight: 700;
    white-space: nowrap;
  }

  .spare-space-editor > .terminal-editor-heading {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
  }

  .terminal-editor-heading {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.35rem;
  }

  .terminal-editor-actions {
    display: flex;
    align-self: start;
    justify-content: flex-end;
    gap: 0.35rem;
  }

  .toggle-node {
    color: #35455b;
    background: #e8edf3;
  }

  .toggle-node:hover {
    background: #d4dde8;
  }

  .charger-editor .editor-type-badge {
    background: #397a48;
  }

  .charger-editor > .incoming-devices {
    grid-column: 1 / -1;
  }

  .other-circuits-editor {
    --card-selection-accent: #75559b;

    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.35rem;
    padding: 0.4rem;
    background: #f5f1f9;
    border: 1px solid #bba7d1;
    border-left: 4px solid #75559b;
    border-radius: var(--radius-small);
    box-shadow: none;
  }

  .other-circuits-editor .editor-type-badge {
    background: #75559b;
  }

  .other-circuits-editor .editor-field label {
    color: #61427f;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .other-circuits-editor .editor-field input {
    background: white;
    border-color: #9d81ba;
  }

  .other-circuits-editor > .incoming-devices {
    grid-column: 1 / -1;
  }

  .existing-circuits-editor {
    --card-selection-accent: #416f75;

    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.35rem;
    padding: 0.4rem;
    background: #eef4f5;
    border: 1px solid #8eaaae;
    border-left: 4px solid #416f75;
    border-radius: var(--radius-small);
    box-shadow: none;
  }

  .existing-circuits-editor .editor-type-badge {
    background: #416f75;
  }

  .existing-circuits-editor .editor-field label {
    color: #315d63;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .existing-circuits-editor .editor-field input {
    background: white;
    border-color: #6f969b;
  }

  .existing-circuits-editor > .incoming-devices {
    grid-column: 1 / -1;
  }

  .spare-space-editor,
  .spare-spaces-editor {
    --card-selection-accent: #667085;

    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.35rem;
    padding: 0.4rem;
    background: #f2f4f7;
    border: 1px solid #b3bac6;
    border-left: 4px solid #667085;
    border-radius: var(--radius-small);
    box-shadow: none;
  }

  .charger-editor.is-collapsed,
  .other-circuits-editor.is-collapsed,
  .existing-circuits-editor.is-collapsed,
  .spare-space-editor.is-collapsed,
  .spare-spaces-editor.is-collapsed {
    padding-block: 0.35rem;
    background: white;
    box-shadow: 0 1px 3px rgb(23 32 51 / 10%);
  }

  .charger-editor .editor-field label {
    color: #276738;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .charger-editor .editor-field input {
    background: white;
    border-color: #79aa84;
  }

  .remove-item {
    color: #8b1e2d;
    background: #f8e8eb;
    border-color: #e9c4cb;
  }

  .remove-item:hover {
    background: #f1cfd5;
  }

  .toggle-board {
    color: var(--colour-brand);
    background: #e9f0fb;
    border-color: #c6d9f0;
  }

  .toggle-board:hover {
    background: #d8e5f7;
  }

  .toggle-bus {
    color: #7a450d;
    background: #f8e8cf;
  }

  .toggle-bus:hover {
    background: #efd3a9;
  }

  .board-editor.is-collapsed {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .board-editor.is-collapsed > .board-editor-heading {
    margin: 0;
    border: 1px solid #8c9caf;
    border-left: 4px solid #5f7088;
    border-radius: var(--radius-small);
  }

  .bus-editor.is-collapsed {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .object-card.is-selected > :first-child {
    color: white;
    background: var(--card-selection-accent, var(--jc-orange));
    outline: 3px solid color-mix(in srgb, var(--card-selection-accent, var(--jc-orange)) 55%, white);
    outline-offset: 2px;
    box-shadow: 0 0.35rem 0.8rem rgb(23 32 51 / 18%);
    transform: translateX(0.18rem);
  }

  .object-card:not(.is-selected):hover > :first-child {
    box-shadow: 0 0.25rem 0.65rem rgb(23 32 51 / 14%);
  }

  .object-card.is-selected > :first-child .collapsed-node-name,
  .object-card.is-selected > :first-child .collapsed-main-bus-name {
    color: white;
  }

  .object-card.is-selected > :first-child .collapsed-main-bus-name {
    opacity: 0.82;
  }

  .object-card.is-selected > :first-child .tree-card-actions::before {
    align-self: center;
    padding: 0.16rem 0.38rem;
    color: white;
    background: rgb(255 255 255 / 18%);
    border: 1px solid rgb(255 255 255 / 55%);
    border-radius: 999px;
    content: "Selected";
    font-size: 0.64rem;
    font-weight: 850;
    letter-spacing: 0.045em;
    text-transform: uppercase;
  }

  .empty-buses {
    margin: 1rem 0 0;
    padding: 1rem;
    color: #526077;
    background: #f4f6f8;
    border-radius: 0.25rem;
  }

  .editor-empty-state {
    margin: 0.55rem 0 0;
    padding: 0.55rem;
    color: #607086;
    background: rgb(255 255 255 / 60%);
    border: 1px dashed #aeb8c5;
    border-radius: 0.25rem;
    font-size: 0.75rem;
  }

  .network-switch-list > .editor-empty-state,
  .incoming-device-list > .editor-empty-state {
    margin-top: 0;
  }

  .diagram-canvas {
    overflow: auto;
    min-height: 20rem;
    background-color: #fbfcfd;
    background-image: radial-gradient(circle, #cbd5e1 0.75px, transparent 0.8px);
    background-size: 18px 18px;
    border: 1px solid var(--colour-border);
    border-radius: var(--radius-small);
    box-shadow: inset 0 1px 2px rgb(24 34 48 / 5%);
  }

  .single-line-diagram {
    display: block;
    max-width: none;
  }

  .diagram-selectable {
    cursor: pointer;
  }

  path.diagram-selectable,
  line.diagram-selectable {
    pointer-events: stroke;
  }

  .diagram-selectable:hover,
  .diagram-selectable:focus-visible {
    filter: drop-shadow(0 0 3px rgb(36 87 166 / 70%));
    outline: none;
  }

  .diagram-selectable.is-selected {
    filter: drop-shadow(0 0 4px rgb(196 117 30 / 90%));
  }

  .electrical-connection,
  .busbar {
    fill: none;
    stroke: var(--jc-ink);
    stroke-width: 3;
  }

  .phase-indicator {
    pointer-events: none;
  }

  .phase-indicator line {
    fill: none;
    stroke: var(--jc-ink);
    stroke-width: 2;
    stroke-linecap: round;
  }

  .busbar {
    stroke-width: 5;
  }

  .board-boundary {
    fill: none;
    stroke: #9ba8ba;
    stroke-width: 1.5;
    stroke-dasharray: 7 5;
  }

  .charger-group-location > rect:first-child {
    fill: none;
    stroke: #5f9da3;
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
  }

  .charger-group-location .charger-group-label-backplate {
    fill: #fbfcfd;
    stroke: none;
  }

  .charger-group-location text {
    fill: #285e64;
    font-size: 11px;
    font-weight: 700;
  }

  .charger-location > rect:first-child {
    fill: none;
    stroke: #67a274;
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
  }

  .charger-location .charger-location-label-backplate {
    fill: #fbfcfd;
    stroke: none;
  }

  .charger-location text {
    fill: #276738;
    font-size: 11px;
    font-weight: 700;
  }

  .diagram-label-backplate {
    fill: #fbfcfd;
    stroke: none;
  }

  .bus-label {
    fill: var(--jc-ink);
    font-size: 15px;
    font-weight: 600;
    text-anchor: start;
  }

  .board-label {
    fill: #526077;
    font-size: 14px;
    font-weight: 700;
  }

  .incoming-device-symbol circle,
  .incoming-device-symbol rect,
  .incoming-device-symbol line,
  .incoming-device-symbol path {
    fill: white;
    stroke: var(--jc-ink);
    stroke-width: 2.5;
  }

  .incoming-device-symbol path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .incoming-device-symbol text {
    fill: var(--jc-ink);
    font-size: 12px;
    font-weight: 600;
  }

  .incoming-device-symbol .device-code {
    font-size: 9px;
    text-anchor: middle;
  }

  .incoming-device-symbol .retail-meter-code {
    font-size: 8px;
    font-weight: 800;
  }

  .incoming-device-symbol.virtual-meter circle {
    fill: #f7f3fb;
    stroke: #75559b;
    stroke-dasharray: 5 3;
  }

  .incoming-device-symbol .virtual-meter-code {
    fill: #61427f;
    font-weight: 800;
  }

  .incoming-device-symbol .device-rating {
    font-size: 12px;
  }

  .incoming-device-symbol .device-type {
    fill: #526077;
    font-size: 9px;
    font-weight: 650;
  }

  .incoming-device-symbol .energy-meter-setting-label {
    fill: #526077;
    font-size: 9px;
    font-weight: 700;
  }

  .incoming-device-symbol .energy-meter-setting-value {
    font-size: 11px;
    font-weight: 700;
  }

  .incoming-device-symbol .energy-meter-detail-label {
    fill: #526077;
    font-size: 8px;
    font-weight: 700;
  }

  .incoming-device-symbol .energy-meter-detail-value {
    font-size: 10px;
    font-weight: 700;
  }

  .incoming-device-symbol .device-mask {
    fill: white;
    stroke: none;
  }

  .charger-symbol rect {
    fill: white;
    stroke: #276738;
    stroke-width: 2;
  }

  .charger-symbol text {
    fill: #1f512c;
    font-size: 13px;
    font-weight: 600;
    text-anchor: middle;
  }

  .other-circuits-symbol rect {
    fill: white;
    stroke: #75559b;
    stroke-width: 2;
    stroke-dasharray: 6 4;
  }

  .other-circuits-symbol text {
    fill: #61427f;
    font-size: 13px;
    font-weight: 600;
    text-anchor: middle;
  }

  .existing-circuits-symbol .existing-circuits-label {
    fill: #315d63;
    font-size: 12px;
    font-weight: 700;
    text-anchor: middle;
  }

  .existing-circuits-branches .branch-line,
  .existing-circuits-branches .continuation-branch {
    fill: none;
    stroke: #416f75;
    stroke-linecap: round;
  }

  .existing-circuits-branches .branch-line {
    stroke-width: 3;
  }

  .spare-space-label {
    fill: #475467;
    font-size: 10px;
    font-weight: 650;
    text-anchor: middle;
  }

  .spare-spaces-description {
    fill: #344054;
    font-size: 10px;
    font-weight: 600;
    text-anchor: middle;
  }

  .spare-spaces-continuation {
    fill: none;
    stroke: #667085;
    stroke-width: 2;
    stroke-linecap: round;
  }

  .existing-circuits-branches .continuation-branch {
    stroke-width: 2;
  }

  @media (max-width: 900px) {
    .builder {
      grid-template-columns: 1fr;
    }

    .project-details-fields {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workspace-panel-heading,
    .project-details-panel .workspace-panel-heading {
      flex-wrap: wrap;
    }
  }

  @media (max-width: 600px) {
    .diagram-page {
      padding: 0.65rem 0.5rem;
    }

    .application-header {
      align-items: flex-start;
      padding: 0.7rem 0.8rem;
    }

    .application-header p {
      max-width: 22rem;
    }

    .project-details-fields {
      grid-template-columns: 1fr;
    }

    .selected-object-details {
      grid-template-columns: 1fr;
    }

    .cable-run-fields {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0.4rem;
    }

    .cable-run-field:last-child {
      grid-column: 1 / -1;
    }

    .network-switch-row {
      grid-template-columns: minmax(0, 1fr) auto;
    }

    .network-switch-row strong {
      grid-column: 1 / -1;
    }

    .downstream-objects {
      padding-left: 0.65rem;
    }

    .project-file-actions,
    .output-toolbar,
    .output-toolbar-actions {
      flex-wrap: wrap;
    }

    .output-toolbar {
      align-items: flex-start;
    }

    .symbol-legend-items {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .incoming-device-row.has-extra-settings {
      grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .incoming-device-row.has-extra-settings > .incoming-device-settings {
      grid-column: 1 / -1;
      grid-row: 2;
    }

    .incoming-device-row.has-extra-settings > .order-controls {
      grid-column: 2;
    }

    .incoming-device-row.has-extra-settings > .remove-item {
      grid-column: 3;
    }
  }

  @media (max-width: 430px) {
    .application-header {
      flex-direction: column;
    }

    .prototype-badge {
      align-self: flex-start;
    }

    .cable-run-route {
      grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .cable-run-destination {
      grid-column: 2 / -1;
    }
  }

  @media (pointer: coarse) {
    button,
    summary {
      min-height: 2.75rem;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      scroll-behavior: auto !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* ── Runway additions (after the port so they win specificity ties) ── */

  & .sld-page-heading {
    display: flex;
    width: 100%;
    margin: 0 auto 1rem;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
  }

  & .sld-page-heading h1 {
    margin: 0;
    text-align: left;
    font-size: 1.5rem;
    font-weight: 700;
  }

  & .sld-page-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
  }

  & .sld-back-link {
    color: var(--jc-warm-700);
    text-decoration: none;
  }

  & .sld-back-link:hover {
    color: var(--jc-orange);
  }

  & .sld-heading-actions {
    display: grid;
    justify-items: end;
    gap: 0.3rem;
    font-size: 0.8rem;
  }

  & .sld-save-status {
    min-height: 1.2rem;
    font-size: 0.8rem;
    color: var(--jc-warm-700);
  }

  & .sld-save-status [data-state="error"],
  & .sld-save-status [data-state="blocked"],
  & .sld-save-status [data-state="conflict"] {
    color: var(--jc-danger);
    font-weight: 600;
  }
}
