* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg: oklch(0.977 0.006 255);
  --surface: oklch(0.995 0.003 255);
  --surface-strong: oklch(0.998 0.002 255);
  --surface-muted: oklch(0.958 0.006 255);
  --ink: oklch(0.205 0.018 255);
  --ink-soft: oklch(0.485 0.025 255);
  --ink-faint: oklch(0.675 0.02 255);
  --line: oklch(0.924 0.007 255);
  --line-strong: oklch(0.89 0.01 255);
  --brand: oklch(0.22 0.014 255);
  --brand-dark: oklch(0.22 0.014 255);
  --brand-hover: oklch(0.29 0.014 255);
  --accent: oklch(0.54 0.19 272);
  --accent-soft: oklch(0.956 0.026 272);
  --green: oklch(0.62 0.17 147);
  --green-dark: oklch(0.41 0.12 147);
  --green-soft: oklch(0.969 0.033 147);
  --blue: oklch(0.55 0.19 259);
  --blue-soft: oklch(0.963 0.027 259);
  --violet: oklch(0.58 0.19 285);
  --violet-soft: oklch(0.955 0.027 285);
  --orange: oklch(0.68 0.15 62);
  --orange-soft: oklch(0.965 0.043 72);
  --mint: oklch(0.969 0.033 147);
  --warning-ink: oklch(0.49 0.105 74);
  --warning-bg: oklch(0.974 0.044 83);
  --warning-line: oklch(0.846 0.083 82);
  --danger: oklch(0.56 0.2 28);
  --danger-dark: oklch(0.48 0.19 28);
  --danger-soft: oklch(0.972 0.03 28);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --shadow-soft: 0 1px 2px oklch(0.205 0.018 255 / 0.04), 0 12px 32px oklch(0.205 0.018 255 / 0.05);
  --shadow-small: 0 1px 2px oklch(0.205 0.018 255 / 0.05), 0 1px 3px oklch(0.205 0.018 255 / 0.04);
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 "Inter", "Aptos", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
}

body.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top, oklch(0.995 0.002 255), transparent 42%),
    linear-gradient(180deg, oklch(0.986 0.004 255), var(--bg));
}

a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
}

button,
.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--brand-dark);
  background: var(--brand-dark);
  color: var(--surface-strong);
  border-radius: var(--radius-sm);
  padding: 8px 15px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  box-shadow: var(--shadow-small);
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

button:hover,
.button:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  text-decoration: none;
  transform: translateY(-1px);
}

button:active,
.button:active {
  transform: translateY(0);
  box-shadow: none;
}

button.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

button.secondary:hover {
  background: var(--surface-muted);
  border-color: var(--line-strong);
}

button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid oklch(0.54 0.19 272 / 0.32);
  outline-offset: 2px;
}

input,
select {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: none;
}

.language-combobox {
  position: relative;
}

.language-combobox-input {
  width: 100%;
}

.language-combobox-list {
  position: absolute;
  z-index: 200;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.language-combobox-option {
  padding: 7px 11px;
  cursor: pointer;
  color: var(--ink);
  font-size: inherit;
}

.language-combobox-option:hover,
.language-combobox-option--active {
  background: var(--surface-muted);
}

input[type="file"] {
  min-width: 0;
  max-width: 100%;
  border-style: dashed;
  background: var(--surface-muted);
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
}

input[type="file"]::file-selector-button {
  min-height: 28px;
  margin: 0 10px 0 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell .panel.narrow {
  width: min(100%, 420px);
  margin: 0;
  box-shadow: var(--shadow-soft);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  margin: 4px 8px 14px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), oklch(0.36 0.016 255));
  position: relative;
}

.brand-mark::after {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 13px;
  height: 13px;
  border-radius: 4px;
  border: 2.5px solid var(--surface-strong);
  content: "";
}

.brand:hover {
  color: var(--ink);
  text-decoration: none;
}

.sidebar-toggle {
  display: none;
  flex: 0 0 auto;
}

.side-nav {
  display: grid;
  gap: 2px;
}

.side-nav p {
  margin: 16px 12px 6px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.side-nav a {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-sm);
  padding: 0 12px;
  color: var(--ink-soft);
  font-weight: 550;
}

.side-nav a:hover {
  background: var(--surface-muted);
  color: var(--ink);
  text-decoration: none;
}

.side-nav a[aria-current="page"] {
  background: var(--surface-muted);
  color: var(--ink);
  font-weight: 650;
}

.nav-icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  opacity: 0.92;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: auto;
  padding: 12px 10px 6px;
  border-top: 1px solid var(--line);
}

.sidebar-user-meta {
  display: grid;
  min-width: 0;
}

.sidebar-user strong {
  font-size: 13px;
  font-weight: 650;
}

.sidebar-user small {
  color: var(--ink-soft);
}

.user-avatar {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--accent));
  color: var(--surface-strong);
  font-size: 13px;
  font-weight: 700;
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  background: oklch(0.995 0.003 255 / 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar form {
  margin: 0;
}

.search-box {
  width: min(520px, 46vw);
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0 10px 0 14px;
  background: var(--surface);
  color: var(--ink-faint);
}

.search-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.search-box input {
  min-height: 32px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink-soft);
}

.search-box input:disabled {
  opacity: 1;
  cursor: text;
}

.search-box input:focus {
  outline: none;
}

.search-box kbd {
  min-width: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 3px 7px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  text-align: center;
}

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

.provider-balance {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
}

.provider-balance[hidden] {
  display: none;
}

.provider-balance:focus-visible {
  outline: 3px solid oklch(0.54 0.19 272 / 0.32);
  outline-offset: 2px;
}

.online-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: default;
}

a.online-pill {
  cursor: pointer;
}

a.online-pill:hover {
  border-color: var(--line-strong);
  background: var(--bg);
}

.online-pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px oklch(0.62 0.17 147 / 0.16);
}

.ghost-icon-button {
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.ghost-icon-button svg {
  width: 18px;
  height: 18px;
}

.ghost-icon-button:hover {
  background: var(--surface-muted);
  border-color: var(--line-strong);
  color: var(--ink);
  transform: none;
}

.notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--surface);
}

.page {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 28px 56px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.section-head h1 {
  max-width: 840px;
  margin: 0;
  font-size: 30px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.section-head p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
}

.muted {
  color: var(--ink-soft);
  margin: 0 0 4px;
}

.section-head .muted {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.panel,
.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-small);
}

.panel > h2 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.panel-heading p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.provider-credentials-panel {
  max-width: 880px;
}

.credential-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.credential-status div {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--surface-muted);
}

