:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --ink: #202422;
  --muted: #7a837f;
  --line: #e2e8e4;
  --brand: #256f5a;
  --brand-strong: #174c3e;
  --brand-soft: #e8f5ef;
  --bad: #d84b42;
  --bad-soft: #fff0ee;
  --good: #2f9b67;
  --good-soft: #e8f7ef;
  --warn: #d56b1f;
  --warn-soft: #fff2e7;
  --shadow: 0 12px 30px rgba(25, 40, 33, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.login-shell,
.app-shell {
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 18px 14px 42px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.login-card,
.panel,
.stat-card,
.photo-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-card {
  display: grid;
  gap: 18px;
  width: min(460px, 100%);
  padding: 26px 22px;
}

.login-card h1 {
  font-size: 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 112px;
  margin-bottom: 14px;
  padding: 22px;
  border-radius: 18px;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.76);
  font-weight: 850;
}

.eyebrow.dark {
  color: var(--brand);
}

h1 {
  font-size: 34px;
  line-height: 1.08;
}

h2 {
  font-size: 22px;
}

.user-line {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 800;
}

.panel {
  margin-bottom: 14px;
  padding: 16px;
}

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

.section-head.tight {
  align-items: center;
}

.section-head p,
.small-note,
.muted {
  color: var(--muted);
}

.section-head p {
  margin-top: 6px;
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.field input,
.field textarea,
.user-form input {
  width: 100%;
  min-height: 52px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  outline: none;
  background: #fff;
  font-size: 18px;
}

.field input:focus,
.field textarea:focus,
.user-form input:focus {
  border-color: var(--brand);
}

.field textarea {
  min-height: 98px;
  resize: vertical;
  line-height: 1.5;
}

.primary-button,
.ghost-button,
.big-action,
.user-actions button,
.example-upload {
  border: 0;
  border-radius: 14px;
  font-weight: 950;
}

.primary-button {
  min-height: 58px;
  background: var(--brand);
  color: #fff;
  font-size: 20px;
}

.primary-button.compact {
  min-height: 52px;
  padding: 0 18px;
  font-size: 16px;
}

.ghost-button {
  min-height: 42px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.18);
  color: inherit;
}

.ghost-button.dark {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-strong);
}

.big-action {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 74px;
  background: var(--brand);
  color: #fff;
  font-size: 22px;
}

.big-action input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat-card {
  display: grid;
  gap: 6px;
  min-height: 86px;
  padding: 14px;
  align-content: center;
  text-align: left;
}

button.stat-card {
  appearance: none;
}

.stat-card.clickable:active {
  transform: translateY(1px);
}

.stat-card span {
  color: var(--muted);
  font-weight: 850;
}

.stat-card strong {
  color: var(--brand);
  font-size: 32px;
  line-height: 1;
}

.stat-card.good strong {
  color: var(--good);
}

.stat-card.bad strong {
  color: var(--bad);
}

.score-good,
.stat-card strong.score-good {
  color: var(--good);
}

.score-warn,
.stat-card strong.score-warn {
  color: var(--warn);
}

.score-bad,
.stat-card strong.score-bad {
  color: var(--bad);
}

.reason-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reason-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 900;
}

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

.photo-card {
  overflow: hidden;
}

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: #edf1ef;
}

.photo-caption {
  display: grid;
  gap: 4px;
  padding: 10px 12px 12px;
}

.photo-caption-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.photo-caption strong {
  font-size: 18px;
}

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

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

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

.score-pill,
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 950;
  background: #f7faf8;
}

.score-pill.score-good,
.score-badge.score-good {
  background: var(--good-soft);
}

.score-pill.score-warn,
.score-badge.score-warn {
  background: var(--warn-soft);
}

.score-pill.score-bad,
.score-badge.score-bad {
  background: var(--bad-soft);
}

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

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

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #f8faf9;
}

.user-row div:first-child {
  display: grid;
  gap: 3px;
}

.user-row span {
  color: var(--muted);
  font-size: 14px;
}

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

.user-actions button {
  min-height: 36px;
  padding: 0 10px;
  background: #fff;
  color: var(--brand-strong);
  border: 1px solid var(--line);
}

.user-actions button:disabled {
  opacity: 0.45;
}

.example-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.example-upload {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 62px;
  border: 2px dashed var(--line);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.example-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.example-actions {
  display: grid;
  grid-template-columns: minmax(0, 220px);
}

.example-actions .primary-button {
  width: 100%;
}

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

.example-card {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #f8faf9;
  border: 1px solid var(--line);
}

.example-card img {
  width: 120px;
  aspect-ratio: 1;
  border-radius: 10px;
  object-fit: cover;
  background: #edf1ef;
}

.example-body {
  display: grid;
  gap: 8px;
}

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

.example-note {
  line-height: 1.45;
  font-weight: 850;
}

.performance-list {
  display: grid;
  gap: 8px;
}

.performance-card {
  display: block;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.performance-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 44px;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
}

.performance-row::-webkit-details-marker {
  display: none;
}

.performance-row::after {
  content: "展开";
  justify-self: end;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.performance-card[open] .performance-row::after {
  content: "收起";
}

.performance-person,
.performance-current {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.performance-person strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.performance-person span,
.performance-current span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.performance-current {
  grid-template-columns: auto auto;
  column-gap: 8px;
  min-width: 108px;
  justify-items: end;
}

.performance-current strong {
  grid-column: 1 / -1;
  font-size: 20px;
  line-height: 1;
}

.performance-detail {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
  background: #f8faf9;
}

.performance-note {
  color: var(--muted);
  font-size: 14px;
}

.performance-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.performance-metrics div {
  display: grid;
  gap: 4px;
  min-height: 70px;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
}

.performance-metrics span,
.session-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.performance-metrics strong {
  font-size: 16px;
}

.sparkline {
  height: 88px;
  padding: 8px;
  border-radius: 12px;
  background: #fff;
}

.sparkline svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.sparkline line {
  stroke: var(--line);
  stroke-width: 2;
}

.sparkline polyline {
  fill: none;
  stroke: var(--brand);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.sparkline circle {
  stroke: #fff;
  stroke-width: 2;
}

.sparkline circle.score-good {
  fill: var(--good);
}

.sparkline circle.score-warn {
  fill: var(--warn);
}

.sparkline circle.score-bad {
  fill: var(--bad);
}

.session-list {
  display: grid;
  gap: 6px;
}

.session-row {
  display: grid;
  grid-template-columns: 64px 58px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #fff;
}

.session-row strong {
  font-size: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 20;
  width: min(520px, calc(100% - 28px));
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(22, 35, 30, 0.94);
  color: #fff;
  text-align: center;
  font-weight: 850;
}

@media (max-width: 700px) {
  .topbar {
    border-radius: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .user-form,
  .photo-grid,
  .performance-metrics {
    grid-template-columns: 1fr;
  }

  .example-card {
    grid-template-columns: 1fr;
  }

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

  .example-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
  }

  .performance-row {
    grid-template-columns: minmax(0, 1fr) auto 42px;
    gap: 10px;
    min-height: 56px;
    padding: 9px 12px;
  }

  .performance-current {
    column-gap: 6px;
    min-width: 96px;
  }

  .performance-person strong {
    font-size: 17px;
  }

  .performance-person span,
  .performance-current span {
    font-size: 13px;
  }

  .performance-current strong {
    font-size: 18px;
  }

  .session-row {
    grid-template-columns: 58px 54px 1fr;
  }

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