:root {
    --navy: #07111f;
    --navy-2: #0b1b30;
    --surface: #10263e;
    --surface-2: #153452;
    --line: rgba(175, 209, 235, .17);
    --line-strong: rgba(175, 209, 235, .32);
    --text: #eff7ff;
    --muted: #9eb3c7;
    --faint: #6c849b;
    --cyan: #42d6d2;
    --blue: #5ba7ff;
    --amber: #f7bd61;
    --violet: #b897ff;
    --rose: #ff8897;
    --green: #7adf9a;
    --shadow: 0 18px 45px rgba(0, 0, 0, .18);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    height: 100%;
}

/* The page is as tall as the window: the header on top and the workspace in the rest, so the panels scroll, not the page. */
body {
    margin: 0;
    min-width: 1040px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--navy);
    color: var(--text);
}

button, input, select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-header {
    height: 72px;
    flex: none;
    display: flex;
    align-items: center;
    gap: 34px;
    padding: 0 26px;
    border-bottom: 1px solid var(--line);
    background: rgba(7,17,31,.92);
}

.brand {
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    letter-spacing: -.4px;
    white-space: nowrap;
}

    .brand b {
        color: var(--cyan);
        font-weight: 720;
    }

.brand-mark {
    display: grid;
    grid-template-columns: repeat(3, 7px);
    gap: 3px;
    align-items: end;
    height: 21px;
}

    .brand-mark i {
        width: 7px;
        background: var(--cyan);
        border-radius: 3px;
        transform: skewY(-25deg);
    }

        .brand-mark i:nth-child(1) {
            height: 11px;
        }

        .brand-mark i:nth-child(2) {
            height: 21px;
        }

        .brand-mark i:nth-child(3) {
            height: 15px;
        }

.model-title {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 13px;
    flex: 1;
}

    .model-title input {
        background: transparent;
        border: 0;
        color: var(--text);
        font-size: 16px;
        font-weight: 650;
        width: 150px;
        outline: none;
        padding: 5px 2px;
        border-bottom: 1px solid transparent;
    }

        .model-title input:focus {
            border-bottom-color: var(--cyan);
        }

.dirty-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: transparent;
}

    .dirty-dot.visible {
        background: var(--amber);
        box-shadow: 0 0 0 3px rgba(247,189,97,.12);
    }

.header-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.button {
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--text);
    border-radius: 8px;
    padding: 9px 13px;
    font-size: 13px;
    font-weight: 600;
    transition: .15s ease;
    white-space: nowrap;
}

    .button:hover {
        border-color: var(--cyan);
        transform: translateY(-1px);
    }

    .button.primary {
        background: var(--cyan);
        color: #06222d;
        border-color: var(--cyan);
    }

        .button.primary:hover {
            filter: brightness(1.08);
        }

    .button.secondary {
        background: transparent;
    }

    .button.compact {
        padding: 6px 10px;
        font-size: 12px;
    }

.upload-button input {
    display: none;
}

.workspace {
    --workspace-gap: 14px;
    --tree-default-width: 254px;
    --tree-min-width: 180px;
    --main-min-width: 520px;
    --rail-width: 315px;
    flex: 1;
    min-height: 0;
    display: grid;
    /* Model explorer, its drag handle (as wide as the gap), diagram, gap and right rail. '--tree-width' is set by the handle
       ('setupTreeResizer'); the explorer never gets narrower than its minimum nor leaves the diagram less than its own. */
    grid-template-columns:
        clamp(var(--tree-min-width), var(--tree-width, var(--tree-default-width)), calc(100% - var(--main-min-width) - var(--rail-width) - 2 * var(--workspace-gap)))
        var(--workspace-gap)
        minmax(var(--main-min-width), 1fr)
        var(--workspace-gap)
        var(--rail-width);
    /* Without this the row is as tall as the tallest diagram, and the three panels with it. */
    grid-template-rows: minmax(0, 1fr);
    padding: var(--workspace-gap);
}

    .workspace > .tree-panel {
        grid-area: 1 / 1;
    }

    .workspace > .tree-resizer {
        grid-area: 1 / 2;
    }

    .workspace > .main-panel {
        grid-area: 1 / 3;
    }

    .workspace > .right-rail {
        grid-area: 1 / 5;
    }

/* Drag handle of the model explorer: it fills the gap between the explorer and the diagram. */
.tree-resizer {
    position: relative;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
    outline: none;
}

    .tree-resizer::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 4px;
        height: 46px;
        transform: translate(-50%, -50%);
        border-radius: 2px;
        background: var(--line-strong);
        transition: background .15s ease, height .15s ease;
    }

    .tree-resizer:hover::after, .tree-resizer:focus-visible::after, .tree-resizer.dragging::after {
        background: var(--cyan);
        height: 74px;
    }

.panel {
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(19,47,75,.88), rgba(10,29,49,.88));
    border-radius: 11px;
    box-shadow: var(--shadow);
}

.tree-panel, .right-rail {
    min-height: 0;
}

.tree-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.right-rail {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: auto;
}

.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 17px 13px;
    border-bottom: 1px solid var(--line);
}

    .panel-heading.small {
        padding: 15px 16px 11px;
    }

.eyebrow {
    color: var(--cyan);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin: 0 0 5px;
}

h1, h2 {
    font-size: 16px;
    margin: 0;
    letter-spacing: -.2px;
}

h2 {
    font-size: 15px;
}

.icon-button {
    width: 29px;
    height: 29px;
    border-radius: 7px;
    border: 1px solid var(--line-strong);
    background: rgba(255,255,255,.04);
    color: var(--text);
    font-size: 20px;
    line-height: 1;
    display: grid;
    place-items: center;
}

    .icon-button:hover {
        border-color: var(--cyan);
        color: var(--cyan);
    }
    .icon-button.danger {
        color: var(--rose);
    }

    .icon-button.danger:hover {
        color: var(--rose);
        border-color: var(--rose);
    }

.tree-icon {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
}

.type-system {
    background: rgba(66,214,210,.18);
    color: var(--cyan);
}

.type-block {
    background: rgba(91,167,255,.16);
    color: var(--blue);
}

.type-process {
    background: rgba(184,151,255,.16);
    color: var(--violet);
}

.type-procedure {
    background: rgba(247,189,97,.16);
    color: var(--amber);
}

.type-state {
    background: rgba(122,223,154,.16);
    color: var(--green);
}