.credential-status dt {
  margin: 0 0 6px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.credential-status dd {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.provider-credential-form {
  display: grid;
  gap: 12px;
}

.provider-credential-form textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.project-create-form textarea {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.project-create-form textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.field-help {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.4;
  text-transform: none;
}

.panel > h3,
.import-group h3 {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-heading-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.modal-heading h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0;
  border-radius: var(--radius-sm);
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}

.icon-button[hidden] {
  display: none;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.1;
}

.icon-button.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  box-shadow: none;
}

.icon-button.secondary:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 24px 70px oklch(0.205 0.018 255 / 0.22);
}

.modal::backdrop {
  background: oklch(0.205 0.018 255 / 0.4);
  backdrop-filter: blur(3px);
}

.modal-panel {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.modal-fullscreen {
  width: calc(100vw - 48px);
  max-width: none;
  height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
}

.preview-modal-panel {
  height: 100%;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
}

.preview-modal-panel [data-preview-content] {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.modal-heading p {
  margin: 6px 0 0;
  color: var(--ink-soft);
}

.preview-state {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--ink-soft);
  padding: 14px 16px;
}

.preview-state strong,
.preview-state span {
  display: block;
}

.preview-state-error {
  border-color: oklch(0.844 0.07 24);
  background: oklch(0.973 0.024 24);
  color: var(--danger);
  font-weight: 650;
}

.preview-hint {
  margin: 0 0 10px;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.preview-table-wrap {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.preview-table {
  min-width: 2180px;
}

.preview-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
  border-bottom: 2px solid var(--line-strong);
  padding-top: 10px;
  padding-bottom: 10px;
}

.preview-table th {
  vertical-align: top;
  white-space: nowrap;
}

.preview-table td {
  vertical-align: top;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-table tbody tr:hover td {
  background: oklch(0.973 0.006 255);
}

.preview-table tbody tr:hover td.preview-thumbnail-cell {
  background: oklch(0.973 0.006 255);
}

.preview-text-trigger {
  appearance: none;
  display: inline;
  width: auto;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 400;
  justify-content: flex-start;
  line-height: inherit;
  margin: 0;
  padding: 0;
  text-align: left;
  transform: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-text-trigger:hover,
.preview-text-trigger:focus-visible {
  background: transparent;
  box-shadow: none;
  color: var(--accent);
  transform: none;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}

.preview-text-trigger:focus-visible {
  outline: 2px solid oklch(0.54 0.19 272 / 0.32);
  outline-offset: 2px;
}

.preview-text-dialog {
  width: min(860px, calc(100vw - 80px));
  --preview-text-area-height: min(720px, calc(100vh - 210px));
}

.preview-readiness-dialog {
  width: min(520px, calc(100vw - 80px));
}

.log-dialog,
.json-dialog,
.youtube-story-preview-dialog,
.youtube-story-subtitles-dialog {
  width: min(1040px, calc(100vw - 80px));
}

.log-modal-panel,
.json-modal-panel,
.youtube-story-preview-panel,
.youtube-story-subtitles-panel {
  max-height: min(880px, calc(100vh - 80px));
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
}

.log-modal-panel {
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
}

.youtube-story-form-panel {
  max-height: min(800px, calc(100vh - 80px));
  overflow-y: auto;
}

.youtube-story-modal-form {
  display: grid;
  gap: 14px;
}

.youtube-story-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 4px;
}

.log-modal-content {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow: auto;
}

.log-section {
  display: grid;
  gap: 8px;
}

.log-section h3 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.log-output {
  max-height: min(620px, calc(100vh - 260px));
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--ink);
  padding: 14px;
  font: 0.82rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.log-output.is-muted {
  color: var(--ink-soft);
}

.log-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.log-controls label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.log-controls button {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.log-controls button[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.log-controls select {
  min-height: 30px;
  width: auto;
  padding: 4px 8px;
  font-size: 12px;
}

.log-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  font: 0.82rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  align-items: baseline;
}

.log-row:last-child {
  border-bottom: 0;
}

.log-field {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.log-timestamp {
  color: var(--ink-faint);
  flex-shrink: 0;
}

.log-level-badge {
  display: inline-flex;
  align-items: center;
  min-width: 54px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.log-event {
  color: var(--ink-soft);
  font-weight: 600;
  flex-shrink: 0;
}

.log-message {
  flex: 1;
  min-width: 0;
}

.log-level--info .log-level-badge {
  background: var(--blue-soft);
  color: var(--blue);
}

.log-level--warning .log-level-badge {
  background: var(--warning-bg);
  color: var(--warning-ink);
}

.log-level--error .log-level-badge {
  background: var(--danger-soft);
  color: var(--danger);
}

.log-level--debug .log-level-badge,
.log-level--trace .log-level-badge,
.log-level--unknown .log-level-badge {
  background: var(--surface-muted);
  color: var(--ink-soft);
}

.log-repeated-group {
  margin: 2px 0 2px 20px;
  font: 0.82rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.log-repeated-group summary {
  padding: 4px 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.log-row--repeated {
  background: var(--surface-muted);
  font-size: 0.78rem;
}

.log-truncated-notice {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--warning-line);
  border-radius: var(--radius-sm);
  background: var(--warning-bg);
  color: var(--warning-ink);
  font-size: 13px;
  font-weight: 600;
}

.json-output {
  min-height: 0;
  max-height: min(680px, calc(100vh - 220px));
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--ink);
  padding: 14px;
  font: 0.82rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.youtube-story-preview-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  color: var(--ink-soft);
  background: var(--surface-muted);
}

.youtube-story-preview-table-wrap {
  min-height: 0;
  max-height: min(680px, calc(100vh - 220px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.youtube-story-preview-table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.youtube-story-preview-table th,
.youtube-story-preview-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.youtube-story-preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.youtube-story-preview-table tbody tr:last-child td {
  border-bottom: 0;
}

.youtube-story-preview-table a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.youtube-story-preview-number {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.youtube-story-preview-th-thumb {
  width: 88px;
  min-width: 88px;
}

.youtube-story-preview-thumb-cell {
  padding: 6px 10px;
  vertical-align: middle;
  width: 88px;
  min-width: 88px;
}

.youtube-story-preview-thumb-img {
  display: block;
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.youtube-story-preview-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.youtube-story-preview-actions[hidden] {
  display: none;
}

.youtube-story-preview-actions label {
  display: grid;
  gap: 7px;
  margin: 0;
}

.youtube-story-preview-actions textarea {
  width: 100%;
  min-height: 74px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.youtube-story-preview-actions textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.youtube-story-preview-notes {
  grid-column: 1 / -1;
}

.youtube-story-preview-option {
  grid-column: 1 / 3;
  align-self: center;
}

.youtube-story-preview-actions > button {
  justify-self: end;
}

.youtube-story-subtitles-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
}

.youtube-story-subtitles-controls label {
  display: grid;
  gap: 7px;
  margin: 0;
}

.youtube-story-subtitles-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  color: var(--ink-soft);
  background: var(--surface-muted);
}

.youtube-story-subtitles-table-wrap {
  min-height: 0;
  max-height: min(640px, calc(100vh - 260px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.youtube-story-subtitles-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.youtube-story-subtitles-table th,
.youtube-story-subtitles-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.youtube-story-subtitles-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.youtube-story-subtitles-table tbody tr:last-child td {
  border-bottom: 0;
}

.youtube-story-subtitles-table a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.youtube-story-subtitles-status {
  color: var(--ink-soft);
}

.preview-readiness-panel {
  gap: 16px;
}

.preview-readiness-result {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
}

.preview-readiness-result strong {
  display: block;
  margin-bottom: 10px;
}

.preview-readiness-result ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--ink-soft);
}

.preview-readiness-result.is-ready {
  border-color: oklch(0.876 0.092 147);
  background: var(--green-soft);
  color: var(--green-dark);
}

.preview-readiness-result.is-blocked {
  border-color: oklch(0.88 0.11 84);
  background: oklch(0.982 0.036 92);
  color: var(--warning-ink);
}

.preview-text-panel {
  max-height: min(880px, calc(100vh - 80px));
  overflow: hidden;
}

.preview-text-body {
  min-height: min(360px, calc(100vh - 210px));
  max-height: var(--preview-text-area-height);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--ink);
  padding: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-text-body:not(.is-editing) {
  cursor: text;
}

.preview-text-body:not(.is-editing):hover {
  border-color: oklch(0.54 0.19 272 / 0.46);
  background: oklch(0.973 0.021 272);
}

.preview-text-body.is-editing {
  height: var(--preview-text-current-height, var(--preview-text-area-height));
  padding: 0;
  background: var(--surface-strong);
}

.preview-text-body.is-saving {
  opacity: 0.72;
}

.preview-text-editor {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  resize: vertical;
  border: 0;
  border-radius: calc(var(--radius-md) - 1px);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 16px;
  font: inherit;
  line-height: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.preview-text-editor:focus {
  outline: 3px solid oklch(0.54 0.19 272 / 0.22);
  outline-offset: -3px;
}

.preview-edit-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: -8px;
}

.preview-edit-toolbar[hidden] {
  display: none;
}

.preview-edit-action {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 9px;
  background: var(--surface);
  box-shadow: none;
  transform: none;
}

.preview-edit-action:hover {
  transform: none;
}

.preview-edit-action:disabled {
  cursor: progress;
  opacity: 0.62;
  transform: none;
}

.preview-edit-cancel {
  border-color: oklch(0.884 0.06 24);
  color: var(--danger);
}

.preview-edit-cancel:hover {
  border-color: oklch(0.797 0.094 24);
  background: oklch(0.973 0.024 24);
  color: var(--danger-dark);
}

.preview-edit-save {
  border-color: oklch(0.876 0.092 147);
  color: var(--green);
}

.preview-edit-save:hover {
  border-color: oklch(0.794 0.13 147);
  background: var(--green-soft);
  color: var(--green-dark);
}

.preview-edit-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.preview-table td.preview-id-cell {
  width: 72px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  white-space: nowrap;
  overflow-wrap: normal;
}

.preview-table td.preview-en-name-cell {
  min-width: 160px;
  max-width: 200px;
  color: var(--ink-soft);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: normal;
}

.preview-table td.preview-identity-context-cell {
  min-width: 280px;
  max-width: 360px;
  color: var(--ink-soft);
  font-size: 13px;
  white-space: pre-wrap;
}

.preview-identity-context-cell .preview-text-trigger {
  display: block;
  min-width: 280px;
  max-width: 360px;
}

.preview-title-cell {
  min-width: 200px;
}

.preview-text-cell {
  min-width: 340px;
}

.preview-table .preview-count-cell {
  min-width: 120px;
  text-align: right;
  vertical-align: top;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow-wrap: normal;
  color: var(--ink-soft);
  font-size: 13px;
}

.preview-count-zero {
  color: var(--ink-faint);
}

.preview-gallery-count-cell {
  position: relative;
  vertical-align: top !important;
}

.preview-count-button {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  box-shadow: none;
  font: inherit;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
  transform: none;
}

.preview-count-button:hover {
  border-color: var(--accent);
  background: oklch(0.973 0.021 272);
  transform: none;
}

.preview-count-button:focus-visible {
  outline: 2px solid oklch(0.54 0.19 272 / 0.34);
  outline-offset: 2px;
}

.preview-col-thumb,
.preview-table td.preview-thumbnail-cell {
  width: 96px;
  min-width: 96px;
}

.preview-table td.preview-thumbnail-cell {
  padding: 8px 10px;
  vertical-align: top;
  white-space: normal;
  font-size: 0;
  line-height: 0;
}

.link-button {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  min-height: 0;
  box-shadow: none;
}

.preview-thumbnail-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: top;
  width: 72px;
  height: 48px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface-muted);
  border-radius: 8px;
  box-shadow: none;
  cursor: zoom-in;
  overflow: hidden;
}

.preview-thumbnail-trigger:hover {
  background: var(--surface-muted);
  border-color: var(--accent);
  transform: none;
}

.preview-thumbnail-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-thumbnail-empty {
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  line-height: 1.5;
}

.preview-image-upload-empty {
  width: 72px;
  min-height: 48px;
  padding: 0;
  border: 1px dashed var(--line-strong);
  background: var(--surface-muted);
  border-radius: 8px;
  cursor: pointer;
}

.preview-image-upload-empty:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.preview-gallery-dialog {
  width: min(820px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
}

.preview-gallery-panel {
  max-height: calc(100vh - 48px);
  gap: 18px;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
}

.preview-gallery-panel .modal-heading {
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.preview-gallery-panel .modal-heading h2 {
  max-width: 620px;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.35rem;
  line-height: 1.15;
}

.preview-gallery-panel .modal-heading p {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
}

.preview-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  grid-auto-rows: 132px;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 2px 4px 4px 2px;
}

.preview-gallery-thumbnail {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 132px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface-strong), var(--surface-muted));
  box-shadow: none;
  cursor: zoom-in;
  overflow: hidden;
  transform: none;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.preview-gallery-thumbnail:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px oklch(0.205 0.018 255 / 0.12);
  transform: translateY(-1px);
}

.preview-gallery-thumbnail:focus-visible {
  outline: 3px solid oklch(0.54 0.19 272 / 0.3);
  outline-offset: 2px;
}

.preview-gallery-thumbnail img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-gallery-index {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 7px;
  border: 1px solid oklch(1 0 0 / 0.58);
  border-radius: 999px;
  background: oklch(0.205 0.018 255 / 0.68);
  color: white;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1;
  backdrop-filter: blur(8px);
}

.preview-gallery-thumbnail.is-broken {
  border-style: dashed;
  color: var(--ink-soft);
  cursor: default;
}

.preview-gallery-broken-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 10px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

.preview-image-dialog {
  width: min(1080px, calc(100vw - 64px));
  max-height: calc(100vh - 64px);
}

.preview-image-panel {
  max-height: calc(100vh - 64px);
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.preview-image-url {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.preview-image-status {
  margin: -2px 0 4px;
}

.preview-thumbnail-regenerate[disabled] {
  cursor: wait;
  opacity: 0.6;
}

.preview-image-target.is-regenerating {
  opacity: 0.72;
}

.preview-image-upload-dialog {
  width: min(520px, calc(100vw - 32px));
}

.preview-image-upload-form {
  gap: 16px;
}

.preview-image-upload-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.preview-image-upload-modes label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  cursor: pointer;
}

.preview-image-upload-modes input {
  width: auto;
  min-height: 0;
}

.preview-image-upload-field {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.preview-image-upload-field[hidden] {
  display: none;
}

.preview-image-upload-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.preview-image-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  padding: 12px;
}

.preview-image-target {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 220px);
  object-fit: contain;
}

.preview-image-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-small);
  transition: background-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.preview-image-nav:hover {
  background: var(--surface-strong);
  transform: translateY(-50%) scale(1.05);
}

.preview-image-nav:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.preview-image-nav[hidden] {
  display: none;
}

.preview-image-nav-prev {
  left: 12px;
}

.preview-image-nav-next {
  right: 12px;
}

@media (max-width: 640px) {
  .preview-image-nav {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
  .preview-image-nav-prev {
    left: 6px;
  }
  .preview-image-nav-next {
    right: 6px;
  }
}

.narrow {
  max-width: 420px;
  margin: 72px auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: inherit;
}

.projects-table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-small);
}

.projects-table {
  min-width: 760px;
}

.project-id-cell {
  width: 72px;
  white-space: nowrap;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.projects-table thead th {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
}

.projects-table th,
.projects-table td {
  padding: 14px 20px;
}

.projects-table tbody tr {
  transition: background-color 120ms ease;
}

.projects-table tbody tr.project-row-finished {
  background: var(--mint);
}

.projects-table tbody tr:hover {
  background: var(--surface-muted);
}

.projects-table tbody tr.project-row-finished:hover {
  background: oklch(0.935 0.056 147);
}

.projects-table a {
  color: var(--ink);
  font-weight: 650;
}

.projects-table a:hover {
  color: var(--green-dark);
}

.project-detail-head {
  align-items: flex-end;
}

.project-title-block {
  min-width: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  vertical-align: baseline;
}

.status-active {
  border-color: oklch(0.55 0.19 259 / 0.24);
  background: var(--blue-soft);
  color: var(--blue);
}

.status-finished {
  border-color: oklch(0.62 0.17 147 / 0.24);
  background: var(--green-soft);
  color: var(--green-dark);
}

.status-archived {
  background: var(--surface-muted);
  color: var(--ink-soft);
}

.project-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 336px);
  gap: 20px;
  align-items: start;
}

.project-main-column,
.project-side-column {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.project-main-column > *,
.project-side-column > * {
  min-width: 0;
}

.project-side-column {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.detail-table-wrap {
  overflow-x: auto;
  box-shadow: none;
}

.detail-table {
  min-width: 820px;
  table-layout: fixed;
}

.detail-table th,
.detail-table td {
  padding: 13px 16px;
  overflow-wrap: anywhere;
}

.detail-table a {
  overflow-wrap: anywhere;
}

.space-video-images-panel {
  display: grid;
  gap: 18px;
}

.space-video-images-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.space-video-images-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 750;
  line-height: 1.15;
}

.space-video-images-header p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-weight: 600;
}

.space-video-images-percent {
  display: grid;
  justify-items: end;
  min-width: 112px;
  color: var(--ink-soft);
}

.space-video-images-percent strong {
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
  font-weight: 760;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.space-video-images-percent span,
.space-video-images-progress-row span,
.space-video-images-chip span,
.space-video-images-status-block > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.space-video-images-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) minmax(260px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.space-video-images-progress {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.space-video-images-progress-row {
  display: grid;
  gap: 7px;
}

.space-video-images-progress-row div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.space-video-images-progress-row strong,
.space-video-images-chip strong {
  font-variant-numeric: tabular-nums;
}

.space-video-images-progress-row progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--surface-muted);
}

.space-video-images-progress-row progress::-webkit-progress-bar {
  background: var(--surface-muted);
}

.space-video-images-progress-row progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--green);
}

.space-video-images-progress-row progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--green);
}

.space-video-images-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.space-video-images-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--surface-muted);
}

