/* Civil CAD Lab: full-screen app shell with a persistent guide.
   Builds on the .cad-app chrome in cad-lab.css. Always dark, like desktop CAD. */

:root {
  --bar: #161b22;
  --bar-line: #2a313b;
  --ink: #e6e9ee;
  --muted: #9aa3b2;
  --blue: #3d9bff;
  --blue-soft: rgba(61, 155, 255, .16);
  --green: #3ccf7a;
  --panel: #232a33;
  --panel-2: #1c222a;
  --panel-line: #3a4350;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.cadapp {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: #212830;
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.cadapp .mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.cadapp [hidden] { display: none !important; }

/* ---------- App bar ---------- */
.app-bar {
  display: flex; align-items: center; gap: 12px;
  height: 48px; padding: 0 10px; flex-shrink: 0;
  background: var(--bar); border-bottom: 1px solid var(--bar-line);
}
.ab-btn {
  appearance: none; display: grid; place-items: center;
  width: 34px; height: 34px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.ab-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ab-btn:hover { color: var(--ink); border-color: var(--bar-line); background: #1f252e; }
.ab-btn[aria-pressed="true"] { color: #8fc3ff; background: var(--blue-soft); }
.ab-brand { color: var(--ink); text-decoration: none; font-weight: 700; font-size: .82rem; letter-spacing: .14em; white-space: nowrap; }
.ab-brand:hover { color: #8fc3ff; }
.ab-lesson {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 12px;
}
.ab-lesson-id { font-size: .68rem; letter-spacing: .12em; color: #8fc3ff; text-transform: uppercase; white-space: nowrap; }
.ab-lesson-title { font-size: .9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-pips { display: flex; gap: 3px; }
.ab-pips i { width: 14px; height: 4px; background: #39414d; }
.ab-pips i.done { background: var(--green); }
.ab-pips i.now { background: var(--blue); }
.ab-right { display: flex; align-items: center; gap: 4px; }
.ab-link { color: var(--muted); text-decoration: none; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; padding: 0 10px; }
.ab-link:hover { color: var(--ink); }

/* ---------- Workspace fills the rest ---------- */
.cadapp .cad-app { flex: 1; min-height: 0; }
.cadapp .cad-viewport { flex: 1; min-height: 0; }
.cadapp .cad-cmd { right: auto; width: min(760px, calc(100% - 24px)); }

/* ---------- Lab body: workspace + docked guide ---------- */
.lab-body { flex: 1; min-height: 0; display: flex; }
.cadapp .lab-body .cad-app { flex: 1; min-width: 0; }

/* ---------- Guide (docked tutorial panel) ---------- */
.teacher {
  width: 380px; flex-shrink: 0;
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border-left: 1px solid var(--bar-line);
  color: var(--ink); user-select: text;
}
.t-head {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 6px 0 16px; flex-shrink: 0;
  background: var(--panel-2); border-bottom: 1px solid var(--panel-line);
}
.t-label { font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: #8fc3ff; font-weight: 700; }
.t-lesson { flex: 1; font-size: .66rem; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-icon {
  appearance: none; display: grid; place-items: center; width: 28px; height: 28px;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.t-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.t-icon:hover { color: var(--ink); border-color: var(--panel-line); }

.guide-rail {
  width: 36px; flex-shrink: 0; border: 0; border-left: 1px solid var(--bar-line);
  background: var(--panel-2); color: var(--muted); cursor: pointer;
  writing-mode: vertical-rl; text-orientation: mixed; padding: 14px 0;
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; text-align: start;
}
.guide-rail:hover { color: var(--ink); background: var(--panel); }
.guide-rail b { color: #8fc3ff; }

.t-body { flex: 1; padding: 18px 18px 16px; overflow-y: auto; min-height: 0; }
.t-body h2 { margin: 0 0 8px; font-size: 1.12rem; line-height: 1.3; letter-spacing: -.01em; }
.t-body p { margin: 0 0 10px; font-size: .88rem; line-height: 1.55; color: #c9cfd8; }
.t-body code {
  font-family: "IBM Plex Mono", monospace; font-size: .86em; font-weight: 600;
  padding: 0 4px; background: rgba(61, 155, 255, .16); color: #fff;
}
.t-meta { display: flex; gap: 14px; margin: 4px 0 14px; font: 600 .68rem "IBM Plex Mono", monospace; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.t-btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border: 1px solid var(--blue); background: var(--blue); color: #fff;
  font: 700 .74rem "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
}
.t-btn:hover { background: #2f8af0; }
.t-btn.ghost { background: transparent; color: #8fc3ff; }
.t-btn.ghost:hover { background: var(--blue-soft); }
.t-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.t-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.t-step-no { font: 700 .68rem "IBM Plex Mono", monospace; letter-spacing: .12em; color: #8fc3ff; text-transform: uppercase; white-space: nowrap; }
.t-bar { flex: 1; height: 4px; background: #39414d; position: relative; }
.t-bar i { position: absolute; inset: 0 auto 0 0; background: var(--green); transition: width .3s ease; }
.t-step { line-height: 1.55; }
.t-step b { color: #fff; }

.t-asking {
  margin: 0 0 12px; padding: 9px 11px; border-left: 2px solid var(--blue); background: rgba(61, 155, 255, .08);
  font-size: .84rem; line-height: 1.5; color: #d4dae3;
}
.t-asking .mono { display: block; font-size: .62rem; letter-spacing: .14em; color: #8fc3ff; text-transform: uppercase; margin-bottom: 2px; }
.t-hint-btn {
  appearance: none; border: 0; background: none; padding: 0; cursor: pointer;
  font: 600 .7rem "IBM Plex Mono", monospace; letter-spacing: .06em; color: #8fc3ff; text-transform: uppercase;
}
.t-hint { margin-top: 8px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--panel-line); font-size: .84rem; line-height: 1.5; color: #c9cfd8; }
.t-flash { animation: tflash .7s ease; }
@keyframes tflash { 0% { box-shadow: inset 0 0 0 2px var(--green); } 100% { box-shadow: inset 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .t-flash { animation: none; } .t-bar i { transition: none; } }

.t-kicker { display: flex; gap: 12px; margin-bottom: 6px; font: 700 .64rem "IBM Plex Mono", monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.t-kicker b { color: #8fc3ff; font-weight: 700; }
.t-intro { font-size: .88rem; }
.t-section { margin: 18px 0 8px; font: 700 .62rem "IBM Plex Mono", monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.t-list { list-style: none; margin: 0; padding: 0; counter-reset: ts; border-top: 1px solid var(--panel-line); }
.t-list > li { counter-increment: ts; position: relative; padding: 10px 0 10px 30px; border-bottom: 1px solid var(--panel-line); font-size: .84rem; line-height: 1.5; color: #7c8594; }
.t-list > li::before {
  content: counter(ts, decimal-leading-zero); position: absolute; left: 0; top: 10px; width: 20px;
  font: 600 .68rem/1.9 "IBM Plex Mono", monospace; color: #6f7888;
}
.t-list > li.complete { color: #8a93a2; }
.t-list > li.complete::before { content: "\2713"; color: var(--green); font-size: .8rem; }
.t-list > li.current { color: var(--ink); background: rgba(61, 155, 255, .06); margin: 0 -18px; padding-left: 48px; padding-right: 18px; box-shadow: inset 2px 0 0 var(--blue); }
.t-list > li.current::before { left: 18px; color: #8fc3ff; }
.t-list > li.current .t-step { font-size: .96rem; margin-bottom: 10px; }
.t-list > li .t-step { margin: 0; font-size: inherit; color: inherit; }
.t-habit { margin-top: 18px; padding: 12px 13px; border: 1px solid var(--panel-line); background: var(--panel-2); }
.t-habit .mono { display: block; margin-bottom: 4px; font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: #ffd84a; }
.t-habit p { margin: 0; font-size: .84rem; }

.t-done { border: 1px solid rgba(60, 207, 122, .45); background: rgba(60, 207, 122, .08); padding: 12px 13px; margin-bottom: 12px; }
.t-done .mono { display: block; font-size: .66rem; letter-spacing: .14em; color: var(--green); text-transform: uppercase; margin-bottom: 4px; }
.t-done p { margin: 0; }

.t-foot {
  display: flex; justify-content: space-between; padding: 8px 12px; flex-shrink: 0;
  border-top: 1px solid var(--panel-line); background: var(--panel-2);
}
.t-link {
  appearance: none; border: 0; background: none; padding: 2px 0; cursor: pointer;
  font: 600 .68rem "IBM Plex Mono", monospace; letter-spacing: .06em; color: var(--muted); text-transform: uppercase;
}
.t-link:hover { color: var(--ink); }
.t-link[aria-expanded="true"] { color: #8fc3ff; }

/* ---------- Lesson drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(5, 8, 12, .5); z-index: 20; }
.lesson-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 21; width: min(380px, 92vw);
  display: flex; flex-direction: column; background: var(--bar); border-right: 1px solid var(--bar-line);
  box-shadow: 10px 0 40px rgba(0, 0, 0, .45);
}
.ld-head { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--bar-line); }
.ld-head .mono { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: #8fc3ff; font-weight: 700; }
.ld-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.ld-group { padding: 12px 16px 4px; font: 700 .64rem "IBM Plex Mono", monospace; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.ld-item {
  appearance: none; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  width: 100%; padding: 10px 16px; border: 0; border-left: 2px solid transparent; background: transparent;
  color: var(--ink); text-align: left; cursor: pointer;
}
.ld-item:hover { background: #1f252e; }
.ld-item[aria-current="true"] { border-left-color: var(--blue); background: #1d2530; }
.ld-num { font: 600 .7rem "IBM Plex Mono", monospace; color: var(--muted); }
.ld-title { font-size: .9rem; line-height: 1.35; }
.ld-sub { display: block; font-size: .76rem; color: var(--muted); margin-top: 2px; }
.ld-state { font: 700 .62rem "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ld-state.done { color: var(--green); }
.ld-soon { opacity: .5; cursor: default; }
.ld-soon:hover { background: transparent; }
.ld-syllabus { padding: 14px 16px; border-top: 1px solid var(--bar-line); color: #8fc3ff; text-decoration: none; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; }
.ld-note { margin: 0; padding: 0 16px 16px; font-size: .7rem; line-height: 1.5; color: #6f7888; }

/* ---------- Small screens ---------- */
.small-screen { display: none; }
@media (max-width: 1100px) { .teacher { width: 330px; } }
@media (max-width: 860px) {
  .small-screen {
    display: block; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30;
    padding: 12px 14px; background: var(--bar); border: 1px solid var(--blue); font-size: .74rem; line-height: 1.5;
  }
  .ab-lesson-title, .ab-pips, .ab-link { display: none; }
  .teacher { width: 300px; }
}

/* cad-lab.css resets .mono inside .cad-app for prompts; guide labels stay uppercase */
.cadapp .teacher .mono, .cadapp .guide-rail { text-transform: uppercase; letter-spacing: .12em; }

/* ---------- Keystroke strip (above the command line) ---------- */
.keys-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  padding: 8px 10px; pointer-events: auto;
  background: rgba(15, 19, 25, .94);
  border: 1px solid rgba(72, 80, 93, .8); border-bottom: 0;
}
.ks-label { margin-right: 4px; font-size: .62rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #ffd84a; }
.ks-key {
  display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 26px; padding: 0 8px;
  font: 600 .84rem "IBM Plex Mono", monospace; color: #fff;
  background: #2d3540; border: 1px solid #5a6472; border-bottom-width: 3px; border-radius: 4px;
}
.ks-act { font-size: .84rem; font-style: italic; color: #c3cad5; }

/* ---------- Interface tour ---------- */
.tour { position: fixed; inset: 0; z-index: 40; }
.tour-spot {
  position: fixed; border: 2px solid var(--blue); border-radius: 3px;
  box-shadow: 0 0 0 9999px rgba(5, 8, 12, .62), 0 0 18px rgba(61, 155, 255, .5);
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease;
  pointer-events: none;
}
.tour-card {
  position: fixed; width: 360px; max-width: calc(100vw - 24px); padding: 18px 20px 16px;
  background: #232a33; border: 1px solid #4a5462; box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  color: var(--ink);
}
.tour-card h3 { margin: 4px 0 8px; font-size: 1.2rem; line-height: 1.3; color: #fff; }
.tour-card p { margin: 0 0 14px; font-size: .95rem; line-height: 1.6; color: #dde2ea; }
.tour-card code, .tour-card kbd {
  font: 600 .86em "IBM Plex Mono", monospace; padding: 0 5px; color: #fff;
  background: #2d3540; border: 1px solid #5a6472; border-radius: 3px;
}
.tc-count { font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #8fc3ff; }
.tc-btns { display: flex; justify-content: flex-end; gap: 8px; }
.tc-btn {
  appearance: none; height: 34px; padding: 0 16px; border: 1px solid var(--blue); background: var(--blue); color: #fff; cursor: pointer;
  font: 700 .74rem "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase;
}
.tc-btn.ghost { background: transparent; color: #8fc3ff; border-color: #4a5462; }
.tc-btn:hover { filter: brightness(1.1); }
@media (prefers-reduced-motion: reduce) { .tour-spot { transition: none; } }

.stab[data-tab="layout"] { cursor: pointer; }
.stab[data-tab="layout"]:hover { color: var(--ink); }

/* ---------- Guide readability: larger type, higher contrast ---------- */
.teacher { width: 400px; }
@media (max-width: 1100px) { .teacher { width: 340px; } }
.t-body { padding: 20px 20px 18px; }
.t-body h2 { font-size: 1.55rem; line-height: 1.22; font-weight: 700; color: #fff; margin: 2px 0 10px; letter-spacing: -.015em; }
.t-body p, .t-intro { font-size: .98rem; line-height: 1.6; color: #dde2ea; }
.t-kicker { color: #b9c1cd; font-size: .7rem; }
.t-kicker b { color: #9fcdff; }
.t-lesson, .t-section { color: #b9c1cd; }
.t-section { font-size: .68rem; }
.t-list > li { font-size: .95rem; line-height: 1.55; color: #b4bcc8; padding-top: 12px; padding-bottom: 12px; }
.t-list > li::before { color: #98a1af; font-size: .74rem; }
.t-list > li.complete { color: #9aa3b0; }
.t-list > li.current { color: #fff; margin: 0 -20px; padding-left: 50px; padding-right: 20px; background: rgba(61, 155, 255, .1); box-shadow: inset 3px 0 0 var(--blue); }
.t-list > li.current::before { left: 20px; color: #9fcdff; }
.t-list > li.current .t-step { font-size: 1.06rem; line-height: 1.55; }
.t-body code { font-size: .9em; padding: 1px 5px; background: rgba(61, 155, 255, .22); border-radius: 3px; }
.t-asking { font-size: .92rem; color: #e6ebf2; background: rgba(61, 155, 255, .12); }
.t-asking .mono { color: #9fcdff; font-size: .66rem; }
.t-hint-btn { font-size: .74rem; color: #9fcdff; }
.t-hint { font-size: .92rem; color: #dde2ea; }
.t-habit { border-color: #4a5462; }
.t-habit p { font-size: .93rem; color: #dde2ea; }
.t-habit .mono { font-size: .66rem; }
.t-done p { color: #e6ebf2; }
.t-link { color: #b9c1cd; font-size: .72rem; }

/* ---------- Drill mode ---------- */
.t-drill-bar { margin: 14px 0 4px; }
.t-clock { font-size: 1.15rem; font-weight: 700; color: #ffd84a; min-width: 3.4em; }
.t-peeked { padding: 10px 12px; background: rgba(61, 155, 255, .1); box-shadow: inset 3px 0 0 var(--blue); font-size: 1.02rem; line-height: 1.55; color: #fff; margin-bottom: 12px; }
.t-body .t-hint-btn[data-act="peek"] { display: block; margin: 0 0 14px; }
.t-drill-result { border: 1px solid rgba(255, 216, 74, .45); background: rgba(255, 216, 74, .07); padding: 14px; margin: 6px 0 14px; }
.t-drill-result .mono { display: block; font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: #ffd84a; }
.t-clock-big { display: block; font: 700 2.4rem/1.15 "IBM Plex Mono", monospace; color: #fff; margin: 4px 0 6px; }
.t-drill-result p { margin: 0; }
.t-body .t-drill-note { margin: 10px 0 0; font-size: .86rem; color: #b9c1cd; }

/* ---------- Layer Properties palette ---------- */
.layer-pal {
  position: absolute; top: 30px; left: 10px; z-index: 6;
  background: #232a33; border: 1px solid #4a5462; box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  color: var(--ink); font-size: .84rem;
}
.lp-head { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 6px 0 12px; background: #1c222a; border-bottom: 1px solid #3a4350; }
.lp-head .mono { font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #9fcdff; }
.lp-x { appearance: none; border: 0; background: none; color: #b9c1cd; font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 2px 6px; }
.lp-x:hover { color: #fff; }
.lp-table { border-collapse: collapse; margin: 4px 0; }
.lp-table th { padding: 6px 10px; font: 600 .62rem "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; color: #9aa3b2; text-align: left; }
.lp-table td { padding: 3px 10px; border-top: 1px solid #2f3742; }
.lp-table tr.cur td { background: rgba(61, 155, 255, .1); }
.lp-name { font-size: .8rem; color: #fff; white-space: nowrap; }
.lp-cur { appearance: none; width: 26px; height: 22px; border: 1px solid #4a5462; background: #1c222a; color: var(--green); cursor: pointer; font-weight: 700; }
.lp-tog {
  appearance: none; min-width: 62px; height: 24px; padding: 0 8px; cursor: pointer;
  font: 600 .7rem "IBM Plex Mono", monospace; color: #ffd84a; background: rgba(255, 216, 74, .12); border: 1px solid rgba(255, 216, 74, .45);
}
.lp-tog.on { color: #c3cad5; background: transparent; border-color: #4a5462; }
.lp-tog:hover { border-color: #9fcdff; }
.lp-sw { appearance: none; width: 22px; height: 22px; border: 1px solid #6a7482; cursor: pointer; }
.lp-sw:hover { outline: 2px solid #9fcdff; }
.lp-foot { padding: 6px 12px 8px; font-size: .74rem; color: #9aa3b2; border-top: 1px solid #3a4350; }
.lp-head { cursor: grab; user-select: none; touch-action: none; }

/* ---------- Annotation scale (status bar) ---------- */
.anno-pick { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; color: var(--muted); font-size: .7rem; }
.anno-pick select { background: #262d36; color: #e6e9ee; border: 1px solid #3a4350; font: 600 .7rem "IBM Plex Mono", monospace; padding: 1px 4px; }

/* ---------- Plot preview ---------- */
.plot { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; background: rgba(5, 8, 12, .7); padding: 24px; }
.plot-card { width: min(1100px, 100%); background: #232a33; border: 1px solid #4a5462; box-shadow: 0 20px 50px rgba(0, 0, 0, .55); }
.plot-head { display: flex; align-items: center; gap: 14px; height: 40px; padding: 0 8px 0 16px; border-bottom: 1px solid #3a4350; }
.plot-head .mono:first-child { font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #9fcdff; }
.plot-meta { flex: 1; font-size: .72rem; color: #b9c1cd; }
.plot-x { appearance: none; border: 0; background: none; color: #b9c1cd; font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 4px 10px; }
.plot-x:hover { color: #fff; }
.plot-paper { padding: 18px; background: #3a414b; }
.plot-paper canvas { display: block; width: 100%; background: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }
.cad-status .stab { cursor: pointer; }
.cad-status .stab:hover { color: var(--ink); }

/* ---------- Layer palette: new layer and rename ---------- */
.lp-head .mono { margin-right: auto; }
.lp-new {
  appearance: none; display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; margin-right: 6px; cursor: pointer;
  font: 600 .66rem "IBM Plex Mono", monospace; color: #c3cad5; background: transparent; border: 1px solid #4a5462;
}
.lp-new svg { width: 14px; height: 14px; }
.lp-new:hover { color: #fff; border-color: #9fcdff; }
.lp-name { cursor: text; min-width: 130px; }
.lp-edit {
  width: 100%; min-width: 150px; height: 22px; padding: 0 4px; box-sizing: border-box;
  font-size: .8rem; color: #fff; background: #11161c; border: 1px solid #3d9bff; outline: none;
}

/* ---------- Layout tabs: rename and reorder ---------- */
.stab[data-i] { position: relative; user-select: none; touch-action: none; }
.stab-group.dragging .stab[data-i] { cursor: grabbing; }
.stab.drop-before { box-shadow: inset 2px 0 0 #3d9bff; }
.stab.drop-after { box-shadow: inset -2px 0 0 #3d9bff; }
.stab-edit { height: 18px; padding: 0 4px; font-size: .74rem; color: #fff; background: #11161c; border: 1px solid #3d9bff; outline: none; }

/* ---------- Save Drawing As ---------- */
.save-dlg {
  position: absolute; top: 30px; left: 50%; transform: translateX(-50%); z-index: 7; width: min(680px, calc(100% - 20px));
  background: #232a33; border: 1px solid #4a5462; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); color: var(--ink); font-size: .8rem;
}
.save-dlg .lp-head { cursor: default; }
.sd-row { display: flex; align-items: center; gap: 8px; padding: 6px 12px; }
.sd-lab { flex: 0 0 112px; white-space: nowrap; color: #9aa3b2; font-size: .74rem; }
.sd-path { flex: 1; min-width: 0; padding: 3px 6px; background: #11161c; border: 1px solid #3a4350; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-panes { display: grid; grid-template-columns: 290px 1fr; margin: 2px 12px 4px; height: 210px; border: 1px solid #3a4350; background: #1a2027; }
.sd-tree, .sd-files { list-style: none; margin: 0; padding: 4px 0; overflow: auto; }
.sd-tree { border-right: 1px solid #3a4350; }
.sd-dir, .sd-file { appearance: none; display: flex; align-items: center; gap: 6px; width: 100%; padding: 3px 8px; border: 0; background: none; color: #c3cad5; font: inherit; font-size: .76rem; text-align: left; cursor: pointer; white-space: nowrap; }
.sd-dir svg { flex: 0 0 14px; width: 14px; height: 14px; color: #ffd84a; }
.sd-dir:hover, .sd-file:hover { background: rgba(61, 155, 255, .12); color: #fff; }
.sd-dir.cur { background: rgba(61, 155, 255, .25); color: #fff; }
.sd-empty { padding: 6px 10px; color: #6f7886; font-size: .74rem; }
.sd-name { flex: 1; min-width: 0; height: 26px; padding: 0 6px; font-size: .8rem; color: #fff; background: #11161c; border: 1px solid #4a5462; outline: none; }
.sd-name:focus { border-color: #3d9bff; }
.sd-type { flex: 1; color: #c3cad5; font-size: .76rem; }
.sd-btn { appearance: none; flex: 0 0 76px; height: 26px; font: 600 .72rem "IBM Plex Mono", monospace; color: #c3cad5; background: transparent; border: 1px solid #4a5462; cursor: pointer; }
.sd-btn:hover { color: #fff; border-color: #9fcdff; }
.sd-btn.primary { color: #fff; background: #2a6fc0; border-color: #3d9bff; }
.sd-msg { min-height: 1em; padding: 0 12px 4px; color: #ffb86b; font-size: .74rem; }
@media (max-width: 640px) { .sd-panes { grid-template-columns: 1fr; height: 260px; } .sd-tree { border-right: 0; border-bottom: 1px solid #3a4350; } .sd-lab { flex-basis: 72px; } }

/* ---------- Text for search engines and screen readers ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cad-noscript { max-width: 640px; margin: 80px auto; padding: 0 16px; color: #c3cad5; font: 1rem/1.6 Inter, sans-serif; }
.cad-noscript a { color: #9fcdff; }
