/* Everything around the composers on the demo path: the header, the sign-in screen, the galleries, the detail
   dialogs, Assets and the Admin pass. Loaded last, so it settles the older per-screen files (style, creative, v1,
   studio). Colours come from tokens.css only. */

/* Header (prototype variant A): the asterisk and wordmark, the screens as pills, then the Creator's credits and
   their initials, which open the account menu. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 28px;
  height: var(--header-h);
  min-height: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.topbar .brand {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}
.brand-mark,
.login-symbol {
  display: block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
}
.topbar .brand b {
  font: 800 17px/1 var(--mark);
  font-stretch: 125%;
  letter-spacing: 0.01em;
}
.topbar .brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}
.topbar nav {
  display: flex;
  align-self: center;
  gap: 4px;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar nav[hidden] {
  display: none;
}
.topbar .nav-item {
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: 500 14px/1 var(--ui);
  white-space: nowrap;
  transition:
    background 150ms var(--ease),
    color 150ms var(--ease);
}
.topbar .nav-item::after {
  display: none;
}
.topbar .nav-item.active,
.topbar .nav-item[aria-current='page'] {
  background: var(--chip);
  color: var(--text);
}
.topbar .nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.topbar .nav-item:disabled {
  opacity: 1;
  color: var(--faint);
}
@media (hover: hover) {
  .topbar .nav-item:hover:not(.active, :disabled) {
    background: var(--surface-2);
    color: var(--text);
  }
  .credits-chip:hover,
  .avatar:hover {
    background: var(--chip);
  }
}
#identity {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.credits-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font: 600 13.5px/1 var(--ui);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms var(--ease);
}
.credits-chip .ic {
  color: var(--accent);
}
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--element-bg);
  color: var(--accent);
  font: 600 12px/1 var(--ui);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 150ms var(--ease);
}
.avatar[aria-expanded='true'] {
  background: var(--chip-hover);
}
.credits-chip:focus-visible,
.avatar:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Account menu items are actions, drawn with their icons rather than a ✓. */
.menu-item[role='menuitem'] .menu-check {
  color: var(--muted);
}
/* Cinema Studio's sidebar opens as a drawer on a phone, from the menu button at the start of the header. */
.topbar #studio-drawer-open {
  display: none;
}

/* Sign-in and waiting screens. */
.login-symbol {
  width: 44px;
  height: 44px;
  margin: 0 auto 22px;
  stroke-width: 2;
}
.login-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin-top: 28px;
  font-size: 12.5px;
}
.login-links a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.login-links a:hover {
  color: var(--text);
}

@media (max-width: 760px) {
  :root {
    --header-h: 96px;
  }
  /* Two rows: the mark, credits and initials; then the screens, scrolling sideways if they must. */
  .topbar {
    flex-wrap: wrap;
    gap: 0 10px;
    height: auto;
    min-height: var(--header-h);
    padding: 0 12px;
  }
  .topbar .brand {
    height: 52px;
  }
  .topbar .brand b {
    font-size: 15px;
  }
  .topbar nav {
    order: 3;
    width: 100%;
    height: 44px;
    margin: 0 -4px;
    padding: 0 0 6px;
  }
  .topbar .nav-item {
    padding: 0 11px;
    font-size: 14px;
  }
  body.studio-active .topbar #studio-drawer-open {
    display: grid;
    margin-left: -6px;
    background: transparent;
  }
  body.studio-active .topbar .brand b {
    display: none;
  }
}

/* Cinema Studio sits on the page ground, as in the prototype, rather than in a framed box. */
body.studio-active .studio-workspace {
  border: 0;
  border-radius: 0;
}