.space-video-images-chip strong {
  color: var(--ink);
}

.space-video-images-status-block {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.space-video-images-status-block strong {
  color: var(--ink);
  font-weight: 700;
}

.space-video-images-status-block a:not(.button) {
  color: var(--green-dark);
  font-weight: 720;
}

.space-video-images-status-block form {
  margin: 0;
}

.space-video-images-status-block .button,
.space-video-images-status-block button {
  width: fit-content;
}

.video-images-operations-panel.panel {
  padding: 0;
  overflow: hidden;
}

.video-images-operations-summary {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  transition: background-color 140ms ease;
}

.video-images-operations-summary::-webkit-details-marker {
  display: none;
}

.video-images-operations-summary:hover {
  background: var(--surface-muted);
}

.video-images-operations-summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.video-images-operations-panel[open] .video-images-operations-summary {
  border-bottom: 1px solid var(--line);
}

.video-images-operations-toggle {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
}

.video-images-operations-toggle::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 6px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  border-radius: 0 0 2px 0;
  transform: rotate(-45deg);
  transition: transform 180ms ease;
}

.video-images-operations-panel[open] .video-images-operations-toggle::before {
  transform: rotate(45deg);
}

.video-images-operations-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.video-images-operations-title p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.video-images-operations-percent {
  display: grid;
  justify-items: end;
  color: var(--ink-soft);
}

