:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #dfe4ea;
  --text: #17202a;
  --muted: #637083;
  --accent: #0f8b8d;
  --accent-2: #e4572e;
  --soft: #eef8f8;
  --danger: #b42318;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
}
body.modal-open { overflow: hidden; }

#app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: #101820;
  color: white;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 800;
}

.brand span, .account, small, p { color: var(--muted); }
.sidebar .brand span { color: #9fb0bf; display: block; font-size: 12px; margin-top: 4px; }

nav {
  display: grid;
  gap: 8px;
}

.nav, button {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.nav {
  text-align: left;
  background: transparent;
  color: #d7e0e8;
}

.nav.active, .nav:hover { background: rgba(255,255,255,.12); }
.ghost { background: #edf2f7; color: var(--text); }
.sidebar .ghost { background: rgba(255,255,255,.12); color: white; margin-top: 10px; width: 100%; }

button:disabled,
.button-link:disabled {
  opacity: .48;
  cursor: not-allowed;
  filter: grayscale(.2);
}

.account {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.14);
  padding-top: 16px;
}
#accountName { color: white; font-weight: 800; }
#accountMeta { color: #9fb0bf; font-size: 13px; margin-top: 4px; }

main { padding: 28px; min-width: 0; }
.view { display: block; }
.hidden { display: none !important; }

.login-panel {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
}
.login-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 12px 30px rgba(16,24,32,.08);
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 28px; }
h2 { font-size: 17px; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: minmax(360px, .85fr) minmax(440px, 1.15fr); }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 14px;
  background: white;
}
textarea {
  min-height: 280px;
  resize: vertical;
  line-height: 1.55;
  font-family: "SFMono-Regular", Consolas, "Microsoft YaHei", monospace;
}
form { display: grid; gap: 14px; }
.stack { gap: 12px; }
.inline-form {
  grid-template-columns: 1fr 1fr 90px auto;
  align-items: end;
  margin-bottom: 14px;
}

.file-picker {
  border: 1px dashed #aab7c4;
  padding: 18px;
  border-radius: 8px;
  background: #fbfcfd;
  cursor: pointer;
}
.file-picker input { display: none; }
.file-picker span { color: var(--text); font-size: 15px; }
.file-picker em { color: var(--muted); font-style: normal; font-weight: 400; }

.tips, .stat {
  background: var(--soft);
  border: 1px solid #cfeeee;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 4px;
  margin-top: 14px;
}
.stat { min-width: 120px; text-align: center; margin-top: 0; }
.stat span { font-size: 26px; font-weight: 900; color: var(--accent); }

.billing-strip,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.billing-strip div,
.metric-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.billing-strip b,
.billing-strip span,
.metric-card span,
.metric-card strong,
.metric-card small {
  display: block;
}

