:root {
    --app-bg: #e9e9e9;
    --bar-bg: #f6f7f8;
    --panel-bg: #f1f3f4;
    --panel-bg-2: #eceff1;
    --surface: #ffffff;
    --line: #d0d0d0;
    --line-dark: #b9b9b9;
    --text: #202124;
    --muted: #666666;
    --blue: #29a9e8;
    --blue-dark: #008bd2;
    --orange: #f08b00;
    --danger-bg: #ffd9dc;
    --danger-text: #c5221f;
}

html,
body {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    min-height: 100%;
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

#app,
.app-shell {
    min-height: 100vh;
}

.studio-shell {
    background: var(--app-bg);
    color: var(--text);
    display: grid;
    grid-template-rows: 70px 42px minmax(0, 1fr);
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}

.app-header {
    align-items: center;
    background: #f8f9fa;
    border-bottom: 1px solid #d7d7d7;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    padding: 8px 10px 6px 14px;
}

.brand-block {
    align-items: flex-start;
    display: flex;
    gap: 12px;
}

.brand-mark {
    align-items: center;
    background: var(--orange);
    border-radius: 4px;
    color: #ffffff;
    display: flex;
    height: 36px;
    justify-content: center;
    margin-top: 1px;
    width: 32px;
}

.brand-mark .rzi,
.brand-mark .material-icons {
    font-size: 25px;
}

.brand-title {
    color: #202124;
    font-size: 18px;
    font-weight: 400;
    line-height: 22px;
}

.menu-row {
    align-items: center;
    display: flex;
    gap: 2px;
    margin-top: 5px;
}

.menu-item {
    position: relative;
}

.menu-row button {
    background: transparent;
    border: 0;
    border-radius: 2px;
    color: #2d2d2d;
    cursor: pointer;
    font-size: 14px;
    height: 24px;
    padding: 0 7px;
}

.menu-row button:hover {
    background: #e6e6e6;
}

.menu-row button.active {
    background: #dfe5ea;
}

.app-menu-dropdown {
    background: #ffffff;
    border: 1px solid #bcbcbc;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
    display: grid;
    left: 0;
    min-width: 178px;
    padding: 4px 0;
    position: absolute;
    top: 26px;
    z-index: 30;
}

.app-menu-dropdown button {
    align-items: center;
    border-radius: 0;
    display: flex;
    height: 28px;
    justify-content: flex-start;
    padding: 0 26px 0 12px;
    text-align: left;
    white-space: nowrap;
}

.app-menu-dropdown button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.app-menu-dropdown span {
    border-top: 1px solid #e0e0e0;
    display: block;
    height: 1px;
    margin: 4px 0;
}

.document-status {
    align-items: center;
    background: #fff7db;
    border: 1px solid #ebc766;
    border-radius: 999px;
    color: #7a5200;
    cursor: pointer;
    display: inline-flex;
    font-size: 12px;
    gap: 7px;
    margin-left: 8px;
    min-height: 24px;
    padding: 0 10px;
    white-space: nowrap;
}

.document-status.saved {
    background: #edf7ed;
    border-color: #b9ddb9;
    color: #256029;
}

.document-status.failed {
    background: var(--danger-bg);
    border-color: #f0a0a5;
    color: var(--danger-text);
}

.document-status .status-dot {
    background: currentColor;
    border-radius: 999px;
    height: 7px;
    width: 7px;
}

.share-button {
    align-items: center;
    background: #c6e7fb;
    border: 0;
    border-radius: 4px;
    color: #2d4b5f;
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 700;
    gap: 7px;
    height: 32px;
    padding: 0 13px;
}

.share-button:hover {
    background: #b4def6;
}

.document-chip {
    display: none;
}

.command-bar {
    align-items: center;
    background: #f3f4f5;
    border-bottom: 1px solid #d2d2d2;
    box-sizing: border-box;
    display: flex;
    height: 42px;
    overflow: visible;
    padding: 0 12px;
}

.tool-group {
    align-items: center;
    border-right: 1px solid #d8d8d8;
    display: flex;
    gap: 4px;
    height: 32px;
    margin-right: 10px;
    padding-right: 10px;
    position: relative;
}

.tool-group.spacer {
    border-left: 1px solid #d8d8d8;
    border-right: 0;
    margin-left: auto;
    margin-right: 0;
    padding-left: 10px;
    padding-right: 0;
}

.tool-group button,
.inspector-button {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    min-width: 30px;
    padding: 0 5px;
}

.tool-group-label {
    color: #667085;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
    margin-right: 2px;
    text-transform: uppercase;
}

.tool-group button:hover,
.inspector-button:hover,
.panel-icon-button:hover {
    background: #e7eaec;
    border-color: #c6c6c6;
}

.tool-group button:disabled {
    cursor: not-allowed;
    opacity: 0.35;
}

.tool-group button .rzi,
.tool-group button .material-icons {
    font-size: 19px;
}

.segmented {
    background: transparent;
    border-right: 1px solid #d8d8d8;
    border-radius: 0;
    gap: 3px;
    padding-right: 10px;
}

.segmented button.active,
.snap-toggle.active,
.tool-group button.active {
    background: #d9efff;
    border-color: #29a9e8;
    box-shadow: inset 0 -2px 0 #008bd2;
    color: #005a87;
}

.tool-group button.primary-tool {
    background: #e8f4fd;
    border-color: #a8d7f2;
    color: #075985;
}

.zoom-readout {
    border-radius: 2px;
    color: #4d4d4d;
    font-size: 14px;
    min-width: 42px;
    padding: 3px 4px;
    text-align: center;
}

.zoom-select {
    background: #ffffff;
    border: 1px solid #c7cdd3;
    border-radius: 4px;
    color: #344054;
    font-size: 12px;
    height: 28px;
    min-width: 66px;
    padding: 0 4px;
}

.tool-group [data-tooltip] {
    position: relative;
}

.tool-group [data-tooltip]::after {
    background: #1f2937;
    border-radius: 4px;
    bottom: -36px;
    box-shadow: 0 7px 20px rgba(15, 23, 42, 0.22);
    color: #ffffff;
    content: attr(data-tooltip);
    font-size: 12px;
    left: 50%;
    opacity: 0;
    padding: 5px 7px;
    pointer-events: none;
    position: absolute;
    transform: translate(-50%, -4px);
    transition: opacity 0.08s ease, transform 0.08s ease;
    white-space: nowrap;
    z-index: 80;
}

.tool-group [data-tooltip]:hover::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.workspace {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr) 230px;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.workspace.left-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 230px;
}

.workspace.right-collapsed {
    grid-template-columns: 230px minmax(0, 1fr) 0;
}

.workspace.left-collapsed.right-collapsed {
    grid-template-columns: 0 minmax(0, 1fr) 0;
}