.video-images-operations-percent strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.video-images-operations-percent span,
.video-images-operations-chip span,
.video-images-operations-status-block > span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.video-images-operations-body {
  display: grid;
  gap: 14px;
  padding: 16px 20px 20px;
}

.video-images-operations-counters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.video-images-operations-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--surface-muted);
}

.video-images-operations-chip strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.video-images-operations-status-block {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.video-images-operations-status-block strong {
  color: var(--ink);
  font-weight: 700;
}

.video-images-operations-status-block a:not(.button) {
  color: var(--green-dark);
  font-weight: 720;
}

.video-images-operations-status-block form {
  margin: 0;
}

.video-images-operations-status-block .button,
.video-images-operations-status-block button {
  width: fit-content;
}

.flat-video-images-status.panel {
  padding: 0;
  overflow: hidden;
}

.flat-video-images-status-summary {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  transition: background-color 140ms ease;
}

.flat-video-images-status-summary::-webkit-details-marker {
  display: none;
}

.flat-video-images-status-summary:hover {
  background: var(--surface-muted);
}

.flat-video-images-status-summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.flat-video-images-status[open] .flat-video-images-status-summary {
  border-bottom: 1px solid var(--line);
}

.flat-video-images-status-summary h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.flat-video-images-status-toggle {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
}

.flat-video-images-status-toggle::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 6px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  border-radius: 0 0 2px 0;
  transform: rotate(-45deg);
  transition: transform 180ms ease;
}

.flat-video-images-status[open] .flat-video-images-status-toggle::before {
  transform: rotate(45deg);
}

.flat-video-images-status-body {
  padding: 0 20px 20px;
}

