/* ============================================================================
   AI SCENE STUDIO — APPLICATION LAYOUT & COMPONENTS
   Consumes ONLY design tokens from styles/themes.css.
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Ambient glow layer behind everything */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(720px 420px at 50% 120%, var(--canvas-glow), transparent 70%);
  z-index: 0;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Reusable glass panel primitive ---------- */
.glass {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(var(--blur-panel)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--blur-panel)) saturate(150%);
  box-shadow: var(--shadow-panel);
  transition: border-color 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out),
              background 0.45s var(--ease-out);
}
.glass:hover { border-color: var(--panel-border-glow); }

/* ---------- App shell grid ---------- */
.studio {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  height: 100vh;
  padding: 14px 16px 12px;
}

/* ============================ TOP BAR ==================================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  border-radius: var(--radius-xl);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 0 22px -4px var(--accent);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand__title { font-size: 17px; font-weight: 700; }
.brand__sub {
  font-size: 10.5px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.topbar__spacer { flex: 1; }

/* Project selector */
.project-select {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-1);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
}
.project-select select {
  background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: 13px; max-width: 210px;
}
.project-select select option { background: #0b0f24; color: #eef1fb; }

/* Segmented HUD controls */
.hud-group {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface-1);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-pill);
  padding: 4px;
}
.hud-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 12.5px; font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.28s var(--ease-out);
  white-space: nowrap;
}
.hud-btn:hover { background: var(--surface-hover); color: var(--text-primary); }
.hud-btn.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  box-shadow: 0 0 18px -4px var(--accent);
}
.hud-btn__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; opacity: 0.55;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  border: 1px solid var(--panel-border);
  transition: border-color 0.3s var(--ease-out);
}
.theme-toggle:hover { border-color: var(--panel-border-glow); }
.theme-toggle__switch {
  position: relative;
  width: 44px; height: 24px;
  border-radius: var(--radius-pill);
  background: var(--track-video);
  box-shadow: inset 0 0 8px rgba(0,0,0,0.35);
}
.theme-toggle__knob {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff;
  transition: transform 0.4s var(--ease-spring);
  box-shadow: 0 1px 6px rgba(0,0,0,0.4);
}
:root[data-theme='kids'] .theme-toggle__knob { transform: translateX(20px); }
.theme-toggle__label { font-size: 12px; font-weight: 600; letter-spacing: 0.4px; }

/* ============================ WORKSPACE ================================== */
.workspace {
  display: grid;
  grid-template-columns: 264px 1fr 300px;
  gap: 14px;
  min-height: 0;
}
.column { display: flex; flex-direction: column; gap: 14px; min-height: 0; }

.panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--panel-border);
}
.panel__title {
  font-size: 11px; font-weight: 700;
  letter-spacing: 2.2px; text-transform: uppercase;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px;
}
.panel__title::before {
  content: ''; width: 3px; height: 14px; border-radius: 3px;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.panel__body { padding: 14px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.panel__body::-webkit-scrollbar { width: 8px; }
.panel__body::-webkit-scrollbar-thumb {
  background: var(--surface-hover); border-radius: 8px;
}

/* ---------- Asset drawer ---------- */
.asset-upload {
  display: grid; place-items: center;
  gap: 6px;
  padding: 20px 14px;
  margin-bottom: 14px;
  border: 1.5px dashed var(--panel-border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 12px; text-align: center;
  transition: all 0.3s var(--ease-out);
  cursor: pointer;
}
.asset-upload:hover, .asset-upload.is-dragover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--surface-1);
}
.asset-upload strong { color: var(--text-secondary); font-size: 12.5px; }

.asset-list { display: flex; flex-direction: column; gap: 9px; }
.asset-card {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-1);
  border: 1px solid transparent;
  cursor: grab;
  transition: all 0.28s var(--ease-out);
}
.asset-card:hover {
  background: var(--surface-hover);
  border-color: var(--panel-border-glow);
  transform: translateX(3px);
}
.asset-card:active { cursor: grabbing; }
.asset-card__icon {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--track-video);
  font-size: 15px;
}
.asset-card__meta { min-width: 0; flex: 1; }
.asset-card__name {
  font-size: 12.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.asset-card__kind { font-size: 10.5px; color: var(--text-muted); letter-spacing: 0.6px; }

/* ---------- Preview stage ---------- */
.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.stage__viewport {
  position: relative;
  flex: 1;
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
}
.preview-frame {
  position: relative;
  max-width: 100%; max-height: 100%;
  aspect-ratio: 16 / 9;
  width: min(100%, 780px);
  border-radius: var(--radius-md);
  overflow: hidden;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255,255,255,0.015) 0 12px,
      transparent 12px 24px
    ),
    linear-gradient(160deg, #060814, #0b0f26 60%, #05060f);
  border: 1px solid var(--panel-border);
  box-shadow: inset 0 0 60px rgba(0,0,0,0.55);
}
.preview-frame[data-ratio='9:16'] { aspect-ratio: 9 / 16; width: min(100%, 340px); }
.preview-frame[data-ratio='1:1']  { aspect-ratio: 1 / 1;  width: min(100%, 520px); }
#preview-canvas { display: block; width: 100%; height: 100%; }