.workspace.left-collapsed .palette,
.workspace.right-collapsed .inspector {
    display: none;
}

.panel {
    background: var(--panel-bg);
    height: 100%;
    min-height: 0;
    overflow: auto;
}

.palette {
    border-right: 1px solid var(--line);
    box-shadow: inset -1px 0 0 #ffffff;
    padding: 8px 8px 12px;
    z-index: 3;
}

.inspector {
    border-left: 1px solid var(--line);
    box-shadow: inset 1px 0 0 #ffffff;
    display: flex;
    flex-direction: column;
    padding: 0 8px 12px;
    z-index: 3;
}

.palette .panel-header {
    display: none;
}

.inspector .panel-header {
    display: none;
}

.panel-icon-button {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 2px;
    cursor: pointer;
    display: inline-flex;
    height: 24px;
    justify-content: center;
    width: 24px;
}

.panel-kicker {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.panel-title {
    font-size: 13px;
    font-weight: 700;
}

.palette-search {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d4d4d4;
    border-radius: 15px;
    box-sizing: border-box;
    color: #4d4d4d;
    display: flex;
    gap: 5px;
    height: 30px;
    margin: 0 0 9px;
    padding: 0 9px;
}

.palette-search input {
    background: transparent;
    border: 0;
    color: #333333;
    font-size: 13px;
    min-width: 0;
    outline: 0;
    width: 100%;
}

.palette-search .rzi,
.palette-search .material-icons {
    font-size: 18px;
}

.scratchpad-section,
.palette-section,
.property-section,
.style-preset-section {
    border-top: 1px solid #d7d7d7;
    padding: 12px 0;
}

.scratchpad-section {
    border-top: 0;
    padding-top: 5px;
}

.section-title {
    align-items: center;
    color: #3d3d3d;
    display: flex;
    font-size: 13px;
    font-weight: 700;
    gap: 4px;
    margin-bottom: 9px;
}

.section-title::before {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid #4b4b4b;
    content: "";
    height: 0;
    width: 0;
}

.scratchpad-drop {
    align-items: center;
    background: #f8f8f8;
    border: 2px dotted #909090;
    border-radius: 8px;
    color: #888888;
    display: flex;
    font-size: 12px;
    height: 29px;
    justify-content: center;
    margin: 0 1px;
}

.library-heading {
    align-items: center;
    background: transparent;
    border: 0;
    color: #333333;
    cursor: pointer;
    display: flex;
    font-size: 13px;
    font-weight: 700;
    gap: 5px;
    height: 24px;
    margin: 0 0 9px;
    padding: 0;
    text-align: left;
    width: 100%;
}

.recent-section {
    background: #f8fbfd;
    border-bottom: 1px solid #dce9f2;
    margin: 0 -3px;
    padding-left: 3px;
    padding-right: 3px;
}

.library-heading .rzi,
.library-heading .material-icons {
    font-size: 17px;
    margin-left: -3px;
}

.shape-grid {
    display: grid;
    gap: 9px 8px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.shape-tile {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    box-sizing: border-box;
    cursor: grab;
    display: flex;
    height: 42px;
    justify-content: center;
    padding: 3px;
    user-select: none;
}

.shape-tile:hover {
    background: #e4edf5;
    border-color: #9cc4df;
}

.shape-tile.active {
    background: #dff2ff;
    border-color: var(--blue);
}

.shape-tile:active {
    cursor: grabbing;
}

.shape-tile span:last-child {
    display: none;
}

.palette-icon {
    color: #4f5559;
    display: inline-block;
    height: 27px;
    position: relative;
    width: 36px;
}

.icon-rectangle,
.icon-card,
.icon-button,
.icon-rounded,
.icon-table,
.icon-note {
    border: 2px solid #4f5559;
}

.icon-rounded {
    border-radius: 5px;
}

.icon-card {
    box-shadow: inset 0 7px 0 #eef0f2;
}

.icon-button {
    background: #f7f7f7;
    border-radius: 999px;
    height: 18px;
    margin-top: 3px;
}

.icon-table {
    background:
        linear-gradient(#f1f1f1 0 7px, transparent 7px),
        linear-gradient(90deg, transparent 0 9px, #4f5559 9px 11px, transparent 11px 21px, #4f5559 21px 23px, transparent 23px),
        linear-gradient(transparent 0 14px, #4f5559 14px 16px, transparent 16px);
}

.icon-note {
    background: #ffffff;
}

.icon-note::after {
    border-color: #4f5559 #f1f3f4 #f1f3f4 #4f5559;
    border-style: solid;
    border-width: 0 0 8px 8px;
    content: "";
    position: absolute;
    right: -2px;
    top: -2px;
}

.icon-circle {
    border: 2px solid #4f5559;
    border-radius: 999px;
    width: 28px;
}

.icon-diamond {
    border: 2px solid #4f5559;
    height: 23px;
    transform: rotate(45deg) scale(0.72);
    width: 23px;
}

.icon-triangle,
.icon-merge,
.icon-isa {
    border: 2px solid #4f5559;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.icon-merge {
    transform: rotate(180deg);
}

.icon-pentagon,
.icon-off-page {
    border: 2px solid #4f5559;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
}

.icon-octagon {
    border: 2px solid #4f5559;
    clip-path: polygon(28% 0, 72% 0, 100% 28%, 100% 72%, 72% 100%, 28% 100%, 0 72%, 0 28%);
}

.icon-parallelogram {
    border: 2px solid #4f5559;
    transform: skewX(-14deg);
}

.icon-trapezoid,
.icon-manual-input,
.icon-loop-limit {
    border: 2px solid #4f5559;
    clip-path: polygon(12% 0, 88% 0, 100% 100%, 0 100%);
}

.icon-manual-input {
    clip-path: polygon(0 18%, 100% 0, 100% 100%, 0 100%);
}

.icon-hexagon {
    background: #ffffff;
    border: 2px solid #4f5559;
    clip-path: polygon(22% 0, 78% 0, 100% 50%, 78% 100%, 22% 100%, 0 50%);
}

.icon-cylinder {
    border: 2px solid #4f5559;
    border-radius: 50% / 16%;
}

.icon-document {
    border: 2px solid #4f5559;
    position: relative;
}

.icon-document::after {
    background: #ffffff;
    border-top: 2px solid #4f5559;
    bottom: -2px;
    content: "";
    height: 7px;
    left: -2px;
    position: absolute;
    right: -2px;
    transform: skewY(-4deg);
}

.icon-multi-document,
.icon-predefined-process,
.icon-internal-storage,
.icon-card-shape,
.icon-uml-class,
.icon-uml-interface,
.icon-uml-enum,
.icon-package,
.icon-component,
.icon-artifact,
.icon-node-cube,
.icon-frame,
.icon-constraint,
.icon-weak-entity,
.icon-associative-entity,
.icon-key-attribute,
.icon-derived-attribute,
.icon-multivalue-attribute,
.icon-composite-attribute,
.icon-view {
    border: 2px solid #4f5559;
}

.icon-multi-document {
    box-shadow: -4px 4px 0 -2px #f1f3f4, -4px 4px 0 0 #4f5559;
}

.icon-predefined-process::before,
.icon-predefined-process::after,
.icon-internal-storage::before,
.icon-internal-storage::after {
    background: #4f5559;
    content: "";
    position: absolute;
}

.icon-predefined-process::before,
.icon-predefined-process::after {
    bottom: 0;
    top: 0;
    width: 2px;
}

.icon-predefined-process::before {
    left: 6px;
}

.icon-predefined-process::after {
    right: 6px;
}

.icon-internal-storage::before {
    bottom: 0;
    left: 7px;
    top: 0;
    width: 2px;
}

.icon-internal-storage::after {
    height: 2px;
    left: 0;
    right: 0;
    top: 7px;
}

.icon-stored-data,
.icon-direct-data,
.icon-delay,
.icon-display,
.icon-summing,
.icon-or,
.icon-initial-state,
.icon-final-state,
.icon-boundary,
.icon-control,
.icon-entity,
.icon-category {
    border: 2px solid #4f5559;
}

.icon-stored-data {
    border-radius: 50% 4px 4px 50% / 50% 4px 4px 50%;
}

.icon-direct-data {
    border-radius: 50% / 16%;
}

.icon-delay {
    border-radius: 0 999px 999px 0;
}

.icon-display {
    clip-path: polygon(0 0, 82% 0, 100% 50%, 82% 100%, 0 100%);
}

.icon-sort {
    border: 2px solid #4f5559;
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.icon-sort::after,
.icon-collate::after {
    background: #4f5559;
    content: "";
    height: 2px;
    left: 3px;
    position: absolute;
    right: 3px;
    top: 50%;
}

.icon-collate {
    border: 2px solid #4f5559;
    clip-path: polygon(0 0, 100% 0, 50% 50%, 100% 100%, 0 100%, 50% 50%);
}

.icon-summing,
.icon-or,
.icon-initial-state,
.icon-final-state {
    border-radius: 999px;
}

.icon-initial-state {
    background: #4f5559;
}

.icon-final-state::after {
    background: #4f5559;
    border-radius: 999px;
    content: "";
    inset: 5px;
    position: absolute;
}

.icon-card-shape {
    clip-path: polygon(0 0, 100% 0, 100% 78%, 16% 78%, 16% 100%, 0 100%);
}

.icon-punched-tape {
    border-bottom: 2px solid #4f5559;
    border-top: 2px solid #4f5559;
    border-radius: 50% / 18%;
}

.icon-annotation {
    border-left: 2px solid #4f5559;
    border-top: 2px solid #4f5559;
}

.icon-uml-class,
.icon-uml-interface,
.icon-uml-enum {
    background:
        linear-gradient(transparent 0 8px, #4f5559 8px 10px, transparent 10px 16px, #4f5559 16px 18px, transparent 18px);
}

.icon-package::before {
    border: 2px solid #4f5559;
    border-bottom: 0;
    content: "";
    height: 7px;
    left: -2px;
    position: absolute;
    top: -9px;
    width: 16px;
}

.icon-component::before,
.icon-component::after {
    background: #f1f3f4;
    border: 2px solid #4f5559;
    content: "";
    height: 5px;
    left: -5px;
    position: absolute;
    width: 8px;
}

.icon-component::before {
    top: 4px;
}

.icon-component::after {
    bottom: 4px;
}

.icon-artifact::after {
    border-color: #4f5559 #f1f3f4 #f1f3f4 #4f5559;
    border-style: solid;
    border-width: 0 0 9px 9px;
    content: "";
    position: absolute;
    right: -2px;
    top: -2px;
}

.icon-node-cube {
    box-shadow: 5px -5px 0 -2px #f1f3f4, 5px -5px 0 0 #4f5559;
}

.icon-boundary {
    border-radius: 999px;
}

.icon-boundary::after {
    background: #4f5559;
    content: "";
    height: 2px;
    left: 70%;
    position: absolute;
    right: -8px;
    top: 50%;
}

.icon-control {
    border-radius: 999px;
}

.icon-entity,
.icon-category {
    border-radius: 999px 999px 6px 6px;
}

.icon-fork-join,
.icon-activation,
.icon-lifeline {
    background: #4f5559;
}

.icon-fork-join {
    height: 7px;
    margin-top: 8px;
}

.icon-activation {
    height: 23px;
    width: 9px;
}

.icon-lifeline {
    background: transparent;
    border: 2px solid #4f5559;
}

.icon-lifeline::after {
    border-left: 2px dashed #4f5559;
    bottom: -12px;
    content: "";
    left: 50%;
    position: absolute;
    top: 100%;
}

.icon-constraint,
.icon-derived-attribute {
    border-style: dashed;
}

.icon-weak-entity,
.icon-multivalue-attribute {
    box-shadow: inset 0 0 0 2px #f1f3f4, inset 0 0 0 4px #4f5559;
}

.icon-associative-entity::after,
.icon-double-diamond::after,
.icon-composite-attribute::after {
    border: 2px solid #4f5559;
    content: "";
    inset: 5px;
    position: absolute;
}

.icon-double-diamond {
    border: 2px solid #4f5559;
    height: 23px;
    transform: rotate(45deg) scale(0.72);
    width: 23px;
}

.icon-associative-entity::after {
    transform: rotate(45deg) scale(0.65);
}

.icon-double-diamond::after {
    inset: 4px;
}

.icon-key-attribute,
.icon-derived-attribute,
.icon-multivalue-attribute,
.icon-composite-attribute {
    border-radius: 999px;
}

.icon-key-attribute::after {
    background: #4f5559;
    bottom: 5px;
    content: "";
    height: 2px;
    left: 8px;
    position: absolute;
    right: 8px;
}

.icon-composite-attribute::after {
    border-radius: 999px;
}

.icon-cloud {
    border: 2px solid #4f5559;
    border-radius: 48% 52% 45% 55% / 55% 44% 56% 45%;
}

.icon-actor {
    position: relative;
}

.icon-actor::before {
    border: 2px solid #4f5559;
    border-radius: 999px;
    content: "";
    height: 11px;
    left: 10px;
    position: absolute;
    top: 0;
    width: 11px;
}

.icon-actor::after {
    background: #4f5559;
    box-shadow: -9px 15px 0 -1px #4f5559, 9px 15px 0 -1px #4f5559, -10px 7px 0 -1px #4f5559, 10px 7px 0 -1px #4f5559;
    content: "";
    height: 18px;
    left: 16px;
    position: absolute;
    top: 13px;
    width: 2px;
}

.icon-text::before {
    color: #4f5559;
    content: "Text";
    font-size: 7px;
    left: 8px;
    position: absolute;
    top: 9px;
}

.more-shapes-button {
    align-items: center;
    background: #bce6ff;
    border: 0;
    border-radius: 4px;
    color: #17445c;
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 700;
    gap: 4px;
    height: 30px;
    justify-content: center;
    margin: 8px 0 0 47px;
    padding: 0 12px;
}

.more-shapes-button:hover {
    background: #a9ddfa;
}

.canvas-area {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 32px;
    align-self: stretch;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.canvas-tabs {
    align-items: center;
    align-self: end;
    background: #f4f6f7;
    border-top: 1px solid #cfcfcf;
    box-sizing: border-box;
    display: flex;
    gap: 0;
    grid-column: 1;
    grid-row: 2;
    height: 32px;
    padding: 0 320px 0 12px;
    z-index: 1;
}

.canvas-tabs button {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-sizing: border-box;
    color: #333333;
    cursor: pointer;
    height: 31px;
    padding: 0 12px;
}

.canvas-tabs button.active {
    background: #e9f2ff;
    border-left: 1px solid #c9d7e8;
    border-right: 1px solid #c9d7e8;
    color: #0b57d0;
}

.canvas-tabs .tab-icon {
    font-size: 21px;
    min-width: 34px;
    padding: 0;
}

.canvas-tabs .tab-icon .rzi,
.canvas-tabs .tab-icon .material-icons {
    font-size: 19px;
}

.canvas-tabs span {
    color: #666666;
    font-size: 12px;
    margin-left: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.diagram-viewport {
    align-self: stretch;
    background: #ededed;
    box-sizing: border-box;
    grid-column: 1;
    grid-row: 1;
    height: 100%;
    min-height: 0;
    min-width: 0;
    overflow: auto;
    position: relative;
    scrollbar-color: #aeb7c2 #eef1f4;
    scrollbar-width: thin;
    width: 100%;
}

.diagram-viewport::-webkit-scrollbar {
    height: 13px;
    width: 13px;
}

.diagram-viewport::-webkit-scrollbar-track {
    background: #eef1f4;
    border-left: 1px solid #d3d7dc;
    border-top: 1px solid #d3d7dc;
}

.diagram-viewport::-webkit-scrollbar-thumb {
    background: #aeb7c2;
    border: 3px solid #eef1f4;
    border-radius: 999px;
}

.diagram-viewport::-webkit-scrollbar-thumb:hover {
    background: #8f9aa7;
}

.diagram-viewport.select-mode {
    cursor: default;
}

.diagram-viewport.pan-mode {
    cursor: grab;
}

.diagram-viewport.pan-mode:active {
    cursor: grabbing;
}

.diagram-viewport.connect-mode {
    cursor: crosshair;
}

.ruler {
    display: none;
}

.diagram-scroll-space {
    box-sizing: border-box;
    min-height: 100%;
    min-width: 100%;
    position: relative;
}

.diagram-world {
    background: transparent;
    left: 0;
    position: absolute;
    top: 0;
    transform-origin: 0 0;
}

.diagram-world::before {
    background-color: #ffffff;
    background-image:
        linear-gradient(#ececec 1px, transparent 1px),
        linear-gradient(90deg, #ececec 1px, transparent 1px),
        linear-gradient(#d9d9d9 1px, transparent 1px),
        linear-gradient(90deg, #d9d9d9 1px, transparent 1px);
    background-position: 0 0;
    background-size:
        var(--grid-size) var(--grid-size),
        var(--grid-size) var(--grid-size),
        calc(var(--grid-size) * 5) calc(var(--grid-size) * 5),
        calc(var(--grid-size) * 5) calc(var(--grid-size) * 5);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.22);
    content: "";
    height: var(--page-height, 1120px);
    left: var(--page-x, 290px);
    position: absolute;
    top: var(--page-y, 0);
    width: var(--page-width, 860px);
    z-index: 0;
}

.diagram-world.grid-disabled::before {
    background-image: none;
}

.connector-layer,
.node-layer {
    inset: 0;
    position: absolute;
}

.connector-layer {
    overflow: visible;
    pointer-events: none;
    z-index: 1;
}

.node-layer {
    pointer-events: none;
    z-index: 2;
}

.node-layer .diagram-node {
    pointer-events: all;
}

.connector-layer foreignObject,
.connector-label {
    pointer-events: all;
}

.connector-hit {
    fill: none;
    pointer-events: stroke;
    stroke: transparent;
    stroke-linecap: square;
    stroke-linejoin: miter;
    stroke-width: 12;
}

.connector-path {
    filter: none;
    pointer-events: none;
    stroke-linecap: square;
    stroke-linejoin: miter;
}

.connector-path.selected {
    filter: url(#connector-shadow);
    stroke: #0f172a;
    stroke-width: 2;
}

.connector-preview {
    pointer-events: none;
    stroke: var(--blue);
    stroke-dasharray: 7 5;
    stroke-linecap: square;
    stroke-linejoin: miter;
    stroke-width: 1.5;
}

.connection-anchor,
.waypoint-handle {
    fill: #ffffff;
    pointer-events: all;
    stroke: var(--blue);
    stroke-width: 2;
}

.waypoint-handle {
    cursor: move;
    filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.18));
}

.connector-label {
    background: #ffffff;
    border: 1px solid #c8c8c8;
    color: #111111;
    display: inline-block;
    font-size: 12px;
    padding: 2px 5px;
    white-space: nowrap;
}

.editable-label {
    cursor: text;
    user-select: text;
}

.editable-label[contenteditable],
.editable-label[contenteditable]:focus {
    outline: none;
}

.diagram-node {
    box-sizing: border-box;
    cursor: move;
    position: absolute;
}

.diagram-node:not(.selected):hover::after {
    border: 1px solid rgba(41, 169, 232, 0.36);
    border-radius: 2px;
    content: "";
    inset: -3px;
    pointer-events: none;
    position: absolute;
}

.diagram-node.selected {
    z-index: 999 !important;
}

.selection-frame {
    border: 1.5px solid #008bd2;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(41, 169, 232, 0.32), 0 0 0 5px rgba(41, 169, 232, 0.08);
    inset: -3px;
    pointer-events: none;
    position: absolute;
}

.shape-content,
.html-card,
.html-textbox,
.html-button,
.html-table,
.unknown-node {
    box-sizing: border-box;
    height: 100%;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.shape-content,
.html-card,
.html-textbox,
.html-table {
    box-shadow: none;
}

.shape-diamond {
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.shape-triangle {
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.shape-pentagon,
.shape-off-page-connector {
    clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
}

.shape-octagon {
    clip-path: polygon(28% 0, 72% 0, 100% 28%, 100% 72%, 72% 100%, 28% 100%, 0 72%, 0 28%);
}

.shape-parallelogram {
    clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
}

.shape-trapezoid,
.shape-manual-operation,
.shape-loop-limit {
    clip-path: polygon(12% 0, 88% 0, 100% 100%, 0 100%);
}

.shape-manual-input {
    clip-path: polygon(0 18%, 100% 0, 100% 100%, 0 100%);
}

.shape-hexagon {
    clip-path: polygon(22% 0, 78% 0, 100% 50%, 78% 100%, 22% 100%, 0 50%);
}

.shape-multi-document {
    box-shadow: -8px 8px 0 -2px #ffffff, -8px 8px 0 -1px currentColor, -4px 4px 0 -2px #ffffff, -4px 4px 0 -1px currentColor;
}

.shape-predefined-process::before,
.shape-predefined-process::after,
.shape-internal-storage::before,
.shape-internal-storage::after {
    background: currentColor;
    content: "";
    position: absolute;
    z-index: 2;
}

.shape-predefined-process::before,
.shape-predefined-process::after {
    bottom: 0;
    top: 0;
    width: 1px;
}

.shape-predefined-process::before {
    left: 14px;
}

.shape-predefined-process::after {
    right: 14px;
}

.shape-internal-storage::before {
    bottom: 0;
    left: 24px;
    top: 0;
    width: 1px;
}

.shape-internal-storage::after {
    height: 1px;
    left: 0;
    right: 0;
    top: 24px;
}

.shape-stored-data {
    border-radius: 50% 4px 4px 50% / 50% 4px 4px 50% !important;
}

.shape-direct-data {
    border-radius: 50% / 14% !important;
}

.shape-display {
    clip-path: polygon(0 0, 84% 0, 100% 50%, 84% 100%, 0 100%);
}

.shape-delay {
    border-radius: 0 999px 999px 0 !important;
}

.shape-merge {
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.shape-sort {
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.shape-sort::after,
.shape-collate::after {
    background: currentColor;
    content: "";
    height: 1px;
    left: 10%;
    position: absolute;
    right: 10%;
    top: 50%;
    z-index: 2;
}

.shape-collate {
    clip-path: polygon(0 0, 100% 0, 50% 50%, 100% 100%, 0 100%, 50% 50%);
}

.shape-summing-junction,
.shape-or,
.shape-initial-state,
.shape-final-state,
.shape-attribute,
.shape-key-attribute,
.shape-derived-attribute,
.shape-multivalued-attribute {
    border-radius: 999px !important;
}

.shape-summing-junction .node-label,
.shape-or .node-label {
    font-size: 26px;
    padding: 0;
}

.shape-card-shape {
    clip-path: polygon(0 0, 100% 0, 100% 78%, 16% 78%, 16% 100%, 0 100%);
}

.shape-punched-tape {
    border-radius: 50% / 18% !important;
}

.shape-annotation {
    background: transparent !important;
    border-bottom-color: transparent !important;
    border-right-color: transparent !important;
}

.shape-package::before {
    background: inherit;
    border: inherit;
    border-bottom: 0;
    content: "";
    height: 24px;
    left: -1px;
    position: absolute;
    top: -24px;
    width: 72px;
}

.shape-component::before,
.shape-component::after {
    background: inherit;
    border: inherit;
    content: "";
    height: 18px;
    left: -12px;
    position: absolute;
    width: 28px;
    z-index: 2;
}

.shape-component::before {
    top: 18px;
}

.shape-component::after {
    top: 48px;
}

.shape-artifact::after {
    border-color: currentColor #ffffff #ffffff currentColor;
    border-style: solid;
    border-width: 0 0 22px 22px;
    content: "";
    position: absolute;
    right: -1px;
    top: -1px;
}

.shape-node-cube {
    box-shadow: 10px -10px 0 -1px #ffffff, 10px -10px 0 0 currentColor;
}

.shape-use-case {
    border-radius: 999px / 60% !important;
}

.shape-boundary {
    border-radius: 999px !important;
}

.shape-boundary::after {
    background: currentColor;
    content: "";
    height: 1px;
    left: 72%;
    position: absolute;
    right: -24px;
    top: 50%;
}

.shape-control {
    border-radius: 999px !important;
}

.shape-control::after {
    border-right: 2px solid currentColor;
    border-top: 2px solid currentColor;
    content: "";
    height: 12px;
    position: absolute;
    right: 18%;
    top: 18%;
    transform: rotate(24deg);
    width: 12px;
}

.shape-uml-entity,
.shape-category {
    border-radius: 999px 999px 8px 8px !important;
}

.shape-initial-state {
    background: #111111 !important;
    border-color: #111111 !important;
}

.shape-final-state::after {
    background: #111111;
    border-radius: 999px;
    content: "";
    inset: 13px;
    position: absolute;
}

.shape-fork-join {
    background: #111111 !important;
    border-color: #111111 !important;
    border-radius: 0 !important;
}

.shape-lifeline {
    overflow: visible;
}

.shape-lifeline::after {
    border-left: 1px dashed currentColor;
    bottom: -160px;
    content: "";
    left: 50%;
    position: absolute;
    top: 100%;
}

.shape-activation {
    border-radius: 0 !important;
}

.shape-frame::before {
    background: #ffffff;
    border-bottom: 1px solid currentColor;
    border-right: 1px solid currentColor;
    content: "";
    height: 24px;
    left: 0;
    position: absolute;
    top: 0;
    width: 74px;
}

.shape-constraint,
.shape-derived-attribute {
    border-style: dashed !important;
}

.shape-weak-entity::before,
.shape-multivalued-attribute::before,
.shape-double-diamond::before {
    border: inherit;
    content: "";
    inset: 6px;
    position: absolute;
}

.shape-associative-entity::before {
    border: inherit;
    content: "";
    inset: 22%;
    position: absolute;
    transform: rotate(45deg);
}

.shape-double-diamond {
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.shape-double-diamond::before {
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.shape-key-attribute .node-label {
    text-decoration: underline;
}

.shape-document {
    position: relative;
}

.shape-document::after {
    background: rgba(255, 255, 255, 0.85);
    border-top: inherit;
    bottom: -1px;
    content: "";
    height: 16px;
    left: -1px;
    position: absolute;
    right: -1px;
    transform: skewY(-4deg);
    transform-origin: left bottom;
}

.shape-cylinder {
    position: relative;
}

.shape-cylinder::before {
    border: inherit;
    border-bottom: 0;
    border-radius: 50%;
    content: "";
    height: 22px;
    left: -1px;
    position: absolute;
    right: -1px;
    top: -1px;
}

.shape-cylinder::after {
    border: inherit;
    border-top: 0;
    border-radius: 50%;
    bottom: -1px;
    content: "";
    height: 22px;
    left: -1px;
    position: absolute;
    right: -1px;
}

.shape-actor {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none;
    position: relative;
}

.shape-actor::before {
    background: var(--surface);
    border: 2px solid currentColor;
    border-radius: 999px;
    content: "";
    height: 28px;
    left: calc(50% - 15px);
    position: absolute;
    top: 8px;
    width: 28px;
}

.shape-actor::after {
    background: currentColor;
    box-shadow:
        -24px 31px 0 -1px currentColor,
        24px 31px 0 -1px currentColor,
        -22px 70px 0 -1px currentColor,
        22px 70px 0 -1px currentColor;
    content: "";
    height: 64px;
    left: calc(50% - 1px);
    position: absolute;
    top: 38px;
    width: 2px;
}

.node-label,
.html-textbox,
.html-button {
    align-items: center;
    display: flex;
    height: 100%;
    justify-content: center;
    line-height: 1.25;
    padding: 8px;
    text-align: center;
    white-space: pre-wrap;
}

.shape-document .node-label,
.shape-cylinder .node-label {
    position: relative;
    z-index: 1;
}

.shape-diamond .node-label {
    padding: 23px;
}

.shape-actor .node-label {
    bottom: 0;
    height: auto;
    left: 0;
    padding: 0;
    position: absolute;
    right: 0;
}

.shape-note {
    position: relative;
}

.shape-note::after {
    border-color: #d97706 #ffffff #ffffff #d97706;
    border-style: solid;
    border-width: 0 0 22px 22px;
    content: "";
    position: absolute;
    right: -1px;
    top: -1px;
}

.html-card {
    display: grid;
    grid-template-rows: 28px minmax(0, 1fr);
    padding: 7px;
}

.html-table {
    display: grid;
    grid-template-rows: 26px minmax(0, 1fr);
    overflow: hidden;
}

.uml-compartment {
    display: grid;
    grid-template-rows: auto minmax(28px, auto) minmax(28px, 1fr);
    overflow: hidden;
}

.uml-title {
    align-items: center;
    border-bottom: 1px solid #111111;
    display: grid;
    justify-items: center;
    min-height: 30px;
    padding: 3px 8px;
}

.uml-title small {
    font-size: 11px;
    line-height: 1.1;
}

.uml-title strong {
    font-size: 13px;
}

.uml-section {
    border-bottom: 1px solid #111111;
    font-size: 12px;
    line-height: 1.35;
    min-height: 26px;
    padding: 5px 8px;
}

.uml-section:last-child {
    border-bottom: 0;
}

.table-title {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid #111111;
    display: flex;
    font-size: 13px;
    font-weight: 700;
    justify-content: center;
    padding: 0 8px;
}

.html-table table {
    border-collapse: collapse;
    font-size: 12px;
    height: 100%;
    width: 100%;
}

.html-table th,
.html-table td {
    border-bottom: 1px solid #111111;
    border-right: 1px solid #111111;
    overflow: hidden;
    padding: 4px 6px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.html-table th {
    background: #ffffff;
    color: #111111;
    font-weight: 700;
}

.card-title {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-body {
    color: #444444;
    font-size: 12px;
    line-height: 1.35;
    overflow: hidden;
}

.html-button {
    box-shadow: none;
    font-weight: 700;
}

.node-port {
    background: var(--blue);
    border: 1px solid #ffffff;
    border-radius: 999px;
    box-shadow: 0 0 0 1px var(--blue);
    cursor: crosshair;
    height: 10px;
    opacity: 0;
    padding: 0;
    position: absolute;
    transform: scale(0.82);
    transition: opacity 0.08s ease, transform 0.08s ease, box-shadow 0.08s ease;
    width: 10px;
}

.diagram-node:hover .node-port,
.diagram-node.selected .node-port,
.diagram-node.ports-visible .node-port {
    opacity: 1;
    transform: scale(1);
}

.node-port:hover {
    background: #ffffff;
    box-shadow: 0 0 0 2px var(--blue), 0 0 0 7px rgba(41, 169, 232, 0.18);
}

.node-port.snap-target {
    background: #ffffff;
    box-shadow: 0 0 0 2px var(--blue), 0 0 0 9px rgba(41, 169, 232, 0.24);
    opacity: 1;
    transform: scale(1.18);
}

.resize-handle {
    background: var(--blue);
    border: 1px solid #ffffff;
    border-radius: 999px;
    box-shadow: 0 0 0 1px var(--blue);
    height: 10px;
    padding: 0;
    position: absolute;
    width: 10px;
    z-index: 5;
}

.resize-n,
.resize-s {
    cursor: ns-resize;
    left: calc(50% - 4px);
}

.resize-e,
.resize-w {
    cursor: ew-resize;
    top: calc(50% - 4px);
}

.resize-ne,
.resize-sw {
    cursor: nesw-resize;
}

.resize-nw,
.resize-se {
    cursor: nwse-resize;
}

.resize-n {
    top: -5px;
}

.resize-ne {
    right: -5px;
    top: -5px;
}

.resize-e {
    right: -5px;
}

.resize-se {
    bottom: -5px;
    right: -5px;
}

.resize-s {
    bottom: -5px;
}

.resize-sw {
    bottom: -5px;
    left: -5px;
}

.resize-w {
    left: -5px;
}

.resize-nw {
    left: -5px;
    top: -5px;
}

.inspector-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 0 -8px 9px;
}

.inspector-tabs button {
    background: #e7e7e7;
    border: 0;
    border-bottom: 1px solid #d0d0d0;
    border-left: 1px solid #d0d0d0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    height: 36px;
}

.inspector-tabs button:first-child {
    border-left: 0;
}

.inspector-tabs button.active {
    background: var(--panel-bg);
    border-bottom-color: var(--panel-bg);
}

.style-preset-section {
    order: 1;
    padding-bottom: 12px;
}

.style-preset-section .swatches {
    grid-template-columns: repeat(4, 1fr);
    margin: 4px 20px 7px;
}

.preset-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.preset-dots span {
    border: 1px solid #bdbdbd;
    border-radius: 999px;
    height: 6px;
    width: 6px;
}

.preset-dots span.active {
    background: #9bd4f3;
    border-color: #75b9dc;
}

.document-section {
    display: none;
}

.appearance-section {
    order: 2;
}

.text-section {
    order: 3;
}

.geometry-section {
    order: 4;
}

.arrange-section {
    order: 5;
}

.inspector .property-section {
    background: #f8fafc;
    border: 1px solid #d7dee5;
    border-radius: 4px;
    margin-bottom: 8px;
    padding: 10px 9px;
}

.inspector .section-title {
    border-bottom: 1px solid #e3e8ee;
    color: #23313d;
    font-size: 12px;
    margin: -2px 0 9px;
    padding-bottom: 7px;
}

.inspector label {
    color: #333333;
    display: grid;
    font-size: 12px;
    gap: 4px;
    margin-bottom: 8px;
}

.inspector input,
.inspector select,
.inspector textarea {
    background: #ffffff;
    border: 1px solid #d2d2d2;
    border-radius: 3px;
    box-sizing: border-box;
    min-width: 0;
    padding: 4px 6px;
    width: 100%;
}

.inspector input[type="checkbox"] {
    height: 14px;
    padding: 0;
    width: 14px;
}

.field-grid,
.meta-grid,
.button-grid {
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.button-grid button,
.router-picker button {
    background: #ffffff;
    border: 1px solid #ccd5dd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    height: 25px;
}

.button-grid button:hover,
.router-picker button:hover {
    background: #edf7ff;
    border-color: #9ed0ee;
}

.router-picker {
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 9px;
}

.router-picker button.active {
    background: #e0f2fe;
    border-color: #45aee8;
    color: #075985;
    font-weight: 700;
}

.meta-grid {
    align-items: center;
    font-size: 12px;
    grid-template-columns: 52px minmax(0, 1fr);
}

.meta-grid span {
    color: var(--muted);
}

.meta-grid strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.swatches {
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 9px;
}

.swatches button {
    border: 1px solid #777777;
    border-radius: 2px;
    cursor: pointer;
    height: 24px;
}

.swatches button:hover {
    box-shadow: 0 0 0 2px rgba(41, 169, 232, 0.18);
}

.empty-selection {
    color: #666666;
    font-size: 13px;
    margin-top: 15px;
    text-align: center;
}

.status-bar {
    align-items: center;
    align-self: end;
    background: #f4f6f7;
    border-top: 1px solid #cfcfcf;
    box-sizing: border-box;
    color: #5f6368;
    display: flex;
    font-size: 12px;
    gap: 14px;
    grid-column: 1;
    grid-row: 2;
    height: 32px;
    justify-self: end;
    min-width: 0;
    padding: 0 14px;
    position: relative;
    z-index: 2;
}

.status-bar span {
    white-space: nowrap;
}

.minimap {
    display: none;
}

.minimap.open {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #b9c0c7;
    bottom: 46px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
    display: block;
    height: 144px;
    overflow: hidden;
    position: absolute;
    right: 18px;
    width: 190px;
    z-index: 8;
}

.minimap-title {
    background: #eef1f4;
    border-bottom: 1px solid #d3d7db;
    color: #3b3b3b;
    font-size: 12px;
    font-weight: 700;
    height: 22px;
    line-height: 22px;
    padding: 0 8px;
}

.minimap-node {
    background: rgba(41, 169, 232, 0.28);
    border: 1px solid #1687bf;
    box-sizing: border-box;
    position: absolute;
}

.context-command-menu {
    background: #fbfdff;
    border: 1px solid #c7d8e6;
    border-radius: 7px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.19), 0 2px 8px rgba(15, 23, 42, 0.12);
    box-sizing: border-box;
    color: #1f2933;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    max-height: min(470px, calc(100vh - 16px));
    overflow: hidden;
    position: fixed;
    width: min(368px, calc(100vw - 16px));
    z-index: 40;
}

.context-command-menu header {
    align-items: center;
    background: linear-gradient(180deg, #ffffff 0%, #eff8ff 100%);
    border-bottom: 1px solid #d4e6f3;
    display: flex;
    gap: 10px;
    height: 34px;
    justify-content: space-between;
    padding: 0 11px;
}

.context-command-menu header strong {
    color: #18384f;
    font-size: 13px;
    letter-spacing: 0;
}

.context-command-menu header span {
    background: #e8f4fd;
    border: 1px solid #c7e2f5;
    border-radius: 999px;
    color: #47677d;
    font-size: 12px;
    line-height: 20px;
    max-width: 150px;
    overflow: hidden;
    padding: 0 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.command-search {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid #dce8f1;
    display: flex;
    gap: 7px;
    height: 38px;
    padding: 0 10px;
}

.command-search .rzi,
.command-search .material-icons {
    color: #5e7d94;
    font-size: 18px;
}

.command-search input {
    background: #f8fbfd;
    border: 1px solid #cfdde8;
    border-radius: 5px;
    color: #20313d;
    font-size: 13px;
    height: 27px;
    min-width: 0;
    outline: 0;
    padding: 0 8px;
    width: 100%;
}

.command-search input:focus {
    background: #ffffff;
    border-color: #68b8ea;
    box-shadow: 0 0 0 2px rgba(41, 169, 232, 0.14);
}

.context-tree {
    min-height: 0;
    overflow: auto;
    padding: 5px;
    scrollbar-color: #b9d7ec transparent;
    scrollbar-width: thin;
}

.context-tree-branch {
    border: 1px solid transparent;
    border-radius: 6px;
    margin-bottom: 3px;
    overflow: hidden;
}

.context-tree-branch:last-child {
    margin-bottom: 0;
}

.context-tree-branch.shape-functions {
    background: #f3faff;
    border-color: #b9daf2;
    box-shadow: inset 3px 0 0 #2aa9e8;
}

.context-tree-branch summary,
.context-tree-subbranch summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 7px;
    list-style: none;
    min-height: 29px;
    padding: 0 9px;
    user-select: none;
}

.context-tree-branch summary::-webkit-details-marker,
.context-tree-subbranch summary::-webkit-details-marker {
    display: none;
}

.context-tree-branch summary::before,
.context-tree-subbranch summary::before {
    border-bottom: 4px solid transparent;
    border-left: 5px solid #6b879b;
    border-top: 4px solid transparent;
    content: "";
    display: inline-block;
    height: 0;
    margin-right: 1px;
    width: 0;
}

.context-tree-branch[open] > summary::before,
.context-tree-subbranch[open] > summary::before {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #2f6f95;
    transform: translateY(2px);
}

.context-tree-branch > summary {
    background: #ffffff;
    color: #243642;
    font-size: 13px;
    font-weight: 700;
}

.context-tree-branch[open] > summary {
    background: #f7fbfe;
}

.context-tree-branch > summary:hover,
.context-tree-subbranch > summary:hover {
    background: #eaf6fe;
}

.context-tree-subbranch {
    border-left: 1px solid #d7e7f2;
    margin: 2px 0 3px 19px;
}

.context-tree-subbranch summary {
    color: #3d596d;
    font-size: 12px;
    font-weight: 700;
    min-height: 25px;
    padding-left: 7px;
}

.context-tree-items {
    display: grid;
    gap: 1px;
    padding: 2px 6px 7px 30px;
}

.shape-purpose {
    background: rgba(255, 255, 255, 0.74);
    border-left: 2px solid #b8dff8;
    color: #496273;
    font-size: 12px;
    line-height: 1.35;
    margin: 0 10px 5px 36px;
    padding: 5px 7px;
}

.context-tree-subbranch > button,
.context-tree-items > button {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: #24313a;
    cursor: pointer;
    display: flex;
    font-size: 12px;
    gap: 7px;
    justify-content: flex-start;
    min-height: 26px;
    min-width: 0;
    padding: 0 8px;
    text-align: left;
    white-space: nowrap;
}

.command-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.command-shortcut {
    color: #748797;
    flex: 0 0 auto;
    font-size: 11px;
    margin-left: 12px;
}

.context-tree-subbranch > button {
    margin-left: 27px;
    width: calc(100% - 33px);
}

.context-tree-subbranch > button:hover,
.context-tree-items > button:hover {
    background: #eaf6ff;
    border-color: #acd8f2;
    color: #0d4f76;
}

.context-tree-subbranch > button.active,
.context-tree-items > button.active {
    background: #d8efff;
    border-color: #48afe9;
    color: #064d76;
    font-weight: 700;
}

.context-tree-subbranch > button:disabled,
.context-tree-items > button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.context-tree-branch summary .rzi,
.context-tree-branch summary .material-icons,
.context-tree-subbranch > button .rzi,
.context-tree-subbranch > button .material-icons,
.context-tree-items > button .rzi,
.context-tree-items > button .material-icons {
    color: #2d7ea8;
    font-size: 17px;
    width: 18px;
}

.context-tree-subbranch > button:hover .rzi,
.context-tree-subbranch > button:hover .material-icons,
.context-tree-items > button:hover .rzi,
.context-tree-items > button:hover .material-icons {
    color: #0b6799;
}

.modal-backdrop {
    background: rgba(0, 0, 0, 0.28);
    inset: 0;
    position: fixed;
    z-index: 20;
}

.shape-library-dialog {
    background: #f6f6f6;
    border: 1px solid #a9a9a9;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.24);
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    height: min(700px, calc(100vh - 80px));
    left: 50%;
    overflow: hidden;
    position: fixed;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(960px, calc(100vw - 80px));
    z-index: 21;
}

.shape-library-dialog header,
.shape-library-dialog footer {
    align-items: center;
    display: flex;
    justify-content: space-between;
    padding: 12px 14px;
}

.shape-library-dialog h2 {
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    margin: 3px 0 0;
}

.library-tabs {
    background: #e7e7e7;
    border-bottom: 1px solid #d0d0d0;
    border-top: 1px solid #d0d0d0;
    display: flex;
}

.library-tabs button {
    background: transparent;
    border: 0;
    border-right: 1px solid #d0d0d0;
    cursor: pointer;
    height: 32px;
    padding: 0 14px;
}

.library-tabs button.active {
    background: #ffffff;
}

.library-content {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    min-height: 0;
}

.library-content aside {
    background: #efefef;
    border-right: 1px solid #d0d0d0;
    overflow: auto;
    padding: 10px 12px;
}

.library-content label {
    align-items: center;
    display: flex;
    gap: 7px;
    height: 31px;
}

.library-shape-browser {
    align-content: start;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    overflow: auto;
    padding: 12px;
}

.library-shape-card {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    cursor: pointer;
    display: grid;
    gap: 5px;
    justify-items: center;
    min-height: 96px;
    padding: 9px;
}

.library-shape-card:hover,
.library-shape-card.active {
    background: #edf7ff;
    border-color: var(--blue);
}

.library-shape-card small {
    color: #666666;
}

.shape-library-dialog footer {
    background: #eeeeee;
    border-top: 1px solid #d0d0d0;
}

.shape-library-dialog footer button {
    background: #e5e5e5;
    border: 1px solid #bdbdbd;
    border-radius: 3px;
    color: #222222;
    cursor: pointer;
    height: 30px;
    padding: 0 18px;
}

.info-dialog {
    background: #f8f9fa;
    border: 1px solid #a9a9a9;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.24);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    left: 50%;
    max-height: min(560px, calc(100vh - 90px));
    overflow: hidden;
    position: fixed;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 60px));
    z-index: 21;
}

.info-dialog header,
.info-dialog footer {
    align-items: center;
    display: flex;
    justify-content: space-between;
    padding: 12px 14px;
}

.info-dialog header {
    background: #ffffff;
    border-bottom: 1px solid #d0d0d0;
}

.info-dialog h2 {
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    margin: 3px 0 0;
}

.info-dialog-body,
.validation-list {
    overflow: auto;
    padding: 14px 16px;
}

.info-dialog-body p {
    color: #333333;
    font-size: 13px;
    line-height: 1.45;
    margin: 0 0 10px;
}

.info-dialog footer {
    background: #eeeeee;
    border-top: 1px solid #d0d0d0;
    justify-content: flex-end;
}

.info-dialog footer button {
    background: #e5e5e5;
    border: 1px solid #bdbdbd;
    border-radius: 3px;
    color: #222222;
    cursor: pointer;
    height: 30px;
    padding: 0 18px;
}

.validation-list {
    display: grid;
    gap: 8px;
}

.validation-item {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d9d9d9;
    display: flex;
    font-size: 13px;
    gap: 9px;
    min-height: 34px;
    padding: 7px 9px;
}

.validation-item .rzi,
.validation-item .material-icons {
    font-size: 18px;
}

.validation-item.success {
    border-color: #9fd3ac;
    color: #176b2c;
}

.validation-item.warning {
    border-color: #e7c166;
    color: #805600;
}

.validation-item.error {
    border-color: #e4a1a8;
    color: #9b1c28;
}

@media (max-width: 1280px) {
    .workspace {
        grid-template-columns: 220px minmax(0, 1fr) 230px;
    }

    .shape-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .field-grid,
    .button-grid {
        grid-template-columns: 1fr;
    }

    .diagram-world::before {
        left: var(--page-x, 290px);
    }
}

@media (max-width: 980px) {
    .studio-shell {
        grid-template-rows: auto auto minmax(0, 1fr);
    }

    .app-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
        padding: 8px 10px;
    }

    .menu-row {
        flex-wrap: wrap;
    }

    .document-status {
        display: none;
    }

    .command-bar {
        flex-wrap: wrap;
        height: auto;
        min-height: 38px;
        padding-bottom: 4px;
        padding-top: 4px;
    }

    .tool-group.spacer {
        margin-left: 0;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    .context-command-menu {
        width: min(368px, calc(100vw - 16px));
    }

    .palette,
    .inspector {
        display: none;
    }

    .canvas-area {
        min-height: 0;
    }

    .diagram-world::before {
        left: var(--page-x, 290px);
        width: var(--page-width, 860px);
    }
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.loading-progress {
    display: block;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
    position: absolute;
    width: 8rem;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.loading-progress circle:last-child {
    stroke: #1b6ec2;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
    position: absolute;
    text-align: center;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Loading");
}
