:root {
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  color: var(--ink);
  background: var(--canvas);
  color-scheme: light;
  font-size: 16px;
  font-synthesis: none;
  /* 中性灰蓝底色承载内容，页面使用不同强调色表达模块归属。 */
  --canvas: #f7f8fc;
  --panel: #ffffff;
  --surface: #f0f3f9;
  --ink: #20283a;
  --muted: #667187;
  --line: #e2e7f0;
  --control-line: #929db0;
  --brand: #514bcf;
  --brand-hover: #4039b5;
  --brand-soft: #efefff;
  --brand-soft-hover: #e6e5ff;
  --brand-line: #d5d2ff;
  --success: #167455;
  --success-soft: #e8f7f0;
  --warning: #9a5b0a;
  --warning-soft: #fff5df;
  --warning-line: #f3d9a8;
  --danger: #b73e58;
  --danger-soft: #fff0f3;
  --danger-line: #f1c9d4;
  --inverse: #ffffff;
  --device-top: #344055;
  --device-bottom: #53627b;
  --device-line: #687995;
  --device-light: #e0e9ff;
  --shadow-card: 0 6px 20px rgb(39 50 75 / 5%);
  --shadow-raised: 0 22px 56px rgb(39 50 75 / 14%);
  --overlay: rgb(25 34 53 / 34%);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 92% -12%, rgb(132 116 255 / 11%), transparent 30rem),
    radial-gradient(circle at -8% 30%, rgb(47 170 151 / 7%), transparent 26rem),
    var(--canvas);
}
::selection {
  color: var(--ink);
  background: var(--brand-line);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}
a {
  color: var(--brand);
}
button,
input,
textarea,
select {
  border-radius: 10px;
}
button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 10px 16px;
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  line-height: 1.4;
  overflow-wrap: anywhere;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
button:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--control-line);
}
button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--inverse);
}
button.primary:hover:not(:disabled) {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}
button.danger {
  color: var(--danger);
  border-color: var(--danger-line);
}
button.danger:hover:not(:disabled) {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger);
}
button.ghost {
  background: transparent;
}
button.small {
  padding: 7px 12px;
  font-size: 0.875rem;
  min-height: 38px;
}
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 1.65rem;
  font-weight: 680;
  letter-spacing: -0.035em;
}
h2 {
  font-size: 1.125rem;
  line-height: 1.5;
}
h3 {
  font-size: 1rem;
}
p {
  line-height: 1.65;
}
small,
.muted {
  color: var(--muted);
}
small {
  font-size: 0.875rem;
}
.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--panel);
  color: var(--muted);
  border-right: 1px solid var(--line);
  padding: 32px 18px;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  width: 220px;
}
.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 650;
  color: var(--ink);
  margin: 0 10px 45px;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 3px;
  width: 32px;
  height: 32px;
}
.brand-mark i {
  background: var(--brand);
  width: 4px;
  height: 15px;
  border-radius: 4px;
}
.brand-mark i:nth-child(2) {
  height: 29px;
}
.brand-mark i:nth-child(3) {
  height: 22px;
}
.nav {
  display: grid;
  gap: 9px;
}
.nav button {
  text-align: left;
  background: none;
  color: var(--muted);
  border: 0;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px 15px;
}
.nav button:hover {
  background: var(--surface);
  color: var(--ink);
}
.nav button.active,
.nav button.active:hover:not(:disabled) {
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: inset 3px 0 var(--brand);
}
.nav-symbol {
  width: 22px;
  text-align: center;
  font-size: 1.1rem;
}
.sidebar-footer {
  margin-top: auto;
  padding: 24px 12px 0;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.8;
}
.workspace {
  grid-column: 2;
  min-width: 0;
}
.topbar {
  height: 84px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 42px;
  background: var(--panel);
}
.topbar-label {
  font-size: 0.875rem;
  color: var(--muted);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.content {
  max-width: 1380px;
  margin: 0 auto;
  padding: 34px 42px 72px;
}
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.page-head h1 {
  margin-bottom: 8px;
}
.page-head p {
  color: var(--muted);
  font-size: 0.9375rem;
  margin-bottom: 0;
}
.grid {
  display: grid;
  gap: 22px;
}
.grid.two {
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
}
.grid.equal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  min-width: 0;
  box-shadow: var(--shadow-card);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.card-header h2 {
  margin: 0;
}
.status {
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.status.good {
  color: var(--success);
  background: var(--success-soft);
}
.status.warn {
  color: var(--warning);
  background: var(--warning-soft);
}
.status.bad {
  color: var(--danger);
  background: var(--danger-soft);
}
.speaker {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 20px;
  margin: 14px 0 30px;
}
.speaker-device {
  height: 88px;
  width: 64px;
  border-radius: 19px;
  background: linear-gradient(140deg, var(--device-top), var(--device-bottom));
  box-shadow: inset 0 0 0 1px var(--device-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--device-light);
}
.speaker h2 {
  font-size: 1.35rem;
  margin: 0 0 8px;
}
.speaker p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}
.device-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 22px 0;
  border-block: 1px solid var(--line);
  margin-bottom: 22px;
}
.device-meta span {
  font-size: 0.875rem;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}