/* Gallery heading: the title and count on the left, the tools as icon chips on the right. */
.image-workspace .gallery-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 0;
  margin: 0;
  padding: 18px 20px 12px;
  border: 0;
  background: none;
}
.image-workspace .gallery-heading h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.gallery-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}
.gallery-tools #image-total {
  order: -1;
  margin-right: 6px;
  color: var(--faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.view-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 0;
  border: 0;
  background: none;
}
.gallery-tools .view-toggle .chip {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 10px;
}
.gallery-tools .view-toggle .chip.active {
  background: var(--chip-hover);
  color: var(--text);
}
.history-more summary {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  background: var(--chip);
  color: var(--muted);
}
.history-more[open] summary,
.history-more summary:hover {
  background: var(--chip-hover);
  color: var(--text);
}
.history-more summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#history-more-menu {
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--menu);
  box-shadow: 0 20px 50px -10px var(--shadow);
}
/* Its items are the shared menu items (controls.css), each with an icon; the tile size is a labelled slider. */
#history-more-menu .menu-item {
  min-height: 34px;
}
#history-more-menu .menu-item .ic {
  color: var(--muted);
}
#history-more-menu .menu-item:hover {
  background: var(--chip);
}
#history-more-menu .menu-item[hidden] {
  display: none;
}
#history-more-menu .menu-range {
  display: grid;
  gap: 6px;
  margin: 4px 0 2px;
  padding: 8px 10px 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 400 13px/1.3 var(--ui);
}
#history-more-menu .menu-range input {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

/* Image and Cinema Studio galleries: tiles the media fills. The prompt shows on hover, Favorite sits top right,
   and a job still running shows its status on a quiet shimmer. */
.gallery.media-grid {
  display: grid;
  grid-template-columns: repeat(var(--columns, 5), minmax(0, 1fr));
  align-items: start;
  gap: 8px;
  padding: 0 20px 260px;
}
.media-grid > .history-item {
  position: relative;
  aspect-ratio: 4 / 5;
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
}
.media-grid .history-preview {
  position: absolute;
  inset: 0;
  height: auto;
  min-height: 0;
  aspect-ratio: auto;
  border-radius: 0;
  background: none;
}
.media-grid .history-preview :is(img, video) {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms var(--ease);
}
.media-grid .preview-open {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}
.media-grid .preview-open:hover {
  background: transparent;
}
.media-grid .preview-open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.media-grid .like-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--scrim);
  color: var(--text);
  opacity: 0;
  transition: opacity 180ms var(--ease);
}
.media-grid .like-button .ic {
  width: 15px;
  height: 15px;
}
.like-button.liked,
.favorite-button.liked {
  color: var(--accent);
}
:is(.like-button, .favorite-button).liked .ic {
  fill: currentColor;
}
.tile-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  display: -webkit-box;
  overflow: hidden;
  padding: 28px 12px 10px;
  background: linear-gradient(transparent, var(--scrim));
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.media-grid .history-item:is(:hover, :focus-within) :is(.like-button, .tile-caption),
.media-grid .like-button.liked {
  opacity: 1;
}
@media (hover: hover) {
  .media-grid .history-item:hover .history-preview :is(img, video) {
    transform: scale(1.03);
  }
}
@media (hover: none) {
  .media-grid .like-button {
    opacity: 1;
  }
}
.video-badge,
.duration {
  position: absolute;
  z-index: 1;
  border-radius: 6px;
  background: var(--scrim);
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.video-badge {
  top: 8px;
  left: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
}
.duration {
  right: 10px;
  bottom: 10px;
  padding: 2px 7px;
}
.duration[hidden] {
  display: none;
}
.history-item.pending .generation-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  color: var(--muted);
  text-align: center;
}
.history-item.pending .generation-state strong {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
}
.history-item.pending .generation-state small {
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
}
.history-item.pending .generation-state .spin {
  color: var(--accent);
}
.history-item.pending .history-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, var(--chip) 50%, transparent 70%);
  background-size: 200% 100%;
  opacity: 0.5;
  pointer-events: none;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}
