:root {
  --bg: #090A0F;
  --panel: #12141D;
  --input: #1E1E24;
  --border: rgba(255, 255, 255, 0.08);
  --cyan: #22D3EE;
  --indigo: #6366F1;
  --text: #F4F4F5;
  --muted: #A1A1AA;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body,
.pane.console,
.pane.theater,
.pane-content {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

a.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  padding: 10px;
  background: var(--panel);
  color: var(--text);
  z-index: 100;
  transition: top 0.2s ease;
}

a.skip-link:focus {
  top: 0;
}

/* Header Bar */
.header-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(180deg, var(--panel) 0%, rgba(17, 17, 20, 0.95) 100%);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.header-brand:hover {
  color: var(--cyan);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* --- Header/Brand SVG Icon Constraints ---
     Ensure all header and brand SVG icons are constrained to 24x24px
     so the logo never blows up full-screen. */
.pane-header .brand-mark,
.pane-header .icon-sun,
.pane-header .icon-moon,
.pane-header svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* Credit Badge */
.credit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.credit-badge .credit-value {
  background: var(--cyan);
  color: var(--bg);
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-variant-numeric: tabular-nums;
}

/* Studio Grid - Two Column Layout */
.studio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .studio-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 2rem;
    padding: 2rem;
  }
}

.studio-main {
  min-width: 0;
}

.studio-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Card Panels */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card-content {
  padding: 1.25rem;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

/* Form Inputs */
.form-group,
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.form-label,
.field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input,
.field-input,
.form-select,
.field-select,
.form-textarea,
.field-textarea,
input[type="range"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
  background: var(--panel);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-select,
.field-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A1A1AA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.7;
}

.form-error,
.field-error {
  font-size: 0.75rem;
  color: #EF4444;
}

.field-input,
.field-textarea,
.field-select,
.field-range {
  width: 100%;
  background: #1E1E24;
}

.wallet-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

/* SVG capping - all non-player SVGs constrained to 24x24 */
svg {
  max-width: 24px;
  max-height: 24px;
}

.char-count {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1;
}

.form-hint,
.field-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Primary Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--input);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #22D3EE 0%, #6366F1 100%);
  color: #6366F1;
  box-shadow: 0 4px 16px rgba(34, 211, 238, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(34, 211, 238, 0.4);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: #1E1E24;
  color: #F4F4F5;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--panel);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-ghost {
  background: #1E1E24;
  color: #F4F4F5;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

.btn-full {
  width: 100%;
}

/* Utility Classes */
.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;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--input);
  border-radius: 4px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}

/* Focus Visible for Accessibility */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: rgba(34, 211, 238, 0.3);
  color: var(--text);
}

/* ==========================================================================
   Stepper Component
   ========================================================================== */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 2rem;
  padding: 0 0.5rem;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  padding: 0 0.5rem;
}

.step-item:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 1.25rem;
  left: 50%;
  right: -50%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.step-item.completed:not(:last-child)::after {
  background: var(--cyan);
}

.step-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--input);
  border: 2px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.875rem;
  z-index: 1;
  transition: all 0.2s ease;
}

.step-item.active .step-circle {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--indigo) 100%);
  border-color: transparent;
  color: var(--bg);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.2);
}

.step-item.completed .step-circle {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--bg);
}

.step-item.completed .step-circle::before {
  content: '✓';
  font-size: 0.75rem;
  font-weight: 700;
}

.step-label {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

.step-item.active .step-label {
  color: var(--text);
  font-weight: 600;
}

.step-item.completed .step-label {
  color: var(--cyan);
}

/* ==========================================================================
   Storyboard List Cards
   ========================================================================== */
.storyboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.storyboard-card {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 1rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.2s ease;
}

.storyboard-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.storyboard-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.storyboard-thumb {
  position: relative;
  width: 120px;
  height: 68px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--input);
  flex-shrink: 0;
}

.storyboard-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.storyboard-thumb .duration-badge {
  position: absolute;
  bottom: 0.375rem;
  right: 0.375rem;
  padding: 0.125rem 0.375rem;
  background: rgba(0, 0, 0, 0.8);
  color: var(--text);
  font-size: 0.625rem;
  font-weight: 600;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}

