:root {
  --page-bg: #f4f6fb;
  --sidebar-bg: #171729;
  --sidebar-panel: #142747;
  --sidebar-text: #f8fafc;
  --sidebar-muted: #c8ced8;
  --blue: #3498db;
  --green: #27ae60;
  --orange: #f39c12;
  --red: #e74c3c;
  --line: #d6dce6;
  --line-soft: #e7eaf0;
  --text: #26364a;
  --muted: #666f7d;
  --panel: #ffffff;
  --blue-soft: #eaf4fd;
  --green-soft: #d9f5e4;
  --yellow-soft: #fff8e7;
  --red-soft: #fde0dc;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(#edf1f7, #edf1f7) 285px 0 / calc(100% - 285px) 100% no-repeat,
    linear-gradient(rgba(33, 150, 243, .06) 1px, transparent 1px) 0 0 / 12px 12px,
    linear-gradient(90deg, rgba(33, 150, 243, .06) 1px, transparent 1px) 0 0 / 12px 12px,
    #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.training-shell {
  display: grid;
  grid-template-columns: 285px minmax(980px, 1fr);
  min-height: 100vh;
}

.training-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 50px 30px 26px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
}

.training-brand {
  margin: 0 0 28px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.training-nav {
  display: grid;
  gap: 18px;
}

.training-nav a {
  position: relative;
  display: block;
  padding: 7px 24px;
  color: var(--sidebar-muted);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.8;
  text-align: center;
}

.training-nav a.active,
.training-nav a:hover {
  color: #ffffff;
}

.training-nav a.active::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 0;
  width: 5px;
  height: 52px;
  background: var(--blue);
}

.sidebar-block {
  width: 202px;
  height: 52px;
  margin: 30px auto 0;
  background: #143b69;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 182px;
  min-height: 82px;
  margin: auto auto 0;
  padding: 0 22px;
  background: #142542;
  color: #ffffff;
  font-weight: 700;
}

.sidebar-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: rgba(52, 152, 219, .18);
  color: #9fd2ff;
}

.training-main {
  min-width: 0;
  padding: 28px 30px 34px;
}

.main-inner {
  max-width: 1380px;
  margin: 0 auto;
}

.top-strip,
.filter-bar,
.summary-strip,
.panel,
.round-panel {
  border: 1px solid var(--line);
  background: var(--panel);
}

.top-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  margin: 16px 0 0;
  padding: 0 22px;
  border-radius: 8px;
}

.top-strip strong {
  font-size: 20px;
}

.todo-red {
  color: #f44336;
  font-size: 15px;
  font-weight: 700;
}

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

.top-strip + .metric-grid {
  margin-top: 0;
}

.metric-card {
  display: grid;
  place-items: center;
  min-height: 120px;
  border-radius: 16px;
  text-align: center;
}

.metric-card.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.metric-card.green {
  background: var(--green-soft);
  color: var(--green);
}

.metric-card.yellow {
  background: var(--yellow-soft);
  color: var(--orange);
}

.metric-card.red {
  background: var(--red-soft);
  color: var(--red);
}

.metric-number {
  display: block;
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
}

.metric-label {
  display: block;
  margin-top: 18px;
  color: #4a5563;
  font-size: 15px;
}

.quick-bar,
.filter-bar,
.summary-strip {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 80px;
  margin: 20px 0;
  padding: 16px 22px;
  border-radius: 8px;
}

.summary-strip {
  min-height: 42px;
  justify-content: flex-start;
  color: #4a5563;
}

.summary-strip strong {
  color: #ff3b30;
}

.quick-label,
.field-label {
  color: #424b5a;
  font-weight: 600;
  white-space: nowrap;
}

.filter-bar {
  flex-wrap: wrap;
}

.filter-spacer {
  flex: 1 1 auto;
}

.segmented {
  display: inline-flex;
  gap: 4px;
}

.segmented button,
.plain-input,
.plain-select,
.btn,
.pager button {
  min-height: 34px;
  border: 1px solid #bcc5d2;
  border-radius: 5px;
  background: #f6f8fb;
  color: #4c5564;
  padding: 0 16px;
}

.segmented button.active,
.btn.primary,
.pager button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  color: #ffffff;
  border-color: transparent;
  background: var(--blue);
  font-weight: 700;
}

