  :root {
    --bg: #eef2f7;
    --surface: rgba(255, 255, 255, 0.64);
    --surface-2: rgba(255, 255, 255, 0.82);
    --line: rgba(173, 186, 201, 0.34);
    --line-2: rgba(173, 186, 201, 0.52);
    --ink: #17202b;
    --muted: #77828e;
    --faint: #9aa5b0;
    --blue: #b32d33;
    --blue-soft: rgba(179, 45, 51, 0.10);
    --green: #2d9a5e;
    --green-soft: #e0f0e8;
    --gold: #d49516;
    --gold-soft: #faf0e0;
    --red: #d4504c;
    --red-soft: #fae8e6;
    --shadow: 0 12px 32px rgba(72, 89, 108, 0.09);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  }

@font-face {
  font-family: "AlimamaShuhei";
  src: url("/assets/fonts/alimama-shuhei.ttf") format("truetype");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  color: var(--blue);
  background: var(--bg);
}

body.auth-required {
  overflow: hidden;
}

body.auth-pending .app-shell,
body.auth-required .app-shell {
  visibility: hidden;
  pointer-events: none;
}

body.auth-pending .auth-overlay {
  display: none;
}

body.auth-required .auth-overlay {
  background: var(--bg);
  backdrop-filter: none;
}

body.auth-pending::before {
  content: "正在加载工作台";
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--bg);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

body.auth-pending::after {
  content: "";
  position: fixed;
  top: calc(50% - 28px);
  left: calc(50% - 10px);
  z-index: 41;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(179, 45, 51, 0.18);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hero {
  position: relative;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.header-stats {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.user-name-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  background: var(--blue-soft);
}

.user-name-btn:hover,
.user-name-btn[aria-expanded="true"] {
  border-color: rgba(179, 45, 51, 0.36);
  color: #8f2429;
  background: #f6e6e7;
}

/* 2026-08-12: frameless account entry with a larger avatar and status copy. */
#accountMenuButton.user-name-btn {
  min-height: 50px;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
  color: #173a40;
  background: transparent;
  box-shadow: none;
}

#accountMenuButton.user-name-btn:hover,
#accountMenuButton.user-name-btn[aria-expanded="true"] {
  border: 0;
  color: #173a40;
  background: transparent;
  box-shadow: none;
}

#accountMenuButton .account-avatar {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  object-fit: cover;
}

.account-avatar.is-placeholder,
.account-profile-avatar.is-placeholder {
  background: #eef2f3;
}

#accountMenuButton .account-button-copy {
  min-width: 56px;
}

#accountMenuButton .account-button-copy b {
  max-width: 104px;
  font-size: 14px;
}

#accountMenuButton .account-button-copy small {
  margin-top: 3px;
  font-size: 10px;
}

#accountMenuButton > svg {
  width: 17px;
  height: 17px;
  flex-basis: 17px;
  margin-left: -6px;
  margin-right: 6px;
}

.user-name-btn > span {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-name-btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  transition: transform 160ms ease;
}

.user-name-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.account-wrap {
  position: relative;
}

.account-wrap[hidden],
.account-menu[hidden] {
  display: none;
}

.account-menu {
  position: absolute;
  z-index: 320;
  top: calc(100% + 8px);
  right: 0;
  width: 210px;
  padding: 10px;
  border: 1px solid rgba(179, 45, 51, 0.18);
  border-radius: 8px;
  background: rgba(250, 250, 253, 0.96);
  box-shadow: 0 18px 42px rgba(26, 26, 46, 0.15);
  backdrop-filter: blur(18px);
}

.account-menu-profile {
  padding: 4px 8px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.account-menu-profile strong,
.account-menu-profile small {
  display: block;
}

.account-menu-profile strong {
  color: var(--ink);
  font-size: 14px;
}

.account-menu-profile small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.account-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  padding: 0 9px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-size: 13px;
}

.account-menu button:hover,
.account-menu button:focus-visible {
  color: var(--blue);
  background: var(--blue-soft);
  outline: none;
}

.account-menu button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.avatar-crop-overlay {
  position: fixed;
  z-index: 9050;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 28, 31, 0.48);
  backdrop-filter: blur(8px);
}

.avatar-crop-overlay[hidden] {
  display: none;
}

.avatar-crop-modal {
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(20, 28, 31, 0.24);
}

.avatar-crop-head,
.avatar-crop-actions,
.avatar-crop-zoom {
  display: flex;
  align-items: center;
}

.avatar-crop-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.avatar-crop-head h2 {
  margin: 0;
  font-size: 17px;
}

.avatar-crop-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  font-size: 24px;
  line-height: 1;
}

.avatar-crop-viewport {
  position: relative;
  width: min(340px, 78vw);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 6px;
  background: #172023;
  cursor: grab;
  touch-action: none;
}

.avatar-crop-viewport.is-dragging {
  cursor: grabbing;
}

.avatar-crop-viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.avatar-crop-mask {
  position: absolute;
  inset: clamp(24px, 6vw, 34px);
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(13, 19, 22, 0.52);
  pointer-events: none;
}

.ai-sidebar-tools-only {
  justify-content: flex-end;
  min-height: 48px;
}

.avatar-crop-zoom {
  gap: 12px;
  margin: 16px 4px 4px;
  color: var(--muted);
  font-size: 13px;
}

.avatar-crop-zoom input {
  flex: 1;
  accent-color: var(--blue);
}

.avatar-crop-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.project-overview {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.project-overview:empty {
  display: none;
}

.auth-overlay {
  display: none;
  position: fixed;
  inset: 0;
  /* Security modal: above all content modals and workbench navigation. */
  z-index: 9100;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(4px);
}

.auth-overlay.active {
  display: grid;
}

.auth-modal {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.12);
}

.auth-heading {
  text-align: center;
}

.auth-heading h2 {
  font-size: 22px;
}

.auth-modal p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 20px;
}

.auth-grid .field-row {
  margin-bottom: 0;
}

#authPanel {
  padding: 28px;
  background:
    radial-gradient(circle at 16% 18%, rgba(176, 45, 52, 0.10), transparent 30%),
    radial-gradient(circle at 88% 82%, rgba(57, 84, 118, 0.12), transparent 32%),
    rgba(238, 241, 245, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

#authPanel .auth-modal {
  display: grid;
  grid-template-columns: 225px minmax(0, 1fr);
  width: min(735px, 100%);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.90);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 34px 90px rgba(32, 43, 59, 0.20);
}

.auth-brand-panel {
  position: relative;
  display: flex;
  min-height: 470px;
  padding: 34px 28px;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 255, 255, 0.14), transparent 30%),
    linear-gradient(150deg, #1d2b3e 0%, #111b29 56%, #26364b 100%);
}

.auth-brand-panel::after {
  content: '';
  position: absolute;
  right: -78px;
  bottom: -92px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(255, 255, 255, 0.025), 0 0 0 76px rgba(255, 255, 255, 0.018);
}

.auth-brand-mark {
  position: relative;
  z-index: 1;
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 21px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.10);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.20);
}

.auth-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-brand-copy {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.auth-brand-copy strong {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.auth-brand-copy span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  letter-spacing: 0.08em;
}

#authPanel .auth-brand-panel > p {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  letter-spacing: 0.12em;
}

.auth-form-panel {
  position: relative;
  display: flex;
  min-width: 0;
  padding: 54px 54px 48px;
  flex-direction: column;
  justify-content: center;
}

.auth-back-btn {
  position: absolute;
  top: 24px;
  right: 30px;
  width: auto;
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  color: #6c7787;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
}

.auth-back-btn:hover,
.auth-back-btn:focus-visible {
  color: #a12d34;
  background: rgba(161, 45, 52, 0.06);
  outline: none;
}

.auth-back-btn[hidden] {
  display: none;
}

#authPanel .auth-heading {
  text-align: left;
}

.auth-eyebrow {
  display: block;
  margin-bottom: 8px;
  color: #a12d34;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

#authPanel .auth-heading h2 {
  margin: 0;
  color: #1b2736;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#authPanel .auth-heading p {
  max-width: 360px;
  margin-top: 10px;
  color: #7a8492;
  font-size: 13px;
  line-height: 1.65;
}

#authPanel .auth-grid {
  gap: 17px;
  margin-top: 28px;
}

#authPanel .field-row label {
  margin-bottom: 8px;
  color: #344052;
  font-size: 13px;
  font-weight: 600;
}

.auth-field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

#authPanel .auth-field-label-row label {
  margin-bottom: 0;
}

.auth-forgot-password {
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  color: #8b4a4f;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

.auth-forgot-password:hover {
  color: #b32d34;
  background: transparent;
  box-shadow: none;
}

.auth-forgot-password:focus-visible {
  outline: 2px solid rgba(179, 45, 51, 0.22);
  outline-offset: 4px;
}

.auth-forgot-password[hidden],
#authEmailCodeRow[hidden],
#authConfirmPasswordRow[hidden],
#authAccountRow[hidden],
#authBackBtn[hidden] {
  display: none;
}

#authPanel .field-row input {
  min-height: 49px;
  padding: 0 15px;
  border-color: #dce2e9;
  border-radius: 11px;
  color: #172333;
  background: #f9fafb;
  box-shadow: inset 0 1px 2px rgba(31, 45, 61, 0.025);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

#authPanel .field-row input:focus {
  border-color: rgba(170, 46, 53, 0.62);
  outline: 0;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(179, 45, 51, 0.08);
}

#authPanel .auth-actions {
  gap: 13px;
  margin-top: 3px;
}

#authPanel #loginBtn {
  min-height: 49px;
  border-radius: 11px;
  font-size: 15px;
  box-shadow: 0 11px 24px rgba(166, 40, 47, 0.20);
}

.cloud-video-grid {
  grid-template-columns: minmax(0, 1fr);
}

section[data-stage="cloud-video"] .panel {
  display: flex;
  flex-direction: column;
}

.cloud-video-toolbar {
  display: grid;
  grid-template-columns: minmax(140px, 170px) minmax(100px, 130px) minmax(155px, 205px) minmax(130px, 1fr) 104px 104px 92px;
  align-items: end;
  justify-content: start;
  gap: 10px;
  margin: 18px 0 12px;
}

.cloud-video-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cloud-video-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.cloud-video-default-date-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  white-space: nowrap;
}

#cloudVideoExportBtn,
#cloudVideoScheduleBtn {
  height: 36px;
  min-height: 36px;
  width: 100%;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.cloud-video-auto-sync-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.cloud-video-status-wrap {
  position: relative;
  align-self: flex-start;
}

.cloud-video-connection-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.cloud-video-connection-status i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d04545;
  box-shadow: 0 0 0 3px rgba(208, 69, 69, 0.15);
}

.cloud-video-connection-status.is-ready i {
  background: #2eaa68;
  box-shadow: 0 0 0 3px rgba(46, 170, 104, 0.15);
}

.cloud-video-connection-status:not(:disabled):hover {
  background: rgba(226, 231, 239, 0.72);
}

.cloud-video-connection-status:disabled {
  cursor: default;
}

