/* v0.9.1 TEST LAB - review harness chrome.
 *
 * Loaded ONLY when HTMLHELD_TASKS_TESTLAB=1. Everything here is namespaced
 * `tl-` and the panel itself is position:fixed, so the lab cannot shift, resize
 * or restyle the app it is measuring. The one exception is deliberate and
 * opt-in: the .tl-fw-override and .tl-clamp rules at the bottom, which only
 * bite once the operator actually moves those controls.
 *
 * Colour scheme is intentionally dark and foreign to the app palette: nobody
 * should ever mistake lab chrome for product UI in a screenshot.
 */

.tl-root {
  --tl-bg:        #14161a;
  --tl-bg-2:      #1c1f25;
  --tl-bg-3:      #24282f;
  --tl-line:      #333942;
  --tl-fg:        #e8eaed;
  --tl-fg-dim:    #9aa2ad;
  --tl-accent:    #4da3ff;
  --tl-accent-2:  #ffb44d;
  --tl-danger:    #ff6b6b;
  --tl-ok:        #4ecb71;

  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  background: var(--tl-bg);
  border-left: 1px solid var(--tl-line);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  line-height: 1.45;
  color: var(--tl-fg);
  transition: transform 0.18s ease;
}

.tl-root.tl-left {
  right: auto;
  left: 0;
  border-left: 0;
  border-right: 1px solid var(--tl-line);
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
}

/* Collapsed: slide the panel off-screen but leave the handle reachable. */
.tl-root.tl-collapsed { transform: translateX(100%); }
.tl-root.tl-collapsed.tl-left { transform: translateX(-100%); }

.tl-handle {
  position: absolute;
  top: 50%;
  left: -34px;
  transform: translateY(-50%);
  width: 34px;
  padding: 14px 0;
  background: var(--tl-accent);
  color: #06101c;
  border: 0;
  border-radius: 6px 0 0 6px;
  cursor: pointer;
  font: 700 10px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.14em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}
.tl-root.tl-left .tl-handle {
  left: auto;
  right: -34px;
  border-radius: 0 6px 6px 0;
}
.tl-handle:hover { filter: brightness(1.1); }

/* Header --------------------------------------------------------------- */

.tl-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--tl-bg-2);
  border-bottom: 1px solid var(--tl-line);
  flex: 0 0 auto;
}
.tl-title {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tl-accent);
  margin-right: auto;
}
.tl-iconbtn {
  background: var(--tl-bg-3);
  color: var(--tl-fg-dim);
  border: 1px solid var(--tl-line);
  border-radius: 4px;
  cursor: pointer;
  padding: 3px 7px;
  font-size: 11px;
  line-height: 1.4;
}
.tl-iconbtn:hover { color: var(--tl-fg); border-color: var(--tl-accent); }

/* Tabs ----------------------------------------------------------------- */

.tl-tabs {
  display: flex;
  border-bottom: 1px solid var(--tl-line);
  background: var(--tl-bg-2);
  flex: 0 0 auto;
}
.tl-tab {
  flex: 1;
  padding: 8px 4px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--tl-fg-dim);
  font: 600 11px/1.3 inherit;
  cursor: pointer;
}
.tl-tab:hover { color: var(--tl-fg); }
.tl-tab.is-active { color: var(--tl-accent); border-bottom-color: var(--tl-accent); }

.tl-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
}
.tl-pane { display: none; }
.tl-pane.is-active { display: block; }

/* Controls ------------------------------------------------------------- */

.tl-group { margin-bottom: 16px; }
.tl-group-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tl-fg-dim);
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--tl-line);
}

.tl-ctl { margin-bottom: 10px; }
.tl-ctl-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 3px;
}
.tl-ctl-label { font-weight: 500; }
.tl-ctl-var {
  margin-left: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: var(--tl-fg-dim);
}
.tl-ctl-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--tl-accent-2);
  min-width: 44px;
  text-align: right;
}
.tl-ctl input[type="range"] {
  width: 100%;
  accent-color: var(--tl-accent);
  margin: 0;
}

.tl-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tl-btn {
  flex: 1 1 auto;
  padding: 6px 8px;
  background: var(--tl-bg-3);
  color: var(--tl-fg);
  border: 1px solid var(--tl-line);
  border-radius: 4px;
  cursor: pointer;
  font: 600 11px/1.3 inherit;
  white-space: nowrap;
}
.tl-btn:hover { border-color: var(--tl-accent); }
.tl-btn.is-active { background: var(--tl-accent); border-color: var(--tl-accent); color: #06101c; }
.tl-btn.tl-primary { background: var(--tl-accent); border-color: var(--tl-accent); color: #06101c; }
.tl-btn.tl-primary:hover { filter: brightness(1.1); }
.tl-btn.tl-warn { color: var(--tl-danger); }

.tl-check {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 0;
  cursor: pointer;
}
.tl-check input { accent-color: var(--tl-accent); margin: 0; }
.tl-check span { flex: 1; }
.tl-hint {
  color: var(--tl-fg-dim);
  font-size: 10px;
  line-height: 1.4;
  margin: 6px 0 0;
}
.tl-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--tl-accent-2);
}

.tl-readout {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: var(--tl-bg-2);
  border: 1px solid var(--tl-line);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: var(--tl-fg-dim);
  margin-bottom: 10px;
}
.tl-readout b { color: var(--tl-fg); font-weight: 700; }

/* Notes ---------------------------------------------------------------- */