.btn.green {
  background: var(--green);
}

.btn.red {
  background: var(--red);
}

.btn.gray {
  color: #4c5564;
  border-color: #bcc5d2;
  background: #f6f8fb;
}

.plain-input {
  width: 200px;
  background: #f7f8fb;
}

.plain-select {
  min-width: 122px;
  appearance: none;
  background: #f7f8fb;
}

.round-panel {
  min-height: 480px;
  padding: 44px 16px 28px;
  border-radius: 72px;
}

.round-panel.tight {
  min-height: 360px;
  padding-top: 28px;
}

.round-panel.with-title {
  padding: 18px 16px 28px;
}

.panel-title {
  margin: 0 0 14px 0;
  font-size: 16px;
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
}

.training-table {
  width: 100%;
  border-collapse: collapse;
  color: #424b5a;
  font-size: 13px;
}

.training-table th,
.training-table td {
  height: 50px;
  border: 1px solid #dde2eb;
  padding: 8px 14px;
  text-align: center;
  white-space: nowrap;
}

.training-table th {
  background: #f2f4f8;
  font-weight: 700;
}

.training-table tr:nth-child(even) td {
  background: #fbfbfc;
}

.score-green {
  color: var(--green);
  font-weight: 800;
}

.score-orange {
  color: var(--orange);
  font-weight: 800;
}

.score-red {
  color: #ff3b30;
  font-weight: 800;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  height: 30px;
  border-radius: 5px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
}

.tag.green {
  border: 1px solid var(--green);
  background: #e9f8ef;
  color: var(--green);
}

.tag.orange {
  border: 1px solid var(--orange);
  background: #fff7e8;
  color: var(--orange);
}

.tag.red {
  border: 1px solid #ff3b30;
  background: #fff2ef;
  color: #ff3b30;
}

.tag.blue {
  border: 1px solid var(--blue);
  background: #eef7ff;
  color: var(--blue);
}

.stars {
  color: #ffc107;
  font-size: 18px;
  letter-spacing: 1px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 34px;
}

.chart-box {
  display: grid;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 44px;
  background: #ffffff;
  padding: 20px 26px;
}

.chart-box.wide {
  grid-column: 1 / -1;
  min-height: 282px;
  margin-top: 16px;
}

.chart-placeholder {
  align-self: center;
  justify-self: center;
  color: #8a8f98;
  line-height: 1.8;
  text-align: center;
  width: 100%;
}

.training-chart,
.training-radar,
.training-pie,
.training-bars {
  width: 100%;
  min-height: 220px;
}

.training-chart svg,
.training-radar svg,
.training-pie svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-axis,
.radar-axis {
  stroke: #d7dde8;
  stroke-width: 1.5;
}

.chart-value {
  fill: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.chart-label {
  fill: #6b7482;
  font-size: 12px;
}

.chart-empty,
.modal-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: #8a95a5;
}

.training-bars {
  display: grid;
  gap: 14px;
  align-content: center;
}

.chart-bar-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.chart-bar-row span {
  overflow: hidden;
  color: #4a5563;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-bar-track {
  height: 16px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #65b7ee);
}

.radar-grid {
  fill: none;
  stroke: #dfe5ee;
  stroke-width: 1;
}

.radar-area {
  fill: rgba(52, 152, 219, .22);
  stroke: var(--blue);
  stroke-width: 3;
}

.training-pie {
  display: grid;
  gap: 22px;
  align-items: center;
}

.pie-legend {
  display: grid;
  gap: 10px;
  color: #4a5563;
  text-align: left;
}

.pie-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pie-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.detail-note {
  min-height: 240px;
  margin-top: 36px;
  border: 2px dashed var(--blue);
  border-radius: 34px;
  background: #ffffff;
  padding: 28px 24px;
  color: #566070;
  line-height: 1.8;
}

.detail-note strong {
  color: var(--blue);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
}

.side-chart {
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 44px;
  background: #ffffff;
  padding: 24px;
}

.score-layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 20px;
  margin-top: 38px;
}

.score-card {
  min-height: 400px;
  border: 1px solid var(--line);
  border-radius: 52px;
  background: #ffffff;
  padding: 24px;
}

.score-big {
  display: flex;
  align-items: center;
  gap: 44px;
  margin: 18px 0 34px 44px;
  color: var(--blue);
}