.cloud-video-admin-popover {
  position: absolute;
  z-index: 30;
  top: 34px;
  right: 0;
  width: min(360px, calc(100vw - 48px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(22, 35, 55, 0.16);
}

.cloud-video-admin-popover p {
  margin: 7px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.cloud-video-admin-popover .cloud-video-popover-task-status {
  min-height: 0;
  margin: -4px 0 12px;
  line-height: 1.5;
}

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

.cloud-video-admin-popover .cloud-video-smoke-btn {
  grid-column: 1 / -1;
}

.cloud-video-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cloud-video-account-filter {
  position: relative;
  min-width: 0;
}

.cloud-video-account-options {
  position: absolute;
  z-index: 520;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  min-width: 220px;
  max-width: 300px;
  max-height: 210px;
  padding: 5px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  opacity: 1;
  box-shadow: 0 12px 28px rgba(18, 28, 45, 0.16);
}

.cloud-video-account-options button {
  display: block;
  width: 100%;
  padding: 7px 8px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-video-account-options button:hover,
.cloud-video-account-options button:focus-visible {
  color: var(--accent);
  background: rgba(179, 45, 51, 0.07);
  outline: none;
}

.cloud-video-account-options .empty {
  padding: 8px;
  color: var(--muted);
  font-size: 11px;
}

.cloud-video-date-picker {
  position: relative;
  min-width: 0;
}

.cloud-video-date-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.cloud-video-date-trigger::after {
  content: '▾';
  flex: 0 0 auto;
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
}

.cloud-video-date-trigger:hover,
.cloud-video-date-trigger[aria-expanded="true"] {
  border-color: rgba(179, 45, 51, 0.45);
}

.cloud-video-date-popover {
  position: absolute;
  z-index: 500;
  top: calc(100% + 8px);
  left: 0;
  width: 310px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  opacity: 1;
  box-shadow: 0 16px 36px rgba(18, 28, 45, 0.18);
}

.cloud-video-calendar-head {
  display: grid;
  grid-template-columns: 30px 1fr 30px;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  text-align: center;
}

.cloud-video-calendar-head button {
  width: 30px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.cloud-video-calendar-head button:hover {
  color: var(--accent);
  background: rgba(179, 45, 51, 0.08);
}

.cloud-video-calendar-head strong {
  color: var(--ink);
  font-size: 13px;
}

.cloud-video-calendar-weekdays,
.cloud-video-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.cloud-video-calendar-weekdays {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.cloud-video-calendar-days > button,
.cloud-video-calendar-blank {
  aspect-ratio: 1;
  min-width: 0;
}

.cloud-video-calendar-days > button {
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.cloud-video-calendar-days > button:hover {
  color: var(--accent);
  background: rgba(179, 45, 51, 0.08);
}

.cloud-video-calendar-days > button.selected {
  border-color: rgba(179, 45, 51, 0.48);
  color: #a6252c;
  background: rgba(179, 45, 51, 0.12);
  font-weight: 800;
}

.cloud-video-calendar-days > button.selected:hover {
  border-color: rgba(179, 45, 51, 0.48);
  color: #a6252c;
  background: rgba(179, 45, 51, 0.12);
}

.cloud-video-calendar-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 12px;
}

.cloud-video-calendar-foot small {
  margin-right: auto;
  color: var(--muted);
  font-size: 10px;
}

.cloud-video-calendar-foot button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 10px;
}

.cloud-video-toolbar input,
.cloud-video-toolbar select {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
}

.cloud-video-schedule-wrap {
  position: relative;
  align-self: end;
  width: 104px;
}

.cloud-video-schedule-wrap > button {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
}

#cloudVideoSyncBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 92px;
  min-height: 36px;
  padding: 0 10px;
  font-size: 12px;
}

#cloudVideoSyncBtn[hidden] {
  display: none;
}

.cloud-video-results {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.cloud-video-totals {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 28px;
  padding: 4px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.cloud-video-totals span { display: inline-flex; align-items: baseline; gap: 6px; }
.cloud-video-totals b { color: var(--ink); font-size: 14px; }

section[data-stage="cloud-video"] #cloudVideoList {
  max-height: none;
  padding-bottom: 12px;
  overscroll-behavior: contain;
}

.cloud-video-search-progress {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  min-height: 240px;
  padding: 32px 24px;
  border: 1px solid rgba(179, 45, 51, 0.14);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(250, 252, 255, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  text-align: center;
}

.cloud-video-search-progress[hidden] {
  display: none;
}

.cloud-video-search-orbit {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 14px;
  border: 5px solid rgba(179, 45, 51, 0.14);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: cloud-video-search-spin 1s linear infinite;
}

.cloud-video-search-orbit i {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 8px rgba(179, 45, 51, 0.1);
}

.cloud-video-search-progress strong {
  font-size: 16px;
}

.cloud-video-search-progress p {
  max-width: min(520px, 100%);
  margin: 8px 0 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.cloud-video-search-progress small {
  color: #8c98aa;
  font-size: 12px;
}

.cloud-video-search-progress.is-failed {
  background: rgba(255, 248, 248, 0.97);
  border-color: rgba(190, 57, 62, 0.28);
}

.cloud-video-search-progress.is-failed .cloud-video-search-orbit i {
  animation: none;
  background: #c33d43;
  box-shadow: 0 0 0 8px rgba(195, 61, 67, 0.1);
}

#cloudVideoScheduleBtn.is-scheduled {
  color: #226f48;
  border-color: rgba(34, 111, 72, 0.32);
  background: rgba(34, 111, 72, 0.08);
}

#cloudVideoScheduleBtn.is-scheduled:disabled {
  cursor: default;
  opacity: 1;
}

@keyframes cloud-video-search-spin {
  to { transform: rotate(360deg); }
}

.cloud-video-sync-spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cloud-video-sync-spin 720ms linear infinite;
}

@keyframes cloud-video-sync-spin {
  to { transform: rotate(360deg); }
}

.cloud-video-schedule-popover {
  position: absolute;
  z-index: 50;
  right: 0;
  top: calc(100% + 8px);
  width: 370px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(22, 35, 55, 0.16);
}

.cloud-video-schedule-popover p {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.cloud-video-schedule-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.cloud-video-schedule-inputs label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.cloud-video-schedule-inputs input,
.cloud-video-schedule-inputs select {
  min-width: 0;
  min-height: 36px;
  padding: 0 5px 0 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
}

.cloud-video-schedule-inputs input::-webkit-calendar-picker-indicator {
  width: 14px;
  height: 14px;
  margin-left: 2px;
  padding: 0;
}

.cloud-video-schedule-popover .primary-btn {
  width: 100%;
}

.cloud-video-notifications {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.cloud-video-notification {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #e4c77b;
  border-radius: 8px;
  color: #6c5114;
  background: #fff8df;
  font-size: 12px;
}

.cloud-video-notification span {
  min-width: 0;
  flex: 1;
}

.cloud-video-notification span b,
.cloud-video-notification span small {
  display: block;
}

.cloud-video-notification span small {
  margin-top: 2px;
  color: rgba(108, 81, 20, 0.72);
  font-size: 10px;
}

.cloud-video-notification button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 11px;
  white-space: nowrap;
}

.cloud-video-notification-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.cloud-video-notification-dismiss {
  width: 28px;
  padding: 0 !important;
  color: #8b6b28;
  border-color: transparent;
  background: transparent;
  font-size: 18px !important;
  line-height: 1;
}

.cloud-video-notification-dismiss:hover,
.cloud-video-notification-dismiss:focus-visible {
  color: #5f4510;
  background: rgba(228, 199, 123, 0.26);
}

.cloud-video-summary-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.cloud-video-summary-table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  table-layout: fixed;
}

.cloud-video-summary-table th,
.cloud-video-summary-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.cloud-video-summary-table th:last-child,
.cloud-video-summary-table td:last-child {
  border-right: 0;
}

.cloud-video-summary-table tbody tr:last-child td {
  border-bottom: 0;
}

.cloud-video-summary-table tbody td {
  vertical-align: middle;
}

.cloud-video-summary-table th {
  color: var(--muted);
  background: var(--bg);
  font-size: 11px;
  font-weight: 800;
}

.cloud-video-summary-table th[data-copy-cloud-summary-column] {
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
}

.cloud-video-summary-table th[data-copy-cloud-summary-column]:hover,
.cloud-video-summary-table th[data-copy-cloud-summary-column]:focus-visible {
  color: var(--accent);
  background: rgba(179, 45, 51, 0.06);
  outline: 0;
}

.cloud-video-reason-filter {
  display: flex;
  justify-content: center;
}

.cloud-video-reason-filter-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 24px;
  padding: 2px 5px;
  border: 0;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: inherit;
}

.cloud-video-reason-filter-trigger:hover,
.cloud-video-reason-filter-trigger:focus-visible,
.cloud-video-reason-filter-trigger[aria-expanded="true"] {
  color: var(--accent);
  background: rgba(179, 45, 51, 0.06);
  outline: 0;
}

.cloud-video-reason-filter-trigger > b {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.cloud-video-reason-filter-trigger > i {
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.cloud-video-reason-filter-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9004;
  display: grid;
  width: min(270px, calc(100vw - 16px));
  max-height: min(390px, calc(100vh - 16px));
  padding: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(18, 28, 45, 0.18);
}

.cloud-video-reason-filter-menu[hidden] {
  display: none;
}

.cloud-video-reason-filter-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.cloud-video-reason-filter-menu button:hover,
.cloud-video-reason-filter-menu button.active {
  color: var(--accent);
  background: rgba(179, 45, 51, 0.07);
}

.cloud-video-reason-filter-menu button b {
  min-width: 22px;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.cloud-video-summary-table th:nth-child(1) { width: 25%; }
.cloud-video-summary-table th:nth-child(2) { width: 13%; }
.cloud-video-summary-table th:nth-child(3) { width: 13%; }
.cloud-video-summary-table th:nth-child(4) { width: 23%; }
.cloud-video-summary-table th:nth-child(5) { width: 26%; }

.cloud-video-summary-material {
  display: grid;
  justify-items: start;
  gap: 6px;
  text-align: left;
}

.cloud-video-summary-material strong,
.cloud-video-summary-official-reason {
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.cloud-video-summary-material-open {
  appearance: none;
  display: grid;
  justify-items: start;
  gap: 3px;
  width: 100%;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  align-content: center;
  justify-content: start;
  text-align: left;
}

.cloud-video-summary-material-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.cloud-video-summary-material-actions button {
  padding: 0;
  border: 0;
  color: var(--muted) !important;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  font-weight: 750;
}

.cloud-video-summary-material-actions button:hover {
  color: var(--muted) !important;
}

.cloud-video-summary-material-open strong {
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.cloud-video-summary-material-open small {
  color: var(--muted);
  font-size: 9px;
}

.cloud-video-summary-material-open:hover strong {
  color: var(--accent);
}

.cloud-video-summary-id-details {
  text-align: center;
}

.cloud-video-summary-table tbody tr.is-id-panel-open,
.cloud-video-summary-table tbody td.is-id-panel-open {
  background: rgba(249, 251, 253, 0.92);
}

.cloud-video-summary-id-details[open] {
  display: grid;
  justify-items: center;
}

.cloud-video-summary-id-details > summary {
  display: grid;
  justify-items: center;
  gap: 2px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  overflow-wrap: anywhere;
}

.cloud-video-summary-id-details > summary::-webkit-details-marker {
  display: none;
}

.cloud-video-summary-id-details > summary b {
  font-size: 11px;
  line-height: 1.4;
  word-break: break-all;
}

.cloud-video-summary-id-details > summary small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.cloud-video-summary-id-details > summary:hover small {
  color: var(--accent);
}

.cloud-video-summary-id-details[open] > summary,
.cloud-video-summary-id-details > summary:hover {
  color: var(--accent);
}

.cloud-video-summary-material-ids {
  position: static;
  display: grid;
  gap: 5px;
  width: min(100%, 170px);
  box-sizing: border-box;
  max-height: 280px;
  margin: 7px auto 0;
  padding: 7px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(18, 28, 45, 0.18);
  isolation: isolate;
  text-align: left;
}

.cloud-video-summary-id-details {
  display: grid;
  justify-items: center;
  width: 100%;
}

.cloud-video-summary-id-details:not([open]) > .cloud-video-summary-material-ids {
  display: none;
}

.cloud-video-summary-material-ids-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cloud-video-summary-id-details > .cloud-video-summary-material-ids {
  width: 100%;
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.cloud-video-summary-material-ids > .cloud-video-summary-id-list {
  display: grid;
  gap: 0;
  padding: 3px 0 0;
  border-top: 1px solid var(--line);
}

.cloud-video-summary-id-list > .cloud-video-id-value {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 6px 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.cloud-video-summary-id-list > .cloud-video-id-value:hover {
  background: #eaf0f6;
}

.cloud-video-summary-material-ids-head > strong {
  color: var(--ink);
  font-size: 10px;
}

.cloud-video-summary-copy-all-ids {
  flex: 0 0 auto;
  padding: 3px 6px;
  border: 0;
  border-radius: 5px;
  color: var(--accent);
  background: rgba(179, 45, 51, 0.08);
  cursor: pointer;
  font-size: 8px;
  font-weight: 750;
}

.cloud-video-summary-id-static {
  display: grid;
  justify-items: center;
  gap: 5px;
  width: 100%;
}

.cloud-video-row-expand {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}

.cloud-video-summary-table .cloud-video-detail-row td {
  background: #f2f6fa;
}

.cloud-video-summary-id-static > b {
  color: var(--ink);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-align: center;
  word-break: break-all;
}

.cloud-video-summary-material-id {
  cursor: pointer;
}

.cloud-video-summary-table td.cloud-video-summary-creative-id,
.cloud-video-summary-table td.cloud-video-summary-component-id {
  cursor: pointer;
}

.cloud-video-summary-table td.cloud-video-summary-creative-id:hover,
.cloud-video-summary-table td.cloud-video-summary-component-id:hover,
.cloud-video-summary-table td.cloud-video-summary-creative-id:focus-visible,
.cloud-video-summary-table td.cloud-video-summary-component-id:focus-visible {
  background: #eaf0f6;
}

.cloud-video-summary-table td.cloud-video-summary-creative-id:focus-visible,
.cloud-video-summary-table td.cloud-video-summary-component-id:focus-visible {
  outline: 1px solid #687c93;
  outline-offset: -2px;
}

.cloud-video-summary-material-id:hover,
.cloud-video-summary-material-id:focus-visible {
  background: rgba(31, 93, 168, 0.06);
  outline: none;
}

.cloud-video-summary-id-static > .cloud-video-summary-id-list {
  width: 100%;
  padding-top: 5px;
}

.cloud-video-summary-copy-all-ids:hover {
  background: rgba(179, 45, 51, 0.14);
}

.cloud-video-summary-id-list {
  display: grid;
  gap: 3px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
}

.cloud-video-summary-id-list > b {
  display: block;
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--ink);
  background: #f5f7fa;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}

.cloud-video-summary-id {
  appearance: none;
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-align: center;
  white-space: normal;
  word-break: break-all;
}

.cloud-video-summary-table td:nth-child(2) {
  text-align: center;
}

.cloud-video-summary-table td:nth-child(3) {
  text-align: center;
}

.cloud-video-summary-table:has(th:nth-child(6)) {
  table-layout: fixed;
}

.cloud-video-summary-table:has(th:nth-child(6)) th:nth-child(1) { width: 22%; }
.cloud-video-summary-table:has(th:nth-child(6)) th:nth-child(2) { width: 13%; }
.cloud-video-summary-table:has(th:nth-child(6)) th:nth-child(3) { width: 13%; }
.cloud-video-summary-table:has(th:nth-child(6)) th:nth-child(4) { width: 18%; }
.cloud-video-summary-table:has(th:nth-child(6)) th:nth-child(5) { width: 17%; }
.cloud-video-summary-table:has(th:nth-child(6)) th:nth-child(6) { width: 17%; }

.cloud-video-summary-wrap {
  overflow-x: hidden;
}

.cloud-video-summary-table tbody td,
.cloud-video-summary-table tbody td strong,
.cloud-video-summary-table tbody td b,
.cloud-video-summary-table tbody td span,
.cloud-video-summary-table tbody td button {
  color: var(--ink);
}

.cloud-video-summary-creative-id b {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.cloud-video-summary-creative-id b,
.cloud-video-summary-component-id b {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.cloud-video-summary-creative-details > summary small {
  display: block;
  margin-top: 2px;
}

.cloud-video-summary-creative-panel {
  width: min(100%, 260px);
  max-height: 320px;
}

.cloud-video-summary-creative-list {
  display: grid;
  gap: 6px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
}

.cloud-video-summary-creative-list article {
  display: grid;
  gap: 3px;
  padding: 6px;
  border-radius: 6px;
  background: #f5f7fa;
  text-align: left;
}

.cloud-video-summary-creative-list article dl {
  display: grid;
  gap: 3px;
  margin: 0;
}

.cloud-video-summary-creative-list article dl > div {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 5px;
  align-items: start;
}

.cloud-video-summary-creative-list article dt,
.cloud-video-summary-creative-list article dd {
  margin: 0;
  font-size: 9px;
  line-height: 1.35;
}

.cloud-video-summary-creative-list article dt {
  color: var(--muted);
  font-weight: 700;
}

.cloud-video-summary-creative-list article dd {
  color: var(--ink);
  font-weight: 750;
  word-break: break-all;
}

.cloud-video-summary-creative-list article span,
.cloud-video-summary-creative-list > small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cloud-video-summary-component-in-creative {
  color: var(--muted) !important;
  font-size: 9px;
  line-height: 1.4;
}

.cloud-video-summary-table td:nth-child(4) {
  text-align: left;
}

.cloud-video-summary-table td:nth-child(5) {
  text-align: center;
}

.cloud-video-summary-id:hover {
  border-color: var(--line);
  color: var(--accent);
  background: var(--bg);
}

.cloud-video-floating-player {
  position: fixed;
  left: 44px;
  top: 180px;
  z-index: 8800;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(760px, calc(100vw - 68px));
  height: min(619px, calc(100vh - 204px));
  min-width: 260px;
  min-height: 220px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 52px rgba(18, 28, 45, 0.28);
  resize: both;
}

.cloud-video-floating-player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  cursor: move;
  touch-action: none;
  user-select: none;
}

.cloud-video-floating-player-head > div {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.cloud-video-floating-player-head strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-video-floating-player-head > button {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: var(--bg);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
}

.cloud-video-floating-player-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.72fr);
  min-height: 0;
  overflow: hidden;
}

.cloud-video-floating-video-pane {
  min-width: 0;
  min-height: 0;
  background: #08090b;
}

.cloud-video-floating-video-pane > video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #08090b;
  object-fit: contain;
}

.cloud-video-floating-transcript-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: #fff;
}

.cloud-video-floating-transcript-pane > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.cloud-video-floating-transcript-pane > div strong {
  font-size: 11px;
}

.cloud-video-floating-transcript-pane > div button {
  padding: 3px 7px;
  border: 0;
  border-radius: 5px;
  color: var(--accent);
  background: rgba(179, 45, 51, 0.08);
  cursor: pointer;
  font-size: 9px;
}

.cloud-video-floating-transcript-pane > div button:disabled {
  cursor: default;
  opacity: 0.45;
}

.cloud-video-floating-transcript-pane pre {
  min-height: 0;
  margin: 0;
  padding: 10px;
  overflow: auto;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  font: inherit;
  font-size: 11px;
  line-height: 1.7;
}

.cloud-video-floating-player > small {
  display: block;
  padding: 6px 10px 8px;
  color: var(--muted);
  font-size: 9px;
}

.cloud-video-floating-player-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 3;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
  touch-action: none;
}

.cloud-video-floating-player-resize::before {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(77, 86, 101, 0.65);
  border-bottom: 2px solid rgba(77, 86, 101, 0.65);
  border-radius: 0 0 3px;
  content: '';
}

.cloud-video-summary-table th:nth-child(2) {
  text-align: center;
}

.cloud-video-summary-editable {
  position: relative;
  color: var(--ink);
  cursor: text;
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cloud-video-mention-menu {
  position: fixed;
  z-index: 9005;
  display: grid;
  max-height: 210px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(18, 28, 45, 0.18);
}

.cloud-video-mention-menu button {
  padding: 7px 8px;
  border: 0;
  border-radius: 5px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.cloud-video-mention-menu button:hover {
  color: var(--accent);
  background: rgba(179, 45, 51, 0.08);
}

.cloud-video-summary-table tr.is-notification-focus > td {
  animation: cloudVideoNotificationFocus 2.8s ease;
}

@keyframes cloudVideoNotificationFocus {
  0%, 70% { background: #fff3c9; }
  100% { background: transparent; }
}

@media (max-width: 720px) {
  .cloud-video-floating-player-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(180px, 1fr) minmax(160px, 0.8fr);
  }

  .cloud-video-floating-transcript-pane {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

.cloud-video-summary-editable:empty::before {
  color: var(--muted);
  content: attr(data-placeholder);
  pointer-events: none;
}

.cloud-video-summary-editable:focus::before {
  content: '';
}

.cloud-video-summary-editable[data-focused="1"]::before {
  content: '';
}

.cloud-video-summary-editable:hover {
  background: rgba(229, 234, 241, 0.42);
}

.cloud-video-summary-editable:focus {
  position: relative;
  z-index: 1;
  background: rgba(229, 234, 241, 0.32);
  box-shadow: inset 0 0 0 2px var(--accent);
  outline: 0;
}

.cloud-video-summary-editable.is-saving {
  opacity: 0.7;
}

.task-status-line {
  min-height: 22px;
  margin: 7px 0;
  color: var(--muted);
  font-size: 13px;
}

.task-status-line.status-failed,
.task-status-line.status-login_required {
  color: #b33f3b;
}

.cloud-video-card {
  display: grid;
  gap: 12px;
}

.cloud-video-director,
.cloud-video-material,
.cloud-video-trader-material {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.cloud-video-director + .cloud-video-director {
  margin-top: 8px;
}

.cloud-video-director > summary,
.cloud-video-material > summary,
.cloud-video-trader-material > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.cloud-video-director > summary::-webkit-details-marker,
.cloud-video-material > summary::-webkit-details-marker,
.cloud-video-trader-material > summary::-webkit-details-marker {
  display: none;
}

.cloud-video-director > summary::after,
.cloud-video-material > summary::after,
.cloud-video-trader-material > summary::after {
  content: '›';
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 18px;
  transform: rotate(90deg);
  transition: transform 0.18s ease;
}

.cloud-video-director[open] > summary::after,
.cloud-video-material[open] > summary::after,
.cloud-video-trader-material[open] > summary::after {
  transform: rotate(-90deg);
}

.cloud-video-director > summary > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.cloud-video-director > summary strong {
  font-size: 15px;
}

.cloud-video-director > summary small,
.cloud-video-material-title small,
.cloud-video-account-head small {
  color: var(--muted);
  font-size: 11px;
}

.cloud-video-counts {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.cloud-video-counts b {
  color: var(--ink);
}

.cloud-video-material-list {
  display: grid;
  gap: 7px;
  padding: 0 8px 8px;
  background: var(--bg);
}

.cloud-video-material {
  border-radius: 7px;
}

.cloud-video-material-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  gap: 3px 8px;
}

.cloud-video-material-title > div {
  display: flex;
  gap: 5px;
}

.cloud-video-material-title > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.35;
}

.cloud-video-material-title > small {
  grid-column: 2;
}

.cloud-video-account-list {
  display: grid;
  gap: 7px;
  padding: 0 8px 8px;
}

.cloud-video-account {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.cloud-video-account-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.cloud-video-account-head > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cloud-video-account-head strong {
  overflow: hidden;
  max-width: min(520px, 58vw);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-video-account-head > b {
  flex: 0 0 auto;
  color: #b33f3b;
  font-size: 12px;
}

.cloud-video-audit-row {
  display: grid;
  gap: 7px;
  padding: 8px 10px;
}

.cloud-video-audit-row + .cloud-video-audit-row {
  border-top: 1px dashed var(--line);
}

.cloud-video-card .card-top > div {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.cloud-video-card h3 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-video-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.cloud-video-reason,
.cloud-video-suggestion {
  padding: 8px 10px;
  border-left: 2px solid #d4504c;
  background: var(--red-soft);
  font-size: 12px;
  line-height: 1.5;
}

.cloud-video-suggestion {
  border-left-color: #37846c;
  background: rgba(55, 132, 108, 0.08);
}

.cloud-video-reason p,
.cloud-video-suggestion p {
  margin: 3px 0 0;
  white-space: pre-wrap;
}

.cloud-video-reason strong,
.cloud-video-suggestion strong {
  font-size: 12px;
}

.cloud-video-director > summary:hover,
.cloud-video-material > summary:hover,
.cloud-video-trader-material > summary:hover {
  background: rgba(229, 234, 241, 0.38);
}

.cloud-video-director-material-list {
  display: grid;
  gap: 6px;
  padding: 0 8px 8px;
  background: var(--bg);
}

.cloud-video-director-material {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.cloud-video-director-material > div {
  display: flex;
  gap: 4px;
}

.cloud-video-director-material > strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-video-director-material > small {
  color: var(--muted);
  font-size: 11px;
}

.cloud-video-transcript-details {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 7px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11px;
}

.cloud-video-transcript-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
}

.cloud-video-transcript-details pre {
  max-height: 220px;
  margin: 8px 0;
  padding: 8px;
  overflow: auto;
  border-radius: 6px;
  color: var(--ink);
  background: var(--bg);
  white-space: pre-wrap;
  line-height: 1.55;
}

.cloud-video-transcript-details ol {
  margin: 7px 0 0;
  padding-left: 20px;
  color: var(--ink);
}

.cloud-video-transcript-details li {
  margin: 5px 0;
  line-height: 1.5;
}

.cloud-video-transcript-details li small {
  color: #a33b3b;
}

.cloud-video-transcript-details p,
.cloud-video-transcript-status {
  color: var(--muted);
}

.cloud-video-trader-material {
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.cloud-video-trader-material[open] {
  overflow: visible;
}

.cloud-video-trader-list {
  display: grid;
  gap: 1px;
  padding: 0 7px 7px;
  background: var(--bg);
}

.cloud-video-trader-row {
  display: grid;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.cloud-video-trader-row:first-child {
  border-radius: 7px 7px 3px 3px;
}

.cloud-video-trader-row:last-child {
  border-radius: 3px 3px 7px 7px;
}

.cloud-video-trader-row.is-qianchuan {
  grid-template-columns: auto minmax(150px, 1.2fr) minmax(105px, 0.7fr) minmax(105px, 0.7fr) auto minmax(210px, 1.5fr);
}

.cloud-video-trader-row.is-adq {
  grid-template-columns: minmax(190px, 1.35fr) minmax(110px, 0.68fr) minmax(110px, 0.68fr) auto minmax(240px, 1.55fr);
}

.cloud-video-trader-name {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-video-trader-field,
.cloud-video-trader-reason {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.cloud-video-trader-field small,
.cloud-video-trader-reason small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.cloud-video-trader-field b {
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-video-trader-reason {
  position: relative;
  padding: 6px 9px;
  border: 1px solid rgba(208, 69, 69, 0.13);
  border-radius: 8px;
  background: rgba(208, 69, 69, 0.065);
}

.cloud-video-trader-reason-tooltip {
  position: absolute;
  z-index: 80;
  right: 0;
  bottom: calc(100% - 1px);
  width: max-content;
  max-width: min(520px, 72vw);
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(22, 35, 55, 0.18);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
  opacity: 0;
  visibility: hidden;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  pointer-events: none;
  cursor: text;
  user-select: text;
  transform: translateY(3px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s ease;
}

.cloud-video-trader-reason:hover .cloud-video-trader-reason-tooltip,
.cloud-video-trader-reason:focus-within .cloud-video-trader-reason-tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.cloud-video-trader-reason b {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-video-copy-btn {
  min-height: 30px;
  padding: 0 9px;
  font-size: 11px;
  white-space: nowrap;
}

@media (max-width: 1050px) {
  .cloud-video-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cloud-video-trader-row.is-qianchuan {
    grid-template-columns: auto minmax(150px, 1fr) repeat(2, minmax(100px, 0.7fr));
  }

  .cloud-video-trader-row.is-adq {
    grid-template-columns: minmax(180px, 1fr) repeat(2, minmax(100px, 0.7fr)) auto;
  }

  .cloud-video-trader-reason {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .cloud-video-toolbar,
  .cloud-video-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .cloud-video-toolbar button {
    width: 100%;
  }

  .cloud-video-schedule-wrap,
  #cloudVideoSyncBtn {
    width: 100%;
  }

  .cloud-video-director > summary,
  .cloud-video-material > summary,
  .cloud-video-trader-material > summary,
  .cloud-video-account-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .cloud-video-counts {
    margin-left: 0;
    white-space: normal;
  }

  .cloud-video-material-title {
    grid-template-columns: minmax(0, 1fr);
  }

  .cloud-video-material-title > small {
    grid-column: 1;
  }

  .cloud-video-account-head strong {
    max-width: 100%;
    white-space: normal;
  }

  .cloud-video-head-actions {
    width: 100%;
    align-items: flex-start;
  }

  .cloud-video-status-wrap {
    flex: 0 0 auto;
  }

  .cloud-video-director-material {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .cloud-video-director-material > small {
    grid-column: 2;
  }

  .cloud-video-trader-row.is-qianchuan {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .cloud-video-trader-row.is-adq {
    grid-template-columns: minmax(0, 1fr);
  }

  .cloud-video-trader-field,
  .cloud-video-copy-btn,
  .cloud-video-trader-reason {
    grid-column: 1 / -1;
  }
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 4px;
}

.auth-error {
  margin: 2px 0 0;
  padding: 9px 11px;
  border: 1px solid rgba(212, 80, 76, 0.28);
  border-radius: 7px;
  color: #b33f3b;
  background: var(--red-soft);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.auth-error[hidden] {
  display: none;
}

.auth-actions button {
  width: 100%;
  min-height: 42px;
}

.auth-alternative-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.auth-alternative-actions[hidden] {
  display: none;
}

.wechat-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: auto !important;
  min-height: 30px !important;
  padding: 2px 5px;
  border: 0;
  border-radius: 0;
  color: #253040;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
  transition: color 160ms ease, opacity 160ms ease;
}

.wechat-login-btn:hover {
  color: #087f40;
  background: transparent;
  box-shadow: none;
}

.wechat-login-btn:focus-visible {
  outline: 2px solid rgba(8, 127, 64, 0.22);
  outline-offset: 2px;
  color: #087f40;
}

.wechat-login-btn:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.wechat-login-icon {
  display: block;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
}

.email-recovery-btn {
  min-height: 30px !important;
  padding: 2px 5px;
  border: 0;
  border-radius: 0;
  color: #8b4a4f;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
}

.email-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto !important;
  gap: 6px;
  min-height: 30px !important;
  padding: 2px 5px;
  border: 0;
  border-radius: 0;
  color: #344052;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
}

.email-login-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.account-bindings-modal {
  max-width: 530px;
}

.account-bindings-list {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.account-binding-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border: 1px solid #e0e5eb;
  border-radius: 8px;
  background: #fff;
}

.account-binding-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
}

.account-binding-icon svg,
.account-binding-icon img {
  width: 22px;
  height: 22px;
}

.email-binding-icon {
  color: #275c92;
  background: #edf5fc;
}

.wechat-binding-icon {
  background: #edf8f1;
}

.account-binding-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.account-binding-copy strong {
  color: #243143;
  font-size: 14px;
}

.account-binding-copy small {
  overflow: hidden;
  color: #788494;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-binding-item .ghost-btn {
  width: auto;
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.account-binding-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.account-binding-actions > button[hidden] {
  display: none;
}

.account-binding-actions .account-unbind-btn {
  color: #9a4148;
}

.email-login-btn:hover,
.email-login-btn:focus-visible,
.email-login-btn.active {
  color: #275c92;
  background: transparent;
  outline: none;
}

.email-login-btn:focus-visible {
  outline: 2px solid rgba(43, 90, 142, 0.18);
  outline-offset: 2px;
}

.email-recovery-btn:hover,
.email-recovery-btn:focus-visible {
  color: #a12d34;
  background: transparent;
  outline: none;
}

.email-recovery-btn:focus-visible {
  outline: 2px solid rgba(179, 45, 51, 0.18);
  outline-offset: 2px;
}

.auth-display-name-field[hidden] {
  display: none;
}

.library-confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  /* Global content modal: always cover the hero and top navigation. */
  z-index: 9000;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.20);
  backdrop-filter: blur(4px);
}

.library-confirm-overlay.active {
  display: grid;
}

.library-confirm-modal {
  width: min(680px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.10);
}

.collection-confirm-modal {
  width: min(460px, 100%);
  padding: 20px;
}

.collection-confirm-details {
  display: grid;
  gap: 0;
  margin: 18px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.collection-confirm-details div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
}

.collection-confirm-details div + div {
  border-top: 1px solid var(--line);
}

.collection-confirm-details dt,
.collection-confirm-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.collection-confirm-details dt {
  color: var(--muted);
  font-size: 12px;
}

.collection-confirm-details dd {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.collection-confirm-notice {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.collection-confirm-modal .library-confirm-actions {
  margin-top: 18px;
}

/* Keep the collection confirmation visually independent from global form/error styles. */
.collection-confirm-modal {
  width: min(480px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid rgba(23, 35, 56, 0.12);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 22px 70px rgba(21, 31, 48, 0.20);
}

.collection-confirm-modal .library-confirm-head h3 {
  color: #172338;
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: 0;
}

.collection-confirm-modal .library-confirm-head p {
  margin-top: 7px;
  color: #718096;
  font-size: 12px;
}

.collection-confirm-modal .collection-confirm-details {
  margin-top: 20px;
  border: 1px solid #e7ebf0;
  border-radius: 10px;
  background: #f8fafc;
}

.collection-confirm-modal .collection-confirm-details div {
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 14px;
  background: transparent;
}

.collection-confirm-modal .collection-confirm-details dt {
  color: #7b8798;
  font-size: 12px;
  font-weight: 700;
}

.collection-confirm-modal .collection-confirm-details dd {
  color: #243247;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.collection-confirm-modal .collection-confirm-notice {
  margin: 16px 2px 0;
  padding: 10px 12px;
  border-left: 3px solid #d7a328;
  border-radius: 4px;
  color: #687588;
  background: #fffaf0;
  font-size: 12px;
  line-height: 1.65;
}

.collection-confirm-modal .library-confirm-close {
  width: 30px;
  height: 30px;
  color: #7b8798;
  background: #f5f7fa;
}

.collection-confirm-modal .library-confirm-actions {
  width: 100%;
  gap: 8px;
  margin-top: 20px;
}

.collection-confirm-modal .library-confirm-actions button {
  flex: 1 1 auto;
  width: 100%;
  min-width: 72px;
  min-height: 38px;
  border-radius: 8px;
  font-weight: 800;
}

@media (max-width: 520px) {
  .collection-confirm-modal {
    width: min(100%, calc(100vw - 20px));
    padding: 20px;
  }

  .collection-confirm-modal .collection-confirm-details div {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

.library-confirm-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.library-confirm-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.library-confirm-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.library-confirm-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.library-confirm-field {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.library-confirm-field[hidden] {
  display: none;
}

.library-confirm-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.library-confirm-field select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
}

.course-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.course-select-row select {
  min-width: 0;
}

.add-course-btn {
  white-space: nowrap;
}

.library-confirm-textarea {
  width: 100%;
  min-height: 112px;
  max-height: 180px;
  margin-top: 14px;
  resize: vertical;
}

.library-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.text-input-modal {
  width: min(460px, 100%);
}

.course-create-modal {
  width: min(720px, 100%);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.course-create-overlay {
  z-index: 9100;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.course-create-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin: 14px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.course-create-mode-switch button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.course-create-mode-switch button.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(24, 31, 44, 0.1);
}

.text-input-control {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
  font-weight: 800;
  outline: none;
}

.text-input-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(179, 45, 51, 0.12);
}

.text-input-control.input-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(212, 80, 76, 0.12);
}

textarea.text-input-control {
  min-height: 120px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.6;
  font-weight: 500;
}

.library-confirm-field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.course-profile-modal {
  width: min(860px, 100%);
  max-height: calc(100vh - 44px);
  overflow-y: auto;
}

.seedance-mobile-thread-picker {
  display: none;
}

.course-profile-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
}

.course-profile-status.failed,
.course-profile-error {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}

.course-profile-status.ready {
  border-color: var(--green);
  background: var(--green-soft);
}

.course-profile-status small {
  margin-left: auto;
  color: var(--muted);
}

.course-profile-progress {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.course-profile-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.course-profile-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 180ms ease;
}

.course-profile-progress p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.course-profile-error,
.course-profile-summary {
  margin-top: 12px;
  padding: 10px 12px;
  line-height: 1.6;
}

.course-profile-summary {
  border-left: 3px solid var(--ink);
  background: var(--surface-2);
}

.course-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.course-profile-row {
  min-width: 0;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.course-profile-row b,
.course-profile-issues h4 {
  font-size: 12px;
}

.course-profile-row p,
.course-profile-issues p,
.course-profile-issues li {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

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

.course-profile-issues,
.course-profile-evidence {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.course-profile-issues ul,
.course-profile-evidence ul {
  display: grid;
  gap: 10px;
  margin: 9px 0 0;
  padding-left: 18px;
}

.course-profile-issues small,
.course-profile-evidence small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.course-profile-evidence summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.danger-action {
  background: var(--red) !important;
  color: #fff !important;
}

/* Final mobile modal overrides: keep long forms centered without the sticky
   framed footer treatment. */
@media (max-width: 720px) {
  .library-confirm-overlay.active,
  .course-create-overlay.active {
    align-items: center !important;
    justify-items: center;
    overflow-y: auto !important;
  }

  .library-confirm-overlay.active .library-confirm-modal,
  .course-create-overlay.active .library-confirm-modal {
    margin: auto;
  }

  .course-create-modal .course-source-text {
    min-height: 210px;
    max-height: 310px;
  }

  .course-create-modal .library-confirm-actions,
  .course-profile-modal .library-confirm-actions {
    position: static !important;
    margin-top: 10px;
    padding: 0 !important;
    background: transparent !important;
  }
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.08;
  font-weight: 850;
  letter-spacing: 0;
}

.brand-lockup {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}

.brand-logo {
  display: block;
  width: auto;
  height: 42px;
  object-fit: contain;
}

.brand-subtitle {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding-left: 12px;
  border-left: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}

h2 {
  font-size: 19px;
}

.step-nav {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.step-nav button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 800;
  font-size: 14px;
  padding: 0 8px;
  outline: none;
}

.step-nav button:focus-visible {
  box-shadow: 0 0 0 3px rgba(179, 45, 51, 0.18);
}

.step-nav button b {
  display: none;
  width: 25px;
  height: 25px;
  margin-right: 7px;
  place-items: center;
  border-radius: 999px;
  color: var(--faint);
  background: var(--surface);
}

.step-nav button.active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.step-nav button.active b {
  color: var(--blue);
}

.step-nav button.collecting #realtimeNavLabel::after {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: '';
  vertical-align: -1px;
  animation: spin 0.8s linear infinite;
}

.step-nav button.synthesizing #digitalHumanNavLabel::after {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: '';
  vertical-align: -1px;
  animation: spin 0.8s linear infinite;
}

.stage {
  display: none;
}

.stage.active {
  display: block;
  height: 100%;
  overflow-y: hidden;
}

.stage-grid {
  display: grid;
  gap: 16px;
}

.source-grid,
.chat-grid,
.knowledge-grid,
.rewrite-grid,
.review-grid {
  grid-template-columns: minmax(360px, 0.85fr) minmax(420px, 1.15fr);
}

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

section[data-stage="accounts"] .accounts-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

section[data-stage="accounts"].active {
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 24px;
}

section[data-stage="accounts"] .accounts-grid {
  height: auto;
  min-height: 100%;
  min-width: 0;
  overflow: visible;
}

section[data-stage="accounts"] .accounts-panel {
  max-height: none;
  overflow: visible;
}

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

.competitor-benchmark-panel {
  display: grid;
  gap: 12px;
  padding: 2px 0 18px;
}

.competitor-benchmark-panel[hidden],
.competitor-form[hidden],
.competitor-add-btn[hidden] {
  display: none !important;
}

/* 对标账号的新增与定时入口暂不在账号板块展示；保留已有对标数据列表。 */
.competitor-toolbar,
.competitor-form {
  display: none !important;
}

.competitor-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 104px 140px;
  gap: 10px;
  align-items: end;
  justify-content: space-between;
}

.competitor-search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.competitor-search input { min-height: 38px; background: #fff; }

.competitor-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 140px;
  flex-shrink: 0;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(173, 186, 201, 0.5);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.competitor-export-btn {
  width: 104px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(173, 186, 201, 0.5);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.competitor-sync-all-btn {
  width: 92px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(173, 186, 201, 0.5);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.competitor-sync-all-btn:hover { border-color: var(--blue); color: var(--blue); }
.competitor-sync-all-btn:disabled { cursor: wait; opacity: 0.7; }

.competitor-export-btn:hover { border-color: var(--blue); color: var(--blue); }
.competitor-export-btn.is-scheduled { color: var(--blue); border-color: rgba(44, 103, 190, 0.48); }
.competitor-export-btn.is-scheduled { color: #226f48; border-color: rgba(34, 111, 72, 0.32); background: rgba(34, 111, 72, 0.08); }
.competitor-schedule-wrap { position: relative; width: 104px; }
.competitor-schedule-popover { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; display: grid; gap: 10px; width: 230px; padding: 14px; border: 1px solid rgba(173, 186, 201, 0.45); border-radius: 8px; background: #fff; box-shadow: 0 16px 36px rgba(35, 43, 54, 0.16); }
.competitor-schedule-popover[hidden] { display: none; }
.competitor-schedule-popover strong { color: var(--ink); font-size: 13px; }
.competitor-schedule-popover p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.competitor-schedule-popover label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.competitor-schedule-popover input { min-height: 34px; }
.competitor-schedule-popover .primary-btn { min-height: 34px; }
.competitor-schedule-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.competitor-schedule-actions .ghost-btn { min-height: 34px; padding: 0 8px; font-size: 12px; }

.competitor-add-btn:hover { border-color: var(--blue); color: var(--blue); }
.competitor-add-btn svg { width: 16px; height: 16px; }

.competitor-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) 112px;
  gap: 8px;
  align-items: end;
  width: 100%;
  margin-left: 0;
  padding: 12px;
  border: 1px solid rgba(173, 186, 201, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.competitor-form label { min-width: 0; }
.competitor-form label:nth-child(2) { max-width: none; }
.competitor-form .primary-btn { width: 100%; min-width: 0; box-sizing: border-box; white-space: nowrap; }

.competitor-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.competitor-form input {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  min-height: 36px;
}

.competitor-benchmark-list {
  display: grid;
  gap: 0;
}

.competitor-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(173, 186, 201, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.competitor-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
}

.competitor-table th {
  padding: 12px 14px;
  color: var(--muted);
  background: rgba(246, 248, 251, 0.9);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.competitor-table th:nth-child(1) { width: 14%; }
.competitor-table th:nth-child(2) { width: 9%; }
.competitor-table th:nth-child(3) { width: 26%; }
.competitor-table th:nth-child(n+4):nth-child(-n+7) { width: 8%; }
.competitor-table th:nth-child(8) { width: 12%; }
.competitor-table th:last-child { width: 5%; }
.competitor-note-input { display: block; width: 100%; min-width: 90px; height: 36px; min-height: 36px; max-height: 64px; resize: vertical; overflow-y: hidden; border: 1px solid rgba(173, 186, 201, 0.42); border-radius: 4px; padding: 7px 8px; color: var(--ink); background: #fff; font: inherit; font-size: 13px; line-height: 1.5; box-sizing: border-box; vertical-align: top; }

.competitor-table th:nth-child(n+4):nth-child(-n+7),
.competitor-table td:nth-child(n+4):nth-child(-n+7) { text-align: center; }

.competitor-table td:nth-child(2) { text-align: center; }

.competitor-table td {
  padding: 14px;
  border-top: 1px solid rgba(173, 186, 201, 0.22);
  color: var(--ink);
  background: #fff;
  vertical-align: middle;
}
.competitor-table td:nth-child(8) { vertical-align: top; }

.competitor-table tbody tr { transition: background 140ms ease; }
.competitor-table tbody tr:hover { background: rgba(255, 255, 255, 0.78); }
.competitor-syncing-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 14px; font-weight: 700; }
.competitor-syncing-state .status-spinner { width: 14px; height: 14px; border-width: 2px; }

.competitor-identity,
.competitor-work-cell { display: grid; gap: 4px; min-width: 0; }
.competitor-table td:first-child { text-align: center; }
.competitor-table td:first-child .competitor-identity { justify-items: center; }
.competitor-table td:first-child .competitor-account-link { text-align: center; }
.competitor-identity small,
.competitor-work-cell small { color: var(--muted); font-size: 11px; }

.competitor-account-link,
.competitor-work-title {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.competitor-identity strong,
.competitor-syncing-state { font-size: 14px; line-height: 1.35; }

.competitor-work-title {
  font-size: 14px;
  cursor: pointer;
}

.competitor-account-link:hover,
.competitor-work-title:hover,
.competitor-comment-count:hover {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.competitor-platform {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 750;
}

.competitor-platform i {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #20242d;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.competitor-table td > b,
.competitor-fans-value { font-size: 14px; font-weight: 700; }

.competitor-comment-count {
  padding: 0;
  border: 0;
  color: var(--blue);
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}


.competitor-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 31, 42, 0.38);
  backdrop-filter: blur(4px);
}

.competitor-preview-overlay[hidden] { display: none !important; }

.competitor-preview-dialog {
  display: block;
  width: 960px;
  max-width: calc(100% - 32px);
  overflow: hidden;
  border: 1px solid rgba(173, 186, 201, 0.36);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(35, 43, 54, 0.24);
}

.competitor-preview-head,
.competitor-preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
}

.competitor-preview-head small { color: var(--muted); font-size: 12px; }
.competitor-preview-head h2 { margin: 4px 0 0; font-size: 17px; font-weight: 700; }
.competitor-preview-close { align-self: flex-start; margin-top: -6px; border: 0; background: transparent; color: var(--muted); font-size: 25px; line-height: 1; cursor: pointer; }
.competitor-preview-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.competitor-recent-work-label { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 600; }
.competitor-recent-work-list { display: flex; width: 100%; max-width: 820px; min-width: 0; gap: 6px; margin-top: 9px; overflow: hidden; }
.competitor-recent-work-link { flex: 1 1 0; min-width: 0; overflow: hidden; border: 1px solid rgba(173, 186, 201, 0.48); border-radius: 999px; padding: 5px 10px; color: var(--muted); background: #fff; font-size: 12px; line-height: 1.2; text-align: center; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.competitor-recent-work-link.active,
.competitor-recent-work-link:hover { border-color: var(--red); color: var(--red); }
.competitor-preview-body { display: grid !important; width: 100% !important; min-width: 0; grid-template-columns: 42% 58%; }
.competitor-preview-media { display: grid; width: 100%; min-width: 0; min-height: 0; place-items: center; background: #14171d; }
.competitor-preview-media video { display: block; width: auto; max-width: 100%; height: min(60dvh, 520px); aspect-ratio: 9 / 16; background: #050505; }
.competitor-preview-unavailable { padding: 24px; color: rgba(255, 255, 255, 0.82); font-size: 14px; text-align: center; }
.competitor-preview-comments { display: grid; width: 100%; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr); border-left: 1px solid rgba(173, 186, 201, 0.26); background: #fff; color: var(--ink); }
.competitor-preview-comments h3 { margin: 0; padding: 16px 18px; border-bottom: 1px solid rgba(173, 186, 201, 0.26); color: var(--ink); font-size: 14px; font-weight: 700; }
.competitor-preview-comments h3 { display: flex; align-items: center; justify-content: center; gap: 16px; text-align: center; }
.competitor-comments-refresh { display: inline-flex; align-items: center; justify-content: center; margin: 18px auto 0; padding: 10px 18px; border: 1px solid var(--red); border-radius: 6px; color: var(--red); background: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.competitor-comments-empty { display: flex; min-height: 220px; flex-direction: column; align-items: center; justify-content: center; padding: 36px 18px; }
.competitor-preview-comments-content { min-height: 0; max-height: min(60dvh, 520px); overflow-y: auto; background: #fff; }
.competitor-preview-footer { align-items: center; border-top: 1px solid rgba(173, 186, 201, 0.26); }
.competitor-preview-footer p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.competitor-preview-actions { display: flex; flex: 0 0 auto; gap: 8px; }

.competitor-comments-overlay {
  position: fixed;
  inset: 0;
  z-index: 9200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 31, 42, 0.38);
  backdrop-filter: blur(4px);
}

.competitor-comments-overlay[hidden] { display: none !important; }
.competitor-comments-dialog { width: min(620px, 100%); max-height: min(720px, calc(100dvh - 48px)); overflow: auto; border: 1px solid rgba(173, 186, 201, 0.36); border-radius: 8px; background: #fff; box-shadow: 0 24px 80px rgba(35, 43, 54, 0.24); }
.competitor-comments-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid rgba(173, 186, 201, 0.26); }
.competitor-comments-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.competitor-comments-content { display: grid; }
.competitor-preview-comments .competitor-comment { padding: 11px 18px; border-bottom: 1px solid rgba(173, 186, 201, 0.2); }
.competitor-preview-comments .competitor-comment:last-child { border-bottom: 0; }
.competitor-preview-comments .competitor-comment-author { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 13px; }
.competitor-preview-comments .competitor-comment-avatar { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border-radius: 50%; background: #e6ebf2; color: #526174; font-size: 12px; font-weight: 700; object-fit: cover; }
.competitor-preview-comments .competitor-comment p { margin: 5px 0 0 38px; color: var(--ink); font-size: 14px; line-height: 1.5; }
.competitor-preview-comments .competitor-comment-meta { display: flex; flex-wrap: wrap; gap: 14px; margin: 5px 0 0 38px; color: var(--muted); font-size: 12px; }
.competitor-preview-comments .competitor-comment-like { color: var(--muted); }
.competitor-preview-comments .competitor-comment-replies { display: block; margin: 6px 0 0 38px; color: #8f8f8f; font-size: 12px; }
.competitor-comments-loading,
.competitor-comments-empty { padding: 36px 18px; color: #a8a8a8; font-size: 14px; text-align: center; }

.competitor-card-actions { display: flex; align-items: center; gap: 4px; }

.competitor-action-button,
.competitor-work-link {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.competitor-action-button svg,
.competitor-work-link svg { width: 16px; height: 16px; }

.competitor-action-button:hover { color: var(--blue); background: var(--blue-soft); }
.competitor-action-button.danger { opacity: 0; }
.competitor-table tr:hover .competitor-action-button.danger,
.competitor-action-button.danger:focus-visible { opacity: 1; }
.competitor-action-button.danger:hover { color: var(--red); background: rgba(179, 45, 51, 0.08); }

.accounts-panel.competitor-mode .account-summary,
.accounts-panel.competitor-mode .account-management-toolbar,
.accounts-panel.competitor-mode #accountTableWrap {
  display: none !important;
}

@media (max-width: 680px) {
  .competitor-table { min-width: 860px; }
  .competitor-toolbar { grid-template-columns: minmax(0, 1fr) auto auto; }
  .competitor-form { grid-template-columns: 1fr; }
  .competitor-form .primary-btn { width: 100%; }
  .competitor-search span { display: none; }
  .competitor-preview-body { grid-template-columns: 1fr; }
  .competitor-preview-media { min-height: 220px; }
  .competitor-preview-comments { max-height: 300px; border-top: 1px solid rgba(173, 186, 201, 0.26); border-left: 0; }
  .competitor-preview-comments-content { max-height: 250px; }
}

.account-summary-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(173, 186, 201, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.account-summary-card strong {
  color: var(--blue);
  font-size: 24px;
  font-weight: 900;
}

.account-summary-card span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.account-summary-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.account-section {
  display: grid;
  gap: 10px;
}

.account-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}

.account-section-head strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.account-section-head small {
  color: var(--muted);
  font-size: 12px;
}

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

.account-breakdown-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(173, 186, 201, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
}

.account-breakdown-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.account-breakdown-head strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.account-breakdown-head small {
  color: var(--muted);
  font-size: 12px;
}

.account-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-breakdown-table-wrap {
  overflow: hidden;
  border: 1px solid rgba(173, 186, 201, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.account-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.account-breakdown-table th,
.account-breakdown-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(173, 186, 201, 0.14);
  text-align: left;
}

.account-breakdown-table thead th {
  color: var(--muted);
  background: rgba(245, 247, 250, 0.92);
  font-weight: 800;
}

.account-breakdown-table tbody td:last-child {
  text-align: right;
}

.account-breakdown-table tbody td:last-child strong {
  color: var(--blue);
  font-size: 13px;
}

.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(179, 45, 51, 0.16);
  border-radius: 999px;
  color: #8f2429;
  background: rgba(179, 45, 51, 0.06);
  font-size: 12px;
  font-weight: 800;
}

.account-pill span {
  color: var(--muted);
  font-weight: 700;
}

.account-pill-empty {
  color: var(--muted);
  font-size: 12px;
}

.account-editor,
.account-toolbar {
  display: grid;
  gap: 10px;
}

.account-ip-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
}

@media (min-width: 981px) {
  .accounts-panel-head {
    position: relative;
    justify-content: center;
  }

  .accounts-panel-head #accountNewBtn {
    position: absolute;
    right: 0;
  }
}

.account-ip-tabs button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 108px;
  min-height: 54px;
  padding: 7px 18px;
  border: 1px solid rgba(173, 186, 201, 0.38);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  font-size: 15px;
  font-weight: 850;
  cursor: pointer;
}

.account-ip-tabs button small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.account-ip-tabs button.active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: 0 8px 20px rgba(179, 45, 51, 0.2);
}

.account-ip-tabs button.active small {
  color: rgba(255, 255, 255, 0.78);
}

.account-ip-stats {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 18px;
  padding: 9px 14px;
  border: 1px solid rgba(173, 186, 201, 0.24);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.account-ip-stats strong {
  color: var(--ink);
  font-size: 14px;
}

.account-ip-stats b {
  margin-left: 3px;
  color: var(--ink);
}

.account-ip-stats .is-active b {
  color: var(--green);
}

.account-ip-stats .is-blocked b,
.account-ip-stats .is-closed b {
  color: var(--blue);
}

.account-editor {
  width: min(920px, 100%);
  max-height: calc(100dvh - 48px);
  padding: 20px;
  overflow-y: auto;
  border: 1px solid rgba(173, 186, 201, 0.32);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(35, 43, 54, 0.18);
}

.account-editor[hidden] {
  display: none !important;
}

.account-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 31, 42, 0.28);
  backdrop-filter: blur(5px);
}

.account-editor-overlay[hidden] {
  display: none !important;
}

.account-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 31, 42, 0.28);
  backdrop-filter: blur(5px);
}

.account-detail-overlay[hidden] {
  display: none !important;
}

.account-detail-dialog {
  width: min(880px, 100%);
  max-height: calc(100dvh - 48px);
  padding: 22px;
  overflow-y: auto;
  border: 1px solid rgba(173, 186, 201, 0.3);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(35, 43, 54, 0.2);
}

.account-detail-head,
.account-detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.account-detail-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.account-detail-close {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.account-detail-edit {
  display: inline-grid;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: #2576df;
  background: transparent;
  cursor: pointer;
}

.account-detail-edit svg {
  width: 16px;
  height: 16px;
}

.account-detail-edit:hover,
.account-detail-edit:focus-visible {
  color: #1762c6;
  background: rgba(47, 120, 215, 0.1);
  outline: 0;
}

.account-detail-close:hover,
.account-detail-close:focus-visible {
  color: var(--ink);
  background: rgba(35, 43, 54, 0.06);
  outline: 0;
}

.account-detail-head {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(173, 186, 201, 0.24);
}

.account-detail-head small,
.account-detail-head p,
.account-detail-field span {
  color: var(--muted);
}

.account-detail-head h2 {
  margin: 5px 0 4px;
  color: var(--ink);
  font-size: 22px;
}

.account-detail-head p {
  margin: 0;
  font-size: 12px;
}

.account-detail-content {
  display: grid;
  gap: 14px;
  padding-top: 16px;
}

.account-detail-section {
  padding: 16px;
  border: 1px solid rgba(173, 186, 201, 0.24);
  border-radius: 14px;
  background: rgba(247, 249, 252, 0.7);
}

.account-detail-section-head {
  min-height: 30px;
  margin-bottom: 12px;
}

.account-detail-section-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.account-detail-section-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-detail-section-head .account-inline-status {
  display: inline-flex;
  width: auto;
  min-width: 64px;
  height: 28px;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
}

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

.account-detail-field {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 11px 12px;
  border-radius: 10px;
  background: #fff;
}

.account-detail-field.is-wide {
  grid-column: 1 / -1;
}

.account-detail-field span {
  font-size: 11px;
  font-weight: 700;
}

.account-detail-field strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.account-detail-field select,
.account-detail-field input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 6px 9px;
  border: 1px solid rgba(173, 186, 201, 0.42);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 13px;
}

.account-detail-edit-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.account-detail-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.account-detail-edit-actions .ghost-btn,
.account-detail-edit-actions .primary-btn {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 5px;
  box-shadow: none;
  font-size: 13px;
}

.account-editor-head,
.account-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.account-editor-head > div {
  display: grid;
  gap: 4px;
}

.account-editor-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.account-editor-grid {
  display: grid;
  gap: 14px;
}

.account-editor-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(173, 186, 201, 0.24);
  border-radius: 12px;
  background: rgba(247, 249, 252, 0.7);
}

.account-editor-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.account-editor-section-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.account-editor-section-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.account-editor-section-head b,
.account-editor-label b {
  color: var(--accent);
}

.account-editor-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.account-editor-fields {
  display: grid;
  gap: 10px;
}

.account-editor-fields-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.account-editor-fields-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.account-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  padding: 14px;
  overflow: hidden;
  border: 1px solid rgba(173, 186, 201, 0.24);
  border-radius: 14px;
  background: rgba(247, 249, 252, 0.82);
}

.account-summary {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  overflow: hidden;
  border: 1px solid rgba(173, 186, 201, 0.24);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
}

.account-summary-scroll {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.account-summary-scroll::-webkit-scrollbar {
  display: none;
}

.account-summary-primary {
  display: flex;
  flex: 0 0 auto;
  align-items: baseline;
  gap: 8px;
  padding-right: 4px;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.account-summary-primary:hover,
.account-summary-primary:focus-visible {
  opacity: 0.78;
  outline: 0;
}

.account-summary-primary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.account-summary-primary strong {
  color: var(--accent);
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
}

.account-summary-scroll > i {
  flex: 0 0 1px;
  width: 1px;
  height: 24px;
  background: rgba(173, 186, 201, 0.34);
}

.account-summary-group {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.account-summary-reminder {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 7px 10px;
  border-radius: 999px;
  color: #7a5b1c;
  background: rgba(252, 244, 225, 0.92);
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.account-department-empty {
  display: grid;
  min-height: 220px;
  place-content: center;
  gap: 8px;
  padding: 36px 24px;
  border: 1px dashed rgba(173, 186, 201, 0.52);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
  background: rgba(247, 249, 252, 0.7);
}

.account-department-empty strong {
  color: var(--ink);
  font-size: 15px;
}

.account-department-empty span {
  font-size: 13px;
}

.account-summary-group > span,
.account-summary-group > button {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(245, 247, 250, 0.9);
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.account-summary-group > button:hover,
.account-summary-group > button:focus-visible {
  color: var(--ink);
  background: rgba(223, 229, 237, 0.96);
  outline: 0;
}

.account-summary-group em {
  font-size: 11px;
  font-style: normal;
  font-weight: 750;
}

.account-summary-group b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.account-summary-status .is-active {
  color: #167f50;
  background: rgba(224, 240, 232, 0.72);
}

.account-summary-status .is-active b {
  color: #167f50;
}

.account-summary-status .is-banned {
  color: #9a4f00;
  background: rgba(250, 240, 224, 0.82);
}

.account-summary-status .is-banned b {
  color: #9a4f00;
}

.account-summary-status .is-closed {
  color: #a12d33;
  background: rgba(248, 231, 232, 0.82);
}

.account-summary-status .is-closed b {
  color: #a12d33;
}

.account-toolbar label {
  flex: 0 1 118px;
}

.account-toolbar .account-search-field {
  flex: 1 1 220px;
}

.account-compact-toolbar {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.account-compact-toolbar #accountNewBtn {
  flex: 0 0 auto;
  align-self: end;
}

.account-management-toolbar {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(173, 186, 201, 0.26);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

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

.account-management-filters label {
  display: grid;
  grid-column: span 1;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.account-management-filters .account-search-field {
  grid-column: span 1;
}

.account-management-filters select,
.account-management-filters input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 7px 10px;
  border: 1px solid rgba(173, 186, 201, 0.38);
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  box-shadow: none;
}

.account-management-actions {
  display: flex;
  grid-column: span 1;
  align-items: end;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.account-management-actions button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 4px;
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
}

.account-management-actions .ghost-btn {
  border-color: #a8caff;
  color: #2576df;
  background: #f8fbff;
}

.account-management-actions .ghost-btn:hover,
.account-management-actions .ghost-btn:focus-visible {
  border-color: #7eaeef;
  color: #1762c6;
  background: #f0f6ff;
}

.account-management-actions .primary-btn {
  border: 1px solid #2b75d9;
  background: #2f78db;
  box-shadow: none;
}

.account-management-actions .primary-btn:hover,
.account-management-actions .primary-btn:focus-visible {
  border-color: #2168c7;
  background: #256dcc;
  box-shadow: none;
}

.account-editor-grid label,
.account-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.account-editor-grid input,
.account-editor-grid textarea,
.account-editor-grid select,
.account-toolbar select,
.account-toolbar input {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(173, 186, 201, 0.42);
  border-radius: 11px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
}

.account-editor-grid textarea {
  resize: vertical;
  min-height: 72px;
}

.account-editor-grid .account-editor-wide {
  grid-column: 1 / -1;
}

.account-table-wrap {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  height: min(600px, calc(100dvh - 430px));
  min-height: 360px;
  overflow: auto;
  border: 1px solid rgba(173, 186, 201, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.account-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 12px;
}

.account-table th,
.account-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(173, 186, 201, 0.18);
  text-align: center;
  vertical-align: middle;
}

.account-table th:nth-child(3),
.account-table td:nth-child(3) {
  width: 96px;
  text-align: center;
}

.account-table th:nth-child(2),
.account-table td:nth-child(2) {
  width: 96px;
  text-align: left;
}

.account-table th:nth-child(1),
.account-table td:nth-child(1),
.account-table th:nth-child(2),
.account-table td:nth-child(2),
.account-table th:nth-child(3),
.account-table td:nth-child(3),
.account-table th:nth-child(4),
.account-table td:nth-child(4),
.account-table th:nth-child(5),
.account-table td:nth-child(5),
.account-table th:nth-child(7),
.account-table td:nth-child(7),
.account-table th:nth-child(8),
.account-table td:nth-child(8),
.account-table th:nth-child(9),
.account-table td:nth-child(9) {
  white-space: nowrap;
}

.account-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: rgba(245, 247, 250, 0.96);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.account-filter-trigger {
  min-width: 0;
  color: inherit;
}

.account-sort-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
}

.account-sort-trigger i {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1;
}

.account-sort-trigger:hover,
.account-sort-trigger:focus-visible {
  color: var(--accent);
}

.account-sort-trigger:focus-visible {
  outline: 2px solid rgba(47, 120, 215, 0.34);
  outline-offset: 4px;
  border-radius: 4px;
}

.account-filter-menu {
  width: min(270px, calc(100vw - 16px));
}

.account-table th:first-child,
.account-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
}

.account-table thead th:first-child {
  z-index: 3;
  background: rgba(245, 247, 250, 0.98);
}

.account-table tbody tr:hover td:first-child {
  background: #fbf5f5;
}

.account-ip-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.account-table tbody tr:hover {
  background: rgba(179, 45, 51, 0.04);
}

.account-name-cell {
  display: grid;
  gap: 3px;
  place-items: center start;
  text-align: left;
}

.account-id-details {
  display: grid;
  justify-items: start;
  color: var(--muted);
  text-align: left;
}

.account-id-details > summary {
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.account-id-details > summary::-webkit-details-marker {
  display: none;
}

.account-id-details > summary:hover,
.account-id-details[open] > summary {
  color: var(--accent);
}

.account-id-details > summary strong {
  color: inherit;
  font: inherit;
}

.account-account-meta {
  display: grid;
  gap: 4px;
  width: min(220px, 100%);
  margin-top: 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.account-account-meta > span {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}

.account-account-meta em {
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  line-height: 1.35;
}

.account-account-meta b {
  color: var(--ink);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.account-id-details:not([open]) > .account-account-meta {
  display: none;
}

.account-id-empty {
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
}

.account-inline-name-fields {
  display: grid;
  gap: 5px;
}

.account-inline-edit-row input,
.account-inline-edit-row select {
  width: 100%;
  min-width: 62px;
  height: 32px;
  padding: 4px 7px;
  border: 1px solid rgba(179, 45, 51, 0.34);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font-size: 11px;
}

.account-inline-edit-row td:first-child input {
  min-width: 150px;
  text-align: left;
}

.account-name-cell strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.account-home-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.account-home-link span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
  transform: translate(-2px, 1px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.account-home-link:hover,
.account-home-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.account-home-link:hover span,
.account-home-link:focus-visible span {
  opacity: 1;
  transform: translate(0, 1px);
}

.account-home-link:focus-visible {
  outline: 2px solid rgba(47, 120, 215, 0.34);
  outline-offset: 3px;
  border-radius: 3px;
}

.account-name-cell small,
.account-phone-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.account-name-note {
  color: #b3262e;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.account-platform-pill {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.account-platform-pill img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.account-platform-icon {
  display: inline-grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(173, 186, 201, 0.18);
}

.account-platform-icon.is-dark {
  background: #161823;
  box-shadow: none;
}

.account-platform-icon.is-dark img {
  filter: brightness(0) invert(1);
}

.account-platform-icon img.is-video-channel {
  width: 24px;
  height: 24px;
}

.account-platform-pill.is-text-only {
  color: var(--muted);
}

.account-inline-status {
  width: 76px;
  min-width: 76px;
  height: 32px;
  min-height: 32px;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.account-table th:nth-child(8),
.account-table td:nth-child(8) {
  width: 106px;
  padding-right: 6px;
  padding-left: 6px;
  text-align: center;
}

.account-table th:first-child,
.account-table td:first-child {
  min-width: 210px;
  padding-right: 14px;
  padding-left: 14px;
  text-align: left;
}

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

.account-table th:nth-child(4),
.account-table td:nth-child(4) {
  width: 90px;
  text-align: center;
}

.account-table th:nth-child(5),
.account-table td:nth-child(5),
.account-table th:nth-child(9),
.account-table td:nth-child(9) {
  width: 100px;
}

.account-future-status {
  color: var(--faint);
  font-weight: 750;
}

.account-sync-pill {
  display: inline-flex;
  min-width: 58px;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.account-sync-pill.is-synced {
  color: #167f50;
  background: rgba(224, 240, 232, 0.84);
}

.account-sync-pill.is-unsynced {
  color: #b3262e;
  background: rgba(248, 231, 232, 0.9);
}

.account-sync-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

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

  .account-management-filters label {
    grid-column: span 1;
  }

  .account-management-filters .account-search-field {
    grid-column: span 1;
  }

  .account-management-actions {
    grid-column: span 1;
  }
}

@media (max-width: 720px) {
  .account-management-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-management-filters label {
    grid-column: span 1;
  }

  .account-management-filters .account-search-field {
    grid-column: 1 / -1;
  }

  .account-management-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-management-actions button {
    min-width: 0;
    padding-right: 6px;
    padding-left: 6px;
  }
}

.account-edit-btn {
  min-width: 54px;
  white-space: nowrap;
}

.ghost-btn.account-edit-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: #2f78d7;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.ghost-btn.account-edit-btn:hover {
  color: #2f78d7;
  background: rgba(47, 120, 215, 0.10);
}

.account-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.account-delete-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.account-delete-btn svg {
  width: 16px;
  height: 16px;
}

.account-delete-btn:hover,
.account-delete-btn:focus-visible {
  color: var(--accent);
  background: rgba(179, 45, 51, 0.06);
  outline: 0;
}

.account-status-active {
  color: var(--green);
  background: rgba(224, 240, 232, 0.8);
}

.account-status-live_banned {
  color: #9a4f00;
  background: rgba(250, 240, 224, 0.8);
}

.account-status-closed {
  color: #8f2429;
  background: rgba(250, 232, 230, 0.8);
}

.account-status-other {
  color: #5f6976;
  background: rgba(241, 244, 248, 0.8);
}

.account-empty {
  margin: 0;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.panel-head p,
.panel > p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

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

.metric-chip {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
}

.metric-chip b {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.3;
}

.metric-chip span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.metric-chip small {
  display: block;
  margin-top: 4px;
  color: var(--blue);
  font-size: 12px;
}

.advanced-review-fields {
  margin: 2px 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.48);
}

.advanced-review-fields summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
}

.advanced-review-fields .field-row {
  margin-top: 12px;
}

.review-metric-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.review-metric-line span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 12px;
}

section[data-stage="review"] .panel {
  overflow-y: auto;
}

section[data-stage="review"] .panel-head {
  margin-bottom: 12px;
}

.review-form-title {
  width: fit-content;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(179, 45, 51, 0.20);
  border-radius: 10px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff 0%, #fff8f8 100%);
  font-size: 18px;
  font-weight: 950;
  letter-spacing: 0;
}

section[data-stage="review"] textarea {
  min-height: 116px;
}

section[data-stage="review"] #reviewLinks,
section[data-stage="review"] #reviewTranscript {
  min-height: 92px;
}

section[data-stage="review"] #reviewDataPaste {
  min-height: 92px;
}

section[data-stage="review"] .metric-preview {
  max-height: 188px;
  overflow-y: auto;
  padding-right: 4px;
}

.field-row {
  display: grid;
  gap: 8px;
  margin-bottom: 13px;
  flex-shrink: 0;
}

.field-row.compact {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

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

.field-optional {
  margin-left: 4px;
  color: #98a1ad;
  font-size: 11px;
  font-weight: 600;
}

.source-object-hint {
  margin-top: -2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  outline: none;
  color: var(--ink);
  background: var(--surface);
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 17px, calc(100% - 12px) 17px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  font-weight: 800;
}

textarea {
  min-height: 132px;
  padding: 12px;
  resize: vertical;
  line-height: 1.7;
}

.hidden-field {
  display: none;
}

.source-fields-hidden {
  display: none;
}

.source-mode-switch,
.source-method-switch {
  display: grid;
  gap: 6px;
  padding: 4px;
  margin-bottom: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

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

.source-method-switch {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 0;
}

.chanmama-fields {
  gap: 9px;
}

.chanmama-filter-summary,
.chanmama-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chanmama-filter-summary span,
.chanmama-meta span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
}

.chanmama-task {
  grid-column: 1 / -1;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.chanmama-sort-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.chanmama-sort-control select {
  width: auto !important;
  min-width: 128px !important;
  max-width: 160px;
  flex: 0 0 auto;
  min-height: 28px;
  height: 28px;
  padding: 2px 24px 2px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
}

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

.chanmama-task-head b {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chanmama-task progress {
  width: 100%;
  height: 8px;
  margin-top: 9px;
}

.chanmama-task.failed b {
  color: var(--red);
}

.chanmama-video {
  display: block;
  width: min(100%, 320px);
  max-height: 480px;
  margin: 10px 0;
  background: #111;
  object-fit: contain;
}

.chanmama-browser {
  height: 100%;
  padding: 10px 4px 18px 0;
  overflow-y: auto;
}

#chanmamaWorkspace[hidden],
#miaosiWorkspace[hidden] {
  display: none;
}

.realtime-nav-item {
  position: relative;
  min-width: 0;
}

.step-nav .realtime-nav-main {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.step-nav .realtime-nav-main span {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-nav .realtime-nav-main .realtime-nav-caret {
  display: inline-flex;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.step-nav .realtime-nav-main .realtime-nav-caret::before {
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: '';
  transform: translateY(-2px) rotate(45deg);
}

.step-nav .realtime-nav-main[aria-expanded="true"] .realtime-nav-caret::before {
  transform: translateY(2px) rotate(-135deg);
}

.realtime-nav-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  width: 132px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
}

.realtime-nav-menu[hidden] {
  display: none;
}

.step-nav .realtime-nav-menu button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.step-nav .realtime-nav-menu button:hover,
.step-nav .realtime-nav-menu button.active {
  color: var(--blue);
  background: var(--blue-soft);
}

.chanmama-category-tabs {
  display: flex;
  gap: 10px;
  padding: 4px 0 16px;
  overflow-x: auto;
}

.chanmama-category-tabs button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.chanmama-category-tabs button span {
  margin-left: 7px;
  color: var(--muted-2);
  font-size: 11px;
}

.chanmama-category-tabs button.active {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
  box-shadow: 0 7px 18px rgba(179, 45, 51, 0.20);
}

.chanmama-category-tabs button.active span {
  color: rgba(255, 255, 255, 0.78);
}

.chanmama-category-tabs .category-del {
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease;
}

.chanmama-category-tabs button:hover .category-del,
.chanmama-category-tabs button:focus-visible .category-del {
  opacity: 1;
}

.chanmama-category-tabs button.active .category-del {
  border-left-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.78);
}

.chanmama-category-tabs button.task-running:not(.active) {
  border-color: rgba(179, 45, 51, 0.55);
  color: var(--blue);
}

.chanmama-category-tabs button.task-failed:not(.active) {
  border-color: rgba(198, 60, 60, 0.45);
  color: var(--red);
}

.empty-category {
  padding: 7px 0;
  color: var(--muted);
  font-size: 13px;
}

.chanmama-collector-panel {
  display: grid;
  grid-template-columns: minmax(360px, 1fr);
  align-items: end;
  gap: 12px;
  padding: 12px 0 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.chanmama-material-type-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}

.chanmama-material-type-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted, #667085);
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.chanmama-material-type-tabs button.active {
  color: var(--ink, #172033);
  border-bottom-color: var(--accent, #2563eb);
}

#chanmamaCategoryTabs[hidden],
#chanmamaMaterialTypeTabs[hidden] {
  display: none !important;
}

.youshu-workspace {
  min-height: 620px;
  overflow: hidden;
  border: 1px solid #dfe5ee;
  border-radius: 14px;
  background: #f5f7fb;
  color: #172033;
  box-shadow: 0 10px 30px rgba(23, 32, 51, .06);
}

.youshu-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  padding: 0 22px;
  border-bottom: 1px solid #e1e7f0;
  background: #fff;
}

.youshu-topbar-brand,
.youshu-topbar-status,
.youshu-module-button,
.youshu-module-notice {
  display: flex;
  align-items: center;
}

.youshu-topbar-brand {
  gap: 10px;
}

.youshu-topbar-brand strong,
.youshu-topbar-brand small {
  display: block;
}

.youshu-topbar-brand strong {
  font-size: 16px;
  line-height: 1.3;
}

.youshu-topbar-brand small {
  margin-top: 2px;
  color: #667085;
  font-size: 12px;
}

.youshu-brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: #b4232e;
  color: #fff;
  font-weight: 700;
}

.youshu-topbar-status {
  gap: 8px;
  margin-left: auto;
  color: #667085;
  font-size: 13px;
}

.youshu-status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, .12);
}

.youshu-status-divider {
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: #d0d5dd;
}

.youshu-open-link {
  color: #b4232e;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.youshu-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 552px;
}

.youshu-sidebar {
  padding: 20px 12px;
  border-right: 1px solid #e1e7f0;
  background: #fff;
}

.youshu-sidebar-title {
  padding: 0 10px 8px;
  color: #98a2b3;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

.youshu-sidebar-title.secondary {
  margin-top: 24px;
}

.youshu-module-button {
  width: 100%;
  gap: 10px;
  min-height: 42px;
  margin: 3px 0;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #344054;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.youshu-module-button:hover {
  background: #f8f9fc;
}

.youshu-module-button.active {
  border-color: #f0c7cb;
  background: #fff4f4;
  color: #b4232e;
  font-weight: 700;
}

.youshu-module-icon {
  width: 20px;
  color: #98a2b3;
  text-align: center;
}

.youshu-module-button em {
  margin-left: auto;
  color: #98a2b3;
  font-size: 11px;
  font-style: normal;
}

.youshu-module-button em.available {
  color: #16a34a;
}

.youshu-content {
  min-width: 0;
  padding: 24px;
}

.youshu-module-panel {
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
}

.youshu-module-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.youshu-module-panel h2 {
  margin: 6px 0 8px;
}

.youshu-module-panel p {
  margin: 0;
  color: var(--muted, #667085);
}

.youshu-module-kicker {
  color: var(--muted, #667085);
  font-size: 13px;
}

.youshu-launch-button {
  white-space: nowrap;
  text-decoration: none;
}

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

.youshu-material-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.youshu-material-list article {
  display: flex;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px;
  background: #fafafa;
}

.youshu-material-list img {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border-radius: 6px;
  object-fit: cover;
  background: #eef1f5;
}

.youshu-material-list strong,
.youshu-material-list small {
  display: block;
}

.youshu-material-list strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-height: 1.45;
}

.youshu-material-list small {
  margin-top: 6px;
  color: var(--muted, #667085);
}

.youshu-module-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line, #e5e7eb);
  color: var(--muted, #667085);
  font-size: 13px;
}

.youshu-search-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  color: var(--text, #344054);
  font-weight: 600;
}

.youshu-search-field input {
  width: min(260px, 32vw);
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line, #d0d5dd);
  border-radius: 6px;
  background: #fff;
  color: var(--text, #101828);
}

.chanmama-collector-panel[hidden] {
  display: none;
}

.chanmama-collector-panel .field-row {
  margin: 0;
}

.chanmama-collector-panel input,
.chanmama-collector-panel select,
.chanmama-search-action button {
  min-height: 42px;
  height: 42px;
}

.chanmama-search-action button {
  white-space: nowrap;
}

.chanmama-search-action {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding-left: 14px;
  border-left: none;
}

.youshu-filter-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  background: #f7f9fc;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.youshu-filter-bar::-webkit-scrollbar { display: none; }
.chanmama-task-strip > .youshu-filter-bar { width: 100%; margin: 0; }
.youshu-inline-filters { display:flex; align-items:center; gap:16px; width:100%; min-height:32px; overflow-x:auto; white-space:nowrap; scrollbar-width:none; color:#8792a2; }
.youshu-inline-filters::-webkit-scrollbar { display:none; }
.youshu-inline-filters label { display:inline-flex; align-items:center; gap:3px; flex:0 0 auto; color:#8792a2; font-size:12px; font-weight:600; white-space:nowrap; }
.youshu-inline-filters select { height:24px; min-width:0; padding:0 16px 0 0; border:0; border-radius:0; background-color:transparent; color:#667085; font:inherit; appearance:auto; cursor:pointer; }
.youshu-inline-check input { width:13px; height:13px; margin:0 2px 0 0; accent-color:#b32d33; }
.youshu-filter-bar label { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; color: #667085; font-size: 12px; font-weight: 600; white-space: nowrap; }
.youshu-filter-bar select { flex: 0 0 auto; min-width: 104px; height: 36px; border: 1px solid #d7dee8; border-radius: 7px; background: #fff; padding: 6px 10px; color: #263243; font-size: 13px; white-space: nowrap; }
.youshu-filter-bar .youshu-check { padding: 6px 0; }

.chanmama-search-action label {
  color: var(--blue);
  font-weight: 900;
}

.chanmama-search-action input {
  border-color: rgba(179, 45, 51, 0.75);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(179, 45, 51, 0.08);
}

.chanmama-search-action input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(179, 45, 51, 0.16);
  outline: none;
}

.chanmama-task-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.chanmama-sort-summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

.chanmama-sort-summary button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--muted);
  background: var(--surface-2);
  font: inherit;
  cursor: pointer;
}

.chanmama-sort-summary button.active {
  border-color: rgba(179, 45, 51, 0.55);
  color: var(--blue);
  background: rgba(179, 45, 51, 0.08);
}

.chanmama-sort-summary em {
  margin-left: 3px;
  font-style: normal;
  opacity: 0.7;
}

.chanmama-task-strip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.miaosi-task-status-main {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.miaosi-task-status-main > progress {
  flex: 1 1 auto;
  min-width: 120px;
}

.chanmama-task-strip progress {
  flex: 1;
  min-width: 120px;
  height: 7px;
}

.chanmama-task-strip .failed {
  color: var(--red);
}

.chanmama-login-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

button.chanmama-login-indicator {
  border: 0;
  background: transparent;
  cursor: pointer;
}

button.chanmama-login-indicator.can-manage:hover,
button.chanmama-login-indicator.can-manage:focus-visible {
  color: var(--ink);
  background: rgba(20, 32, 48, 0.06);
  outline: none;
}

.chanmama-login-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(123, 133, 148, 0.12);
}

.chanmama-login-dot.is-ready {
  background: #31a968;
  box-shadow: 0 0 0 3px rgba(49, 169, 104, 0.14);
}

.chanmama-login-dot.is-offline {
  background: #cf3c43;
  box-shadow: 0 0 0 3px rgba(207, 60, 67, 0.14);
}

.chanmama-login-dot.is-unknown {
  background: #98a2b3;
  box-shadow: 0 0 0 3px rgba(152, 162, 179, 0.14);
}

.chanmama-login-dot.is-active {
  background: #31a968;
  box-shadow: 0 0 0 3px rgba(49, 169, 104, 0.14);
  animation: chanmama-active-pulse 1.6s ease-in-out infinite;
}

@keyframes chanmama-active-pulse {
  50% { box-shadow: 0 0 0 6px rgba(49, 169, 104, 0.06); }
}

.chanmama-task-error {
  flex: 1;
  color: var(--red);
  font-weight: 700;
}

.chanmama-task-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 290px;
}

.chanmama-task-summary > div {
  display: grid;
  gap: 3px;
}

.chanmama-task-summary b {
  color: var(--ink);
  font-size: 13px;
}

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

.chanmama-data-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.chanmama-grid-empty {
  grid-column: 1 / -1;
}

.chanmama-grid-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.chanmama-grid-card:hover,
.chanmama-grid-card:focus-visible {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 10px 26px rgba(20, 31, 52, 0.12);
  transform: translateY(-2px);
}

.chanmama-card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #111;
}

.chanmama-card-media img,
.chanmama-card-media video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
  transition: transform 200ms ease;
}

.chanmama-grid-card:hover .chanmama-card-media img,
.chanmama-grid-card:hover .chanmama-card-media video {
  transform: scale(1.025);
}

.chanmama-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(12, 16, 24, 0.72);
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 160ms ease;
}

.chanmama-play-icon::after {
  position: absolute;
  top: 14px;
  left: 19px;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 15px solid #fff;
  content: '';
}

.chanmama-grid-card:hover .chanmama-play-icon,
.chanmama-grid-card:focus-visible .chanmama-play-icon {
  opacity: 1;
}

.chanmama-run-score {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 5px 7px;
  border-radius: 5px;
  color: #fff;
  background: rgba(16, 20, 28, 0.78);
  font-size: 12px;
}

.chanmama-saved-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 5px 7px;
  border-radius: 5px;
  color: #fff;
  background: rgba(23, 126, 82, 0.9);
  font-size: 12px;
  font-weight: 800;
}

.chanmama-analysis-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 5px 7px;
  border-radius: 5px;
  color: #fff;
  background: rgba(179, 45, 51, 0.92);
  font-size: 12px;
  font-weight: 800;
}

.chanmama-analysis-badge.running {
  background: rgba(155, 99, 20, 0.94);
}

.chanmama-analysis-badge.failed {
  background: rgba(170, 47, 47, 0.94);
}

.chanmama-card-body {
  padding: 12px;
}

.chanmama-card-body h3 {
  display: -webkit-box;
  min-height: 42px;
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

section[data-stage="chanmama"] .chanmama-card-body h3 { color: var(--ink); }

.chanmama-title-toggle {
  display: none;
}

.chanmama-author {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chanmama-author {
  margin: 8px 0 10px;
}

.chanmama-card-save {
  width: 100%;
  min-height: 34px;
  margin-top: 10px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  color: var(--blue);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.chanmama-card-save:hover {
  color: #fff;
  background: var(--blue);
}

.chanmama-card-save.saved {
  border-color: var(--line);
  color: var(--muted);
  background: var(--surface-2);
  cursor: default;
}

.chanmama-primary-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.chanmama-primary-metrics.single {
  grid-template-columns: 1fr;
}

.chanmama-primary-metrics div {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px;
  border-radius: 6px;
  background: var(--surface-2);
}

.chanmama-primary-metrics dt {
  min-width: 0;
  white-space: nowrap;
  color: var(--muted);
  font-size: 10px;
}

.chanmama-primary-metrics dd {
  min-width: 0;
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chanmama-primary-metrics.youshu-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 6px 2px;
  border-radius: 6px;
  background: var(--surface-2);
}

.chanmama-primary-metrics.youshu-metrics div {
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 2px;
  border-radius: 0;
  background: transparent;
  text-align: center;
}

.chanmama-primary-metrics.youshu-metrics dt {
  order: 2;
  font-size: 10px;
}

.chanmama-primary-metrics.youshu-metrics dd {
  order: 1;
  width: 100%;
  font-size: 13px;
}

.chanmama-author.youshu-author {
  margin: 9px 0 0;
}

.chanmama-player-overlay {
  position: fixed;
  inset: 0;
  /* Global content modal: above all workbench chrome, below the login overlay. */
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 16, 24, 0.72);
}

.chanmama-player-modal {
  position: relative;
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(320px, 1fr);
  width: min(980px, 100%);
  height: min(820px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
}

.chanmama-player-media {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #08090b;
}

.chanmama-player-media video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}

.chanmama-player-detail {
  min-width: 0;
  min-height: 0;
  padding: 34px 28px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: #17202b;
  background: #fff;
}

.chanmama-player-detail h2 {
  margin: 14px 0 8px;
  font-size: 19px;
  line-height: 1.5;
}

.chanmama-player-detail > p {
  color: var(--muted);
}

.chanmama-player-detail dl {
  display: grid;
  gap: 1px;
  margin: 22px 0;
  background: var(--line);
}

.chanmama-player-detail dl div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 11px 12px;
  background: var(--surface);
}

.chanmama-player-detail dt {
  color: var(--muted);
}

.chanmama-player-detail dd {
  margin: 0;
  font-weight: 800;
}

.chanmama-player-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 22px;
  cursor: pointer;
}

.chanmama-player-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}

.chanmama-player-actions > * {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
}

.chanmama-player-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.chanmama-analysis {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.chanmama-analysis[hidden] {
  display: none;
}

.chanmama-analysis h3 {
  margin: 0 0 14px;
  font-size: 16px;
}

.chanmama-analysis h3 span {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--blue);
  background: var(--surface-2);
  font-size: 11px;
  vertical-align: 2px;
}

.chanmama-analysis > div {
  margin-bottom: 14px;
}

.chanmama-analysis b {
  font-size: 13px;
}

.chanmama-analysis p,
.chanmama-analysis ul,
.chanmama-analysis ol {
  margin: 6px 0 0;
  color: #4f5a66;
  font-size: 13px;
  line-height: 1.7;
}

.chanmama-analysis ul,
.chanmama-analysis ol {
  padding-left: 20px;
}

.chanmama-structure-list li {
  margin-bottom: 10px;
}

.chanmama-structure-list li > b {
  color: var(--ink);
}

.chanmama-structure-list li > span {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
}

.chanmama-structure-list li > p {
  margin-top: 3px;
}

.chanmama-formula {
  padding: 10px 12px;
  border-left: 3px solid var(--blue);
  background: var(--surface-2);
  color: var(--ink) !important;
  font-weight: 700;
}

.chanmama-analysis-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.chanmama-analysis-loading > div {
  display: grid;
  gap: 3px;
}

.chanmama-analysis-loading small {
  color: var(--muted);
  font-size: 12px;
}

.chanmama-analysis-error {
  color: var(--red) !important;
}

.chanmama-save-overlay {
  position: fixed;
  inset: 0;
  /* Nested content modal: above the player overlay and top navigation. */
  z-index: 9050;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 16, 24, 0.72);
}

.chanmama-save-dialog {
  position: relative;
  width: min(480px, 100%);
  padding: 26px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.chanmama-save-dialog h2 {
  margin: 0 38px 6px 0;
  font-size: 19px;
}

.chanmama-save-dialog > p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.chanmama-save-dialog label {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.chanmama-save-dialog [hidden] {
  display: none !important;
}

.chanmama-save-dialog select,
.chanmama-save-dialog input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  padding: 0 10px;
}

.chanmama-save-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

.source-method-switch.two-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.source-mode-switch button,
.source-method-switch button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.source-mode-switch button.active,
.source-method-switch button.active {
  color: #fff;
  background: var(--blue);
}

#sourceLinks,
#internalLinks {
  min-height: 112px;
  height: 112px;
}

#sourceTranscript,
#internalTranscript {
  min-height: 86px;
  height: 86px;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-picker {
  min-height: 46px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 5px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
}

.file-picker:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.file-picker-btn {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.local-upload-dropzone .file-picker-btn {
  border: 1px solid rgba(179, 45, 51, 0.34);
  color: var(--blue);
  background: #fff;
  box-shadow: none;
}

.local-upload-dropzone .file-picker-btn:hover {
  border-color: rgba(179, 45, 51, 0.56);
  background: rgba(179, 45, 51, 0.06);
}

.file-picker span {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picker.has-file span {
  color: var(--ink);
}

.file-picker.local-upload-dropzone {
  min-height: 124px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 18px;
  border: 2px dashed var(--line-2);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.file-picker.local-upload-dropzone:hover,
.file-picker.local-upload-dropzone:focus-within,
.file-picker.local-upload-dropzone:focus-visible,
.file-picker.local-upload-dropzone.drag-over {
  border-color: var(--blue);
  outline: none;
  background: var(--blue-soft);
  box-shadow: 0 0 0 3px rgba(179, 45, 51, 0.12);
}

.file-picker.local-upload-dropzone.has-file {
  border-color: var(--green);
  background: var(--green-soft);
  cursor: default;
}

.local-upload-empty,
.local-upload-selected {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.local-upload-selected {
  display: none;
}

.local-upload-dropzone.has-file .local-upload-empty {
  display: none;
}

.local-upload-dropzone.has-file .local-upload-selected {
  display: flex;
}

.local-upload-dropzone strong {
  max-width: 100%;
  color: var(--ink);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.file-picker.local-upload-dropzone .local-upload-subtitle,
.file-picker.local-upload-dropzone .local-upload-selection {
  max-width: 100%;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.file-picker.local-upload-dropzone .local-upload-selection {
  color: var(--ink);
  font-weight: 900;
}

.local-upload-dropzone .file-picker-btn {
  width: auto;
  min-height: 34px;
}

.local-upload-cancel {
  min-height: 30px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.local-upload-cancel:hover {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-soft);
}

.local-source-row small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.primary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  font-weight: 900;
}

.primary-btn {
  color: #fff;
  background: var(--blue);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

.ghost-btn {
  border: 1px solid var(--line-2);
  color: var(--ink);
  background: var(--surface);
}

.card-list {
  display: grid;
  gap: 10px;
  max-height: 640px;
  overflow: auto;
  padding-right: 4px;
}

.source-queue-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  align-items: center;
  gap: 14px;
  height: 64px;
  min-height: 64px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fff8f8 100%);
  box-shadow: 0 10px 24px rgba(39, 41, 92, 0.06);
}

.source-queue-head > div {
  display: inline-flex;
  align-items: center;
  align-self: center;
  justify-content: center;
  gap: 10px;
  justify-self: center;
}

.source-queue-head b {
  display: inline-block;
  line-height: 1.2;
  color: var(--ink);
  font-size: 18px;
  letter-spacing: 0;
}

.source-queue-head span {
  display: inline-block;
  margin-top: 0;
  line-height: 1.2;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.source-queue-head .source-queue-library-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.source-queue-toggle {
  align-self: center;
  justify-self: start;
  width: 100%;
  margin-right: 0;
  min-height: 36px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.source-queue-items {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.source-material-card {
  min-width: 0;
  overflow: hidden;
}

.source-material-card .card-top {
  min-width: 0;
  flex-wrap: wrap;
}

.source-material-card .card-top h3 {
  flex: 1 1 220px;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--ink);
}

.account-table tbody td:nth-child(7),
.account-table tbody td:nth-child(8),
.account-table tbody td:nth-child(6) {
  color: var(--ink);
}

.source-material-card .card-top-right {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

.source-material-card > p,
.source-material-card > small,
.source-material-card .chanmama-meta span {
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.mini-card,
.version-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.card-top h3 {
  font-size: 15px;
  line-height: 1.35;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.ok {
  color: var(--green);
  background: var(--green-soft);
}

.pill.working {
  color: #d49516;
  background: var(--gold-soft);
}

.pill.bad {
  color: var(--red);
  background: var(--red-soft);
}

.pill.muted {
  color: var(--muted);
  background: var(--surface-2);
}

.transcript-correction-pill {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.transcript-correction-pill.risk-low {
  color: var(--muted);
  background: var(--surface-2);
}

.transcript-correction-pill.risk-medium {
  color: #9a6a00;
  background: var(--gold-soft);
}

.transcript-correction-pill.risk-high {
  color: var(--red);
  background: var(--red-soft);
}

.pipeline-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.pipeline-status div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.pipeline-status b,
.pipeline-status span {
  display: inline-block;
}

.pipeline-status b {
  font-size: 19px;
}

.pipeline-status span,
.pipeline-status p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.pipeline-status p {
  grid-column: 1 / -1;
  margin: 0;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--surface-2);
}

.scope-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 130px)) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.scope-box div,
.scope-box p {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.scope-box b,
.scope-box span {
  display: block;
}

.scope-box b {
  font-size: 18px;
}

.scope-box span,
.scope-box p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

.ip-library button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}

.ip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.ip-row .delete-ip-btn {
  width: auto;
  min-height: 44px;
  padding: 0 12px;
  justify-content: center;
  color: var(--red);
  background: var(--red-soft);
  font-size: 12px;
  font-weight: 900;
}

.ip-library span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.knowledge-side-panel .ip-library,
.knowledge-side-panel .card-list {
  min-height: 0;
  max-height: none;
  margin-bottom: 0;
  overflow: auto;
}

.knowledge-side-panel .ip-library {
  flex-shrink: 0;
  max-height: 168px;
  padding-right: 4px;
}

.knowledge-side-panel .card-list {
  flex: 1;
}

.mini-card p,
.mini-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.mini-card blockquote {
  margin: 8px 0;
  padding: 10px;
  border-left: 3px solid var(--blue);
  border-radius: 8px;
  color: var(--ink);
  background: #fff8f8;
  font-size: 13px;
  line-height: 1.6;
}

.review-card .card-top-right {
  align-items: center;
  gap: 6px;
}

.review-delete-btn {
  width: 26px;
  height: 26px;
  min-height: 26px;
  border-radius: 8px;
}

.knowledge-layout {
  height: 100%;
  min-height: 0;
  display: block;
  overflow: hidden;
}

.knowledge-elements-panel {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 14px 12px;
}

.knowledge-elements-panel .panel-head {
  min-height: 0;
  align-items: center;
  margin-bottom: 2px;
}

.kb-source-switch {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  white-space: nowrap;
}

.kb-source-switch button {
  min-height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.kb-source-switch button.active {
  color: #fff;
  background: var(--blue);
}

.knowledge-elements-panel .panel-head h2 {
  font-size: 18px;
}

.knowledge-elements-panel .panel-head p {
  display: none;
}

.knowledge-searchbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 8px;
  margin-bottom: 4px;
  flex-shrink: 0;
  align-items: center;
}

.knowledge-searchbar input {
  min-height: 36px;
  border-color: var(--line-2);
  background: var(--surface);
  font-size: 13px;
  line-height: 36px;
  padding-top: 0;
  padding-bottom: 0;
  display: flex;
  align-items: center;
}

.knowledge-searchbar input::placeholder {
  color: var(--muted);
  font-size: 13px;
}

.knowledge-searchbar span {
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  align-items: center;
  justify-self: end;
  min-width: 238px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.knowledge-search-results {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid rgba(179, 45, 51, 0.28);
  border-radius: 11px;
  background: #f8fafc;
}

.knowledge-search-results-head,
.knowledge-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.knowledge-search-results-head > div {
  display: grid;
  gap: 2px;
}

.knowledge-search-results-head b {
  font-size: 15px;
}

.knowledge-search-results-head span {
  color: var(--muted);
  font-size: 12px;
}

.knowledge-search-result-list {
  display: grid;
  gap: 6px;
}

.knowledge-search-result {
  width: 100%;
  min-height: 62px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.knowledge-search-result:hover {
  border-color: rgba(179, 45, 51, 0.50);
  background: #fff;
}

.knowledge-search-result-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.knowledge-search-result-main b,
.knowledge-search-result-main em {
  overflow: hidden;
  text-overflow: ellipsis;
}

.knowledge-search-result-main b {
  font-size: 13px;
  white-space: nowrap;
}

.knowledge-search-result-main em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
  white-space: normal;
}

.knowledge-search-result-meta {
  flex: 0 0 112px;
  display: grid;
  justify-items: end;
  gap: 3px;
}

.knowledge-search-result-meta small {
  max-width: 112px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-search-result-meta strong {
  color: var(--blue);
  font-size: 12px;
}

.knowledge-search-no-result {
  padding: 16px 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.knowledge-coursebar {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.knowledge-coursebar > div:first-child {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

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

.knowledge-coursebar b {
  font-size: 14px;
}

.knowledge-coursebar .add-course-btn {
  min-height: 32px;
  white-space: nowrap;
}

.course-profile-state {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  white-space: nowrap;
}

.course-profile-state.failed {
  color: var(--red);
  border-color: var(--red);
}

.course-tabs {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow-x: auto;
}

.course-tabs button {
  min-height: 26px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.course-tabs button.active {
  color: #fff;
  background: var(--blue);
}

.knowledge-workbench {
  flex: 1;
  min-height: 0;
  display: block;
  overflow: hidden;
}

.knowledge-tree-panel,
.element-cloud-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.knowledge-tree-panel {
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.knowledge-element-directory {
  flex: 0 0 auto;
}

.knowledge-element-directory-body {
  padding: 8px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.46);
}

.knowledge-element-directory .element-cloud-panel {
  max-height: min(58vh, 560px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: auto;
}

.knowledge-element-directory .cloud-scope-bar {
  min-height: auto;
  justify-content: flex-end;
}

.knowledge-element-directory .cloud-scope-actions {
  width: 100%;
}

.workbench-pane-head {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px 0 2px;
  flex-shrink: 0;
}

.workbench-pane-head div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.workbench-pane-head b {
  font-size: 15px;
  line-height: 1.25;
}

.workbench-pane-head span {
  display: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workbench-pane-head em {
  flex: 0 0 auto;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.material-tree {
  flex: 1;
  min-height: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  overflow: auto;
}

.material-tree.hit-table-mode {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: auto;
}

.hit-empty-state {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.hit-empty-state b {
  font-size: 16px;
}

.hit-empty-state p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.compact-hit-empty {
  margin-top: 10px;
}

.pending-hit-group {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.pending-hit-group summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
  background: var(--surface);
}

.pending-hit-group summary::-webkit-details-marker {
  display: none;
}

.pending-hit-group summary strong {
  color: var(--ink);
  font-size: 13px;
}

.pending-hit-group summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pending-hit-group[open] summary span {
  color: var(--blue);
}

.pending-hit-group .hit-table {
  margin-top: 0;
  border-width: 1px 0 0;
  border-radius: 0;
}

.pending-audit-panel {
  margin-top: 10px;
}

.pending-audit-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  background: #fbfcff;
}

.pending-audit-tools button {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  border: 1px solid rgba(179, 45, 51, 0.18);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.pending-audit-tools button.active {
  color: var(--blue);
  border-color: rgba(179, 45, 51, 0.34);
  background: var(--blue-soft);
}

.pending-audit-tools strong {
  color: inherit;
  font-size: 11px;
}

.knowledge-next-step {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(179, 45, 51, 0.18);
  border-radius: 12px;
  color: var(--blue);
  background: linear-gradient(180deg, #f8fafc 0%, #f2f5f8 100%);
}

.knowledge-next-step b {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.knowledge-next-step span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.knowledge-next-step button {
  flex-shrink: 0;
  min-height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--blue);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.overview-next-step {
  margin-top: 10px;
}

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

.hit-stat-grid span {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-size: 11px;
  font-weight: 900;
}

.hit-stat-grid em {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
}

.hit-stat-grid strong {
  color: var(--ink);
  font-size: 15px;
  white-space: nowrap;
}

.pending-overview {
  display: grid;
  gap: 7px;
  padding-top: 2px;
}

.pending-overview-head,
.pending-overview-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pending-overview-head {
  min-height: 30px;
  cursor: pointer;
  list-style: none;
}

.pending-overview-head::-webkit-details-marker {
  display: none;
}

.pending-overview-head b {
  color: var(--ink);
  font-size: 13px;
}

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

.pending-overview[open] .pending-overview-head span {
  color: var(--blue);
}

.pending-overview-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.pending-overview-list button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(179, 45, 51, 0.18);
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.pending-overview-list button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--blue);
}

.pending-overview-list button strong {
  flex-shrink: 0;
}

.course-material-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.course-material-list article {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.course-material-list b {
  font-size: 13px;
  line-height: 1.4;
}

.course-material-list span {
  color: var(--muted);
  font-size: 12px;
}

.hit-table-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.hit-table-head b,
.hit-table-head span {
  display: block;
}

.hit-table-head b {
  font-size: 15px;
}

.hit-table-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.hit-table {
  margin-top: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.hit-table table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.55;
  table-layout: fixed;
}

.hit-table th,
.hit-table td {
  padding: 8px 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.hit-table .col-text {
  width: 44%;
  vertical-align: middle;
}

.hit-table .col-text b {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.5;
}

.hit-table .col-count {
  width: 52px;
  text-align: center;
  vertical-align: middle;
}

.hit-table .col-source {
  width: 31%;
  vertical-align: middle;
}

.hit-table .col-source b {
  display: block;
  font-size: 13px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.hit-table .col-source small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.hit-table .col-source .source-expand summary {
  display: block;
  min-height: 0;
  font-size: 11px;
}

.hit-table .col-owner {
  width: 64px;
  text-align: center;
  vertical-align: middle;
}

.hit-table th {
  color: var(--ink);
  background: var(--blue-soft);
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.hit-table td.col-text,
.hit-table td.col-source {
  text-align: left;
}

.hit-table td.col-count,
.hit-table td.col-owner {
  text-align: center;
}

.hit-table td:first-child {
  color: var(--ink);
}

.hit-table td {
  color: var(--muted);
}

.hit-table small {
  color: var(--faint);
}

.source-expand {
  margin: 0;
  contain: layout paint;
}

.source-expand-body {
  contain: layout paint;
}

.source-expand-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.source-expand summary {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 900;
  color: var(--blue);
}

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

.source-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.source-link-row code {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  font-family: inherit;
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-link-btn {
  flex-shrink: 0;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.source-expand pre {
  max-height: 180px;
  overflow: auto;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-2);
  font: inherit;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.tree-node {
  margin-bottom: 6px;
}

.tree-node summary {
  list-style: none;
}

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

.tree-children {
  margin-left: 10px;
  padding-left: 9px;
  border-left: 1px solid var(--line);
}

.tree-scope-btn,
.sentence-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  padding: 7px 8px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.tree-scope-btn:hover,
.sentence-row:hover {
  background: var(--surface);
}

.tree-scope-btn.active {
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 900;
  box-shadow: inset 3px 0 0 var(--blue);
}

.tree-scope-btn span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-scope-btn em {
  min-width: 22px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  font-style: normal;
}

.tree-scope-btn.benchmark span {
  color: var(--green);
}

.tree-scope-btn.material {
  min-height: 40px;
  align-items: flex-start;
  background: var(--surface);
}

.tree-sentences {
  display: grid;
  gap: 5px;
  margin: 4px 0 8px 12px;
}

.sentence-row {
  align-items: flex-start;
  justify-content: flex-start;
  font-size: 12px;
  line-height: 1.55;
}

.sentence-row b {
  flex: 0 0 auto;
  min-width: 22px;
  color: var(--faint);
  font-size: 11px;
}

.sentence-row span {
  min-width: 0;
}

.sentence-row.highlight {
  color: var(--ink);
  background: var(--gold-soft);
  box-shadow: inset 3px 0 0 var(--gold);
}

.tree-empty {
  padding: 9px;
  color: var(--faint);
  font-size: 12px;
}

.cloud-scope-bar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  flex-shrink: 0;
}

.cloud-scope-bar b,
.cloud-scope-bar span {
  display: block;
}

.cloud-scope-bar b {
  font-size: 14px;
}

.cloud-scope-bar span,
.cloud-scope-bar p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.cloud-scope-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.cloud-element-search {
  width: min(220px, 24vw);
  min-width: 150px;
  height: 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  padding: 0 7px 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--surface);
}

.cloud-element-search:focus-within {
  border-color: rgba(179, 45, 51, 0.42);
  box-shadow: 0 0 0 2px rgba(179, 45, 51, 0.08);
}

.cloud-element-search input {
  min-width: 0;
  height: 30px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
}

.cloud-element-search small {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.cloud-element-search button {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.cloud-element-search button:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.cloud-scope-actions .ghost-btn {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--blue);
  font-size: 12px;
}

.cloud-scope-actions .danger-btn {
  border-color: rgba(212, 80, 76, 0.24);
  color: var(--red);
  background: var(--red-soft);
}

.element-cloud {
  flex: 1;
  min-height: 240px;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f8fb;
  overflow: auto;
  position: relative;
}

.element-directory {
  min-height: 100%;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 10px;
}

.element-directory-group {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.element-directory-group header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.element-directory-group header div {
  min-width: 0;
}

.element-directory-group header b,
.element-directory-group header span {
  display: block;
}

.element-directory-group header b {
  color: var(--blue);
  font-size: 13px;
  line-height: 1.3;
}

.element-directory-group header span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.element-directory-group header em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

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

.element-directory-item {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.element-directory-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.element-directory-item em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.element-directory-item:hover {
  border-color: rgba(179, 45, 51, 0.28);
  background: #fbfbff;
}

.element-directory-item.active {
  border-color: rgba(179, 45, 51, 0.52);
  background: var(--blue-soft);
  box-shadow: inset 3px 0 0 var(--blue);
}

.element-directory-item.placeholder {
  color: var(--muted);
  background: #fafafa;
}

.element-directory-item.placeholder em {
  color: var(--faint);
}

.element-directory-empty {
  padding: 22px 12px;
  border: 1px dashed var(--line-2);
  border-radius: 11px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
  text-align: center;
}

.element-detail {
  flex-shrink: 0;
  margin-top: 0;
}

.element-detail article,
.element-detail .empty {
  min-height: 78px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.element-detail p {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
}

.element-detail small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.knowledge-topbar {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  flex-shrink: 0;
}

.kb-path {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.kb-path b {
  color: var(--ink);
  font-size: 14px;
}

.kb-filter-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(240px, 1.2fr) minmax(260px, 1.3fr);
  gap: 10px;
}

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

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

.kb-segment {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow-x: auto;
}

.kb-segment button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.kb-segment button.active {
  color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--blue-soft);
}

.kb-segment em {
  min-width: 22px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  font-style: normal;
}

.kb-segment button.active em {
  color: var(--blue);
  background: var(--blue-soft);
}

.knowledge-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.knowledge-side-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.knowledge-source-summary {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.knowledge-source-summary div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.knowledge-source-summary b {
  font-size: 14px;
}

.knowledge-source-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.knowledge-source-summary p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.internal-entry {
  flex-shrink: 0;
}

.course-kb-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 12px;
}

.course-nav {
  min-height: 0;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.course-nav-ip h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.course-nav-ip div {
  display: grid;
  gap: 8px;
}

.course-nav button {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
  font-weight: 900;
}

.course-nav button.active {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-soft);
}

.course-nav button b {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 11px;
}

.knowledge-element-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.element-column,
.element-group-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.element-column-head,
.element-group-head {
  min-height: 44px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.element-column-head h3,
.element-group-head h3 {
  font-size: 14px;
}

.element-column-head span,
.element-group-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.element-type-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  overflow: auto;
}

.element-type-card,
.element-subtype-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.element-type-card summary,
.element-subtype-card summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 900;
}

.element-subtype-card {
  margin-bottom: 8px;
  background: var(--surface);
}

.element-subtype-card summary {
  min-height: 36px;
  font-size: 12px;
}

.element-type-card em,
.element-subtype-card em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.element-type-body {
  padding: 0 8px 8px;
}

.category-tools {
  display: flex;
  gap: 6px;
  padding: 0 8px 8px;
  opacity: 0.72;
}

.category-tools button,
.mini-action {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 900;
}

.mini-action {
  width: 100%;
  margin-top: 8px;
  color: var(--faint);
  background: var(--surface);
}

.group-add {
  width: calc(100% - 20px);
  margin: auto 10px 10px;
}

.element-column-body {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  overflow: auto;
}

.element-chip {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.element-chip div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.element-chip b {
  font-size: 13px;
  line-height: 1.35;
}

.element-chip span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.element-chip p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.element-empty {
  min-height: 72px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  color: var(--faint);
  background: var(--surface);
  font-size: 12px;
}

.pending-library {
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  overflow: hidden;
  flex-shrink: 0;
}

.pending-library summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pending-library em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.pending-element-list {
  max-height: 240px;
  display: grid;
  gap: 8px;
  padding: 10px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.pending-element-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 42%);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.pending-element-card b {
  font-size: 13px;
}

.pending-element-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.pending-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 72px;
  gap: 6px;
  align-items: center;
}

.pending-actions select,
.pending-actions button {
  min-height: 36px;
}

.kb-fold {
  padding: 0;
  overflow: hidden;
}

.kb-fold summary {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
}

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

.kb-fold summary span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.kb-fold summary b {
  font-size: 15px;
}

.kb-fold summary small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.kb-fold summary em {
  min-width: 48px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.kb-fold[open] summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.kb-fold[open] summary em {
  color: var(--blue);
  background: var(--blue-soft);
}

.kb-fold[open] summary em::before {
  content: "收起";
}

.kb-fold[open] summary em {
  font-size: 0;
}

.kb-fold[open] summary em::before {
  font-size: 12px;
}

.kb-fold > .field-row,
.kb-fold > .ip-library,
.kb-fold > .card-list {
  margin-left: 16px;
  margin-right: 16px;
}

.compact-list {
  max-height: 220px;
  margin-bottom: 16px;
}

.transcript-details {
  margin-top: 10px;
}

.transcript-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 8px;
  color: var(--blue);
  background: rgba(179, 45, 51, 0.045);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  flex-wrap: wrap;
}

.transcript-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.transcript-details summary .copy-btn {
  flex-shrink: 0;
}

.transcript-details pre {
  max-height: 220px;
  overflow: auto;
  margin: 10px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--ink);
  background: var(--surface-2);
  font: inherit;
  font-size: 13px;
  line-height: 1.7;
}

.pending-audit-bulk-actions {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0;
}

.pending-audit-bulk-actions .danger-btn {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(201, 58, 58, 0.26);
  border-radius: 7px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.pending-audit-bulk-actions .danger-btn:hover {
  border-color: var(--red);
}

.pending-audit-bulk-actions .danger-btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

@media (max-width: 640px) {
  .source-material-card .card-top-right,
  .transcript-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
}

.copy-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.material-transcript-modal {
  max-width: min(760px, calc(100vw - 32px));
}

.material-transcript-full {
  max-height: min(62vh, 620px);
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface-2);
  white-space: pre-wrap;
  font: inherit;
  font-size: 14px;
  line-height: 1.8;
}

.mini-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.mini-actions button,
.version-card button {
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 900;
}

.chat-log {
  min-height: 430px;
  max-height: 560px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.chat-msg {
  position: relative;
  max-width: 92%;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.7;
  font-size: 13px;
}

.chat-msg.assistant {
  padding-right: 58px;
}

.chat-collapse-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.chat-collapsed-summary {
  display: grid;
  gap: 4px;
  padding: 4px 0;
}

.chat-collapsed-summary b {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.chat-collapsed-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-msg.user {
  max-width: 86%;
  width: fit-content;
  justify-self: end;
  align-self: flex-end;
  padding: 8px 12px;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.90);
  background: rgba(255, 255, 255, 0.70);
  line-height: 1.55;
}

.chat-msg.pending {
  opacity: 0.78;
}

.chat-msg.pending.assistant {
  position: relative;
  padding-left: 34px;
}

.chat-msg.pending.assistant::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 22px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 12px 0 0 rgba(179, 45, 51, 0.45), 24px 0 0 rgba(179, 45, 51, 0.22);
  animation: typingPulse 1s infinite ease-in-out;
}

@keyframes typingPulse {
  0%, 100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

.chat-msg strong {
  display: none;
}

.chat-source-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  margin: 0 0 10px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.chat-source-meta em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.legacy-summary-notice {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface-2);
  color: #d49516;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.6;
}

.chat-msg p {
  margin: 0 0 10px;
}

.chat-msg p:last-child {
  margin-bottom: 0;
}

.chat-table-wrap {
  width: 100%;
  margin: 10px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.chat-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.55;
}

.chat-table th,
.chat-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-table th:last-child,
.chat-table td:last-child {
  border-right: 0;
}

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

.chat-table th {
  color: var(--ink);
  background: var(--blue-soft);
  font-weight: 900;
  white-space: nowrap;
}

.chat-msg.user .chat-table-wrap {
  color: var(--ink);
}

.chat-review-head,
.chat-review-cell {
  width: 108px;
  min-width: 108px;
}

.chat-review-cell {
  vertical-align: middle;
}

.chat-table .chat-col-index {
  width: 56px;
  text-align: center;
  white-space: nowrap;
}

.chat-table .chat-col-type {
  width: 88px;
}

.chat-table .chat-col-count {
  width: 88px;
  white-space: nowrap;
}

.chat-table .chat-col-original {
  width: 64%;
}

.chat-table .chat-col-project {
  width: auto;
}

.chat-table .chat-col-insight {
  width: 28%;
}

.chat-actions,
.chat-review-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chat-actions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.chat-review-btn {
  min-height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.chat-review-btn.save {
  color: #fff;
  background: var(--blue);
}

.chat-review-btn.discard {
  color: var(--red);
  background: var(--red-soft);
}

.chat-review-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.chat-review-status.saved {
  color: var(--green);
  background: var(--green-soft);
}

.chat-review-status.discarded {
  color: var(--red);
  background: var(--red-soft);
}

.chat-review-status.muted {
  color: var(--muted);
  background: var(--surface-2);
}

.chat-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
  margin-top: 12px;
}

.chat-box textarea {
  min-height: 72px;
}

.hint-box {
  margin-top: 14px;
  padding: 12px;
  border-radius: 10px;
  color: #d49516;
  background: var(--gold-soft);
  font-size: 13px;
  line-height: 1.6;
}

.rewrite-title-line {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 26px;
}

.rewrite-title-line span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding-left: 12px;
  border-left: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.rewrite-mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.rewrite-mode-switch button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.rewrite-mode-switch button.active {
  color: #fff;
  background: var(--blue);
}

.rewrite-builder {
  display: grid;
  gap: 10px;
  min-height: 0;
  margin-bottom: 13px;
  align-content: start;
}

.rewrite-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
}

.rewrite-action-row #makeRewriteBtn {
  width: 100%;
  min-height: 46px;
}

.rewrite-action-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.rewrite-inline-status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.rewrite-inline-status .ghost-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.rewrite-inline-status:empty {
  display: none;
}

.rewrite-source-panel {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.rewrite-source-panel label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.rewrite-source-panel textarea {
  min-height: 122px;
}

.rewrite-course-picker {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.rewrite-course-picker label {
  justify-self: center;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
  text-align: center;
}

.rewrite-course-picker select {
  min-height: 42px;
  border-color: rgba(179, 45, 51, 0.18);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.rewrite-course-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  min-width: 0;
}

.rewrite-course-control .ghost-btn {
  min-width: 64px;
  padding-inline: 14px;
}

.rewrite-course-control .ghost-btn[hidden] {
  display: none;
}

.rewrite-course-profile-status {
  grid-column: 2;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.rewrite-course-profile-status:empty {
  display: none;
}

.rewrite-course-profile-status.running,
.rewrite-course-profile-status.pending {
  color: var(--blue);
}

.rewrite-course-profile-status.ready {
  color: var(--green);
}

.rewrite-course-profile-status.failed {
  color: var(--red);
}

.rewrite-course-profile-status small {
  flex-basis: 100%;
  min-width: 0;
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.rewrite-framework-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 296px;
  overflow: auto;
  padding-right: 2px;
}

.rewrite-framework-card {
  min-height: 92px;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}

.rewrite-framework-card.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

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

.rewrite-framework-card b {
  font-size: 14px;
}

.rewrite-framework-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.rewrite-flow {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.rewrite-flow-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.rewrite-flow-head div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rewrite-flow-head b {
  color: var(--ink);
}

.rewrite-flow-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-height: 50px;
  border-radius: 10px;
}

.rewrite-flow-list.drag-over {
  outline: 2px dashed var(--blue);
  outline-offset: 3px;
}

.rewrite-flow-item {
  min-height: 58px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: grab;
}

.rewrite-flow-item.dragging,
.rewrite-block.dragging {
  opacity: 0.45;
}

.rewrite-flow-item strong {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
}

.rewrite-flow-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.rewrite-flow-item span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.rewrite-flow-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.rewrite-flow-evidence-list {
  display: grid;
  gap: 5px;
  max-height: 132px;
  overflow-y: auto;
}

.rewrite-flow-evidence-list p {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  line-height: 1.45;
}

.rewrite-flow-item select {
  width: 100%;
  min-height: 30px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--ink);
  background-color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.rewrite-flow-item button {
  min-height: 26px;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 900;
}

.rewrite-flow-item button.active {
  color: #fff;
  background: var(--blue);
}

.rewrite-flow-item button:disabled {
  color: var(--faint);
  background: var(--surface-2);
  cursor: default;
}

.rewrite-flow-empty {
  width: 100%;
  padding: 10px;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
}

.rewrite-palette-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.rewrite-palette-head b {
  color: var(--ink);
}

.rewrite-block-palette {
  width: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 8px;
  max-height: none;
  overflow: visible;
  align-content: center;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.46);
  box-sizing: border-box;
}

.rewrite-block {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  text-align: left;
  cursor: grab;
}

.rewrite-block-main {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 2px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.rewrite-block b {
  color: var(--ink);
  font-size: 14px;
}

.fission-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.fission-head div {
  display: grid;
  gap: 4px;
}

.fission-head b {
  color: var(--ink);
  font-size: 14px;
}

.fission-head em {
  font-style: normal;
  white-space: nowrap;
}

.fission-head-actions {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 8px !important;
}

.fission-upload-mini {
  position: relative;
}

.fission-upload-mini summary {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  color: var(--blue);
  background: var(--surface);
  font-size: 13px;
  font-weight: 950;
  list-style: none;
  cursor: pointer;
}

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

.fission-upload-mini[open] {
  z-index: 20;
}

.fission-upload-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 2;
  width: 286px;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(20, 27, 55, 0.14);
}

.fission-upload-mini input {
  display: block;
  width: 100%;
  min-height: 32px;
  font-size: 12px;
}

.fission-upload-mini textarea {
  display: block;
  width: 100%;
  min-height: 106px;
  margin-top: 6px;
  font-size: 12px;
}

.fission-upload-mini button {
  width: 100%;
  min-height: 30px;
  margin-top: 6px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 950;
}

.fission-upload-mini p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.fission-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  min-height: 230px;
}

.fission-column {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.fission-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fission-column-head b {
  color: var(--ink);
  font-size: 13px;
}

.fission-column-head span {
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
  font-weight: 950;
}

.fission-column small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.fission-card-list {
  display: grid;
  align-content: start;
  gap: 6px;
  overflow: visible;
  padding-right: 2px;
}

.fission-select {
  width: 100%;
  min-height: 30px;
  padding: 0 26px 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  color: var(--ink);
  background-color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.fission-card {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 4px;
  min-height: 164px;
  position: relative;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
  overflow: hidden;
}

.fission-card.active {
  border-color: var(--line);
  box-shadow: none;
}

.fission-card-main {
  width: 100%;
  display: grid;
  gap: 4px;
  min-height: 132px;
  padding: 8px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.fission-card b {
  color: var(--blue);
  font-size: 11px;
}

.fission-card p {
  display: -webkit-box;
  min-height: 52px;
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.45;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fission-card span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.fission-delete-btn {
  justify-self: end;
  margin: 0 7px 7px 0;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: 7px;
  color: #b42318;
  background: #fff7f6;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

.fission-delete-btn:hover {
  border-color: rgba(239, 68, 68, 0.42);
  background: #ffeceb;
}

.rewrite-block em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.rewrite-block.active {
  color: var(--ink);
  border-color: var(--blue);
  background: var(--blue-soft);
}

.rewrite-block.active b,
.rewrite-block.active em {
  color: inherit;
}

.rewrite-clear-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.rewrite-result-area {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.duplicate-material-preview {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(179, 45, 51, 0.28);
  border-left: 3px solid var(--blue);
  border-radius: 10px;
  background: rgba(179, 45, 51, 0.05);
}

.duplicate-material-preview-head,
.duplicate-material-preview-actions,
.final-script-section-head,
.final-script-history-head,
.final-script-history-meta,
.final-script-editor-actions,
.version-card-actions,
.final-script-history-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.duplicate-material-preview-head h3 {
  margin: 8px 0 2px;
  font-size: 15px;
}

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

.duplicate-preview-close {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
}

.duplicate-material-preview pre,
.final-script-history-card pre {
  max-height: 280px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: 13px;
  line-height: 1.7;
}

.duplicate-material-preview-actions {
  justify-content: flex-end;
}

.final-script-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  margin-top: 0;
}

.final-script-editor,
.final-script-history {
  min-width: 0;
}

.final-script-section-head,
.final-script-history-head {
  align-items: flex-start;
  margin-bottom: 12px;
}

.final-script-section-head {
  align-items: center;
}

.final-script-section-head h3,
.final-script-history-head h3 {
  margin: 0;
  font-size: 15px;
}

.final-script-history-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.final-script-history-title span {
  margin-top: 0;
}

.final-script-section-head span,
.final-script-history-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.final-script-section-head em {
  color: var(--blue);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.final-script-editor > input,
.final-script-history-head input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.final-script-editor textarea {
  width: 100%;
  height: 140px;
  min-height: 140px;
  margin-top: 0;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  line-height: 1.7;
}

.final-script-editor-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

.final-script-history-head input {
  width: min(230px, 52%);
}

.final-script-history-list {
  display: grid;
  gap: 10px;
  max-height: 430px;
  overflow: auto;
}

.final-script-history-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.final-script-history-meta {
  align-items: flex-start;
}

.final-script-history-meta h4 {
  margin: 0;
  font-size: 13px;
}

.final-script-history-meta span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.final-script-history-actions,
.version-card-actions {
  justify-content: flex-end;
}

.final-script-history-actions {
  flex-shrink: 0;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.final-script-history-actions button {
  min-width: 44px;
  min-height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.final-script-history-actions button:hover {
  color: var(--ink);
  background: var(--surface);
}

.danger-text-btn {
  color: var(--red) !important;
}

.final-script-history-actions .danger-text-btn:hover {
  background: var(--red-soft);
}

.final-script-history-card details {
  margin-top: 10px;
}

.final-script-history-card summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.final-script-history-card details pre {
  margin-top: 8px;
}

.rewrite-versions-bar {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.rewrite-versions-bar:empty {
  display: none;
}

.rewrite-versions-bar b {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
}

.rewrite-versions-bar span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rewrite-versions-bar button {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.version-grid {
  display: grid;
  gap: 12px;
}

.version-grid:has(.version-card:nth-child(2)) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.rewrite-generating-panel {
  min-height: clamp(220px, 34vh, 360px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 24px;
  border: 1px solid rgba(179, 45, 51, 0.18);
  border-radius: 12px;
  background: var(--surface);
  color: var(--blue);
  text-align: center;
}

.rewrite-generating-panel b {
  display: block;
  font-size: 20px;
  font-weight: 900;
}

.rewrite-generating-panel span:not(.status-spinner) {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.version-card pre {
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.version-card-loading {
  min-height: 320px;
}

.rewrite-card-loading-body {
  min-height: 230px;
  display: grid;
  place-items: center;
  color: var(--blue);
}

.rewrite-card-error {
  min-height: 160px;
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 10px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.version-provider {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rewrite-structure {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.rewrite-structure div {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.rewrite-structure b {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.rewrite-structure span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.empty {
  padding: 32px 14px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  text-align: center;
  color: var(--faint);
  background: var(--surface);
  font-size: 13px;
}

.toast {
  position: fixed;
  z-index: 12000;
  right: 18px;
  bottom: 18px;
  max-width: 340px;
  padding: 12px 14px;
  border-radius: 10px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: 0.18s;
  pointer-events: none;
}

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

.mobile-bottom-nav {
  display: none;
}

.mobile-workspace-nav {
  display: none;
}

.ai-chat-mobile-thread-select,
.mobile-rewrite-generate-btn {
  display: none;
}

@media (max-width: 980px) {
  .youshu-body {
    grid-template-columns: 176px minmax(0, 1fr);
  }

  .youshu-content {
    padding: 16px;
  }

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

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

  .chanmama-player-modal {
    grid-template-columns: minmax(280px, 0.8fr) minmax(300px, 1fr);
  }

  .app-shell {
    padding: 18px;
  }

  .hero {
    display: flex;
    flex-wrap: nowrap;
  }

  .brand-lockup {
    flex: 1 1 auto;
    flex-wrap: nowrap;
  }

  .header-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    margin-left: auto;
  }

  .header-stats {
    display: none;
  }

  .auth-actions {
    flex-wrap: wrap;
  }

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

  .step-nav {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
    padding: 6px;
  }

  .step-nav button {
    min-height: 34px;
    padding: 0 4px;
    font-size: 12px;
  }

  .source-grid,
  .chat-grid,
  .knowledge-grid,
  .rewrite-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }

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

  .kb-filter-row,
  .knowledge-main,
  .knowledge-workbench {
    grid-template-columns: 1fr;
  }

  .knowledge-workbench {
    grid-template-rows: minmax(260px, 42%) minmax(0, 1fr);
  }

  .knowledge-side-panel {
    max-height: 340px;
  }

  .knowledge-tree-panel {
    max-height: none;
    order: 2;
  }

  .element-cloud-panel {
    order: 1;
  }

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

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

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

  .account-breakdown {
    grid-template-columns: 1fr;
  }

  .account-editor-grid,
  .account-toolbar {
    grid-template-columns: 1fr;
  }

  .pending-element-card {
    grid-template-columns: 1fr;
  }
}

/* 2026-08-12: compact grouped top navigation and avatar account menu. */
.hero {
  min-height: 58px;
  align-items: center;
  gap: 22px;
  margin-bottom: 14px;
}

.brand-lockup {
  flex: 0 1 auto;
}

.hero .step-nav {
  z-index: 310;
  display: flex;
  flex: 1 1 auto;
  align-items: stretch;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.hero .step-nav > button,
.hero .step-nav .grouped-nav-main {
  position: relative;
  display: inline-flex;
  width: auto;
  min-width: 76px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border: 0;
  border-radius: 9px;
  color: #505a67;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.hero .step-nav > button[hidden],
.hero .step-nav .grouped-nav-menu button[hidden] {
  display: none;
}

.hero .step-nav > button:hover,
.hero .step-nav .grouped-nav-main:hover,
.hero .step-nav .grouped-nav-main[aria-expanded="true"] {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.48);
}

.hero .step-nav > button.active,
.hero .step-nav .grouped-nav-main.active {
  color: var(--blue);
  background: transparent;
  box-shadow: none;
}

.hero .step-nav > button.active::after,
.hero .step-nav .grouped-nav-main.active::after {
  position: absolute;
  right: 16px;
  bottom: 1px;
  left: 16px;
  width: auto;
  height: 3px;
  border-radius: 999px;
  background: var(--blue);
  content: '';
  transform: none;
}

.grouped-nav-item {
  position: relative;
  flex: 0 0 auto;
}

.grouped-nav-caret {
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.grouped-nav-main[aria-expanded="true"] .grouped-nav-caret {
  margin-top: 3px;
  transform: rotate(-135deg);
}

.grouped-nav-menu {
  position: absolute;
  z-index: 330;
  top: calc(100% + 8px);
  left: 50%;
  display: grid;
  width: 190px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 44px rgba(44, 61, 82, 0.17);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.grouped-nav-menu[hidden] {
  display: none;
}

.hero .step-nav .grouped-nav-menu button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  width: 100%;
  min-height: 48px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.hero .step-nav .grouped-nav-menu button span {
  align-self: end;
  font-size: 13px;
  font-weight: 800;
}

.hero .step-nav .grouped-nav-menu button small {
  grid-column: 1;
  color: var(--muted);
  font-size: 10px;
}

.hero .step-nav .grouped-nav-menu button::after {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  color: var(--blue);
  content: '›';
  font-size: 18px;
  opacity: 0;
}

.hero .step-nav .grouped-nav-menu button:hover,
.hero .step-nav .grouped-nav-menu button.active {
  color: var(--blue);
  background: var(--blue-soft);
}

.hero .step-nav .grouped-nav-menu button.active::after {
  opacity: 1;
}

.hero .step-nav .grouped-nav-menu button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.header-actions {
  flex: 0 0 auto;
}

.user-name-btn {
  min-height: 44px;
  padding: 3px 9px 3px 4px;
  border-color: rgba(129, 185, 198, 0.28);
  border-radius: 999px;
  color: #173a40;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 5px 16px rgba(72, 89, 108, 0.055);
}

.account-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  object-fit: cover;
}

.account-button-copy {
  display: grid;
  min-width: 48px;
  text-align: left;
}

.account-button-copy b {
  max-width: 92px;
  overflow: hidden;
  color: #173a40;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-button-copy small {
  margin-top: 2px;
  color: #82a0a4;
  font-size: 8px;
}

.header-version-switch {
  margin-left: -2px;
  min-width: 48px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(117, 130, 145, 0.28);
  border-radius: 999px;
  color: #687481;
  background: rgba(255, 255, 255, 0.54);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.header-version-switch:hover {
  color: var(--blue);
  border-color: rgba(179, 45, 51, 0.28);
  background: rgba(255, 255, 255, 0.86);
}

.header-version-switch[hidden] {
  display: none;
}

#addSourcePersonalBtn[hidden] {
  display: none;
}

.legacy-step-nav {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: -2px 0 12px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 8px 24px rgba(43, 58, 75, 0.055);
}

.legacy-step-nav[hidden] {
  display: none;
}

.legacy-step-nav button {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  color: #626d79;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.legacy-step-nav button:hover,
.legacy-step-nav button.active {
  color: var(--blue);
  background: rgba(255, 255, 255, 0.82);
}

.legacy-step-nav .legacy-return-btn {
  margin-left: auto;
  border: 1px solid rgba(179, 45, 51, 0.2);
}

body.legacy-navigation-mode .hero .step-nav {
  display: none;
}

body.legacy-navigation-mode #stepNav[hidden] {
  display: none;
}

.account-menu {
  top: calc(100% + 10px);
  width: 208px;
  padding: 12px;
  border-color: rgba(169, 199, 205, 0.5);
  border-radius: 14px;
}

.account-menu-profile {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  column-gap: 10px;
  padding: 3px 5px 12px;
}

.account-profile-avatar {
  grid-row: 1 / 3;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.account-menu-profile strong,
.account-menu-profile small {
  align-self: end;
}

.account-menu-profile small {
  align-self: start;
  margin-top: 2px;
}

#sourcePersonalRow .ip-combo {
  grid-template-columns: minmax(0, 1fr) auto;
}

#sourcePersonalRow #personalLibrarySelect {
  display: block !important;
  width: 100%;
  min-width: 0;
}

#sourcePersonalRow #addSourcePersonalBtn,
#sourceBenchmarkRow #addSourceBenchmarkBtn {
  width: auto;
  min-width: 160px;
}

@media (max-width: 980px) {
  .hero {
    gap: 10px;
  }

  .brand-subtitle {
    display: none;
  }

  .hero .step-nav > button,
  .hero .step-nav .grouped-nav-main {
    min-width: 64px;
    padding-inline: 10px;
    font-size: 13px;
  }

  .account-button-copy {
    display: none;
  }

  .user-name-btn {
    padding-right: 7px;
  }
}

@media (max-width: 680px) {
  body {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }

  .hero {
    min-height: 0;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 9px;
  }

  .brand-lockup {
    flex: 1 1 auto;
  }

  .hero .step-nav,
  .hero .step-nav[hidden] {
    display: none;
  }

  .hero .header-version-switch {
    display: none;
  }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 700;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: calc(62px + env(safe-area-inset-bottom));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(195, 204, 214, 0.78);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -8px 24px rgba(38, 49, 65, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .mobile-bottom-nav button {
    position: relative;
    min-height: 48px;
    padding: 0 4px;
    border: 0;
    border-radius: 9px;
    color: #697482;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
  }

  .mobile-bottom-nav button.active {
    color: var(--blue);
    background: rgba(179, 45, 51, 0.07);
  }

  .mobile-bottom-nav button.active::after {
    position: absolute;
    top: 4px;
    right: 50%;
    width: 18px;
    height: 3px;
    border-radius: 999px;
    background: var(--blue);
    content: '';
    transform: translateX(50%);
  }

  .mobile-bottom-nav button:focus,
  .mobile-bottom-nav button:focus-visible,
  .mobile-workspace-nav button:focus,
  .mobile-workspace-nav button:focus-visible {
    outline: 0;
    box-shadow: none;
  }

  .mobile-workspace-nav {
    position: sticky;
    z-index: 30;
    top: 0;
    display: block;
    margin: 0 10px 12px;
    padding: 7px 0 0;
    border-radius: 0 0 18px 18px;
    background: transparent;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .mobile-workspace-nav[hidden] {
    display: none;
  }

  .mobile-workspace-nav > div {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    padding: 5px;
    border: 1px solid rgba(211, 219, 228, 0.9);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 7px 18px rgba(38, 49, 65, 0.07);
    overflow: hidden;
  }

  .mobile-workspace-nav > div[hidden] {
    display: none;
  }

  .mobile-workspace-nav button {
    min-height: 38px;
    padding: 6px 3px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #44505f;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
  }

  .mobile-workspace-nav button.active {
    color: var(--blue);
    border-color: rgba(179, 45, 51, 0.28);
    background: rgba(179, 45, 51, 0.07);
  }

  .mobile-workspace-nav button:disabled {
    color: #a7b0bb;
    background: #f4f6f8;
  }

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

  .account-breakdown {
    grid-template-columns: 1fr;
  }

  .account-editor-grid,
  .account-toolbar {
    grid-template-columns: 1fr;
  }

  #chanmamaTaskStatus,
  #miaosiTaskStatus {
    display: none !important;
  }

  .chanmama-analysis-badge,
  .chanmama-author,
  .chanmama-primary-metrics {
    display: none !important;
  }

  .chanmama-card-body {
    padding: 10px;
  }

  .chanmama-card-body h3 {
    min-height: 38px;
    margin-bottom: 8px;
    font-size: 12px;
  }

  .chanmama-title-toggle {
    display: inline-flex;
    margin: -4px 0 7px;
    padding: 0;
    border: 0;
    color: var(--accent);
    background: transparent;
    font-size: 11px;
    font-weight: 750;
  }

  .chanmama-grid-card:not(.title-expanded) .chanmama-card-body h3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .chanmama-grid-card.title-expanded .chanmama-card-body h3 {
    display: block;
    max-height: none;
    overflow: visible;
  }

  .chanmama-card-save {
    margin-top: 0;
  }

  section[data-stage="ai-chat"] .ai-chat-workspace {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
  }

  section[data-stage="ai-chat"] .ai-chat-sidebar {
    display: none !important;
  }

  section[data-stage="ai-chat"] .ai-chat-main {
    grid-row: 1;
  }

  section[data-stage="ai-chat"] .ai-chat-main-head {
    display: flex !important;
    min-height: 54px;
    padding: 8px 12px;
  }

  section[data-stage="ai-chat"] #aiChatTitleHost {
    display: block;
  }

  .ai-chat-mobile-thread-select {
    display: none !important;
  }

  .rewrite-builder[data-mode="elements"] {
    display: flex;
    flex-direction: column;
  }

  .rewrite-builder[data-mode="elements"] .rewrite-block-palette {
    order: 1;
  }

  .rewrite-builder[data-mode="elements"] .rewrite-flow {
    order: 3;
  }

  section[data-stage="cloud-video"] .panel-head {
    position: relative;
    display: block;
    min-height: 34px;
    padding-right: 34px;
  }

  section[data-stage="cloud-video"] .panel-head h2 {
    overflow: hidden;
    font-size: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  section[data-stage="cloud-video"] .cloud-video-head-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: block;
    width: 28px;
  }

  section[data-stage="cloud-video"] #cloudVideoList > .empty {
    display: none;
  }

  .grouped-nav-menu {
    position: fixed;
    top: 108px;
    right: 12px;
    left: 12px;
    width: auto;
    transform: none;
  }

  #sourcePersonalRow .ip-combo,
  #sourceBenchmarkRow .ip-combo {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #sourcePersonalRow #addSourcePersonalBtn,
  #sourceBenchmarkRow #addSourceBenchmarkBtn {
    min-width: 112px;
    padding-inline: 10px;
  }
}

@media (max-width: 720px) {
  .cloud-video-summary-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .cloud-video-summary-table,
  .cloud-video-summary-table thead,
  .cloud-video-summary-table tbody,
  .cloud-video-summary-table tr,
  .cloud-video-summary-table th,
  .cloud-video-summary-table td {
    display: block;
    width: auto;
    min-width: 0;
  }

  .cloud-video-summary-table thead {
    display: none;
  }

  .cloud-video-summary-table tbody {
    display: grid;
    gap: 10px;
  }

  .cloud-video-summary-table tbody tr {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(38, 49, 65, 0.05);
  }

  .cloud-video-summary-table tbody td {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 7px 0;
    border: 0;
    text-align: left !important;
  }

  .cloud-video-summary-table tbody td::before {
    content: attr(data-mobile-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
  }

  .cloud-video-summary-material-open,
  .cloud-video-summary-id-details,
  .cloud-video-summary-editable {
    width: 100%;
    min-width: 0;
  }

  .cloud-video-summary-material-open {
    justify-items: start;
    text-align: left;
  }

  .cloud-video-summary-material-open strong,
  .cloud-video-summary-official-reason,
  .cloud-video-summary-editable,
  .cloud-video-summary-id-details > summary {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .cloud-video-summary-material-actions {
    justify-content: flex-start;
  }

  .cloud-video-summary-material-ids {
    width: auto;
    max-width: 100%;
    margin-left: 0;
  }

  .cloud-video-summary-creative-panel {
    width: auto;
  }

  .cloud-video-reason-filter {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 12px;
  }

  .hero {
    gap: 8px;
    margin-bottom: 8px;
  }

  h1 {
    font-size: 24px;
    line-height: 1.15;
  }

  .brand-lockup {
    gap: 4px 10px;
  }

  .brand-logo {
    height: 34px;
  }

  .brand-subtitle {
    width: 100%;
    min-height: 0;
    padding-left: 0;
    border-left: 0;
    font-size: 12px;
    white-space: normal;
  }

  .header-actions {
    gap: 6px;
  }

  .header-stats {
    min-height: 34px;
    padding: 0 9px;
    font-size: 11px;
  }

  .header-actions .ghost-btn {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  .step-nav {
    margin-bottom: 8px;
    padding: 6px;
  }

  .step-nav button {
    min-height: 32px;
    font-size: 11px;
  }

  .knowledge-searchbar {
    grid-template-columns: 1fr;
  }

  .knowledge-coursebar {
    grid-template-columns: 1fr;
  }

  .knowledge-elements-panel {
    padding: 12px;
  }

  .element-directory-list {
    grid-template-columns: 1fr;
  }

  .workbench-pane-head {
    min-height: 42px;
  }

  .workbench-pane-head span {
    display: none;
  }

  .knowledge-element-grid {
    grid-template-columns: 1fr;
  }

  .cloud-scope-bar {
    display: grid;
    gap: 6px;
  }

  .cloud-scope-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .cloud-element-search {
    width: min(100%, 280px);
  }

  .element-cloud {
    min-height: 320px;
  }

  .knowledge-topbar {
    padding: 8px;
  }

  .kb-path {
    flex-wrap: wrap;
  }

  .kb-segment {
    min-height: 38px;
  }

  .kb-segment button {
    min-height: 30px;
    padding: 0 10px;
    font-size: 12px;
  }

  .pending-actions {
    grid-template-columns: 1fr;
  }

  .kb-fold summary {
    align-items: flex-start;
  }
}

/* === 固定视口：页面不误导滚动，内部列表/对话滚动 === */
body {
  height: 100vh;
  overflow: hidden;
}

.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hero,
.step-nav {
  flex-shrink: 0;
}

main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.stage.active {
  height: 100%;
  overflow: hidden;
}

.stage-grid {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.stage-grid .panel {
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

/* Accounts is a long-form management page, so it must remain scrollable on
   desktop as well as mobile. Keep the other workspaces viewport-bounded. */
section[data-stage="accounts"].active {
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 24px;
}

section[data-stage="accounts"] .accounts-grid {
  height: auto;
  min-height: 100%;
  overflow: visible;
}

section[data-stage="accounts"] .accounts-panel {
  max-height: none;
  overflow: visible;
}

section[data-stage="rewrite"] .panel {
  overflow-y: auto;
}

section[data-stage="rewrite"] .rewrite-grid {
  grid-template-columns: 1fr;
}

section[data-stage="rewrite"] .rewrite-panel {
  display: block;
}

section[data-stage="rewrite"] .rewrite-framework-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

section[data-stage="rewrite"] .version-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-list {
  flex: 1;
  min-height: 0;
}

section[data-stage="source"] .source-grid {
  grid-template-columns: minmax(0, 1fr);
}

section[data-stage="source"] .source-grid > .panel {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

section[data-stage="source"] .source-library-section {
  flex: 0 0 auto;
  min-width: 0;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

section[data-stage="source"] .source-library-section .pipeline-status {
  margin-bottom: 10px;
}

section[data-stage="source"] .source-library-section .source-queue-head {
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

section[data-stage="chanmama"] .source-grid > .panel:last-child {
  display: flex;
  flex-direction: column;
}

section[data-stage="source"] #sourceQueue {
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
  align-content: start;
  grid-auto-rows: max-content;
  overflow: visible;
  padding-right: 0;
}

section[data-stage="chanmama"] #chanmamaDataList {
  flex: 1;
  min-height: 0;
  max-height: none;
  align-content: start;
  grid-auto-rows: max-content;
  overflow: auto;
}

section[data-stage="elements"].active .stage-grid {
  display: block;
}

section[data-stage="elements"].active .panel {
  height: 100%;
  padding: 14px;
  display: flex;
  flex-direction: column;
  border-color: rgba(255, 255, 255, 0.90);
}

section[data-stage="elements"] .panel-head {
  align-items: flex-start;
  margin-bottom: 8px;
  flex-shrink: 0;
}

section[data-stage="elements"] .panel-head h2 {
  font-size: 18px;
}

section[data-stage="elements"] .panel-head p {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
}

section[data-stage="elements"] .scope-picker {
  display: none;
}

section[data-stage="elements"] .scope-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  flex-shrink: 0;
  align-items: center;
  justify-content: flex-end;
}

section[data-stage="elements"] .scope-box div,
section[data-stage="elements"] .scope-box p {
  min-height: 38px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}

section[data-stage="elements"] .scope-source-row {
  min-height: 38px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

section[data-stage="elements"] .scope-source-row .kb-source-switch {
  min-height: 38px;
}

section[data-stage="elements"] .scope-select-card {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: min(420px, 42vw);
  max-width: 100%;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f2f5f8;
  box-shadow: inset 0 0 0 1px rgba(179, 45, 51, 0.04);
}

section[data-stage="elements"] .scope-unified-card {
  width: min(520px, 52vw);
}

section[data-stage="elements"] .scope-unified-card .scope-personal-filter {
  flex: 0 0 108px;
  min-width: 96px;
}

section[data-stage="elements"] .scope-unified-card #scopeTargetSelect {
  flex: 1 1 300px;
  min-width: 260px;
}

.analysis-scope-mode {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.analysis-scope-mode button {
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.analysis-scope-mode button.active {
  color: #fff;
  background: var(--blue);
}

section[data-stage="elements"] .scope-select-card select {
  flex: 1;
  min-width: 220px;
  height: 30px;
  padding: 0 30px 0 10px;
  border: 1px solid rgba(179, 45, 51, 0.28);
  border-radius: 8px;
  color: var(--ink);
  background-color: #fff;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 12px, calc(100% - 11px) 12px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  appearance: none;
  font-size: 13px;
  font-weight: 900;
}

section[data-stage="elements"] .scope-box b {
  min-width: 48px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

section[data-stage="elements"] .scope-box span,
section[data-stage="elements"] .scope-box p {
  font-size: 12px;
  line-height: 1.2;
}

section[data-stage="elements"] .scope-box p {
  justify-content: center;
  padding: 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

section[data-stage="elements"] .chat-log {
  flex: 1;
  min-height: 430px;
  max-height: none;
  margin: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-content: normal;
}

section[data-stage="elements"] .chat-box {
  margin-top: 10px;
  flex-shrink: 0;
  grid-template-columns: minmax(0, 1fr) 88px;
  align-items: end;
}

section[data-stage="elements"] .chat-box textarea {
  height: auto;
  min-height: 58px;
  max-height: min(320px, 42vh);
  resize: none;
  overflow-y: hidden;
}

@media (min-width: 981px) {
  section[data-stage="elements"] .chat-box {
    grid-template-columns: minmax(0, 1fr) 76px;
    gap: 8px;
    margin-top: 8px;
  }

  section[data-stage="elements"] .chat-box textarea {
    min-height: 58px;
    max-height: min(320px, 42vh);
    padding: 8px 10px;
    line-height: 1.45;
  }

  section[data-stage="elements"] .chat-box .primary-btn {
    min-height: 46px;
    padding: 0 12px;
  }
}

@media (max-width: 980px) {
  section[data-stage="elements"] .panel-head {
    flex-wrap: wrap;
  }

  section[data-stage="elements"] .panel-head p {
    display: none;
  }

  section[data-stage="elements"] .scope-box {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  section[data-stage="elements"] .scope-box p {
    display: block;
  }
}

@media (max-width: 560px) {
  section[data-stage="elements"].active .panel {
    padding: 10px;
    border-radius: 12px;
  }

  section[data-stage="elements"] .panel-head {
    margin-bottom: 6px;
  }

  section[data-stage="elements"] .panel-head h2 {
    font-size: 16px;
  }

  section[data-stage="elements"] .scope-box {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
  }

  section[data-stage="elements"] .scope-box div,
  section[data-stage="elements"] .scope-box p {
    min-height: 34px;
    padding: 0 8px;
  }

  section[data-stage="elements"] .scope-select-card {
    width: min(420px, 100%);
    padding: 4px 6px 4px 10px;
  }

  section[data-stage="elements"] .scope-unified-card {
    width: min(520px, 100%);
  }

  section[data-stage="elements"] .scope-unified-card {
    gap: 5px;
  }

  section[data-stage="elements"] .scope-unified-card .scope-personal-filter {
    flex-basis: 100px;
    min-width: 92px;
  }

  section[data-stage="elements"] .scope-unified-card #scopeTargetSelect {
    flex-basis: 220px;
    min-width: 200px;
  }

  section[data-stage="elements"] .scope-select-card select {
    height: 30px;
    font-size: 12px;
  }

  section[data-stage="elements"] .scope-box p {
    justify-content: center;
    text-align: center;
  }

  section[data-stage="elements"] .scope-box b {
    min-width: 48px;
    font-size: 12px;
    white-space: nowrap;
  }

  section[data-stage="elements"] .scope-box span,
  section[data-stage="elements"] .scope-box p {
    font-size: 11px;
  }

  section[data-stage="elements"] .chat-msg {
    max-width: 95%;
    padding: 10px;
    font-size: 12px;
  }

  section[data-stage="elements"] .chat-msg.user {
    max-width: 84%;
    width: fit-content;
    align-self: flex-end;
    padding: 8px 10px;
  }

  section[data-stage="elements"] .chat-box {
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 8px;
  }

  section[data-stage="elements"] .chat-box textarea {
    min-height: 58px;
    max-height: min(320px, 42vh);
    padding: 9px;
    font-size: 13px;
    line-height: 1.45;
  }

  section[data-stage="elements"] .chat-box .primary-btn {
    min-height: 52px;
    padding: 0 10px;
  }
}
.material-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.material-title-row b {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.delete-material-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  color: var(--faint);
  background: transparent;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.delete-material-btn:hover {
  color: var(--red);
  background: var(--red-soft);
}

.card-top-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.scope-source-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

section[data-stage="elements"] #elementScope .scope-source-row {
  padding: 0;
}

.scope-stats {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.scope-stats div {
  min-height: 34px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.scope-stats b {
  font-size: 15px;
  line-height: 1;
}

.scope-stats span {
  font-size: 11px;
  color: var(--muted);
}

.owner-cell {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.owner-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
}

.owner-status.pending {
  color: var(--faint);
}

.owner-status.saved {
  color: var(--green);
}

.owner-actions {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.hit-table .pending-row .owner-actions {
  display: grid;
  grid-template-columns: 1fr;
  width: 44px;
  gap: 5px;
}

.owner-action-btn {
  min-height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.hit-table .pending-row .owner-action-btn {
  width: 100%;
  padding: 0 6px;
}

.owner-action-btn.save-btn {
  color: #fff;
  background: var(--green);
}

.owner-action-btn.discard-btn {
  color: var(--muted);
  background: var(--surface-2);
}

.owner-action-btn.remove-btn {
  color: var(--muted);
  background: var(--surface-2);
}

.source-target-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.source-target-section > summary {
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 42px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
  background: var(--surface-2);
}

.source-target-section > summary::-webkit-details-marker {
  display: none;
}

.source-target-section > summary strong {
  font-size: 13px;
  color: var(--ink);
}

.source-target-section > summary span,
.source-target-section > summary em {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  font-style: normal;
  white-space: nowrap;
}

.source-target-section:not([open]) > summary em {
  font-size: 0;
}

.source-target-section:not([open]) > summary em::after {
  content: "展开";
  font-size: 11px;
}

.source-target-section-items {
  display: grid;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--line);
}

.ip-material-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.76);
  overflow: hidden;
}

.ip-material-group summary {
  min-height: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px auto;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
}

.ip-material-group summary::-webkit-details-marker {
  display: none;
}

.ip-material-group summary strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: #17202b;
}

.ip-material-group summary .ip-material-count {
  color: #17202b;
  font-size: 11px;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.ip-material-actions {
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.ip-material-group[open] .ip-material-actions {
  display: inline-flex;
}

.ip-material-actions button {
  display: grid;
  width: 26px;
  height: 26px;
  min-height: 26px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.ip-material-actions button svg {
  width: 15px;
  height: 15px;
}

.ip-material-actions button:hover {
  color: var(--blue);
  background: var(--blue-soft);
}

.ip-material-actions button.danger:hover {
  color: var(--red);
  background: var(--red-soft);
}

.ip-material-items {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.material-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin-top: 4px;
}

.material-status-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.material-collected-time,
.material-status-processing {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.material-status-failed {
  color: var(--red);
  font-weight: 900;
}

.material-view-btn {
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(179, 45, 51, 0.22);
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.material-view-btn:hover {
  border-color: rgba(179, 45, 51, 0.42);
  background: rgba(179, 45, 51, 0.15);
}
.ip-combo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.ip-combo select,
.ip-combo input,
.ip-combo button {
  width: auto;
}

.personal-library-auto-label {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface-2);
  font-weight: 800;
}

.ip-combo .add-course-btn {
  min-width: 160px;
}

.personal-library-auto-label[hidden] {
  display: none;
}

@media (min-width: 681px) {
  .ip-combo {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .ip-combo .add-course-btn {
    width: auto;
  }
}

.compact-detail {
  flex-wrap: wrap;
  align-items: center;
}

.compact-detail small {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.source-expand pre mark {
  background: var(--red-soft);
  color: var(--red);
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 900;
}

.status-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 5px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.source-queue-guide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 136px;
  align-items: center;
  gap: 14px;
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.source-queue-guide > div {
  justify-self: center;
}

.source-queue-guide.processing {
  min-height: clamp(220px, 46vh, 430px);
  grid-template-columns: 1fr;
  place-items: center;
  align-content: center;
  gap: 14px;
  border: 1px solid rgba(179, 45, 51, 0.18);
  background: var(--surface);
  color: var(--blue);
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(179, 45, 51, 0.04);
}

.source-queue-guide.ready {
  background: var(--blue-soft);
  color: var(--blue);
}

.source-queue-guide.failed {
  background: var(--red-soft);
  color: var(--red);
}

.source-queue-notice {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.source-queue-notice > div {
  width: min(100%, 760px);
}

.source-duplicate-notice-detail {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid currentColor;
  color: var(--ink);
}

.source-duplicate-notice-detail > summary {
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
}

.source-duplicate-notice-detail p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.source-duplicate-notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.source-duplicate-notice-actions button {
  min-height: 30px;
  padding: 0 12px;
}

.source-queue-guide b {
  display: block;
  font-size: 13px;
  font-weight: 900;
}

.source-queue-guide.processing b {
  font-size: 20px;
}

.source-queue-guide span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.8;
}

.source-queue-guide.processing span {
  font-size: 14px;
  color: var(--muted);
  opacity: 1;
}

.source-queue-spinner {
  width: 58px;
  height: 58px;
  margin: 0;
  border-width: 5px;
}

.source-queue-guide button {
  justify-self: start;
  margin-right: 0;
  min-height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.source-upload-status.uploading {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(179, 45, 51, 0.22);
  border-radius: 12px;
  background: var(--surface);
}

.source-upload-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.source-upload-status-head b,
.source-upload-status-head span {
  display: block;
}

.source-upload-status-head b {
  color: var(--ink);
  font-size: 15px;
}

.source-upload-status-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.source-upload-status-head strong {
  flex-shrink: 0;
  color: var(--blue);
  font-size: 18px;
}

.source-upload-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-2);
}

.source-upload-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 120ms linear;
}

.chat-auto-pending {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--blue-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.chat-auto-pending span {
  color: var(--blue);
  font-weight: 900;
}

.chat-auto-pending button {
  min-height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.source-expand .details-toggle-open { display: none !important; }
.source-expand[open] .details-toggle-open { display: inline !important; }
.source-expand[open] .details-toggle-closed { display: none !important; }

.knowledge-tree-panel { overflow-y: auto; overflow-x: hidden; }

.element-detail article, .element-detail .empty { min-height: auto; padding: 8px 10px; }
.element-detail p { margin: 0; font-size: 12px; }
.element-detail small { margin-top: 4px; }

/* Keep the AI analysis workspace bounded on narrow screens. */
@media (max-width: 980px) {
  section[data-stage="elements"].active .panel {
    height: calc(100dvh - 118px);
    min-height: 560px;
    max-height: 760px;
    overflow: hidden;
  }

  section[data-stage="elements"] .chat-log {
    flex: 1 1 auto;
    min-height: 430px;
    overflow-y: auto;
  }
}

@media (max-width: 980px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  main,
  .stage.active,
  .stage-grid,
  .stage-grid .panel {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  section[data-stage="rewrite"] .rewrite-framework-grid,
  section[data-stage="rewrite"] .version-grid {
    grid-template-columns: 1fr;
  }

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

  .rewrite-flow-list {
    grid-template-columns: 1fr;
  }

  .fission-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .source-queue-guide {
    align-items: flex-start;
    flex-direction: column;
  }

  .source-queue-guide button,
  .source-queue-toggle {
    margin-right: 0;
  }

}

/* Mobile workspace: desktop rules remain unchanged above 720px. */
@media (max-width: 720px) {
  .chanmama-browser {
    padding: 4px 0 16px;
  }

  .chanmama-page-head {
    align-items: flex-start;
  }

  .chanmama-page-head p {
    display: none;
  }

  .chanmama-collector-panel {
    grid-template-columns: 1fr;
  }

  .chanmama-task-strip {
    flex-wrap: wrap;
  }

  .chanmama-task-strip progress {
    flex-basis: 100%;
  }

  .chanmama-data-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .chanmama-card-body {
    padding: 9px;
  }

  .chanmama-card-body h3 {
    min-height: 38px;
    font-size: 12px;
  }

  .chanmama-primary-metrics {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .chanmama-player-overlay {
    padding: 10px;
  }

  .chanmama-player-modal {
    display: block;
    height: auto;
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
  }

  .chanmama-player-media {
    min-height: 0;
  }

  .chanmama-player-media video {
    height: 52vh;
  }

  .chanmama-player-detail {
    padding: 18px 14px;
  }

  .chanmama-player-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html,
  body {
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.auth-required {
    height: 100dvh;
    overflow: hidden;
  }

  .app-shell {
    width: 100%;
    height: auto;
    min-height: 100dvh;
    padding: 10px;
    overflow: visible;
  }

  .hero {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 8px;
  }

  .brand-lockup {
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
  }

  .brand-logo {
    max-width: 188px;
    height: 34px;
  }

  .brand-subtitle,
  .header-stats {
    display: none !important;
  }

  .header-actions {
    flex: 0 0 auto;
    margin-left: auto;
  }

  .header-actions .ghost-btn {
    min-height: 34px;
    max-width: 92px;
    padding: 0 10px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .step-nav {
    position: sticky;
    top: 0;
    z-index: 30;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 8px;
    padding: 4px;
    border-radius: 10px;
  }

  .step-nav button {
    min-width: 0;
    min-height: 38px;
    padding: 3px 2px;
    border-radius: 8px;
    font-size: 11px;
    line-height: 1.2;
    white-space: normal;
  }

  main,
  .stage.active,
  .stage-grid {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  main {
    flex: none;
    width: 100%;
  }

  .stage-grid {
    gap: 10px;
  }

  .stage-grid .panel,
  section[data-stage="source"] .panel,
  section[data-stage="knowledge"] .panel,
  section[data-stage="rewrite"] .panel,
  section[data-stage="review"] .panel {
    width: 100%;
    min-width: 0;
    max-height: none;
    padding: 12px;
    border-radius: 12px;
    overflow: visible;
  }

  .panel-head {
    gap: 8px;
    margin-bottom: 12px;
  }

  .panel-head h2 {
    font-size: 17px;
  }

  .panel-head p,
  .panel > p {
    font-size: 12px;
    line-height: 1.5;
  }

  input,
  select,
  .primary-btn,
  .ghost-btn {
    min-height: 42px;
  }

  .ip-combo,
  .file-picker,
  .rewrite-course-picker {
    grid-template-columns: 1fr;
  }

  .rewrite-course-profile-status {
    grid-column: 1;
  }

  .rewrite-course-control {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .ip-combo button {
    width: 100%;
  }

  .file-picker-btn {
    width: 100%;
  }

  .file-picker span {
    padding: 0 8px 5px;
    text-align: center;
  }

  .source-method-switch button,
  .source-mode-switch button,
  .rewrite-mode-switch button {
    min-width: 0;
    min-height: 38px;
    padding: 4px;
    font-size: 12px;
    line-height: 1.25;
  }

  .pipeline-status {
    gap: 6px;
  }

  .pipeline-status div {
    min-height: 48px;
    padding: 8px;
  }

  .pipeline-status b {
    font-size: 17px;
  }

  .source-queue-head,
  .source-queue-guide {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .source-queue-head > div,
  .source-queue-guide > div {
    justify-self: start;
  }

  .source-queue-head b {
    font-size: 16px;
  }

  .source-queue-toggle,
  .source-queue-guide button {
    min-height: 36px;
    padding: 0 14px;
    font-size: 13px;
  }

  section[data-stage="source"] #sourceQueue {
    flex: none;
    max-height: none;
    overflow: visible;
  }

  .card-top {
    flex-wrap: wrap;
  }

  .material-status-actions {
    flex-wrap: wrap;
  }

  section[data-stage="elements"].active .stage-grid {
    display: block;
  }

  section[data-stage="elements"].active .panel {
    height: calc(100dvh - 118px);
    min-height: 560px;
    max-height: 760px;
    padding: 10px;
    overflow: hidden;
  }

  section[data-stage="elements"] .panel-head {
    display: block;
  }

  section[data-stage="elements"] .scope-box {
    width: 100%;
    justify-content: flex-start;
  }

  section[data-stage="elements"] .scope-select-card {
    width: 100%;
  }

  section[data-stage="elements"] .scope-select-card select {
    min-width: 0;
  }

  section[data-stage="elements"] .chat-log {
    min-height: 0;
    overscroll-behavior: contain;
  }

  section[data-stage="elements"] .chat-msg {
    max-width: 100%;
  }

  section[data-stage="elements"] .chat-box {
    grid-template-columns: minmax(0, 1fr) 64px;
    gap: 6px;
  }

  section[data-stage="elements"] .chat-box .primary-btn {
    min-width: 64px;
    padding: 0 8px;
  }

  .chat-table-wrap,
  .hit-table {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chat-table,
  .hit-table table {
    min-width: 680px;
  }

  .knowledge-layout,
  .knowledge-elements-panel {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .knowledge-elements-panel {
    display: block;
  }

  .knowledge-searchbar,
  .knowledge-coursebar {
    grid-template-columns: 1fr;
  }

  .knowledge-searchbar span {
    width: 100%;
    min-width: 0;
    justify-self: stretch;
  }

  .knowledge-workbench {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible;
  }

  .element-cloud-panel {
    order: 1;
    min-height: 0;
    padding: 8px;
    overflow: visible;
  }

  .knowledge-tree-panel {
    order: 2;
    max-height: 58dvh;
    overflow-y: auto;
  }

  .element-cloud {
    height: 58dvh;
    min-height: 380px;
    max-height: 560px;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .cloud-scope-bar {
    display: grid;
    gap: 8px;
  }

  .cloud-scope-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    justify-content: stretch;
    gap: 6px;
  }

  .cloud-element-search {
    width: 100%;
    min-width: 0;
  }

  .cloud-scope-actions .ghost-btn {
    min-height: 32px;
    padding: 0 9px;
  }

  .element-directory-list,
  .knowledge-element-grid {
    grid-template-columns: 1fr;
  }

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

  .knowledge-next-step {
    display: grid;
    grid-template-columns: 1fr;
  }

  .knowledge-next-step button {
    width: 100%;
  }

  .rewrite-mode-switch {
    gap: 4px;
  }

  section[data-stage="rewrite"] .rewrite-framework-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 420px;
  }

  .rewrite-framework-card {
    min-height: 104px;
    padding: 9px;
  }

  .rewrite-action-row,
  .rewrite-versions-bar,
  .fission-head,
  .fission-head-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .rewrite-action-row {
    align-items: center;
    flex-direction: row;
  }

  .rewrite-action-row .primary-btn {
    width: 100%;
  }

  .rewrite-action-tools {
    min-width: 0;
  }

  .rewrite-inline-status {
    justify-content: flex-start;
  }

  section[data-stage="rewrite"] .version-grid,
  .version-grid:has(.version-card:nth-child(2)),
  .fission-grid,
  .rewrite-flow-list {
    grid-template-columns: 1fr;
  }

  .final-script-workspace {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .final-script-section-head,
  .final-script-history-head,
  .final-script-history-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .final-script-section-head {
    align-items: center;
    flex-direction: row;
  }

  .final-script-history-head input {
    width: 100%;
  }

  .final-script-history-actions {
    justify-content: flex-start;
  }

  .fission-upload-popover {
    right: 0;
    width: min(286px, calc(100vw - 44px));
  }

  .version-card pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  section[data-stage="review"] .metric-preview {
    max-height: none;
    overflow: visible;
  }

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

  .auth-overlay,
  .library-confirm-overlay {
    padding: 10px;
  }

  .auth-modal {
    width: 100%;
    padding: 22px 18px;
  }

  #authPanel {
    padding: 12px;
    overflow-y: auto;
  }

  #authPanel .auth-modal {
    grid-template-columns: 1fr;
    width: min(100%, 430px);
    border-radius: 20px;
  }

  .auth-brand-panel {
    min-height: 0;
    padding: 23px 24px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 13px;
  }

  .auth-brand-panel::after {
    right: -62px;
    bottom: -116px;
  }

  .auth-brand-mark {
    width: 46px;
    height: 46px;
    margin: 0;
    flex: 0 0 46px;
    border-radius: 13px;
  }

  .auth-brand-copy {
    display: grid;
    gap: 1px;
  }

  .auth-brand-copy strong {
    font-size: 21px;
  }

  .auth-brand-copy span {
    font-size: 11px;
  }

  #authPanel .auth-brand-panel > p {
    display: none;
  }

  .auth-form-panel {
    padding: 30px 24px 27px;
  }

  .auth-back-btn {
    top: 18px;
    right: 16px;
  }

  #authPanel .auth-heading h2 {
    font-size: 24px;
  }

  #authPanel .auth-grid {
    margin-top: 23px;
  }

  .library-confirm-overlay.active {
    align-items: start;
    overflow-y: auto;
  }

  .course-create-overlay {
    align-items: center;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .course-create-modal {
    max-height: calc(100dvh - max(20px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
  }

  .library-confirm-modal {
    width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 14px;
    overflow-y: auto;
  }

  .library-confirm-actions {
    position: sticky;
    bottom: -14px;
    padding: 10px 0 14px;
    background: var(--surface);
  }

  .material-transcript-modal {
    max-height: calc(100dvh - 20px);
  }

  .toast {
    right: 10px;
    bottom: 10px;
    left: 10px;
    max-width: none;
  }
}

/* Digital human is a long-form workspace; scroll the stage instead of clipping it. */
section[data-stage="digital-human"].active {
  min-height: 0;
  padding-bottom: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  overscroll-behavior: contain;
}

section[data-stage="digital-human"] .digital-human-grid {
  height: auto;
  min-height: 0;
  overflow: visible;
}

section[data-stage="digital-human"] .digital-human-panel {
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

/* Coach Certification visual baseline for the Lingshu workbench. */
html,
body {
  background: var(--bg);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app-shell {
  width: min(1240px, calc(100% - 48px));
  max-width: none;
  margin: 0 auto;
  padding: 28px 0 64px;
}

.hero {
  min-height: 54px;
  gap: 20px;
  margin-bottom: 18px;
}

.brand-lockup {
  flex-wrap: nowrap;
  gap: 14px;
}

.brand-logo {
  height: 48px;
}

.brand-subtitle {
  min-height: 15px;
  padding-left: 13px;
  border-left-color: rgba(102, 113, 125, 0.42);
  color: #66717d;
  font-size: 11px;
  font-weight: 500;
}

.header-stats,
.user-name-btn {
  min-height: 38px;
  border: 1px solid rgba(173, 186, 201, 0.38);
  border-radius: 10px;
  color: #596470;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.user-name-btn {
  padding-inline: 14px 12px;
}

.user-name-btn:hover,
.user-name-btn[aria-expanded="true"] {
  border-color: rgba(179, 45, 51, 0.22);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 6px 16px rgba(72, 89, 108, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.90);
}

.account-menu {
  top: calc(100% + 10px);
  padding: 12px;
  border-color: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.90);
  box-shadow: 0 16px 35px rgba(72, 89, 108, 0.16);
}

.account-menu button {
  min-height: 36px;
  border-radius: 7px;
  font-weight: 500;
}

.account-menu button:hover,
.account-menu button:focus-visible {
  color: var(--blue);
  background: var(--blue-soft);
}

.step-nav {
  position: relative;
  z-index: 200;
  gap: 6px;
  margin-bottom: 14px;
  padding: 7px;
  border-color: rgba(255, 255, 255, 0.88);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.51);
  box-shadow: 0 10px 28px rgba(72, 89, 108, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
}

.step-nav button {
  position: relative;
  min-height: 50px;
  border-color: transparent;
  border-radius: 10px;
  color: #707986;
  background: rgba(255, 255, 255, 0.17);
  font-size: 15px;
  font-weight: 600;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.step-nav button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.42);
}

.step-nav button.active {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 10px 24px rgba(73, 92, 112, 0.12), 0 2px 5px rgba(73, 92, 112, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.step-nav > button.active::after,
.step-nav > .realtime-nav-item > button.active::after,
.step-nav > .ai-nav-item > button.active::after {
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 28px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--blue);
  content: "";
  transform: translateX(-50%);
}

.realtime-nav-menu {
  z-index: 220;
  top: calc(100% + 10px);
  padding: 7px;
  border-color: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 35px rgba(72, 89, 108, 0.16);
  backdrop-filter: blur(18px);
}

.ai-nav-item {
  position: relative;
  min-width: 0;
}

.step-nav .ai-nav-main {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.step-nav .ai-nav-main > span:not(.ai-nav-caret) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-nav-caret {
  display: inline-flex;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
}

.ai-nav-caret::before {
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: '';
  transform: translateY(-2px) rotate(45deg);
}

.ai-nav-main[aria-expanded="true"] .ai-nav-caret::before {
  transform: translateY(2px) rotate(-135deg);
}

.ai-nav-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 220;
  width: 132px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 35px rgba(72, 89, 108, 0.16);
  backdrop-filter: blur(18px);
}

.ai-nav-menu[hidden] {
  display: none;
}

.step-nav .ai-nav-menu button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.step-nav .ai-nav-menu button:hover,
.step-nav .ai-nav-menu button.active {
  color: var(--blue);
  background: var(--blue-soft);
}

.ai-chat-workspace {
  display: grid;
  grid-template-columns: minmax(180px, 212px) minmax(0, 1fr);
  min-height: min(650px, calc(100vh - 238px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.57);
  box-shadow: 0 14px 38px rgba(72, 89, 108, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.ai-chat-sidebar {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
  padding: 15px;
  border-right: 1px solid var(--line);
  background: rgba(247, 249, 252, 0.62);
}

.ai-chat-sidebar-head,
.ai-chat-main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-chat-main-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.ai-chat-connection-status {
  display: inline-flex;
  align-items: center;
  width: 24px;
  height: 24px;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
}

.ai-chat-connection-status i {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #aab3bf;
  box-shadow: 0 0 0 3px rgba(170, 179, 191, 0.15);
}

.ai-chat-connection-status.is-ready i {
  background: #2eaa68;
  box-shadow: 0 0 0 3px rgba(46, 170, 104, 0.15);
}

.ai-chat-connection-status.is-error i {
  background: #d04545;
  box-shadow: 0 0 0 3px rgba(208, 69, 69, 0.15);
}

.ai-chat-connection-status:hover {
  background: rgba(226, 231, 239, 0.72);
}

.seedance-account-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  min-height: 28px;
}

.seedance-account-dot {
  position: relative;
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #aab3bf;
  box-shadow: 0 0 0 3px rgba(170, 179, 191, 0.15);
}

.seedance-account-dot.is-ready {
  background: #2eaa68;
  box-shadow: 0 0 0 3px rgba(46, 170, 104, 0.15);
}

.seedance-account-dot.is-error {
  background: #d04545;
  box-shadow: 0 0 0 3px rgba(208, 69, 69, 0.15);
}

.seedance-account-dot.is-exhausted {
  background: #d04545;
  box-shadow: 0 0 0 3px rgba(208, 69, 69, 0.15);
}

.seedance-account-dot.is-standby {
  background: #aab3bf;
  box-shadow: 0 0 0 3px rgba(170, 179, 191, 0.15);
}

.seedance-account-dot.is-busy {
  animation: seedanceAccountPulse 1.2s ease-in-out infinite;
}

@keyframes seedanceAccountPulse {
  50% { opacity: 0.45; }
}

.seedance-main {
  min-height: 0;
}

.seedance-mode-switch {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 7px;
}

.seedance-action-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}

.seedance-mode-switch button {
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid #e0e5ec;
  border-radius: 7px;
  color: #697482;
  background: #f8f9fb;
  font-size: 12px;
  cursor: pointer;
}

.seedance-mode-switch button.active {
  color: #aa2c36;
  border-color: rgba(184, 48, 58, 0.32);
  background: #fff6f6;
  box-shadow: none;
}

@media (max-width: 720px) {
  .seedance-action-group {
    gap: 6px;
  }
}

.seedance-log {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.seedance-task-result {
  width: 100%;
}

.seedance-message {
  max-width: min(720px, 88%);
}

.seedance-prompt-message > div {
  white-space: pre-wrap;
}

.seedance-prompt-message {
  align-self: flex-end;
}

.seedance-result-message {
  align-self: flex-start;
}

.seedance-result-message > div {
  width: 100%;
}

.seedance-assistant-text {
  align-self: flex-start;
  white-space: pre-wrap;
}

.seedance-assistant-text > div {
  line-height: 1.65;
}

.seedance-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 7px;
}

.seedance-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  padding: 4px 7px 4px 4px;
  border: 1px solid #e3e7ed;
  border-radius: 8px;
  background: #f7f8fa;
  color: #59616d;
  font-size: 11px;
}

.seedance-attachment img {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: cover;
}

.seedance-attachment > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seedance-attachment button {
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #8b939e;
  cursor: pointer;
}

.seedance-attachment.is-uploading {
  opacity: 0.65;
}

.seedance-attach-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #8d96a2;
  cursor: pointer;
  font-size: 19px;
  line-height: 22px;
}

.seedance-attach-btn:hover,
.seedance-attach-btn:focus-visible {
  background: #f0f2f5;
  color: #59616d;
  outline: none;
}

.seedance-status-line {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.seedance-generating-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 2px solid rgba(179, 45, 51, 0.22);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: seedanceGeneratingSpin 0.8s linear infinite;
}

@keyframes seedanceGeneratingSpin {
  to { transform: rotate(360deg); }
}

.seedance-task-result > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
}

.seedance-task-result > header strong,
.seedance-task-result > header small {
  display: block;
}

.seedance-task-result > header small {
  margin-top: 4px;
  color: var(--muted);
}

.seedance-task-result video {
  display: block;
  width: min(100%, 300px);
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  background: #111;
  object-fit: cover;
}

.seedance-task-result img {
  display: block;
  width: min(100%, 480px);
  max-height: min(64vh, 540px);
  border-radius: 8px;
  background: #f2f3f5;
  object-fit: contain;
}

.seedance-empty {
  display: grid;
  min-height: 100%;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.ai-chat-sidebar-head strong {
  font-size: 16px;
}

.ai-workspace-mode-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-workspace-mode-select {
  position: relative;
  min-width: 0;
}

.ai-workspace-mode-button {
  display: flex;
  width: auto;
  min-height: 34px;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 4px 2px;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.ai-workspace-mode-button svg {
  width: 15px;
  height: 15px;
  transition: transform 160ms ease;
}

.ai-workspace-mode-button[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.ai-workspace-mode-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  left: 0;
  width: 150px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 28px rgba(72, 89, 108, 0.14);
}

.ai-workspace-mode-menu[hidden] {
  display: none;
}

.ai-workspace-mode-menu button {
  display: block;
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.ai-workspace-mode-menu button:hover,
.ai-workspace-mode-menu button.active {
  color: var(--ink);
  background: rgba(226, 231, 239, 0.72);
}

.ai-sidebar-collapse-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
}

.ai-sidebar-collapse-button:hover {
  color: var(--ink);
  background: rgba(226, 231, 239, 0.72);
}

.ai-sidebar-collapse-button svg {
  width: 16px;
  height: 16px;
  transition: transform 160ms ease;
}

.ai-analysis-main {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.ai-analysis-main-head {
  gap: 18px;
  justify-content: space-between;
}

.ai-analysis-title-block {
  min-width: 180px;
  flex: 1 1 auto;
}

.ai-analysis-scope-panel {
  display: flex;
  min-width: 0;
  flex: 0 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.ai-analysis-main-head .analysis-scope-mode,
.ai-analysis-main-head .scope-box {
  flex: 0 0 auto;
  margin: 0;
}

.ai-analysis-main-head .scope-unified-card {
  width: min(460px, 46vw);
}

.ai-analysis-main-head .scope-unified-card #scopeTargetSelect {
  min-width: 180px;
}

@media (min-width: 761px) {
  .ai-chat-workspace.sidebar-collapsed {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .ai-chat-workspace.sidebar-collapsed .ai-chat-sidebar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .ai-chat-workspace.sidebar-collapsed .ai-workspace-mode-select,
  .ai-chat-workspace.sidebar-collapsed .ai-chat-thread-section {
    display: none;
  }

.ai-chat-workspace.sidebar-collapsed .ai-workspace-mode-wrap {
    justify-content: center;
  }
}

.ai-analysis-main .stage-grid {
  height: 100%;
}

.ai-chat-section-toggle {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.ai-chat-section-toggle:hover,
.ai-chat-section-toggle.is-open {
  color: var(--ink);
  background: rgba(226, 231, 239, 0.62);
}

.ai-chat-section-toggle svg {
  width: 15px;
  height: 15px;
  transition: transform 160ms ease;
}

.ai-chat-section-toggle:not(.is-open) svg {
  transform: rotate(-90deg);
}

.ai-chat-thread-section {
  display: grid;
  min-height: 0;
  gap: 6px;
}

.ai-analysis-thread-section {
  flex: 1 1 auto;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.ai-chat-thread-section[hidden] {
  display: none;
}

.ai-chat-analysis-link {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.ai-chat-analysis-link:hover,
.ai-chat-analysis-link:focus-visible {
  color: var(--ink);
  background: rgba(226, 231, 239, 0.62);
  outline: none;
}

.ai-chat-analysis-link svg {
  width: 15px;
  height: 15px;
}

.ai-chat-new-thread-row {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid rgba(205, 212, 222, 0.85);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.ai-chat-new-thread-row svg {
  width: 17px;
  height: 17px;
}

.ai-chat-new-thread-row:hover {
  border-color: rgba(173, 182, 195, 0.95);
  background: #fff;
}

.ai-chat-new-thread-row:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ai-chat-agent-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-chat-agent-field select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
}

.ai-chat-thread-list {
  display: grid;
  min-height: 0;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 5px;
  overflow-y: auto;
}

.ai-chat-thread-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 3px;
  border-radius: 7px;
}

.ai-chat-thread-row.active {
  background: var(--blue-soft);
}

.ai-chat-thread-button {
  display: grid;
  align-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.ai-chat-thread-title-input,
.ai-chat-title-input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 5px 8px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

.ai-chat-title-input {
  width: min(420px, 100%);
  height: 32px;
  font-size: 17px;
  font-weight: 800;
}

.ai-chat-thread-button strong,
.ai-chat-thread-button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-chat-thread-button strong {
  font-size: 13px;
  font-weight: 750;
}

#seedanceTaskList .ai-chat-thread-button {
  width: 100%;
  min-height: 48px;
  justify-items: start;
  text-align: left;
}

#seedanceTaskList .ai-chat-thread-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 3px;
}

#seedanceTaskList .ai-chat-thread-button strong {
  width: 100%;
  text-align: left;
}

.ai-chat-thread-button small,
.ai-chat-thread-empty {
  color: var(--muted);
  font-size: 12px;
}

.ai-chat-thread-delete {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms ease, color 140ms ease, background 140ms ease;
}

.ai-chat-thread-row:hover .ai-chat-thread-delete,
.ai-chat-thread-delete:focus-visible {
  opacity: 1;
}

.ai-chat-thread-delete:hover {
  color: var(--red);
  background: var(--red-soft);
}

.ai-chat-main {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.ai-chat-main-head {
  min-height: 72px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.ai-chat-main-head h2 {
  max-width: 42ch;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-chat-main-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ai-chat-model-select {
  width: min(210px, 42vw);
  height: 36px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.ai-chat-main-head > .ai-chat-model-select {
  display: none;
}

.ai-chat-model-select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ai-chat-log {
  display: grid;
  min-height: 0;
  align-content: start;
  gap: 14px;
  padding: 18px;
  overflow-y: auto;
}

.ai-chat-log.is-empty {
  align-content: center;
  place-items: center;
}

.ai-chat-message {
  display: grid;
  width: fit-content;
  max-width: min(760px, 88%);
  gap: 6px;
}

.ai-chat-message > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-chat-message > div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.ai-chat-message.assistant {
  width: min(760px, 88%);
}

.ai-chat-message.assistant > div {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.ai-chat-message.assistant.error > div {
  padding: 12px 14px;
  border: 1px solid rgba(201, 53, 63, 0.22);
  border-radius: 8px;
  color: var(--red);
  background: var(--red-soft);
  white-space: pre-wrap;
}

.ai-chat-message.user {
  justify-self: end;
}

.ai-chat-message.user > div {
  border-color: rgba(255, 255, 255, 0.9);
  background: var(--blue-soft);
}

.ai-chat-message.pending {
  opacity: 0.72;
}

.ai-chat-typing {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 24px;
  vertical-align: middle;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 10px 0 0 rgba(179, 45, 51, 0.62), 20px 0 0 rgba(179, 45, 51, 0.3);
  animation: aiChatTyping 1.05s ease-in-out infinite;
}

@keyframes aiChatTyping {
  50% { opacity: 0.25; }
}

.ai-chat-welcome {
  align-self: center;
  justify-self: center;
  max-width: 330px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.ai-chat-welcome strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

.ai-chat-welcome p {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.6;
}

.ai-chat-composer {
  display: grid;
  min-height: 116px;
  margin: 0 18px 18px;
  padding: 14px 16px 10px;
  border: 1px solid rgba(214, 220, 229, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 22px rgba(72, 89, 108, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.ai-chat-composer textarea {
  width: 100%;
  height: auto;
  min-height: 58px;
  max-height: min(320px, 42vh);
  padding: 1px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  resize: none;
  overflow-y: hidden;
  scrollbar-width: none;
}

.ai-chat-composer textarea:focus {
  border: 0;
  box-shadow: none;
  outline: none;
}

.ai-chat-composer textarea::placeholder {
  color: #8a929d;
}

.ai-chat-composer textarea::-webkit-scrollbar {
  display: none;
}

.ai-chat-composer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 34px;
  padding-top: 8px;
  border-top: 1px solid #edf0f4;
}

.ai-chat-composer-hint {
  margin-right: auto;
  color: #9aa1ab;
  font-size: 11px;
}

.ai-chat-composer-model-select {
  width: 145px;
  max-width: 145px;
  height: 32px;
  padding: 0 26px 0 8px;
  border: 0;
  border-radius: 8px;
  color: #4f5661;
  appearance: none;
  -webkit-appearance: none;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 7px center;
  background-repeat: no-repeat;
  background-size: 14px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  text-align-last: right;
}

.ai-chat-composer-model-select option {
  text-align: left;
}

.ai-chat-composer-model-select:hover,
.ai-chat-composer-model-select:focus {
  background-color: #f2f4f7;
  outline: none;
}

.ai-chat-composer-model-label {
  min-width: 44px;
  padding: 0 4px;
  color: #4f5661;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.ai-chat-send-btn {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--blue);
  cursor: pointer;
}

.ai-chat-send-btn svg {
  width: 17px;
  height: 17px;
}

.ai-chat-send-btn:hover {
  background: var(--blue-dark, #142d58);
}

.ai-chat-send-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 760px) {
  .step-nav > .ai-nav-item {
    min-width: 82px;
    flex: 0 0 82px;
    scroll-snap-align: start;
  }

  .ai-chat-workspace {
    min-height: calc(100vh - 205px);
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-chat-sidebar {
    gap: 8px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .ai-chat-thread-list {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .ai-chat-thread-row {
    flex: 0 0 150px;
  }

  .ai-chat-main-head,
  .ai-chat-composer {
    padding-right: 12px;
    padding-left: 12px;
  }

  .ai-chat-composer {
    margin-right: 12px;
    margin-bottom: 12px;
    margin-left: 12px;
  }

  .ai-chat-composer-hint {
    display: none;
  }

  .ai-chat-log {
    padding: 14px 12px;
  }
}

/* Keep the conversation frame fixed while only the message stream scrolls. */
.ai-chat-workspace {
  height: 100%;
  min-height: 0;
}

.ai-chat-main {
  overflow: hidden;
}

.ai-chat-log {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (max-width: 980px) {
  .ai-chat-workspace {
    height: calc(100dvh - 172px);
    min-height: 360px;
  }

  .ai-chat-sidebar {
    min-height: 0;
  }

  .ai-chat-thread-section {
    min-height: 0;
    overflow: hidden;
  }

  .ai-chat-thread-list {
    min-height: 0;
    max-height: 126px;
    overflow-y: auto;
  }
}

.panel,
.chanmama-collector-panel,
.knowledge-elements-panel,
.rewrite-panel {
  border-color: rgba(255, 255, 255, 0.90);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.57);
  box-shadow: 0 14px 38px rgba(72, 89, 108, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

input,
textarea,
select {
  border-color: var(--line);
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.80);
  font-weight: 500;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(179, 45, 51, 0.58);
  box-shadow: 0 0 0 3px rgba(179, 45, 51, 0.10);
}

.primary-btn,
.ghost-btn {
  min-height: 42px;
  border-radius: 9px;
  font-weight: 650;
}

.primary-btn {
  background: var(--blue);
  box-shadow: 0 10px 22px rgba(179, 45, 51, 0.18);
}

.ghost-btn {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.70);
}

.chanmama-category-tabs {
  /* Keep the category row flat; the surrounding card/frame was removed. */
  gap: 0;
  padding: 4px 0 16px;
  margin-bottom: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.chanmama-category-tabs:empty {
  display: none;
}

.chanmama-category-tabs button {
  min-height: 48px;
  border-color: transparent;
  border-radius: 9px;
  color: #6f7a86;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}

.chanmama-category-tabs button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.46);
}

.chanmama-category-tabs button.active {
  border-color: rgba(255, 255, 255, 0.90);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 8px 18px rgba(72, 89, 108, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.98);
}

.chanmama-category-tabs button.active span {
  color: var(--blue);
}

.chanmama-grid-card,
.source-material-card,
.version-card,
.mini-card,
.element-subtype-card,
.pending-element-card,
.rewrite-framework-card,
.rewrite-block,
.fission-card,
.final-script-history-card,
.knowledge-search-result {
  border-color: rgba(255, 255, 255, 0.90);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 10px 26px rgba(72, 89, 108, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.source-queue-head,
.knowledge-searchbar,
.knowledge-coursebar,
.rewrite-title-line,
.rewrite-versions-bar {
  border-color: rgba(255, 255, 255, 0.90);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 8px 20px rgba(72, 89, 108, 0.06);
}

.rewrite-framework-card.active,
.rewrite-block.active,
.knowledge-search-result:hover {
  border-color: rgba(179, 45, 51, 0.24);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 10px 24px rgba(72, 89, 108, 0.10), inset 3px 0 0 var(--blue);
}

.chat-msg.assistant {
  border: 1px solid rgba(255, 255, 255, 0.90);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.70);
  box-shadow: 0 8px 20px rgba(72, 89, 108, 0.06);
}

.chat-msg.user {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.70);
  box-shadow: 0 8px 20px rgba(72, 89, 108, 0.06);
}

section[data-stage="elements"].active .panel {
  border-color: rgba(255, 255, 255, 0.90);
}

section[data-stage="elements"] .scope-select-card {
  background: rgba(255, 255, 255, 0.70);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

section[data-stage="elements"] .scope-select-card select {
  border-color: var(--line);
}

.auth-overlay,
.library-confirm-overlay,
.chanmama-save-overlay {
  background: rgba(23, 32, 43, 0.22);
  backdrop-filter: blur(8px);
}

.auth-modal,
.library-confirm-modal,
.text-input-modal,
.course-create-modal,
.course-profile-modal,
.chanmama-player-modal,
.chanmama-save-dialog {
  border-color: rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 50px rgba(72, 89, 108, 0.14);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

@media (max-width: 1050px) {
  .app-shell {
    width: min(calc(100% - 40px), 920px);
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: 100%;
    padding: 18px 12px 28px;
  }

  .hero {
    min-height: 50px;
    margin-bottom: 16px;
  }

  .brand-logo {
    height: 40px;
  }

  .brand-subtitle,
  .header-stats {
    display: none;
  }

  .step-nav {
    gap: 5px;
    padding: 6px;
    border-radius: 12px;
  }

  .step-nav button {
    min-height: 48px;
    padding-inline: 4px;
    border-radius: 9px;
    font-size: 12px;
  }

  #realtimeNavLabel {
    font-size: 0;
  }

  #realtimeNavLabel::before {
    color: inherit;
    content: "实时";
    font-size: 12px;
  }

  .panel,
  .chanmama-collector-panel,
  .knowledge-elements-panel,
  .rewrite-panel {
    border-radius: 13px;
  }

  .chanmama-category-tabs {
    padding: 4px 0 12px;
  }

  .chanmama-category-tabs button {
    min-height: 44px;
    padding-inline: 14px;
    font-size: 12px;
  }
}

/* Digital human workflow */
.digital-human-grid {
  grid-template-columns: minmax(0, 1fr);
}

.digital-human-panel {
  min-width: 0;
}

.digital-human-panel > .panel-head {
  align-items: flex-end;
}

.digital-human-workflow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.digital-human-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(224, 229, 235, 0.95);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(40, 52, 66, 0.05);
}

.digital-human-card:nth-child(2) {
  display: flex;
  flex-direction: column;
}

.digital-human-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.digital-human-card-head > div {
  display: grid;
  gap: 5px;
}

.digital-human-card-head strong {
  color: var(--ink);
  font-size: 16px;
}

.digital-human-card-head span {
  color: #7b8590;
  font-size: 12px;
}

.digital-human-avatar-column .digital-human-card-head,
.digital-human-result-column .digital-human-card-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-bottom: 14px;
  padding: 0 8px;
  text-align: center;
}

.digital-human-avatar-column .digital-human-card-head strong,
.digital-human-result-column .digital-human-card-head strong {
  font-size: 16px;
  font-weight: 700;
}

.digital-human-view-all {
  position: absolute;
  right: 2px;
  min-height: 30px;
  padding: 0 4px;
  border: 0;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.digital-human-view-all:hover {
  text-decoration: underline;
}

.digital-human-view-all[hidden] {
  display: none !important;
}

.digital-human-status {
  flex: 0 0 auto;
  color: #7b8590;
  font-size: 12px;
}

.digital-human-health {
  position: absolute;
  top: 50%;
  left: 8px;
  z-index: 8;
  transform: translateY(-50%);
}

.digital-human-health-toggle {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.digital-human-health-toggle:hover,
.digital-human-health-toggle[aria-expanded="true"] {
  background: transparent;
}

.digital-human-health-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #a5adb5;
  box-shadow: 0 0 0 3px rgba(165, 173, 181, 0.12);
}

.digital-human-health[data-status="healthy"] .digital-human-health-dot {
  background: #1f9d62;
  box-shadow: 0 0 0 3px rgba(31, 157, 98, 0.12);
}

.digital-human-health[data-status="error"] .digital-human-health-dot {
  background: #c44343;
  box-shadow: 0 0 0 3px rgba(196, 67, 67, 0.12);
}

.digital-human-health-popover {
  position: absolute;
  top: 32px;
  left: 0;
  display: grid;
  width: min(290px, calc(100vw - 48px));
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(39, 48, 58, 0.2);
  text-align: left;
}

.digital-human-health-popover[hidden] {
  display: none !important;
}

.digital-human-health-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.digital-human-health-copy strong {
  color: var(--ink);
  font-size: 12px;
}

.digital-human-health-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.digital-human-health .icon-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
}

.digital-human-field,
.digital-human-upload {
  display: grid;
  gap: 8px;
}

.digital-human-field > span,
.digital-human-upload > span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.digital-human-field textarea {
  width: 100%;
  min-height: 164px;
  resize: vertical;
}

.digital-human-upload-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.digital-human-selected-row,
.digital-human-selected-avatar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid #e0e5eb;
  border-radius: 6px;
  background: #fbfcfd;
}

.digital-human-selected-row > div,
.digital-human-selected-avatar > div {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.digital-human-selected-row span,
.digital-human-selected-avatar span {
  color: #7b8590;
  font-size: 12px;
}

.digital-human-selected-row strong,
.digital-human-selected-avatar strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.digital-human-selected-avatar video {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 5px;
  background: #20252b;
  object-fit: cover;
}

.digital-human-selected-avatar video[hidden] {
  display: none !important;
}

.digital-human-upload-compact {
  min-height: 0;
  margin-top: 12px;
}

.digital-human-upload {
  min-width: 0;
  padding: 13px;
  border: 1px dashed #d8dee6;
  border-radius: 6px;
  background: #fafbfc;
}

.digital-human-upload input {
  width: 100%;
  min-width: 0;
  color: #66717d;
  font-size: 12px;
}

.digital-human-upload em {
  overflow: hidden;
  color: #89929c;
  font-size: 12px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.digital-human-avatar-upload {
  flex: 1 1 auto;
  min-height: 112px;
  align-content: center;
}

.digital-human-avatar-list {
  display: grid;
  gap: 8px;
  max-height: 170px;
  margin-top: 4px;
  overflow-y: auto;
}

.digital-human-avatar-list[hidden] {
  display: none !important;
}

.digital-human-avatar-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid #dce2e9;
  border-radius: 5px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.digital-human-avatar-option:hover {
  border-color: rgba(179, 45, 51, 0.45);
}

.digital-human-avatar-option.active {
  border-color: rgba(179, 45, 51, 0.65);
  background: rgba(179, 45, 51, 0.06);
}

.digital-human-avatar-option strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.digital-human-avatar-option span {
  flex: 0 0 auto;
  color: #8a939d;
  font-size: 11px;
}

.digital-human-action {
  width: 100%;
  margin-top: 16px;
}

.digital-human-player {
  display: block;
  width: 100%;
  max-height: 360px;
  margin-top: 16px;
  border-radius: 6px;
  background: transparent;
}

video.digital-human-player {
  background: #111820;
}

.digital-human-player[hidden],
.digital-human-download[hidden] {
  display: none !important;
}

.digital-human-download {
  display: inline-flex;
  margin-top: 12px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.digital-human-download:hover {
  text-decoration: underline;
}

.digital-human-task-status {
  min-height: 20px;
  margin-top: 12px;
  color: #7b8590;
  font-size: 12px;
  line-height: 1.6;
}

.digital-human-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 35, 43, 0.48);
}

.digital-human-rename-overlay {
  z-index: 1100;
}

.digital-human-modal[hidden] {
  display: none !important;
}

.digital-human-modal-dialog {
  display: grid;
  grid-template-rows: auto auto auto minmax(220px, 1fr) auto;
  width: min(820px, 100%);
  max-height: min(640px, calc(100dvh - 40px));
  padding: 20px;
  border: 1px solid #e3e7ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(35, 43, 52, 0.25);
}

.digital-human-avatar-modal-dialog {
  grid-template-rows: auto auto minmax(220px, 1fr) auto;
}

.digital-human-video-modal-dialog {
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1040px, 100%);
  max-height: min(780px, calc(100dvh - 40px));
}

.digital-human-all-video-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 16px;
  min-height: 0;
  padding: 16px 2px 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.digital-human-all-video-list .digital-human-result-item {
  align-content: start;
  padding: 10px;
  border: 1px solid #e0e5eb;
  border-radius: 8px;
  background: #f7f8fa;
}

.digital-human-all-video-list .digital-human-result-item:last-child {
  padding-bottom: 10px;
  border: 1px solid #e0e5eb;
}

.digital-human-all-video-list .digital-human-result-item video {
  max-height: 470px;
}

.digital-human-modal-head,
.digital-human-modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.digital-human-modal-head {
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid #edf0f3;
}

.digital-human-video-modal-dialog .digital-human-modal-head {
  justify-content: flex-start;
}

.digital-human-modal-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.digital-human-modal-close {
  width: 32px;
  height: 32px;
  border: 0;
  color: #7b8590;
  background: transparent;
  font-size: 24px;
}

.digital-human-modal-tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid #edf0f3;
}

.digital-human-modal-tabs button {
  min-height: 46px;
  padding: 0 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: #8a939d;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.digital-human-modal-tabs button.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.digital-human-modal-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 0;
  color: #68737e;
  font-size: 12px;
}

.digital-human-modal-filters button {
  min-height: 30px;
  padding: 0 13px;
  border: 1px solid #dce2e8;
  border-radius: 4px;
  color: #66717d;
  background: #fff;
}

.digital-human-modal-filters button.active {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.digital-human-gender-filter {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 34px;
  gap: 4px;
  padding: 0 8px;
  border: 1px solid #dce2e8;
  border-radius: 6px;
  background: #fff;
}

.digital-human-gender-filter > span {
  padding-right: 4px;
  color: #68737e;
}

.digital-human-modal-filters .digital-human-gender-filter button,
.digital-human-modal-filters .digital-human-gender-filter button.active {
  min-height: 28px;
  padding: 0 7px;
  border: 0;
  border-radius: 4px;
  color: #68737e;
  background: transparent;
  font-weight: 600;
}

.digital-human-modal-filters .digital-human-gender-filter button.active {
  color: var(--blue);
  font-weight: 800;
}

.digital-human-modal-filters input {
  flex: 1 1 240px;
  min-width: 160px;
  min-height: 34px;
  margin-left: 10px;
}

.digital-human-avatar-filters #digitalHumanAvatarSearch {
  flex-basis: 160px;
  min-width: 120px;
  margin-left: 4px;
}

.digital-human-teacher-filter {
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.digital-human-add-ip-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.digital-human-library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  min-height: 220px;
  max-height: min(420px, calc(100dvh - 270px));
  padding: 2px;
  overflow-y: auto;
}

.digital-human-library-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 68px;
  padding: 10px;
  border: 1px solid #e0e5eb;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.digital-human-library-actions {
  position: absolute;
  right: 8px;
  bottom: 5px;
  display: flex;
  gap: 3px;
}

.digital-human-library-action {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 5px;
  color: #68717d;
  cursor: pointer;
}

.digital-human-library-action svg {
  width: 15px;
  height: 15px;
}

.digital-human-library-rename:hover,
.digital-human-library-rename:focus-visible {
  color: var(--blue);
  background: #edf3f8;
  outline: none;
}

.digital-human-library-delete {
  color: #9b3b3f;
}

.digital-human-library-delete:hover,
.digital-human-library-delete:focus-visible {
  color: #b32d33;
  background: #fbefef;
  outline: none;
}

.digital-human-library-item:hover,
.digital-human-library-item.active {
  border-color: rgba(179, 45, 51, 0.65);
  background: rgba(179, 45, 51, 0.05);
}

.digital-human-library-play {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-size: 11px;
}

.digital-human-library-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.digital-human-library-copy strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.digital-human-library-copy small {
  color: #8a939d;
  font-size: 11px;
}

.digital-human-avatar-library-item {
  display: grid;
  grid-template-rows: auto auto;
  align-items: stretch;
  gap: 9px;
  min-height: 190px;
  overflow: hidden;
}

.digital-human-avatar-library-item video,
.digital-human-avatar-library-item img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  min-height: 132px;
  max-height: 150px;
  border-radius: 6px;
  background: #23282e;
  object-fit: contain;
}

.digital-human-uploading-item {
  pointer-events: none;
  border-style: dashed;
  background: #f7f8fa;
}

.digital-human-uploading-preview {
  display: grid;
  min-height: 132px;
  place-items: center;
  align-content: center;
  gap: 10px;
  border-radius: 6px;
  color: #68737e;
  background: #eef1f4;
  font-size: 12px;
}

.digital-human-uploading-preview .status-spinner {
  width: 26px;
  height: 26px;
}

.digital-human-avatar-modal-grid {
  min-height: 0;
  overscroll-behavior: contain;
}

.digital-human-library-empty {
  grid-column: 1 / -1;
  display: grid;
  min-height: 220px;
  place-items: center;
  color: #8a939d;
  font-size: 13px;
}

@media (max-width: 820px) {
  .digital-human-workflow,
  .digital-human-upload-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Flat selection and command treatment: brand red is an accent, not a filled surface. */
.source-mode-switch button.active,
.source-method-switch button.active,
.rewrite-mode-switch button.active,
.analysis-scope-mode button.active,
.kb-source-switch button.active,
.course-tabs button.active,
.pending-audit-tools button.active,
.kb-segment button.active,
.course-nav button.active {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.92);
  color: var(--blue);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 7px 16px rgba(72, 89, 108, 0.08), inset 0 -3px 0 var(--blue);
}

.source-mode-switch button.active::after,
.source-method-switch button.active::after,
.rewrite-mode-switch button.active::after,
.analysis-scope-mode button.active::after,
.kb-source-switch button.active::after,
.course-tabs button.active::after,
.pending-audit-tools button.active::after,
.kb-segment button.active::after,
.course-nav button.active::after {
  display: none;
}

#ingestLinksBtn {
  align-self: stretch;
  width: 100%;
  min-height: 46px;
  margin: 2px 0 0;
  border: 1px solid var(--blue);
  color: #fff;
  background: var(--blue);
  box-shadow: 0 7px 16px rgba(179, 45, 51, 0.20);
}

#ingestLinksBtn:hover:not(:disabled) {
  border-color: #a8252d;
  background: #a8252d;
  box-shadow: 0 9px 18px rgba(179, 45, 51, 0.26);
}

#ingestLinksBtn:disabled {
  color: rgba(255, 255, 255, 0.82);
  background: rgba(179, 45, 51, 0.58);
  box-shadow: none;
}

/* A collection always belongs to the current user; this is informative, not a second choice. */
.source-library-destination {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid rgba(214, 220, 229, 0.94);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
}

.source-library-destination strong {
  color: var(--ink);
  font-size: 14px;
}

.source-library-destination span {
  color: var(--muted);
  font-size: 12px;
}

#sourcePersonalRow #personalLibrarySelect {
  display: none !important;
}

@media (max-width: 680px) {
  .source-library-destination {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding-block: 9px;
  }
}

@media (max-width: 680px) {
  #ingestLinksBtn {
    min-height: 44px;
  }
}
.chanmama-search-action button.running {
  opacity: 0.7;
  cursor: default;
}

.chanmama-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(16, 18, 22, 0.72);
}

.chanmama-login-dialog {
  width: min(1440px, 100%);
  height: min(900px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) 62px;
  overflow: hidden;
  border: 1px solid #d9dde5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.chanmama-login-dialog header,
.chanmama-login-dialog footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: #fff;
}

.chanmama-login-dialog header {
  justify-content: space-between;
  border-bottom: 1px solid #e5e7eb;
}

.chanmama-login-dialog footer {
  justify-content: flex-end;
  border-top: 1px solid #e5e7eb;
}

.chanmama-login-dialog iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #16191f;
}

.chanmama-login-dialog .icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #374151;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 720px) {
  .library-confirm-overlay.active {
    align-items: center;
    justify-items: center;
    overflow-y: auto;
  }

  .library-confirm-modal {
    margin: auto;
  }

  .course-create-modal,
  .course-profile-modal {
    max-height: calc(100dvh - 28px);
  }

  .course-create-modal .course-source-text {
    min-height: 210px;
    max-height: 310px;
  }

  .course-create-modal .library-confirm-actions,
  .course-profile-modal .library-confirm-actions {
    position: static;
    margin-top: 10px;
    padding: 0;
    background: transparent;
  }

  .course-create-modal .library-confirm-actions::before,
  .course-profile-modal .library-confirm-actions::before {
    display: none;
  }

  .seedance-workspace .ai-chat-sidebar {
    display: none !important;
  }

  .seedance-workspace .ai-chat-main {
    grid-column: 1 / -1;
  }

  .seedance-workspace .seedance-mobile-thread-picker {
    position: relative;
    display: inline-block;
    max-width: min(68vw, 260px);
    margin-top: 3px;
  }

  .seedance-mobile-thread-picker summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 3px 0;
    color: var(--ink);
    cursor: pointer;
    list-style: none;
    font-size: 15px;
    font-weight: 850;
  }

  .seedance-mobile-thread-picker summary::-webkit-details-marker {
    display: none;
  }

  .seedance-mobile-thread-picker summary i {
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
  }

  .seedance-mobile-thread-picker[open] summary i {
    transform: rotate(225deg) translate(-1px, -1px);
  }

  .seedance-mobile-thread-picker > div {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0;
    display: grid;
    width: min(280px, 75vw);
    max-height: 230px;
    overflow-y: auto;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(18, 28, 45, 0.16);
  }

  .seedance-mobile-thread-picker > div button {
    padding: 9px 10px;
    border: 0;
    border-radius: 7px;
    color: var(--ink);
    background: transparent;
    text-align: left;
    font-size: 12px;
  }

  .seedance-mobile-thread-picker > div button.active,
  .seedance-mobile-thread-picker > div button:hover {
    color: var(--accent);
    background: rgba(179, 45, 51, 0.08);
  }

  .seedance-workspace #seedanceTitle {
    display: none;
  }

  .course-profile-grid {
    grid-template-columns: 1fr;
  }

  .course-profile-status {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .course-profile-status small {
    width: 100%;
    margin-left: 0;
  }

  .course-profile-modal .library-confirm-actions {
    flex-wrap: wrap;
  }

  .course-profile-modal .library-confirm-actions button {
    flex: 1 1 140px;
  }

  .chanmama-login-overlay {
    padding: 0;
  }

  .chanmama-login-dialog {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    grid-template-rows: 48px minmax(0, 1fr) 58px;
  }
}

.chanmama-grid-card {
  border-radius: 16px;
}

.chanmama-card-save {
  border-radius: 9px;
}

.chanmama-primary-metrics div {
  border-radius: 8px;
}

.chanmama-search-action {
  grid-template-columns: minmax(0, 3fr) minmax(120px, 1fr);
  justify-content: stretch;
  padding-inline: 18px;
}

.chanmama-search-action .chanmama-sort-control {
  display: flex;
  min-width: 0;
  min-height: 42px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.chanmama-search-action .chanmama-sort-control span {
  display: none;
}

.chanmama-search-action .chanmama-sort-control select {
  appearance: none;
  -webkit-appearance: none;
  width: 100% !important;
  max-width: none;
  min-width: 0 !important;
  height: 38px;
  min-height: 38px;
  padding: 0 24px 0 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  background: transparent;
}

.chanmama-search-action .chanmama-sort-control {
  position: relative;
}

.chanmama-search-action .chanmama-sort-control::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

#startChanmamaBtn,
#startMiaosiBtn {
  min-width: 116px;
  border: 1px solid rgba(179, 45, 51, 0.30);
  color: var(--blue);
  background: rgba(179, 45, 51, 0.08);
  box-shadow: none;
}

#chatSendBtn {
  min-width: 0;
  width: 100%;
  border: 1px solid rgba(179, 45, 51, 0.30);
  color: var(--blue);
  background: rgba(179, 45, 51, 0.08);
  box-shadow: none;
}

@media (min-width: 981px) {
  section[data-stage="elements"] .chat-box {
    grid-template-columns: minmax(0, 1fr) 96px;
  }
}

#startChanmamaBtn:hover,
#startMiaosiBtn:hover,
#chatSendBtn:hover {
  border-color: rgba(179, 45, 51, 0.48);
  background: rgba(179, 45, 51, 0.13);
}

.chanmama-analysis-badge,
.chanmama-run-score {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(16, 20, 28, 0.58);
}

.chat-review-btn.save {
  border: 1px solid rgba(34, 131, 94, 0.20);
  color: #22835e;
  background: rgba(34, 131, 94, 0.12);
}

.chat-review-btn.discard {
  border: 1px solid rgba(179, 45, 51, 0.16);
  color: var(--blue);
  background: rgba(179, 45, 51, 0.08);
}

.chat-review-actions {
  flex-wrap: nowrap;
  justify-content: center;
}

.chat-review-actions .chat-review-btn {
  flex: 0 0 auto;
}

.pending-audit-tools button.active {
  border-color: rgba(179, 45, 51, 0.24);
  color: var(--blue);
  background: #fff;
  box-shadow: inset 3px 0 0 var(--blue);
}

#materialTree .source-target-section {
  border-color: rgba(179, 45, 51, 0.18);
  background: rgba(255, 255, 255, 0.62);
}

#materialTree .source-target-section > summary {
  border-radius: 12px;
  color: var(--blue);
  background: rgba(179, 45, 51, 0.08);
}

#materialTree .source-target-section > summary strong,
#materialTree .source-target-section > summary span,
#materialTree .source-target-section > summary em {
  color: inherit;
}

.source-method-switch {
  gap: 6px;
  padding: 7px;
  border-color: rgba(255, 255, 255, 0.88);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.51);
  box-shadow: 0 10px 28px rgba(72, 89, 108, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
}

.source-method-switch button {
  position: relative;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #707986;
  background: rgba(255, 255, 255, 0.17);
  font-size: 14px;
  font-weight: 600;
}

.source-method-switch button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.42);
}

.source-method-switch button.active {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 10px 24px rgba(73, 92, 112, 0.12), 0 2px 5px rgba(73, 92, 112, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.source-method-switch button.active::after {
  display: block;
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 28px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--blue);
  content: "";
  transform: translateX(-50%);
}

/* Material collection and creation modes use one selection cue only: the red underline. */
#externalSourceMethodSwitch,
#internalSourceMethodSwitch,
#rewriteModeSwitch {
  gap: 0;
  padding: 0;
  border: 1px solid rgba(214, 220, 229, 0.94);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#externalSourceMethodSwitch button,
#internalSourceMethodSwitch button,
#rewriteModeSwitch button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  color: #657080;
  background: transparent;
  box-shadow: none;
}

#externalSourceMethodSwitch button.active,
#internalSourceMethodSwitch button.active,
#rewriteModeSwitch button.active {
  color: var(--ink);
  background: transparent;
  box-shadow: none;
}

#externalSourceMethodSwitch button.active::after,
#internalSourceMethodSwitch button.active::after,
#rewriteModeSwitch button.active::after {
  display: block;
  bottom: 4px;
}

/* The realtime categories are labels, not a row of individually framed cards. */
.chanmama-category-tabs button {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding-left: 14px;
  padding-right: 14px;
}

.chanmama-category-tabs button:hover {
  background: rgba(255, 255, 255, 0.46);
}

.chanmama-category-tabs button.active {
  border-color: transparent;
  color: var(--blue);
  background: transparent;
  box-shadow: none;
}

.chanmama-category-tabs button.active span {
  color: var(--blue);
}

/* Keep the send action compact and deliberate, closer to the Doubao composer. */
.ai-chat-send-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(146, 34, 42, 0.36);
  border-radius: 12px;
  background: linear-gradient(145deg, #ca3942, #aa2730);
  box-shadow: 0 5px 12px rgba(179, 45, 51, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.ai-chat-send-btn:hover {
  background: linear-gradient(145deg, #d34750, #b12b34);
  box-shadow: 0 7px 16px rgba(179, 45, 51, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.ai-chat-send-btn svg {
  width: 18px;
  height: 18px;
  transform: translateX(1px);
}

.rewrite-mode-switch button.active,
.analysis-scope-mode button.active {
  box-shadow: 0 7px 16px rgba(72, 89, 108, 0.08);
}

.rewrite-mode-switch button.active::after,
.analysis-scope-mode button.active::after {
  display: block;
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 28px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--blue);
  content: "";
  transform: translateX(-50%);
}

.rewrite-mode-switch {
  gap: 6px;
  padding: 7px;
  border-color: rgba(255, 255, 255, 0.88);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.51);
  box-shadow: 0 10px 28px rgba(72, 89, 108, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
}

.rewrite-mode-switch button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #707986;
  background: rgba(255, 255, 255, 0.17);
  font-size: 14px;
  font-weight: 600;
}

.rewrite-mode-switch button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.42);
}

.rewrite-mode-switch button.active {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.68);
}

.chanmama-fields > label {
  display: none;
}

.chanmama-search-action input::placeholder {
  color: #8b949e;
  font-size: 12px;
  opacity: 1;
}

@media (max-width: 680px) {
  .rewrite-builder {
    min-height: 0;
  }

  .rewrite-block-palette {
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  }

  .chanmama-search-action {
    grid-template-columns: minmax(0, 3fr) minmax(110px, 1fr);
    gap: 6px;
    padding-inline: 8px;
  }
}

/* Digital human three-column production workspace */
.digital-human-engine-label {
  color: #8a939d;
  font-size: 12px;
  font-weight: 500;
}

.digital-human-workflow {
  grid-template-columns: minmax(210px, 0.84fr) minmax(360px, 1.45fr) minmax(260px, 1.16fr);
  align-items: stretch;
  margin-top: 0;
}

/* Keep the three production cards vertically balanced inside the existing
   workspace, while preserving the intentional empty area below them. */
section[data-stage="digital-human"] .digital-human-panel {
  display: flex;
  flex-direction: column;
}

section[data-stage="digital-human"] .digital-human-workflow {
  width: 100%;
  margin-top: auto;
  margin-bottom: auto;
}

.digital-human-card,
.digital-human-card:nth-child(2) {
  display: flex;
  /* Fit the full workspace in the viewport; only the finished-video library scrolls. */
  height: max(540px, calc(100dvh - 305px));
  min-height: 0;
  flex-direction: column;
}

.digital-human-script-column .digital-human-field {
  position: relative;
  flex: 1 1 auto;
}

.digital-human-script-column .digital-human-field textarea {
  height: 100%;
  min-height: 330px;
}

.digital-human-script-column .digital-human-field textarea::placeholder {
  color: #6f7a86;
  font-size: 14px;
  opacity: 1;
}

.digital-human-synthesis-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 28px;
  border: 1px solid rgba(179, 45, 51, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  text-align: center;
  backdrop-filter: blur(2px);
}

.digital-human-synthesis-overlay[hidden] {
  display: none !important;
}

.digital-human-synthesis-overlay .source-queue-spinner {
  width: 64px;
  height: 64px;
  border-width: 5px;
}

.digital-human-synthesis-overlay strong {
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
}

.digital-human-synthesis-overlay small {
  max-width: 320px;
  color: #68737e;
  font-size: 13px;
  line-height: 1.6;
}

.digital-human-audio-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(179, 45, 51, 0.22);
  border-radius: 12px;
  background: rgba(179, 45, 51, 0.055);
}

.digital-human-audio-current {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 4px;
}

.digital-human-audio-current span,
.digital-human-inline-upload span {
  color: #8f2429;
  font-size: 12px;
  font-weight: 700;
}

.digital-human-audio-current strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#digitalHumanChooseAudioBtn,
#digitalHumanChooseAvatarBtn {
  min-width: 112px;
  min-height: 44px;
  border-color: rgba(179, 45, 51, 0.28);
  color: var(--blue);
  background: #fff;
  font-size: 14px;
  font-weight: 800;
}

#digitalHumanChooseAudioBtn {
  min-width: 136px;
}

#digitalHumanChooseAudioBtn:hover,
#digitalHumanChooseAvatarBtn:hover {
  border-color: rgba(179, 45, 51, 0.45);
  background: rgba(255, 255, 255, 0.86);
}

#digitalHumanChooseAvatarBtn {
  width: 100%;
}

.digital-human-inline-upload {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.digital-human-inline-upload input {
  width: 92px;
  min-width: 0;
  color: #7b8590;
  font-size: 10px;
}

.digital-human-inline-upload em {
  display: none;
}

.digital-human-audio-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin-top: 10px;
}

.digital-human-audio-action-row .primary-btn {
  flex: 0 0 auto;
  min-width: 96px;
}

.digital-human-audio-player {
  flex: 1 1 auto;
  min-width: 0;
  height: 36px;
  margin-top: 0;
}

.digital-human-audio-action-row .digital-human-download {
  flex: 0 0 auto;
  margin-top: 0;
}

.digital-human-avatar-stage,
.digital-human-result-stage {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  min-height: clamp(280px, calc(100dvh - 540px), 320px);
  margin-bottom: 16px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #e0e5eb;
  border-radius: 10px;
  background: #f3f5f7;
}

.digital-human-avatar-stage video {
  width: 100%;
  height: 100%;
  max-height: none;
  margin: 0;
  border-radius: 0;
  background: #20252b;
  object-fit: contain;
}

.digital-human-result-list {
  display: grid;
  align-self: stretch;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  gap: 12px;
  padding: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.digital-human-result-list[hidden] {
  display: none !important;
}

.digital-human-result-item {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid #dfe4ea;
}

.digital-human-result-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.digital-human-result-item video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 360px;
  border-radius: 8px;
  background: #20252b;
  object-fit: contain;
}

.digital-human-result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #7b8590;
  font-size: 12px;
}

.digital-human-result-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: #303943;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.digital-human-result-time {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #7b8590;
  white-space: nowrap;
}

.digital-human-inline-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--blue);
  text-decoration: none;
}

.digital-human-inline-download svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.digital-human-inline-download:hover {
  opacity: .72;
}


.digital-human-result-meta a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.digital-human-result-meta a:hover {
  text-decoration: underline;
}

.digital-human-result-actions {
  display: none !important;
}

/* The card metadata already owns the download/delete controls. Keep the
   legacy action group out of the “全部成品视频” cards so controls are not
   rendered twice. */
.digital-human-all-video-list .digital-human-result-actions {
  display: none !important;
}

.digital-human-video-modal-dialog .digital-human-video-search {
  margin-left: auto;
}

.digital-human-result-actions button {
  padding: 0;
  border: 0;
  color: var(--red);
  background: transparent;
  font: inherit;
  font-weight: 700;
}

.digital-human-icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  color: var(--red);
  background: transparent;
}

.digital-human-icon-action svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.digital-human-icon-action:not(.danger) { color: var(--blue); }
.digital-human-icon-action:hover { opacity: .72; }

.digital-human-video-search {
  width: min(190px, 42%);
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #dce2e8;
  border-radius: 7px;
  color: #303943;
  background: #fff;
  font: inherit;
  font-size: 12px;
}

.digital-human-result-actions button:hover {
  text-decoration: underline;
}

.digital-human-avatar-placeholder,
.digital-human-video-empty {
  padding: 24px;
  color: #8a939d;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.digital-human-avatar-placeholder[hidden],
.digital-human-video-empty[hidden] {
  display: none !important;
}

.digital-human-avatar-column > .primary-btn {
  width: 100%;
}

.digital-human-upload-btn {
  width: auto;
  min-width: 132px;
  min-height: 42px;
  border-color: #dce3eb;
  color: #4c5865;
  background: #fff;
  font-size: 13px;
  font-weight: 800;
}

.digital-human-upload-btn:hover {
  border-color: rgba(179, 45, 51, 0.32);
  color: var(--blue);
  background: rgba(179, 45, 51, 0.055);
}

.digital-human-avatar-column .digital-human-upload-compact {
  margin-top: 10px;
}

.digital-human-result-column .digital-human-task-status {
  min-height: 20px;
  margin-top: 10px;
}

.digital-human-result-column .digital-human-task-status:empty {
  display: none;
}

.digital-human-result-column .digital-human-action {
  margin-top: auto;
}

.digital-human-result-column .digital-human-download {
  align-self: flex-end;
}

/* A disabled generation action should read as unavailable, not as a washed-out brand red. */
#digitalHumanGenerateVideoBtn:disabled {
  color: #fff;
  background: #aeb7c1;
  cursor: not-allowed;
  opacity: 1;
}

@media (max-width: 1050px) {
  .digital-human-workflow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .digital-human-result-column {
    grid-column: 1 / -1;
  }

  .digital-human-all-video-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .digital-human-workflow {
    grid-template-columns: minmax(0, 1fr);
  }

  .digital-human-result-column {
    grid-column: auto;
  }

  .digital-human-card,
  .digital-human-card:nth-child(2) {
    min-height: 0;
  }

  .digital-human-video-modal-dialog {
    max-height: calc(100dvh - 24px);
    padding: 14px;
  }

  .digital-human-all-video-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Automatic editing */
.auto-edit-grid {
  grid-template-columns: minmax(0, 1fr);
}

.auto-edit-panel {
  display: flex;
  min-width: 0;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.auto-edit-preview-meta,
.auto-edit-transcript-head,
.auto-edit-setting-row,
.auto-edit-footer,
.auto-edit-actions,
.auto-edit-export-head,
.auto-edit-export-option {
  display: flex;
  align-items: center;
}

.auto-edit-export-head h3 {
  margin: 0;
}

.auto-edit-export-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.auto-edit-health {
  position: absolute;
  top: 12px;
  right: 18px;
  z-index: 8;
}

.auto-edit-health-toggle {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(39, 48, 58, 0.14);
}

.auto-edit-health-toggle:hover,
.auto-edit-health-toggle[aria-expanded="true"] {
  background: #f4f6f8;
}

.auto-edit-health-popover {
  position: absolute;
  top: 32px;
  right: 0;
  display: grid;
  width: min(310px, calc(100vw - 48px));
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(39, 48, 58, 0.2);
}

.auto-edit-health-popover[hidden] {
  display: none;
}

.auto-edit-health-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #a5adb5;
  box-shadow: 0 0 0 3px rgba(165, 173, 181, 0.14);
}

.auto-edit-health[data-status="healthy"] .auto-edit-health-dot {
  background: #1f9d62;
  box-shadow: 0 0 0 3px rgba(31, 157, 98, 0.14);
}

.auto-edit-health[data-status="warning"] .auto-edit-health-dot,
.auto-edit-health[data-status="error"] .auto-edit-health-dot {
  background: #c44343;
  box-shadow: 0 0 0 3px rgba(196, 67, 67, 0.14);
}

.auto-edit-health-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.auto-edit-health-copy strong,
.auto-edit-health-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auto-edit-health-copy strong {
  color: var(--ink);
  font-size: 12px;
}

.auto-edit-health-copy small {
  color: var(--muted);
  font-size: 11px;
}

.auto-edit-health .icon-btn {
  width: 32px;
  min-width: 32px;
  height: 32px;
}

.auto-edit-health .ghost-btn {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.auto-edit-health-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.auto-edit-segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(92px, 1fr);
  flex: 0 0 auto;
  gap: 3px;
  padding: 3px;
  border: 1px solid #dfe5eb;
  border-radius: 8px;
  background: #f3f5f7;
}

.auto-edit-segmented button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: #6d7782;
  background: transparent;
  font-size: 13px;
  font-weight: 750;
}

.auto-edit-segmented button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 10px rgba(72, 89, 108, 0.11);
}

.auto-edit-source-control {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
}

.auto-edit-source-control[hidden] {
  display: none !important;
}

.auto-edit-source-control select {
  min-width: 0;
  height: 40px;
  flex: 1 1 auto;
}

.auto-edit-source-control .ghost-btn {
  min-height: 40px;
  white-space: nowrap;
}

#autoEditLocalName {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auto-edit-workspace {
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  grid-template-columns: minmax(250px, 0.76fr) minmax(500px, 1.55fr);
  gap: 16px;
  margin-top: 8px;
}

.auto-edit-preview-column,
.auto-edit-editor-column {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.auto-edit-preview-column {
  padding: 12px;
}

.auto-edit-preview-column.has-source {
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #20252b;
}

.auto-edit-preview-column.has-source .auto-edit-preview-stage {
  background: #20252b;
}

.auto-edit-preview-stage {
  position: relative;
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #20252b;
}

.auto-edit-preview-stage.is-empty {
  border: 1px dashed #cfd6dd;
  background: #fff;
}

.auto-edit-preview-stage video {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-height: calc(100dvh - 390px);
  background: #20252b;
  object-fit: contain;
  object-position: center;
  transform: none;
}

.auto-edit-preview-load {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 5;
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 7px;
  color: #fff;
  background: rgba(24, 29, 34, 0.82);
  pointer-events: none;
}

.auto-edit-preview-load[hidden] {
  display: none !important;
}

.auto-edit-preview-load-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.auto-edit-preview-load-head span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auto-edit-preview-load-head strong {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.auto-edit-preview-load-bar {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.auto-edit-preview-load-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff6b6b, #f6a45c);
  transition: width 120ms linear;
}

@keyframes autoEditTaskScan {
  to {
    transform: translateX(100%);
  }
}

.auto-edit-preview-column.has-source .auto-edit-preview-stage video {
  max-height: none;
}

.auto-edit-delete-source {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  color: #fff;
  background: rgba(31, 38, 45, 0.78);
  box-shadow: 0 4px 14px rgba(20, 28, 36, 0.2);
  cursor: pointer;
}

.auto-edit-delete-source:hover {
  background: #c92f3d;
}

.auto-edit-delete-source:disabled {
  cursor: wait;
  opacity: 0.55;
}

.auto-edit-delete-source svg {
  width: 17px;
  height: 17px;
}

.auto-edit-delete-source[hidden] {
  display: none !important;
}

.auto-edit-preview-stage video[hidden],
.auto-edit-preview-empty[hidden],
.auto-edit-processing[hidden],
.auto-edit-tab-panel[hidden],
.auto-edit-modal[hidden] {
  display: none !important;
}

.auto-edit-preview-empty {
  display: grid;
  width: 100%;
  height: 100%;
  max-width: none;
  place-content: center;
  gap: 8px;
  padding: 24px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: center;
}

.auto-edit-preview-empty strong {
  color: var(--ink);
  font-size: 22px;
}

.auto-edit-preview-empty span {
  font-size: 12px;
  line-height: 1.6;
}

.auto-edit-processing {
  position: absolute;
  top: 48px;
  right: 14px;
  bottom: 76px;
  left: 14px;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 28px;
  border: 1px solid #e0e5ea;
  border-radius: 8px;
  color: var(--ink);
  background: #f7f8f9;
  text-align: center;
}

.auto-edit-processing .status-spinner {
  width: 54px;
  height: 54px;
  border-width: 4px;
}

#autoEditProcessingProgress {
  color: #5e6974;
  font-size: 14px;
  font-weight: 800;
}

.auto-edit-processing small {
  max-width: 360px;
  color: #69737d;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.auto-edit-processing-bar {
  width: min(360px, calc(100% - 32px));
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe4e8;
}

.auto-edit-processing-bar i {
  position: relative;
  display: block;
  width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: #c7353e;
  transition: width 220ms ease;
}

.auto-edit-processing-bar i::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  content: "";
  transform: translateX(-100%);
  animation: autoEditTaskScan 1.35s linear infinite;
}

.auto-edit-processing[data-status="failed"] .status-spinner,
.auto-edit-processing[data-status="completed"] .status-spinner {
  display: none;
}

.auto-edit-processing[data-status="failed"] .auto-edit-processing-bar i {
  background: #d54b55;
}

.auto-edit-processing[data-status="failed"] .auto-edit-processing-bar i::after,
.auto-edit-processing[data-status="completed"] .auto-edit-processing-bar i::after {
  display: none;
}

.auto-edit-processing[data-status="completed"] .auto-edit-processing-bar i {
  background: #2fa36b;
}

.auto-edit-preview-meta {
  display: none;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding-top: 10px;
}

.auto-edit-preview-meta strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auto-edit-preview-meta span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.auto-edit-editor-column {
  position: relative;
  padding: 0 14px 14px;
}

.auto-edit-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
}

.auto-edit-tabs button {
  position: relative;
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 0;
  color: #77818c;
  background: transparent;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
}

.auto-edit-tabs button.active {
  color: var(--ink);
}

.auto-edit-tabs button.active::after {
  position: absolute;
  right: auto;
  bottom: -1px;
  left: 50%;
  width: 28px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--blue);
  transform: translateX(-50%);
  content: '';
}

.auto-edit-tab-panel {
  min-height: 0;
  flex: 1 1 auto;
  padding-top: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

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

.auto-edit-template-card {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fff;
  text-align: left;
}

.auto-edit-template-card:hover {
  background: #f6f7f8;
  box-shadow: 0 6px 15px rgba(72, 89, 108, 0.08);
}

.auto-edit-template-card.active {
  border-color: rgba(179, 45, 51, 0.36);
  background: #fff;
  box-shadow: 0 7px 18px rgba(179, 45, 51, 0.12);
}

.auto-edit-template-card.active::after {
  position: absolute;
  right: 50%;
  bottom: 2px;
  width: 34px;
  height: 3px;
  border-radius: 999px;
  background: var(--red);
  content: "";
  transform: translateX(50%);
}

.auto-edit-template-preview {
  position: relative;
  display: grid;
  min-height: 0;
  aspect-ratio: 3 / 4;
  place-items: end start;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  color: #fff;
  background: #2a3138;
}

.auto-edit-template-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.auto-edit-template-card:nth-child(-n + 8) .auto-edit-template-preview img {
  transform: translateX(-1px) scale(1.055);
  transform-origin: center;
}

.auto-edit-source-dialog {
  display: grid;
  width: min(660px, 100%);
  max-height: min(680px, calc(100dvh - 40px));
  padding: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(32, 43, 54, 0.2);
}

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

.auto-edit-source-choice-grid[hidden],
.auto-edit-existing-picker[hidden] {
  display: none !important;
}

.auto-edit-source-choice-grid button {
  display: grid;
  min-height: 92px;
  place-content: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid #dce2e8;
  border-radius: 10px;
  color: var(--ink);
  background: #f8f9fa;
  text-align: center;
}

.auto-edit-source-choice-grid button:hover {
  border-color: rgba(179, 45, 51, 0.48);
  background: #fff;
}

.auto-edit-source-choice-grid span,
.auto-edit-existing-video-card small {
  color: var(--muted);
  font-size: 12px;
}

.auto-edit-existing-picker {
  display: grid;
  min-height: 0;
  overflow: hidden;
}

.auto-edit-existing-video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
}

.auto-edit-existing-video-card {
  display: grid;
  min-width: 0;
  gap: 6px;
  padding: 8px;
  border: 1px solid #dfe4e9;
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.auto-edit-existing-video-cover {
  display: grid;
  aspect-ratio: 9 / 16;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: #20252b;
}

.auto-edit-existing-video-cover video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auto-edit-existing-video-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auto-edit-existing-empty {
  grid-column: 1 / -1;
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
}

.auto-edit-template-card strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auto-edit-option-row {
  display: flex;
  gap: 22px;
  margin-top: 14px;
  padding: 12px 2px 2px;
  border-top: 1px solid var(--line);
}

.auto-edit-footer .auto-edit-option-row {
  margin: 0;
  padding: 0;
  border: 0;
}

.auto-edit-option-row label {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: #4f5964;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.auto-edit-option-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin: 0;
  accent-color: var(--blue);
}

.auto-edit-transcript-head {
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 10px;
}

.auto-edit-transcript-head span {
  color: var(--muted);
  font-size: 11px;
}

.auto-edit-title-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.auto-edit-title-fields {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
}

.auto-edit-title-fields > label {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.auto-edit-title-editor-head {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.auto-edit-title-editor-head span {
  color: var(--muted);
}

.auto-edit-title-editor input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: #fff;
}

.auto-edit-title-editor input:disabled {
  color: var(--muted);
  background: #f5f6f7;
}

.auto-edit-transcript {
  display: grid;
  gap: 8px;
}


.auto-edit-transcript-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border: 1px solid #e1e6eb;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.auto-edit-transcript-row time {
  color: var(--muted);
  font-size: 11px;
}

.auto-edit-transcript-row span {
  font-size: 13px;
  line-height: 1.55;
}

.auto-edit-transcript-row textarea {
  width: 100%;
  min-height: 58px;
  resize: vertical;
  border: 1px solid rgba(179, 45, 51, 0.42);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 13px;
  line-height: 1.55;
  cursor: text;
}

.auto-edit-transcript-row.editing {
  border-color: rgba(179, 45, 51, 0.42);
  box-shadow: 0 0 0 2px rgba(179, 45, 51, 0.08);
}

.auto-edit-transcript-row.selected {
  border-color: rgba(179, 45, 51, 0.34);
  background: #fff8f8;
}

.auto-edit-transcript-actions {
  display: flex;
  gap: 4px;
}

.auto-edit-transcript-actions button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 1px solid #dfe4e9;
  border-radius: 6px;
  color: #68727d;
  background: #fff;
}

.auto-edit-transcript-actions button:hover {
  color: var(--blue);
  border-color: rgba(38, 112, 184, 0.42);
  background: #f5f9fd;
}

.auto-edit-transcript-actions svg {
  width: 16px;
  height: 16px;
}

.auto-edit-transcript-row.removed {
  color: #9ba3ab;
  background: #f4f5f6;
}

.auto-edit-transcript-row.removed > span {
  text-decoration: line-through;
}

.auto-edit-setting-row {
  justify-content: space-between;
  gap: 20px;
  min-height: 48px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
}

.auto-edit-setting-row > div:first-child {
  display: grid;
  gap: 5px;
}

.auto-edit-setting-row strong {
  font-size: 14px;
}

.auto-edit-setting-row span {
  color: var(--muted);
  font-size: 12px;
}

#autoEditSoundPanel {
  padding-top: 0;
}

#autoEditSoundPanel .auto-edit-setting-row {
  min-height: 52px;
  padding-block: 3px;
}

#autoEditSoundPanel .auto-edit-setting-row > div:first-child {
  gap: 2px;
}

#autoEditSoundPanel .auto-edit-setting-row span {
  line-height: 1.2;
}

.auto-edit-volume-control {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 42px;
  align-items: center;
  gap: 10px;
}

.auto-edit-volume-control input[type="range"] {
  --range-progress: 78%;
  width: 100%;
  height: 20px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
}

.auto-edit-volume-control input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #2f72e8 0,
    #2f72e8 var(--range-progress),
    #dce3ec var(--range-progress),
    #dce3ec 100%
  );
}

.auto-edit-volume-control input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
  background: #2f72e8;
  box-shadow: 0 1px 3px rgba(24, 58, 112, 0.22);
}

.auto-edit-volume-control input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #dce3ec;
}

.auto-edit-volume-control input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: #2f72e8;
}

.auto-edit-volume-control input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: #2f72e8;
  box-shadow: 0 1px 3px rgba(24, 58, 112, 0.22);
}

.auto-edit-volume-control output {
  min-height: 34px;
  padding: 7px 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-size: 12px;
  text-align: center;
}

.auto-edit-switch {
  position: relative;
  display: inline-flex;
  width: 46px;
  height: 26px;
}

.auto-edit-switch input {
  position: absolute;
  opacity: 0;
}

.auto-edit-switch span {
  width: 100%;
  border-radius: 13px;
  background: #cbd2d9;
  transition: background 0.18s ease;
}

.auto-edit-switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(24, 32, 40, 0.18);
  content: '';
  transition: transform 0.18s ease;
}

.auto-edit-switch input:checked + span {
  background: var(--blue);
}

.auto-edit-switch input:checked + span::after {
  transform: translateX(20px);
}

.auto-edit-footer {
  justify-content: space-between;
  gap: 14px;
  flex: 0 0 auto;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.auto-edit-status {
  color: var(--muted);
  font-size: 12px;
}

.auto-edit-actions {
  flex: 0 0 auto;
  gap: 8px;
}

.auto-edit-actions button {
  min-width: 104px;
}

.auto-edit-actions button[hidden] {
  display: none !important;
}

.auto-edit-update-btn.is-dirty:not(:disabled) {
  border-color: #c92f3d;
  color: #fff;
  background: #c92f3d;
}

.auto-edit-update-btn.is-dirty:not(:disabled):hover {
  background: #ae2432;
}

.auto-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 31, 38, 0.28);
  backdrop-filter: blur(6px);
}

.auto-edit-export-dialog {
  width: min(440px, 100%);
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 60px rgba(32, 43, 54, 0.2);
}

.auto-edit-export-head {
  justify-content: space-between;
  margin-bottom: 18px;
}

.auto-edit-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: #66717c;
  background: #eef1f3;
  font-size: 22px;
}

.auto-edit-export-option {
  justify-content: space-between;
  min-height: 64px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.auto-edit-preview-notice {
  margin: 12px 0;
  padding: 11px 12px;
  border-radius: 7px;
  color: #6b747e;
  background: #f2f4f6;
  font-size: 12px;
  line-height: 1.55;
}

.auto-edit-export-dialog > .primary-btn {
  width: 100%;
  margin-top: 4px;
}

@media (max-width: 900px) {
  .auto-edit-panel {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .auto-edit-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .auto-edit-preview-stage {
    min-height: 520px;
  }

  .auto-edit-preview-stage video {
    height: 520px;
    max-height: 70dvh;
  }

  .auto-edit-editor-column {
    min-height: 520px;
  }
}

@media (max-width: 680px) {
  .step-nav {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .step-nav::-webkit-scrollbar {
    display: none;
  }

  .step-nav > button,
  .step-nav > .realtime-nav-item {
    min-width: 82px;
    flex: 0 0 82px;
    scroll-snap-align: start;
  }

  .auto-edit-segmented {
    width: 100%;
  }

  .auto-edit-source-control {
    width: 100%;
  }

  .auto-edit-preview-stage {
    min-height: 430px;
  }

  .auto-edit-preview-stage video {
    height: 430px;
  }

  .auto-edit-editor-column {
    min-height: 500px;
    padding: 12px;
  }

  .auto-edit-processing {
    top: 60px;
    right: 12px;
    bottom: 128px;
    left: 12px;
  }

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

  .auto-edit-source-choice-grid,
  .auto-edit-existing-video-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .auto-edit-transcript-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .auto-edit-transcript-row time {
    grid-column: 1 / -1;
  }

  .auto-edit-setting-row {
    align-items: stretch;
    flex-direction: column;
  }

  .auto-edit-volume-control {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .auto-edit-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .auto-edit-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
}

/* AI analysis uses the same conversation frame as AI chat. */
section[data-stage="elements"] .analysis-chat-log {
  min-height: 0;
  padding: 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

section[data-stage="elements"] .analysis-chat-message.chat-msg {
  width: fit-content;
  max-width: min(760px, 88%);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

section[data-stage="elements"] .analysis-chat-message.chat-msg.assistant {
  width: min(760px, 88%);
  padding: 0;
}

section[data-stage="elements"] .analysis-chat-message.chat-msg.user {
  width: fit-content;
  max-width: min(760px, 88%);
  padding: 0;
  border: 0;
  background: transparent;
}

section[data-stage="elements"] .analysis-chat-composer {
  flex-shrink: 0;
}

section[data-stage="elements"] .analysis-chat-composer textarea {
  padding: 1px 2px;
}

section[data-stage="elements"] #chatSendBtn {
  min-width: 38px;
  width: 38px;
  height: 38px;
  border-color: rgba(146, 34, 42, 0.36);
  color: #fff;
  background: linear-gradient(145deg, #ca3942, #aa2730);
  box-shadow: 0 5px 12px rgba(179, 45, 51, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

section[data-stage="elements"] #chatSendBtn:hover:not(:disabled) {
  border-color: rgba(146, 34, 42, 0.36);
  color: #fff;
  background: linear-gradient(145deg, #d34750, #b12b34);
}

@media (max-width: 980px) {
  .ai-analysis-main-head {
    min-height: auto;
    align-items: stretch;
    flex-direction: column;
  }

  .ai-analysis-scope-panel {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .ai-analysis-main-head .scope-box,
  .ai-analysis-main-head .scope-unified-card {
    width: 100%;
  }
}

/* Mobile uses one viewport. Long content scrolls inside the active workspace,
   so the header, workspace switcher and four-item bottom navigation stay put. */
@media (max-width: 680px) {
  html,
  body {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden !important;
  }

  body {
    height: 100dvh;
    padding-bottom: 0 !important;
  }

  .app-shell {
    box-sizing: border-box;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 10px 10px calc(72px + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .hero,
  .mobile-workspace-nav {
    flex: 0 0 auto;
  }

  .mobile-workspace-nav {
    position: relative;
    top: auto;
    flex-shrink: 0;
  }

  main {
    display: flex;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    overflow: hidden !important;
  }

  .stage.active {
    flex: 1 1 auto;
    min-height: 0;
    height: 100% !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }

  .stage.active::-webkit-scrollbar {
    display: none;
  }

  section[data-stage="ai-chat"].active {
    overflow: hidden !important;
  }

  section[data-stage="ai-chat"] .ai-chat-workspace {
    height: 100% !important;
    min-height: 0 !important;
  }

  section[data-stage="ai-chat"] .ai-chat-main,
  section[data-stage="ai-chat"] .ai-chat-log {
    min-height: 0;
  }

  section[data-stage="ai-chat"] .ai-chat-log {
    overscroll-behavior: contain;
  }

  /* Keep the regular AI chat composer as one continuous writing surface. */
  section[data-stage="ai-chat"] .ai-chat-composer {
    position: relative;
    min-height: 126px;
    margin: 0 4px 4px;
    padding: 13px 14px 48px;
    border-radius: 18px;
  }

  section[data-stage="ai-chat"] .ai-chat-composer textarea {
    min-height: 64px;
    padding: 0;
  }

  section[data-stage="ai-chat"] .ai-chat-composer-actions {
    position: absolute;
    right: 12px;
    bottom: 10px;
    left: 12px;
    min-height: 32px;
    padding: 0;
    border-top: 0;
  }

  section[data-stage="ai-chat"] .ai-chat-composer-hint {
    display: none;
  }

  section[data-stage="ai-chat"] .ai-chat-composer-model-select {
    width: min(178px, calc(100vw - 142px));
    max-width: none;
    height: 32px;
    padding-right: 24px;
    font-size: 12px;
  }

  section[data-stage="ai-chat"] .ai-chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }
}
.source-material-progress {
  display: grid;
  gap: 6px;
  margin: 10px 0 4px;
}

.source-material-progress > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #475569;
  font-size: 12px;
}

.source-material-progress > div strong {
  color: #1f2937;
  font-variant-numeric: tabular-nums;
}

.source-material-progress > i {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: #e5e7eb;
}

.source-material-progress > i > b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #dc2626;
  transition: width 240ms ease;
}

@media (max-width: 980px) {
  .account-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .account-toolbar label,
  .account-toolbar .account-search-field {
    min-width: 0;
  }

  .account-toolbar .account-search-field {
    grid-column: 1 / -1;
  }

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

  .account-ip-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .account-ip-tabs button {
    min-width: 0;
    padding: 0 10px;
  }

  .account-ip-stats {
    flex-wrap: wrap;
    gap: 8px 14px;
  }

  .account-editor-overlay {
    align-items: end;
    padding: 10px;
  }

  .account-detail-overlay {
    align-items: end;
    padding: 10px;
  }

  .account-editor {
    max-height: calc(100dvh - 20px);
    padding: 16px;
    border-radius: 16px 16px 12px 12px;
  }

  .account-detail-dialog {
    max-height: calc(100dvh - 20px);
    padding: 16px;
    border-radius: 16px 16px 12px 12px;
  }

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

@media (max-width: 680px) {
  .youshu-topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 14px 16px;
  }

  .youshu-topbar-status {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .youshu-body {
    display: block;
  }

  .youshu-sidebar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid #e1e7f0;
  }

  .youshu-sidebar-title {
    display: none;
  }

  .youshu-module-button {
    width: auto;
    min-width: max-content;
    margin: 0;
  }

  .youshu-sidebar-title.secondary {
    display: none;
  }

  .youshu-module-panel {
    padding: 18px;
  }

  .youshu-module-panel-head {
    display: block;
  }

  .youshu-module-actions {
    margin-top: 16px;
  }

  .youshu-search-field input {
    width: min(220px, 48vw);
  }
}