.billing-strip b,
.metric-card span {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.billing-strip span,
.metric-card strong {
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
}

.metric-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ops-grid {
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(420px, 1.1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.service-list {
  display: grid;
  gap: 9px;
}

.service-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.service-row small {
  display: block;
  margin-top: 3px;
}

.service-row b {
  color: var(--muted);
  font-size: 12px;
}

.service-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}

.service-dot.ok {
  background: #16a34a;
}

.ai-page-header {
  align-items: flex-start;
}

.ai-agent-panel {
  min-height: 330px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 28px;
  margin-bottom: 18px;
}

.ai-agent-panel h2 {
  font-size: 28px;
  letter-spacing: 0;
  margin: 0;
  text-align: center;
}

.agent-mode-toggle {
  padding: 0 4px;
  background: transparent;
  color: #0ba4c8;
  font-size: inherit;
  border-radius: 0;
}

.ai-composer {
  width: min(1120px, 100%);
  min-height: 176px;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr auto;
  gap: 12px 14px;
  padding: 18px;
  border: 1px solid #e5e9ef;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(16, 24, 32, .08);
}

.ai-material-strip {
  grid-row: 1 / span 2;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 220px;
  flex-wrap: wrap;
}

.ai-add-material {
  width: 58px;
  height: 68px;
  border-radius: 4px;
  background: #f0f2f4;
  color: #7c8794;
  font-size: 26px;
  transform: rotate(-7deg);
}

.ai-prompt-editor {
  min-height: 92px;
  outline: none;
  line-height: 1.65;
  color: var(--text);
  padding: 4px 8px;
}

.ai-prompt-editor:empty::before {
  content: attr(data-placeholder);
  color: #9aa5b1;
}

.ai-composer-footer {
  grid-column: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.ai-mode-tabs,
.ai-options {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-mode-tab,
.ai-options select,
.ai-options input {
  height: 38px;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  border-radius: 8px;
  padding: 0 12px;
  width: auto;
}

.ai-mode-tab.active {
  color: var(--accent);
  border-color: #bfe7e7;
  background: var(--soft);
}

.ai-submit {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  font-size: 22px;
  display: grid;
  place-items: center;
  padding: 0;
}

.ai-material-chip {
  width: 72px;
  display: grid;
  gap: 4px;
  position: relative;
}

.ai-material-preview {
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #eef8f8;
  color: var(--accent);
  display: grid;
  place-items: center;
}

.ai-material-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ai-material-name {
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.ai-material-remove {
  position: absolute;
  top: -8px;
  right: 5px;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--danger);
  border: 1px solid #ffd6d1;
}

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

.ai-result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.ai-result-media {
  aspect-ratio: 9 / 12;
  background: #101820;
  display: grid;
  place-items: center;
}

.ai-result-media img,
.ai-result-media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #101820;
}

.ai-result-placeholder {
  color: #d7e0e8;
  font-weight: 800;
}

.ai-result-body {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.ai-result-body p {
  color: var(--text);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ai-subnav {
  display: inline-flex;
  width: fit-content;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ai-subnav button {
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 900;
}

.ai-subnav button.active {
  background: var(--accent);
  color: #fff;
}

.batch-generation-panel {
  display: grid;
  gap: 14px;
}

.batch-summary {
  background: #eaf8f7;
  color: var(--accent);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 900;
  white-space: nowrap;
}

.batch-workbench {
  display: grid;
  gap: 12px;
}

.batch-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfd;
  display: grid;
  gap: 12px;
}

.batch-step > header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
}

.batch-step > header b {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
}

.batch-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.batch-horizontal-groups {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.batch-group-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  display: grid;
  gap: 8px;
  min-width: 280px;
  max-width: 360px;
  flex: 0 0 320px;
}

.batch-group-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 150, 150, .08);
}

.batch-group-main {
  padding: 0;
  background: transparent;
  display: grid;
  gap: 3px;
  justify-items: start;
  text-align: left;
}

.batch-group-main input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 900;
}

.batch-group-main span {
  color: var(--muted);
  font-size: 12px;
}

.batch-material-thumbs {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 42px;
  overflow-x: auto;
}

.batch-material-thumb,
.batch-mini-add {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  background: #edf8f8;
  color: var(--accent);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

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

.batch-text-items {
  display: grid;
  gap: 8px;
}

.batch-text-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.batch-text-item input,
.batch-group-card textarea,
.batch-prompt-label textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  font: inherit;
  line-height: 1.5;
}

.batch-group-actions,
.batch-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}

.batch-group-actions {
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
}

.batch-group-actions label,
.batch-settings-grid label,
.batch-prompt-label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.batch-group-actions input,
.batch-settings-grid input,
.batch-settings-grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
}

.batch-placeholder-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.batch-token-button {
  background: #ecfbfa;
  color: var(--accent);
  border: 1px solid #bfeeed;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 900;
}

.batch-preview-table {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.batch-preview-table table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  background: #fff;
}

.batch-preview-table th,
.batch-preview-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.batch-preview-table th {
  background: #f5f8f8;
  color: var(--muted);
  font-weight: 900;
}

.config-divider {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-weight: 900;
  color: var(--text);
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
}