/* Model explorer: Wunderbaum themed with the SDL Studio palette. */
sdl-tree-panel .sdl-tree {
    --wb-font-stack: inherit;
    --wb-node-text-color: var(--muted);
    --wb-background-color: transparent;
    --wb-border-color: transparent;
    --wb-focus-border-color: transparent;
    --wb-hover-color: rgba(255,255,255,.055);
    --wb-active-color: rgba(66,214,210,.13);
    --wb-active-hover-color: rgba(66,214,210,.18);
    --wb-active-color-grayscale: rgba(66,214,210,.13);
    --wb-active-hover-color-grayscale: rgba(66,214,210,.18);
    --wb-active-border-color: rgba(66,214,210,.4);
    --wb-active-hover-border-color: var(--cyan);
    --wb-active-border-color-grayscale: rgba(66,214,210,.25);
    --wb-row-outer-height: 30px;
    --wb-row-inner-height: 28px;
    --wb-icon-outer-height: 28px;
    --wb-icon-outer-width: 22px;
    height: 100%;
    font-size: 13px;
    /* Always there, like the vertical one of Wunderbaum: a bar that comes and goes would change the height of the tree. */
    overflow-x: scroll;
}

/* The list is as wide as its widest row ('--tree-content-width', set by the panel), so a deep tree scrolls sideways
   and its titles are shown whole. Wunderbaum gives the cell of a row and its title the width of the panel and hides
   what does not fit; here the cell is as wide as the list and nothing is cut. */
sdl-tree-panel .sdl-tree div.wb-list-container {
    min-width: var(--tree-content-width, 0px);
}

sdl-tree-panel .sdl-tree div.wb-row > span.wb-node.wb-col {
    width: 100% !important;
    overflow-x: visible;
    overflow-y: clip;
}

sdl-tree-panel .sdl-tree span.wb-node span.wb-title {
    width: auto !important;
    overflow: visible;
}

/* Where the panel measures the titles of the tree. */
.tree-ruler {
    position: fixed;
    top: 0;
    left: -10000px;
    visibility: hidden;
    pointer-events: none;
    white-space: nowrap;
}

    .tree-ruler > span {
        display: block;
        width: max-content;
    }

sdl-tree-panel .sdl-tree div.wb-row {
    border-radius: 7px;
}

sdl-tree-panel .sdl-tree div.wb-row.wb-active {
    color: #e8ffff;
}

sdl-tree-panel .sdl-tree i.wb-expander {
    color: var(--faint);
    font-size: 11px;
}

sdl-tree-panel .sdl-tree i.wb-icon.tree-icon {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 4px 7px 0 2px;
    vertical-align: top;
}

.tree-badge {
    margin-left: 8px;
    color: var(--faint);
    font-size: 10px;
}

/* Menu shown on a right-click over a block of the model explorer. It is appended to <body>. */
.context-menu {
    position: fixed;
    z-index: 10000;
    min-width: 150px;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

    .context-menu button {
        display: block;
        width: 100%;
        padding: 8px 12px;
        text-align: left;
        border: none;
        background-color: transparent;
        cursor: pointer;
    }

        .context-menu button:hover {
            background-color: #f0f0f0;
        }

.tree-footer {
    padding: 11px 16px;
    border-top: 1px solid var(--line);
}

.text-button {
    color: var(--muted);
    border: 0;
    background: transparent;
    padding: 0;
    font-size: 12px;
}

    .text-button:hover {
        color: var(--cyan);
    }

.main-panel {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0,1fr);
    gap: 14px;
}

.canvas-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px 9px 16px;
    min-height: 51px;
}

.breadcrumb {
    display: flex;
    gap: 7px;
    align-items: center;
    color: var(--muted);
    font-size: 12px;
}

    .breadcrumb strong {
        color: var(--text);
        font-weight: 650;
    }

    .breadcrumb .crumb-type {
        color: var(--cyan);
        background: rgba(66,214,210,.09);
        padding: 4px 7px;
        border-radius: 5px;
        font-size: 10px;
        text-transform: uppercase;
        font-weight: 750;
        letter-spacing: .06em;
    }

.view-options {
    display: flex;
    gap: 8px;
    align-items: center;
}

    .view-options .icon-button {
        width: 29px;
        height: 29px;
        font-size: 18px;
    }

.diagram {
    min-height: 0;
    position: relative;
    overflow: auto;
    padding: 26px;
    background-image: radial-gradient(rgba(147,190,221,.18) 1px, transparent 1px);
    background-size: 22px 22px;
}

/* Custom panel elements styling */
sdl-tree-panel,
sdl-diagram-panel,
sdl-palette-panel,
sdl-inspector-panel {
    display: block;
    min-height: 0;
    overflow: hidden;
}

sdl-tree-panel {
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(19,47,75,.88), rgba(10,29,49,.88));
    border-radius: 11px;
    box-shadow: var(--shadow);
}

sdl-diagram-panel {
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(19,47,75,.88), rgba(10,29,49,.88));
    border-radius: 11px;
    box-shadow: var(--shadow);
    overflow: auto;
    padding: 26px;
    background-image: 
        linear-gradient(145deg, rgba(19,47,75,.88), rgba(10,29,49,.88)),
        radial-gradient(rgba(147,190,221,.18) 1px, transparent 1px);
    background-size: 100% 100%, 22px 22px;
}

sdl-palette-panel,
sdl-inspector-panel {
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(19,47,75,.88), rgba(10,29,49,.88));
    border-radius: 11px;
    box-shadow: var(--shadow);
    overflow-y: auto;
}

.diagram-empty {
    height: 100%;
    min-height: 330px;
    display: grid;
    place-content: center;
    text-align: center;
    color: var(--muted);
}

    .diagram-empty strong {
        color: var(--text);
        font-size: 17px;
        margin-bottom: 7px;
    }

.system-diagram {
    position: relative;
    min-width: 650px;
    min-height: 440px;
    height: 100%;
}

.diagram-label {
    position: absolute;
    top: 0;
    left: 0;
    color: var(--faint);
    font-size: 11px;
    letter-spacing: .09em;
    text-transform: uppercase;
    font-weight: 700;
}

.connection-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: visible;
    pointer-events: none;
}

.connection-labels {
    z-index: 3;
}

.connection-line {
    stroke: rgba(66,214,210,.82);
    stroke-width: 2;
    fill: none;
}

    .connection-line.dual {
        stroke-dasharray: 5 4;
    }

.connection-label {
    fill: var(--cyan);
    font-size: 11px;
    font-weight: 650;
    paint-order: stroke;
    stroke: var(--navy-2);
    stroke-width: 5px;
    stroke-linejoin: round;
}

.connection-events {
    fill: var(--cyan);
    font-size: 11px;
    font-weight: 650;
}

.connection-events-box {
    fill: var(--navy-2);
    stroke: none;
}

