.ltcad-app {
    --cad-bg: #eef0f2;
    --cad-panel: #f7f8f9;
    --cad-surface: #ffffff;
    --cad-line: #c8cdd2;
    --cad-line-dark: #aeb5bb;
    --cad-text: #20262b;
    --cad-muted: #667179;
    --cad-blue: #168ad1;
    --cad-blue-dark: #086ca9;
    --cad-blue-soft: #e4f3fc;
    --cad-orange: #f28a2e;
    --cad-green: #228b61;
    --cad-red: #c33f45;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1600px;
    height: clamp(640px, calc(100vh - 40px), 900px);
    min-height: 0;
    max-height: 900px;
    margin: 12px auto;
    overflow: hidden;
    border: 1px solid var(--cad-line-dark);
    border-radius: 9px;
    background: var(--cad-bg);
    color: var(--cad-text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 13px;
    line-height: 1.35;
    box-shadow: 0 14px 44px rgba(29, 40, 48, .2);
}

.ltcad-app *, .ltcad-app *::before, .ltcad-app *::after { box-sizing: border-box; }
.ltcad-app button, .ltcad-app input { font: inherit; }
.ltcad-app button:focus-visible, .ltcad-app input:focus-visible, .ltcad-app label:focus-within { outline: 3px solid rgba(22, 138, 209, .3); outline-offset: 2px; }
.ltcad-app button:disabled { cursor: not-allowed; opacity: .42; }
.ltcad-app [hidden] { display: none !important; }

.ltcad-titlebar {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 6px 11px;
    border-bottom: 1px solid #242a2e;
    background: #30363a;
    color: #f5f7f8;
}
.ltcad-brand { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.ltcad-brand strong { color: #43b7ed; font-weight: 600; }
.ltcad-brand-mark { width: 29px; height: 29px; position: relative; border: 2px solid #f3f6f7; border-radius: 4px; }
.ltcad-brand-mark::before, .ltcad-brand-mark::after { content: ""; position: absolute; background: #35afe7; }
.ltcad-brand-mark::before { width: 19px; height: 6px; left: 4px; top: 4px; }
.ltcad-brand-mark::after { width: 6px; height: 18px; left: 11px; top: 8px; }
.ltcad-project-name { margin-left: 12px; }
.ltcad-project-name input { width: 220px; height: 34px; padding: 5px 8px; border: 1px solid #545d63; border-radius: 4px; background: #252a2d; color: #fff; }
.ltcad-save-status { color: #aeb7bc; font-size: 11px; }
.ltcad-title-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }

.ltcad-button, .ltcad-icon-action, .ltcad-close, .ltcad-delete-last {
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.ltcad-button { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 7px 12px; font-weight: 600; white-space: nowrap; }
.ltcad-button-primary { background: var(--cad-blue); color: #fff; }
.ltcad-button-primary:hover { background: var(--cad-blue-dark); }
.ltcad-button-quiet { border: 1px solid #5d666b; background: #3c4347; color: #f5f7f8; }
.ltcad-button-quiet:hover { border-color: #8a969d; background: #464e53; }
.ltcad-button-light { border: 1px solid var(--cad-line-dark); background: #fff; color: var(--cad-text); }
.ltcad-button-light:hover { border-color: var(--cad-blue); color: var(--cad-blue-dark); }
.ltcad-button-block { width: 100%; }
.ltcad-icon-action { width: 33px; height: 33px; border: 1px solid #5d666b; background: #3c4347; color: #fff; font-size: 17px; }
.ltcad-file { position: relative; overflow: hidden; cursor: pointer; }
.ltcad-file input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }

.ltcad-ribbon { min-height: 78px; display: flex; align-items: stretch; gap: 12px; padding: 0 10px; border-bottom: 1px solid var(--cad-line-dark); background: var(--cad-surface); }
.ltcad-workspace-tabs { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding-right: 10px; border-right: 1px solid var(--cad-line); }
.ltcad-workspace-tabs button { min-width: 68px; padding: 5px 7px; border: 0; border-radius: 3px; background: transparent; color: var(--cad-muted); cursor: pointer; font-size: 11px; font-weight: 600; }
.ltcad-workspace-tabs button.is-active { background: var(--cad-blue-soft); color: var(--cad-blue-dark); }
.ltcad-command-group { display: flex; align-items: stretch; gap: 4px; }
.ltcad-command { min-width: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 7px 9px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--cad-text); cursor: pointer; font-size: 11px; }
.ltcad-command:hover { background: #f0f4f7; }
.ltcad-command.is-active { border-bottom-color: var(--cad-blue); background: var(--cad-blue-soft); color: var(--cad-blue-dark); }
.ltcad-command-icon { min-height: 25px; font-size: 23px; line-height: 1; }
.ltcad-finish-command { margin-left: 8px; border-left: 1px solid var(--cad-line); color: var(--cad-green); }
.ltcad-ribbon-spacer { flex: 1; }
.ltcad-mode-label { align-self: center; padding: 5px 9px; border: 1px solid var(--cad-line); border-radius: 999px; color: var(--cad-muted); font-size: 11px; white-space: nowrap; }

.ltcad-shell { flex: 1; min-height: 0; overflow: hidden; display: grid; grid-template-columns: 220px minmax(0, 1fr) 300px; }
.ltcad-browser, .ltcad-inspector { min-width: 0; background: var(--cad-panel); }
.ltcad-browser { overflow-y: auto; border-right: 1px solid var(--cad-line-dark); }
.ltcad-inspector { overflow-y: auto; border-left: 1px solid var(--cad-line-dark); }
.ltcad-panel-title { min-height: 37px; display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; border-bottom: 1px solid var(--cad-line); color: var(--cad-muted); font-size: 10px; letter-spacing: .04em; }
.ltcad-panel-title button { border: 0; background: transparent; color: var(--cad-muted); cursor: pointer; }

.ltcad-tree { padding: 8px 0; }
.ltcad-tree-row { min-height: 29px; display: flex; align-items: center; gap: 6px; padding: 4px 9px; border-left: 3px solid transparent; cursor: default; color: var(--cad-text); }
.ltcad-tree-row.is-selectable { cursor: pointer; }
.ltcad-tree-row.is-selectable:hover { background: #e8edf0; }
.ltcad-tree-row.is-selected { border-left-color: var(--cad-blue); background: var(--cad-blue-soft); color: var(--cad-blue-dark); }
.ltcad-tree-row.depth-1 { padding-left: 22px; }
.ltcad-tree-row.depth-2 { padding-left: 38px; }
.ltcad-tree-icon { width: 17px; color: var(--cad-muted); text-align: center; }
.ltcad-tree-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ltcad-tree-count { margin-left: auto; color: var(--cad-muted); font-size: 10px; }
.ltcad-plane-tree { color: #8b9499; }
.ltcad-sketch-eye { width: 25px; height: 25px; display: grid; place-items: center; margin-left: auto; padding: 0; border: 0; border-radius: 3px; background: transparent; color: var(--cad-blue-dark); cursor: pointer; font-size: 15px; }
.ltcad-sketch-eye:hover { background: #d8eaf5; }
.ltcad-sketch-eye.is-hidden { color: #929ca2; }

.ltcad-viewport { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: radial-gradient(circle at 50% 38%, #f8fafb 0%, #e7ebee 58%, #d8dde1 100%); }
.ltcad-viewport canvas { display: block; width: 100%; height: 100%; min-height: 0; outline: 0; touch-action: none; }
.ltcad-viewport canvas.is-panning { cursor: grabbing; }
.ltcad-viewport canvas.is-dragging-profile { cursor: move; }
.ltcad-viewport canvas.is-plane-hover { cursor: pointer; }
.ltcad-app.is-extruding .ltcad-viewport canvas { cursor: pointer; }
.ltcad-viewport canvas.is-dragging-extrude { cursor: ns-resize; }
.ltcad-dimension-overlay { position: absolute; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; }
.ltcad-dimension-label { position: absolute; left: 0; top: 0; min-width: 46px; padding: 3px 6px; border: 1px solid #5ba9d2; border-radius: 3px; background: rgba(255,255,255,.94); color: #075d8c; pointer-events: auto; cursor: move; user-select: none; touch-action: none; font-size: 10px; font-weight: 700; line-height: 1.2; box-shadow: 0 2px 7px rgba(30,62,79,.13); }
.ltcad-dimension-label:hover, .ltcad-dimension-label.is-active { border-color: var(--cad-orange); background: #fff5e9; color: #a75208; }
.ltcad-dimension-label.is-dragging { cursor: grabbing; border-color: var(--cad-orange); background: #fff5e9; color: #a75208; box-shadow: 0 4px 12px rgba(30,62,79,.22); }
.ltcad-dimension-label.is-construction { border-style: dashed; border-color: #8b5cf6; color: #6941c6; }
.ltcad-offset-dimension { display: inline-flex; align-items: center; gap: 3px; cursor: text; z-index: 5; }
.ltcad-offset-dimension input { width: 54px; padding: 1px 2px; border: 0; border-bottom: 1px solid #d57a24; outline: 0; background: transparent; color: inherit; font: inherit; text-align: right; }
.ltcad-offset-dimension em { font-style: normal; font-weight: 600; }
.ltcad-distance-dimension { display: inline-flex; align-items: center; gap: 3px; cursor: move; z-index: 5; border-color: #d97706; color: #9a4d00; }
.ltcad-distance-dimension > span { white-space: nowrap; font-size: 9px; }
.ltcad-distance-dimension input { width: 55px; padding: 1px 2px; border: 0; border-bottom: 1px solid #d97706; outline: 0; background: transparent; color: inherit; font: inherit; text-align: right; cursor: text; }
.ltcad-distance-dimension em { font-style: normal; font-weight: 600; }
.ltcad-extrude-dimension { position: absolute; left: 0; top: 0; z-index: 6; display: inline-flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid #dd7b20; border-radius: 5px; background: rgba(255,250,244,.97); color: #9b4c08; pointer-events: auto; box-shadow: 0 3px 10px rgba(86,48,15,.2); }
.ltcad-extrude-dimension input { width: 58px; padding: 2px 3px; border: 0; border-bottom: 1px solid #dd7b20; outline: 0; background: transparent; color: inherit; font-size: 11px; font-weight: 750; text-align: right; }
.ltcad-extrude-dimension span { padding-right: 2px; font-size: 10px; font-weight: 700; }
.ltcad-extrude-dimension button { width: 24px; height: 24px; display: grid; place-items: center; padding: 0; border: 1px solid #e6b17d; border-radius: 3px; background: #fff; color: #b65b0b; cursor: pointer; font-size: 14px; font-weight: 800; }
.ltcad-extrude-dimension button:hover { border-color: #ca650c; background: #fff0e1; }
.ltcad-angle-label { border-color: #d97706; color: #9a4d00; cursor: pointer; }
.ltcad-view-cube { position: absolute; top: 14px; right: 14px; display: grid; justify-items: center; gap: 3px; }
.ltcad-view-cube button { min-width: 48px; min-height: 29px; padding: 4px 6px; border: 1px solid #aeb8be; background: rgba(255,255,255,.9); color: #44515a; cursor: pointer; font-size: 9px; font-weight: 600; box-shadow: 0 2px 7px rgba(36,48,56,.12); }
.ltcad-view-cube > button { border-radius: 4px 4px 0 0; }
.ltcad-view-cube div { display: flex; gap: 2px; }
.ltcad-view-cube div button:first-child { border-radius: 4px 0 0 4px; }
.ltcad-view-cube div button:last-child { border-radius: 0 4px 4px 0; }
.ltcad-view-cube button:hover { border-color: var(--cad-blue); color: var(--cad-blue); }
.ltcad-app.is-sketching .ltcad-view-cube { display: none; }
.ltcad-viewport-status { position: absolute; left: 12px; bottom: 11px; display: flex; align-items: center; gap: 7px; padding: 5px 8px; border: 1px solid rgba(130,142,150,.5); border-radius: 4px; background: rgba(255,255,255,.84); color: #56636b; font-size: 11px; }
.ltcad-viewport-status > span:first-child { width: 7px; height: 7px; border-radius: 50%; background: var(--cad-green); }
.ltcad-viewport-status > span:first-child.is-working { background: var(--cad-orange); }
.ltcad-viewport-status > span:first-child.is-error { background: var(--cad-red); }
.ltcad-camera-help { position: absolute; z-index: 2; left: 12px; top: 12px; padding: 4px 7px; border-radius: 3px; background: rgba(255,255,255,.78); color: #667179; font-size: 9px; pointer-events: none; }
.ltcad-hint { position: absolute; left: 50%; bottom: 12px; max-width: 60%; padding: 6px 10px; border-radius: 4px; transform: translateX(-50%); background: rgba(38,45,49,.86); color: #fff; text-align: center; font-size: 11px; pointer-events: none; }
.ltcad-loading { position: absolute; inset: 0; z-index: 8; display: grid; place-content: center; justify-items: center; gap: 13px; background: rgba(238,240,242,.94); color: #47545d; }
.ltcad-loading > span { width: 34px; height: 34px; border: 3px solid #c9d1d6; border-top-color: var(--cad-blue); border-radius: 50%; animation: ltcad-spin 1s linear infinite; }
.ltcad-loading.is-hidden { display: none; }
@keyframes ltcad-spin { to { transform: rotate(360deg); } }

.ltcad-inspector-panel { padding: 16px; }
.ltcad-inspector-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.ltcad-inspector-head small { display: block; margin-bottom: 3px; color: var(--cad-muted); font-size: 9px; font-weight: 700; letter-spacing: .09em; }
.ltcad-inspector-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.ltcad-close { width: 28px; height: 28px; background: transparent; color: var(--cad-muted); font-size: 21px; }
.ltcad-close:hover { background: #e3e7ea; color: var(--cad-text); }
.ltcad-panel-copy { margin: 0 0 15px; color: var(--cad-muted); font-size: 12px; line-height: 1.5; }
.ltcad-model-stats { margin: 18px 0 0; border-top: 1px solid var(--cad-line); }
.ltcad-model-stats div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--cad-line); }
.ltcad-model-stats dt { color: var(--cad-muted); }
.ltcad-model-stats dd { margin: 0; font-weight: 600; }
.ltcad-selection-card { margin: 14px 0 0; padding: 10px; border: 1px solid #b8d8ea; border-radius: 5px; background: var(--cad-blue-soft); color: #325a70; }

.ltcad-plane-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.ltcad-plane-grid button { min-height: 95px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 1px solid var(--cad-line); border-radius: 5px; background: #fff; color: var(--cad-text); cursor: pointer; }
.ltcad-plane-grid button:hover, .ltcad-plane-grid button.is-active { border-color: var(--cad-blue); background: var(--cad-blue-soft); box-shadow: inset 0 0 0 1px var(--cad-blue); }
.ltcad-plane-grid small { color: var(--cad-muted); font-size: 9px; }
.ltcad-plane-icon { width: 32px; height: 25px; display: block; border: 2px solid; transform: skewY(-15deg); }
.ltcad-plane-icon.xy { border-color: #3d9ed3; background: rgba(61,158,211,.12); }
.ltcad-plane-icon.xz { border-color: #d46a6a; background: rgba(212,106,106,.12); }
.ltcad-plane-icon.yz { border-color: #55a879; background: rgba(85,168,121,.12); }
.ltcad-info-box { margin-top: 13px; padding: 9px 10px; border-left: 3px solid var(--cad-blue); background: #edf5fa; color: #526975; font-size: 11px; line-height: 1.45; }
.ltcad-edge-selection-state { display: grid; gap: 2px; margin: 0 0 13px; padding: 10px; border: 1px solid #f1ba86; border-radius: 5px; background: #fff6ed; color: #8f4b12; }
.ltcad-edge-selection-state strong { font-size: 13px; }
.ltcad-edge-selection-state small { color: #866d59; font-size: 9px; line-height: 1.4; }

.ltcad-sketch-state { display: grid; grid-template-columns: 10px 1fr; column-gap: 7px; margin: -3px 0 12px; padding: 9px 10px; border: 1px solid var(--cad-line); border-radius: 5px; background: #fff; }
.ltcad-sketch-state > span:first-child { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--cad-blue); }
.ltcad-sketch-state > span:first-child.is-full { background: #252b2f; }
.ltcad-sketch-state small { grid-column: 2; color: var(--cad-muted); }
.ltcad-fieldset { min-width: 0; margin: 0; padding: 13px 0; border: 0; border-top: 1px solid var(--cad-line); }
.ltcad-fieldset legend { padding: 0 0 9px; color: var(--cad-text); font-size: 12px; font-weight: 700; }
.ltcad-profile-list { display: grid; gap: 5px; margin-bottom: 8px; }
.ltcad-offset-directions { margin: 8px 0; }
.ltcad-offset-actions { display: grid; grid-template-columns: .8fr 1.2fr; gap: 7px; margin-top: 9px; }
.ltcad-extrude-profiles { display: grid; gap: 6px; }
.ltcad-extrude-profile { display: flex; align-items: flex-start; gap: 8px; padding: 8px 9px; border: 1px solid var(--cad-border); border-radius: 6px; background: #fff; cursor: pointer; }
.ltcad-extrude-profile:has(input:checked) { border-color: var(--cad-blue); background: #eef8fd; }
.ltcad-extrude-profile input { margin-top: 2px; }
.ltcad-extrude-profile span { display: grid; gap: 1px; }
.ltcad-extrude-profile small { color: var(--cad-muted); }
.ltcad-profile-item { width: 100%; min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border: 1px solid var(--cad-line); border-radius: 4px; background: #fff; color: var(--cad-text); cursor: pointer; text-align: left; }
.ltcad-profile-item:hover, .ltcad-profile-item.is-active { border-color: var(--cad-blue); background: var(--cad-blue-soft); color: var(--cad-blue-dark); }
.ltcad-profile-item small { color: var(--cad-muted); font-size: 9px; }
.ltcad-text-action { padding: 2px 0; border: 0; background: transparent; color: var(--cad-red); cursor: pointer; font-size: 10px; }
.ltcad-text-action:hover { text-decoration: underline; }
.ltcad-switch { display: flex; align-items: center; gap: 8px; margin: 7px 0; color: var(--cad-muted); cursor: pointer; }
.ltcad-switch input { width: 16px; height: 16px; accent-color: var(--cad-blue); }
.ltcad-constraint-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.ltcad-constraint-grid button { min-height: 42px; display: grid; grid-template-columns: 26px 1fr; align-items: center; padding: 4px 7px; border: 1px solid var(--cad-line); border-radius: 4px; background: #fff; color: var(--cad-text); cursor: pointer; text-align: left; }
.ltcad-constraint-grid button:hover, .ltcad-constraint-grid button.is-active { border-color: var(--cad-blue); background: var(--cad-blue-soft); color: var(--cad-blue-dark); }
.ltcad-constraint-grid b { color: var(--cad-blue-dark); font-size: 14px; text-align: center; }
.ltcad-constraint-grid span { font-size: 10px; }
.ltcad-two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.ltcad-two-fields label > span:first-child, .ltcad-full-field > span:first-child { display: block; margin-bottom: 4px; color: var(--cad-muted); font-size: 10px; }
.ltcad-full-field { display: block; margin: 10px 0; }
.ltcad-number { display: flex; align-items: center; overflow: hidden; border: 1px solid var(--cad-line-dark); border-radius: 4px; background: #fff; }
.ltcad-number:focus-within { border-color: var(--cad-blue); }
.ltcad-number input { width: 100%; min-width: 0; height: 34px; padding: 5px 4px 5px 8px; border: 0; outline: 0; background: transparent; color: var(--cad-text); }
.ltcad-number em { padding-right: 7px; color: var(--cad-muted); font-style: normal; font-size: 10px; }
.ltcad-range { width: 100%; accent-color: var(--cad-blue); }
.ltcad-constraints-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 12px; }
.ltcad-constraint-tag { padding: 3px 6px; border-radius: 999px; background: var(--cad-blue-soft); color: var(--cad-blue-dark); font-size: 9px; }
.ltcad-panel-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--cad-line); }
.ltcad-panel-actions .ltcad-button-quiet { border-color: var(--cad-line-dark); background: #fff; color: var(--cad-text); }

.ltcad-segmented { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 9px; }
.ltcad-segmented button { min-height: 34px; border: 1px solid var(--cad-line-dark); background: #fff; color: var(--cad-muted); cursor: pointer; }
.ltcad-segmented button:first-child { border-radius: 4px 0 0 4px; }
.ltcad-segmented button:last-child { border-radius: 0 4px 4px 0; border-left: 0; }
.ltcad-segmented button.is-active { background: var(--cad-blue-soft); color: var(--cad-blue-dark); box-shadow: inset 0 0 0 1px var(--cad-blue); }
.ltcad-operation-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }
.ltcad-operation-grid button { min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 1px solid var(--cad-line); border-radius: 4px; background: #fff; color: var(--cad-muted); cursor: pointer; font-size: 10px; }
.ltcad-operation-grid button b { font-size: 17px; }
.ltcad-operation-grid button.is-active { border-color: var(--cad-blue); background: var(--cad-blue-soft); color: var(--cad-blue-dark); }

.ltcad-timeline { min-height: 52px; display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-top: 1px solid var(--cad-line-dark); background: var(--cad-surface); }
.ltcad-timeline-label { padding-right: 7px; border-right: 1px solid var(--cad-line); color: var(--cad-muted); font-size: 9px; font-weight: 700; letter-spacing: .06em; }
.ltcad-timeline-items { min-width: 0; display: flex; gap: 5px; overflow-x: auto; }
.ltcad-timeline-item { min-width: 38px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 5px 8px; border: 1px solid var(--cad-line); border-radius: 4px; background: #fff; color: var(--cad-muted); cursor: pointer; }
.ltcad-timeline-item:hover, .ltcad-timeline-item.is-selected { border-color: var(--cad-blue); background: var(--cad-blue-soft); color: var(--cad-blue-dark); }
.ltcad-timeline-item span { margin-left: 5px; font-size: 10px; white-space: nowrap; }
.ltcad-delete-last { min-height: 31px; margin-left: auto; padding: 5px 8px; border: 1px solid var(--cad-line); background: #fff; color: var(--cad-muted); white-space: nowrap; font-size: 10px; }
.ltcad-delete-last:hover { border-color: var(--cad-red); color: var(--cad-red); }

.ltcad-modal-backdrop { position: absolute; z-index: 50; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(22,29,34,.62); backdrop-filter: blur(2px); }
.ltcad-modal { width: min(520px, 100%); display: grid; grid-template-columns: 56px 1fr; gap: 18px; padding: 24px; border: 1px solid #b6c0c6; border-radius: 8px; background: #fff; box-shadow: 0 24px 70px rgba(12,20,25,.38); }
.ltcad-modal-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 8px; background: var(--cad-blue-soft); color: var(--cad-blue-dark); font-size: 32px; font-weight: 300; }
.ltcad-modal-content > small { color: var(--cad-blue-dark); font-size: 10px; font-weight: 700; letter-spacing: .09em; }
.ltcad-modal-content h2 { margin: 3px 0 7px; font-size: 24px; font-weight: 600; }
.ltcad-modal-content > p { margin: 0 0 16px; color: var(--cad-muted); }
.ltcad-warning-box { margin: 0 0 15px; padding: 9px 11px; border: 1px solid #edb36f; border-radius: 5px; background: #fff7e9; color: #824b11; font-size: 11px; }
.ltcad-modal-field { display: grid; gap: 6px; color: var(--cad-muted); font-size: 11px; font-weight: 600; }
.ltcad-modal-field input { width: 100%; height: 38px; padding: 7px 9px; border: 1px solid var(--cad-line-dark); border-radius: 4px; background: #fff; color: var(--cad-text); font-size: 13px; }
.ltcad-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.ltcad-field-hint { display: block; margin-top: 8px; color: var(--cad-muted); font-size: 10px; font-weight: 400; }

.ltcad-toast { position: absolute; z-index: 30; right: 14px; bottom: 63px; max-width: min(360px, calc(100% - 28px)); padding: 10px 13px; border: 1px solid #73bce6; border-radius: 5px; background: #eaf6fd; color: #235c7c; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; box-shadow: 0 7px 22px rgba(32,45,54,.17); }
.ltcad-toast.is-visible { opacity: 1; transform: translateY(0); }
.ltcad-toast.is-error { border-color: #e19a9e; background: #fff0f1; color: #9a3035; }

.ltcad-app.is-sketching .ltcad-viewport { background: #f3f5f6; }
.ltcad-app.is-browser-collapsed .ltcad-shell { grid-template-columns: 38px minmax(0,1fr) 300px; }
.ltcad-app.is-browser-collapsed .ltcad-tree, .ltcad-app.is-browser-collapsed .ltcad-panel-title strong { display: none; }

@media (max-width: 1050px) {
    .ltcad-project-name { margin-left: 0; }
    .ltcad-project-name input { width: 170px; }
    .ltcad-save-status { display: none; }
    .ltcad-shell { grid-template-columns: 185px minmax(0,1fr) 270px; }
    .ltcad-command { min-width: 60px; padding-inline: 6px; }
}

@media (max-width: 820px) {
    .ltcad-app { height: auto; min-height: 760px; max-height: none; margin: 8px auto; border-radius: 5px; }
    .ltcad-titlebar { flex-wrap: wrap; }
    .ltcad-brand { width: 100%; }
    .ltcad-project-name { flex: 1; }
    .ltcad-project-name input { width: 100%; }
    .ltcad-title-actions { margin-left: 0; }
    .ltcad-ribbon { min-height: 67px; overflow-x: auto; }
    .ltcad-command span:last-child { display: none; }
    .ltcad-command { min-width: 45px; }
    .ltcad-mode-label { display: none; }
    .ltcad-shell { display: grid; grid-template-columns: 1fr; }
    .ltcad-browser { display: none; }
    .ltcad-viewport, .ltcad-viewport canvas { min-height: 500px; }
    .ltcad-inspector { max-height: none; border-left: 0; border-top: 1px solid var(--cad-line-dark); }
    .ltcad-timeline { overflow-x: auto; }
    .ltcad-modal-backdrop { padding: 12px; }
    .ltcad-modal { grid-template-columns: 1fr; padding: 19px; }
    .ltcad-modal-icon { width: 44px; height: 44px; font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
    .ltcad-app * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* === Panel stagingu wiązań (v0.24.0) === */
.ltcad-stage{display:flex;flex-direction:column;gap:8px;padding:2px 0;}
.ltcad-stage-head{font-size:12px;color:var(--cad-muted);}
.ltcad-stage-head strong{color:var(--cad-text);}
.ltcad-stage-items{display:flex;flex-direction:column;gap:5px;}
.ltcad-stage-empty{font-size:11px;color:var(--cad-muted);padding:6px 8px;border:1px dashed var(--cad-line);border-radius:6px;background:#fafbfc;}
.ltcad-stage-row{display:flex;align-items:center;gap:8px;padding:5px 8px;border:1px solid var(--cad-line);border-radius:6px;background:#fff;}
.ltcad-stage-dot{width:10px;height:10px;border-radius:50%;flex:0 0 auto;}
.ltcad-stage-dot.is-point{background:#168ad1;}
.ltcad-stage-dot.is-entity{background:#f28a2e;}
.ltcad-stage-label{flex:1;font-size:12px;color:var(--cad-text);}
.ltcad-stage-remove{width:20px;height:20px;flex:0 0 auto;display:grid;place-items:center;padding:0;border:0;border-radius:4px;background:transparent;color:var(--cad-muted);cursor:pointer;font-size:16px;line-height:1;}
.ltcad-stage-remove:hover{background:#fdecec;color:#c33f45;}
.ltcad-stage-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:2px;}
.ltcad-stage-actions .ltcad-button{padding:6px 12px;min-height:30px;font-size:12px;}
/* === Panel narzędzia wiązania na górze inspektora (v0.28.0) === */
[data-stage-panel]{margin:0 0 12px;padding:12px 13px;border:1px solid #9fd0ee;border-radius:9px;background:#eef7fd;box-shadow:0 4px 14px rgba(41,168,238,.14);}
[data-stage-panel] .ltcad-stage-head{font-size:13px;color:#20618a;}
[data-stage-panel] .ltcad-stage-row{background:#fff;}