.gallery .empty {
  grid-column: 1 / -1;
  padding: 72px 20px;
}
.gallery .empty-symbol {
  display: block;
  margin: 0 auto 16px;
  color: var(--accent);
}
.gallery .empty-symbol .ic {
  width: 40px;
  height: 40px;
  margin: auto;
  stroke-width: 2;
}
.gallery > .quiet {
  grid-column: 1 / -1;
  justify-self: center;
  margin: 8px 0 0;
}

/* Cinema Studio takes are wide, so their tiles are too. */
.studio-workspace .gallery.studio-gallery {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  padding: 0;
}
.studio-gallery > .history-item {
  aspect-ratio: 16 / 10;
}

/* The Video list: the player on the left, with a play button and its length; Details and Favorite beside the
   prompt. A grid of tiles is the other layout. */
.video-history.list .history-preview {
  position: relative;
  overflow: hidden;
}
.video-history.list .history-preview :is(img, video) {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}
.play-button {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--scrim);
  color: var(--text);
  transition:
    opacity 180ms var(--ease),
    background 150ms var(--ease);
}
.play-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.history-preview.playing .play-button {
  opacity: 0;
}
.history-preview.playing:hover .play-button,
.history-preview.playing .play-button:focus-visible {
  opacity: 1;
}
.favorite-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.video-history.grid.media-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  padding: 0 0 24px;
}
.video-history.grid > .history-item {
  aspect-ratio: 16 / 9;
}

@media (max-width: 760px) {
  .image-workspace .gallery-heading {
    padding: 14px 12px 10px;
  }
  .gallery.media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 0 12px 330px;
  }
  .studio-workspace .gallery.studio-gallery {
    grid-template-columns: minmax(0, 1fr);
    padding: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .history-item.pending .history-preview::after {
    animation: none;
  }
  .media-grid .history-preview :is(img, video) {
    transition: none;
  }
}

/* Dialogs: the surface, heading and close button every dialog shares. */
.modal {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px -20px var(--shadow);
}
.modal::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(4px);
}
.modal .icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.modal .icon-button:hover {
  background: var(--chip);
  color: var(--text);
}
.modal .icon-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* The detail dialog, shared by the galleries and Assets: the media on the left, the facts and actions on the
   right. One primary action, Download, spans the column; the others sit beneath it two to a row. */