.connection-events-border {
    fill: none;
    stroke: var(--cyan);
    stroke-width: 1.5;
}

/* The line and the label of a channel are in two layers; the diagram panel marks both with 'hovered'. Before the
   'selected' rules, which win. */
.channel-link.hovered .connection-label,
.channel-link.hovered .connection-events {
    fill: var(--text);
}

.channel-link.hovered .connection-events-border,
.channel-link.hovered .connection-leader {
    stroke: var(--text);
}

.channel-link.selected .connection-events {
    fill: var(--rose);
}

.channel-link.selected .connection-events-border {
    stroke: var(--rose);
}

.connection-leader {
    fill: none;
    stroke: var(--cyan);
    stroke-width: 1;
    stroke-dasharray: 2 3;
    opacity: .8;
}

.channel-link.selected .connection-leader {
    stroke: var(--rose);
}

.channel-link {
    cursor: pointer;
    pointer-events: all;
}

.connection-hit {
    fill: none;
    stroke: transparent;
    stroke-width: 18;
    pointer-events: stroke;
}

.channel-link:hover .connection-line,
.channel-link.hovered .connection-line {
    stroke: var(--text);
    stroke-width: 3;
}

.connection-arrow {
    fill: rgba(66,214,210,.82);
    stroke: none;
}

.channel-link:hover .connection-arrow,
.channel-link.hovered .connection-arrow {
    fill: var(--text);
}

.channel-link.selected .connection-arrow {
    fill: var(--rose);
}

.channel-link.selected .connection-line {
    stroke: var(--rose);
    stroke-width: 4;
}

.channel-link.selected .connection-label {
    fill: var(--rose);
}

.agent-card {
    position: absolute;
    z-index: 2;
    width: 174px;
    min-height: 92px;
    border: 1px solid var(--line-strong);
    border-top: 3px solid var(--blue);
    background: rgba(12,31,52,.96);
    border-radius: 9px;
    padding: 12px;
    cursor: pointer;
    box-shadow: 0 9px 24px rgba(0,0,0,.2);
    transition: .15s ease;
}

    .agent-card:hover {
        transform: translateY(-2px);
        border-color: var(--cyan);
    }

    .agent-card.selected {
        outline: 2px solid var(--cyan);
        outline-offset: 3px;
    }

    .agent-card .card-kind {
        color: var(--blue);
        font-size: 10px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .09em;
    }

    .agent-card strong {
        display: block;
        font-size: 15px;
        margin: 7px 0 7px;
        overflow-wrap: anywhere;
    }

    .agent-card small {
        color: var(--muted);
        font-size: 11px;
    }

/* The declarations of an agent: a sheet with its upper right corner folded. The signals of the channels of a system or
   a block are drawn on the same sheet. */
.dcls-box, .signals-box {
    --dcls-fold: 16px;
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
    width: max-content;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    background: rgba(32,58,86,.62);
    clip-path: polygon(0 0, calc(100% - var(--dcls-fold)) 0, 100% var(--dcls-fold), 100% 100%, 0 100%);
}

    .dcls-box::before, .signals-box::before {
        content: "";
        position: absolute;
        top: -1px;
        right: -1px;
        width: var(--dcls-fold);
        height: var(--dcls-fold);
        background: linear-gradient(225deg, transparent 0 calc(50% - 1px), var(--line-strong) calc(50% - 1px) 50%, rgba(66,104,140,.75) 50%);
    }

.dcls-head, .signals-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    min-width: 150px;
    gap: 10px;
    margin-bottom: 12px;
}

    .dcls-head span, .signals-head span {
        color: var(--faint);
        font-size: 10px;
        letter-spacing: .09em;
        text-transform: uppercase;
    }

    .dcls-head strong {
        color: #fff;
        font-size: 15px;
        white-space: nowrap;
    }

.dcls-list, .signals-list {
    max-height: 220px;
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0;
    /* Spare room: text widths are fractions of a pixel, and a line a hair wider than the box would add a sideways scroll bar. */
    padding: 0 10px 0 0;
    list-style: none;
    color: var(--text);
    font-size: 11px;
    line-height: 1.5;
}

    .dcls-list li, .signals-list li {
        white-space: nowrap;
    }

    /* A line of the signals selects its channel. */
    .signals-list li {
        cursor: pointer;
    }

        .signals-list li:hover {
            color: var(--cyan);
        }

        .signals-list li.selected {
            color: var(--rose);
        }

/* The signals of a system are above its drawing, and the ones of a block under its header. */
.system-heading {
    margin-bottom: 18px;
}

.block-heading {
    margin-bottom: 30px;
}

    .block-heading > .block-header {
        margin-bottom: 14px;
    }

/* Clicking the sheet opens the dialog that edits it (the clip-path hides an outline, so the focus is the border). */
.dcls-box {
    cursor: pointer;
}

    .dcls-box:hover, .dcls-box:focus-visible {
        background: rgba(44,80,118,.78);
        border-color: var(--cyan);
        outline: none;
    }

/* In the system diagram the sheet is in the top right corner of the drawing. */
.system-diagram > .dcls-box {
    position: absolute;
    top: 0;
    right: 0;
}

/* In the other diagrams it is the right end of the heading. */
.diagram-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

    .diagram-top > :first-child {
        flex: 1 1 auto;
        min-width: 0;
        margin-bottom: 0;
    }

    .diagram-top .process-summary {
        flex-wrap: wrap;
    }

.block-diagram {
    min-width: 520px;
    min-height: 100%;
    height: max-content;
}

    /* The blocks inside a block, drawn like the blocks of the system. */
    .block-diagram .system-diagram {
        margin-bottom: 24px;
    }

.block-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

    .block-header strong {
        font-size: 20px;
    }

    .block-header span {
        color: var(--blue);
        font-size: 12px;
    }

.process-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.process-card {
    min-height: 160px;
    border: 1px solid rgba(184,151,255,.45);
    background: rgba(16,33,57,.9);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
}

    .process-card:hover {
        border-color: var(--cyan);
    }

    .process-card .card-top {
        color: var(--violet);
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: .1em;
        font-weight: 800;
    }

    .process-card strong {
        display: block;
        font-size: 18px;
        margin: 8px 0;
    }

    .process-card p {
        color: var(--muted);
        font-size: 12px;
        margin: 0 0 15px;
    }

.process-link {
    display: flex;
    align-items: stretch;
    gap: 0;
}

    .process-link .process-card {
        flex: 0 0 250px;
        width: 250px;
        box-sizing: border-box;
    }

.channel-arrow {
    flex: 1 1 auto;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 8px;
    cursor: pointer;
    color: var(--text);
}

