* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f4f6f8;
  color: #18212b;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  min-width: 0;
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid #bdc9d4;
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: #253648;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.training-topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  min-height: 76px;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #dce2e8;
  background: rgba(255, 255, 255, 0.97);
}

.training-topbar h1,
.training-topbar p,
.section-head h2 {
  margin: 0;
}

.training-topbar h1 {
  font-size: 20px;
}

.training-topbar p {
  margin-top: 4px;
  color: #667586;
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.training-layout {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 24px 28px 60px;
  display: grid;
  gap: 20px;
}

.summary-band,
.training-section {
  border: 1px solid #dce2e8;
  border-radius: 8px;
  background: #fff;
}

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

.summary-band > div {
  min-height: 82px;
  padding: 16px 18px;
  display: grid;
  gap: 5px;
  border-right: 1px solid #e3e8ed;
}

.summary-band > div:last-child {
  border-right: 0;
}

.summary-band span,
.section-head span,
label > span,
legend {
  color: #667586;
  font-size: 12px;
}

.summary-band strong {
  font-size: 24px;
}

.section-head {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #e3e8ed;
}

.section-head h2 {
  margin-top: 3px;
  font-size: 18px;
}

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

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd4dc;
  border-radius: 5px;
  padding: 0 10px;
  background: #fff;
  color: #18212b;
}

input,
select {
  height: 38px;
}

textarea {
  min-height: 66px;
  padding-top: 8px;
  resize: vertical;
}

.checkbox-control {
  min-height: 38px;
  align-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-control input,
.assignee-option input,
.review-featured input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--fd-color-primary);
}

.checkbox-control span {
  color: #253648;
  font-size: 13px;
}

.assignee-fieldset {
  min-width: 0;
  margin: 0;
  padding: 12px;
  grid-column: 1 / -1;
  border: 1px solid #d8e0e7;
  border-radius: 6px;
}

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

.assignee-option {
  min-height: 38px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e0e6eb;
  border-radius: 5px;
}

.assignee-option span {
  min-width: 0;
  color: #253648;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.page-status {
  min-height: 20px;
  margin: 0;
  padding: 0 18px 16px;
  color: #526a7c;
  font-size: 13px;
}

.page-status.is-error {
  color: var(--fd-color-danger);
}

.page-status.is-success {
  color: var(--fd-color-success);
}

.task-list {
  display: grid;
}

.task-empty {
  padding: 32px 18px;
  color: #667586;
  text-align: center;
}

.task-item {
  border-bottom: 1px solid #e3e8ed;
}

.task-item:last-child {
  border-bottom: 0;
}