/* Track-state overlays drawn on top of canvas */
.preview-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
  padding: 18px;
}
.preview-overlay__caption {
  position: absolute;
  left: 50%; bottom: 12%;
  transform: translateX(-50%);
  max-width: 82%;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(4, 8, 20, 0.62);
  backdrop-filter: blur(10px);
  border: 1px solid var(--panel-border);
  font-size: clamp(12px, 2vw, 18px);
  font-weight: 700;
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview-overlay__badge {
  position: absolute; top: 12px; left: 12px;
  display: flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(4, 8, 20, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid var(--panel-border);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-secondary);
}
.rec-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

/* Generation HUD visualizer sits above the canvas */
.hud-visualizer {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden;
  transition: opacity 0.4s var(--ease-out), visibility 0.4s;
  pointer-events: none;
}
.hud-visualizer.is-active { opacity: 1; visibility: visible; }
#hud-canvas { display: block; width: 100%; height: 100%; }
.hud-visualizer__label {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-family: var(--font-mono);
}
.hud-visualizer__pct {
  font-size: clamp(30px, 6vw, 58px);
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  text-shadow: 0 0 28px currentColor;
}
.hud-visualizer__status {
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--text-secondary);
}

/* ---------- Transport controls ---------- */
.transport {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  border-top: 1px solid var(--panel-border);
}
.transport__btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-1);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.25s var(--ease-out);
}
.transport__btn:hover { background: var(--surface-hover); border-color: var(--panel-border-glow); }
.transport__btn--play {
  width: 50px; height: 50px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  border: none;
  box-shadow: 0 0 22px -4px var(--accent);
}
.transport__time {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 1px;
  color: var(--text-secondary);
  min-width: 118px;
}
.transport__spacer { flex: 1; }
.render-btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  font-size: 13px; font-weight: 700; letter-spacing: 0.6px;
  box-shadow: 0 0 24px -6px var(--accent);
  transition: transform 0.25s var(--ease-spring), box-shadow 0.25s;
}
.render-btn:hover { transform: translateY(-2px); box-shadow: 0 0 32px -4px var(--accent); }
.render-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ============================ RIGHT RAIL ================================= */
.field { margin-bottom: 14px; }
.field__label {
  display: block;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.field select, .field input[type='text'], .field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.25s var(--ease-out);
}
.field textarea { resize: vertical; min-height: 76px; font-family: inherit; }
.field select:focus, .field input:focus, .field textarea:focus { border-color: var(--accent); }
.field select option { background: #0b0f24; color: #eef1fb; }

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  border: 1px solid var(--panel-border);
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.25s var(--ease-out);
}
.chip:hover { border-color: var(--panel-border-glow); color: var(--text-primary); }
.chip.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  border-color: transparent;
}