.tl-notes-form textarea {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  background: var(--tl-bg-2);
  color: var(--tl-fg);
  border: 1px solid var(--tl-line);
  border-radius: 4px;
  padding: 7px 8px;
  font: 400 12px/1.45 inherit;
  box-sizing: border-box;
}
.tl-notes-form textarea:focus {
  outline: none;
  border-color: var(--tl-accent);
}
.tl-kinds { display: flex; gap: 4px; margin: 7px 0; }
.tl-kind {
  flex: 1;
  padding: 5px 2px;
  background: var(--tl-bg-3);
  border: 1px solid var(--tl-line);
  border-radius: 4px;
  color: var(--tl-fg-dim);
  font: 600 10px/1.3 inherit;
  cursor: pointer;
}
.tl-kind.is-active { color: #06101c; }
.tl-kind[data-kind="bug"].is-active      { background: var(--tl-danger); border-color: var(--tl-danger); }
.tl-kind[data-kind="change"].is-active   { background: var(--tl-accent); border-color: var(--tl-accent); }
.tl-kind[data-kind="like"].is-active     { background: var(--tl-ok); border-color: var(--tl-ok); }
.tl-kind[data-kind="question"].is-active { background: var(--tl-accent-2); border-color: var(--tl-accent-2); }

.tl-status { min-height: 15px; font-size: 10px; margin: 6px 0 0; }
.tl-status.is-ok   { color: var(--tl-ok); }
.tl-status.is-err  { color: var(--tl-danger); }

.tl-note {
  border: 1px solid var(--tl-line);
  border-left: 3px solid var(--tl-line);
  border-radius: 4px;
  padding: 7px 8px;
  margin-bottom: 7px;
  background: var(--tl-bg-2);
}
.tl-note[data-kind="bug"]      { border-left-color: var(--tl-danger); }
.tl-note[data-kind="change"]   { border-left-color: var(--tl-accent); }
.tl-note[data-kind="like"]     { border-left-color: var(--tl-ok); }
.tl-note[data-kind="question"] { border-left-color: var(--tl-accent-2); }
.tl-note-text { white-space: pre-wrap; word-break: break-word; margin-bottom: 4px; }
.tl-note-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--tl-fg-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tl-note-del {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: var(--tl-fg-dim);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
}
.tl-note-del:hover { color: var(--tl-danger); }

/* Injected stress cards -------------------------------------------------
 * Faithful to real card markup so density reads true. The dotted outline is
 * the ONLY difference, and it exists so a screenshot can never be mistaken
 * for real data. It is drawn with outline (not border) precisely because
 * outline does not participate in layout - the measured box stays honest.
 */
.tl-lab-card {
  outline: 1px dashed rgba(77, 163, 255, 0.55);
  outline-offset: -1px;
  cursor: default !important;
}
.tl-lab-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
}
.tl-lab-tag {
  font-size: var(--fs-micro, 10px);
  line-height: 1.4;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(120, 130, 145, 0.16);
  color: #5a6472;
  white-space: nowrap;
}

/* Push, do not cover -----------------------------------------------------
 * A floating panel would sit on top of the right edge of the board and the
 * topbar - i.e. on top of the horizontal-scroll boundary and the user menu,
 * which are exactly the things being evaluated. Reserving the width instead
 * means the app is never hidden, and the app simply renders into a narrower
 * viewport, which is itself a useful test. Collapsing releases the space.
 */
html.tl-open body { padding-right: var(--tl-panel-w, 340px); }
html.tl-open.tl-dock-left body { padding-right: 0; padding-left: var(--tl-panel-w, 340px); }
html.tl-open .topbar { padding-right: calc(12px + var(--tl-panel-w, 340px)); }
html.tl-open.tl-dock-left .topbar { padding-right: 12px; padding-left: calc(12px + var(--tl-panel-w, 340px)); }

/* Opt-in overrides ------------------------------------------------------ */

/* Only active once the card-title weight knob is touched. */
html.tl-fw-override .kanban-card-title,
html.tl-fw-override .board-list-row-title {
  font-weight: var(--tl-fw-card) !important;
}

/* Viewport simulation: clamp the app shell to a target width so reflow can be
 * checked without physically resizing the browser. Centred so the clamped
 * shell reads like a narrower screen rather than a stuck panel. */
html.tl-clamp .app-shell {
  max-width: var(--tl-clamp-w);
  margin-inline: auto;
  border-inline: 1px dashed rgba(77, 163, 255, 0.4);
  box-sizing: border-box;
}

@media print {
  .tl-root { display: none !important; }
}

/* v0.10.1 - lab cards must never pass for real work.
   Before this, stress cards rendered byte-identically to database-backed cards
   on /tasks/* and on the boards. Clicking one did nothing, which is exactly
   what "it is still a mockup" feels like from the outside. A dashed edge plus
   a LAB chip makes the distinction impossible to miss without changing the
   density or type metrics the lab exists to evaluate. */

.tl-lab-card {
  border-style: dashed !important;
  border-color: var(--tl-accent, #c2410c) !important;
  opacity: 0.92;
  position: relative;
}

.tl-lab-card::after {
  content: "LAB";
  position: absolute;
  top: 3px;
  right: 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--tl-accent, #c2410c);
  background: var(--tl-accent-soft, #fff1e7);
  border-radius: 3px;
  padding: 0 3px;
  pointer-events: none;
}

.tl-lab-card .kanban-card-title,
.tl-lab-card .board-list-row-title,
.tl-lab-card .tasks-row-title { padding-right: 26px; }

.tl-lab-click-note {
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.35;
  color: var(--tl-accent, #c2410c);
  border-top: 1px dashed var(--tl-accent, #c2410c);
  padding-top: 4px;
}