.storyboard-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.storyboard-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.storyboard-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.storyboard-meta .meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.storyboard-actions {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  align-items: flex-end;
}

.storyboard-actions .btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.storyboard-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--muted);
}

.storyboard-empty svg {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.storyboard-empty p {
  font-size: 0.875rem;
}

/* ==========================================================================
   Cost Summary Bar
   ========================================================================== */
.cost-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 10px;
  margin-top: 1rem;
}

.cost-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
}

.cost-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.cost-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.cost-value {
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.cost-value.credits {
  color: var(--cyan);
}

.cost-total {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}

.cost-total-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cost-total-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
}

.cost-progress {
  flex: 1;
  min-width: 150px;
  max-width: 300px;
  height: 6px;
  background: var(--input);
  border-radius: 3px;
  overflow: hidden;
}

.cost-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--indigo) 100%);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.cost-progress-bar.warning {
  background: linear-gradient(90deg, #F59E0B 0%, #EF4444 100%);
}

.cost-progress-bar.danger {
  background: #EF4444;
}

/* ==========================================================================
   Video Theater
   ========================================================================== */
.video-theater {
  position: relative;
  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.video-theater .video-poster {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 1;
}

.video-theater video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg);
}

.video-theater .video-poster {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 1;
}

.video-theater .video-poster img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.video-theater .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  z-index: 2;
  transition: background 0.2s ease;
}

.video-theater:hover .play-overlay {
  background: rgba(0, 0, 0, 0.2);
}

.video-theater .play-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  transform: scale(1);
}

.video-theater .play-button:hover {
  background: var(--text);
  transform: scale(1.1);
}

.video-theater .play-button svg {
  width: 32px;
  height: 32px;
  color: var(--bg);
  margin-left: 4px;
}

.video-theater .video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
  z-index: 3;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.video-theater:hover .video-controls,
.video-theater.controls-visible .video-controls {
  opacity: 1;
}

.video-theater .control-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.video-theater .progress-container {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.video-theater .progress-bar {
  height: 100%;
  background: var(--cyan);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

.video-theater .progress-container:hover .progress-bar {
  background: var(--text);
}

.video-theater .time-display {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 100px;
  text-align: right;
}

.video-theater .volume-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.video-theater .volume-slider {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  outline: none;
}

.video-theater .volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cyan);
  cursor: pointer;
}

.video-theater .fullscreen-btn {
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.video-theater .fullscreen-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Modal Backdrop & Dialog Drawers
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  max-width: 100%;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.2s ease;
}

.modal-backdrop.visible .modal-dialog {
  transform: scale(1) translateY(0);
}

/* Drawer variants */
.modal-dialog.drawer-bottom {
  width: 100%;
  max-width: 500px;
  max-height: 70vh;
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
}

.modal-backdrop.visible .modal-dialog.drawer-bottom {
  transform: translateY(0);
}

.modal-dialog.drawer-side {
  width: 420px;
  max-width: 90vw;
  height: 90vh;
  max-height: 90vh;
  border-radius: 16px 0 0 16px;
  transform: translateX(100%);
}

.modal-backdrop.visible .modal-dialog.drawer-side {
  transform: translateX(0);
}

.modal-dialog.drawer-side.left {
  border-radius: 0 16px 16px 0;
  transform: translateX(-100%);
}

.modal-backdrop.visible .modal-dialog.drawer-side.left {
  transform: translateX(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
}

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

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  max-height: calc(90vh - 120px);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Toast Alerts
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  min-width: 280px;
  max-width: 420px;
  pointer-events: auto;
  animation: toast-slide-in 0.3s ease forwards;
  opacity: 0;
  transform: translateX(100%);
}

.toast.removing {
  animation: toast-slide-out 0.2s ease forwards;
}