.channel-arrow-label {
    text-align: center;
    font-size: 13px;
    font-weight: 650;
    padding: 0 8px;
    overflow-wrap: anywhere;
}

.channel-arrow-events {
    position: relative;
    display: inline-block;
    margin-left: 8px;
    padding: 1px 9px;
    font-weight: 600;
}

    .channel-arrow-events::before,
    .channel-arrow-events::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 8px;
        border: 1.5px solid currentColor;
    }

    .channel-arrow-events::before {
        left: 0;
        border-right: 0;
    }

    .channel-arrow-events::after {
        right: 0;
        border-left: 0;
    }

.channel-arrow-line {
    position: relative;
    display: block;
    height: 2px;
    margin: 6px 0;
    background: rgba(184,151,255,.75);
}

    .channel-arrow-line.to-left::before,
    .channel-arrow-line.to-right::after {
        content: "";
        position: absolute;
        top: -5px;
        border: 6px solid transparent;
    }

    .channel-arrow-line.to-left::before {
        left: 0;
        border-right: 9px solid rgba(184,151,255,.75);
        border-left-width: 0;
    }

    .channel-arrow-line.to-right::after {
        right: 0;
        border-left: 9px solid rgba(184,151,255,.75);
        border-right-width: 0;
    }

.channel-arrow:hover .channel-arrow-line {
    background: var(--text);
}

.channel-arrow:hover .channel-arrow-line::before {
    border-right-color: var(--text);
}

.channel-arrow:hover .channel-arrow-line::after {
    border-left-color: var(--text);
}

.channel-arrow.selected {
    color: var(--rose);
}

    .channel-arrow.selected .channel-arrow-line {
        background: var(--rose);
    }

    .channel-arrow.selected .channel-arrow-line::before {
        border-right-color: var(--rose);
    }

    .channel-arrow.selected .channel-arrow-line::after {
        border-left-color: var(--rose);
    }

.state-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.state-pill {
    padding: 3px 7px;
    color: var(--green);
    background: rgba(122,223,154,.12);
    border-radius: 20px;
    font-size: 10px;
}

.block-channels {
    margin: -8px 0 24px;
}

.block-channel-list {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.block-channel {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 175px;
    border: 1px solid rgba(66,214,210,.35);
    border-radius: 7px;
    padding: 8px 10px;
    color: var(--text);
    background: rgba(66,214,210,.06);
    text-align: left;
}

    .block-channel:hover {
        border-color: var(--cyan);
        background: rgba(66,214,210,.13);
    }

    .block-channel.selected {
        border-color: var(--rose);
        background: rgba(255,136,151,.12);
    }

    .block-channel.selected .sdl-icon {
        color: var(--rose);
    }

    .block-channel .sdl-icon {
        color: var(--cyan);
        flex: 0 0 auto;
    }

    .block-channel strong {
        display: block;
        font-size: 12px;
    }

    .block-channel small {
        display: block;
        color: var(--muted);
        font-size: 10px;
        margin-top: 2px;
    }

.process-diagram {
    min-width: 760px;
    min-height: 100%;
    height: max-content;
}

.process-summary {
    display: flex;
    gap: 14px;
    margin-bottom: 24px;
}

.summary-card {
    min-width: 160px;
    padding: 11px 13px;
    border-radius: 8px;
    background: rgba(255,255,255,.045);
    border: 1px solid var(--line);
}

    .summary-card span {
        display: block;
        color: var(--faint);
        font-size: 10px;
        letter-spacing: .07em;
        text-transform: uppercase;
    }

    .summary-card strong {
        display: block;
        margin-top: 4px;
        font-size: 13px;
        color: var(--text);
    }

/* The summary cards of a process with its procedure symbol under them. */
.process-heading {
    margin-bottom: 24px;
}

    .process-heading > .process-summary {
        margin-bottom: 14px;
    }

/* The local procedures of a process in the procedure symbol: a rectangle with a cut-cornered piece at each side, as
   wide as its lines. The outer element is the border (its background shows 1px around the frame, also along the diagonals). */
.procedures-box {
    --procedure-side: 10px;
    --procedure-shape: polygon(var(--procedure-side) 0, calc(100% - var(--procedure-side)) 0, 100% var(--procedure-side), 100% calc(100% - var(--procedure-side)), calc(100% - var(--procedure-side)) 100%, var(--procedure-side) 100%, 0 calc(100% - var(--procedure-side)), 0 var(--procedure-side));
    width: max-content;
    max-width: 100%;
    padding: 1px;
    background: var(--line-strong);
    clip-path: var(--procedure-shape);
}

.procedures-frame {
    position: relative;
    padding: 12px calc(var(--procedure-side) + 16px);
    background: #182e47;
    clip-path: var(--procedure-shape);
}

    /* The sides of the rectangle, where the pointed pieces begin. */
    .procedures-frame::before,
    .procedures-frame::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 1px;
        background: var(--line-strong);
    }

    .procedures-frame::before {
        left: calc(var(--procedure-side) - 1px);
    }

    .procedures-frame::after {
        right: calc(var(--procedure-side) - 1px);
    }

.procedures-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    min-width: 170px;
    gap: 28px;
}

    .procedures-head span {
        color: var(--faint);
        font-size: 10px;
        letter-spacing: .09em;
        text-transform: uppercase;
    }

    .procedures-head strong {
        color: #fff;
        font-size: 12px;
        white-space: nowrap;
    }

.procedures-list {
    margin: 12px 0 0;
    padding: 0 0 0 14px;
    list-style: none;
    color: var(--text);
    font-size: 11px;
    line-height: 1.5;
}

    .procedures-list li {
        white-space: nowrap;
        cursor: pointer;
    }

        .procedures-list li:hover {
            color: var(--cyan);
        }

.flow-area {
    display: flex;
    gap: 26px;
    align-items: flex-start;
    padding: 5px;
}

.start-flow {
    width: 170px;
    flex: 0 0 170px;
}

.flow-title {
    color: var(--cyan);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin: 0 0 11px;
}