.list { display: grid; gap: 10px; }
#jobList {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: stretch;
}
.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.item:hover { border-color: var(--accent); }
.job-card {
  min-height: 168px;
  display: grid;
  align-content: space-between;
  gap: 12px;
}
.job-card .item-head strong {
  font-size: 15px;
  line-height: 1.45;
}
.job-card-meta,
.job-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 12px;
}
.job-card-stats span {
  border-radius: 999px;
  padding: 4px 8px;
  background: #f0f3f6;
  color: #334155;
}
.item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}
.badge {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: var(--soft);
  color: var(--accent);
  white-space: nowrap;
}
.badge.failed { background: #fff0ed; color: var(--danger); }
.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.item.compact { padding: 10px 12px; }

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

.result-block section {
  min-width: 0;
}
.summary {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.shot-list {
  display: grid;
  gap: 14px;
}

.shot {
  display: grid;
  grid-template-columns: minmax(210px, 280px) 1fr;
  gap: 14px;
  align-items: start;
  border-left: 4px solid var(--accent);
  background: white;
  border-radius: 8px;
  padding: 14px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.shot h3 { margin: 0 0 8px; font-size: 16px; }
.shot-media {
  display: grid;
  gap: 8px;
}
.shot-media video {
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 360px;
  background: #101820;
  border-radius: 8px;
  border: 1px solid var(--line);
  object-fit: contain;
}
.shot-detail { min-width: 0; }
.shot-grid {
  display: grid;
  gap: 2px;
}
.kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px;
  margin: 7px 0;
  font-size: 14px;
}
.kv b { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #f0f3f6; border-radius: 999px; padding: 4px 8px; font-size: 12px; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #101820;
  color: white;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  max-width: 360px;
}

.progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8edf2;
  margin: 12px 0;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width .25s ease;
}

.actions, .credits-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.compact-actions { margin-top: 10px; }

.ledger-panel { margin-top: 18px; }

.button-link {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 32, .54);
}

.modal-panel {
  position: absolute;
  inset: 24px;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.modal-header h1 { font-size: 22px; }
.modal-header p { margin-bottom: 0; }

.modal-body {
  overflow: auto;
  padding: 18px 22px 24px;
}

.modal [data-open-job] { display: none; }

.breakdown-workspace {
  display: block;
}

.result-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 16px;
}

.result-actions {
  position: sticky;
  top: 0;
  display: grid;
  gap: 8px;
  align-content: start;
}

.result-actions .button-link,
.result-actions .ghost {
  width: 100%;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 16px 0 10px;
}

.section-title-row h2 {
  margin: 0;
}

.video-settings-panel {
  margin: 12px 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fbfcfd;
}

.compose-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 12px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fbfcfd;
}

.compose-readiness-panel {
  align-items: stretch;
}

.compose-readiness-main {
  min-width: 0;
  display: grid;
  gap: 10px;
  flex: 1;
}

.compose-readiness-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.compose-readiness-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.compose-readiness-grid div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.compose-readiness-grid b,
.compose-readiness-grid span {
  display: block;
}