.device-meta strong {
  font-size: 0.9375rem;
  font-weight: 550;
  overflow-wrap: anywhere;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.stack {
  display: grid;
  gap: 18px;
}
.split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.label {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.role-name {
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}
.role-prompt {
  color: var(--muted);
  white-space: pre-wrap;
  font-size: 0.9375rem;
  line-height: 1.8;
}
.tag-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.tag {
  background: var(--surface);
  padding: 6px 9px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 0.8125rem;
}
.notice {
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  color: var(--brand-hover);
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 0.875rem;
  line-height: 1.7;
  margin: 16px 0;
}
.notice.warn {
  background: var(--warning-soft);
  border-color: var(--warning-line);
  color: var(--warning);
}
.notice.error {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger);
}
.empty {
  padding: 38px 20px;
  text-align: center;
  color: var(--muted);
  line-height: 1.8;
}
.empty strong {
  color: var(--ink);
  display: block;
  font-size: 1rem;
  margin-bottom: 7px;
  font-weight: 550;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  border-left: 3px solid var(--brand);
  padding: 2px 18px;
}
.stat strong {
  display: block;
  font-size: 1.9rem;
  font-weight: 600;
  margin-top: 6px;
}
.stat span {
  font-size: 0.875rem;
  color: var(--muted);
}
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  align-items: center;
}
.toolbar input {
  max-width: 320px;
}
.field {
  display: grid;
  gap: 8px;
}
.field label {
  font-size: 0.875rem;
  font-weight: 550;
}
.field .help {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.6;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 19px;
}
.field.full {
  grid-column: 1/-1;
}
input,
textarea,
select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--control-line);
  color: var(--ink);
  padding: 11px 12px;
  min-height: 44px;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
}
input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  margin: 0;
  accent-color: var(--brand);
}
input[type="range"] {
  padding: 0;
  min-height: 28px;
  accent-color: var(--brand);
}
textarea {
  resize: vertical;
  min-height: 108px;
  line-height: 1.7;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9375rem;
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 24px 0;
}
.list {
  display: grid;
  gap: 14px;
}
.list-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child {
  border-bottom: 0;
}
.list-main {
  flex: 1;
  min-width: 0;
}
.list-main p {
  margin-bottom: 7px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.list-main h3 {
  margin-bottom: 8px;
}
.record {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.record-content {
  white-space: pre-wrap;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.record time {
  font-size: 0.8125rem;
  color: var(--muted);
  display: block;
  margin-top: 8px;
}
.record-meta {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 8px;
}
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--canvas);
}
.login-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-raised);
  padding: 42px;
  border-radius: 20px;
}
.login-card .brand {
  margin: 0 0 32px;
  color: var(--ink);
}
.login-card .brand-mark i {
  background: var(--brand);
}
.login-card h1 {
  font-size: 1.45rem;
  margin-bottom: 10px;
}
.login-card p {
  color: var(--muted);
  font-size: 0.875rem;
}
.login-card form {
  margin-top: 28px;
  display: grid;
  gap: 19px;
}
.login-card .primary {
  width: 100%;
}
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: var(--ink);
  color: var(--inverse);
  padding: 13px 20px;
  border-radius: 12px;
  z-index: 100;
  box-shadow: var(--shadow-raised);
  display: none;
  line-height: 1.6;
  font-size: 0.9375rem;
}
#toast.show {
  display: block;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  width: min(650px, calc(100vw - 32px));
  max-height: 90dvh;
  overflow: auto;
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow-raised);
}
dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(3px);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.dialog-head h2 {
  margin: 0;
  font-size: 1.3rem;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 26px;
}
.code {
  font-family: ui-monospace, monospace;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  background: var(--surface);
  padding: 15px;
  border-radius: 8px;
}
.busy {
  opacity: 0.65;
  pointer-events: none;
}
.inline-error {
  color: var(--danger);
  font-size: 0.875rem;
  line-height: 1.6;
}
.checkbox-field {
  padding: 12px 0;
}
.section-gap {
  margin-top: 26px;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.progress {
  height: 6px;
  background: var(--brand-soft-hover);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 16px;
}
.progress span {
  display: block;
  width: 30%;
  height: 100%;
  background: var(--brand);
  animation: move 1.5s infinite ease-in-out;
}
@keyframes move {
  50% {
    transform: translateX(200%);
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
@media (max-width: 1050px) {
  .sidebar {
    width: 185px;
    padding-inline: 12px;
  }
  .layout {
    grid-template-columns: 185px minmax(0, 1fr);
  }
  .content {
    padding: 28px 25px 72px;
  }
  .topbar {
    padding-inline: 25px;
  }
  .grid.two {
    grid-template-columns: 1fr;
  }
  .grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 680px) {
  .layout {
    display: block;
  }
  .sidebar {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    height: 74px;
    padding: 0 4px;
    background: var(--panel);
    border-right: 0;
    border-top: 1px solid var(--line);
    z-index: 40;
  }
  .sidebar > .brand,
  .sidebar-footer {
    display: none;
  }
  .nav {
    height: 100%;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
  }
  .nav button {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    font-size: 0.75rem;
    padding: 6px 1px;
    border-radius: 0;
    min-width: 0;
  }
  .nav button.active,
  .nav button.active:hover:not(:disabled) {
    box-shadow: inset 0 3px var(--brand);
  }
  .nav-symbol {
    font-size: 1.2rem;
    height: 23px;
  }
  .topbar {
    height: 65px;
    padding: 0 20px;
  }
  .topbar-label {
    font-size: 0.8125rem;
  }
  .content {
    padding: 25px 18px 102px;
  }
  .page-head {
    margin-bottom: 22px;
  }
  .page-head h1 {
    font-size: 1.45rem;
  }
  .page-head p {
    font-size: 0.875rem;
  }
  .grid.equal,
  .grid.three {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 20px;
    border-radius: 14px;
  }
  .stats {
    gap: 4px;
  }
  .stat {
    padding-left: 11px;
  }
  .stat strong {
    font-size: 1.5rem;
  }
  .stat span {
    font-size: 0.8125rem;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field.full {
    grid-column: auto;
  }
  .device-meta {
    gap: 10px;
  }
  .device-meta span {
    font-size: 0.8125rem;
  }
  .device-meta strong {
    font-size: 0.875rem;
  }
  .record {
    grid-template-columns: 58px 1fr;
    gap: 14px;
  }
  .record .status {
    font-size: 0.75rem;
    padding: 3px 7px;
  }
  #toast {
    bottom: 90px;
  }
  .login-card {
    padding: 30px 26px;
  }
  .toolbar input {
    max-width: none;
  }
  .toolbar > * {
    flex: 1 1 120px;
  }
  .list-row {
    gap: 10px;
  }
  .topbar-actions {
    gap: 8px;
  }
}

.library-tools { display: grid; gap: 16px; margin-bottom: 20px; }
.library-tools .toolbar { margin: 0; }
.library-tools .toolbar .field { width: 100%; max-width: 560px; }
.library-tools input { max-width: none; }
.category-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.category-chips button { border-radius: 24px; padding: 8px 15px; }
.category-chips [aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.category-chips [aria-pressed="true"]:hover:not(:disabled) { background: var(--brand-soft-hover); border-color: var(--brand); }
.role-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.role-card h2, .role-card p { margin: 0; }
.role-card .actions { margin-top: auto; padding-top: 10px; }
.role-avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); font-size: 23px; font-weight: 600; }
.role-description { color: var(--muted); line-height: 1.65; min-height: 3.3em; }
.prompt-preview { white-space: pre-wrap; line-height: 1.8; }
.draft-panel { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); }
.draft-panel textarea { display: block; width: 100%; margin: 10px 0; }
.guide-steps { padding-left: 24px; }
.guide-steps li { padding: 5px 0; }
.guide-steps p, .faq p { color: var(--muted); line-height: 1.75; }
.faq { border-bottom: 1px solid var(--line); padding: 15px 0; }
.faq summary { cursor: pointer; font-weight: 600; line-height: 1.6; }
.diagnostic-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-bottom: 1px solid var(--line); padding: 16px 0; }
.diagnostic-row > span { text-align: right; }
.diagnostic-row p { grid-column: 1 / -1; margin: 0; }
input[readonly] { background: var(--surface); color: var(--muted); }