.task-item-head {
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.task-item-head h3,
.task-item-head p {
  margin: 0;
}

.task-item-head h3 {
  font-size: 16px;
}

.task-item-head p {
  margin-top: 6px;
  color: #667586;
  font-size: 12px;
}

.task-item-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.status-badge {
  width: fit-content;
  padding: 3px 7px;
  border: 1px solid var(--fd-color-primary-line);
  border-radius: var(--fd-radius-sm);
  background: var(--fd-color-success-soft);
  color: var(--fd-color-success);
  font-size: 11px;
}

.status-badge.is-closed,
.status-badge.is-overdue {
  border-color: #e5bbb6;
  background: var(--fd-color-danger-soft);
  color: var(--fd-color-danger);
}

.task-progress {
  padding: 0 18px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #486174;
  font-size: 12px;
}

.task-progress-track {
  height: 7px;
  flex: 1;
  overflow: hidden;
  border-radius: 4px;
  background: #e8edf1;
}

.task-progress-track i {
  height: 100%;
  display: block;
  background: var(--fd-color-success);
}

.assignment-table-wrap {
  overflow-x: auto;
  border-top: 1px solid #edf0f3;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid #edf0f3;
  text-align: left;
  overflow-wrap: anywhere;
}

th {
  color: #667586;
  background: #fafbfc;
  font-size: 12px;
  font-weight: 600;
}

td {
  font-size: 13px;
}

.attempts-cell {
  padding: 0;
  background: #fafbfc;
}

.attempt-list {
  padding: 12px 18px;
  display: grid;
  gap: 10px;
}

.attempt-item {
  padding-bottom: 10px;
  display: grid;
  grid-template-columns: 120px 80px minmax(220px, 1fr) auto;
  align-items: start;
  gap: 10px;
  border-bottom: 1px solid #e2e7ec;
}

.attempt-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.attempt-meta {
  color: #667586;
  font-size: 12px;
}

.attempt-overview {
  display: grid;
  gap: 7px;
}

.attempt-overview button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.review-featured {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.attempt-detail-dialog {
  width: min(820px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--fd-color-line);
  border-radius: var(--fd-radius-lg);
  background: var(--fd-color-surface);
  color: var(--fd-color-ink);
}

.attempt-detail-dialog::backdrop {
  background: rgb(20 35 48 / 42%);
}

.attempt-detail-head {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e3e8ed;
}

.attempt-detail-head span {
  color: #667586;
  font-size: 12px;
}

.attempt-detail-head h2 {
  margin: 3px 0 0;
  font-size: 18px;
}

.attempt-detail-head button {
  width: 36px;
  padding: 0;
  font-size: 22px;
}

.attempt-detail-body {
  max-height: calc(100vh - 130px);
  padding: 18px;
  overflow-y: auto;
}

.attempt-detail-body section {
  margin-top: 18px;
}

.attempt-detail-body h3 {
  margin: 0 0 9px;
  font-size: 15px;
}

.attempt-recording {
  width: 100%;
  height: 40px;
}

.attempt-recording-meta {
  margin-top: 7px !important;
  color: #667586 !important;
  font-size: 12px;
}

.attempt-detail-body p {
  margin: 0;
  color: #45576a;
  line-height: 1.65;
}

.attempt-audit-retry-button {
  min-height: 32px;
  margin-top: 10px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 600;
}

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

.attempt-detail-summary > div {
  padding: 10px;
  display: grid;
  gap: 4px;
  border: 1px solid #e0e6eb;
  border-radius: 6px;
}

.attempt-detail-summary span {
  color: #667586;
  font-size: 11px;
}

.attempt-score-section,
.attempt-deduction-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e0e6eb;
}

.attempt-detail-body h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.attempt-score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 16px;
}

.attempt-score-grid > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #edf1f4;
}

.attempt-score-grid span {
  color: #45576a;
  font-size: 12px;
}

.attempt-score-grid strong {
  color: #18212b;
  font-size: 12px;
}

.attempt-deduction-list {
  display: grid;
  gap: 12px;
}

.attempt-deduction-list article {
  padding: 0 0 12px 12px;
  border-bottom: 1px solid #e0e6eb;
  border-left: 3px solid var(--fd-color-danger);
}

.attempt-deduction-list article:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.attempt-deduction-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.attempt-deduction-heading > span {
  flex: 0 0 auto;
  color: var(--fd-color-danger);
  font-weight: 700;
}

.attempt-deduction-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 9px;
  padding: 3px 0;
}

.attempt-deduction-row > span {
  color: #667586;
  font-size: 11px;
}

.attempt-deduction-row > p {
  color: #33485b;
  overflow-wrap: anywhere;
}

.attempt-no-deductions {
  margin-top: 12px !important;
  color: var(--fd-color-success) !important;
  font-weight: 600;
}

.attempt-transcript {
  display: grid;
  gap: 8px;
}

.attempt-turn {
  padding: 9px 11px;
  border-left: 3px solid #8ca1b4;
  background: #f5f7f9;
}

.attempt-turn.is-sales {
  border-left-color: var(--fd-color-info);
}

.attempt-turn.is-customer {
  border-left-color: var(--fd-color-success);
}