.compose-readiness-grid b {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.compose-readiness-grid span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.compose-output-preview {
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef8f8;
  color: var(--muted);
  font-size: 12px;
}

.compose-output-preview span {
  color: var(--text);
  word-break: break-all;
}

.compose-issues {
  display: grid;
  gap: 6px;
}

.compose-issues span {
  padding: 7px 9px;
  border: 1px solid #f3d5d8;
  border-radius: 8px;
  background: #fff6f7;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

.compose-latest {
  color: var(--muted);
  font-size: 12px;
}

.compose-latest p {
  margin: 4px 0 0;
}

.compose-readiness-actions {
  display: grid;
  gap: 8px;
  align-content: start;
  width: min(260px, 28vw);
  min-width: 210px;
}

.compose-video-preview,
.compose-video-placeholder {
  width: 100%;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff8ed;
  overflow: hidden;
}

.compose-video-preview video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 360px;
  background: #0b1118;
  object-fit: contain;
}

.compose-video-placeholder {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 14px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.failed-text {
  color: var(--danger);
}

.video-settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.material-planner-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding-top: 4px;
  margin-bottom: 10px;
}

.segment-material-planner {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.segment-material-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.global-material-row {
  border-left: 4px solid var(--accent);
  background: #f7fcfc;
}

.segment-material-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.icon-plus {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: #e9fbfb;
  color: #05777b;
  font-size: 22px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

.shot-table-area {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.segment-workbench {
  position: sticky;
  top: 0;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 210px);
  overflow: auto;
  padding-right: 4px;
}

.segment-workbench-head {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  background: var(--panel);
}

.segment-workbench-head h2 { margin: 0; }

.segment-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.segment-card-meta {
  margin-bottom: 10px;
}

.segment-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.shot-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.shot-table {
  width: 100%;
  min-width: 2180px;
  border-collapse: collapse;
  table-layout: fixed;
}

.shot-table th,
.shot-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.shot-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f7f9;
  color: #334155;
  font-weight: 800;
}

.shot-table th:first-child,
.shot-table td:first-child {
  width: 220px;
}

.shot-table th:nth-child(2),
.shot-table td:nth-child(2) {
  width: 180px;
}

.shot-table th:nth-child(3),
.shot-table td:nth-child(3) {
  width: 280px;
}

.shot-table th:nth-child(7),
.shot-table td:nth-child(7) {
  width: 220px;
}

.shot-table th:nth-child(8),
.shot-table td:nth-child(8) {
  width: 180px;
}

.shot-table th:nth-child(9),
.shot-table td:nth-child(9) {
  width: 380px;
}

.shot-table th:nth-child(10),
.shot-table td:nth-child(10) {
  width: 280px;
}

.shot-table th:nth-child(11),
.shot-table td:nth-child(11) {
  width: 240px;
}

.shot-table tr:last-child td { border-bottom: 0; }

.segment-cell {
  background: #f8fbfb;
  border-left: 3px solid var(--accent);
}

.segment-prompt-cell {
  background: #fbfcfd;
}

.segment-prompt-input {
  min-height: 190px;
  font-family: inherit;
  font-size: 13px;
}

.aligned-prompt {
  min-height: 260px;
  resize: vertical;
}

.aligned-material-group {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.aligned-material-group b {
  color: var(--muted);
  font-size: 12px;
}

.compact-material-list {
  margin-bottom: 0;
}

.inline-plus {
  margin-top: 4px;
}

.aligned-result {
  display: grid;
  gap: 8px;
  min-height: 80px;
}

.small-btn {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 12px;
  margin-top: 8px;
}

.material-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.material-chip {
  min-height: 28px;
  padding: 5px 8px;
  background: #eaf7f7;
  color: var(--accent);
  border: 1px solid #cfeeee;
  font-size: 12px;
}

.material-chip.failed {
  background: #fff1f1;
  border-color: #ffd1d1;
  color: #b42318;
}

.generate-btn {
  width: 100%;
  margin-bottom: 8px;
}

.shot-review-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.shot-review-player {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto auto;
  gap: 10px;
  height: auto;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #071018;
  align-self: start;
}

.shot-review-player video {
  width: 100%;
  aspect-ratio: 9 / 16;
  height: auto;
  min-height: 0;
  background: #05080d;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12);
  object-fit: contain;
}

.shot-review-meta {
  display: grid;
  gap: 4px;
  padding: 2px 2px 0;
  font-size: 13px;
  color: #dbeafe;
}

.shot-review-meta strong {
  color: white;
}

.shot-review-meta span {
  color: #72f0ec;
  font-weight: 800;
}

.shot-review-table-wrap {
  height: min(720px, calc(100vh - 285px));
  min-height: 520px;
}

.shot-table-tools {
  position: sticky;
  left: 0;
  z-index: 7;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.shot-table-tools span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.shot-index-cell,
.shot-title-cell,
.shot-plain-cell {
  cursor: pointer;
}

.shot-index-cell {
  text-align: center !important;
  background: #fbfcfd;
}

.shot-index-cell span {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #eaf7f7;
  color: var(--accent);
  font-weight: 900;
}

.shot-title-cell {
  display: grid;
  gap: 6px;
}

.shot-title-cell strong {
  line-height: 1.45;
}

.shot-title-cell small {
  color: var(--accent);
  font-weight: 800;
}

.shot-plain-cell {
  line-height: 1.55;
  word-break: break-word;
}

.shot-index-cell:hover,
.shot-title-cell:hover,
.shot-plain-cell:hover,
.active-shot-row .shot-index-cell,
.active-shot-row .shot-title-cell,
.active-shot-row .shot-plain-cell {
  background: #f4fcfc;
}

.active-shot-row .shot-index-cell span {
  background: var(--accent);
  color: white;
}

.shot-review-table-wrap .shot-table th {
  top: 0;
  z-index: 5;
}

.mini {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  line-height: 1.55;
}

.mini b {
  color: var(--muted);
  font-size: 12px;
}

.mini span {
  word-break: break-word;
}

.optimized-shot-table {
  min-width: 1880px;
}

.optimized-shot-table th:first-child,
.optimized-shot-table td:first-child {
  width: 64px;
}

.optimized-shot-table th:nth-child(2),
.optimized-shot-table td:nth-child(2) {
  width: 170px;
}

.optimized-shot-table th:nth-child(3),
.optimized-shot-table td:nth-child(3) {
  width: 230px;
}

.optimized-shot-table th:nth-child(4),
.optimized-shot-table td:nth-child(4) {
  width: 160px;
}

.optimized-shot-table th:nth-child(5),
.optimized-shot-table td:nth-child(5) {
  width: 210px;
}

.optimized-shot-table th:nth-child(6),
.optimized-shot-table td:nth-child(6) {
  width: 220px;
}

.optimized-shot-table th:nth-child(7),
.optimized-shot-table td:nth-child(7) {
  width: 220px;
}

.optimized-shot-table th:nth-child(8),
.optimized-shot-table td:nth-child(8) {
  width: 190px;
}

.shot-detail-cell {
  background: #fff;
}

.shot-detail-card {
  display: grid;
  gap: 10px;
}

.shot-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.shot-detail-head strong {
  font-size: 14px;
  line-height: 1.45;
}

.shot-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.detail-block {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.detail-block.wide {
  grid-column: 1 / -1;
}

.detail-block b {
  color: var(--muted);
  font-size: 12px;
}

.detail-block span {
  line-height: 1.55;
  word-break: break-word;
}

.optimized-shot-table .aligned-prompt {
  min-height: 220px;
}

.compact-work-table {
  min-width: 1480px;
}

.compact-work-table th:first-child,
.compact-work-table td:first-child {
  width: 64px;
}

.compact-work-table th:nth-child(2),
.compact-work-table td:nth-child(2) {
  width: 170px;
}

.compact-work-table th:nth-child(3), .compact-work-table td:nth-child(3) { width: 230px; }
.compact-work-table th:nth-child(4), .compact-work-table td:nth-child(4) { width: 160px; }
.compact-work-table th:nth-child(5), .compact-work-table td:nth-child(5) { width: 210px; }
.compact-work-table th:nth-child(6), .compact-work-table td:nth-child(6) { width: 220px; }
.compact-work-table th:nth-child(7), .compact-work-table td:nth-child(7) { width: 220px; }
.compact-work-table th:nth-child(8), .compact-work-table td:nth-child(8) { width: 190px; }

.segment-workspace-cell {
  border-left: 3px solid var(--accent);
  background: #f8fbfb;
  vertical-align: middle !important;
}

.segment-result-cell {
  border-left: 3px solid #f59e0b;
  background: #fff8ed;
  vertical-align: middle !important;
}

.remake-workspace-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #cfeeee;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 139, 141, .06);
}

.empty-workspace {
  min-height: 180px;
  place-items: center;
  text-align: center;
}

.remake-workspace-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.workspace-kicker,
.result-kicker {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.workspace-kicker {
  margin-bottom: 8px;
  background: #eaf7f7;
  color: var(--accent);
}

.result-kicker {
  margin-bottom: 8px;
  background: #ffedd5;
  color: #92400e;
}

.remake-workspace-head strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.remake-workspace-card .aligned-prompt {
  min-height: 112px;
  background: #fbffff;
  border-color: #cfeeee;
  line-height: 1.65;
}

.remake-subsection {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.remake-subsection-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: end;
}

.remake-subsection-head strong {
  font-size: 13px;
}

.material-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.material-preview-card,
.material-add-card {
  width: 100%;
  min-height: 0;
  position: relative;
  display: block;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid #cfeeee;
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.material-preview-card:hover,
.material-add-card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(15, 139, 141, .12);
}

.material-preview-card.failed {
  border-color: #ffd1d1;
  background: #fff8f8;
}

.material-thumb-button {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: center;
}

.material-preview-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 7px;
  background: #eaf7f7;
  color: var(--accent);
  font-weight: 900;
}

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

.material-preview-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
  justify-items: center;
}

.material-preview-meta b {
  color: var(--accent);
  font-size: 11px;
}

.material-preview-meta em {
  width: 100%;
  overflow: hidden;
  color: var(--text);
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.material-preview-meta small {
  color: var(--muted);
  font-size: 11px;
}

.material-add-card {
  min-height: 78px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border-style: dashed;
  border-color: #8bd6d7;
  background: linear-gradient(180deg, #ffffff, #f2fcfc);
  color: var(--accent);
}

.material-add-card.compact {
  min-height: 56px;
}

.material-add-card span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 26px;
  line-height: 1;
}

.material-add-card b {
  font-size: 13px;
}

.material-delete-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #fecaca;
  background: rgba(255, 255, 255, .92);
  color: #b42318;
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .12);
}

.aligned-result {
  min-height: 0;
  padding: 10px;
  border-radius: 8px;
  background: white;
  border: 1px solid #fed7aa;
  box-shadow: 0 8px 18px rgba(146, 64, 14, .06);
}

.remake-studio {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.remake-studio-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
}

.remake-studio-head h2 {
  margin: 0 0 4px;
}

.remake-studio-head > strong {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eaf7f7;
  color: var(--accent);
  white-space: nowrap;
}

.remake-studio-list {
  display: grid;
  gap: 12px;
}

.remake-studio-row {
  display: grid;
  grid-template-columns: minmax(150px, .56fr) minmax(360px, 1.35fr) minmax(170px, .58fr);
  gap: 10px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fbfcfd;
}

.remake-studio-meta,
.remake-studio-work,
.remake-studio-result {
  min-width: 0;
}

.remake-studio-meta {
  display: grid;
  gap: 7px;
  align-content: start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.remake-studio-meta .workspace-kicker,
.prompt-summary-card .workspace-kicker {
  margin-bottom: 0;
}

.remake-studio-meta > strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  font-size: 13px;
  line-height: 1.45;
}

.compact-segment-facts {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  overflow: hidden;
}

.compact-segment-facts span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f4fcfc;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.remake-studio-meta p {
  display: none;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.remake-studio-work .remake-workspace-card,
.remake-studio-result .aligned-result {
  height: 100%;
}

.remake-studio-work .remake-workspace-card {
  max-height: 440px;
  overflow: auto;
}

.remake-studio-work .remake-workspace-head {
  padding-bottom: 0;
  border-bottom: 0;
}

.remake-studio-work .remake-workspace-head > div {
  display: none;
}

.remake-studio-result .aligned-result {
  max-height: 360px;
  overflow: auto;
}

.remake-studio-meta .mini {
  margin-top: 3px;
}

.remake-studio-meta .mini b {
  font-size: 11px;
}

.remake-studio-meta .mini span {
  font-size: 12px;
}

.remake-studio-meta .mini:nth-of-type(n+4) {
  display: none;
}

.generation-history {
  display: grid;
  gap: 8px;
}

.generation-request {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.generation-request.success {
  border-color: #86efac;
  background: #f0fdf4;
}

.segment-video-card {
  width: 100%;
  display: grid;
  gap: 8px;
  padding: 0;
  border: 1px solid #86efac;
  border-radius: 8px;
  background: #f0fdf4;
  color: var(--text);
  overflow: hidden;
  text-align: left;
}

.segment-video-card video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 210px;
  background: #0b1118;
  object-fit: cover;
}

.segment-video-card span {
  display: grid;
  gap: 3px;
  padding: 8px 9px 9px;
}

.segment-video-card b {
  color: #166534;
  font-size: 13px;
}

.segment-video-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-preview-modal {
  z-index: 45;
}

.video-preview-panel {
  position: absolute;
  inset: 36px;
  display: grid;
  grid-template-rows: auto 1fr;
  max-width: 980px;
  margin: 0 auto;
  border-radius: 8px;
  background: #0b1118;
  box-shadow: 0 24px 80px rgba(0,0,0,.36);
  overflow: hidden;
}

.video-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  padding: 14px 16px;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
}

.video-preview-header h2 {
  margin: 0 0 3px;
}

.video-preview-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

#videoPreviewPlayer {
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #0b1118;
  object-fit: contain;
}

.generation-request.failed {
  border-color: #fecaca;
  background: #fff5f5;
}

.generation-request strong {
  display: block;
  font-size: 12px;
  color: #1f2937;
}

.generation-request span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.generation-request a {
  width: fit-content;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  background: #dcfce7;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.generation-request p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

.remake-studio-table-head {
  display: grid;
  grid-template-columns: minmax(140px, .5fr) minmax(320px, 1.25fr) minmax(220px, .75fr) minmax(160px, .55fr);
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f7f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.remake-studio-row {
  grid-template-columns: minmax(140px, .5fr) minmax(320px, 1.25fr) minmax(220px, .75fr) minmax(160px, .55fr);
  gap: 8px;
  align-items: stretch;
  padding: 8px 10px;
}

.remake-studio-materials {
  min-width: 0;
  display: grid;
  align-content: center;
}

.remake-studio-work {
  display: grid;
  align-content: center;
}

.prompt-summary-card {
  width: 100%;
  min-height: 92px;
  display: grid;
  gap: 7px;
  align-content: start;
  padding: 10px;
  border: 1px solid #cfeeee;
  border-radius: 8px;
  background: #fbffff;
  color: var(--text);
  text-align: left;
}

.prompt-summary-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(15, 139, 141, .12);
}

.prompt-summary-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #111827;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}

.prompt-summary-card small {
  color: var(--muted);
  font-size: 11px;
}

.row-materials {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.row-materials .material-preview-card,
.row-materials .material-add-card {
  min-height: 0;
  padding: 5px;
}

.row-materials .material-preview-thumb {
  width: 100%;
  height: auto;
}

.row-materials .material-preview-meta small {
  display: none;
}

.row-materials .material-add-card span {
  width: 28px;
  height: 28px;
  font-size: 22px;
}

.row-materials .material-add-card b {
  font-size: 12px;
}

.planner-materials {
  grid-template-columns: repeat(auto-fill, minmax(74px, 88px));
  justify-content: start;
}

.remake-studio-result .aligned-result {
  max-height: 150px;
  overflow: auto;
  padding: 8px;
}

.remake-studio-result .result-kicker {
  min-height: 20px;
  margin-bottom: 6px;
  padding: 2px 7px;
  font-size: 11px;
}

.remake-studio-result .generation-history {
  gap: 6px;
}

.remake-studio-result .generation-request {
  padding: 7px;
}

.segment-video-card {
  gap: 0;
}

.segment-video-card video {
  max-height: 96px;
  object-fit: cover;
}

.segment-video-card span {
  padding: 6px 8px;
}

.prompt-editor-modal {
  z-index: 50;
}

.prompt-editor-panel {
  position: absolute;
  inset: 7vh 50%;
  width: min(860px, calc(100vw - 48px));
  transform: translateX(-50%);
  display: grid;
  grid-template-rows: auto auto minmax(260px, 1fr) auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
  overflow: hidden;
}

.prompt-editor-header,
.prompt-editor-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.prompt-editor-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.prompt-editor-header h2 {
  margin: 0 0 4px;
}

.prompt-editor-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.prompt-token-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 52px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfb;
}

.prompt-token {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 34px;
  padding: 4px 9px 4px 5px;
  border: 1px solid #cfeeee;
  border-radius: 999px;
  background: #fff;
}

.prompt-token img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.prompt-token b {
  color: var(--accent);
  font-size: 12px;
}

.prompt-token small {
  color: var(--muted);
  font-size: 11px;
}

.prompt-editor-wrap {
  position: relative;
  padding: 16px;
  min-height: 0;
}

#promptEditorTextarea {
  width: 100%;
  height: 100%;
  min-height: 260px;
  overflow: auto;
  padding: 12px;
  font-size: 14px;
  line-height: 1.8;
  border: 1px solid #cfeeee;
  border-radius: 8px;
  border-color: #cfeeee;
  background: #fbffff;
  outline: none;
  white-space: pre-wrap;
}

#promptEditorTextarea:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.prompt-inline-token {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  max-width: 240px;
  min-height: 34px;
  margin: 0 3px;
  padding: 3px 8px 3px 4px;
  border: 1px solid #bfe7e8;
  border-radius: 999px;
  background: #eefbfb;
  color: var(--accent);
  vertical-align: middle;
}