.states-flow {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.state-card {
    width: 236px;
    border: 1px solid rgba(122,223,154,.38);
    background: rgba(10,30,49,.95);
    border-radius: 10px;
    padding: 0 12px 12px;
    cursor: pointer;
}

    .state-card:hover {
        border-color: var(--cyan);
    }

.state-title {
    margin: 0 -12px 11px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(122,223,154,.23);
    color: var(--green);
    font-size: 13px;
    font-weight: 750;
}

.flow-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.flow-node {
    width: 100%;
    position: relative;
    border-radius: 5px;
    padding: 7px 8px;
    margin-bottom: 18px;
    font-size: 11px;
    border: 1px solid;
    background: rgba(255,255,255,.05);
    color: var(--text);
    min-height: 32px;
    overflow-wrap: anywhere;
}

    .flow-node::after {
        content: "";
        position: absolute;
        bottom: -18px;
        left: calc(50% - .75px);
        height: 18px;
        border-left: 1.5px solid var(--faint);
    }

    .flow-node:last-child {
        margin-bottom: 0;
    }

        .flow-node:last-child::after {
            display: none;
        }

.node-input {
    border-color: rgba(91,167,255,.55);
}

.node-output {
    border-color: rgba(247,189,97,.6);
}

.node-task {
    border-color: rgba(184,151,255,.55);
}

.node-setstate {
    border-color: rgba(122,223,154,.55);
}

.node-decision {
    transform: rotate(0deg);
    border-color: rgba(255,136,151,.63);
}

.node-procedurecall {
    border-color: rgba(66,214,210,.6);
}

.node-return {
    border-color: rgba(247,189,97,.65);
}

.flow-node .kind {
    display: block;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 9px;
    font-weight: 750;
    letter-spacing: .08em;
    margin-bottom: 3px;
}

/* The C code of a task (highlightC in c-code.ts): one statement per line, with the C/C++ colors of the Dark theme
   of Visual Studio. */
.c-code {
    display: block;
    white-space: pre-wrap;
    tab-size: 2;
    color: #dcdcdc;
}

    .c-code .code-line {
        display: block;
    }

.c-control {
    color: #d8a0df;
}

.c-keyword {
    color: #569cd6;
}

.c-type {
    color: #4ec9b0;
}

.c-macro {
    color: #beb7ff;
}

.c-function {
    color: #dcdcaa;
}

.c-identifier {
    color: #9cdcfe;
}

.c-number {
    color: #b5cea8;
}

.c-string {
    color: #d69d85;
}

.c-comment {
    color: #57a64a;
}

.c-preprocessor {
    color: #9b9b9b;
}

.c-operator {
    color: #b4b4b4;
}

.c-punctuation {
    color: #dcdcdc;
}

.start-node {
    border-radius: 50%;
    width: 76px;
    height: 76px;
    display: grid;
    place-content: center;
    text-align: center;
    border: 2px solid var(--cyan);
    color: var(--cyan);
    background: rgba(66,214,210,.1);
    font-size: 11px;
    font-weight: 750;
    margin: 9px auto 20px;
}

.procedure-diagram {
    min-width: 500px;
    min-height: 100%;
    height: max-content;
}

.procedure-head {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    margin-bottom: 24px;
}

    .procedure-head strong {
        display: block;
        font-size: 20px;
    }

    .procedure-head p {
        margin: 5px 0 0;
        color: var(--muted);
        font-size: 12px;
    }

.procedure-signature {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.param-list {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.param-paren,
.param-sep {
    color: var(--muted);
    font-size: 16px;
}

.param-sep {
    font-size: 14px;
}

.param-chip {
    background: rgba(247,189,97,.11);
    color: var(--amber);
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 15px;
}

.procedure-flow {
    width: 260px;
    margin: 0 auto;
}

.flow-node.clickable {
    cursor: pointer;
}

    .flow-node.clickable:hover {
        border-color: var(--cyan);
    }

.palette-panel {
    flex: 0 0 auto;
}

.panel-copy {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    padding: 0 16px;
    margin: 14px 0;
}

.palette {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 14px 15px;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--muted);
    background: rgba(255,255,255,.025);
    text-align: left;
    font-size: 11px;
    font-weight: 600;
}

    .palette-item:hover {
        border-color: var(--cyan);
        color: var(--text);
        background: rgba(66,214,210,.07);
    }

    .palette-item:hover:disabled {
        border-color: var(--line);
        color: var(--muted);
        background: rgba(255,255,255,.025);
        cursor: not-allowed;
    }

sdl-palette-panel[data-disabled="true"] {
    opacity: 0.6;
    pointer-events: none;
}

sdl-palette-panel[data-disabled="true"] .palette-item {
    cursor: not-allowed;
}

.palette-glyph {
    width: 19px;
    height: 19px;
    display: grid;
    place-items: center;
    font-size: 12px;
    border-radius: 4px;
    background: rgba(255,255,255,.08);
    color: var(--cyan);
}

.flow-node.selected {
    border-color: var(--cyan);
    box-shadow: 0 0 0 2px rgba(66,214,210,.16);
    background: rgba(66,214,210,.1);
}

.tree-icon .sdl-icon {
    width: 15px;
    height: 13px;
}

.palette-glyph {
    width: 24px;
    background: transparent;
}

.sdl-icon {
    width: 23px;
    height: 17px;
    display: block;
    overflow: visible;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: square;
    stroke-linejoin: miter;
}

/* SDL graphical symbols based on ITU-T Z.100. */
.state-card {
    border: 1px dashed rgba(122,223,154,.35);
    border-radius: 7px;
    background: rgba(10,30,49,.62);
    padding: 10px 12px 12px;
}

.state-title {
    /* The width of a flow column, like the first nodes of a lane (.state-lane > .flow-node). The title hangs from the
       middle of the connector that reaches the lanes (--title-axis, set by the card). */
    width: 210px;
    margin: -2px 0 0 calc(var(--title-axis, 105px) - 105px);
    padding: 8px 12px;
    border: 1.5px solid var(--green);
    border-radius: 999px;
    background: rgba(122,223,154,.08);
    text-align: center;
}

    .state-title small {
        color: rgba(122,223,154,.72);
    }

.flow-node {
    border-radius: 0;
    min-height: 38px;
    padding: 7px 10px;
    margin-bottom: 22px;
    border-width: 1.5px;
}

    .flow-node::after {
        bottom: -22px;
        height: 22px;
    }

.node-input {
    /* The clip-path has a stem under the node so that the connector (.flow-node::after) is not clipped. */
    clip-path: polygon(0 0,100% 0,100% 100%,calc(50% + 1px) 100%,calc(50% + 1px) calc(100% + 22px),calc(50% - 1px) calc(100% + 22px),calc(50% - 1px) 100%,0 100%,14% 50%);
    border-shape: polygon(0 0,100% 0,100% 100%,0 100%,14% 50%);
    padding-left: 34px;
    border-color: rgba(91,167,255,.88);
    background: rgba(91,167,255,.1);
}

.node-output {
    border-shape: polygon(0 0,84% 0,100% 50%,84% 100%,0 100%);
    clip-path: polygon(0 0,84% 0,100% 50%,84% 100%,calc(50% + 1px) 100%,calc(50% + 1px) calc(100% + 22px),calc(50% - 1px) calc(100% + 22px),calc(50% - 1px) 100%,0 100%);
    padding-right: 31px;
    border-color: rgba(247,189,97,.9);
    background: rgba(247,189,97,.09);
}

/* An output with parameters has a box hanging from its tip, with one line per parameter: its left side is a connector
   and it has no right border. The node is a grid of two columns: the text, and a track of no width that holds the box,
   pushed past the tip by its margin (31px of padding-right of the symbol and 24px of connector). The box is in the
   row of the text, so the symbol grows to the height of the box and the boxes of two outputs never overlap; both are
   centered vertically. The box is a child of the symbol, so the clip-path of the symbol is extended with the area to
   the right of the tip (a short strip for the connector, then the area of the box, which starts a little before it:
   its left border must not be clipped); the diagram leaves the room for it (OUTPUT_PARAMS_RESERVE in
   diagram-renderer.ts: 24px of connector and the 160px of the box, in the gap after the column of the output or after
   the flow). */
.node-output.output-has-params {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 0;
    align-items: center;
    clip-path: polygon(0 0,84% 0,100% 50%,calc(100% + 2px) calc(50% - 2px),calc(100% + 18px) calc(50% - 2px),calc(100% + 18px) 0,calc(100% + 424px) 0,calc(100% + 424px) 100%,calc(100% + 18px) 100%,calc(100% + 18px) calc(50% + 2px),calc(100% + 2px) calc(50% + 2px),100% 50%,84% 100%,calc(50% + 1px) 100%,calc(50% + 1px) calc(100% + 22px),calc(50% - 1px) calc(100% + 22px),calc(50% - 1px) 100%,0 100%);
}

.output-text {
    min-width: 0;
}

.output-params {
    position: relative;
    margin-left: 55px;
    box-sizing: border-box;
    width: 160px;
    padding: 5px 8px;
    border: 1.5px solid rgba(247,189,97,.9);
    border-right: none;
    background: rgba(247,189,97,.09);
    color: var(--text);
    font-size: 11px;
    line-height: 1.35;
    text-align: left;
}

    /* The connector from the tip of the symbol to the box. */
    .output-params::before {
        content: "";
        position: absolute;
        top: calc(50% - .75px);
        left: -25.5px;
        width: 24px;
        border-top: 1.5px solid rgba(247,189,97,.9);
    }

.output-param {
    display: block;
}

.flow-node.clickable:hover > .output-params,
.flow-node.selected > .output-params {
    border-color: var(--cyan);
}

    .flow-node.clickable:hover > .output-params::before,
    .flow-node.selected > .output-params::before {
        border-top-color: var(--cyan);
    }

/* The box is outside the border box of the node, so it does not get the background of a selected node. */
.flow-node.selected > .output-params {
    background: rgba(66,214,210,.1);
}

.node-task {
    border-color: rgba(184,151,255,.86);
}

.node-procedurecall {
    border-color: rgba(66,214,210,.9);
    padding-left: 17px;
    padding-right: 17px;
    background-image: linear-gradient(90deg,transparent 5px,rgba(66,214,210,.72) 5px,rgba(66,214,210,.72) 6px,transparent 6px,transparent calc(100% - 6px),rgba(66,214,210,.72) calc(100% - 6px),rgba(66,214,210,.72) calc(100% - 5px),transparent calc(100% - 5px));
}

.node-setstate {
    width: 84%;
    min-height: 40px;
    border-radius: 999px;
    padding: 8px 16px;
    border-color: rgba(122,223,154,.9);
    background: rgba(122,223,154,.1);
    text-align: center;
}

.node-decision {
    width: 180px;
    min-height: 86px;
    clip-path: polygon(50% 0,100% 50%,50% 100%,0 50%);
    border-shape: polygon(50% 0,100% 50%,50% 100%,0 50%);
    border-color: rgba(255,136,151,.92);
    padding: 23px 36px;
    background: rgba(255,136,151,.1);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

    .node-decision .kind {
        margin-bottom: 3px;
    }

.node-return {
    width: 52px;
    min-height: 52px;
    height: 52px;
    padding: 0;
    border-radius: 50%;
    border-color: rgba(247,189,97,.92);
    background: rgba(247,189,97,.08);
    font-size: 0;
    display: grid;
    place-items: center;
}

    /* Two diameters at 45 degrees: the corners of the box are cut by the circle, so the lines end on the circumference. */
    .node-return::before {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: 50%;
        background: linear-gradient(to top right,transparent calc(50% - .75px),rgba(247,189,97,.92) calc(50% - .75px),rgba(247,189,97,.92) calc(50% + .75px),transparent calc(50% + .75px)),linear-gradient(to bottom right,transparent calc(50% - .75px),rgba(247,189,97,.92) calc(50% - .75px),rgba(247,189,97,.92) calc(50% + .75px),transparent calc(50% + .75px));
    }

    .node-return .kind {
        display: none;
    }

.start-node {
    width: 116px;
    height: 48px;
    border-radius: 999px;
    border-width: 1.5px;
    margin-bottom: 24px;
}

/* The start of a procedure: a vertical line at each end of the pill (where its round ends begin) and a connector
   down to the first node of the body. */
.procedure-start {
    position: relative;
    width: 168px;
    height: 54px;
    margin-bottom: 22px;
    background-image: linear-gradient(90deg,transparent 26px,rgba(66,214,210,.72) 26px,rgba(66,214,210,.72) 27.5px,transparent 27.5px,transparent calc(100% - 27.5px),rgba(66,214,210,.72) calc(100% - 27.5px),rgba(66,214,210,.72) calc(100% - 26px),transparent calc(100% - 26px));
}

    .procedure-start::after {
        content: "";
        position: absolute;
        top: calc(100% + 1.5px);
        left: calc(50% - .75px);
        height: 22px;
        border-left: 1.5px solid var(--faint);
    }

    /* Selected, the next element of the palette goes first in the body. */
    .procedure-start.clickable {
        cursor: pointer;
    }

        .procedure-start.clickable:hover {
            background-color: rgba(66,214,210,.18);
        }

    .procedure-start.selected {
        background-color: rgba(66,214,210,.22);
        box-shadow: 0 0 0 3px rgba(66,214,210,.2);
    }

/* One lane per input of a state, side by side under its title. The connectors are lines: one from the title down to a
   horizontal one, and one from it to the first node of each lane. The axes are the variables the renderer sets. */
.state-lanes {
    position: relative;
    display: flex;
    gap: 36px;
    align-items: flex-start;
    width: max-content;
    padding-top: 26px;
}

    .state-lanes::before {
        content: "";
        position: absolute;
        top: 13px;
        left: var(--lane-first-axis, 105px);
        right: var(--lane-last-inset, 105px);
        border-top: 1.5px solid var(--faint);
    }

    .state-lanes::after {
        content: "";
        position: absolute;
        top: 0;
        height: 13px;
        left: calc(var(--title-axis, 105px) - .75px);
        border-left: 1.5px solid var(--faint);
    }

.state-lane {
    position: relative;
    flex: 0 0 auto;
    align-items: flex-start;
}

    .state-lane::before {
        content: "";
        position: absolute;
        top: -13px;
        height: 13px;
        left: calc(var(--lane-axis, 105px) - .75px);
        border-left: 1.5px solid var(--faint);
    }

    .state-lane > .flow-node {
        width: 210px;
    }

.decision-layout {
    width: max-content;
    min-width: 0;
    margin: 0 0 28px;
}

/* The renderer moves the layout (margin-left) so its rhombus is on the axis of the nodes of its flow. */
.flow-stack > .decision-layout {
    align-self: flex-start;
}

/* The rhombus spans every column, centered on --decision-anchor (midway between the axes of the first and the last
   branch). Every branch shares three rows (subgrid) with it: the rhombus, the branch labels and the flows.
   The connectors are drawn on the rhombus row at 50%, so they reach its vertices whatever its height (a condition that
   wraps makes it taller). */
.decision-branches {
    display: grid;
    grid-template-columns: repeat(var(--decision-columns, 2), 210px);
    grid-template-rows: auto auto auto;
    column-gap: var(--decision-gap, 18px);
    row-gap: 0;
    position: relative;
    align-items: start;
    --decision-half-width: 90px;
    --decision-label-gap: 18px;
}

/* A decision drawn inside a branch is smaller (see .decision-branch-flow .node-decision). */
.decision-branch-flow .decision-branches {
    --decision-half-width: 77px;
}

    /* From the left vertex of the rhombus to the axis of the first branch, and from the right vertex to the axis of the
       last one. An absolutely positioned child needs both lines of its grid area: with an 'auto' end it would reach the
       edge of the grid. */
    .decision-branches::before,
    .decision-branches::after {
        content: "";
        position: absolute;
        grid-row: 1 / 2;
        grid-column: 1 / -1;
        top: 50%;
        border-top: 1.5px solid rgba(255,136,151,.7);
    }

    .decision-branches::before {
        left: var(--decision-first-anchor, 105px);
        width: max(0px, calc(var(--decision-anchor, 219px) - var(--decision-half-width) - var(--decision-first-anchor, 105px)));
    }

    .decision-branches::after {
        left: calc(var(--decision-anchor, 219px) + var(--decision-half-width));
        right: var(--decision-last-inset, 105px);
    }

    /* The rhombus alone sets the height of the first row: no margin under it (also inside a branch, where the nodes
       of the flow have one). */
    .decision-branches > .flow-node.node-decision {
        grid-row: 1;
        grid-column: 1 / -1;
        margin-left: calc(var(--decision-anchor, 219px) - var(--decision-half-width));
        margin-right: 0;
        margin-bottom: 0;
    }

/* --branch-anchor is the axis of a branch: the center of the rhombus of the decision it holds, or of its column. */
.decision-branch {
    position: relative;
    min-width: 0;
    display: grid;
    grid-row: 1 / span 3;
    grid-template-rows: subgrid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    --branch-anchor: 105px;
}

    /* From the horizontal connector (or, for a branch under the rhombus, from its lower edge: --branch-top) down to the
       label of the branch. */
    .decision-branch::before {
        content: "";
        position: absolute;
        grid-row: 1 / 2;
        grid-column: 1 / 2;
        top: var(--branch-top, 50%);
        bottom: calc(-1 * var(--decision-label-gap));
        left: var(--branch-anchor);
        border-left: 1.5px solid rgba(255,136,151,.7);
    }

    /* Direct children only: the labels and flows of a nested decision belong to its own rows. */
    .decision-branches > .decision-branch > .decision-option {
        grid-row: 2;
        margin-top: var(--decision-label-gap);
    }

    .decision-branches > .decision-branch > .decision-branch-flow {
        grid-row: 3;
    }

.decision-option {
    display: block;
    margin: 0 0 11px var(--branch-anchor);
    transform: translateX(-50%);
    width: max-content;
    max-width: 100%;
    color: var(--rose);
    background: rgba(255,136,151,.1);
    border: 1px solid rgba(255,136,151,.35);
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    position: relative;
}

    /* From the label to the first node of its branch. */
    .decision-option::after {
        content: "";
        position: absolute;
        top: 100%;
        left: calc(50% - .75px);
        height: 11px;
        border-left: 1.5px solid var(--faint);
    }

.decision-branch-flow {
    width: 100%;
    align-items: stretch;
    /* How far the axis of the nodes before a nested decision is from the middle of the first column: they are on the
       axis of its rhombus (set by the renderer; 0 for a branch of one column). */
    --branch-lead: 0px;
}

    .decision-branch-flow .flow-node {
        margin-bottom: 22px;
    }

    /* A branch that ends in a nested decision spans several columns; its nodes stay one column (FLOW_COLUMN_WIDTH) wide. */
    .decision-branch-flow > .flow-node {
        max-width: 210px;
        margin-left: var(--branch-lead);
    }

    /* The symbols narrower than the column (they end a branch of one column) are centered on its axis. */
    .decision-branch-flow > .node-return,
    .decision-branch-flow > .node-setstate {
        margin-left: auto;
        margin-right: auto;
    }

    .decision-branch-flow .node-decision {
        width: 154px;
        min-height: 76px;
        align-self: center;
        padding: 20px 30px;
    }

.decision-empty {
    min-height: 52px;
    display: grid;
    place-items: center;
    color: var(--faint);
    border: 1px dashed rgba(255,136,151,.45);
    border-radius: 5px;
    padding: 8px;
    font-size: 10px;
    text-align: center;
}

.inspector {
    flex: 1 0 300px;
}

.inspector-form {
    padding: 4px 16px 18px;
}

    .inspector-form label, .dialog label {
        color: var(--muted);
        display: block;
        font-size: 11px;
        font-weight: 650;
        margin-top: 12px;
    }

        .inspector-form label small, .dialog small {
            color: var(--faint);
            font-weight: 500;
        }

    .inspector-form input, .inspector-form select, .inspector-form textarea, .dialog input, .dialog select {
        display: block;
        width: 100%;
        margin-top: 6px;
        background: rgba(3,13,25,.45);
        border: 1px solid var(--line);
        color: var(--text);
        border-radius: 6px;
        padding: 8px 9px;
        outline: none;
        font-size: 12px;
    }

    .inspector-form textarea {
        resize: vertical;
        min-height: 64px;
    }

        .inspector-form input:focus, .inspector-form select:focus, .inspector-form textarea:focus, .dialog input:focus, .dialog select:focus {
            border-color: var(--cyan);
        }

.form-section {
    color: var(--faint);
    font-size: 10px;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight: 800;
    border-top: 1px solid var(--line);
    padding-top: 14px;
    margin-top: 15px;
}

.attribute-note {
    color: var(--faint);
    font-size: 10px;
    padding-top: 11px;
}

.dcl-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.xml-preview {
    position: absolute;
    z-index: 5;
    top: 65px;
    left: 14px;
    right: 14px;
    bottom: 14px;
    overflow: auto;
    background: #071321;
}

    .xml-preview.hidden {
        display: none;
    }

    .xml-preview.xml-split {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
    }

.xml-pane {
    min-width: 0;
    min-height: 0;
    overflow: auto;
}

.xml-split > .xml-pane + .xml-pane {
    border-left: 1px solid var(--line);
}

.xml-empty {
    margin: 0;
    padding: 16px;
    color: var(--muted, #8fa7bd);
    font-size: 12px;
}

.xml-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}
.xml-heading-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

    .xml-heading strong {
        font-size: 12px;
    }

.xml-file > .xml-heading {
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,.03);
}

.xml-preview pre {
    margin: 0;
    overflow-wrap: anywhere;
    padding: 16px;
    color: #b9d9ee;
    font: 12px/1.55 "Cascadia Code", Consolas, monospace;
    white-space: pre-wrap;
}

/* The XML of the state that is shown in the diagram. */
.xml-highlight {
    background: none;
    color: #6d9eeb;
    font-weight: 700;
}

.dialog {
    color: var(--text);
    width: min(480px, calc(100vw - 30px));
    border: 1px solid var(--line-strong);
    background: #10263e;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 25px 70px rgba(0,0,0,.55);
}

    .dialog::backdrop {
        background: rgba(1,8,17,.7);
        backdrop-filter: blur(2px);
    }

    .dialog form {
        padding: 18px;
    }

.dialog-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.dialog h2 {
    font-size: 18px;
}

.declarations-dialog {
    width: min(640px, calc(100vw - 30px));
}

    .declarations-dialog textarea {
        display: block;
        box-sizing: border-box;
        width: 100%;
        margin-top: 6px;
        background: rgba(3,13,25,.45);
        border: 1px solid var(--line);
        color: var(--text);
        border-radius: 6px;
        padding: 8px 9px;
        outline: none;
        font: 12px/1.5 "Cascadia Code", Consolas, monospace;
        resize: vertical;
        overflow: auto;
        white-space: pre;
    }

        .declarations-dialog textarea:focus {
            border-color: var(--cyan);
        }

        .declarations-dialog textarea[aria-invalid="true"] {
            border-color: #ff7b7b;
        }

.dialog-errors {
    margin: 12px 0 0;
    padding: 8px 10px 8px 26px;
    border: 1px solid #ff7b7b;
    border-radius: 6px;
    background: rgba(255,123,123,.1);
    color: #ffb4b4;
    font-size: 12px;
    max-height: 140px;
    overflow-y: auto;
}

    .dialog-errors[hidden] {
        display: none;
    }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.check-row {
    display: flex !important;
    gap: 8px;
    align-items: center;
}

    .check-row input {
        width: auto !important;
        margin: 0 !important;
        accent-color: var(--cyan);
    }

menu {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0;
    margin: 20px 0 0;
}

.export-dialog {
    width: min(590px, calc(100vw - 30px));
}

.export-list {
    border: 1px solid var(--line);
    border-radius: 8px;
    max-height: 340px;
    overflow: auto;
}

.export-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}

    .export-item:last-child {
        border-bottom: 0;
    }

    .export-item strong {
        font-size: 12px;
    }

    .export-item small {
        display: block;
        margin-top: 3px;
        color: var(--faint);
        font-size: 10px;
    }

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    transform: translateY(15px);
    opacity: 0;
    pointer-events: none;
    background: #0b2639;
    border: 1px solid var(--cyan);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 7px;
    font-size: 12px;
    box-shadow: var(--shadow);
    transition: .22s ease;
}

    .toast.show {
        opacity: 1;
        transform: translateY(0);
    }