/* ---------- Job queue ---------- */
.job-card {
  padding: 11px 13px;
  margin-bottom: 9px;
  border-radius: var(--radius-md);
  background: var(--surface-1);
  border: 1px solid var(--panel-border);
  transition: border-color 0.3s var(--ease-out);
}
.job-card__top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.job-card__name {
  font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.job-card__provider {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 1px;
  color: var(--text-muted);
}
.status-pill {
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  padding: 4px 9px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
.status-pill[data-status='queued']    { background: rgba(150,165,235,0.18); color: var(--text-secondary); }
.status-pill[data-status='running']   { background: rgba(79,209,197,0.20); color: var(--accent); }
.status-pill[data-status='succeeded'] { background: rgba(78,222,128,0.20); color: #5eea8d; }
.status-pill[data-status='failed']    { background: rgba(255,92,140,0.20); color: #ff6b93; }
.status-pill[data-status='canceled']  { background: rgba(150,150,170,0.16); color: var(--text-muted); }

.progress-track {
  height: 5px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.4s var(--ease-out);
}

/* ============================ TIMELINE ================================== */
.timeline-dock {
  border-radius: var(--radius-xl);
  padding: 0;
  overflow: hidden;
}
.timeline-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--panel-border);
  flex-wrap: wrap;
}
.timeline-toolbar__title {
  font-size: 11px; font-weight: 700;
  letter-spacing: 2.2px; text-transform: uppercase;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px;
}
.timeline-toolbar__title::before {
  content: ''; width: 3px; height: 14px; border-radius: 3px;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.timeline-toolbar__spacer { flex: 1; }
.zoom-control { display: flex; align-items: center; gap: 6px; }
.zoom-control input[type='range'] { width: 110px; accent-color: var(--accent); }

.timeline-scroll {
  overflow-x: auto; overflow-y: hidden;
  background: rgba(0,0,0,0.16);
}
.timeline-scroll::-webkit-scrollbar { height: 10px; }
.timeline-scroll::-webkit-scrollbar-thumb {
  background: var(--surface-hover); border-radius: 10px;
}
.timeline {
  position: relative;
  min-width: 100%;
  padding-bottom: 6px;
}

/* Ruler */
.timeline__ruler {
  position: relative;
  height: var(--ruler-h);
  margin-left: var(--track-header-w);
  border-bottom: 1px solid var(--panel-border);
  background: var(--track-grid);
}
.ruler-tick {
  position: absolute; top: 0; bottom: 0;
  border-left: 1px solid var(--track-grid);
}
.ruler-tick__label {
  position: absolute; top: 9px; left: 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Tracks */
.track {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--track-grid);
}
.track:last-child { border-bottom: none; }
.track__header {
  width: var(--track-header-w);
  flex: 0 0 var(--track-header-w);
  padding: 10px 14px;
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  background: var(--surface-1);
  border-right: 1px solid var(--panel-border);
  position: sticky; left: 0; z-index: 3;
}
.track__name {
  font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.8px;
  display: flex; align-items: center; gap: 7px;
}
.track__swatch {
  width: 10px; height: 10px; border-radius: 3px;
  background: var(--track-color, var(--accent));
  box-shadow: 0 0 10px -1px var(--track-color, var(--accent));
}
.track__hint { font-size: 10px; color: var(--text-muted); letter-spacing: 0.4px; }
.track[data-track='text']  .track__header { --track-color: #ffd166; }
.track[data-track='video'] .track__header { --track-color: var(--accent); }
.track[data-track='audio'] .track__header { --track-color: var(--accent-2); }

.track__lane {
  position: relative;
  flex: 1;
  height: var(--track-h);
  background-image: linear-gradient(90deg, var(--track-grid) 1px, transparent 1px);
  background-size: var(--px-per-second) 100%;
}
.track__lane.is-drop-target::after {
  content: '';
  position: absolute; inset: 0;
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  pointer-events: none;
}

/* Clips */
.clip {
  position: absolute;
  top: 8px;
  height: calc(var(--track-h) - 16px);
  border-radius: 10px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  border: 1.5px solid var(--clip-border, var(--panel-border));
  background: var(--clip-bg, var(--surface-2));
  box-shadow: 0 8px 22px -12px rgba(0,0,0,0.9);
  transition: box-shadow 0.25s var(--ease-out), transform 0.2s var(--ease-out);
  min-width: 26px;
}
.clip:hover { box-shadow: 0 0 0 2px var(--panel-border-glow), 0 10px 26px -10px rgba(0,0,0,0.9); }
.clip.is-selected {
  box-shadow: 0 0 0 2px var(--accent), 0 0 22px -4px var(--accent);
  z-index: 2;
}
.clip.is-dragging { opacity: 0.85; cursor: grabbing; z-index: 5; }
.clip[data-track='video'] {
  --clip-bg: var(--track-video);
  --clip-border: color-mix(in srgb, var(--accent-2) 55%, transparent);
}
.clip[data-track='text'] {
  --clip-bg: var(--track-text);
  --clip-border: rgba(255,209,102,0.55);
}
.clip[data-track='audio'] {
  --clip-bg: var(--track-audio);
  --clip-border: color-mix(in srgb, var(--accent-2) 60%, transparent);
}
.clip__inner {
  position: relative; height: 100%;
  padding: 8px 10px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: var(--accent-contrast);
}
:root[data-theme='noir'] .clip__inner { color: #fff; }
.clip__label {
  font-size: 11.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 5px rgba(0,0,0,0.35);
}
.clip__meta {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.6px;
  opacity: 0.9;
  display: flex; gap: 8px;
}
/* Waveform flourish for audio clips */
.clip[data-track='audio'] .clip__inner::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 16px;
  background:
    repeating-linear-gradient(90deg,
      rgba(255,255,255,0.55) 0 2px,
      transparent 2px 4px);
  mask-image: linear-gradient(180deg, transparent, #000);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000);
  opacity: 0.5;
}
/* Trim handles */
.clip__handle {
  position: absolute; top: 0; bottom: 0;
  width: 9px;
  cursor: ew-resize;
  background: rgba(0,0,0,0.24);
  opacity: 0; transition: opacity 0.2s;
}
.clip:hover .clip__handle, .clip.is-selected .clip__handle { opacity: 1; }
.clip__handle--left  { left: 0; border-radius: 9px 0 0 9px; }
.clip__handle--right { right: 0; border-radius: 0 9px 9px 0; }
.clip__handle::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 2px; height: 18px; border-radius: 2px;
  background: currentColor; opacity: 0.7;
}

/* Playhead */
.playhead {
  position: absolute; top: 0; bottom: 0;
  width: 2px;
  background: var(--playhead);
  box-shadow: 0 0 14px var(--playhead);
  z-index: 6;
  pointer-events: none;
}
.playhead::before {
  content: '';
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 9px solid var(--playhead);
}
.timeline__scrub {
  position: absolute; top: 0; left: 0; right: 0;
  height: var(--ruler-h);
  margin-left: var(--track-header-w);
  cursor: ew-resize;
  z-index: 7;
}

/* ============================ MODAL ==================================== */
.modal-backdrop {
  position: fixed; inset: 0;
  z-index: 80;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(2, 4, 12, 0.68);
  backdrop-filter: blur(8px);
  animation: fade-in 0.25s var(--ease-out);
}
.modal-backdrop[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(100%, 540px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px 24px 24px;
  border-radius: var(--radius-lg);
  border-color: var(--panel-border-glow);
  animation: modal-in 0.35s var(--ease-spring);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.modal__title {
  font-size: 17px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-body);
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-primary);
  background: none;
  -webkit-text-fill-color: currentColor;
}
.modal__title i { color: var(--accent); }
.modal__close {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-secondary);
  background: var(--surface-1);
  border: 1px solid var(--panel-border);
  transition: all 0.25s var(--ease-out);
}
.modal__close:hover { background: var(--surface-hover); color: var(--text-primary); }
.modal__lede {
  font-size: 12.5px; color: var(--text-secondary);
  margin: 0 0 18px; line-height: 1.55;
}

.field__hint {
  font-size: 10.5px; color: var(--text-muted);
  margin: 6px 0 0;
}
.field__hint code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 1px 5px; border-radius: 4px;
  font-size: 10px;
}

/* Auth method tabs */
.tabs {
  display: flex; gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  border-radius: var(--radius-pill);
  background: var(--surface-1);
  border: 1px solid var(--panel-border);
}
.tab {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-pill);
  font-size: 12.5px; font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.28s var(--ease-out);
}
.tab:hover { color: var(--text-primary); }
.tab[aria-selected='true'] {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-contrast);
  box-shadow: 0 0 16px -5px var(--accent);
}
.tab-panel { animation: fade-in 0.25s var(--ease-out); }

