:root {
  --primary: var(--nv-accent);
  --primary-dark: var(--nv-accent-dark);
  --primary-light: var(--nv-accent-light);
  --primary-bg: var(--nv-accent-soft);
  --secondary: var(--nv-danger);
  --success: var(--nv-success);
  --warning: var(--nv-warning);
  --info: var(--nv-accent);
  --gold: var(--nv-gold);
  --dark: var(--nv-ink-soft);
  --gray: var(--nv-body);
  --gray-light: var(--nv-line);
  --gray-bg: var(--nv-surface-2);
  --white: #ffffff;
  --card: #ffffff;
  --text: var(--nv-ink-soft);
  --sidebar-w: 240px;
  --header-h: 56px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  /* Owner-facing borders. The toolkit cards read "blue"; the four editing tool
     groups read "navy blue" — one step darker than the body text navy, so the
     two border colours are never mistaken for each other on the same screen. */
  --studio-blue-border: #1E5BFF;
  --studio-navy-border: #16205C;
  /* Timeline slider surfaces (sit on the navy preview panel). */
  --studio-slider-track: #16305C;
  --studio-slider-track-line: rgba(255, 255, 255, 0.28);
}

.dark {
  --gray-bg: var(--nv-ink-2);
  --white: var(--nv-ink-soft);
  --card: var(--nv-ink-soft);
  --text: var(--nv-on-dark);
  --dark: var(--nv-on-dark);
  --gray: var(--nv-on-dark-2);
  --gray-light: var(--nv-ink-line);
  --primary-bg: var(--nv-accent-soft-dark);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  /* Navy on a navy card is invisible: lift both borders for dark mode, keeping
     the navy hue (not a pastel blue) so tool groups still read as navy. */
  --studio-blue-border: #4C7DFF;
  --studio-navy-border: #33509E;
  --studio-slider-track: #1B2B52;
  --studio-slider-track-line: rgba(255, 255, 255, 0.34);
}

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

html, body { height: 100%; }

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
}

button { font-family: inherit; }

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--gray-light);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: sticky;
  top: 0;
  z-index: 40;
  transition: transform 0.25s ease, width 0.25s ease, min-width 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
}

.sidebar-brand .pro {
  color: var(--gold);
  font-size: 0.7rem;
  margin-left: 4px;
  vertical-align: super;
  font-weight: 700;
}

.sidebar-nav {
  list-style: none;
  padding: 8px 12px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--gray);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 4px;
}

.sidebar-nav li:hover { background: var(--primary-bg); color: var(--primary); }
.sidebar-nav li.active { background: var(--primary); color: #fff; }
.sidebar-nav li .badge {
  margin-left: auto;
  background: var(--secondary);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}
.sidebar-nav li.active .badge { background: #fff; color: var(--primary); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--gray-light);
}

.token-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--primary);
}

.token-display i { color: var(--gold); }

.btn-buy-tokens {
  margin-left: auto;
  border: none;
  background: var(--primary);
  color: var(--nv-on-dark);
  border-radius: 0;                 /* SamCart: square CTA */
  font-family: var(--nv-font-mono);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

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

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.user-card .name { display: block; font-size: 0.85rem; font-weight: 600; }
.user-card .plan { display: block; font-size: 0.72rem; color: var(--gray); }

.main-content {
  flex: 1;
  min-width: 0;
  padding: 0 16px 40px;
  overflow-x: hidden;
}

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--header-h);
  position: sticky;
  top: 0;
  background: var(--gray-bg);
  z-index: 20;
}

.header-left, .header-right { display: flex; align-items: center; gap: 8px; }

.menu-toggle, .icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--gray-light);
  background: var(--white);
  border-radius: 8px;
  color: var(--gray);
  cursor: pointer;
  position: relative;
}

.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  background: var(--secondary);
  border-radius: 50%;
}

.breadcrumb { font-size: 0.85rem; color: var(--gray); }
.breadcrumb .separator { margin: 0 6px; }
.breadcrumb .active { color: var(--text); font-weight: 600; }