.prompt-inline-token img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.prompt-inline-token b {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-inline-token small {
  display: none;
}

.prompt-mention-menu {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: min(420px, calc(100% - 48px));
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #cfeeee;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
}

.prompt-mention-menu.hidden {
  display: none;
}

.prompt-mention-menu button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fbfcfd;
  text-align: left;
}

.prompt-mention-menu button:hover {
  border-color: var(--accent);
  background: #f4fcfc;
}

.prompt-mention-menu span {
  width: 42px;
  height: 38px;
  border-radius: 8px;
  background: #eaf7f7;
  overflow: hidden;
}

.prompt-mention-menu img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prompt-mention-menu b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-mention-menu small {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.material-preview-modal {
  z-index: 55;
}

.material-preview-panel {
  position: absolute;
  inset: 7vh 50%;
  width: min(720px, calc(100vw - 48px));
  transform: translateX(-50%);
  display: grid;
  grid-template-rows: auto 1fr;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
  overflow: hidden;
}

.material-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.material-preview-header h2 {
  margin: 0 0 4px;
}

.material-preview-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.material-preview-body {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(200px, .7fr);
  gap: 14px;
  min-height: 0;
  padding: 16px;
}

#materialPreviewImage {
  width: 100%;
  max-height: 66vh;
  border-radius: 8px;
  background: #f1f5f9;
  object-fit: contain;
}