.detail-modal,
.asset-dialog {
  width: min(1120px, calc(100vw - 40px));
  max-height: calc(100dvh - 40px);
  padding: 16px;
  overflow: auto;
}
.detail-modal .detail-layout,
.asset-dialog .detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: stretch;
}
.detail-media {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 12px;
  background: var(--bg);
}
.detail-media .detail-image {
  display: block;
  width: 100%;
  height: min(70vh, 720px);
  max-height: none;
  border-radius: 0;
  background: none;
  object-fit: contain;
}
.detail-media audio {
  width: calc(100% - 32px);
}
.detail-waiting {
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}
.detail-waiting h2 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
}
.detail-waiting p {
  margin: 0;
}
.detail-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  padding: 4px 4px 4px 0;
  font-size: 13px;
}
.detail-info .modal-heading {
  align-items: flex-start;
  gap: 12px;
  margin: 0;
}
.detail-info .modal-heading h2 {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.detail-close {
  flex: none;
  margin: -2px -4px 0 0;
}
.detail-prompt {
  max-height: 160px;
  margin: 0;
  overflow: auto;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.detail-info .detail-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
  color: var(--faint);
  font-size: 12.5px;
}
.detail-info .detail-meta :is(dt, dd) {
  margin: 0;
}
.detail-info .detail-meta dd {
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.detail-meta dd .quiet {
  min-height: 0;
  padding: 0;
  color: var(--accent);
  font-size: 12.5px;
}
.detail-info .detail-references {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.detail-info .detail-references:empty {
  display: none;
}
.detail-info .detail-references :is(img, video) {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
}
.detail-buttons {
  display: grid;
  gap: 8px;
  margin-top: auto;
}
.detail-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 14px/1 var(--ui);
  text-decoration: none;
}
.detail-primary:hover {
  background: var(--accent-hover);
}
.detail-primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.detail-info .detail-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.detail-info .detail-actions:empty {
  display: none;
}
.detail-action {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 36px;
  height: auto;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: var(--chip);
  color: var(--text);
  font: 500 13px/1.25 var(--ui);
  text-align: left;
  white-space: normal;
  cursor: pointer;
  transition: background 150ms var(--ease);
}
.detail-action[hidden] {
  display: none;
}
.detail-action .ic {
  color: var(--muted);
}
.detail-action:hover:not(:disabled) {
  background: var(--chip-hover);
}
.detail-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.detail-action.liked,
.detail-action.liked .ic {
  color: var(--accent);
}
.detail-action.liked .ic {
  fill: currentColor;
}
.detail-info form {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* The tools on a video (video-tools.js), as Higgsfield's Edit | Extend | Trim bar: on the video, above the player's
   own controls, the open tool white. */
.detail-media {
  position: relative;
}
.video-tools {
  position: absolute;
  bottom: 60px;
  left: 50%;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  background: var(--scrim);
  box-shadow: 0 8px 24px -8px var(--shadow);
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}
.video-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: 500 13px/1 var(--ui);
}
.video-tool:hover {
  background: var(--chip-hover);
}
/* Under the mouse too: style.css's button:hover would otherwise darken it under its dark label. */
.video-tool[aria-pressed='true'],
.video-tool[aria-pressed='true']:hover:not(:disabled) {
  background: var(--text);
  color: var(--bg);
}
.video-tool:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* A tool's panel takes the side panel's place: Extend's direction, prompt, duration and settings, then Generate. Edit's
   panel is built from the same parts: its Prompt tab, prompt, settings and the video's length, then Generate. Trim's
   panel has its In / Out and Download. */
.extend-panel,
.trim-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  font-size: 13px;
}
.extend-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}
.extend-heading h2 {
  flex: 1;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.extend-heading .detail-close {
  margin: 0;
}
.extend-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
}
/* Prequel | Sequel and the resolutions are the composer's segmented control (composer.css .workflow-tabs). */
.extend-panel .workflow-tabs button {
  height: 34px;
  min-height: 34px;
  font-weight: 600;
}
.extend-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-2);
}
.extend-label {
  color: var(--faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.extend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.extend-row output {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
#extend-prompt,
#edit-prompt {
  width: 100%;
  min-height: 76px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--ui);
  resize: vertical;
}
#extend-prompt::placeholder,
#edit-prompt::placeholder {
  color: var(--faint);
}
#extend-prompt:focus-visible,
#edit-prompt:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.extend-prompt-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.extend-images {
  display: contents;
}
.extend-image {
  position: relative;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.extend-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.extend-image button {
  position: absolute;
  top: 1px;
  right: 1px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--scrim);
  color: var(--text);
}
#extend-duration {
  width: 100%;
  margin: 0;
  accent-color: var(--text);
}
.extend-advanced summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.extend-advanced summary::-webkit-details-marker {
  display: none;
}
.extend-advanced summary::after {
  width: 7px;
  height: 7px;
  border-right: 1.8px solid var(--muted);
  border-bottom: 1.8px solid var(--muted);
  content: '';
  transform: rotate(45deg);
  transition: transform 150ms var(--ease);
}
.extend-advanced[open] summary::after {
  transform: rotate(-135deg);
}
.extend-advanced[open] summary {
  margin-bottom: 4px;
}
.extend-reminder {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 12.5px;
  line-height: 1.45;
}
.extend-foot {
  display: grid;
  gap: 8px;
  margin-top: auto;
}
.extend-foot .gen {
  width: 100%;
}
.extend-notice {
  margin: 0;
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.45;
}
.extend-notice:empty,
.extend-hint:empty {
  display: none;
}
.extend-hint {
  margin: 0;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}