.welcome-banner {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 18px;
}

.welcome-banner h1 { font-size: 1.4rem; font-weight: 800; }
.welcome-banner p { opacity: 0.92; font-size: 0.92rem; margin-top: 4px; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.btn-primary, .btn-secondary, .btn-outline, .btn-package {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
}

.btn-primary { background: #fff; color: var(--primary); }
.welcome-banner .btn-primary { background: #fff; color: var(--primary); }
.studio-controls .btn-primary { background: var(--primary); color: #fff; }
.btn-secondary {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.4);
}
.btn-outline {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--gray-light);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.stat-icon.purple { background: var(--primary); }
.stat-icon.green { background: var(--success); }
.stat-icon.orange { background: var(--warning); }
.stat-icon.blue { background: var(--info); }

.stat-info { flex: 1; min-width: 0; }
.stat-value { display: block; font-size: 1.35rem; font-weight: 800; }
/* "Not tracked" is longer and lower-case; keep it inside the card. */
.stat-value.is-na { font-size: 0.95rem; font-weight: 600; color: var(--gray); }
.stat-label { font-size: 0.75rem; color: var(--gray); }
.stat-change { font-size: 0.8rem; font-weight: 600; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--secondary); }

.studio-section, .recent-projects, .token-packages, .recent-activity, .media-library {
  background: var(--card);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
/* Token-purchase panel follows the cart's square geometry (scoped: the other
   panels in the group above keep their existing radius). */
.token-packages { border-radius: 0; padding: 24px; }

.studio-header, .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.studio-header h2, .section-header h2 {
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.studio-header h2 i, .section-header h2 i { color: var(--primary); }
.studio-controls { display: flex; gap: 8px; }
.hint { color: var(--gray); font-size: 0.8rem; }
.view-all {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}

.studio-workspace { display: flex; flex-direction: column; gap: 14px; }

.preview-container {
  background: var(--nv-text);
  border-radius: 12px;
  overflow: hidden;
}

.preview-stage { position: relative; }

.preview-thumbnail {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(circle at 30% 40%, rgb(var(--nv-accent-rgb) / 0.45), transparent 50%),
    linear-gradient(135deg, var(--nv-ink-soft), var(--nv-ink-line));
}

.preview-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.18);
}

.play-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

.preview-timeline { padding: 10px 12px 4px; color: var(--nv-body-2); }

/* ------------------------------------------------------------------
   Timeline scrub slider — the "slider bar" the owner asked to see.
   The range input ships `disabled` in the markup (no media loaded yet),
   so it reads greyed-and-ready; JS enables it the moment a video is in
   the preview. The track and thumb are both painted explicitly, because
   a native range look on a navy panel is near-invisible.
   ------------------------------------------------------------------ */
.timeline-slider {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 10px;
  margin: 6px 0 8px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--studio-slider-track-line);
  background: var(--studio-slider-track);
  cursor: pointer;
}
.timeline-slider:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.timeline-slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background-color: var(--studio-slider-track);
  /* Tick marks: reads as a bar that is ready to be dragged left to right. */
  background-image: repeating-linear-gradient(
    to right,
    var(--studio-slider-track-line) 0 1px,
    transparent 1px 12.5%
  );
}
.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -5px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
}
.timeline-slider::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background-color: var(--studio-slider-track);
  background-image: repeating-linear-gradient(
    to right,
    var(--studio-slider-track-line) 0 1px,
    transparent 1px 12.5%
  );
}
.timeline-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
}
/* Disabled = no media loaded yet. Muted, but the bar is still visible. */
.timeline-slider:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}
.timeline-slider:disabled::-webkit-slider-thumb {
  background: var(--nv-on-dark-2);
  border-color: var(--nv-body-2);
}
.timeline-slider:disabled::-moz-range-thumb {
  background: var(--nv-on-dark-2);
  border-color: var(--nv-body-2);
}
/* Enabled = a video is loaded. Accent ring, brighter track: clearly movable.
   (Do not reach for --primary-light here: in this theme it is a rose, not the
   accent, and it reads as an off-brand pink dot on the navy panel.) */
