:root {
  --bg: #f4f7fb;
  --card: #fff;
  --text: #172033;
  --muted: #64748b;
  --line: #e2e8f0;
  --blue: #2563eb;
  --green: #16a34a;
  --orange: #d97706;
  --red: #dc2626;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 14px;
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  border-color: #cbd5e1;
  background: #f1f5f9;
  color: #64748b;
  opacity: 1;
}

button.small {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
}

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

button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}

button.primary-soft {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
}

button.attention {
  border-color: #f97316 !important;
  background: #fff7ed !important;
  color: #c2410c !important;
  font-weight: 900;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 12px;
}

.search-input {
  min-width: 180px;
}

.shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

main,
.page,
.card,
.niuma-work,
.work-left,
.niuma-main,
.niuma-side,
.video-stage,
.upload-panel {
  min-width: 0;
}

aside {
  padding: 34px 28px;
  background: radial-gradient(circle at 18% 8%, rgba(37, 99, 235, 0.13), transparent 28%), #0b1427;
  color: white;
}

body.login-mode .shell { grid-template-columns: minmax(0, 1fr); }
body.login-mode aside { display: none; }
body.login-mode { min-height: 100%; overflow: hidden; background: #030b1d; }
body.login-mode .shell { min-height: 100%; }
body.login-mode main { min-height: 100%; padding: 0; overflow: hidden; background: radial-gradient(circle at 50% 100%, rgba(37,99,235,.2), transparent 42%), #030b1d; }
body.login-mode .login { font-family: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Helvetica Neue", sans-serif; }

.home-brand {
  font-size: 19px;
  font-weight: 850;
  letter-spacing: .05em;
}

aside h1 {
  margin: 25px 0 8px;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: -.025em;
}

.home-subtitle {
  margin: 0;
  color: #9aa9c2;
  font-size: 14px;
  line-height: 1.6;
}

.workspace-nav {
  display: grid;
  gap: 16px;
  margin: 38px 0 24px;
}

.workspace-nav button {
  border: 0;
  text-align: left;
}

.workspace-card {
  position: relative;
  display: grid;
  gap: 17px;
  width: 100%;
  min-height: 150px;
  padding: 22px 20px 18px;
  overflow: hidden;
  border-radius: 24px !important;
  transition: transform .18s ease, box-shadow .18s ease;
}

.workspace-card:hover { transform: translateY(-2px); }
.workspace-card:focus-visible,
.workspace-admin-link:focus-visible,
.home-account button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }
.workspace-card-work { background: #fff !important; color: #0b1427 !important; box-shadow: 0 18px 46px rgba(0,0,0,.18); }
.workspace-card-ai { background: linear-gradient(135deg, #2563eb 0%, #4f46e5 60%, #7c3aed 100%) !important; color: #fff !important; box-shadow: 0 18px 42px rgba(37,99,235,.24); }
.workspace-card-image { background: linear-gradient(135deg, #047857 0%, #0f766e 58%, #0369a1 100%) !important; color: #fff !important; box-shadow: 0 18px 42px rgba(5,150,105,.2); }
.workspace-card-copy { display: grid; gap: 7px; padding-right: 25px; }
.workspace-card-copy strong { font-size: 21px; line-height: 1.2; }
.workspace-card-copy small { color: #52627d; font-size: 13px; line-height: 1.55; }
.workspace-card-ai .workspace-card-copy small { color: rgba(255,255,255,.82); }
.workspace-card-image .workspace-card-copy small { color: rgba(255,255,255,.82); }
.workspace-title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.workspace-title-line em { border: 1px solid rgba(255,255,255,.24); border-radius: 999px; background: rgba(255,255,255,.14); padding: 4px 8px; color: #fff; font-size: 10px; font-style: normal; font-weight: 800; }
.workspace-arrow { position: absolute; top: 27px; right: 18px; font-size: 32px; font-weight: 300; line-height: 1; }
.workspace-status { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 28px; border-top: 1px solid #e2e8f0; padding-top: 15px; color: #52627d; font-size: 12px; text-align: center; }
.workspace-status > span { white-space: nowrap; }
.workspace-status b { color: #2563eb; font-size: 16px; }
.workspace-ai-status { justify-content: flex-start; border-color: rgba(255,255,255,.22); color: rgba(255,255,255,.9); }
.workspace-ai-status i { width: 9px; height: 9px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74,222,128,.13); }
.workspace-admin-link { justify-self: stretch; display: flex; align-items: center; justify-content: space-between; min-height: 46px; border: 1px solid rgba(147,197,253,.18) !important; border-radius: 14px; background: rgba(30,64,175,.12) !important; color: #dbeafe; padding: 11px 14px !important; font-size: 16px; font-weight: 750; }
.workspace-admin-link:hover { background: rgba(37,99,235,.2) !important; color: #fff; }
.workspace-admin-link::after { content: "→"; color: #93c5fd; font-size: 17px; }
.home-account { display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid rgba(148,163,184,.28); border-radius: 18px; background: rgba(15,23,42,.8); padding: 16px; }
.home-account > div:first-child { display: grid; gap: 3px; }
.home-account b { color: #f8fafc; font-size: 16px; }
.home-account span { color: #cbd5e1; font-size: 13px; }
.home-account-actions { display: flex; align-items: center; gap: 2px; }
.home-account-actions button { border: 0; background: transparent; color: #dbeafe; padding: 8px 7px; font-size: 13px; font-weight: 650; }
.home-account-actions button:hover { color: #fff; background: rgba(255,255,255,.08); }
.feature-locked { filter: saturate(.72); }
.permission-editor { display: grid; gap: 7px; min-width: 132px; }
.permission-editor label { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 12px; }
.permission-editor input { width: 15px; height: 15px; margin: 0; }
.permission-editor button { width: fit-content; }

@media (max-width: 980px) {
  aside { min-height: 100svh; padding: 28px 20px 34px; }
  aside h1 { margin-top: 30px; font-size: clamp(34px, 10vw, 46px); }
  .home-subtitle { font-size: 16px; }
  .workspace-nav { margin-top: 42px; }
  .workspace-card { min-height: 168px; padding: 24px 22px 20px; }
  .workspace-card-copy strong { font-size: 24px; }
  .workspace-card-copy small { font-size: 15px; }
  .workspace-status { font-size: 14px; }
  .workspace-status b { font-size: 18px; }
}

main {
  padding: 30px;
}

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

.header-actions {
  display: flex;
  gap: 10px;
}

h2,
h3,
p {
  margin-top: 0;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.hidden {
  display: none !important;
}

.login {
  --login-edge: clamp(18px, 3.2vmin, 44px);
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: var(--login-edge);
  overflow: hidden;
}

body.login-mode #loginPage.login {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: auto;
  height: auto;
  min-height: 0;
}

.card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  padding: 22px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.login-card {
  width: 100%;
  display: grid;
  gap: 12px;
  align-content: center;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  border: 0;
  border-radius: 0 26px 26px 0;
  padding: clamp(38px, 4.2vw, 66px);
  box-shadow: none;
}

.auth-stack {
  display: grid;
  grid-template-columns: minmax(0, 1.46fr) minmax(420px, .84fr);
  width: min(1460px, 100%);
  height: min(760px, calc(100vh - (var(--login-edge) * 2)));
  height: min(760px, calc(100dvh - (var(--login-edge) * 2)));
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(96,165,250,.55);
  border-radius: 26px;
  background: #07152f;
  box-shadow: 0 34px 90px rgba(0,0,0,.42), 0 0 70px rgba(37,99,235,.12);
}

.login-showcase { position: relative; min-height: 0; height: 100%; overflow: hidden; background-color: #06142f; background-image: url("./assets/login-ai-orb.jpg"); background-position: center center; background-size: cover; background-repeat: no-repeat; color: #fff; }
.login-showcase::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3,11,29,.1), transparent 58%, rgba(3,11,29,.08)); }
.login-showcase-copy { position: relative; z-index: 1; max-width: 780px; padding: clamp(42px, 4.2vw, 68px); }
.login-showcase-copy > span { display: inline-flex; align-items: center; gap: 10px; color: #dbeafe; font-size: 18px; font-weight: 650; letter-spacing: .12em; }
.login-showcase-copy > span::before { content: ""; width: 24px; height: 3px; border-radius: 99px; background: linear-gradient(90deg, #38bdf8, #8b5cf6); box-shadow: 0 0 16px rgba(56,189,248,.55); }
.login-showcase-copy h1 { margin: 24px 0 22px; font-size: clamp(42px, 4vw, 64px); line-height: 1.12; font-weight: 700; letter-spacing: -.02em; }
.login-showcase-copy .login-slogan { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 26px; min-height: 40px; margin: 0; border-left: 3px solid #60a5fa; padding: 2px 0 2px 18px; color: #e0e7ff; font-size: clamp(17px, 1.5vw, 22px); font-weight: 500; line-height: 1.65; letter-spacing: .075em; }
.login-feature-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.login-feature-tags i { border: 1px solid rgba(96,165,250,.55); border-radius: 9px; background: rgba(15,23,42,.32); padding: 10px 16px; color: #e0e7ff; font-size: 15px; font-style: normal; font-weight: 500; letter-spacing: .035em; }
.login-card h2 { margin: 4px 0 0; font-size: clamp(34px, 3vw, 46px); font-weight: 700; letter-spacing: -.02em; }
.login-help { margin: -3px 0 18px; color: #667085; }
.login-card input { min-height: 54px; }
.login-card .primary { min-height: 56px; background: linear-gradient(100deg, #2563eb, #7c3aed); font-size: 16px; box-shadow: 0 12px 28px rgba(79,70,229,.24); }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.auth-tabs button {
  background: #f8fafc;
}

.auth-tabs button.active {
  border-color: var(--blue);
  background: #eff6ff;
  color: var(--blue);
  font-weight: 900;
}
.auth-switch-row { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 4px; color: #64748b; font-size: 13px; }
.auth-switch-row button { min-height: auto; border: 0; background: transparent; padding: 5px 3px; color: #2563eb; font-size: 13px; font-weight: 750; }
.auth-switch-row button:hover { color: #1d4ed8; text-decoration: underline; }
.login-password-help { display: flex; justify-content: flex-end; margin: -4px 0 2px; }
.login-password-help button { min-height: auto; border: 0; background: transparent; padding: 3px 0; color: #2563eb; font-size: 13px; font-weight: 700; }
.login-password-help button:hover { color: #1d4ed8; text-decoration: underline; }

.centered-notice-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(3px);
}

.centered-notice {
  width: min(420px, 100%);
  border: 1px solid #dbe3f0;
  border-radius: 20px;
  background: #fff;
  padding: 28px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
  text-align: center;
}

.centered-notice b { display: block; font-size: 20px; }
.centered-notice p { margin: 12px 0 22px; color: #475467; font-size: 15px; line-height: 1.7; }
.centered-notice button { min-width: 140px; }
.centered-notice-actions { display: flex; justify-content: center; gap: 10px; }
.centered-notice-actions button { min-height: 44px; }

@media (max-width: 1100px) {
  .auth-stack { grid-template-columns: minmax(0, 1.18fr) minmax(400px, .82fr); }
  .login-showcase-copy { padding: 42px; }
  .login-showcase-copy h1 { font-size: clamp(38px, 4.5vw, 52px); }
  .login-showcase-copy .login-slogan { font-size: 17px; }
  .login-card { padding: 38px; }
}

@media (max-width: 900px) {
  body.login-mode main { min-height: 100%; }
  body.login-mode #loginPage.login { padding: 24px; overflow-y: auto; background: radial-gradient(circle at 50% 0%, rgba(37,99,235,.22), transparent 45%); }
  .auth-stack { grid-template-columns: 1fr; width: min(520px, 100%); height: auto; min-height: 0; max-height: none; background: #fff; }
  .login-showcase { display: none; }
  .login-card { min-height: auto; height: auto; overflow: visible; border-radius: 24px; padding: 40px 34px; }
}

@media (min-width: 901px) and (max-height: 780px) {
  .login { --login-edge: clamp(14px, 2.5vh, 24px); }
  .auth-stack {
    height: calc(100vh - (var(--login-edge) * 2));
    height: calc(100dvh - (var(--login-edge) * 2));
  }
  .login-showcase-copy { padding: 30px 42px; }
  .login-showcase-copy > span { font-size: 16px; }
  .login-showcase-copy h1 { margin: 14px 0 12px; font-size: clamp(36px, 4vw, 50px); }
  .login-showcase-copy .login-slogan { font-size: 17px; line-height: 1.5; }
  .login-feature-tags { margin-top: 16px; }
  .login-feature-tags i { padding: 8px 13px; font-size: 14px; }
  .login-card { padding: 28px 38px; }
  .login-card h2 { font-size: 32px; }
  .login-help { margin-bottom: 12px; }
  .login-card input { min-height: 50px; }
  .login-card .primary { min-height: 52px; }
  .auth-form { gap: 10px; }
}

@media (max-width: 560px) {
  body.login-mode { background: #fff; }
  body.login-mode main { background: #fff; }
  body.login-mode #loginPage.login { padding: 0; background: #fff; }
  .auth-stack { width: 100%; min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  .login-card { justify-content: stretch; min-height: 100dvh; border-radius: 0; padding: max(34px, env(safe-area-inset-top)) 24px max(30px, env(safe-area-inset-bottom)); }
  .login-card h2 { font-size: 34px; }
}

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

.grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 18px;
}

.employee-top {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.employee-top article {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  padding: 16px 18px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.06);
}

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

.employee-top b {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.daily-motivation {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 58px;
  margin: -3px 0 18px;
  padding: 10px 14px;
  border: 1px solid #fde0a2;
  border-radius: 16px;
  background: linear-gradient(90deg, #fff9ed 0%, #fffdf8 100%);
  color: #714a12;
}

.daily-motivation-mark {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: #fff0c8;
  color: #d68b00;
  font-size: 18px;
}

.daily-motivation p {
  flex: 1;
  margin: 0;
  color: #79531d;
  font-size: 15px;
  font-weight: 700;
}

.daily-motivation-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.daily-motivation-actions button {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #efd8a5;
  border-radius: 9px;
  background: #fff;
  color: #8a621f;
  font-size: 13px;
  white-space: nowrap;
}

.daily-motivation-actions button:hover {
  border-color: #e2b85c;
  background: #fff7e7;
}

.top-balance {
  display: block;
  margin-top: 8px;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 800;
}

.admin-lowfreq-tools .lowfreq-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.admin-lowfreq-tools .bulk-user-box {
  margin-top: 16px;
}

.niuma-work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: 18px;
  align-items: start;
  max-width: 100%;
  overflow-x: hidden;
}

.work-left {
  display: grid;
  gap: 18px;
  align-content: start;
}

.work-left .records-card {
  margin-top: 0;
}

.niuma-main {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.upload-panel {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  align-content: stretch;
  border: 1.5px dashed #93c5fd;
  border-radius: 18px;
  background: #eff6ff;
  padding: 20px;
  cursor: pointer;
  height: 520px;
  max-height: 520px;
  overflow: hidden;
}

.upload-panel > *,
.upload-panel p,
.upload-panel button,
.upload-file-list,
.upload-progress {
  min-width: 0;
  max-width: 100%;
}

.upload-panel p,
#uploadMsg,
.upload-limit {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.upload-panel button.primary {
  position: relative;
  z-index: 2;
  width: 100%;
  background: var(--blue);
  opacity: 1;
}

.upload-panel > div:first-child {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.upload-panel:has(.upload-file-item) {
  cursor: default;
}

.upload-panel.dragging {
  border-color: var(--blue);
  background: #dbeafe;
}

.upload-panel input[type="file"] {
  display: none;
}

.upload-progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}

.upload-progress div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  transition: width 0.18s ease;
}

.upload-file-list {
  display: grid;
  gap: 8px;
  max-height: 270px;
  overflow: auto;
  padding-right: 2px;
}

.upload-list-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0 8px;
  background: #eff6ff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.upload-file-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
  padding: 10px 12px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.upload-file-item.selectable {
  cursor: pointer;
}

.upload-file-item.selectable:hover {
  border-color: #60a5fa;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

.upload-file-item.active {
  border: 2px solid #1d4ed8;
  background: #dbeafe;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22), 0 12px 24px rgba(37, 99, 235, 0.18);
  transform: translateX(2px);
}

.upload-file-item.active::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 10px;
  bottom: 10px;
  width: 5px;
  border-radius: 999px;
  background: #1d4ed8;
}

.upload-file-item.uploaded {
  border-color: #86efac;
  background: #f0fdf4;
}

.upload-file-item.uploaded.active {
  border-color: #2563eb;
  background: #dbeafe;
}

.upload-file-item.ready {
  border-color: #22c55e;
  background: #ecfdf5;
}

.upload-file-item.ready .upload-file-title span {
  color: #15803d;
}

.upload-file-item.ready.active {
  border-color: #2563eb;
  background: #dbeafe;
}

.upload-file-item.active b,
.upload-file-item.uploaded.active b {
  color: #1d4ed8;
}

.upload-file-item.failed {
  border-color: #fecaca;
  background: #fef2f2;
}

.upload-file-item.deleting {
  opacity: 0.58;
  pointer-events: none;
}

.upload-file-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  min-width: 0;
}

.upload-file-main {
  min-width: 0;
}

.upload-file-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.upload-file-item b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.upload-file-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-item span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.upload-file-bar {
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}

.upload-file-bar i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  transition: width 0.18s ease;
}

.upload-file-item.uploaded .upload-file-bar {
  background: #dcfce7;
}

.upload-file-item.uploaded .upload-file-bar i {
  background: linear-gradient(90deg, #16a34a, #86efac);
}

.upload-file-item.failed .upload-file-bar {
  background: #fee2e2;
}

.upload-file-item.failed .upload-file-bar i {
  background: linear-gradient(90deg, #dc2626, #fca5a5);
}

.niuma-side {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 16px;
  overflow-wrap: anywhere;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-toggle label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #f8fafc;
  color: #334155;
  font-weight: 800;
}

.mode-toggle label:has(input:disabled) {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #64748b;
}

.mode-toggle input {
  width: auto;
}

.advanced-mask {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
}

.advanced-mask summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 900;
}

.advanced-mask .mask-form {
  margin-top: 12px;
}

.action-stack {
  display: grid;
  gap: 10px;
}

.usage-help {
  border-radius: 16px;
  background: #f8fafc;
  padding: 14px;
  color: var(--muted);
  line-height: 1.7;
}

.usage-help ol {
  margin: 8px 0 0 18px;
  padding: 0;
}

.records-card {
  margin-top: 18px;
}

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

.error {
  color: var(--red);
}

.upload-limit {
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e40af;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}

.app-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.32);
}

.app-modal {
  width: min(420px, calc(100vw - 48px));
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  padding: 22px;
}

.app-modal p {
  margin: 0 0 18px;
  color: var(--text);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.app-modal-actions {
  display: flex;
  justify-content: center;
}

.app-modal-actions button {
  min-width: 92px;
}

.preview-notice {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 12;
  display: grid;
  gap: 12px;
  width: min(420px, calc(100% - 48px));
  transform: translate(-50%, -50%);
  border: 1px solid rgba(147, 197, 253, 0.38);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 18px 20px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.35);
}

.preview-notice p {
  margin: 0;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.preview-notice button {
  justify-self: center;
  min-width: 88px;
  border-color: rgba(255, 255, 255, 0.22);
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.ai-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #f4f7ff, #f7fbff 58%, #eefbf6);
}

.ai-hero h2,
.ai-product-editor h3,
.ai-coming-card h3 {
  margin: 4px 0 8px;
}

.ai-stage-badge {
  white-space: nowrap;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  background: #ecfdf3;
  color: #067647;
  padding: 9px 13px;
  font-weight: 700;
}

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

.ai-product-list,
.ai-product-editor {
  display: grid;
  gap: 12px;
}

.ai-product-editor {
  gap: 18px;
  padding: 28px;
}

.ai-product-editor h3 {
  margin-bottom: 2px;
  font-size: 22px;
}

.ai-section-note {
  margin: 7px 0 0;
  color: #667085;
  font-size: 16px;
  line-height: 1.6;
}

.ai-product-list-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ai-product-editor label {
  display: grid;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #344054;
}

.ai-product-editor input,
.ai-product-editor textarea {
  min-height: 48px;
  border-color: #d0d5dd;
  padding: 13px 14px;
  background: #fff;
  color: #1d2939;
  font-size: 15px;
  line-height: 1.6;
}

.ai-product-editor textarea { min-height: 88px; }

.ai-product-review {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 8px;
  border-top: 1px solid #e4e7ec;
  padding-top: 22px;
}

.ai-product-review .ai-review-head,
.ai-product-review > .primary {
  grid-column: 1 / -1;
}

.ai-direct-upload {
  display: grid;
  gap: 13px;
  border: 1px dashed #98a2b3;
  border-radius: 18px;
  background: #fff;
  padding: 20px;
}

.ai-direct-upload-head { display: grid; justify-items: start; gap: 7px; }
.ai-direct-upload-head strong { color: #101828; font-size: 20px; line-height: 1.3; }
.ai-direct-upload-head span { border-radius: 999px; background: #dbeafe; padding: 6px 10px; color: #174ea6; font-size: 14px; font-weight: 800; }
.ai-material-file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
.ai-material-picker { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px; border: 1px solid #d0d9e8; border-radius: 14px; background: #fff; padding: 12px; }
.ai-material-picker > label { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 11px; background: #2563eb; padding: 10px 20px; color: #fff !important; font-size: 15px; font-weight: 800; cursor: pointer; white-space: nowrap; text-shadow: 0 1px 1px rgba(15,23,42,.18); }
.ai-material-picker > label:hover { background: #1d4ed8; color: #fff !important; }
.ai-material-picker > div { min-width: 0; }
.ai-material-picker b { display: block; overflow: hidden; color: #1d2939; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.ai-material-picker small { display: block; margin-top: 5px; color: #52627d; font-size: 13px; }
.ai-upload-rule { color: #475467; font-size: 14px; line-height: 1.7; }
.ai-material-progress { height: 8px; overflow: hidden; border-radius: 999px; background: #dfe7f3; }
.ai-material-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2563eb, #06b6d4); transition: width .2s ease; }
#aiMaterialUploadMsg { min-height: 20px; color: #52627d; font-size: 13px; line-height: 1.5; }

.ai-processing-banner { display: flex; align-items: center; gap: 12px; margin: 14px 0; border: 1px solid #b2ccff; border-radius: 14px; background: #eff6ff; padding: 14px 16px; color: #174ea6; }
.ai-processing-banner i { width: 12px; height: 12px; flex: 0 0 auto; border-radius: 50%; background: #2563eb; box-shadow: 0 0 0 6px rgba(37,99,235,.12); animation: ai-processing-pulse 1.4s ease-in-out infinite; }
.ai-processing-banner div { display: grid; gap: 3px; }
.ai-processing-banner b { color: #102a56; font-size: 16px; }
.ai-processing-banner span { font-size: 14px; font-weight: 700; }
@keyframes ai-processing-pulse { 50% { opacity: .55; transform: scale(.85); } }

.ai-segment-tools,
.ai-segment-times { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ai-segment-tools { margin: 10px 0; }
.ai-segment-tools select { width: auto; min-width: 130px; }
.ai-segment-video { position: relative; display: grid; gap: 8px; width: min(100%, 320px); justify-self: center; }
.ai-segment-preview { width: 100%; height: 420px; border-radius: 12px; background: #0f172a; object-fit: contain; cursor: zoom-in; }
.ai-video-click-hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 20px); border-radius: 999px; background: rgba(15,23,42,.78); padding: 6px 10px; color: #fff; font-size: 13px; font-weight: 800; pointer-events: none; }
.open-ai-video-preview { width: 100%; color: #175cd3; font-weight: 800; }
.ai-video-modal-backdrop { position: fixed; inset: 0; z-index: 10020; display: grid; place-items: center; padding: 22px; background: rgba(2, 6, 23, .82); }
.ai-video-modal { display: grid; gap: 12px; width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border-radius: 18px; background: #0b1220; padding: 14px; box-shadow: 0 28px 80px rgba(0,0,0,.45); }
.ai-video-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #fff; }
.ai-video-modal-head button { border-color: #344054; background: #1d2939; color: #fff; }
.ai-video-modal video { width: 100%; height: min(72vh, 760px); border-radius: 12px; background: #000; object-fit: contain; }
.ai-segment-times label { display: flex; align-items: center; gap: 6px; color: #667085; font-size: 12px; }
.ai-segment-times input { width: 92px; }

.ai-proposal-list { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 18px 0; }
.ai-proposal-card { display: grid; gap: 12px; align-content: start; border: 1px solid #dbe3f0; border-radius: 16px; background: #fff; padding: 20px; }
.ai-proposal-card em { color: #175cd3; font-size: 14px; font-style: normal; font-weight: 800; }
.ai-proposal-card h5 { margin: 0; font-size: 19px; line-height: 1.5; }
.ai-proposal-card p { margin: 0; font-size: 15px; line-height: 1.75; }
.ai-proposal-card > b { font-size: 16px; line-height: 1.7; }
.ai-proposal-card ol { margin: 0; padding-left: 24px; color: #344054; font-size: 15px; line-height: 1.8; }
.ai-proposal-card small { color: #b54708; font-size: 14px; line-height: 1.7; }
.ai-proposal-card button { min-height: 46px; font-size: 15px; }
@media (max-width: 980px) { .ai-proposal-list { grid-template-columns: 1fr; } }

.image-workspace { display: grid; min-width: 0; grid-template-columns: minmax(0,1fr); gap: 24px; align-items: start; }
.image-workspace > * { min-width: 0; }
.image-generator-form { display: grid; gap: 20px; padding: 30px; border-radius: 24px; }
.image-form-head { display: grid; gap: 7px; padding-bottom: 4px; }
.image-form-head p, .image-form-head h3 { margin: 0; }
.image-form-head h3 { font-size: 27px; line-height: 1.35; letter-spacing: -.02em; }
.image-form-head span { color: #667085; font-size: 15px; line-height: 1.7; }
.image-form-section { display: grid; gap: 15px; border: 1px solid #e2e8f0; border-radius: 18px; background: #fbfcfe; padding: 20px; }
.image-step-head { display: flex; align-items: flex-start; gap: 12px; }
.image-step-head > span { display: grid; flex: 0 0 32px; height: 32px; place-items: center; border-radius: 10px; background: #eaf1ff; color: #175cd3; font-size: 15px; font-weight: 900; }
.image-step-head > div { display: grid; gap: 3px; }
.image-step-head b { color: #172033; font-size: 17px; line-height: 1.4; }
.image-step-head small { color: #667085; font-size: 13px; font-weight: 500; line-height: 1.6; }
.image-generator-form label { display: grid; gap: 8px; color: #1d2939; font-size: 15px; font-weight: 750; }
.image-generator-form input,
.image-generator-form select,
.image-generator-form textarea { min-height: 48px; border-radius: 12px; padding: 11px 13px; font-size: 15px; line-height: 1.6; }
.image-generator-form textarea { min-height: 100px; }
.image-generator-form > button { min-height: 48px; font-size: 15px; }
.image-field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.image-template-section { background: linear-gradient(145deg,#f8fbff,#fff); border-color: #cfe0ff; }
.image-template-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.image-template-choice { position: relative; display: grid; min-height: 88px; gap: 5px; align-content: center; border: 1px solid #d7dfeb; border-radius: 14px; background: #fff; padding: 14px 15px; text-align: left; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.image-template-choice:hover { border-color: #84adff; background: #f8fbff; }
.image-template-choice.active { border-color: #3b73f1; background: #edf4ff; box-shadow: 0 0 0 2px rgba(59,115,241,.1); }
.image-template-choice b { color: #172033; font-size: 15px; }
.image-template-choice small { color: #667085; font-size: 12px; line-height: 1.55; }
.image-template-choice em { position: absolute; top: 10px; right: 10px; border-radius: 999px; background: #2563eb; padding: 3px 7px; color: #fff; font-size: 11px; font-style: normal; font-weight: 800; }
.image-template-preview { display: grid; gap: 8px; }
.image-template-slot { display: grid; grid-template-columns: 64px 112px minmax(0,1fr); gap: 10px; align-items: center; border: 1px solid #e4eaf3; border-radius: 12px; background: rgba(255,255,255,.92); padding: 10px 12px; }
.image-template-slot > span { color: #2563eb; font-size: 13px; font-weight: 850; }
.image-template-slot b { color: #1d2939; font-size: 14px; }
.image-template-slot small { color: #667085; font-size: 13px; line-height: 1.55; }
.image-reference-field { border-color: #c7d7f0; background: #f8fbff; }
.image-reference-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.image-reference-picker { display: grid !important; place-items: center; gap: 7px !important; min-height: 126px; border: 2px dashed #84adff; border-radius: 15px; background: #fff; padding: 20px; text-align: center; cursor: pointer; }
.image-reference-picker:hover { border-color: #2563eb; background: #f5f8ff; }
.image-reference-picker strong { display: inline-flex; align-items: center; justify-content: center; min-width: 170px; min-height: 42px; border-radius: 11px; background: #2563eb; padding: 9px 18px; color: #fff; font-size: 15px; }
.image-reference-picker small { color: #52627d; font-size: 13px; font-weight: 550; }
.image-reference-preview { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; }
.image-reference-preview:empty { display: none; }
.image-reference-preview article { position: relative; min-width: 0; border: 1px solid #d0d9e8; border-radius: 12px; background: #fff; padding: 7px; box-shadow: 0 5px 14px rgba(23,32,51,.05); }
.image-reference-preview img { width: 100%; aspect-ratio: 1; border-radius: 7px; object-fit: cover; }
.image-reference-preview article > div { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 5px 2px 1px; }
.image-reference-preview small { display: block; min-width: 0; overflow: hidden; color: #344054; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.image-reference-preview button { flex: 0 0 auto; min-height: 30px; border-color: #f5b7b1; border-radius: 8px; padding: 4px 9px; color: #b42318; font-size: 12px; font-weight: 750; }
.image-reference-preview button:hover { border-color: #f04438; background: #fff1f0; }
.image-reference-number { position: absolute; z-index: 1; top: 13px; left: 13px; display: grid; width: 26px; height: 26px; place-items: center; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; background: rgba(17,24,39,.76); color: #fff; font-size: 12px; font-weight: 850; box-shadow: 0 2px 7px rgba(0,0,0,.18); }
.image-brief-section textarea { border-color: #d6deea; background: #fff; }
.image-auto-review-note { display: flex; align-items: flex-start; gap: 13px; border: 1px solid #b9e6d3; border-radius: 16px; background: linear-gradient(135deg,#ecfdf3,#f5fbff); padding: 17px 18px; }
.image-auto-review-note > span { flex: 0 0 auto; border-radius: 999px; background: #067647; padding: 6px 10px; color: #fff; font-size: 12px; font-weight: 850; }
.image-auto-review-note > div { display: grid; gap: 4px; }
.image-auto-review-note b { color: #17352a; font-size: 15px; line-height: 1.45; }
.image-auto-review-note small { color: #49695e; font-size: 13px; line-height: 1.65; }
.image-generate-button { min-height: 58px !important; border-radius: 14px !important; font-size: 17px !important; box-shadow: 0 14px 26px rgba(37,99,235,.2); }
#aiImageCostHint, #aiImageMsg { margin: -6px 0 0; font-size: 14px; line-height: 1.7; }
.image-gallery-panel { min-height: 0; border-radius: 24px; padding: 26px; }
.image-gallery-panel .section-head { align-items: flex-start; margin-bottom: 20px; }
.image-gallery-panel .section-head h3 { margin: 3px 0 4px; font-size: 25px; }
.image-gallery-panel .section-head span { color: #667085; font-size: 14px; }
.image-current-head { gap: 18px; }
.image-gallery-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.image-gallery-actions button { min-height: 42px; white-space: nowrap; }
.ai-image-gallery { display: grid; gap: 22px; }
.ai-image-gallery.is-loading { opacity: .62; pointer-events: none; }
.ai-image-batch { display: grid; gap: 14px; border-top: 1px solid #e4e7ec; padding-top: 20px; }
.ai-image-batch:first-child { border-top: 0; padding-top: 0; }
.ai-image-batch-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ai-image-batch-head b { font-size: 16px; }
.ai-image-batch-head span { color: #667085; font-size: 13px; }
.ai-image-batch-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.ai-image-card { display: grid; gap: 11px; border: 1px solid #dbe3f0; border-radius: 17px; background: #fff; padding: 12px; box-shadow: 0 8px 22px rgba(15,23,42,.05); }
.ai-image-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 11px; background: #eef2f7; }
.ai-image-preview-wrap { position: relative; overflow: hidden; border-radius: 11px; background: #eef2f7; }
.ai-image-preview-wrap img { display: block; border-radius: 0; }
.ai-image-preview-wrap > span { position: absolute; right: 10px; bottom: 10px; left: 10px; border: 1px solid rgba(255,255,255,.35); border-radius: 10px; background: rgba(12,23,43,.82); padding: 9px 11px; color: #fff; font-size: 12px; font-weight: 750; line-height: 1.45; text-align: center; backdrop-filter: blur(7px); }
.ai-image-card b { font-size: 15px; line-height: 1.55; }
.ai-image-card small { color: #667085; font-size: 13px; }
.ai-image-card p { margin: 0; color: #475467; font-size: 14px; line-height: 1.65; }
.ai-image-concept { display: grid; gap: 4px; border-radius: 10px; background: #f5f8ff; padding: 10px; }
.ai-image-concept span { color: #344054; font-size: 13px; }
.ai-image-review-status { display: grid; gap: 3px; border: 1px solid #d8e2f0; border-radius: 11px; background: #f8fafc; padding: 10px 11px; }
.ai-image-review-status b { color: #344054; font-size: 13px; }
.ai-image-review-status small { color: #667085; font-size: 12px; line-height: 1.55; }
.ai-image-review-status.review-passed,
.ai-image-review-status.review-passed_after_retry { border-color: #abefc6; background: #ecfdf3; }
.ai-image-review-status.review-passed b,
.ai-image-review-status.review-passed_after_retry b { color: #067647; }
.ai-image-review-status.review-needs_attention { border-color: #fedf89; background: #fffaeb; }
.ai-image-review-status.review-needs_attention b { color: #b54708; }
.ai-image-review-status.review-reviewing,
.ai-image-review-status.review-regenerating { border-color: #b2ccff; background: #eff4ff; }
.ai-image-review-status.review-reviewing b,
.ai-image-review-status.review-regenerating b { color: #175cd3; }
.ai-image-review-status.review-review_failed { border-color: #e4e7ec; background: #f9fafb; }
.ai-image-human-review { display: grid; gap: 10px; border: 1px solid #fedf89; border-radius: 12px; background: #fffaeb; padding: 12px; }
.ai-image-human-review > div:first-child { display: grid; gap: 4px; }
.ai-image-human-review b { color: #93370d; font-size: 14px; }
.ai-image-human-review small { color: #854a0e; font-size: 12px; line-height: 1.6; }
.ai-image-human-review.human-approved { border-color: #abefc6; background: #ecfdf3; }
.ai-image-human-review.human-approved b { color: #067647; }
.ai-image-human-review.human-approved small { color: #087443; }
.ai-image-human-review.human-rejected { border-color: #d0d5dd; background: #f9fafb; }
.ai-image-human-review.human-rejected b { color: #344054; }
.ai-image-human-review.human-rejected small { color: #667085; }
.ai-image-human-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-image-human-actions button { min-height: 40px; flex: 1 1 140px; }
.button-link { display: inline-flex; justify-content: center; border: 1px solid #d0d5dd; border-radius: 10px; padding: 9px 12px; color: #175cd3; text-decoration: none; font-weight: 700; }
.ai-image-card-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
.ai-image-card-actions > * { min-height: 42px; align-items: center; }
@media (max-width: 720px) {
  .centered-notice-actions { flex-direction: column-reverse; }
  .centered-notice-actions button { width: 100%; }
}

/* AI 图片对话创作：按“AI先推荐，员工做决策”的单列流程组织。 */
.image-hero { align-items: center; }
.image-hero-actions { display: flex; align-items: center; gap: 12px; }
.image-dialogue-workspace { width: min(100%, 1180px); margin: 0 auto; display: grid; gap: 22px; }
.image-dialogue-panel { padding: 30px; border-radius: 24px; }
.image-dialogue-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.image-dialogue-head h3 { margin: 4px 0 8px; font-size: clamp(24px, 2vw, 32px); line-height: 1.25; color: #101828; }
.image-dialogue-head > div > span { display: block; color: #667085; font-size: 15px; line-height: 1.6; }
.image-flow-step { flex: 0 0 auto; border-radius: 999px; padding: 8px 13px; background: #eef4ff; color: #175cd3; font-size: 14px; font-weight: 700; }
.image-setup-section { display: grid; gap: 16px; padding: 26px 0; border-top: 1px solid #e4e7ec; }
.image-setup-section:first-of-type { border-top: 0; padding-top: 0; }
.image-setup-section label, .image-generation-settings label, .image-selected-direction label { display: grid; gap: 9px; color: #344054; font-size: 15px; font-weight: 700; }
.image-setup-section input, .image-setup-section select, .image-setup-section textarea,
.image-generation-settings input, .image-generation-settings select,
.image-custom-idea input, .image-selected-direction textarea,
.image-refine-composer textarea { min-height: 48px; border: 1px solid #d0d5dd; border-radius: 13px; background: #fff; color: #101828; font-size: 16px; line-height: 1.55; padding: 12px 14px; }
.image-setup-section textarea, .image-selected-direction textarea, .image-refine-composer textarea { resize: vertical; }
.image-primary-action { width: 100%; min-height: 54px; margin-top: 24px; font-size: 17px; }
.image-generation-settings { margin-top: 8px; border-top: 1px solid #e4e7ec; padding-top: 20px; }
.image-generation-settings summary { color: #344054; font-size: 15px; font-weight: 800; cursor: pointer; }
.image-generation-settings .image-field-grid { margin-top: 18px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.image-reference-picker { min-height: 132px; border: 2px dashed #84adff; border-radius: 18px; background: #f5f8ff; display: flex !important; align-items: center; justify-content: center; align-content: center; text-align: center; gap: 8px !important; cursor: pointer; }
.image-reference-picker strong { color: #175cd3; font-size: 17px; }
.image-reference-picker small { color: #667085; font-size: 14px; font-weight: 500; }
.image-reference-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.image-reference-preview article { min-width: 0; border: 1px solid #dfe5ef; border-radius: 16px; background: #fff; overflow: hidden; }
.image-reference-preview article > img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #f2f4f7; }
.image-reference-preview article > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 11px; }
.image-reference-preview article small { min-width: 0; display: grid; gap: 2px; font-size: 13px; color: #344054; }
.image-reference-preview article small span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #667085; font-size: 11px; font-weight: 500; }
.image-reference-preview article button { flex: 0 0 auto; padding: 7px 9px; font-size: 12px; }
.image-product-strip { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid #e4e7ec; padding-bottom: 22px; margin-bottom: 28px; }
.image-product-strip > div { display: grid; gap: 5px; }
.image-product-strip b { color: #101828; font-size: 20px; }
.image-product-strip span { color: #667085; font-size: 14px; }
.image-direction-list { display: grid; gap: 14px; }
.image-direction-item { display: grid; grid-template-columns: 210px minmax(0,1fr) auto; align-items: center; gap: 22px; min-height: 164px; border: 1px solid #dfe5ef; border-radius: 18px; padding: 14px; background: #fff; transition: border-color .2s ease, background .2s ease; }
.image-direction-item.selected { border: 2px solid #2e6af0; background: #f5f8ff; padding: 13px; }
.image-direction-item.no-thumb { grid-template-columns: minmax(0,1fr) auto; min-height: 138px; padding-left: 24px; }
.image-direction-item > img { width: 210px; height: 136px; border-radius: 13px; object-fit: cover; background: #f2f4f7; }
.image-direction-copy { min-width: 0; display: grid; gap: 8px; }
.image-direction-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.image-direction-title b { color: #101828; font-size: 21px; line-height: 1.35; }
.image-direction-title em { border-radius: 999px; background: #2e6af0; color: #fff; padding: 4px 9px; font-size: 12px; font-style: normal; font-weight: 800; }
.image-direction-copy p { margin: 0; color: #344054; font-size: 15px; line-height: 1.6; }
.image-direction-copy span { color: #175cd3; font-size: 14px; font-weight: 700; }
.image-direction-copy small { color: #667085; font-size: 13px; line-height: 1.5; }
.image-direction-item > button { min-width: 132px; min-height: 44px; }
.image-custom-idea { display: grid; grid-template-columns: minmax(190px, auto) minmax(0,1fr); align-items: center; gap: 20px; margin-top: 18px; border-top: 1px solid #e4e7ec; padding-top: 22px; }
.image-custom-idea label { display: grid; gap: 4px; color: #101828; font-size: 15px; }
.image-custom-idea label span { color: #667085; font-size: 13px; font-weight: 500; }
.image-selected-direction { display: grid; grid-template-columns: minmax(170px,auto) minmax(0,1fr) auto; align-items: end; gap: 18px; margin-top: 18px; border: 2px solid #84adff; border-radius: 18px; background: #f5f8ff; padding: 18px; }
.image-selected-direction > div { display: grid; gap: 4px; align-self: center; }
.image-selected-direction > div span { color: #667085; font-size: 13px; }
.image-selected-direction > div b { color: #101828; font-size: 17px; }
.image-selected-direction button { min-width: 126px; min-height: 50px; }
.image-conversation-gallery { display: grid; gap: 16px; }
.image-conversation-context { display: grid; gap: 5px; text-align: center; }
.image-conversation-context span { color: #175cd3; font-size: 13px; font-weight: 800; }
.image-conversation-context b { color: #101828; font-size: 22px; }
.image-conversation-context p { margin: 0; color: #667085; font-size: 14px; }
.image-version-tabs { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.image-version-tabs button { min-height: 38px; border-radius: 10px; padding: 8px 14px; }
.image-version-tabs button.active { border-color: #2e6af0; background: #eef4ff; color: #175cd3; }
.image-conversation-preview { width: min(100%, 720px); margin: 0 auto; border-radius: 20px; overflow: hidden; background: #f2f4f7; }
.image-conversation-preview img { display: block; width: 100%; height: auto; max-height: 760px; object-fit: contain; }
.image-conversation-wait { min-height: 420px; border: 1px dashed #98a2b3; border-radius: 20px; background: #f8fafc; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; color: #344054; }
.image-conversation-wait p { margin: 0; color: #667085; }
.image-wait-pulse { width: 12px; height: 12px; border-radius: 50%; background: #2e6af0; box-shadow: 0 0 0 8px #dbe8ff; }
.image-conversation-review, .image-conversation-human { display: flex; align-items: center; justify-content: space-between; gap: 18px; border-radius: 15px; padding: 16px 18px; background: #ecfdf3; border: 1px solid #abefc6; }
.image-conversation-review > div, .image-conversation-human > div:first-child { display: grid; gap: 4px; }
.image-conversation-review b, .image-conversation-human b { color: #067647; font-size: 15px; }
.image-conversation-review small, .image-conversation-human small { color: #475467; font-size: 13px; line-height: 1.5; }
.image-conversation-review > span { flex: 0 0 auto; color: #667085; font-size: 12px; }
.image-conversation-review.review-needs_attention { background: #fffaeb; border-color: #fedf89; }
.image-conversation-review.review-needs_attention b { color: #b54708; }
.image-conversation-human { background: #f8fafc; border-color: #d0d5dd; }
.image-conversation-human > div:last-child { display: flex; gap: 8px; flex: 0 0 auto; }
.image-conversation-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.image-conversation-actions > * { min-width: 150px; min-height: 46px; }
.image-refine-composer { margin-top: 8px; border-top: 1px solid #e4e7ec; padding-top: 24px; display: grid; gap: 10px; }
.image-refine-composer > label { color: #101828; font-size: 16px; font-weight: 800; }
.image-refine-composer > div { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: stretch; }
.image-refine-composer button { min-width: 146px; }
.image-refine-composer small { color: #667085; font-size: 13px; }
.image-workspace-status { text-align: center; }
.image-workspace-status p { margin: 0; }

@media (max-width: 900px) {
  .image-dialogue-panel { padding: 22px; border-radius: 20px; }
  .image-direction-item { grid-template-columns: 150px minmax(0,1fr); }
  .image-direction-item > img { width: 150px; height: 118px; }
  .image-direction-item > button { grid-column: 2; justify-self: start; }
  .image-selected-direction { grid-template-columns: 1fr; align-items: stretch; }
  .image-selected-direction button { width: 100%; }
}

@media (max-width: 640px) {
  .image-hero { align-items: flex-start; }
  .image-hero-actions { width: 100%; justify-content: space-between; }
  .image-dialogue-head { display: grid; gap: 12px; }
  .image-flow-step { justify-self: start; }
  .image-generation-settings .image-field-grid { grid-template-columns: 1fr; }
  .image-reference-preview { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .image-product-strip { align-items: flex-start; }
  .image-direction-item { grid-template-columns: 1fr; padding: 14px; }
  .image-direction-item.no-thumb { grid-template-columns: 1fr; padding-left: 14px; }
  .image-direction-item.selected { padding: 13px; }
  .image-direction-item > img { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .image-direction-item > button { grid-column: 1; width: 100%; }
  .image-custom-idea { grid-template-columns: 1fr; }
  .image-refine-composer > div { grid-template-columns: 1fr; }
  .image-refine-composer button { min-height: 48px; }
  .image-conversation-review, .image-conversation-human { align-items: flex-start; flex-direction: column; }
  .image-conversation-human > div:last-child { width: 100%; }
  .image-conversation-human > div:last-child button { flex: 1; }
}
.modal-open { overflow: hidden; }
.image-history-overlay { position: fixed; inset: 0; z-index: 10040; display: grid; place-items: center; background: rgba(7, 15, 32, .72); padding: 28px; backdrop-filter: blur(5px); }
.image-history-dialog { display: grid; grid-template-rows: auto minmax(0,1fr); width: min(1320px, calc(100vw - 56px)); max-height: calc(100vh - 56px); overflow: hidden; border: 1px solid rgba(255,255,255,.35); border-radius: 24px; background: #f7f9fc; box-shadow: 0 28px 90px rgba(2,8,23,.36); }
.image-history-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid #dfe5ef; background: #fff; padding: 24px 26px 20px; }
.image-history-head h3, .image-history-head p { margin: 0; }
.image-history-head h3 { margin: 4px 0 5px; color: #172033; font-size: 25px; }
.image-history-head span { color: #667085; font-size: 14px; }
.image-history-gallery { overflow-y: auto; padding: 24px 26px 30px; }
.image-history-gallery .ai-image-batch { border: 1px solid #dfe5ef; border-radius: 18px; background: #fff; padding: 20px; }
.image-history-gallery .ai-image-batch:first-child { padding-top: 20px; }
@media (max-width: 760px) {
  .image-generator-form, .image-gallery-panel { padding: 18px; }
  .image-template-choices, .image-field-grid, .ai-image-batch-grid { grid-template-columns:1fr; }
  .image-template-slot { grid-template-columns: 54px 92px minmax(0,1fr); }
  .image-reference-preview { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .image-history-overlay { padding: 10px; }
  .image-history-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); border-radius: 18px; }
  .image-history-head { display: grid; padding: 19px; }
  .image-history-head .image-gallery-actions { justify-content: flex-start; }
  .image-history-gallery { padding: 16px; }
}

.ai-review-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.ai-review-head span {
  color: #667085;
  font-size: 14px;
}

.ai-product-card {
  position: relative;
  display: grid;
  gap: 16px;
  border: 1px solid #e4e7ec;
  border-radius: 14px;
  padding: 24px;
}

.ai-product-card b { display: block; padding-right: 145px; font-size: 20px; line-height: 1.45; }

.ai-product-card small {
  display: block;
  margin-top: 4px;
  color: #667085;
  font-size: 16px;
  line-height: 1.7;
}

.ai-product-card-actions {
  position: absolute;
  right: 12px;
  top: 12px;
  display: flex;
  gap: 7px;
}

.ai-product-card-actions button {
  padding: 8px 11px;
  font-size: 13px;
}

.ai-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-right: 58px;
}

.ai-tag-row span {
  border-radius: 999px;
  background: #eef4ff;
  color: #3538cd;
  padding: 7px 11px;
  font-size: 15px;
  line-height: 1.35;
}

.ai-tag-row em,
.ai-risk {
  color: #b54708;
  font-size: 16px;
  font-style: normal;
  line-height: 1.8;
}

@media (max-width: 640px) {
  .ai-material-picker { grid-template-columns: 1fr; }
  .ai-material-picker > label { width: 100%; }
  .ai-product-card b { padding-right: 0; }
  .ai-product-card-actions { position: static; }
}

.password-reset-chip { display: inline-flex; width: fit-content; border-radius: 999px; background: #fff7ed; padding: 5px 8px; color: #c2410c; font-size: 11px; font-weight: 800; white-space: nowrap; }

.ai-empty {
  border: 1px dashed #98a2b3;
  border-radius: 14px;
  padding: 28px;
  text-align: center;
  color: #667085;
}

.ai-coming-card {
  margin-top: 18px;
}

.ai-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.ai-flow span {
  border-radius: 10px;
  background: #f2f4f7;
  padding: 9px 12px;
  font-weight: 700;
  color: #344054;
}

.ai-flow i {
  color: #98a2b3;
  font-style: normal;
}

.ai-analysis-form {
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(280px, 1.3fr) auto;
  gap: 12px;
  align-items: end;
  margin: 18px 0 8px;
}

.ai-analysis-form label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.ai-jobs-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
  margin-top: 18px;
  min-height: 280px;
}

.ai-job-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 580px;
  overflow: auto;
}

.ai-job-item {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  text-align: left;
}

.ai-job-item.selected {
  border-color: #6172f3;
  background: #f4f7ff;
  box-shadow: 0 0 0 2px rgba(97, 114, 243, .08);
}

.ai-job-item span,
.ai-job-item small,
.ai-detail-head small {
  color: #667085;
  font-size: 12px;
}

.ai-job-detail {
  min-width: 0;
  border: 1px solid #eaecf0;
  border-radius: 14px;
  background: #fcfcfd;
  padding: 14px;
}

.ai-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ai-detail-head div {
  display: grid;
  gap: 4px;
}

.ai-detail-head > span {
  white-space: nowrap;
  color: #3538cd;
  font-weight: 700;
}

.ai-report-note {
  border-left: 3px solid #84adff;
  background: #eef4ff;
  color: #344054;
  padding: 10px 12px;
}

.ai-report-section {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.ai-report-section h4 {
  margin: 0;
  color: #101828;
}

.ai-transcript {
  margin: 0;
  border-radius: 10px;
  background: #f2f4f7;
  padding: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.ai-structure-list,
.ai-recommended-list,
.ai-risk-list {
  display: grid;
  gap: 9px;
}

.ai-structure-list article {
  display: grid;
  grid-template-columns: 90px 105px minmax(0, 1fr);
  gap: 8px 12px;
  border-left: 3px solid #84adff;
  background: #f5f8ff;
  padding: 10px 12px;
}

.ai-structure-list p,
.ai-structure-list small {
  margin: 0;
}

.ai-structure-list small {
  grid-column: 3;
  color: #667085;
}

.ai-recommended-item {
  display: grid;
  grid-template-columns: auto minmax(180px, .7fr) minmax(220px, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  background: #fff;
  padding: 11px;
}

.ai-recommended-item > div:nth-child(2) {
  display: grid;
  gap: 5px;
}

.ai-recommended-item .ai-tag-row {
  grid-column: 2 / -1;
  padding-right: 0;
}

.ai-segment-check {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #3538cd;
  font-weight: 700;
}

.ai-risk-list article {
  border-left: 3px solid #fdb022;
  background: #fffaeb;
  padding: 10px 12px;
}

.ai-risk-list article.high {
  border-color: #f04438;
  background: #fef3f2;
}
.ai-risk-list article.prohibited { border-color: #f04438; background: #fef3f2; }
.ai-risk-list article.verify { border-color: #f79009; background: #fffaeb; }
.ai-risk-list article.suggestion { border-color: #2e90fa; background: #eff8ff; }

.ai-risk-list span,
.ai-risk-list p {
  display: block;
  margin: 4px 0 0;
}

.ai-report-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  bottom: 10px;
  z-index: 2;
  margin: 0 0 16px;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  background: rgba(255, 255, 255, .94);
  padding: 10px;
  backdrop-filter: blur(8px);
}

.ai-script-workbench {
  border-top: 1px solid #e4e7ec;
  padding-top: 22px;
}

.ai-script-workbench > h4 { margin-bottom: 16px; font-size: 20px; }

.ai-script-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 14px;
  align-items: end;
}
.ai-script-instruction { grid-column: 1 / -1; }

.ai-script-form label,
.ai-script-field,
.ai-timeline-item label {
  display: grid;
  gap: 7px;
  color: #1d2939;
  font-size: 14px;
  font-weight: 700;
}

.ai-script-form select,
.ai-script-form input,
.ai-script-form textarea { min-height: 44px; font-size: 15px; }
.ai-script-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; }
.ai-script-actions button { min-height: 44px; padding-inline: 20px; font-size: 15px; }
#aiScriptMsg { margin: 14px 0; font-size: 14px; line-height: 1.7; }

.ai-script-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  min-height: 240px;
}

.ai-script-list {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 10px;
}

.ai-script-item {
  display: grid;
  gap: 6px;
  width: 100%;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #fff;
  padding: 14px;
  text-align: left;
}

.ai-script-item.selected {
  border-color: #6172f3;
  background: #f4f7ff;
}

.ai-script-item span,
.ai-script-item small {
  color: #667085;
  font-size: 13px;
}

.ai-script-item b { font-size: 15px; }

.ai-script-detail {
  min-width: 0;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  background: #fcfcfd;
  padding: 22px;
}

.ai-timeline-list {
  display: grid;
  gap: 16px;
  margin: 18px 0;
}

.ai-timeline-item {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  align-items: start;
  border: 1px solid #e4e7ec;
  border-radius: 14px;
  background: #fff;
  padding: 18px;
}

.ai-timeline-time {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: auto 1fr;
  gap: 8px 14px;
  color: #3538cd;
  font-size: 17px;
}

.ai-timeline-time small {
  color: #667085;
  font-size: 14px;
}

.ai-timeline-item label { font-size: 15px; }
.ai-timeline-item input,
.ai-timeline-item textarea { min-height: 52px; padding: 12px 14px; font-size: 16px; line-height: 1.65; }
.ai-timeline-item textarea { min-height: 92px; resize: vertical; }

.ai-usage-admin {
  margin-bottom: 18px;
}

.ai-usage-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.ai-usage-stats article {
  display: grid;
  gap: 5px;
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px;
}

.ai-usage-stats span {
  color: #667085;
  font-size: 12px;
}

.ai-usage-stats b {
  font-size: 20px;
}

.ai-budget-bar {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #eaecf0;
}

.ai-budget-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #12b76a;
  transition: width .2s ease;
}

.ai-budget-bar i.warning {
  background: #f79009;
}

.ai-budget-bar i.danger {
  background: #f04438;
}

.ai-usage-tables {
  display: grid;
  grid-template-columns: minmax(260px, .7fr) minmax(520px, 1.3fr);
  gap: 16px;
  overflow: auto;
}

.ai-frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.ai-frame-grid article {
  display: grid;
  gap: 5px;
  overflow: hidden;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  background: #fff;
  padding-bottom: 8px;
}

.ai-frame-grid img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  background: #101828;
}

.ai-frame-grid b,
.ai-frame-grid small {
  padding: 0 8px;
  font-size: 12px;
}

.ai-frame-grid small {
  color: #667085;
}

.task-list {
  display: grid;
  gap: 10px;
  min-height: 160px;
  max-height: 360px;
  overflow: auto;
}

.status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.download-progress-panel {
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: #eff6ff;
  padding: 12px 14px;
}

.download-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #1e40af;
}

.download-progress-head b,
.download-progress-head span,
.download-progress-panel small {
  overflow-wrap: anywhere;
}

.download-progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}

.download-progress-bar i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  transition: width 0.16s ease;
}

.summary-pill {
  border: 1px solid transparent;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.summary-pill:hover {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1d4ed8;
}

.summary-pill.active {
  border-color: #2563eb;
  background: #2563eb;
  color: white;
}

.summary-pill.danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: #dc2626;
}

.summary-pill.danger:hover {
  border-color: #f87171;
  background: #fee2e2;
  color: #b91c1c;
}

.task {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
}

.task.active {
  border-color: var(--blue);
  outline: 3px solid rgba(37, 99, 235, 0.12);
}

.record-list {
  max-height: 620px;
}

.record-item {
  grid-template-columns: 140px minmax(0, 1fr) auto;
  align-items: center;
}

.record-thumb {
  width: 140px;
  height: 78px;
  border-radius: 12px;
  background: #0f172a;
  object-fit: cover;
}

.record-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 13px;
}

.record-body {
  min-width: 0;
}

.record-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

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

.task b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task small {
  color: var(--muted);
}

.task .task-note {
  display: block;
  margin-top: 4px;
  white-space: normal;
}

.task-side {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.status {
  align-self: start;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.uploaded,
.ready,
.queued {
  background: #fef3c7;
  color: var(--orange);
}

.processing {
  background: #dbeafe;
  color: var(--blue);
}

.success {
  background: #dcfce7;
  color: var(--green);
}

.failed,
.expired {
  background: #fee2e2;
  color: var(--red);
}

.pending {
  background: #fef3c7;
  color: var(--orange);
}

.approved {
  background: #dcfce7;
  color: var(--green);
}

.rejected {
  background: #fee2e2;
  color: var(--red);
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.compact-row {
  margin-top: 0;
  flex-wrap: wrap;
}

.editor {
  margin-top: 18px;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 360px;
  gap: 18px;
  align-items: stretch;
}

.video-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 520px;
  overflow: hidden;
  border-radius: 18px;
  background: #0f172a;
  user-select: none;
}

.video-stage video {
  display: none;
  width: 100%;
  height: clamp(380px, 46vw, 520px);
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
}

.video-stage video.show {
  display: block;
}

.empty-preview {
  color: #dbeafe;
  text-align: center;
}

.empty-preview.hidden {
  display: none;
}

.preview-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #dbeafe;
  background: rgba(15, 23, 42, 0.28);
  font-weight: 900;
  pointer-events: none;
}

.preview-loading.hidden {
  display: none;
}

.mask-box {
  position: absolute;
  border: 2px solid #60a5fa;
  background: rgba(37, 99, 235, 0.22);
  box-shadow: 0 0 0 999px rgba(15, 23, 42, 0.2);
  cursor: move;
  pointer-events: auto;
}

.mask-box.hidden {
  display: none;
}

.mask-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid white;
  border-radius: 999px;
  background: #2563eb;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.28);
}

.mask-handle.nw {
  top: -10px;
  left: -10px;
  cursor: nwse-resize;
}

.mask-handle.n {
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.mask-handle.ne {
  top: -10px;
  right: -10px;
  cursor: nesw-resize;
}

.mask-handle.e {
  top: 50%;
  right: -10px;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.mask-handle.se {
  right: -10px;
  bottom: -10px;
  cursor: nwse-resize;
}

.mask-handle.s {
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.mask-handle.sw {
  bottom: -10px;
  left: -10px;
  cursor: nesw-resize;
}

.mask-handle.w {
  top: 50%;
  left: -10px;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.mask-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mask-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  align-items: center;
}

.mask-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.selected {
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  padding: 14px;
  color: var(--muted);
  line-height: 1.8;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.selected b,
.niuma-side b,
.niuma-side p,
.niuma-side small {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.stats article {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  padding: 18px;
  min-width: 0;
  overflow: hidden;
}

.stats span {
  display: block;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stats b {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1.2;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.manual-account-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  padding: 0;
  margin: 12px 0 16px;
  overflow: hidden;
}

.manual-account-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 900;
  color: var(--text);
  list-style: none;
}

.manual-account-panel summary::-webkit-details-marker {
  display: none;
}

.manual-account-panel summary::after {
  content: "展开";
  flex: 0 0 auto;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
  padding: 6px 12px;
  color: var(--primary);
  font-size: 13px;
}

.manual-account-panel[open] summary::after {
  content: "收起";
}

.manual-account-panel summary small {
  color: var(--muted);
  font-weight: 700;
}

.manual-account-panel .user-form,
.manual-account-panel .bulk-user-box {
  margin: 0 14px 14px;
}

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

.user-table-wrap {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.user-admin table {
  min-width: 1040px;
  table-layout: fixed;
}

.user-admin th,
.user-admin td {
  vertical-align: middle;
}

.user-admin th:nth-child(1) { width: 17%; }
.user-admin th:nth-child(2) { width: 12%; }
.user-admin th:nth-child(3) { width: 14%; }
.user-admin th:nth-child(4) { width: 18%; }
.user-admin th:nth-child(5) { width: 18%; }
.user-admin th:nth-child(6) { width: 21%; }

.user-identity,
.user-times,
.user-times > span,
.user-metrics > span {
  display: grid;
}

.user-identity { gap: 4px; }
.user-identity b { font-size: 14px; }
.user-identity span,
.user-times small,
.user-metrics small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.user-identity span {
  overflow-wrap: anywhere;
}

.user-status-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.user-role,
.account-enabled,
.all-permissions {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.account-enabled.active { background: #ecfdf5; color: #047857; }
.account-enabled.inactive { background: #f1f5f9; color: #64748b; }
.all-permissions { background: #f3e8ff; color: #7e22ce; }

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

.user-metrics > span {
  gap: 4px;
  min-width: 0;
}

.user-metrics b {
  font-size: 13px;
  white-space: nowrap;
}

.user-times { gap: 9px; }
.user-times > span { gap: 3px; }

.user-admin .status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 8px;
  font-size: 11px;
  white-space: nowrap;
}

.date-cell {
  display: inline-grid;
  gap: 2px;
  min-width: 152px;
  line-height: 1.25;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.user-admin .date-cell {
  min-width: 0;
  font-size: 12px;
}

.action-cell { min-width: 0; }

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-actions button {
  margin: 0;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 12px;
  white-space: nowrap;
}

.user-admin .permission-editor { min-width: 0; }
.user-admin .permission-editor button { padding: 7px 10px; font-size: 12px; }

@media (max-width: 1380px) {
  .user-admin table { min-width: 930px; }
  .user-admin th,
  .user-admin td { padding: 10px 8px; }
  .user-admin th:nth-child(1) { width: 16%; }
  .user-admin th:nth-child(4) { width: 17%; }
  .user-admin th:nth-child(6) { width: 23%; }
}

@media (max-width: 760px) {
  .user-table-wrap { overflow: visible; }
  .user-admin table,
  .user-admin tbody,
  .user-admin tr,
  .user-admin td { display: block; }
  .user-admin table { min-width: 0; }
  .user-admin thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .user-admin tbody { display: grid; gap: 14px; }
  .user-admin tbody tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
  }
  .user-admin td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #edf2f7;
  }
  .user-admin td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }
  .user-admin td:last-child { border-bottom: 0; }
  .user-admin .user-empty-row td { display: block; text-align: center; }
  .user-admin .user-empty-row td::before { content: none; }
  .user-metrics { grid-template-columns: 1fr 1fr; }
  .user-actions { align-items: stretch; }
  .user-actions button { flex: 1 1 calc(50% - 6px); }
}

.admin-tasks {
  margin-top: 18px;
}

.admin-logs {
  margin-top: 18px;
}

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

.section-head p {
  margin-bottom: 12px;
  color: var(--muted);
}

.user-admin {
  margin-bottom: 18px;
}

.settings-admin {
  margin-bottom: 18px;
}

.security-card {
  margin-bottom: 18px;
  border-color: #fed7aa;
  background: #fff7ed;
}

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

.security-head h3 {
  margin-bottom: 4px;
}

.security-head span {
  border-radius: 999px;
  background: #fb923c;
  color: white;
  padding: 6px 10px;
  font-weight: 900;
}

.security-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.security-item {
  border-left: 4px solid #f97316;
  border-radius: 12px;
  background: white;
  padding: 12px 14px;
}

.security-item.high {
  border-left-color: #dc2626;
}

.security-item.medium {
  border-left-color: #f97316;
}

.security-item.low {
  border-left-color: #eab308;
}

.security-item p {
  margin: 6px 0;
  color: var(--text);
}

.security-item small {
  color: var(--muted);
}

.system-card {
  margin-bottom: 18px;
}

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

.system-grid article {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
}

.system-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.system-grid b {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.system-grid small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.system-grid .backup-health,
.system-grid .processor-health {
  background: #f0fdf4;
}

.system-grid .backup-health.high,
.system-grid .processor-health.high {
  border-color: #fecaca;
  background: #fef2f2;
}

.system-grid .backup-health.medium,
.system-grid .processor-health.medium {
  border-color: #fed7aa;
  background: #fff7ed;
}

.system-grid .backup-health.low,
.system-grid .processor-health.low {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.settings-form label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: #344054;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 800;
}

.settings-form > label:not(.checkbox-row) input {
  min-height: 46px;
  font-size: 15px;
}

.settings-form > .muted {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px solid #cfe0ff;
  border-radius: 12px;
  background: #f5f8ff;
  padding: 12px 14px;
  color: #475467;
  font-size: 14px;
  line-height: 1.65;
}

.settings-form > #saveSettingsBtn {
  grid-column: 1 / -1;
  min-height: 48px;
  font-size: 15px;
}

.settings-form .checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px 12px;
}

.settings-form .checkbox-row input {
  width: auto;
}

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

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

.report-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.report-item b,
.report-item span,
.report-item small {
  display: block;
}

.report-item span {
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.report-item small {
  margin-top: 4px;
  color: var(--muted);
}

.user-form {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 130px auto;
  gap: 10px;
  margin-bottom: 12px;
}

.bulk-user-box {
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 14px;
  margin: 8px 0 14px;
  background: #f8fafc;
}

.bulk-user-box label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.bulk-user-box textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
}

.bulk-user-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

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

@media (max-width: 980px) {
  .shell,
  .grid,
  .stats,
  .editor-layout,
  .niuma-work,
  .niuma-main,
  .mask-form,
  .user-form,
  .settings-form,
  .ai-layout,
  .ai-analysis-form,
  .ai-jobs-layout,
  .ai-recommended-item,
  .ai-structure-list,
  .ai-script-form,
  .ai-script-layout,
  .ai-timeline-item,
  .ai-usage-stats,
  .ai-usage-tables,
  .report-item,
  .bulk-user-actions,
  .section-head {
    grid-template-columns: 1fr;
  }

  .ai-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .ai-product-review { grid-template-columns: 1fr; }
  .ai-product-review .ai-review-head,
  .ai-product-review > .primary { grid-column: auto; }

  .ai-structure-list small,
  .ai-recommended-item .ai-tag-row {
    grid-column: auto;
  }

  .bulk-user-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .report-item {
    align-items: stretch;
  }

  .section-head {
    display: grid;
  }

  .upload-panel {
    max-height: none;
  }

  .upload-file-list {
    max-height: 320px;
  }

  .video-stage {
    min-height: 320px;
  }

  .video-stage video {
    height: 320px;
  }
}