.attempt-detail-error {
  color: var(--fd-color-danger) !important;
}

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

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

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

  .attempt-score-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .training-topbar {
    align-items: flex-start;
    padding: 12px 16px;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .training-layout {
    padding: 16px;
  }

  .summary-band,
  .task-form,
  .assignee-list {
    grid-template-columns: 1fr;
  }

  .attempt-deduction-row {
    grid-template-columns: 1fr;
    gap: 1px;
  }

  .summary-band > div {
    border-right: 0;
    border-bottom: 1px solid #e3e8ed;
  }

  .summary-band > div:last-child {
    border-bottom: 0;
  }

  .task-item-head {
    flex-direction: column;
  }

  .attempt-item {
    grid-template-columns: 1fr;
  }
}

/* 后台任务工作台：在保留既有功能选择器的前提下，统一新的轻量工作界面。 */
body {
  background: var(--admin-page);
  color: var(--admin-ink);
}

button,
input,
select,
textarea {
  border-color: #cbd6e0;
}

button {
  min-height: 38px;
  border-radius: 6px;
  color: #304255;
  font-weight: 600;
}

button:hover:not(:disabled) {
  border-color: #97a9bb;
  background: #f8fafc;
}

.training-topbar {
  min-height: 70px;
  padding: 11px max(28px, calc((100vw - 1380px) / 2));
  border-bottom-color: var(--admin-border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 1px 0 rgba(23, 36, 53, 0.02);
}

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

.admin-brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #172435;
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.admin-brand-eyebrow,
.training-topbar .admin-brand-eyebrow {
  margin: 0 0 2px;
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.training-topbar h1 {
  font-size: 18px;
  line-height: 1.25;
}

.topbar-actions {
  align-items: center;
  gap: 8px;
}

.organization-switcher {
  display: flex;
  align-items: center;
  gap: 7px;
}

.organization-switcher label {
  color: var(--admin-muted);
  font-size: 12px;
  white-space: nowrap;
}

.organization-switcher:has(select[hidden]) {
  display: none;
}

.organization-switcher select {
  width: 170px;
  height: 36px;
  background: #f8fafc;
  font-size: 13px;
}

.training-layout {
  width: min(1380px, 100%);
  padding: 30px max(28px, calc((100vw - 1380px) / 2)) 72px;
  gap: 18px;
}

.training-page-heading {
  min-height: 74px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.training-page-heading > div > span,
.section-head > div > span {
  color: var(--admin-accent);
  font-size: 12px;
  font-weight: 700;
}

.training-page-heading h2 {
  margin: 5px 0 5px;
  color: var(--admin-ink);
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: 0;
}

.training-page-heading p {
  margin: 0;
  color: var(--admin-muted);
  font-size: 13px;
}

.admin-page-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--admin-border);
  border-radius: 7px;
  background: #ffffff;
}

.admin-page-nav a {
  min-height: 30px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  color: #526477;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.admin-page-nav a:hover {
  background: #f2f6f8;
}

.admin-page-nav a.is-current {
  background: var(--admin-accent-soft);
  color: #0b655e;
}

.summary-band,
.training-section {
  overflow: hidden;
  border-color: var(--admin-border);
  border-radius: 8px;
  background: var(--admin-surface);
  box-shadow: 0 1px 2px rgba(23, 36, 53, 0.025);
}

.summary-band {
  gap: 0;
}

.summary-band > div {
  min-height: 104px;
  padding: 18px 20px;
  gap: 3px;
  border-right-color: #e7edf1;
}

.summary-band span {
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 600;
}

.summary-band strong {
  color: var(--admin-ink);
  font-size: 28px;
  line-height: 1.1;
}

.summary-band small {
  color: #8290a0;
  font-size: 12px;
}

.section-head {
  min-height: 76px;
  padding: 17px 20px;
  border-bottom-color: #e7edf1;
}

.section-head h2 {
  margin-top: 4px;
  color: var(--admin-ink);
  font-size: 18px;
  letter-spacing: 0;
}

.section-head > p {
  margin: 0;
  color: var(--admin-muted);
  font-size: 13px;
}

.task-form {
  padding: 22px 20px 18px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.task-form > label {
  grid-column: span 3;
}

.task-form > .task-field-title {
  grid-column: span 7;
}

.task-form > .task-field-scenario {
  grid-column: span 5;
}

.task-form > .task-field-due-at {
  grid-column: span 3;
}

.task-form label > span,
.assignee-fieldset legend {
  color: #4f6377;
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  border-radius: 6px;
  color: var(--admin-ink);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--admin-blue);
  outline: 3px solid rgba(37, 99, 235, 0.12);
}

.checkbox-control {
  min-height: 40px;
  padding: 0 2px;
}

.checkbox-control span {
  color: #41566a;
  font-size: 13px;
}

.assignee-fieldset {
  padding: 15px;
  border-color: #d9e3e8;
  border-radius: 7px;
  background: #fbfcfd;
}

.assignee-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.assignee-option {
  min-height: 42px;
  padding: 8px 10px;
  border-color: #dbe4ea;
  border-radius: 6px;
  background: #ffffff;
}

.assignee-option:has(input:checked) {
  border-color: #87c8bf;
  background: #f1faf8;
}

.form-actions {
  padding-top: 2px;
  justify-content: flex-start;
}

.form-actions .primary {
  min-width: 132px;
}

.page-status {
  min-height: 34px;
  padding: 0 20px 16px;
  color: var(--admin-muted);
}

.task-empty {
  padding: 52px 20px;
  color: var(--admin-muted);
}

.task-item-head {
  padding: 19px 20px 16px;
}

.task-item-head h3 {
  color: var(--admin-ink);
  font-size: 16px;
}

.task-item-head p {
  color: var(--admin-muted);
  line-height: 1.55;
}

.task-item-actions {
  min-height: 32px;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
}

.task-item-actions button,
.section-head > button {
  min-height: 32px;
  font-size: 12px;
}

.task-item-actions > button,
.task-item-actions > .status-badge {
  box-sizing: border-box;
  min-height: 32px;
  white-space: nowrap;
}

.task-item-actions > .status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.status-badge {
  padding: 4px 8px;
  border-color: #92cabc;
  border-radius: 4px;
  background: #edf9f6;
  color: #147268;
  font-weight: 700;
}

.task-progress {
  padding: 0 20px 17px;
  color: #526477;
}

.task-progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e7eff0;
}