/* Edit's "Whole video 0:00 – 0:04" above its prompt, and its Duration: the video's length, to read, not to choose. */
.edit-segment {
  margin: 0;
  color: var(--faint);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.edit-segment strong {
  color: var(--accent);
  font-weight: 600;
}
.edit-duration {
  display: grid;
  place-items: center;
  height: 34px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Trim (trim.js) is offered once the server gives the video's length; a bar with no tool to show is not drawn. */
.video-tool[hidden],
.video-tools:not(:has(.video-tool:not([hidden]))) {
  display: none;
}
/* Trim's panel shares Extend's heading and cards. In and Out sit side by side under the status, as on Higgsfield. */
.trim-times {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border-radius: 10px;
  background: var(--bg);
}
.trim-status {
  grid-column: 1 / -1;
  margin: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
}
.trim-time {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  color: var(--faint);
  font-size: 12px;
}
.trim-time + .trim-time {
  border-left: 1px solid var(--line);
}
.trim-time input {
  width: 100%;
  min-height: 0;
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: 600 14px/1.3 var(--ui);
  font-variant-numeric: tabular-nums;
}
.trim-time input:focus-visible {
  outline: none;
  box-shadow: 0 1px 0 var(--accent);
}
.trim-help {
  margin: 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.45;
}
.trim-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 8px;
}
.trim-actions .detail-action {
  justify-content: center;
}
/* The timeline under the video while Trim is open: the part kept, outlined, between two handles, and where the video
   is. The video gives it room, and the bar on the video moves up by its height. */
.detail-media.trimming .detail-image {
  height: min(62vh, 640px);
}
.detail-media.trimming .video-tools {
  bottom: 124px;
}
.trim-timeline {
  box-sizing: border-box;
  width: 100%;
  padding: 12px 16px 16px;
}
.trim-track {
  position: relative;
  height: 36px;
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  touch-action: none;
}
.trim-range {
  position: absolute;
  top: 0;
  bottom: 0;
  box-sizing: border-box;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  pointer-events: none;
}
.trim-playhead {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--text);
  pointer-events: none;
}
.trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  margin-left: -7px;
  border-radius: 5px;
  background: var(--accent);
  cursor: ew-resize;
}
.trim-handle::after {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: 6px;
  width: 2px;
  border-radius: 1px;
  background: var(--accent-ink);
  content: '';
}
.trim-handle:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .detail-modal,
  .asset-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    padding: 12px;
  }
  .detail-modal .detail-layout,
  .asset-dialog .detail-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .detail-media .detail-image {
    height: 42vh;
  }
  .detail-info {
    padding: 0;
  }
}

