/* Fon AI Studio · Labeling mode (v0.11.0)
 *
 * Labeling-specific styles. Reuses the design tokens, .card, .btn, .pill,
 * .toast, .record-orb, .vu, .spinner classes from /style.css.
 * Only NEW classes (.lbl-*, .main-labeling, .pill-link, .badge-*,
 * .btn-tiny, .status-strip, .record-stage) are defined here.
 */

/* =====================================================================
 * Layout — 2-col grid with sane mobile collapse
 * ===================================================================== */
.main-labeling {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 1.25rem;
  align-items: start;
  padding: 1.25rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}
.lbl-side, .lbl-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}
@media (max-width: 960px) {
  .main-labeling {
    grid-template-columns: 1fr;
    padding: 0.875rem;
  }
}

/* =====================================================================
 * Top-bar pill link ("← Studio")
 * ===================================================================== */
.pill-link {
  text-decoration: none;
  color: var(--text-dim);
  font-weight: 500;
}
.pill-link:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-elev);
}
.pill-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

/* =====================================================================
 * Session form
 * ===================================================================== */
.lbl-form {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.lbl-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.lbl-field-inline {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.lbl-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
}
.lbl-field input[type="text"],
.lbl-field textarea,
.lbl-field-inline select,
#lbl-user-text {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 8px);
  background: var(--bg-elev-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.lbl-field input[type="text"]:focus,
.lbl-field textarea:focus,
.lbl-field-inline select:focus,
#lbl-user-text:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.lbl-checkbox {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
  cursor: pointer;
}
.lbl-checkbox input[type="checkbox"] {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.lbl-checkbox span {
  flex: 1;
}
.lbl-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}
.lbl-session-active {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.lbl-session-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  padding: 10px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 8px);
  font-size: 13px;
}
.lbl-session-meta code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}
.lbl-session-meta strong {
  color: var(--accent);
  font-size: 16px;
}

/* =====================================================================
 * Capture / record stage
 * ===================================================================== */
.record-stage {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  padding: 0.5rem 0 0.75rem 0;
}
.record-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}
.record-state {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}
.record-timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* fallback text-input toggle */
.lbl-text-fallback {
  margin-top: 0.5rem;
  padding: 0.5rem 0;
  border-top: 1px dashed var(--border);
}
.lbl-text-fallback summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  padding: 4px 0;
  user-select: none;
}
.lbl-text-fallback summary:hover {
  color: var(--text);
}
.lbl-text-fallback textarea {
  margin-top: 0.5rem;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 8px);
  background: var(--bg-elev-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.lbl-row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* status strip during cascade run */
.status-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 8px 12px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm, 8px);
  font-size: 13px;
  color: var(--text-dim);
}

/* =====================================================================
 * VU meter — match main app, scoped to labeling page
 * (style.css already defines .vu but be explicit just in case)
 * ===================================================================== */
.record-meta .vu {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}
.record-meta .vu > div {
  height: 100%;
  width: 0%;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    color-mix(in srgb, var(--accent) 60%, #f0c419 40%) 70%,
    var(--error, #e74c3c) 100%
  );
  transition: width 60ms linear;
}

/* =====================================================================
 * Turn list (history)
 * ===================================================================== */
.lbl-turn-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  max-height: 360px;
  overflow-y: auto;
}
.lbl-turn-row {
  cursor: pointer;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 8px);
  background: var(--bg-elev-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 120ms ease, background 120ms ease;
}
.lbl-turn-row:hover {
  border-color: var(--border-strong);
  background: var(--bg-elev);
}
.lbl-turn-row.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-elev-2));
}
.lbl-turn-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 12px;
  color: var(--text-mute);
}
.lbl-turn-row-preview {
  font-size: 13px;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.lbl-turn-row-status {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-mute);
  border: 1px solid var(--border);
}
.lbl-turn-row-status.saved {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  border-color: transparent;
}
.lbl-turn-row-route,
.lbl-turn-row-time {
  font-variant-numeric: tabular-nums;
}

/* =====================================================================
 * Turn card with per-stage cards
 * ===================================================================== */
.lbl-stages {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding-bottom: 0.875rem;
}
.lbl-stage {
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 8px);
  background: var(--bg-elev-2);
  padding: 0.75rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.lbl-stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.lbl-stage-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.lbl-stage-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}
.lbl-lang-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-mute);
  border: 1px solid var(--border);
  letter-spacing: 0.04em;
}
.lbl-stage-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.lbl-stage-rowlabel {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
}
.lbl-stage-original {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 8px);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
}
.lbl-stage-row .lbl-alt-select {
  flex: 1;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 8px);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.lbl-stage-row:has(.lbl-alt-select) {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.lbl-stage-row:has(.lbl-alt-select) .lbl-stage-rowlabel {
  flex-basis: 100%;
}
.lbl-stage-correction {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 8px);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
  min-height: 56px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.lbl-stage-correction:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* save bar */
.lbl-save-bar {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
}
.lbl-save-bar textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm, 8px);
  background: var(--bg-elev-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}
#lbl-save-meta {
  font-size: 12px;
}
#lbl-save-meta.warn {
  color: var(--warn, #d97706);
  font-weight: 600;
}

/* =====================================================================
 * Tiny button + route badges
 * ===================================================================== */
.btn-tiny {
  padding: 4px 9px;
  font-size: 12px;
  border-radius: var(--r-sm, 8px);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  color: var(--text-mute);
}
.badge-fon {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  border-color: transparent;
}
.badge-fr {
  background: color-mix(in srgb, var(--brand, #4a6cf7) 16%, transparent);
  color: var(--brand, #4a6cf7);
  border-color: transparent;
}

/* =====================================================================
 * Toast region (parity with /style.css's toast-host if needed)
 * ===================================================================== */
.toast-region {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast-region .toast {
  pointer-events: auto;
}

/* utility */
.muted { color: var(--text-mute); }
.small { font-size: 12px; }
