/* Tracklayer workspace. Everything is scoped under .tl-app (the platform puts .uwapp-tracklayer on <body> too).
   Tokens: site design system (docs/DESIGN_SYSTEM.md §9) — light = system tokens, dark = the --d-* constants. The app
   follows the site theme via data-theme on .tl-app (set from window.uwTheme). No animations; reduced motion safe. */
.tl-app {
  --tl-bg: var(--canvas); --tl-surface: var(--surface); --tl-surface-2: var(--surface-2); --tl-surface-3: var(--surface-3, var(--surface-2));
  --tl-ink: var(--ink); --tl-muted: var(--muted); --tl-line: var(--line); --tl-line-strong: var(--line-strong, var(--line)); --tl-control: var(--control);
  --tl-primary: var(--primary); --tl-primary-text: var(--primary-text); --tl-on-accent: var(--on-accent); --tl-focus: var(--focus-color);
  --tl-info-bg: var(--info-bg); --tl-info-line: var(--info-line); --tl-danger: var(--danger); --tl-danger-bg: var(--danger-bg, #fde8e8); --tl-warning: var(--warning, #92400e); --tl-success: var(--success, #166534);
  --tl-lane: #f3f5f7; --tl-lane-alt: #eceff2; --tl-grid: rgb(15 23 42 / .08); --tl-bar: rgb(15 23 42 / .2);
  --tl-c0: #dbe7fd; --tl-c0-ink: #1e3a8a; --tl-c1: #d3efe9; --tl-c1-ink: #134e4a; --tl-c2: #fbe8cf; --tl-c2-ink: #7c2d12; --tl-c3: #fbdce3; --tl-c3-ink: #881337;
  --tl-c4: #e3efd0; --tl-c4-ink: #365314; --tl-c5: #d4eef5; --tl-c5-ink: #164e63; --tl-c6: #f8ecc4; --tl-c6-ink: #713f12; --tl-c7: #f6dbe2; --tl-c7-ink: #831843;
  --tl-rec: #b91c1c; --tl-meter: #15803d; --tl-meter-hot: #b45309; --tl-playhead: #b91c1c; --tl-loop: rgb(37 99 235 / .25);
  --tl-hdr-w: 200px;
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  background: var(--tl-bg); color: var(--tl-ink); font-family: var(--font-sans); font-size: 14px; color-scheme: light;
}
.tl-app[data-theme="dark"] {
  --tl-bg: var(--d-canvas); --tl-surface: var(--d-surface); --tl-surface-2: var(--d-surface-2); --tl-surface-3: var(--d-surface-3, var(--d-surface-2));
  --tl-ink: var(--d-ink); --tl-muted: var(--d-muted); --tl-line: var(--d-line); --tl-line-strong: var(--d-line-strong, var(--d-line)); --tl-control: var(--d-control);
  --tl-primary: var(--d-primary); --tl-primary-text: var(--d-focus); --tl-on-accent: var(--d-on-accent); --tl-focus: var(--d-focus);
  --tl-info-bg: var(--d-info-bg); --tl-info-line: var(--d-info-line); --tl-danger: var(--d-danger); --tl-danger-bg: var(--d-danger-bg, #3b1212); --tl-warning: var(--d-warning, #fdba74); --tl-success: var(--d-success, #86efac);
  --tl-lane: #1a2229; --tl-lane-alt: #161d23; --tl-grid: rgb(255 255 255 / .06); --tl-bar: rgb(255 255 255 / .18);
  --tl-c0: #26406e; --tl-c0-ink: #e3ecff; --tl-c1: #1f4d47; --tl-c1-ink: #dcfbf4; --tl-c2: #5b3a17; --tl-c2-ink: #ffedd5; --tl-c3: #5e2133; --tl-c3-ink: #ffe4ea;
  --tl-c4: #33451c; --tl-c4-ink: #ecfccb; --tl-c5: #1b4655; --tl-c5-ink: #dff7ff; --tl-c6: #554215; --tl-c6-ink: #fef3c7; --tl-c7: #5a2140; --tl-c7-ink: #fce7f3;
  --tl-rec: #f87171; --tl-meter: #4ade80; --tl-meter-hot: #fbbf24; --tl-playhead: #f87171; --tl-loop: rgb(96 165 250 / .3);
  color-scheme: dark;
}
.tl-app > .tl-arrange { flex: 1 1 55%; min-height: 160px; }
.tl-app > .tl-dock { flex: 1 1 45%; min-height: 200px; }
.tl-app > :is(.tl-toolbar, .tl-reclevel, .tl-error, .tl-status) { flex: none; }
@media (max-width: 639px) { .tl-app { --tl-hdr-w: 112px; overflow-y: auto; } .tl-app > .tl-arrange { flex: none; height: 52vh; } .tl-app > .tl-dock { flex: none; min-height: 0; } .tl-app .tl-panel { overflow: visible; } }

/* Platform element defaults leak into app workspaces: reset at zero specificity. */
:where(.tl-app) button { font: inherit; font-weight: 600; padding: 0; border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer; width: auto; min-height: 0; margin: 0; }
:where(.tl-app) button:hover { background: none; }
:where(.tl-app) :is(input, select, textarea) { font: inherit; font-size: 14px; color: var(--tl-ink); background: var(--tl-surface); border: 1px solid var(--tl-control); border-radius: 8px; padding: 4px 8px; width: auto; min-height: 0; margin: 0; }
:where(.tl-app) input[type=range] { padding: 0; border: 0; background: none; accent-color: var(--tl-primary); min-width: 0; }
:where(.tl-app) input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--tl-primary); }
:where(.tl-app) table { border-collapse: collapse; width: 100%; margin: 0; font-size: 13px; }
:where(.tl-app) :is(th, td) { text-align: start; padding: 5px 8px; border-bottom: 1px solid var(--tl-line); }
:where(.tl-app) thead th { background: var(--tl-surface-2); color: var(--tl-ink); }
:where(.tl-app) caption { text-align: start; font-weight: 600; padding: 4px 0; }
:where(.tl-app) kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; padding: 1px 6px; border: 1px solid var(--tl-control); border-radius: 5px; background: var(--tl-surface-2); color: var(--tl-ink); white-space: nowrap; }
:where(.tl-app) h2, :where(.tl-app) h3 { margin: 0; }
:where(.tl-app) p { margin: 0; }
.tl-app [hidden] { display: none !important; }
.tl-app :focus-visible { outline: 3px solid var(--tl-focus); outline-offset: 1px; }
.tl-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* buttons */
.tl-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid color-mix(in srgb, var(--tl-ink) 35%, transparent); border-radius: 8px; background: var(--tl-surface); color: var(--tl-ink); white-space: nowrap; }
.tl-btn:hover { background: var(--tl-surface-2); }
.tl-btn-primary { background: var(--tl-primary); border-color: var(--tl-primary); color: var(--tl-on-accent); }
.tl-btn-primary:hover { background: var(--tl-primary); filter: brightness(1.08); }
.tl-btn-danger { color: var(--tl-danger); }
.tl-btn-small { min-height: 30px; padding: 0 8px; font-size: 13px; }
.tl-btn:disabled, .tl-icon-btn:disabled { opacity: .45; cursor: default; }
.tl-icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--tl-ink); }
.tl-icon-btn:hover:not(:disabled) { background: var(--tl-surface-2); }
.tl-icon-small { width: 30px; height: 30px; }