.space-visual-map {
  display: grid;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.space-visual-map[open] {
  border-color: var(--line-strong);
  box-shadow: 0 1px 3px oklch(0.205 0.018 255 / 0.06);
}

.space-visual-map-head {
  display: grid;
  grid-template-columns: 20px max-content minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  list-style: none;
  transition: background-color 140ms ease;
}

.space-visual-map[open] .space-visual-map-head {
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.space-visual-map-head::-webkit-details-marker {
  display: none;
}

.space-visual-map-head:hover {
  background: var(--surface-muted);
}

.space-visual-map-head:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.space-visual-map-toggle {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
}

.space-visual-map-toggle::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 6px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  border-radius: 0 0 2px 0;
  transform: rotate(-45deg);
  transition: transform 180ms ease;
}

.space-visual-map[open] .space-visual-map-toggle::before {
  transform: rotate(45deg);
}

.space-visual-map-head:hover .space-visual-map-toggle::before {
  border-color: var(--ink);
}

.space-visual-map-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.space-visual-map-summary {
  justify-self: end;
  max-width: 100%;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.space-visual-map-body {
  display: block;
  min-width: 0;
  padding: 12px 14px 14px;
}

.space-visual-map-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  max-height: min(440px, 52vh);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 2px 8px 0;
  scrollbar-gutter: stable;
  scrollbar-color: var(--ink-faint) transparent;
  scrollbar-width: thin;
}

.space-visual-map-scroll::-webkit-scrollbar {
  width: 10px;
}

.space-visual-map-scroll::-webkit-scrollbar-track {
  border-radius: 999px;
  background: transparent;
}

.space-visual-map-scroll::-webkit-scrollbar-thumb {
  border: 2px solid var(--surface-muted);
  border-radius: 999px;
  background: var(--ink-faint);
}

.space-visual-map-scroll:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.space-visual-map-track {
  display: grid;
  gap: 7px;
  width: 100%;
  min-width: 0;
}

.space-visual-map-row {
  display: grid;
  grid-template-columns: minmax(210px, 255px) minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.space-visual-map-label {
  display: grid;
  grid-template-columns: 48px minmax(120px, 1fr) 72px;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.2;
}

.space-visual-map-label strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.space-visual-map-label span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.space-visual-map-label em {
  color: var(--ink-faint);
  font-style: normal;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.space-visual-map-cells {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding-top: 1px;
}

.space-visual-map-cell {
  display: block;
  min-width: 14px;
  min-height: 14px;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-muted);
  box-shadow: inset 0 0 0 1px oklch(0.998 0.002 255 / 0.55);
  cursor: pointer;
  transform: none;
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.space-visual-map-cell:hover {
  border-color: var(--ink-soft);
  background: var(--surface);
  box-shadow:
    inset 0 0 0 1px oklch(0.998 0.002 255 / 0.75),
    0 1px 3px oklch(0.205 0.018 255 / 0.16);
  transform: translateY(-1px);
}

.space-visual-map-cell:active {
  box-shadow: inset 0 0 0 1px oklch(0.205 0.018 255 / 0.08);
  transform: translateY(0);
}

.space-visual-map-cell:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.space-visual-map-cell-ready {
  border-color: var(--green-dark);
  background: var(--green);
}

.space-visual-map-cell-ready:hover {
  border-color: var(--green-dark);
  background: var(--green);
}

.space-visual-map-cell-partial {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.space-visual-map-cell-partial:hover {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.space-visual-map-cell-failed {
  border-color: var(--danger-dark);
  background: var(--danger);
  box-shadow:
    inset 0 0 0 1px oklch(0.998 0.002 255 / 0.24),
    0 0 0 2px oklch(0.56 0.2 28 / 0.18);
}

.space-visual-map-cell-failed:hover {
  border-color: var(--danger-dark);
  background: var(--danger);
  box-shadow:
    inset 0 0 0 1px oklch(0.998 0.002 255 / 0.32),
    0 0 0 3px oklch(0.56 0.2 28 / 0.22);
}

.space-visual-map-cell-stale {
  border-color: var(--warning-ink);
  background: var(--warning-bg);
  box-shadow:
    inset 0 0 0 1px oklch(0.998 0.002 255 / 0.45),
    0 0 0 2px oklch(0.49 0.105 74 / 0.18);
}

.space-visual-map-cell-stale:hover {
  border-color: var(--warning-ink);
  background: var(--warning-bg);
  box-shadow:
    inset 0 0 0 1px oklch(0.998 0.002 255 / 0.6),
    0 0 0 3px oklch(0.49 0.105 74 / 0.22);
}

.space-visual-map-cell-query_ready,
.space-visual-map-cell-images_ready {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.space-visual-map-cell-query_ready:hover,
.space-visual-map-cell-images_ready:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.space-visual-map-cell-pending,
.space-visual-map-cell-missing {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.space-visual-map-empty {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.space-visual-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 10px;
}

.space-visual-map-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.space-visual-map-legend-item .space-visual-map-cell {
  min-width: 10px;
  min-height: 10px;
  width: 10px;
  height: 10px;
  cursor: default;
  pointer-events: none;
}

.space-block-preview-dialog {
  width: min(1180px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: hidden;
}

.space-block-preview-panel {
  width: 100%;
  max-height: calc(100vh - 24px);
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  gap: 14px;
}

.space-block-preview-panel .modal-heading {
  min-width: 0;
}

.space-block-preview-panel .modal-heading > div {
  min-width: 0;
}

.space-block-preview-panel .modal-heading p {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.space-block-preview-panel [data-space-block-preview-content] {
  min-width: 0;
}

.space-block-preview {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.space-block-preview-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.space-block-preview-summary div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.space-block-preview-summary strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.space-block-preview-summary span {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

.space-block-preview-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.space-block-preview-badges span {
  width: fit-content;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.space-block-preview-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
}

.space-block-preview-state::before {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.space-block-preview-failed .space-block-preview-state,
.space-block-preview-stale .space-block-preview-state {
  border-color: var(--danger-dark);
  background: var(--danger-soft);
  color: var(--danger-dark);
}

.space-block-preview-notice,
.space-block-preview-error,
.space-block-preview-empty {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
}

.space-block-preview-notice {
  border: 1px solid var(--warning-line);
  background: var(--warning-bg);
  color: var(--warning-ink);
}

.space-block-preview-error {
  border: 1px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger-dark);
}

.animate-media-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.animate-media-progress > div {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.animate-media-progress strong {
  flex-basis: 100%;
}

.animate-media-progress span {
  color: var(--ink-soft);
  font-size: 12px;
}

.space-block-preview-video {
  min-width: 0;
}

.space-block-preview-video video {
  display: block;
  width: min(100%, 960px);
  margin-top: 12px;
  border-radius: 8px;
  background: rgb(0 0 0);
}

.space-block-preview-diagnostics {
  margin: 10px 0 0;
}

dl.space-block-preview-diagnostics {
  display: grid;
  gap: 6px;
}

.space-block-preview-diagnostics > div {
  display: grid;
  grid-template-columns: minmax(90px, 0.25fr) 1fr;
  gap: 8px;
}

.space-block-preview-diagnostics dt {
  color: var(--ink-soft);
}

.space-block-preview-diagnostics dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.space-block-preview-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.space-block-preview-action [role="status"],
.space-block-preview-action [role="alert"] {
  color: var(--ink-soft);
  font-size: 12px;
}

@media (max-width: 760px) {
  .animate-media-progress {
    grid-template-columns: 1fr;
  }
}

.space-block-preview-empty {
  border: 1px dashed var(--line-strong);
  background: var(--surface-muted);
  color: var(--ink-soft);
}

.space-block-preview-section {
  display: grid;
  gap: 8px;
}

.space-block-preview-body {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: start;
  gap: 18px;
  min-width: 0;
}

.space-block-preview-section {
  min-width: 0;
}

.space-block-preview-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.space-block-preview-text {
  max-height: min(420px, calc(100vh - 310px));
  max-width: 100%;
  margin: 0;
  padding: 13px 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.space-block-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  min-width: 0;
}

.space-block-preview-image {
  position: relative;
  display: block;
  min-height: 96px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  box-shadow: var(--shadow-small);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.space-block-preview-image:hover {
  border-color: var(--ink-soft);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.space-block-image-dialog {
  width: min(1180px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
}

.space-block-preview-image span {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  min-width: 24px;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.space-block-preview-image img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.row-actions form {
  margin: 0;
}

.compact-button {
  min-height: 32px;
  padding: 5px 10px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metrics div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-small);
}

.metrics strong {
  display: block;
  font-size: 25px;
  line-height: 1.05;
  font-weight: 740;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.metrics span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.run-activity-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.run-activity-percent {
  font-size: 22px;
  font-weight: 740;
  font-variant-numeric: tabular-nums;
}

.run-timeline {
  list-style: none;
  margin: 14px 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.run-timeline-step {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.run-timeline-label {
  font-weight: 700;
  font-size: 13px;
}

.run-timeline-state {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.run-timeline-step.is-done {
  border-color: rgb(47, 158, 68);
  background: color-mix(in srgb, rgb(47, 158, 68) 8%, transparent);
}

.run-timeline-step.is-active {
  border-color: rgb(25, 113, 194);
  background: color-mix(in srgb, rgb(25, 113, 194) 10%, transparent);
}

.run-timeline-step.is-failed {
  border-color: rgb(224, 49, 49);
  background: color-mix(in srgb, rgb(224, 49, 49) 10%, transparent);
}

.run-activity-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
}

.status-chip-succeeded { border-color: rgb(47, 158, 68); color: rgb(47, 158, 68); }
.status-chip-failed { border-color: rgb(224, 49, 49); color: rgb(224, 49, 49); }
.status-chip-running { border-color: rgb(25, 113, 194); color: rgb(25, 113, 194); }
.status-chip-waiting_external { border-color: rgb(240, 140, 0); color: rgb(240, 140, 0); }
.status-chip-cancelled { border-color: var(--ink-soft); color: var(--ink-soft); }
.status-chip-idle { border-color: var(--line-strong); color: var(--ink-faint); }
.status-chip-complete { border-color: var(--green); color: var(--green-dark); }

.run-poll-warning {
  margin-top: 10px;
  color: rgb(232, 89, 12);
  font-size: 13px;
}

.run-stuck-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: rgb(255, 247, 237);
  border: 1px solid rgb(253, 186, 116);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.run-stuck-banner p {
  flex: 1;
  margin: 0;
  color: rgb(154, 52, 18);
  font-size: 14px;
}

.run-stuck-banner button {
  flex-shrink: 0;
  background: rgb(234, 88, 12);
  border-color: rgb(234, 88, 12);
  color: rgb(255, 255, 255);
  font-size: 13px;
  min-height: 32px;
  padding: 4px 12px;
  white-space: normal;
}

.run-stuck-banner button:hover {
  background: rgb(194, 65, 12);
  border-color: rgb(194, 65, 12);
}

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

.forms form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.action-list,
.stage-grid {
  display: grid;
  align-items: stretch;
}

.action-list form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
  min-width: 0;
}

.upload-list {
  gap: 8px;
}

.upload-collapsible {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.upload-collapsible[open] {
  border-color: var(--line-strong);
  box-shadow: 0 1px 3px oklch(0.205 0.018 255 / 0.06);
}

.upload-collapsible-summary {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
  transition: background-color 140ms ease;
}

.upload-collapsible[open] .upload-collapsible-summary {
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.upload-collapsible-summary::-webkit-details-marker {
  display: none;
}

.upload-collapsible-summary:hover {
  background: var(--surface-muted);
}

.upload-collapsible-summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.upload-collapsible-toggle {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
}

.upload-collapsible-toggle::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 6px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  border-radius: 0 0 2px 0;
  transform: rotate(-45deg);
  transition: transform 180ms ease;
}

.upload-collapsible[open] .upload-collapsible-toggle::before {
  transform: rotate(45deg);
}

.upload-collapsible-summary:hover .upload-collapsible-toggle::before {
  border-color: var(--ink);
}

.upload-collapsible > .upload-form {
  padding: 12px;
}

.action-list .upload-form {
  grid-template-columns: 1fr;
}

.upload-form input[type="file"] {
  align-self: stretch;
}

.upload-form button {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
}

.stage-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stage-grid form,
.stage-grid button {
  width: 100%;
}

.stage-grid button {
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-align: center;
}

.export-form {
  display: grid;
  gap: 10px;
}

.checkbox-control {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.checkbox-control input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.export-parts-control {
  display: grid;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.export-parts-control input {
  max-width: 120px;
}

.export-form button {
  width: 100%;
}

.stack {
  display: grid;
  gap: 14px;
}

.stack label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stack label[hidden] {
  display: none;
}

.error {
  color: var(--danger);
  font-weight: 600;
}

.warning {
  color: var(--warning-ink);
  background: var(--warning-bg);
  border: 1px solid var(--warning-line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.flash {
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  padding: 12px 14px;
  font-weight: 600;
}

.flash-error {
  color: var(--danger);
  background: oklch(0.973 0.024 24);
  border: 1px solid oklch(0.844 0.07 24);
}

.flash-warning {
  color: var(--warning-ink);
  background: var(--warning-bg);
  border: 1px solid var(--warning-line);
}

.flash-success {
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid oklch(0.876 0.092 147);
}

.read-only-notice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 16px;
  border: 1px solid var(--warning-line);
  border-radius: var(--radius-md);
  background: var(--warning-bg);
  color: var(--warning-ink);
  padding: 14px 16px;
  box-shadow: var(--shadow-small);
}

.read-only-notice span {
  color: var(--warning-ink);
}

.action-unavailable {
  display: inline-block;
  margin: 0;
  margin-right: 8px;
  color: var(--ink-soft);
}

.project-create-form {
  width: 100%;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
}

.status-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.status-form label {
  display: grid;
  gap: 4px;
  color: var(--ink-soft);
}

.status-form span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-form select {
  min-width: 150px;
}

.danger-form {
  display: flex;
  align-items: flex-end;
}

.danger-button {
  border-color: var(--danger);
  background: var(--danger);
}

.danger-button:hover {
  border-color: var(--danger-dark);
  background: var(--danger-dark);
}

.details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 11px 16px;
  align-items: baseline;
}

.details dt {
  min-width: 0;
  color: var(--ink-soft);
  font-weight: 650;
}

.details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.run-warnings-list {
  margin: 11px 0 0;
  padding-left: 18px;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
}

.queue-alerts {
  margin: 0;
  padding-left: 0;
  list-style-position: inside;
}

.queue-alerts:empty {
  display: none;
}

.import-group {
  margin-top: 18px;
}

.import-group:first-of-type {
  margin-top: 0;
}

.import-group h3 {
  margin-bottom: 8px;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  body.sidebar-collapsed .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  body.sidebar-collapsed .sidebar {
    display: none;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .topbar .sidebar-toggle {
    order: -1;
  }

  .search-box {
    width: min(400px, 42vw);
  }

  .project-detail-layout {
    grid-template-columns: 1fr;
  }

  .project-side-column {
    position: static;
  }

  .space-video-images-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    flex-direction: column;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    margin: 4px 4px 10px;
  }

  .side-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .side-nav p,
  .sidebar-user,
  .online-pill,
  .search-box kbd {
    display: none;
  }

  .side-nav a {
    flex: 0 0 auto;
    min-height: 38px;
  }

  .topbar {
    min-height: 56px;
    padding: 0 14px;
  }

  .space-video-images-header {
    display: grid;
  }

  .space-video-images-percent {
    justify-items: start;
  }

  .space-video-images-chips {
    grid-template-columns: 1fr;
  }

  .video-images-operations-summary,
  .flat-video-images-status-summary {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .video-images-operations-percent {
    grid-column: 2;
    justify-items: start;
  }

  .flat-video-images-status-summary .muted {
    grid-column: 2;
  }

  .video-images-operations-counters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .space-visual-map-head {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .space-visual-map-summary {
    grid-column: 2;
    justify-self: start;
  }

  .space-visual-map-scroll {
    max-height: min(380px, 56vh);
    overflow-x: hidden;
    overflow-y: auto;
  }

  .space-visual-map-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .space-visual-map-label {
    grid-template-columns: 46px minmax(120px, 1fr) 72px;
  }

  .space-block-preview-body {
    grid-template-columns: 1fr;
  }

  .space-block-preview-dialog {
    width: min(100vw - 16px, 720px);
    max-height: calc(100vh - 16px);
  }

  .space-block-preview-panel {
    max-height: calc(100vh - 16px);
    padding: 18px;
  }

  .space-block-preview-summary {
    display: grid;
  }

  .space-block-preview-badges {
    justify-content: flex-start;
  }

  .search-box {
    width: 100%;
  }

  .page {
    padding: 22px 14px 40px;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .section-head h1 {
    font-size: 26px;
  }

  .section-head p {
    font-size: 14px;
  }

  .project-actions {
    justify-content: flex-start;
  }

  .project-detail-head {
    align-items: stretch;
  }

  .project-metrics {
    grid-template-columns: 1fr;
  }

  .modal-fullscreen {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
  }

  .preview-modal-panel {
    padding: 16px;
  }

  .preview-table {
    min-width: 1980px;
  }

  .preview-text-dialog {
    width: calc(100vw - 32px);
  }

  .preview-readiness-dialog {
    width: calc(100vw - 32px);
  }

  .preview-gallery-dialog {
    width: calc(100vw - 32px);
  }

  .preview-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    grid-auto-rows: 112px;
    gap: 10px;
  }

  .preview-gallery-thumbnail {
    min-height: 112px;
  }

  .log-dialog,
  .json-dialog,
  .youtube-story-preview-dialog,
  .youtube-story-subtitles-dialog {
    width: calc(100vw - 32px);
  }

  .youtube-story-preview-actions {
    grid-template-columns: 1fr;
  }

  .youtube-story-preview-notes,
  .youtube-story-preview-option {
    grid-column: auto;
  }

  .youtube-story-preview-actions > button {
    justify-self: stretch;
  }

  .youtube-story-subtitles-controls {
    grid-template-columns: 1fr;
  }

  .details {
    grid-template-columns: 1fr;
  }

  .details dt {
    margin-top: 6px;
  }

  .forms form,
  .status-form,
  .danger-form {
    width: 100%;
  }

  .action-list form,
  .stage-grid {
    grid-template-columns: 1fr;
  }

  .upload-form button {
    width: 100%;
  }

  button,
  .button,
  .status-form select {
    width: 100%;
  }

  .topbar-actions button {
    width: auto;
    min-width: 38px;
    white-space: nowrap;
  }
}

.project-switcher {
  position: relative;
  display: inline-block;
}

.project-switcher h1 {
  margin: 0;
}

.project-switcher-trigger,
.project-switcher-trigger:hover,
.project-switcher-trigger:active,
.project-switcher-trigger:focus,
.project-switcher-trigger:focus-visible {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  min-height: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  box-shadow: none;
  transform: none;
}

.project-switcher-caret {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: transparent;
  font-size: 0;
  transition:
    background-color 140ms ease,
    transform 180ms ease;
}

.project-switcher-caret::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: -3px;
  border-right: 2px solid var(--ink-faint);
  border-bottom: 2px solid var(--ink-faint);
  border-radius: 0 0 2px 0;
  transform: rotate(45deg);
  transition: border-color 140ms ease;
}

.project-switcher-trigger:hover .project-switcher-caret {
  background: var(--surface-muted);
}

.project-switcher-trigger:hover .project-switcher-caret::before,
.project-switcher-trigger:focus-visible .project-switcher-caret::before {
  border-color: var(--accent);
}

.project-switcher-trigger[aria-expanded="true"] .project-switcher-caret {
  background: var(--accent-soft);
  transform: rotate(180deg);
}

.project-switcher-trigger[aria-expanded="true"] .project-switcher-caret::before {
  border-color: var(--accent);
}

.project-switcher-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 50;
  min-width: 320px;
  max-width: 420px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow:
    0 12px 32px oklch(0.205 0.018 255 / 0.16),
    0 2px 6px oklch(0.205 0.018 255 / 0.08);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform-origin: top left;
  animation: project-switcher-pop 150ms ease;
}

@keyframes project-switcher-pop {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.project-switcher-popover[hidden],
.project-switcher-list[hidden],
.project-switcher-state[hidden] {
  display: none;
}

.project-switcher-heading {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.project-switcher-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.project-switcher-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.project-switcher-section-title {
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.project-switcher-state {
  font-size: 0.85rem;
  color: var(--ink-soft);
  padding: 6px 4px;
}

.project-switcher-state-error {
  color: var(--danger-dark);
}

.project-switcher-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-color: var(--ink-faint) transparent;
  scrollbar-width: thin;
}

.project-switcher-item {
  border-radius: var(--radius-sm);
}

.project-switcher-item-link,
.project-switcher-item-current {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
  transition: background-color 120ms ease;
}

.project-switcher-item-link:hover,
.project-switcher-item-link:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.project-switcher-item-current {
  background: var(--surface-muted);
  cursor: default;
}

.project-switcher-item-name {
  font-weight: 550;
}

.project-switcher-item-meta {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.project-switcher-view-all {
  border-top: 1px solid var(--line);
  margin-top: 2px;
  padding-top: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  transition: color 120ms ease;
}

.project-switcher-view-all:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ── Stage board ─────────────────────────────────────────────────────────── */

.stage-board-scroll {
  overflow-x: auto;
}

.stage-board {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.stage-board th {
  padding: 0 10px 8px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.stage-board th:first-child {
  padding-left: 0;
}

.stage-board th:last-child {
  padding-right: 0;
}

.stage-board td {
  padding: 10px 10px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.stage-board td:first-child {
  padding-left: 0;
}

.stage-board td:last-child {
  padding-right: 0;
}

.stage-board tbody tr:last-child td {
  border-bottom: none;
}

.stage-board-name {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
}

.stage-board-bar-cell {
  width: 180px;
  min-width: 120px;
}

.stage-board-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-board-bar {
  flex: 1 1 auto;
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}

.stage-board-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--green);
  transition: width 0.4s ease;
}

.stage-board-bar-fill.is-complete {
  background: var(--green);
}

.stage-board-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  min-width: 32px;
  text-align: right;
}

.stage-board-pct.is-complete {
  color: var(--green-dark);
}

.stage-board-count {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-faint);
}

.stage-board-count.is-nonzero {
  color: var(--ink);
}

.stage-board-count.is-running {
  color: var(--blue);
}

.stage-board-count.is-failed {
  color: var(--danger);
}

.stage-board-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stage-board-dot.is-running {
  background: var(--blue);
  animation: stage-board-pulse 1.4s ease-in-out infinite;
}

.stage-board-dot.is-failed {
  background: var(--danger);
}

.stage-board-dot.is-todo {
  background: var(--line-strong);
}

.stage-board-count.is-retrying {
  color: var(--orange);
}

.stage-board-dot.is-retrying {
  background: var(--orange);
}

.stage-board-retry-hint {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-faint);
  white-space: nowrap;
  margin-top: 2px;
}

.stage-board td:last-child {
  text-align: right;
  white-space: nowrap;
  min-width: 100px;
}

.stage-board-action-btn {
  min-height: 30px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.stage-board-done-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green-dark);
  padding: 4px 0;
}

.stage-board-done-check svg {
  width: 14px;
  height: 14px;
  stroke: var(--green);
  flex-shrink: 0;
}

.stage-board-action-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.stage-board-operator-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
}

.stage-board-run-ref {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  color: var(--ink-soft);
  font-weight: 400;
}

.stage-board-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.stage-board-total {
  font-size: 11px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.stage-board-refresh-time {
  font-size: 11px;
  color: var(--ink-faint);
  margin-left: auto;
}

.stage-board-empty {
  font-size: 13px;
  color: var(--ink-faint);
  padding: 8px 0;
}

@keyframes stage-board-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ── Advanced / Diagnostics collapsible ─────────────────────────────────── */

.diag-collapsible {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.diag-collapsible[open] {
  border-color: var(--line-strong);
  box-shadow: 0 1px 3px oklch(0.205 0.018 255 / 0.06);
}

.diag-summary {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-soft);
  transition: background-color 140ms ease, color 140ms ease;
}

.diag-collapsible[open] .diag-summary {
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  color: var(--ink);
}

.diag-summary::-webkit-details-marker {
  display: none;
}

.diag-summary:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.diag-summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.diag-toggle {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
}

.diag-toggle::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 6px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ink-faint);
  border-bottom: 2px solid var(--ink-faint);
  border-radius: 0 0 2px 0;
  transform: rotate(-45deg);
  transition: transform 180ms ease, border-color 140ms ease;
}

.diag-collapsible[open] .diag-toggle::before {
  transform: rotate(45deg);
}

.diag-summary:hover .diag-toggle::before {
  border-color: var(--ink-soft);
}

.diag-body {
  display: grid;
  gap: 0;
  padding: 14px 14px 16px;
}

.diag-body section {
  padding-bottom: 14px;
}

.diag-section-divider {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.diag-section-heading {
  margin-bottom: 12px;
}

.diag-section-heading h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---- Health page ---- */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.health-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px 20px 16px;
}

.health-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.health-card-header strong {
  flex: 1;
  font-size: 14px;
}

.health-label {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-soft);
}

.health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ink-faint);
}

.health-ok .health-dot { background: var(--green); box-shadow: 0 0 0 3px oklch(0.62 0.17 147 / 0.14); }
.health-ok .health-label { background: var(--green-soft); color: var(--green-dark); }

.health-warn .health-dot { background: var(--orange); box-shadow: 0 0 0 3px oklch(0.68 0.15 62 / 0.14); }
.health-warn .health-label { background: var(--orange-soft); color: var(--warning-ink); }

.health-fail .health-dot { background: var(--danger); box-shadow: 0 0 0 3px oklch(0.56 0.2 28 / 0.14); }
.health-fail .health-label { background: var(--danger-soft); color: var(--danger-dark); }

.health-details {
  display: grid;
  gap: 6px;
  margin: 0;
}

.health-details > div {
  display: flex;
  gap: 8px;
  font-size: 13px;
}

.health-details dt {
  color: var(--ink-faint);
  min-width: 80px;
}

.health-details dd {
  margin: 0;
  color: var(--ink);
  word-break: break-all;
}

.health-error-text { color: var(--danger-dark); }
.health-warn-text { color: var(--warning-ink); }

.health-queue-badge {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  margin: 0 2px 2px 0;
}

.health-overall {
  font-size: 14px;
  color: var(--ink-soft);
}

.health-ok-text strong { color: var(--green-dark); }
.health-fail-text strong { color: var(--danger-dark); }

/* ---- Topbar health pill variants ---- */
.online-pill--degraded .online-pill__dot {
  background: var(--orange);
  box-shadow: 0 0 0 3px oklch(0.68 0.15 62 / 0.16);
}

.online-pill--down .online-pill__dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px oklch(0.56 0.2 28 / 0.14);
}

/* ---- Flat video images status table ---- */
.flat-status-row:hover { background: var(--surface-muted); }
.flat-status-row.flat-status-failed,
.flat-status-row.flat-status-retrying { background: oklch(0.972 0.03 28 / 0.15); }

.flat-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.flat-status-badge-ready   { background: var(--green-soft); color: var(--green-dark); }
.flat-status-badge-running { background: var(--blue-soft);  color: var(--blue); }
.flat-status-badge-retrying{ background: var(--orange-soft); color: var(--orange); }
.flat-status-badge-failed  { background: var(--danger-soft); color: var(--danger-dark); }
.flat-status-badge-pending { background: var(--surface-muted); color: var(--ink-soft); }
.flat-status-badge-empty   { background: var(--surface-muted); color: var(--ink-faint); }

.flat-status-error {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--danger-dark);
  font-size: 12px;
}