.timeline-slider:not(:disabled) {
  opacity: 1;
  border-color: var(--primary);
}
.timeline-slider:not(:disabled)::-webkit-slider-thumb {
  background: #fff;
  border-color: var(--primary);
}
.timeline-slider:not(:disabled)::-moz-range-thumb {
  background: #fff;
  border-color: var(--primary);
}
.timeline-bar {
  height: 6px;
  background: var(--nv-text);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
}
.timeline-progress {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}
.playhead {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.timeline-time {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  margin-top: 6px;
  opacity: 0.8;
}

.preview-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px 12px;
  color: #fff;
  flex-wrap: wrap;
}
.preview-controls button {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  width: 32px;
  height: 32px;
}
.preview-time { margin-left: auto; font-size: 0.8rem; opacity: 0.85; }

.editing-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.tool-group {
  border: 1px solid var(--gray-light);
  border-radius: 12px;
  padding: 12px;
}

/* The four editing boxes get a NAVY border (clearly darker than the blue on
   the toolkit cards). Addressed by data-tool-group so the fifth group
   (Upload) keeps its hairline. */
.tool-group[data-tool-group="cut"],
.tool-group[data-tool-group="audio"],
.tool-group[data-tool-group="text"],
.tool-group[data-tool-group="ai"] {
  border: 2px solid var(--studio-navy-border);
}

.tool-group h4 {
  font-size: 0.8rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gray);
}

.tool-buttons, .platform-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-btn, .platform-btn {
  border: 1px solid var(--gray-light);
  background: var(--gray-bg);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tool-btn:hover, .platform-btn:hover, .tool-btn.active, .platform-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.timeline-header h4 { font-size: 0.9rem; display: flex; gap: 8px; align-items: center; }
.timeline-zoom button {
  background: var(--gray-bg);
  border: 1px solid var(--gray-light);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  color: var(--text);
}

.track {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.track-label { font-size: 0.72rem; color: var(--gray); }
.track-row {
  display: flex;
  align-items: center;
  background: var(--gray-bg);
  border-radius: 8px;
  min-height: 28px;
  overflow: hidden;
}
.track-clip {
  height: 24px;
  border-radius: 6px;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  white-space: nowrap;
}

.project-grid, .package-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* Owner: "recent projects shall be half the size on one row or 6 on one row."
   Six compact cards on one desktop row; the card itself is roughly half the
   old height (thumbnail 110px -> 54px, tighter type and padding). */
.project-grid { gap: 10px; }

.project-card {
  border: 1px solid var(--gray-light);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
  min-width: 0;
  cursor: pointer;
}

.project-thumbnail {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
}
.project-info { padding: 8px; min-width: 0; }
.project-info h4 {
  font-size: 0.74rem;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-info p {
  font-size: 0.64rem;
  color: var(--gray);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-status, .status {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  display: inline-block;
  white-space: nowrap;
}
.project-status.completed { background: var(--nv-success-soft); color: var(--nv-success-dark); }
.project-status.draft { background: var(--primary-bg); color: var(--primary); }
.project-status.pending { background: var(--nv-warning-soft); color: var(--nv-warning-dark); }
.dark .project-status.completed { background: var(--nv-success-soft-dark); color: var(--nv-success); }
.dark .project-status.pending { background: var(--nv-warning-soft-dark); color: var(--nv-warning); }

.package-card {
  border: 1px solid var(--gray-light);
  border-radius: 0;              /* SamCart: square panels */
  padding: 24px 18px;
  text-align: center;
  position: relative;
}
.package-card.popular { border-color: var(--primary); }
.package-card .badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-family: var(--nv-font-mono);
  font-size: 0.68rem;
  padding: 3px 10px;
  border-radius: 0;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.package-card .tokens { font-family: var(--nv-font-display); font-size: 1.6rem; font-weight: 800; }
.package-card .tokens span { font-size: 0.8rem; color: var(--success); }
.package-card .price { font-family: var(--nv-font-display); color: var(--primary); font-weight: 800; margin: 6px 0; font-size: 1.5rem; }
.package-card .per-token { font-family: var(--nv-font-mono); font-size: 0.75rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--gray); margin-bottom: 12px; }

.btn-package {
  width: 100%;
  justify-content: center;
  background: var(--gray-bg);
  color: var(--text);
  border: 1px solid var(--gray-light);
  border-radius: 0;                 /* SamCart: square CTA */
  font-family: var(--nv-font-mono);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 14px 18px;
}
.btn-package.primary { background: var(--primary); color: var(--nv-on-dark); border: none; }
.btn-package.outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.activity-list { display: flex; flex-direction: column; gap: 10px; }
.activity-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-light);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.activity-item p { font-size: 0.85rem; }
.activity-item span { font-size: 0.72rem; color: var(--gray); }
.activity-tokens { font-size: 0.78rem !important; font-weight: 700; color: var(--secondary); white-space: nowrap; }
.activity-tokens.positive { color: var(--success); }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--gray-bg);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  z-index: 80;
  max-width: calc(100% - 24px);
}