@keyframes toast-slide-in {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-slide-out {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
}

.toast.success .toast-icon {
  color: #22C55E;
}

.toast.error .toast-icon {
  color: #EF4444;
}

.toast.warning .toast-icon {
  color: #F59E0B;
}

.toast.info .toast-icon {
  color: var(--cyan);
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.125rem;
}

.toast-message {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
}

.toast-close {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin-top: -0.25rem;
  margin-right: -0.25rem;
}

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

.toast-close svg {
  width: 16px;
  height: 16px;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 0 0 10px 10px;
  background: var(--cyan);
  animation: toast-progress 5s linear forwards;
}

.toast.success .toast-progress {
  background: #22C55E;
}

.toast.error .toast-progress {
  background: #EF4444;
}

.toast.warning .toast-progress {
  background: #F59E0B;
}

@keyframes toast-progress {
  from { width: 100%; }
  to { width: 0%; }
}

/* ==========================================================================
   Mobile Media Queries
   ========================================================================== */
@media (max-width: 899px) {
  .studio-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 1rem;
  }
  
  .studio-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .studio-sidebar > .card {
    flex: 1;
    min-width: 280px;
  }
  
  .stepper {
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }
  
  .step-item {
    min-width: 80px;
  }
  
  .step-item:not(:last-child)::after {
    display: none;
  }
  
  .storyboard-card {
    grid-template-columns: 80px 1fr;
    grid-template-rows: auto auto;
    gap: 0.5rem 0.75rem;
  }
  
  .storyboard-thumb {
    width: 80px;
    height: 45px;
    grid-row: 1 / 3;
  }
  
  .storyboard-actions {
    flex-direction: row;
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
  }
  
  .cost-summary {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .cost-breakdown {
    justify-content: space-between;
    width: 100%;
  }
  
  .cost-total {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 0.75rem;
    justify-content: space-between;
    width: 100%;
  }
  
  .cost-progress {
    max-width: none;
  }
  
  .video-theater {
    border-radius: 8px;
  }
  
  .video-theater .play-button {
    width: 60px;
    height: 60px;
  }
  
  .video-theater .play-button svg {
    width: 24px;
    height: 24px;
  }
  
  .modal-dialog {
    margin: 0.5rem;
    max-height: calc(100vh - 1rem);
    border-radius: 12px;
  }
  
  .modal-dialog.drawer-bottom {
    border-radius: 12px 12px 0 0;
    max-height: 80vh;
  }
  
  .modal-dialog.drawer-side {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 12px;
    transform: translateY(100%);
  }
  
  .modal-backdrop.visible .modal-dialog.drawer-side {
    transform: translateY(0);
  }
  
  .modal-dialog.drawer-side.left {
    transform: translateY(100%);
  }
  
  .modal-backdrop.visible .modal-dialog.drawer-side.left {
    transform: translateY(0);
  }
  
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    align-items: stretch;
  }
  
  .toast {
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .header-bar {
    padding: 0.75rem 1rem;
  }
  
  .header-brand {
    font-size: 1rem;
  }
  
  .credit-badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
  }
  
  .card-header,
  .card-content,
  .card-footer {
    padding: 0.875rem 1rem;
  }
  
  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.8125rem;
  }
  
  .btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 0.875rem;
  }
  
  .storyboard-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  
  .storyboard-thumb {
    width: 100%;
    height: 120px;
    grid-row: 1;
  }
  
  .storyboard-actions {
    grid-row: 3;
  }
  
  .cost-breakdown {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }
  
  .cost-item {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }
  
  .step-circle {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
  }
  
.step-label {
    font-size: 0.6875rem;
}

.footer-nav {
  display: flex;
  gap: 1rem;
  padding: 1.5rem 1.5rem 1rem;
  border-top: 1px solid var(--border);
}

.footer-nav .footer-link {
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.2s ease;
}

.footer-nav .footer-link:hover {
  color: var(--text);
}

.footer-nav .footer-link:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.copyright {
  padding: 1rem 1.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

/* --- Subdomain Selector --- */
.subdomain-selector {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* --- Guided Launchpad --- */
.guided-launchpad {
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--panel) 0%, var(--bg) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 1rem 0;
}

.launchpad-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.launchpad-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.launchpad-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: padding;
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 1.25rem;
}

.launchpad-close:hover {
  color: var(--cyan);
}

.launchpad-steps {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.launchpad-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.launchpad-step .step-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--input);
  border: 2px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.launchpad-step.completed .step-circle {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--bg);
}

.launchpad-step.completed .step-label {
  color: var(--cyan);
  font-weight: 600;
}

