/* Sliding track workspace. Keep controls in normal document flow so expanded pockets
   and long measured paths remain usable at every viewport height. */
.track-design {
    --tde-ink: #16334f;
    --tde-muted: #5c7083;
    --tde-line: #d8e3ec;
    --tde-blue: #eaf3fc;
    --tde-surface: #fff;
    --fg: #16334f;
    --fg-2: #314f6a;
    --fg-3: #5c7083;
    --fg-4: #5c7083;
    --accent: #234e75;
    --accent-contrast: #fff;
    --accent-bg: #eaf3fc;
    --accent-border: #7ca4cb;
    color: var(--tde-ink);
    border: 1px solid var(--tde-line);
    border-radius: 16px;
    background: #f4f8fc;
    padding: 20px;
    margin-top: 16px;
    min-width: 0;
}
.track-design *, .track-design *::before, .track-design *::after { box-sizing: border-box; }
.track-design button:focus-visible, .track-design input:focus-visible, .track-design select:focus-visible {
    outline: 3px solid #3280c9;
    outline-offset: 3px;
}
.tde-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 18px; }
.tde-eyebrow { color: #426c95; font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.track-design .tde-heading h3 { margin: 5px 0 6px; color: var(--tde-ink); font-size: clamp(19px, 1.6vw, 24px); line-height: 1.25; font-weight: 750; letter-spacing: -.025em; }
.tde-heading p { margin: 0; color: var(--tde-muted); font-size: 12px; line-height: 1.6; }
.tde-heading > .config-help { flex-shrink: 0; }
.tde-starts { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tde-starts-label { font-size: 11px; font-weight: 650; width: 100%; margin-bottom: 2px; }
.track-design .tde-starter { display: flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--tde-line); border-radius: 9px; background: var(--tde-surface); color: var(--tde-ink); cursor: pointer; font: 600 12px/1.3 var(--font-sans, sans-serif); min-height: 50px; transition: border-color .15s, background .15s; }
.track-design .tde-starter:hover { background: var(--tde-blue); border-color: #80a9d0; }
.tde-starter svg { width: 36px; height: 28px; flex: 0 0 auto; fill: none; stroke: #3974aa; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tde-starter-note { margin-left: auto; font-size: 10px; line-height: 1.5; color: var(--tde-muted); }
.tde-confirm { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 14px; padding: 14px; background: #fff6e7; border: 1px solid #e5cc9f; border-radius: 9px; }
.tde-confirm > div { display: grid; gap: 4px; flex: 1 1 280px; font-size: 12px; }
.tde-confirm span { color: var(--tde-muted); font-size: 11px; }
.tde-metrics { display: grid; grid-template-columns: 1.15fr 1fr 1fr; margin-bottom: 16px; border: 1px solid var(--tde-line); border-radius: 11px; overflow: hidden; background: var(--tde-surface); }
.tde-metric { min-width: 0; display: grid; gap: 5px; padding: 14px 17px; }
.tde-metric + .tde-metric { border-left: 1px solid var(--tde-line); }
.tde-metric > span { font-size: 11px; font-weight: 600; color: var(--tde-muted); }
.tde-metric > strong { font-size: 23px; line-height: 1.25; font-weight: 730; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tde-metric em { font-size: 12px; font-weight: 500; font-style: normal; letter-spacing: 0; }
.tde-metric small { color: var(--tde-muted); font-size: 10px; line-height: 1.5; }
.tde-metric--primary { background: #eaf3fc; }
.tde-validation { padding: 12px 15px; margin-bottom: 14px; border: 1px solid #e4bfbf; background: #fff5f4; color: #903737; border-radius: 9px; font-size: 12px; line-height: 1.6; }
.tde-validation ul { margin: 4px 0 0; padding-left: 18px; }
.itd.tde-workbench {
    --bg-input: #fff;
    --bg-panel: #fff;
    --fg: #16334f;
    --fg-2: #314f6a;
    --fg-3: #5c7083;
    --fg-4: #5c7083;
    --line: #d8e3ec;
    --line-soft: #e6edf4;
    --line-strong: #b7cadb;
    --accent: #234e75;
    --accent-contrast: #fff;
    --accent-bg: #eaf3fc;
    --accent-border: #7ca4cb;
    --bg-hover: #f2f7fc;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 308px;
    grid-template-rows: minmax(410px, auto) auto;
    grid-template-areas: "stage rail" "segments rail";
    align-items: start;
    gap: 14px;
    height: auto;
    min-height: 0;
}
.tde-workbench .itd-stage { height: auto; min-height: 0; border: 1px solid var(--tde-line); border-radius: 11px; background: var(--tde-surface); position: relative; top: auto; box-shadow: 0 3px 13px #16334f08; }
.tde-workbench .itd-canvaswrap { flex: 0 0 auto; }
.tde-stage-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--tde-line); background: var(--tde-surface); color: var(--tde-ink); font-size: 12px; flex: 0 0 auto; }
.tde-stage-heading > span:first-child { display: flex; gap: 10px; align-items: baseline; }
.tde-stage-heading small, .tde-stage-status { color: var(--tde-muted); font-size: 10px; font-weight: 500; }
.tde-stage-note { padding: 9px 14px; background: var(--tde-surface); border-top: 1px solid var(--tde-line); color: var(--tde-muted); font-size: 10px; line-height: 1.5; flex: 0 0 auto; }
.tde-workbench .itd-rail { overflow: visible; gap: 14px; height: auto; }
.tde-workbench .itd-panel { border: 1px solid var(--tde-line); border-radius: 11px; background: var(--tde-surface); }
.tde-workbench .itd-panel-head { padding: 13px 15px; min-height: 46px; font-size: 12px; font-weight: 700; }
.tde-step-marker { width: 22px; height: 22px; display: grid; place-items: center; background: var(--tde-blue); color: #426c95; border-radius: 6px; font-size: 17px; }
.tde-workbench .itd-panel-body { padding: 14px; gap: 11px; }
.tde-panel-intro, .tde-field-note { margin: 0; color: var(--tde-muted); font-size: 11px; line-height: 1.6; }
.tde-workbench .itd-add-grid { grid-template-columns: minmax(0,1fr) 89px; align-items: start; gap: 9px; }
.tde-workbench .itd-add-grid > .field { display: grid; grid-template-rows: 31px 40px auto; align-content: start; }
.tde-workbench .itd-add-grid .field-label { align-self: end; padding-bottom: 5px; font-size: 10px; line-height: 1.25; min-height: 0; }
.tde-workbench .itd-add-grid .num-input { height: 40px !important; min-height: 40px; max-height: 40px; }
.tde-workbench .itd-add-grid .hint { font-size: 9px; margin-top: 4px; line-height: 1.5; }
.tde-workbench .itd-anglechips { gap: 5px; flex-wrap: wrap; overflow: visible; padding: 0; }
.tde-workbench .itd-chip { min-width: 35px; height: 29px; padding: 0 8px; border-radius: 6px; font-family: var(--font-sans, sans-serif); font-size: 11px; }
.track-design button:disabled { cursor: not-allowed; opacity: .46; }
.tde-workbench .itd-dirseg, .tde-workbench .itd-shapeseg { display: flex; width: 100%; }
.tde-workbench .segment button { flex: 1; justify-content: center; padding-inline: 6px; font-size: 11px; min-height: 33px; }
.wiz-overlay .tde-workbench .itd-addbtn { width: 100%; height: 39px; margin-top: 2px; justify-content: center; font-weight: 650; }
.tde-workbench .itd-toggle { min-height: 38px; padding: 0 9px; }
.tde-workbench .itd-pocketdetail { border-top: 1px solid var(--tde-line); padding-top: 12px; margin-top: 0; }
.tde-workbench .itd-pocketdetail .field-label { margin-bottom: 4px; }
.tde-new-radius { display: grid; gap: 6px; }
.tde-new-radius select { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--tde-surface); color: var(--tde-ink); font: 500 12px/1.4 var(--font-sans, sans-serif); }
.tde-workbench .itd-segments { overflow: hidden; min-height: 0; border: 1px solid var(--tde-line); border-radius: 11px; background: var(--tde-surface); }
.tde-workbench .itd-segments-bar { padding: 13px 14px; gap: 12px; flex-wrap: wrap; }
.tde-path-title { display: grid; gap: 4px; flex: 1 1 150px; }
.tde-path-title strong { color: var(--tde-ink); font-size: 13px; }
.tde-path-title span { color: var(--tde-muted); font-size: 10px; }
.tde-workbench .itd-stat-actions { gap: 6px; }
.tde-workbench .itd-seglist { display: flex; flex-direction: column; gap: 0; padding: 0 14px; overflow: visible; touch-action: auto; }
.tde-workbench .itd-segrow { width: 100%; min-width: 0; display: flex; gap: 5px; flex-wrap: wrap; border: 0; border-bottom: 1px solid #e6edf4; border-radius: 0; padding: 6px 0; cursor: default; background: transparent; }
.tde-workbench .itd-segrow:last-child { border-bottom: 0; }
.tde-workbench .itd-segrow.is-selected { background: #edf5fd; box-shadow: -14px 0 #edf5fd, 14px 0 #edf5fd; }
.tde-workbench .tde-seg-select { display: flex; align-items: center; gap: 10px; flex: 1 1 290px; min-width: 0; padding: 6px 3px; border: 0; border-radius: 5px; background: transparent; text-align: left; color: var(--tde-ink); cursor: pointer; }
.tde-workbench .tde-seg-select:hover { background: #eaf3fc; }
.tde-workbench .itd-segbadge { width: 28px; height: 28px; border-radius: 7px; font: 700 17px/1 var(--font-sans, sans-serif); }
.tde-workbench .itd-segbadge.is-straight { color: #2c6ea6; background: #e0eef9; }
.tde-workbench .itd-segbadge.is-curve { color: #836231; background: #f6eddf; }
.tde-seg-copy { min-width: 0; display: grid; gap: 4px; flex: 1; }
.tde-seg-copy strong { font-size: 12px; line-height: 1.3; font-weight: 650; }
.tde-seg-copy > span { font-size: 10px; line-height: 1.35; color: var(--tde-muted); }
.tde-seg-measure { display: grid; gap: 4px; flex-shrink: 0; text-align: right; color: var(--tde-ink); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tde-seg-measure small { color: var(--tde-muted); font-size: 9px; font-weight: 400; }
.tde-workbench .itd-segactions { gap: 3px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.tde-workbench .itd-segactions .icon { font-size: 16px; width: 28px; height: 30px; }
.tde-list-note { margin: 0; padding: 11px 15px; border-top: 1px solid var(--tde-line); color: var(--tde-muted); font-size: 10px; line-height: 1.5; }
.tde-workbench .itd-empty { display: grid; gap: 7px; padding: 28px 16px; color: var(--tde-muted); font-size: 11px; line-height: 1.6; }
.tde-workbench .itd-empty strong { font-size: 14px; color: var(--tde-ink); }
.tde-live { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 1100px) {
    .track-design { padding: 15px; }
    .itd.tde-workbench { grid-template-columns: minmax(0,1fr) 284px; }
    .tde-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
    .tde-starter-note { margin-left: 0; }
    .tde-metric { padding: 12px; }
    .tde-metric strong { font-size: 20px; }
}
@media (max-width: 900px) {
    .itd.tde-workbench { grid-template-columns: minmax(0,1fr); grid-template-areas: "stage" "rail" "segments"; grid-template-rows: auto; }
    .tde-workbench .itd-rail { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
    .tde-workbench .itd-stage { height: auto; min-height: 0; }
    .tde-workbench .itd-add-grid { grid-template-columns: minmax(0,1fr) 85px; }
}
@media (max-width: 767px) {
    .track-design { margin-top: 12px; padding: 12px; border-radius: 12px; }
    .tde-heading { margin-bottom: 14px; }
    .tde-heading p { font-size: 11px; }
    .tde-starts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
    .tde-starts-label, .tde-starter-note { grid-column: 1 / -1; }
    .track-design .tde-starter { padding: 8px; font-size: 10px; gap: 5px; min-height: 46px; }
    .tde-starter svg { width: 31px; height: 25px; }
    .tde-starter-note br { display: none; }
    .tde-metrics { grid-template-columns: 1fr 1fr; }
    .tde-metric { padding: 11px; gap: 4px; }
    .tde-metric--primary { grid-column: 1 / -1; }
    .tde-metric:nth-child(2) { border-left: 0; }
    .tde-metric:not(:first-child) { border-top: 1px solid var(--tde-line); }
    .tde-metric strong { font-size: 19px; }
    .tde-metric > span { font-size: 10px; }
    .tde-metric small { font-size: 9px; }
    .itd.tde-workbench { display: flex; gap: 0; flex-direction: column; }
    .tde-workbench .itd-stage { position: relative; top: auto; height: auto; min-height: 0; width: 100%; flex: 0 0 auto; box-shadow: none; }
    .tde-stage-heading { padding: 11px; }
    .tde-stage-heading > span:first-child { gap: 7px; }
    .tde-stage-note { padding: 8px 10px; font-size: 9px; }
    .tde-workbench .itd-tabbar { display: flex; width: 100%; position: relative; top: auto; background: transparent; padding: 12px 0 0; gap: 5px; }
    .tde-workbench .itd-tabbar button { min-width: 0; padding: 5px; height: auto; min-height: 40px; font-size: 10px; line-height: 1.3; }
    .tde-workbench .itd-rail { display: contents; }
    .tde-workbench .itd-add, .tde-workbench .itd-options, .tde-workbench .itd-segments { width: 100%; margin-top: 10px; }
    .tde-workbench .itd-add-grid { grid-template-columns: minmax(0,1fr) 95px; }
    .tde-workbench .itd-seglist { padding: 0 10px; }
    .tde-workbench .itd-segrow { min-width: 0; padding-block: 7px; }
    .tde-workbench .itd-segrow.is-selected { box-shadow: -10px 0 #edf5fd, 10px 0 #edf5fd; }
    .tde-workbench .tde-seg-select { flex-basis: 100%; gap: 8px; }
    .tde-workbench .itd-segactions { padding-bottom: 3px; }
    .tde-workbench .itd-segactions .icon { width: 34px; min-height: 34px; }
    .tde-workbench .itd-segments-bar { padding: 12px; gap: 10px; }
    .tde-path-title { flex-basis: 100%; }
    .tde-workbench .itd-stat-actions { width: 100%; }
    .tde-workbench .itd-stat-actions button:last-child { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
    .track-design *, .track-design *::before, .track-design *::after { transition: none !important; }
}
