:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #18202a;
  --muted: #667085;
  --line: #d9e0e7;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --warn: #b45309;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.auth-pending .sidebar,
body.auth-pending main > header,
body.auth-pending main > .page {
  display: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  background: #111827;
  color: #f9fafb;
  padding: 22px 18px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand span {
  display: block;
  margin-top: 4px;
  color: #a7b0bf;
  font-size: 13px;
}

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

nav {
  display: grid;
  gap: 6px;
  margin-top: 22px;
}

.navItem {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d1d5db;
  padding: 10px 12px;
  text-align: left;
  font-weight: 800;
  cursor: pointer;
}

.navItem:hover,
.navItem.active {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.subNav {
  display: grid;
  gap: 4px;
  margin: -2px 0 8px 16px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.subNavItem {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #aeb7c6;
  padding: 7px 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.subNavItem:hover,
.subNavItem.active {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

main {
  margin-left: 248px;
  padding: 28px;
  min-width: 0;
  overflow-x: hidden;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

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

.accountMenuWrap {
  position: relative;
}

.accountButton {
  display: inline-flex;
  width: auto;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px 7px 7px;
  background: white;
  color: var(--ink);
}

.accountAvatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 900;
}

.accountLabel {
  max-width: 180px;
  overflow: hidden;
  color: #475467;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accountChevron {
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}

.accountMenu {
  position: fixed;
  top: 76px;
  left: auto;
  right: 28px;
  z-index: 80;
  display: grid;
  width: 260px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
  box-shadow: var(--shadow);
}

.accountMenu.hiddenPanel {
  display: none;
}

.accountMenu button {
  justify-content: flex-start;
  text-align: left;
}

.accountMenuSummary {
  display: grid;
  gap: 4px;
  padding: 8px 8px 10px;
  border-bottom: 1px solid var(--line);
}

.accountMenuSummary strong {
  font-size: 14px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 17px;
  margin-bottom: 16px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric,
.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 15px;
}

.metric strong {
  display: block;
  font-size: 24px;
  margin-bottom: 4px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

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

.page {
  display: none;
}

.activePage {
  display: block;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
  gap: 14px;
  margin-top: 14px;
}

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

.creationBrief textarea[name="topic"] {
  min-height: 116px;
}

.creationPrompt {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.creationParamBar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  align-items: start;
  margin-top: 12px;
}

.creationParamBar label,
.creationParamBar .durationField {
  margin-bottom: 0;
}

.creationParamBar > button {
  width: min(280px, 100%);
  min-height: 44px;
  align-self: end;
  justify-self: start;
}

.creationBatchHint {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
}

.creationProfileHint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.scriptDetailPanel {
  min-width: 0;
}

.durationField {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.durationFieldTitle {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.durationInputLine {
  display: flex;
  gap: 8px;
  align-items: center;
}

.durationInputLine input {
  max-width: 86px;
}

.durationInputLine span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.durationPresets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.durationPreset {
  width: auto;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  font-weight: 900;
}

.durationPreset.active {
  border-color: var(--accent);
  background: #ecfdf5;
  color: var(--accent);
}

.compactSectionHeader {
  margin-bottom: 12px;
}

.sectionHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.sectionHeader h2 {
  margin-bottom: 0;
}

.sectionHeader p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.aiBadge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.aiAssistStrip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 14px;
}

.aiAssistStrip span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfd;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.resultHint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.resultHint.isGenerating {
  color: var(--accent);
  font-weight: 900;
}

.creationResultPanel {
  min-width: 0;
}

.panel {
  padding: 18px;
}

.settingsPane {
  display: none;
}

.activeSettingsPane {
  display: block;
}

.settingsSummary {
  gap: 8px;
  margin-bottom: 10px;
}

.settingsSummary .statusCard {
  padding: 10px 12px;
}

.settingsSummary .statusCard strong {
  font-size: 20px;
}

.settingsTableWrap {
  overflow-x: auto;
}

.settingsTable {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.settingsTable th,
.settingsTable td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
}

.settingsTable th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.tabSwitch {
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f7;
}

.tabSwitch button {
  min-height: 34px;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  font-size: 13px;
  font-weight: 900;
}

.tabSwitch button.active {
  background: white;
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.overviewActivityPanel {
  overflow: hidden;
}

.overviewActivityTable {
  min-width: 760px;
}

.overviewActivityTable th:last-child,
.overviewActivityTable td:last-child {
  width: 92px;
}

.overviewTitleCell {
  max-width: 440px;
}

.overviewTitleCell,
.overviewTitleCell strong,
.overviewTitleCell span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overviewTitleCell strong,
.overviewTitleCell span {
  display: block;
}

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

#settings-tab-usage .panel {
  padding: 14px;
}

#settings-tab-usage .sectionHeader p {
  font-size: 13px;
}

.compactTable th,
.compactTable td {
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.35;
}

.compactTable th {
  white-space: nowrap;
}

.usageTable td {
  white-space: nowrap;
}

.usageTable {
  min-width: 1120px;
}

.usageTable td:nth-child(1) {
  font-weight: 900;
}

.usageTable td:nth-child(2),
.usageTable td:nth-child(3) {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usageTable:not(.usageHistoryTable) td:nth-child(5),
.usageTable:not(.usageHistoryTable) td:nth-child(6),
.usageTable:not(.usageHistoryTable) td:nth-child(7),
.usageTable:not(.usageHistoryTable) td:nth-child(8),
.usageTable:not(.usageHistoryTable) td:nth-child(9),
.usageTable:not(.usageHistoryTable) td:nth-child(10),
.usageHistoryTable td:nth-child(4),
.usageHistoryTable td:nth-child(5),
.usageHistoryTable td:nth-child(6),
.usageHistoryTable td:nth-child(7) {
  font-variant-numeric: tabular-nums;
}

.usageTable:not(.usageHistoryTable) td:nth-child(5),
.usageTable:not(.usageHistoryTable) td:nth-child(6),
.usageTable:not(.usageHistoryTable) td:nth-child(7),
.usageTable:not(.usageHistoryTable) td:nth-child(8),
.usageTable:not(.usageHistoryTable) td:nth-child(9),
.usageTable:not(.usageHistoryTable) td:nth-child(10),
.usageHistoryTable td:nth-child(4),
.usageHistoryTable td:nth-child(5),
.usageHistoryTable td:nth-child(6),
.usageHistoryTable td:nth-child(7) {
  text-align: right;
}

.usageHistoryDetails {
  margin-top: 12px;
}

.usageHistoryDetails summary {
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  font-weight: 950;
}

.usageHistoryTable {
  margin-top: 8px;
  min-width: 960px;
}

.usageApiTag {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  padding: 2px 7px;
  margin-right: 6px;
  font-size: 11px;
  font-weight: 950;
}

.usageApiTag.real {
  background: #ecfdf3;
  color: #047857;
}

.usageApiTag.current {
  background: #eef4ff;
  color: #1d4ed8;
}

.usageApiTag.old {
  background: #fff7ed;
  color: #c2410c;
}

.usageApiTag.mock {
  background: #f8fafc;
  color: #667085;
}

.storagePanel {
  padding: 14px;
  overflow: hidden;
}

.storagePathGrid {
  display: grid;
  gap: 8px;
}

.storageConfigForm {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px minmax(220px, 0.55fr);
  gap: 12px;
  align-items: stretch;
  margin-bottom: 12px;
}

.storageConfigForm > *,
.remoteUploadForm > *,
.remoteUploadFields > * {
  min-width: 0;
}

.storageConfigForm button {
  min-height: 42px;
}

.storageAutoSaveSwitch {
  min-height: 42px;
  align-self: stretch;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fbfcfd;
}

.storageLocalStatus {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.storageLocalStatus.ready {
  color: #047857;
}

.storageChoiceHeader {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfd;
}

.storageChoiceHeader span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.storageChoiceHeader strong {
  overflow: hidden;
  color: #101828;
  font-size: 15px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remoteUploadForm {
  display: grid;
  gap: 12px;
}

.remoteUploadTopline,
.remoteUploadActions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.remoteUploadFields {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1.2fr) minmax(110px, 0.45fr) minmax(180px, 0.8fr);
  gap: 10px;
  align-items: end;
}

.remoteUploadFields label {
  margin-bottom: 0;
}

.remoteUploadSwitch {
  min-height: 42px;
  align-items: center;
}

.remoteUploadHint {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.remoteUploadActions {
  padding-top: 2px;
}

.remoteUploadActions button {
  width: 180px;
}

.modelMaintenancePanel {
  margin-top: 14px;
}

.modelPresetBar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.modelPresetBar button {
  width: auto;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: #344054;
  font-size: 12px;
  font-weight: 900;
}

.modelConfigForm {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.modelConfigForm > * {
  min-width: 0;
}

.modelConfigForm label {
  margin-bottom: 0;
}

.modelConfigForm .apiKeyField {
  grid-column: span 2;
}

.modelConfigForm button[type="submit"] {
  min-height: 42px;
  width: 100%;
  white-space: nowrap;
}

.modelListDetails {
  margin-top: 12px;
}

.modelListDetails summary {
  cursor: pointer;
  font-weight: 950;
}

.storagePathRow {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  background: #fbfcfd;
}

.storagePathRow span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.storagePathRow p {
  margin: 0;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.storageTable {
  min-width: 880px;
}

.storageTable td:nth-child(7) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.localSaveButton {
  width: auto;
  min-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.localSaveButton.saved {
  background: #d1fae5;
  color: #047857;
}

.storageFileState {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 900;
}

.storageFileOk {
  background: #ecfdf5;
  color: #047857;
}

.storageFileMissing {
  background: #fef2f2;
  color: #b42318;
}

.storageFileExternal {
  background: #eff6ff;
  color: #1d4ed8;
}

.storageFilePlaceholder {
  background: #f8fafc;
  color: #667085;
}

.settingsTable select {
  min-width: 120px;
  padding: 8px 9px;
}

.settingsAccountCreatePanel {
  margin-bottom: 14px;
  overflow: hidden;
}

.settingsAccountForm {
  display: grid;
  grid-template-columns:
    minmax(280px, 1.25fr)
    minmax(180px, 1fr)
    minmax(180px, 1fr)
    minmax(160px, 0.8fr)
    minmax(126px, 0.5fr)
    minmax(150px, 0.55fr);
  gap: 12px;
  align-items: end;
}

.settingsAccountForm > * {
  min-width: 0;
}

.settingsAccountForm label,
.settingsAccountForm .checkLine {
  margin-bottom: 0;
}

.settingsAccountForm .checkLine {
  min-height: 42px;
}

.settingsAccountForm button[type="submit"] {
  min-height: 42px;
  width: 100%;
}

.settingsAccountForm h2 {
  margin-bottom: 4px;
}

.settingsAccountForm .resultHint {
  margin: 0;
}

.userTable {
  min-width: 920px;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.apiKeyField {
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px;
  background: #eff6ff;
}

.apiKeyField span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.modelKeyStatus {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  margin-top: 8px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
}

.modelKeyStatus.saved {
  border: 1px solid #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}

.modelKeyStatus.missing {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.modelDiagnosticsList {
  margin-bottom: 12px;
}

.modelDiagnosticsPanel {
  padding: 14px;
}

.diagnosticCounts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.diagnosticCounts span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #f8fafc;
}

.modelDiagnosticsTable td:nth-child(2) {
  max-width: 280px;
}

.modelDiagnosticsTable td:last-child {
  max-width: 360px;
  color: var(--muted);
}

.diagnosticBlockedRow td {
  background: #fffafa;
}

.modelSecretRow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.modelSecretRow span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 900;
}

.modelSecretRow .ok {
  border: 1px solid #99f6e4;
  background: #f0fdfa;
  color: #0f766e;
}

.modelSecretRow .missing {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.compactModelList .item {
  padding: 10px;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid #cfd6df;
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  font: inherit;
  background: white;
}

strong,
span,
div,
p,
td,
th,
pre,
code {
  overflow-wrap: anywhere;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

button {
  width: 100%;
  max-width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.96);
}

button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.secondary {
  background: #e8eef7;
  color: #1d4ed8;
}

.danger {
  background: #fee4e2;
  color: #b42318;
}

.dangerButton {
  background: #fee4e2;
  color: #b42318;
}

.iconBtn {
  width: 42px;
  min-height: 42px;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 18px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.itemActions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.inlineForm {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) 120px;
  gap: 12px;
  align-items: end;
}

.loginPage {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(37, 99, 235, 0.05)),
    var(--bg);
}

.loginShell {
  display: grid;
  min-height: 100vh;
  margin-left: 0;
  padding: 24px;
  place-items: center;
}

.loginCard {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: white;
  box-shadow: var(--shadow);
}

.loginBrand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.loginBrand span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.loginTitleBlock {
  margin-bottom: 22px;
}

.loginForm {
  display: grid;
  gap: 12px;
}

.loginForm button {
  margin-top: 4px;
}

.loginForm .inlineForm {
  grid-template-columns: 1fr;
}

.checkLine {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.checkLine input {
  flex: 0 0 auto;
  width: auto;
}

.preview {
  white-space: pre-wrap;
  line-height: 1.65;
  color: #263241;
}

.empty {
  color: var(--muted);
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfd;
}

.item strong {
  display: block;
  margin-bottom: 4px;
}

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

.itemHeader .status {
  margin-top: 0;
  white-space: nowrap;
}

.status {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 800;
}

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

.statusCard {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fbfcfd;
}

.statusCard strong {
  display: block;
  font-size: 24px;
}

.statusCard span,
.recordMeta,
.publishTips {
  color: var(--muted);
  font-size: 13px;
}

.publishTips {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  line-height: 1.55;
}

.secretFlags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.secretFlags span {
  padding: 5px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}

.publishRecord {
  padding: 14px;
}

.publishEditForm {
  margin-top: 12px;
}

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

.recordMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

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

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

.titleGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.scriptCandidateList {
  display: grid;
  gap: 8px;
}

.candidateHeader {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.candidateHeader strong {
  color: var(--ink);
}

.candidateRows {
  display: grid;
  gap: 6px;
}

.candidateRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fbfcfd;
}

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

.candidateMain span,
.candidateMain em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.candidateMain strong {
  overflow: hidden;
  color: var(--ink);
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidateMain em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidateActions {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 6px;
}

.candidateActions button {
  width: auto;
  min-height: 34px;
  padding: 0 11px;
  white-space: nowrap;
}

.selectedCandidate {
  border-color: var(--accent);
  background: #f0fdfa;
}

.productionModeBar {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(280px, 1fr);
  gap: 14px;
  align-items: center;
  width: 100%;
}

.productionModeBar label {
  margin-bottom: 0;
}

.productionModeBar span {
  display: block;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.titleOption {
  display: grid;
  gap: 6px;
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--ink);
  text-align: left;
}

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

.titleOption strong {
  line-height: 1.45;
  word-break: break-word;
}

.selectedTitle {
  border-color: var(--accent);
  background: #f0fdfa;
}

.scriptResult {
  display: grid;
  gap: 10px;
}

.scriptEditForm {
  display: grid;
  gap: 10px;
}

.scriptEditGrid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  gap: 10px;
}

.scriptEditForm label {
  margin-bottom: 0;
}

.scriptEditForm textarea {
  min-height: 0;
  line-height: 1.55;
}

.storyboardPlanBlock {
  display: grid;
  gap: 8px;
}

.storyboardPlanTableWrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.storyboardPlanTable {
  min-width: 780px;
}

.storyboardPlanTable th,
.storyboardPlanTable td {
  padding: 8px 10px;
  font-size: 12px;
  vertical-align: top;
}

.storyboardPlanTable td:nth-child(1),
.storyboardPlanTable td:nth-child(2),
.storyboardPlanTable td:nth-child(5) {
  white-space: nowrap;
}

.scriptAdvancedEdit {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfd;
}

.scriptAdvancedEdit summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 900;
}

.scriptAdvancedEdit label {
  margin-top: 10px;
}

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

.scriptEditActions button {
  width: auto;
  min-width: 132px;
}

.scriptBlock,
.scriptMetaGrid > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: #fbfcfd;
}

.scriptResultFresh {
  animation: resultPulse 1.2s ease-out;
}

.scriptBlock span,
.scriptMetaGrid span {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.scriptBlock strong {
  line-height: 1.55;
}

.scriptBlock p,
.scriptMetaGrid p {
  margin: 0;
  color: #263241;
  line-height: 1.58;
  white-space: pre-wrap;
}

.primaryScriptBlock {
  background: #ffffff;
}

.primaryScriptBlock p {
  font-size: 15px;
}

.compactScriptBlock p,
.compactScriptBlock strong {
  line-height: 1.5;
}

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

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

.scriptUtilityGrid details {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  min-width: 0;
}

.scriptUtilityGrid summary {
  cursor: pointer;
  padding: 10px 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  list-style-position: inside;
}

.scriptUtilityGrid p {
  margin: 0;
  padding: 0 12px 12px;
  color: #263241;
  line-height: 1.55;
  white-space: pre-wrap;
}

.tagChips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 12px;
}

.tagChips span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef6f5;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.scriptLoading {
  border: 1px dashed var(--accent);
  border-radius: 6px;
  padding: 16px;
  background: #f0fdfa;
  color: var(--accent);
  font-weight: 900;
}

@keyframes resultPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(19, 124, 109, 0.28);
  }
  100% {
    box-shadow: 0 0 0 14px rgba(19, 124, 109, 0);
  }
}

.creationActions {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(220px, 1.25fr) minmax(150px, 0.9fr);
  gap: 10px;
  align-items: stretch;
}

.creationFooterActions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(500px, 0.9fr);
  gap: 16px;
  margin-top: 14px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.creationFooterActions > * {
  min-width: 0;
}

.creationActions button {
  min-height: 44px;
  white-space: normal;
}

.compactButton {
  width: auto;
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

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

.workflowSteps span {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.workflowSteps strong {
  display: block;
  color: var(--accent);
  font-size: 18px;
  line-height: 1.1;
}

.taskTableWrap {
  overflow-x: auto;
}

.taskFlowPanel {
  margin-bottom: 14px;
}

.advancedTaskPanel {
  margin-bottom: 14px;
}

.advancedTaskPanel summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 900;
}

.advancedTaskGrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 14px;
  margin-top: 16px;
}

.taskTable {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.taskTable th,
.taskTable td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
}

.taskTable th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  background: #f8fafc;
}

.taskSelectCheckbox {
  width: auto;
}

.taskTable .status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-top: 4px;
  padding: 2px 7px;
  font-size: 11px;
}

.taskStatusQueued,
.taskStatusDraft {
  background: #eef2ff;
  color: #3730a3;
}

.taskStatusRunning {
  background: #ecfdf5;
  color: #047857;
}

.taskStatusReview {
  background: #eff6ff;
  color: #1d4ed8;
}

.taskStatusApproved {
  background: #f0fdf4;
  color: #15803d;
}

.taskStatusRejected,
.taskStatusFailed {
  background: #fef2f2;
  color: #b42318;
}

.taskTable td:nth-child(2) strong {
  display: inline-block;
  margin-right: 6px;
}

.taskTable td:nth-child(3) {
  max-width: 280px;
  font-size: 13px;
  line-height: 1.45;
}

.taskTable td:nth-child(4) {
  max-width: 150px;
  font-size: 13px;
}

.scriptTaskTable {
  min-width: 760px;
}

.scriptTaskTable td:nth-child(1) {
  max-width: 420px;
}

.scriptTaskTable th:last-child,
.scriptTaskTable td:last-child {
  width: 150px;
}

.scriptTitleCell {
  min-width: 0;
}

.scriptTitleCell strong {
  display: block;
  overflow: hidden;
  max-width: min(420px, 42vw);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scriptTitleCell span {
  display: block;
  overflow: hidden;
  max-width: min(420px, 42vw);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tablePager {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.tablePager div {
  display: flex;
  gap: 8px;
}

.tablePager button {
  width: auto;
  min-height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

.taskExportPill {
  display: inline-flex;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.progressBar {
  width: 130px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.progressBar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.referenceWorkbench {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.referenceTabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f7;
}

.referenceTab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  font-weight: 900;
  cursor: pointer;
}

.referenceTab span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  margin-left: 6px;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--accent-2);
  font-size: 12px;
}

.referenceTab:hover,
.referenceTab.active {
  background: white;
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.referenceTabPanels {
  min-width: 0;
}

.referenceTabPanel {
  display: none;
}

.referenceTabPanel.active {
  display: block;
}

.referenceLinkForm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.48fr);
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.referenceUrlField {
  grid-column: auto;
}

.referenceUrlField input {
  min-height: 54px;
}

.referenceActions {
  grid-column: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 10px;
}

.referenceOptionalSettings {
  grid-column: 1 / -1;
}

.referenceOptionalSettings summary {
  width: max-content;
  cursor: pointer;
  color: #0f766e;
  font-weight: 900;
}

.referenceOptionalGrid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 0.7fr));
  gap: 12px;
  margin-top: 12px;
}

.referenceContentGrid {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  gap: 14px;
  align-items: start;
}

.referenceExistingForm,
.referenceListPanel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.referenceExistingForm h3,
.referenceListPanel h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.compactHeader {
  margin-bottom: 10px;
}

.compactHeader p {
  margin: 4px 0 0;
  font-size: 13px;
}

.analysisMaterialPreview {
  margin-bottom: 12px;
}

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

.analysisPreviewMedia {
  display: block;
  width: 132px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  background: #eef2f7;
}

.referenceMaterialList {
  min-width: 0;
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 2px;
}

.referenceMaterialCard {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.selectedReferenceCard {
  border-color: var(--accent);
  background: #f0fdfa;
}

.referenceMaterialMedia {
  display: block;
  width: 116px;
  aspect-ratio: 9 / 16;
  border-radius: 6px;
  object-fit: cover;
  background: #eef2f7;
}

.referenceMaterialBody {
  min-width: 0;
}

.referenceMaterialActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.referenceMaterialActions button,
.referenceMaterialActions .buttonLike {
  width: auto;
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.buttonLike,
.ghostButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 6px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #1d4ed8;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.ghostButton {
  width: auto;
}

.successStatus {
  background: #dcfce7;
  color: #047857;
}

.pendingStatus {
  background: #eef2ff;
  color: #4f46e5;
}

.drawerOverlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  justify-content: end;
  background: rgba(15, 23, 42, 0.28);
}

.drawerOverlay.hiddenPanel {
  display: none;
}

.detailDrawer {
  width: min(860px, calc(100vw - 28px));
  height: 100vh;
  overflow: auto;
  padding: 20px;
  background: white;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 36px rgba(15, 23, 42, 0.14);
}

.drawerHeader {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 14px;
  margin-bottom: 14px;
  background: white;
  border-bottom: 1px solid var(--line);
}

.drawerHeader h2 {
  margin: 0;
  font-size: 24px;
}

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

.drawerSummary {
  display: grid;
  gap: 10px;
}

.drawerActions {
  margin-top: 0;
}

.drawerSheet {
  max-height: none;
  object-fit: contain;
}

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

.modalOverlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.34);
}

.modalOverlay.hiddenPanel {
  display: none;
}

.modalPanel {
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: white;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.modalHeader {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.accountProfileContent {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

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

.profileField {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.profileField span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profileField strong {
  display: block;
  overflow-wrap: anywhere;
}

.compactModalPanel {
  width: min(520px, 100%);
}

.helpList {
  display: grid;
  gap: 10px;
}

.accountPasswordForm {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.accountPasswordForm h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.analysisResultList {
  display: grid;
  gap: 12px;
}

.videoAnalysisCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.analysisMetrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.analysisMetrics span {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.analysisQuality,
.modelTestResult {
  border: 1px solid #b7e4d8;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f0fdfa;
  color: #134e4a;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.modelTestResult {
  margin-bottom: 12px;
}

.modelTestResult strong,
.modelTestResult span {
  display: block;
}

.modelTestResult p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.videoAnalysisSheet {
  display: block;
  width: 100%;
  max-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: white;
}

.analysisGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.analysisGrid > div,
.analysisReuseNotes,
.analysisTimelineDetails {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.analysisGrid h3 {
  margin: 0;
  padding: 10px 12px 0;
  font-size: 14px;
}

.analysisGrid pre,
.analysisReuseNotes {
  margin: 0;
  padding: 10px 12px;
  color: #344054;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.analysisTimelineDetails {
  margin-top: 10px;
  padding: 10px 12px;
}

.analysisTimelineDetails summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 900;
}

.analysisTimelineTable {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
}

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

.analysisReuseNotes {
  margin-top: 10px;
}

.tableActions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 190px;
  max-width: 100%;
}

.tableActions button {
  flex: 0 0 auto;
  width: auto;
  min-height: 28px;
  padding-inline: 8px;
  font-size: 12px;
}

.tableActions button:disabled {
  cursor: not-allowed;
}

.errorText {
  max-width: 240px;
  margin-top: 6px;
  color: #b42318;
  font-size: 12px;
  line-height: 1.45;
}

.materialGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 12px;
}

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

.materialThumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eef2f7;
}

.materialFile {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.materialBody {
  min-width: 0;
  padding: 0;
}

.materialBody strong {
  display: block;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.humanGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 12px;
}

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

.humanTableWrap {
  overflow-x: auto;
}

.assetListTable {
  min-width: 980px;
}

.humanListTable {
  min-width: 1040px;
}

.assetListTable th:last-child,
.assetListTable td:last-child {
  width: 170px;
}

.assetListTable td:first-child {
  max-width: 320px;
}

.assetListTable strong {
  display: block;
  overflow-wrap: anywhere;
}

.assetListTable .recordMeta {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assetListTable .assetState {
  white-space: nowrap;
}

.portraitPreview {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  background: #eef2f7;
}

.portraitPreview img,
.portraitPlaceholder {
  width: 100%;
  height: 100%;
}

.portraitPreview img {
  display: block;
  object-fit: cover;
}

.portraitPlaceholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.humanSourceVideo {
  display: block;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 16 / 9;
  margin-top: 8px;
  border-radius: 6px;
  background: #eef2f7;
  object-fit: cover;
}

.assetMiniThumb {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  object-fit: cover;
  background: #eef2f7;
}

.mediaIcon {
  display: grid;
  place-items: center;
  color: #0e7490;
  font-size: 13px;
  font-weight: 900;
}

.humanCardBody {
  min-width: 0;
}

.humanCardBody strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assetMetaLine {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 6px 0;
}

.assetState {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.assetState.ready {
  color: #047857;
  background: #d1fae5;
}

.assetState.pending {
  color: #9a3412;
  background: #ffedd5;
}

.assetDetailContent {
  display: grid;
  gap: 16px;
}

.assetDrawerSummary {
  display: grid;
  gap: 12px;
}

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

.assetDetailGrid > div,
.assetVoiceBlock {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.assetDetailGrid span,
.assetVoiceBlock span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.assetDetailGrid strong,
.assetVoiceBlock code {
  display: block;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

.assetDrawerMediaGrid section {
  min-width: 0;
}

.assetDrawerMediaGrid h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.assetDrawerMedia {
  display: block;
  width: 100%;
  max-height: 420px;
  border-radius: 6px;
  background: #eef2f7;
  object-fit: contain;
}

.assetDrawerMedia.full {
  max-height: 560px;
}

.assetDrawerEmpty {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-weight: 900;
  background: #f8fafc;
}

.transcript {
  margin-top: 8px;
  padding: 10px;
  border-radius: 6px;
  background: #f8fafc;
  color: #344054;
  white-space: pre-wrap;
  line-height: 1.55;
}

.footerPanel {
  margin-top: 14px;
}

.hiddenPanel {
  display: none;
}

.taskPreviewPanel {
  max-width: 760px;
}

#closeTaskPreviewBtn {
  width: auto;
  min-width: 96px;
}

.taskPreviewContent {
  display: grid;
  justify-items: start;
}

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

.taskDrawerVideoPanel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.taskDrawerVideoPanel h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.taskOutputPreviewVideo {
  width: min(360px, 100%);
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  background: #eef2f7;
  object-fit: cover;
}

.taskOutputPreviewVideo.drawerVideo {
  width: min(420px, 100%);
  max-height: 70vh;
}

.taskSegmentDetailList {
  display: grid;
  gap: 10px;
}

.integrationPanel {
  margin-bottom: 18px;
}

.roadmap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.roadmap span {
  padding: 8px 10px;
  border-radius: 999px;
  background: #f0fdfa;
  color: #115e59;
  font-size: 13px;
  font-weight: 800;
}

.humanAssetLayout {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.humanAssetFormPanel {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  width: min(860px, 100%);
  max-width: 860px;
  gap: 14px 16px;
}

.humanAssetFormPanel .sectionHeader {
  grid-column: 1 / -1;
}

.humanAssetFormPanel .sectionHeader {
  margin-bottom: 0;
}

.humanField {
  min-width: 0;
  margin-bottom: 0;
}

.humanField input,
.humanField select {
  min-height: 42px;
}

.humanSubmitButton {
  grid-column: 1 / -1;
  justify-self: start;
  width: min(360px, 100%);
  min-height: 44px;
}

.resolverPresetPanel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: #f0fdfa;
}

.resolverPresetPanel strong {
  color: #115e59;
}

.resolverPresetPanel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.resolverPresetActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.resolverPresetActions button {
  width: auto;
  min-height: 38px;
  padding: 8px 12px;
}

.linkResolverTestForm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px 180px;
  gap: 12px;
  align-items: end;
}

.linkResolverTestResult {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
}

.linkResolverTestResult strong {
  color: var(--ink);
}

.linkResolverTestResult span,
.linkResolverTestResult p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.linkResolverTestResult.ok {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.linkResolverTestResult.pending {
  border-color: #fed7aa;
  background: #fff7ed;
}

.linkResolverTestResult.blocked {
  border-color: #fecaca;
  background: #fef2f2;
}

#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #111827;
  color: white;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

#toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1180px) {
  .creationParamBar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .creationParamBar .durationField {
    grid-column: span 2;
  }
}

@media (max-width: 1500px) {
  .settingsAccountForm {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1320px) {
  .settingsAccountForm {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .referenceUrlField,
  .referenceActions {
    grid-column: 1 / -1;
  }

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

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

@media (max-width: 1480px) {
  .modelConfigForm {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .modelConfigForm .apiKeyField {
    grid-column: span 2;
  }
}

@media (max-width: 1280px) {
  .remoteUploadFields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .linkResolverTestForm {
    grid-template-columns: minmax(0, 1fr) minmax(160px, 0.4fr);
  }

  .linkResolverTestForm button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px) {
  .metrics,
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .creationFooterActions,
  .creationParamBar,
  .productionModeBar,
  .analysisGrid,
  .referenceContentGrid,
  .modelConfigForm,
  .storageConfigForm,
  .advancedTaskGrid,
  .scriptUtilityGrid,
  .scriptMetaGrid,
  .scriptEditGrid,
  .settingsAccountForm {
    grid-template-columns: 1fr;
  }

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

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

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

  .creationParamBar .durationField {
    grid-column: auto;
  }

  .modelConfigForm .apiKeyField {
    grid-column: auto;
  }

  .statusBoard,
  .publishActions,
  .titleGrid,
  .materialGrid,
  .humanGrid,
  .modelDiagnosticGrid,
  .settingsSummary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: auto;
  }

  main {
    margin-left: 0;
    padding: 18px;
  }

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

  header {
    align-items: flex-start;
    gap: 12px;
  }

  .headerActions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .accountMenu {
    right: auto;
    left: 0;
    width: min(240px, calc(100vw - 36px));
  }

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

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

  .formGrid,
  .creationActions,
  .creationFooterActions,
  .creationParamBar,
  .productionModeBar,
  .referenceTabs,
  .analysisGrid,
  .humanAssetFormPanel,
  .referenceLinkForm,
  .referenceContentGrid,
  .referenceActions,
  .modelConfigForm,
  .storageConfigForm,
  .advancedTaskGrid,
  .scriptUtilityGrid,
  .scriptEditGrid,
  .settingsAccountForm,
  .statusBoard,
  .publishActions,
  .workflowSteps,
  .materialGrid,
  .humanGrid,
  .modelDiagnosticGrid,
  .settingsSummary {
    grid-template-columns: 1fr;
  }

  .referenceUrlField,
  .referenceTitleField,
  .referencePlatformField,
  .referenceLanguageField,
  .referenceTagsField,
  .referenceActions {
    grid-column: 1 / -1;
  }

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

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

  .assetDetailGrid,
  .assetDrawerMediaGrid {
    grid-template-columns: 1fr;
  }

  .remoteUploadTopline,
  .remoteUploadActions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .remoteUploadHint {
    text-align: left;
  }

  .remoteUploadActions button {
    width: 100%;
  }

  .itemHeader {
    display: grid;
  }

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

  .referenceMaterialCard {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .referenceMaterialMedia {
    width: 88px;
  }

  .detailDrawer {
    width: 100vw;
    padding: 16px;
  }

  .drawerHeader {
    align-items: center;
  }

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

  .humanSubmitButton {
    width: 100%;
  }

  .analysisPreviewMedia {
    width: 100%;
  }

  .humanCard {
    grid-template-columns: 80px minmax(0, 1fr);
  }

  .portraitPreview {
    width: 80px;
    height: 80px;
  }
}