/* toolbar */
.tl-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 6px 10px; background: var(--tl-surface); border-bottom: 1px solid var(--tl-line); }
.tl-tgroup { display: flex; align-items: center; gap: 4px; }
.tl-tgroup-end { margin-inline-start: auto; gap: 10px; }
.tl-transport-btn { display: inline-grid; place-items: center; width: 40px; height: 36px; border-radius: 8px; color: var(--tl-ink); }
.tl-transport-btn:hover { background: var(--tl-surface-2); }
.tl-transport-btn[aria-pressed="true"] { background: var(--tl-info-bg); color: var(--tl-primary-text); box-shadow: inset 0 0 0 1px var(--tl-info-line); }
.tl-play { background: var(--tl-primary); color: var(--tl-on-accent); }
.tl-play:hover { background: var(--tl-primary); filter: brightness(1.08); }
.tl-rec { color: var(--tl-rec); }
.tl-rec.is-on { background: var(--tl-rec); color: #fff; }
.tl-pos-out { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; padding: 4px 8px; background: var(--tl-surface-2); border-radius: 6px; white-space: pre; min-width: 17ch; }
.tl-tempo { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.tl-tempo-in { width: 5.5em; }
.tl-audio-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--tl-control); color: var(--tl-ink); background: var(--tl-surface); }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tl-muted); }
.tl-audio-badge.is-on .tl-dot { background: var(--tl-meter); }
.tl-cpu { font-variant-numeric: tabular-nums; color: var(--tl-muted); font-size: 13px; }
.tl-cpu.is-high { color: var(--tl-warning); font-weight: 700; }
.tl-reclevel { display: flex; align-items: center; gap: 8px; padding: 4px 12px; background: var(--tl-danger-bg); color: var(--tl-ink); }
.tl-reclevel meter { width: 200px; }
.tl-error { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 6px 12px; background: var(--tl-danger-bg); color: var(--tl-ink); border-bottom: 1px solid var(--tl-danger); }