.task-progress-track i {
  background: var(--admin-accent);
}

th {
  padding: 12px 14px;
  background: #f7f9fa;
  color: #5d6f82;
}

td {
  padding: 12px 14px;
  color: #33485b;
}

@media (max-width: 980px) {
  .training-layout {
    padding-inline: 22px;
  }

  .task-form > .task-field-title,
  .task-form > .task-field-scenario {
    grid-column: span 6;
  }

  .task-form > label,
  .task-form > .task-field-due-at {
    grid-column: span 4;
  }

  .assignee-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .training-topbar {
    padding-inline: 16px;
  }

  .training-page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

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

  .admin-page-nav {
    width: 100%;
    overflow-x: auto;
  }

  .task-form > .task-field-title,
  .task-form > .task-field-scenario,
  .task-form > label,
  .task-form > .task-field-due-at {
    grid-column: span 6;
  }

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

@media (max-width: 600px) {
  .training-topbar {
    gap: 12px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .topbar-actions button {
    width: 100%;
  }

  .organization-switcher {
    grid-column: 1 / -1;
  }

  .organization-switcher select {
    flex: 1;
  }

  .training-layout {
    padding: 20px 16px 48px;
  }

  .summary-band > div {
    min-height: 78px;
    padding: 14px 16px;
  }

  .summary-band strong {
    font-size: 24px;
  }

  .summary-band small {
    display: none;
  }

  .section-head {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .section-head > p {
    font-size: 12px;
  }

  .task-form {
    padding: 16px;
    gap: 14px;
  }

  .task-form > .task-field-title,
  .task-form > .task-field-scenario,
  .task-form > label,
  .task-form > .task-field-due-at {
    grid-column: 1 / -1;
  }

  .assignee-fieldset {
    padding: 12px;
  }

  .task-item-head,
  .task-progress {
    padding-inline: 16px;
  }

  .task-item-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}
