/*
 * Lab chrome.
 *
 * Loaded only by index.html. This file never loads into app.html, so it cannot
 * style or contaminate the product.
 *
 * The lab's viewport frame is a real width constraint: choosing 390 genuinely
 * renders the 390 composition inside a wider page rather than faking it.
 */

.lab-body {
  margin: 0;
  background: #e9edf3;
  font-family: var(--font-sans);
  height: 100vh;
  overflow: hidden;
}

.lab {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  height: 100vh;
}

/* ------------------------------------------------------------- panel */

.lab__panel {
  display: flex;
  flex-direction: column;
  background: var(--navy-950);
  color: var(--text-inverse);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 0;
}

.lab__head {
  padding: var(--sp-4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.lab__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.lab__logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: var(--r-control);
  background: rgba(57, 207, 232, 0.12);
  color: var(--cyan-400);
}

.lab__logo svg {
  width: 20px;
  height: 20px;
}

.lab__brand div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lab__brand strong {
  font-size: var(--fs-body-sm);
  font-weight: 640;
}

.lab__brand span {
  font-size: 10px;
  color: var(--text-inverse-muted);
  font-variant-numeric: tabular-nums;
}

.lab__scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.lab__group {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding-bottom: var(--sp-3);
}

.lab__group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4) var(--sp-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(232, 238, 247, 0.44);
}

.lab__group-head i {
  font-style: normal;
  font-variant-numeric: tabular-nums;
  color: rgba(232, 238, 247, 0.3);
}

.lab__surfaces {
  display: flex;
  flex-direction: column;
}

.lab__surface {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: var(--sp-2);
  align-items: baseline;
  width: 100%;
  padding: 5px var(--sp-4);
  text-align: left;
  font-size: var(--fs-micro);
  color: rgba(232, 238, 247, 0.66);
  transition: background var(--dur-fast) var(--ease-standard);
}

.lab__surface:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-inverse);
}

.lab__surface.is-active {
  background: rgba(77, 143, 255, 0.16);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--blue-400);
}

.lab__surface.is-blocked .lab__surface-id {
  color: rgba(233, 171, 59, 0.62);
}

.lab__surface-id {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.lab__surface-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* fields */

.lab__fields {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: 0 var(--sp-4) var(--sp-3);
}

.lab__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lab__field--full {
  margin-top: var(--sp-2);
}

.lab__label {
  font-size: 9px;
  font-weight: 640;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 238, 247, 0.42);
}

.lab__hint {
  font-size: 10px;
  color: rgba(232, 238, 247, 0.34);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lab__select,
.lab__input {
  width: 100%;
  height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-inverse);
  font-size: var(--fs-micro);
}

.lab__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238fa3bd' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

.lab__select:focus,
.lab__input:focus {
  outline: none;
  border-color: var(--blue-400);
  background: rgba(255, 255, 255, 0.09);
}

.lab__select option {
  background: var(--navy-900);
  color: var(--text-inverse);
}

.lab__input--mono {
  font-family: var(--font-mono);
  font-size: 10px;
}

.lab__direct {
  display: flex;
  gap: 6px;
}

.lab__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: var(--fs-micro);
  font-weight: 600;
  border: 1px solid transparent;
}

.lab__btn--primary {
  background: var(--blue-500);
  color: #fff;
}

.lab__btn--sm {
  height: 28px;
  flex: none;
}

/* meta footer */

.lab__foot {
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  max-height: 46vh;
  overflow-y: auto;
}

.lab__meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px var(--sp-3);
}

.lab__meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.lab__meta span {
  font-size: 9px;
  color: rgba(232, 238, 247, 0.36);
  letter-spacing: 0.04em;
}

.lab__meta strong {
  font-size: var(--fs-micro);
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-inverse);
  overflow-wrap: anywhere;
}

.lab__meta-positive { color: var(--green-400) !important; }
.lab__meta-warning { color: var(--amber-400) !important; }
.lab__meta-neutral { color: var(--cyan-300) !important; }

.lab__brief {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 10px;
  line-height: 1.5;
  color: rgba(232, 238, 247, 0.5);
}

.lab__problems {
  display: flex;
  gap: 6px;
  margin-top: var(--sp-2);
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(233, 171, 59, 0.14);
  color: var(--amber-400);
  font-size: 10px;
  line-height: 1.4;
}

.lab__problems svg {
  width: 13px;
  height: 13px;
  flex: none;
  margin-top: 1px;
}

/* -------------------------------------------------------------- stage */

.lab__stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.lab__stage-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  height: 34px;
  flex: none;
  padding-inline: var(--sp-4);
  background: #dde3ec;
  border-bottom: 1px solid #c7d0dd;
  font-size: 10px;
  color: var(--muted);
}

.lab__stage-label {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--slate-700);
}

.lab__stage-note {
  margin-left: auto;
  font-style: italic;
}

.lab__frame-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: var(--sp-5);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.lab__frame {
  width: 1440px;
  height: 100%;
  min-height: 760px;
  border: 1px solid #b9c4d3;
  border-radius: var(--r-card);
  background: #fff;
  box-shadow: 0 8px 28px rgba(8, 17, 31, 0.12);
  transition: width var(--dur-base) var(--ease-standard);
}