.score-big strong {
  font-size: 58px;
  line-height: 1;
}

.score-badge {
  border-radius: 6px;
  padding: 10px 22px;
  background: var(--blue);
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  padding: 10px 12px;
  background: #eef6fc;
}

.bar {
  height: 22px;
  border-radius: 3px;
  background: var(--blue);
}

.bar.green {
  background: var(--green);
}

.bar.orange {
  background: var(--orange);
}

.bar.red {
  background: var(--red);
}

.rank-table td:nth-child(1),
.rank-table td:nth-child(3) {
  font-weight: 800;
}

.rank-top td {
  background: #d7f5e4 !important;
  color: var(--green);
}

.rank-current td {
  background: #eaf4fd !important;
  color: var(--blue);
}

.rating-panel {
  margin-top: 38px;
  min-height: 350px;
  border-radius: 52px;
  padding: 24px 30px;
}

.rating-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 30px;
  margin: 22px 0 28px;
}

.rating-box {
  min-height: 82px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  text-align: center;
  line-height: 1.8;
}

.rating-box.green {
  border: 1px solid var(--green);
  background: #d9f5e4;
  color: var(--green);
}

.rating-box.blue {
  border: 1px solid var(--blue);
  background: #eaf4fd;
  color: var(--blue);
}

.rating-box.orange {
  border: 1px solid var(--orange);
  background: #fff8e7;
  color: var(--orange);
}

.rating-box.red {
  border: 1px solid var(--red);
  background: #fde0dc;
  color: var(--red);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px;
  width: fit-content;
  min-width: 300px;
  margin: 40px auto 0;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 4px 10px;
}

.pager button {
  min-width: 40px;
  min-height: 24px;
  padding: 0 10px;
}

.pager button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.pager-info {
  padding: 0 8px;
  color: #6c7583;
  font-size: 12px;
}

.score-card .pager {
  width: 100%;
  min-width: 0;
  margin: 16px 0 0;
  border: 0;
  background: transparent;
  padding: 0;
}

.score-card .pager-info {
  flex-basis: 100%;
  margin-top: 6px;
  text-align: center;
}

.action-group {
  display: inline-flex;
  gap: 10px;
}

.text-blue {
  color: var(--blue);
}

.link-button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.training-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 18, 32, .48);
  padding: 24px;
}

.training-modal-overlay.open {
  display: flex;
}

.training-modal-card {
  width: min(860px, 96vw);
  max-height: 86vh;
  overflow: hidden;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(10, 18, 32, .24);
}

.training-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 22px;
}

.training-modal-head strong {
  font-size: 18px;
}

.training-modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fc;
  color: #526071;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.training-modal-body {
  max-height: calc(86vh - 58px);
  overflow: auto;
  padding: 22px;
}

.training-timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  max-width: 78%;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #f8fafc;
  padding: 12px 14px;
}

.timeline-item.seat {
  justify-self: start;
  border-color: #bfe2ff;
  background: #eef8ff;
}

.timeline-item.ai,
.timeline-item.customer {
  justify-self: end;
  border-color: #ffd89b;
  background: #fff8e7;
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  color: #667386;
  font-size: 12px;
}

.timeline-text {
  color: #26364a;
  line-height: 1.7;
  text-align: left;
  white-space: pre-wrap;
}

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

.training-detail-grid div {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px 14px;
}

.training-detail-grid span {
  display: block;
  margin-bottom: 6px;
  color: #7a8492;
  font-size: 12px;
}

.training-detail-grid strong {
  color: #26364a;
  line-height: 1.6;
}

@media (max-width: 1100px) {
  body {
    background: var(--page-bg);
  }

  .training-shell {
    grid-template-columns: 1fr;
  }

  .training-sidebar {
    position: static;
    height: auto;
    padding: 20px;
  }

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

  .training-nav a.active::after,
  .sidebar-block,
  .sidebar-user {
    display: none;
  }

  .training-main {
    padding: 18px;
  }

  .metric-grid,
  .chart-grid,
  .score-layout,
  .rating-grid,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .chart-box.wide {
    grid-column: auto;
  }

  .timeline-item,
  .training-detail-grid {
    max-width: 100%;
    grid-template-columns: 1fr;
  }
}