fieldset.form-grid { border: 0; padding: 0; margin: 0; min-width: 0; }

.clone-workspace { display: grid; gap: 22px; }
.clone-workspace .page-head { margin-bottom: 0; }
.clone-workspace .clone-settings, .clone-workspace .clone-register { padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.clone-workspace summary { cursor: pointer; font-weight: 600; line-height: 1.6; }
.clone-settings[open] summary { margin-bottom: 20px; }
.clone-settings .form-grid, .clone-register .form-grid { margin-bottom: 18px; }
.clone-card { display: flex; flex-direction: column; gap: 14px; }
.clone-card .card-header, .clone-card p { margin: 0; }
.clone-card .speaker-id { overflow-wrap: anywhere; font-family: ui-monospace, monospace; font-size: .8125rem; color: var(--muted); }
.clone-card audio { display: block; width: 100%; }
.clone-card .clone-training { padding-top: 16px; border-top: 1px solid var(--line); }
.clone-training .field { margin-bottom: 14px; }
.clone-training .check-row { align-items: flex-start; line-height: 1.6; }
.clone-training input[type="checkbox"] { flex: 0 0 20px; margin-top: 2px; }
.clone-training input[type="file"] { max-width: 100%; min-width: 0; font-size: .875rem; }
.clone-training .actions { margin-top: 16px; }
.clone-card [role="status"]:empty, .clone-card [role="alert"]:empty { display: none; }
.clone-card [role="alert"] { color: var(--danger); }
.clone-card .clone-preview { display: grid; gap: 10px; }
.clone-card .clone-preview[hidden] { display: none; }
@media (max-width: 620px) {
  .clone-workspace .page-head { flex-direction: column; gap: 14px; }
  .clone-workspace .page-head .actions { width: 100%; }
  .clone-workspace .page-head .actions button { flex: 1; }
  .clone-card .card-header { align-items: flex-start; }
  .clone-training .actions button { flex: 1; }
}