@media (max-width: 1120px) {
    body {
        min-width: 900px;
    }

    .workspace {
        --workspace-gap: 10px;
        --tree-default-width: 215px;
        --main-min-width: 440px;
        --rail-width: 275px;
    }

    .app-header {
        gap: 18px;
        padding: 0 16px;
    }

    .header-actions .secondary {
        display: none;
    }
}

/* Panel content styling */
.tree-content,
.diagram-content,
.palette-content,
.inspector-content {
    font-size: 12px;
    line-height: 1.6;
}

.tree-content ul {
    list-style-type: none;
    padding-left: 16px;
}

.tree-content li {
    padding: 4px 0;
    color: var(--text);
}

.tree-content strong {
    color: var(--cyan);
    font-weight: 600;
}

.diagram-content h4,
.inspector-content h3,
.palette-content h3 {
    color: var(--cyan);
    font-size: 13px;
    margin: 12px 0 8px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
}

.diagram-content ul,
.inspector-content ul {
    list-style-type: none;
    padding-left: 0;
}

.diagram-content li,
.inspector-content li {
    padding: 6px 0;
    color: var(--muted);
    font-size: 11px;
}

.inspector-content p {
    margin: 6px 0;
    color: var(--muted);
    font-size: 11px;
}

.inspector-content strong {
    color: var(--text);
    font-weight: 600;
}

sdl-breadcrumb-panel {
    display: block;
    min-height: 0;
}

sdl-breadcrumb-panel .breadcrumb-content {
    display: flex;
    gap: 7px;
    align-items: center;
    color: var(--muted);
    font-size: 12px;
    padding: 12px 0;
}

sdl-breadcrumb-panel .breadcrumb-content strong {
    color: var(--text);
    font-weight: 650;
}

sdl-breadcrumb-panel .breadcrumb-content .crumb-type {
    color: var(--cyan);
    background: rgba(66,214,210,.09);
    padding: 4px 7px;
    border-radius: 5px;
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 750;
    letter-spacing: .06em;
}

sdl-tree-panel {
    display: block;
    flex: 1;
    overflow: hidden;
    padding: 10px 7px 18px;
    min-height: 0;
}
/* Their content floats over the workspace (.xml-preview), so they take no row, and no gap, under the diagram. */
sdl-xml-preview-panel,
sdl-original-xml-panel {
    display: contents;
}