#materialPreviewInfo {
  display: grid;
  align-content: start;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px 10px;
  margin: 0;
  font-size: 13px;
}

#materialPreviewInfo dt {
  color: var(--muted);
  font-weight: 900;
}

#materialPreviewInfo dd {
  min-width: 0;
  margin: 0;
  word-break: break-word;
}

@media (max-width: 760px) {
  .remake-studio-row {
    grid-template-columns: 1fr;
  }
  .remake-studio-table-head {
    display: none;
  }
}

@media (max-width: 760px) {
  .shot-review-layout {
    grid-template-columns: 1fr;
  }

  .shot-review-player {
    position: static;
  }

  .shot-review-player video {
    max-height: 420px;
  }

  .material-preview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .grid.two, .inline-form, .shot { grid-template-columns: 1fr; }
  .billing-strip,
  .metric-grid,
  .ops-grid { grid-template-columns: 1fr; }
  main { padding: 18px; }
  .modal-panel { inset: 10px; }
  .modal-header { align-items: flex-start; flex-direction: column; }
  .result-hero { grid-template-columns: 1fr; }
  .result-actions { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-settings-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .breakdown-workspace { display: block; }
  .segment-workbench {
    position: sticky;
    max-height: calc(100vh - 210px);
  }
}

@media (max-width: 760px) {
  .breakdown-workspace { grid-template-columns: 1fr; }
  .result-actions,
  .video-settings-grid { grid-template-columns: 1fr; }
  .segment-workbench {
    position: static;
    max-height: none;
  }
}