/* menus */
.tl-menu-wrap { position: relative; }
.tl-menu-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 10px; border-radius: 8px; color: var(--tl-ink); }
.tl-menu-btn:hover, .tl-menu-btn[aria-expanded="true"] { background: var(--tl-surface-2); }
.tl-menu { position: absolute; inset-inline-start: 0; top: calc(100% + 4px); z-index: 50; min-width: 250px; max-height: 70vh; overflow: auto; padding: 4px; background: var(--tl-surface); border: 1px solid var(--tl-line); border-radius: 10px; box-shadow: var(--shadow-2); }
.tl-menu-item { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 6px; width: 100%; min-height: 32px; padding: 0 8px; border-radius: 6px; text-align: start; font-weight: 500; color: var(--tl-ink); }
.tl-menu-item:hover, .tl-menu-item:focus { background: var(--tl-surface-2); }
.tl-menu-item[aria-disabled="true"] { opacity: .5; cursor: default; }
.tl-menu-check { color: var(--tl-primary-text); }
.tl-menu-key { color: var(--tl-muted); font-size: 12px; }
.tl-menu-sep { height: 1px; margin: 4px 6px; background: var(--tl-line); }

/* arrange */
.tl-arrange { position: relative; overflow: auto; min-height: 0; background: var(--tl-lane-alt); border-bottom: 1px solid var(--tl-line); }
.tl-content { position: relative; min-width: 100%; }
.tl-ruler-row { position: sticky; top: 0; z-index: 6; display: flex; height: 28px; background: var(--tl-surface); border-bottom: 1px solid var(--tl-line); }
.tl-corner { position: sticky; left: 0; z-index: 7; flex: none; width: var(--tl-hdr-w); background: var(--tl-surface); border-inline-end: 1px solid var(--tl-line); }
.tl-ruler-wrap { position: relative; flex: 1; cursor: pointer; }
.tl-ruler { position: relative; height: 100%; }
.tl-tick { position: absolute; top: 0; bottom: 0; padding: 6px 4px 0; border-left: 1px solid var(--tl-bar); font-size: 12px; color: var(--tl-muted); font-variant-numeric: tabular-nums; }
.tl-loopbar { position: absolute; top: 0; height: 8px; background: var(--tl-primary); opacity: .7; border-radius: 0 0 4px 4px; pointer-events: none; }
.tl-row { display: flex; min-height: 64px; border-bottom: 1px solid var(--tl-line); }
.tl-header { position: sticky; left: 0; z-index: 5; flex: none; width: var(--tl-hdr-w); display: grid; grid-template-columns: 6px 1fr; grid-template-rows: auto auto 4px; gap: 2px 6px; padding: 6px 6px 4px 0; background: var(--tl-surface); border-inline-end: 1px solid var(--tl-line); }
.tl-header.is-selected, .tl-row.is-selected .tl-header { background: var(--tl-info-bg); }
.tl-swatch { width: 6px; border-radius: 0 3px 3px 0; grid-row: 1 / 4; }
.tl-header .tl-swatch { height: 100%; }
.tl-strip-name .tl-swatch { display: inline-block; height: 14px; border-radius: 3px; margin-inline-end: 6px; vertical-align: middle; }
.tl-hname { display: flex; align-items: center; gap: 6px; min-width: 0; min-height: 28px; padding: 0 4px; text-align: start; font-weight: 600; color: var(--tl-ink); border-radius: 6px; }
.tl-hname span:not(.tl-sr) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-hname:hover { background: var(--tl-surface-2); }
.tl-hbtns { display: flex; gap: 3px; flex-wrap: wrap; }
.tl-hbtn { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 5px; border-radius: 6px; border: 1px solid var(--tl-control); font-size: 12px; color: var(--tl-ink); background: var(--tl-surface); }
.tl-hbtn[aria-pressed="true"] { background: var(--tl-info-bg); color: var(--tl-primary-text); border-color: var(--tl-info-line); }
.tl-mute[aria-pressed="true"] { background: #fef3c7; color: #78350f; border-color: #b45309; }
.tl-solo[aria-pressed="true"] { background: #dcfce7; color: #14532d; border-color: #15803d; }
.tl-arm[aria-pressed="true"] { background: var(--tl-rec); color: #fff; border-color: var(--tl-rec); }
.tl-hmeter { grid-column: 2; height: 4px; background: var(--tl-surface-2); border-radius: 2px; overflow: hidden; }
.tl-hmeter-fill { display: block; height: 100%; background: var(--tl-meter); transform-origin: left; transform: scaleX(0); }
.tl-lane { position: relative; flex: none; min-height: 64px; background-color: var(--tl-lane); background-image: linear-gradient(to right, var(--tl-grid) 1px, transparent 1px); background-size: 32px 100%; }
.tl-clip { position: absolute; top: 4px; height: 56px; display: flex; flex-direction: column; overflow: hidden; padding: 0; border-radius: 6px; border: 1px solid rgb(0 0 0 / .25); text-align: start; cursor: grab; touch-action: none; }
.tl-clip.is-selected { outline: 3px solid var(--tl-focus); outline-offset: 0; z-index: 2; }
.tl-clip.is-muted { opacity: .5; }
.tl-clip-name { flex: none; display: flex; align-items: center; gap: 4px; height: 18px; line-height: 18px; padding: 0 6px; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.tl-clip-canvas { display: block; flex: 1; }
.tl-handle { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.tl-handle-l { left: 0; }
.tl-handle-r { right: 0; }
.tl-handle:hover { background: rgb(0 0 0 / .12); }
.tl-c0 { background: var(--tl-c0); color: var(--tl-c0-ink); } .tl-c1 { background: var(--tl-c1); color: var(--tl-c1-ink); } .tl-c2 { background: var(--tl-c2); color: var(--tl-c2-ink); } .tl-c3 { background: var(--tl-c3); color: var(--tl-c3-ink); }
.tl-c4 { background: var(--tl-c4); color: var(--tl-c4-ink); } .tl-c5 { background: var(--tl-c5); color: var(--tl-c5-ink); } .tl-c6 { background: var(--tl-c6); color: var(--tl-c6-ink); } .tl-c7 { background: var(--tl-c7); color: var(--tl-c7-ink); }
.tl-swatch.tl-c0 { background: var(--tl-c0-ink); } .tl-swatch.tl-c1 { background: var(--tl-c1-ink); } .tl-swatch.tl-c2 { background: var(--tl-c2-ink); } .tl-swatch.tl-c3 { background: var(--tl-c3-ink); }
.tl-swatch.tl-c4 { background: var(--tl-c4-ink); } .tl-swatch.tl-c5 { background: var(--tl-c5-ink); } .tl-swatch.tl-c6 { background: var(--tl-c6-ink); } .tl-swatch.tl-c7 { background: var(--tl-c7-ink); }
.tl-playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: var(--tl-playhead); z-index: 8; pointer-events: none; }
.tl-empty { padding: 24px; position: sticky; left: 0; max-width: 640px; }
.tl-empty-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tl-auto-row { min-height: 56px; background: var(--tl-surface); }
.tl-auto-head { position: sticky; left: 0; z-index: 5; flex: none; width: var(--tl-hdr-w); display: flex; flex-direction: column; gap: 4px; padding: 4px 6px; background: var(--tl-surface-2); border-inline-end: 1px solid var(--tl-line); }
.tl-auto-select { max-width: 100%; font-size: 12px !important; }
.tl-auto-count { font-size: 12px; color: var(--tl-muted); }
.tl-auto-lane { position: relative; flex: none; height: 56px; background: var(--tl-lane-alt); cursor: crosshair; }
.tl-auto-svg { display: block; }
.tl-auto-line { stroke: var(--tl-primary); stroke-width: 2; }
.tl-auto-pt { fill: var(--tl-surface); stroke: var(--tl-primary); stroke-width: 2; cursor: move; }

/* dock */
.tl-dock { display: flex; flex-direction: column; min-height: 0; background: var(--tl-surface); }
.tl-tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--tl-line); overflow-x: auto; flex: none; }
.tl-tabs [role=tab] { min-height: 40px; padding: 0 12px; border-radius: 0; color: var(--tl-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tl-tabs [role=tab][aria-selected="true"] { color: var(--tl-ink); border-bottom-color: var(--tl-primary); }
.tl-panel { flex: 1; min-height: 0; overflow: auto; position: relative; }
.tl-panel-body { padding: 12px; }
.tl-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 10px 18px; align-items: start; }
.tl-form-grid > * { min-width: 0; }
.tl-field { display: grid; gap: 4px; }
.tl-field label { font-weight: 600; }
.tl-param { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 2px 8px; align-items: center; }
.tl-param label { grid-column: 1 / 3; font-weight: 600; font-size: 13px; }
.tl-param input[type=range] { width: 100%; }
.tl-param-num { display: inline-flex; align-items: center; gap: 4px; }
.tl-num { width: 5.5em; }
.tl-unit { color: var(--tl-muted); font-size: 12px; }
.tl-check { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.tl-hint { color: var(--tl-muted); font-size: 13px; }
.tl-warn { color: var(--tl-warning); font-weight: 600; }
.tl-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tl-table-wrap { position: relative; overflow-x: auto; max-width: 100%; }

/* mixer */
.tl-strips { display: flex; gap: 8px; align-items: stretch; overflow-x: auto; padding-bottom: 4px; }
.tl-strip { flex: none; width: 190px; display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--tl-line); border-radius: 10px; background: var(--tl-surface); }
.tl-strip.is-selected { border-color: var(--tl-info-line); background: var(--tl-info-bg); }
.tl-strip-bus { background: var(--tl-surface-2); }
.tl-strip-master { border-color: var(--tl-line-strong); }
.tl-strip-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-strip-meter { display: flex; gap: 3px; height: 44px; align-items: flex-end; padding: 2px; background: var(--tl-surface-2); border-radius: 4px; }
.tl-strip-meter span { flex: 1; height: 100%; background: linear-gradient(to top, var(--tl-meter) 75%, var(--tl-meter-hot)); transform-origin: bottom; transform: scaleY(0); border-radius: 2px; }
.tl-strip-btns { display: flex; gap: 4px; }
.tl-strip-btns .tl-hbtn { flex: 1; height: 30px; }
.tl-limit-note { font-size: 12px; color: var(--tl-muted); }
.tl-loud { display: flex; justify-content: space-between; font-size: 12px; color: var(--tl-muted); }
.tl-loud output { font-variant-numeric: tabular-nums; color: var(--tl-ink); }
.tl-insert-box { display: grid; gap: 4px; }
.tl-inserts { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.tl-insert { display: grid; grid-template-columns: 1fr auto auto auto; gap: 2px; align-items: center; padding: 2px; border: 1px solid var(--tl-line); border-radius: 6px; }
.tl-insert.is-off .tl-insert-name { color: var(--tl-muted); text-decoration: line-through; }
.tl-insert-name { min-height: 30px; min-width: 0; padding: 0 6px; text-align: start; color: var(--tl-ink); border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.tl-insert-name:hover { background: var(--tl-surface-2); }
.tl-add-fx { font-size: 13px !important; }

/* keys + roll */
.tl-keys-wrap { grid-column: 1 / -1; display: grid; gap: 8px; }
.tl-keys { position: relative; display: flex; height: 110px; max-width: 100%; overflow-x: auto; direction: ltr; }
.tl-key { flex: none; width: 48px; height: 100%; border: 1px solid var(--tl-line-strong) !important; border-radius: 0 0 6px 6px !important; background: #fff !important; color: #111; }
.tl-key.is-black { width: 24px; height: 64%; margin: 0 -12px; z-index: 1; background: #1f2937 !important; }
.tl-key.is-down { background: var(--tl-info-bg) !important; }
.tl-key.is-black.is-down { background: var(--tl-primary) !important; }
.tl-roll { display: grid; gap: 8px; }
.tl-roll-scroll { position: relative; max-height: 320px; overflow: auto; border: 1px solid var(--tl-line); border-radius: 8px; }
.tl-roll-inner { display: flex; width: max-content; }
.tl-roll-keys { position: sticky; left: 0; z-index: 3; flex: none; width: 44px; background: var(--tl-surface); border-inline-end: 1px solid var(--tl-line); }
.tl-roll-key { height: 14px; font-size: 10px; line-height: 14px; padding-inline-start: 4px; color: var(--tl-muted); border-bottom: 1px solid var(--tl-grid); }
.tl-roll-key.is-black { background: var(--tl-surface-2); }
.tl-roll-key.is-c { color: var(--tl-ink); font-weight: 700; }
.tl-roll-grid { position: relative; flex: none; background-color: var(--tl-lane); background-image: linear-gradient(to right, var(--tl-grid) 1px, transparent 1px), linear-gradient(to bottom, var(--tl-grid) 1px, transparent 1px); cursor: crosshair; touch-action: none; }
.tl-roll-beat { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--tl-grid); }
.tl-roll-beat.is-bar { background: var(--tl-bar); }
.tl-note { position: absolute; background: var(--tl-primary); border: 1px solid rgb(0 0 0 / .3); border-radius: 3px; cursor: move; }
.tl-note.is-selected { outline: 2px solid var(--tl-focus); }
.tl-note-edge { position: absolute; right: 0; top: 0; bottom: 0; width: 6px; cursor: ew-resize; }
.tl-roll-cursor { position: absolute; box-shadow: inset 0 0 0 2px var(--tl-focus); pointer-events: none; display: none; }
.tl-roll-grid:focus-visible .tl-roll-cursor { display: block; }

/* status */
.tl-status { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 4px 12px; font-size: 12px; color: var(--tl-muted); background: var(--tl-surface); border-top: 1px solid var(--tl-line); }
.tl-status-hint { margin-inline-start: auto; }

/* dialogs */
.tl-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--tl-line); border-radius: 14px; background: var(--tl-surface); color: var(--tl-ink); box-shadow: var(--shadow-3); }
.tl-dialog-wide { width: min(860px, calc(100vw - 24px)); }
.tl-dialog::backdrop { background: var(--overlay, rgb(15 23 42 / .5)); }
.tl-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--tl-line); }
.tl-dialog-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; }
.tl-dialog-lede { padding: 8px 16px 0; color: var(--tl-muted); }
.tl-dialog-body { padding: 14px 16px 16px; display: grid; gap: 12px; }
.tl-dialog-body textarea { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.tl-dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tl-templates, .tl-recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tl-templates { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.tl-template, .tl-recent-open { display: grid; gap: 4px; width: 100%; padding: 10px 12px !important; border: 1px solid var(--tl-line) !important; border-radius: 10px !important; text-align: start; color: var(--tl-ink); font-weight: 500 !important; }
.tl-template:hover, .tl-recent-open:hover { background: var(--tl-surface-2) !important; }
.tl-template span, .tl-recent-open span { color: var(--tl-muted); font-size: 13px; }
.tl-recent li { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.tl-export-out { display: grid; gap: 10px; }
.tl-export-item { padding: 10px; border: 1px solid var(--tl-line); border-radius: 10px; display: grid; gap: 6px; }
.tl-dialog progress { width: 100%; }

.tl-app.is-locked .tl-lane, .tl-app.is-locked .tl-roll-grid { cursor: default; }

@media (max-width: 639px) {
  .tl-app { font-size: 15px; }
  .tl-toolbar { gap: 4px 8px; padding: 4px 6px; }
  .tl-tgroup-end { margin-inline-start: 0; }
  .tl-pos-out { min-width: 0; font-size: 12px; }
  .tl-btn, .tl-transport-btn, .tl-icon-btn, .tl-menu-btn { min-height: 44px; }
  .tl-transport-btn, .tl-icon-btn { width: 44px; height: 44px; }
  .tl-hbtn { min-width: 30px; height: 30px; }
  .tl-hname span:not(.tl-sr) { font-size: 13px; }
  .tl-status-hint { display: none; }
  .tl-strip { width: 170px; }
}