.launchpad-step:not(.completed) .step-circle {
  background: var(--input);
  border-color: var(--border);
  color: var(--muted);
}

.launchpad-step:not(.completed):hover .step-circle {
  border-color: var(--cyan);
  color: var(--cyan);
}

/* --- Earning Playbooks Drawer --- */
.earning-playbooks-drawer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  backdrop-filter: blur(4px);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.drawer-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  max-height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--border);
  z-index: 2001;
  transition: transform 0.3s ease;
}

.drawer-backdrop.visible .drawer-panel {
  transform: translateX(0);
}

.drawer-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.75rem;
  font-size: 1.25rem;
  float: right;
}

.drawer-body {
  padding: 1.5rem;
}

.playbook-category {
  margin-bottom: 2rem;
}

.playbook-category h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.playbook-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.playbook-item {
  padding: 0.5rem 0.75rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.playbook-item:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.earning-stats {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1.5rem;
}

.stat-item {
  flex: 1;
}

.stat-item .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cyan);
}

/* --- 3-Angle Choice Cards --- */
.three-angle-choices {
  padding: 1.5rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.angle-choice-grid {
  display: grid;
  gap: 0.75rem;
}

.angle-choice-card {
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
  transition: all 0.2s ease;
}

.angle-choice-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.angle-choice-card.selected {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.05);
}

.angle-choice-card.selected .angle-icon {
  color: var(--cyan);
}

.angle-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

/* --- 1-Click Refinement Chips --- */
.refinement-chips {
  padding: 1.5rem;
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.chip {
  padding: 0.5rem 1rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover:not(.selected) {
  border-color: var(--cyan);
  color: var(--cyan);
}

.chip.selected {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--indigo) 100%);
  color: var(--bg);
  border-color: transparent;
}

/* --- Surgical Block Editor --- */
.surgical-block-editor {
  padding: 1.5rem;
}

.block-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.block-item {
  padding: 0.5rem 0.75rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.block-item:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.block-item.selected {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--indigo) 100%);
  color: var(--bg);
  border-color: transparent;
}

.block-canvas {
  min-height: 120px;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.875rem;
}

/* --- Version History --- */
.version-history {
  padding: 1.5rem;
}

.version-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.version-tab {
  padding: 0.5rem 0.75rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.version-tab:hover:not(.selected) {
  border-color: var(--cyan);
  color: var(--cyan);
}

.version-tab.selected {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--indigo) 100%);
  color: var(--bg);
  border-color: transparent;
}

.version-content p {
  color: var(--muted);
  font-size: 0.875rem;
}

/* --- Customer Dashboard --- */
.customer-dashboard {
  padding: 1.5rem;
}

.dashboard-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.dashboard-tab {
  padding: 0.5rem 0.75rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dashboard-tab:hover:not(.selected) {
  border-color: var(--cyan);
  color: var(--cyan);
}

.dashboard-tab.selected {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--indigo) 100%);
  color: var(--bg);
  border-color: transparent;
}

.faq-section {
  margin-bottom: 2rem;
}

.faq-section h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.faq-item {
  margin-bottom: 1rem;
}

.faq-question {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.faq-question:hover {
  color: var(--cyan);
}

.faq-answer {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.earning-intel {
  margin-top: 1rem;
}

.earning-intel h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.growth-metrics {
  display: flex;
  gap: 1.5rem;
}

.metric {
  flex: 1;
  text-align: center;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 0.25rem;
}

/* --- Pro Tier & BYOK Selector --- */
.pro-tier-selector {
  padding: 1.5rem;
}

.pro-tier-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.pro-tier-option {
  padding: 0.5rem 0.75rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 120px;
  text-align: center;
}

.pro-tier-option:hover:not(.selected) {
  border-color: var(--cyan);
  color: var(--cyan);
}

.pro-tier-option.selected {
  background: linear-gradient(135deg, var(--cyan) 0%, var(--indigo) 100%);
  color: var(--bg);
  border-color: transparent;
}

.byok-section {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.byok-section h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.byok-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9375rem;
  margin-bottom: 0.75rem;
}

.save-byok-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.save-byok-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.05);
}