@media (min-width: 640px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .package-grid { grid-template-columns: repeat(2, 1fr); }
  .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .welcome-banner { flex-direction: row; align-items: center; justify-content: space-between; padding: 24px 28px; }
  .welcome-banner h1 { font-size: 1.7rem; }
  .editing-tools { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 768px) {
  .main-content { padding: 0 24px 48px; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .package-grid { grid-template-columns: repeat(4, 1fr); }
  .project-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .menu-toggle { display: none; }
}

/* Six on one row, the size the owner asked for. */
@media (min-width: 1200px) {
  .project-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
}

@media (min-width: 1024px) {
  .studio-workspace {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    grid-template-areas:
      "preview tools"
      "timeline timeline";
    gap: 16px;
  }
  .video-preview { grid-area: preview; }
  .editing-tools { grid-area: tools; }
  .project-timeline { grid-area: timeline; }
}

.industry-pill {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.industry-features { width: 100%; margin: 0 0 24px; }
.industry-features .section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.industry-features h2 {
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
#industryLabel {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray);
  font-weight: 700;
}
.industry-feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
/* Owner: "the 7 boxes shall be all on one row shrunk to fit on the one row
   with blue borders." min-width:0 + overflow-wrap let a card shrink below its
   text's intrinsic width instead of forcing the row wider than the container. */
.industry-feature-card {
  background: var(--card);
  border: 2px solid var(--studio-blue-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.industry-feature-card i { color: var(--primary); margin-bottom: 8px; display: block; }
.industry-feature-card strong { display: block; margin-bottom: 4px; min-width: 0; overflow-wrap: anywhere; }
.industry-feature-card span { color: var(--gray); font-size: 0.85rem; display: block; min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 768px) {
  .industry-feature-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Owner: the 7 toolkit boxes are one row, shrunk to fit. Flex (not a fixed
   `repeat(7, ...)`) is deliberate: it puts *every* rendered card on one row and
   shrinks them equally, so the row is correct whether the industry route yields
   3 cards or 7 — a fixed 7-track grid would leave the other 4 tracks empty. */
@media (min-width: 1200px) {
  .industry-feature-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .industry-feature-grid .industry-feature-card {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px;
  }
  .industry-feature-grid .industry-feature-card i { font-size: 0.9rem; margin-bottom: 6px; }
  .industry-feature-grid .industry-feature-card strong { font-size: 0.8rem; }
  .industry-feature-grid .industry-feature-card span { font-size: 0.7rem; line-height: 1.3; }
}

.gallery-strip {
  width: 100%;
  margin: 0 0 24px;
}
.gallery-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.gallery-strip-header h2 {
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.gallery-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
/* One compact row that scrolls sideways instead of a tall 4x2 grid.
   Cards are fixed-width so the row height stays small. */
.gallery-strip-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.gallery-strip-row::-webkit-scrollbar { height: 6px; }
.gallery-strip-row::-webkit-scrollbar-thumb {
  background: var(--nv-line);
  border-radius: 3px;
}
.gallery-strip-card {
  position: relative;
  flex: 0 0 auto;
  width: 96px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: var(--gray-light);
  scroll-snap-align: start;
}
.gallery-strip-card img {
  width: 100%;
  max-width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-strip-card span {
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 5px;
  font-size: 0.6rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.gallery-strip-empty { color: var(--gray); font-size: 0.9rem; }

.track-clip.image-clip {
  background: var(--nv-accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  min-width: 72px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.track-clip.image-clip img {
  width: 22px;
  height: 22px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.studio-tab {
  width: 100%;
  padding: 8px 0 40px;
}
.studio-tab h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.studio-tab > p { color: var(--gray); margin-bottom: 16px; }
.studio-tab .gallery-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.studio-tab .gallery-toolbar input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
}
.studio-tab .category-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.studio-tab .filter-btn {
  border: 1px solid var(--gray-light);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  text-transform: capitalize;
}
.studio-tab .filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.studio-tab .gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.studio-gallery-card {
  background: var(--card);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.studio-gallery-card img {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
.studio-gallery-card .meta { padding: 10px 12px 12px; }
.studio-gallery-card .cat {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  font-weight: 700;
}
.studio-gallery-card .who { font-size: 0.88rem; margin: 4px 0 8px; }
.studio-gallery-card button {
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 600;
}
@media (min-width: 640px) {
  .studio-tab .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .studio-tab .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  .gallery-strip-card { width: 108px; }
}

.mobile-studio-nav { display: none; }
.studio-tab .load-more-container {
  display: flex;
  justify-content: center;
  padding: 16px 0 8px;
}
.studio-tab .btn-load-more {
  border: 1px solid var(--gray-light);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 28px;
  font-weight: 600;
  cursor: pointer;
}
.studio-tab .btn-load-more[hidden] { display: none; }

@media (max-width: 767px) {
  body { flex-direction: column; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    box-shadow: none;
    height: 100dvh;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 24px rgba(0,0,0,0.12); }
  .mobile-studio-nav {
    display: flex;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--white);
    border-bottom: 1px solid var(--gray-light);
  }
  .mobile-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--gray);
    padding: 12px 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
  }
  .mobile-tab.active {
    color: var(--primary);
    box-shadow: inset 0 -2px 0 var(--primary);
  }
  .main-content { width: 100%; padding: 12px 12px 32px; }
  .studio-tab .gallery-toolbar input { width: 100%; }
  .studio-tab .category-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
  .studio-tab .category-filters .filter-btn { white-space: nowrap; }
  .studio-tab .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .studio-gallery-card .meta { display: none; }
  .studio-gallery-card { cursor: pointer; }
}

@media (max-width: 767px) {
  .ai-gen-pill { font-size: 0.72rem; padding: 4px 10px; }
  .ai-gen-pill-title { font-size: 0.78rem; padding: 6px 12px; }
  .ai-gen-select-box {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .ai-gen-select-box .ai-gen-pill { align-self: stretch; justify-content: center; }
  .ai-gen-select-box .ai-gen-select { width: 100%; }
  .ai-gen-row-2 #aiGenerateBtn { margin-left: 0; width: 100%; justify-content: center; }
  .ai-gen-prompt-row { flex-direction: column; align-items: stretch; }
  .ai-gen-prompt-row .ai-gen-pill { align-self: flex-start; }
  .ai-gen-prompt { flex: 1 1 auto; width: 100%; }
}

@media (max-width: 1199px) {
  /* Below the 7-across breakpoint the toolkit wraps rather than squashing
     the cards into unreadable slivers. */
  .industry-feature-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}

.dark .ai-gen-balance-box,
.dark .ai-gen-select-box,
.dark .ai-gen-pill-model-cost { background: var(--nv-accent-soft-dark); }
.dark .ai-gen-balance-box,
.dark .ai-gen-select-box { border-color: var(--primary-light); }

/* Text-on-video controls */
/* ------------------------------------------------------------------
   AI generator — two rows, every word on a coloured pill.
   Row 1: Generate a video | Balance box | Save | Publish
   Row 2: Type of video | [selections box] | Generate video (flush right)
   ------------------------------------------------------------------ */
.ai-generator {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.ai-gen-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.ai-gen-row-1 .ai-gen-row-gap { flex: 1 1 12px; }
/* Publish used to be coloured by `.studio-controls .btn-primary`, a wrapper it
   no longer lives in. Without this it would be white text-bg on a white card. */
#aiGenRow1 #publishBtn { background: var(--primary); color: #fff; }
#aiGenRow1 #publishBtn:hover { background: var(--primary-dark); }

/* Every label/word reads as a coloured pill. */
.ai-gen-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.ai-gen-pill i { font-size: 0.72rem; }
.ai-gen-pill-title {
  background: var(--primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 7px 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ai-gen-pill-model-cost { background: var(--nv-accent-soft); color: var(--nv-accent-dark); }

/* The balance box: a literal boxed figure, not just text. */
.ai-gen-balance-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}
.ai-gen-balance-box strong { font-size: 1rem; font-weight: 800; }
.ai-gen-balance-label { color: var(--primary); }
.ai-gen-balance-unit { font-weight: 600; opacity: 0.85; }

/* The coloured box holding the row-2 selections (model + cost + length). */
.ai-gen-select-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  padding: 6px 10px;
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary-bg);
}
.ai-gen-select-box .ai-gen-select { background: var(--card); }

/* Generate sits flush right on row 2. */
.ai-gen-row-2 .ai-gen-select-box { flex: 1 1 auto; }
.ai-gen-row-2 #aiGenerateBtn { margin-left: auto; flex: 0 0 auto; }

.ai-gen-select {
  padding: 7px 10px;
  border: 1px solid var(--gray-light);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.8rem;
  color: inherit;
  background: var(--card);
  min-width: 0;
  max-width: 100%;
}
.ai-gen-prompt-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.ai-gen-prompt {
  flex: 1 1 240px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  color: inherit;
  background: var(--card);
}

/* ------------------------------------------------------------------
   Media libraries (video gallery / photo library) — containers only;
   the behaviour agent renders the cards into them.
   ------------------------------------------------------------------ */
.media-library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.media-library-grid:empty::before {
  content: "Nothing here yet.";
  grid-column: 1 / -1;
  color: var(--gray);
  font-size: 0.88rem;
}
@media (min-width: 640px) {
  .media-library-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .media-library-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
/* Cards rendered into #videoLibrary / #photoLibrary by studio.js. Self-contained
   (no new dependencies on shared vars beyond the ones already used above) so the
   libraries look like tiles, not unstyled text, if the theme vars change. */
.media-library-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm, 10px);
  overflow: hidden;
  background: var(--card, #fff);
  border: 1px solid var(--gray-light, #e5e7eb);
  cursor: pointer;
  text-align: left;
}
.media-library-card:hover { border-color: var(--primary, #6b7280); }
.media-library-card:focus-visible { outline: 2px solid var(--primary, #6b7280); outline-offset: 2px; }
.media-card-tile {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--gray-light, #eef0f4);
}
.media-card-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media-card-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.72rem;
  color: var(--gray, #6b7280);
}
.media-card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  pointer-events: none;
}
.media-card-duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.68rem;
  font-weight: 600;
  pointer-events: none;
}
.media-card-caption {
  display: block;
  padding: 6px 8px 8px;
  font-size: 0.7rem;
  color: var(--gray, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-overlay-controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.text-overlay-controls input[type="text"] {
  flex: 1 1 160px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--bg, #F7F7FB);
  color: inherit;
}
.text-overlay-controls select {
  padding: 9px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--bg, #F7F7FB);
  color: inherit;
}
.text-overlay-note {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--gray, #6B7280);
}
.dark .text-overlay-controls input[type="text"],
.dark .text-overlay-controls select { background: #0f0e17; border-color: #2a2a40; }