.secret-input { position: relative; }
.secret-input input { padding-right: 44px; }
.secret-input__toggle {
  position: absolute; top: 50%; right: 6px;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--text-muted);
  transition: color 0.2s;
}
.secret-input__toggle:hover { color: var(--text-primary); }

.modal__status {
  min-height: 18px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 10px;
}
.modal__status[data-state='ok']    { color: #5eea8d; }
.modal__status[data-state='error'] { color: #ff6b93; }
.modal__status[data-state='busy']  { color: var(--accent); }

.modal__warning {
  display: flex; gap: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 11.5px; line-height: 1.55;
  color: var(--text-secondary);
  background: rgba(255, 92, 140, 0.08);
  border: 1px solid rgba(255, 92, 140, 0.28);
  border-radius: var(--radius-md);
}
.modal__warning i { color: #ff6b93; margin-top: 2px; }
.modal__warning code {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--surface-2);
  padding: 1px 5px; border-radius: 4px;
}
.modal__warning strong { color: var(--text-primary); }

.modal__actions { display: flex; align-items: center; gap: 10px; }

/* ============================ TOASTS ==================================== */
.toast-stack {
  position: fixed; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 60;
  max-width: 340px;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--panel-bg-strong);
  border: 1px solid var(--panel-border-glow);
  backdrop-filter: blur(var(--blur-panel));
  box-shadow: var(--shadow-panel);
  font-size: 12.5px;
  animation: toast-in 0.4s var(--ease-spring);
}
.toast__title { font-weight: 700; margin-bottom: 3px; }
.toast__msg { color: var(--text-secondary); font-size: 12px; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ============================ RESPONSIVE =============================== */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 220px 1fr 262px; }
}
@media (max-width: 980px) {
  body { overflow: auto; }
  .studio { height: auto; min-height: 100vh; }
  .workspace { grid-template-columns: 1fr; }
  .column--left { order: 2; }
  .column--right { order: 3; }
  .preview-frame { width: min(100%, 560px) !important; }
  .track__header { position: static; }
}
@media (max-width: 620px) {
  .studio { padding: 10px; gap: 10px; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
  .topbar__spacer { display: none; }
  .project-select select { max-width: 130px; }
  .hud-btn span.hud-btn__label { display: none; }
  :root { --track-header-w: 104px; --track-h: 66px; }
  .transport { flex-wrap: wrap; }
}