/* Assets: the library tabs, then search and the filters as chips, then the media in tiles grouped by day. */
.assets-view {
  display: block;
  min-height: calc(100dvh - var(--header-h));
  padding: 0;
}
.assets-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 20px 40px;
}
.assets-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.assets-heading h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
#assets-total {
  color: var(--faint);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.assets-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  overflow-x: auto;
  align-self: flex-start;
  max-width: 100%;
  border-radius: 12px;
  background: var(--surface);
  scrollbar-width: none;
}
.assets-tabs button {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: 500 13.5px/1 var(--ui);
  white-space: nowrap;
  transition:
    background 150ms var(--ease),
    color 150ms var(--ease);
}
.assets-tabs button[aria-selected='true'] {
  background: var(--chip-hover);
  color: var(--text);
}
.assets-tabs button:hover:not([aria-selected='true']) {
  color: var(--text);
}
.assets-tabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.assets-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.assets-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(280px, 100%);
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--chip);
  color: var(--muted);
}
.assets-search:focus-within {
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.assets-search input {
  flex: 1;
  min-width: 0;
  height: 32px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 400 13.5px/1 var(--ui);
}
.assets-search input:focus {
  outline: none;
}
.assets-date input {
  width: auto;
  color-scheme: dark;
  text-align: left;
}
.assets-date input::-webkit-calendar-picker-indicator {
  opacity: 0.5;
  cursor: pointer;
}
.assets-date.empty input::-webkit-datetime-edit {
  color: var(--muted);
}
/* Native selects shown as chips (controls.js): the gallery filters beside the search box. */
.history-filters .select-chip {
  flex: none;
}
.assets-spacer {
  flex: 1;
}
.assets-toolbar .view-toggle .chip.active {
  background: var(--chip-hover);
  color: var(--text);
}
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  align-items: start;
  gap: 12px 8px;
}
.asset-date {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.asset-date:first-child {
  margin-top: 0;
}
.asset-card {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.asset-preview {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  width: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
}
.asset-preview :is(img, video) {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms var(--ease);
}
@media (hover: hover) {
  .asset-preview:hover :is(img, video) {
    transform: scale(1.03);
  }
}
.asset-preview:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.asset-media {
  position: relative;
  min-width: 0;
}
.asset-card-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 0 2px;
}
.asset-card-copy strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.asset-card-copy small {
  overflow: hidden;
  color: var(--faint);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-grid.list {
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}
.asset-grid.list .asset-card {
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 6px;
  border-radius: 12px;
  background: var(--surface);
}
.asset-grid.list .asset-preview {
  aspect-ratio: 1;
  border-radius: 9px;
}
.asset-grid.list .asset-card-copy strong {
  white-space: normal;
}
.asset-new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  aspect-ratio: 4 / 5;
  min-height: 0;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: 500 13.5px/1 var(--ui);
}
.asset-new:hover {
  border-color: var(--faint);
  color: var(--text);
}
.asset-grid.list .asset-new {
  flex-direction: row;
  aspect-ratio: auto;
  height: 52px;
}
.assets-empty {
  grid-column: 1 / -1;
  padding: 72px 20px;
  color: var(--muted);
  text-align: center;
}
.assets-empty h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 17px;
}
.assets-footer {
  display: flex;
  justify-content: center;
}
.assets-footer [hidden] {
  display: none;
}
.asset-card .video-badge {
  top: 8px;
  left: 8px;
}
.detail-meta dd small {
  color: var(--faint);
  font-size: 12px;
}

@media (max-width: 760px) {
  .assets-page {
    gap: 12px;
    padding: 14px 12px 32px;
  }
  .assets-tabs {
    flex-wrap: wrap;
    align-self: stretch;
  }
  .assets-search {
    width: 100%;
  }
  .assets-spacer {
    display: none;
  }
  .asset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Admin, a light pass. One danger style for every destructive button (remove, reject, turn off, stop): tinted,
   never a filled block, so the primary action stays the one that stands out. */
button.danger,
#ops-shutdown-confirm {
  border: 1px solid transparent;
  background: var(--danger-bg);
  color: var(--danger);
}
button.danger:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.danger-zone {
  border-top-color: var(--line);
}
.operations-chevron .ic {
  transition: transform 150ms var(--ease);
}
.operations[open] > summary .operations-chevron {
  transform: none;
}
.operations[open] > summary .operations-chevron .ic {
  transform: rotate(180deg);
}
.admin-heading > .chip,
.section-heading > .chip {
  border: 0;
}
.user-access-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
@media (max-width: 760px) {
  .admin-view td button[data-user] {
    padding: 6px 14px;
  }
}

/* The references library: drawn icons where glyphs stood. */
.new-element-icon .ic {
  width: 22px;
  height: 22px;
  margin: 0 auto;
}
[data-edit-element] .ic {
  margin: auto;
}
.library-card :is(img, video) {
  object-fit: cover;
}
.movement-glyph .ic {
  width: 24px;
  height: 24px;
}

/* Uploads (uploads.js): the filter tabs and Sort by chip, in the reference library and on the Assets page. */
.upload-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.upload-filters .upload-tabs {
  align-self: auto;
}
.upload-filters .select-chip {
  margin-left: auto;
}
.library-upload-filters {
  padding: 14px 20px 0;
}
/* An audio upload: its name, its waveform and a round play button, as on Higgsfield. */
.audio-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 14px 14px 60px;
  border-radius: 12px;
  background: var(--surface-2);
  text-align: left;
}
.audio-name {
  display: block;
  overflow: hidden;
  color: var(--text);
  font: 500 13px/1.3 var(--ui);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audio-owner {
  color: var(--faint);
  font: 12px/1.3 var(--ui);
}
.assets-tabs button[hidden] {
  display: none;
}
.audio-wave {
  display: flex;
  flex: 1;
  align-items: center;
  min-height: 0;
  color: var(--faint);
}
.audio-wave svg {
  width: 100%;
  height: min(56px, 100%);
  fill: currentColor;
}
.audio-wave.pending {
  opacity: 0.5;
}
.audio-play {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  transition: background 150ms var(--ease);
}
.audio-play:hover {
  background: #fff;
}
.audio-play.is-playing {
  background: var(--accent);
  color: var(--accent-ink);
}
.audio-play:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.audio-play .ic {
  width: 16px;
  height: 16px;
}
.library-card.audio-card {
  position: relative;
}
.library-card .audio-tile {
  height: 210px;
}
.asset-grid.list .audio-tile {
  padding: 6px;
}
.asset-grid.list .audio-name {
  display: none;
}
.asset-grid.list .audio-play {
  bottom: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
}
@media (max-width: 760px) {
  .library-upload-filters {
    padding: 12px 12px 0;
  }
  .library-card .audio-tile {
    height: 165px;
  }
}

/* Claude access: the account menu's panel for personal access tokens. */
.claude-access-modal {
  width: min(520px, calc(100vw - 32px));
}
.claude-access-modal > p.muted {
  margin: 0 0 20px;
  line-height: 1.5;
}
.claude-access-modal input {
  background: var(--surface-2);
  border-color: var(--line-strong);
  border-radius: 10px;
}
.claude-access-options {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.claude-access-lifetime {
  display: grid;
  gap: 8px;
  color: #b8bbc3;
}
.claude-access-secret {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
}
.claude-access-secret[hidden] {
  display: none;
}
.claude-access-secret code {
  display: block;
  max-height: 120px;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  font:
    12px/1.6 ui-monospace,
    monospace;
  overflow-wrap: anywhere;
  user-select: all;
}
.claude-access-secret p {
  margin: 0;
}
.claude-access-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.claude-access-modal .error:not(:empty) {
  margin-top: 12px;
}
.claude-access-list {
  margin-top: 20px;
  max-height: 40vh;
  overflow: auto;
}
.claude-access-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.claude-access-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.claude-access-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.claude-access-info small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.claude-access-empty {
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}
.claude-access-extension {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.claude-access-howto {
  margin: 12px 0 20px;
  color: #b8bbc3;
}
.claude-access-howto summary {
  cursor: pointer;
}
.claude-access-howto ol,
.claude-access-secret ol {
  margin: 8px 0;
  padding-left: 20px;
  line-height: 1.6;
}
.claude-access-howto p {
  margin: 8px 0 0;
  line-height: 1.5;
}
.claude-access-secret section {
  display: grid;
  gap: 8px;
  justify-items: start;
}
.claude-access-secret section code {
  justify-self: stretch;
}
.claude-access-heading {
  margin: 20px 0 0;
  font-size: 14px;
}
.claude-access-heading + .claude-access-list {
  margin-top: 8px;
}
.claude-access-secret .claude-access-download {
  color: var(--accent);
  text-decoration: underline;
}
