:root {
  color-scheme: light;
  --bg: #f3ede3;
  --bg-accent: #d8e6de;
  --panel: rgba(255, 251, 247, 0.84);
  --text: #1d1d18;
  --muted: #5a5b51;
  --line: rgba(67, 68, 54, 0.12);
  --shadow: 0 24px 70px rgba(45, 50, 40, 0.12);
  --teal: #0d6d65;
  --teal-soft: #d7ece8;
  --amber: #bc7a2f;
  --amber-soft: #f3e1c8;
  --red: #a63932;
  --red-soft: #f3d2ce;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Noto Serif SC", serif;
  color: var(--text);
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.92), transparent 30%),
    radial-gradient(circle at bottom right, rgba(202, 225, 219, 0.7), transparent 26%),
    linear-gradient(135deg, var(--bg) 0%, #efe2d2 44%, var(--bg-accent) 100%);
}

.shell {
  width: min(1420px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.shell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  margin-bottom: 20px;
}

.brand-copy h2 {
  margin: 0;
  font-size: 1.6rem;
}

.brand-subline {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-chip {
  min-width: 240px;
  max-width: 100%;
  padding: 12px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
}

.user-chip strong,
.summary-card strong {
  display: block;
  font-size: 1.02rem;
}

.user-chip span,
.summary-card span,
.muted-copy {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.hero-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 380px);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 0.95;
}

.lead {
  width: min(640px, 100%);
  margin: 20px 0 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
}

.hero-note {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.note-title {
  margin: 0 0 10px;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.control-panel,
.transcript-panel,
.risk-panel {
  padding: 24px;
  animation: rise 420ms ease;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.45rem;
}

.signal,
.panel-tag,
.risk-level {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.95rem;
  white-space: nowrap;
}

.signal[data-tone="neutral"] {
  background: rgba(255, 255, 255, 0.72);
}

.signal[data-tone="good"] {
  background: var(--teal-soft);
  color: var(--teal);
}

.signal[data-tone="warning"] {
  background: var(--amber-soft);
  color: var(--amber);
}

.signal[data-tone="error"] {
  background: var(--red-soft);
  color: var(--red);
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span,
.speaker-title,
.section-label {
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid rgba(67, 68, 54, 0.14);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.field-wide {
  grid-column: 1 / -1;
}

.speaker-block {
  margin-top: 20px;
}

.speaker-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.voiceprint-panel {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(67, 68, 54, 0.1);
  background: rgba(255, 255, 255, 0.58);
}

.compact-actions {
  margin-top: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-field {
  margin-top: 14px;
}

.sample-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.sample-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(67, 68, 54, 0.08);
}

.sample-item.upload {
  background: rgba(215, 236, 232, 0.44);
}

.voiceprint-actions {
  margin-top: 16px;
}

.voiceprint-guide-list {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.75;
}

.voiceprint-script-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.script-card {
  border: 1px solid rgba(67, 68, 54, 0.12);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
}

.script-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.script-card p {
  margin: 0;
  line-height: 1.65;
  color: var(--muted);
}

.compact-inline-check {
  margin-top: 12px;
}

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

.switcher-button,
.action {
  border: 0;
  border-radius: 18px;
  padding: 14px 16px;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.switcher-button {
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
}

.switcher-button.active {
  background: linear-gradient(135deg, #113f39, var(--teal));
  color: white;
  box-shadow: 0 14px 30px rgba(13, 109, 101, 0.18);
}

.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.action.primary {
  background: linear-gradient(135deg, #143934, var(--teal));
  color: white;
}

.action.secondary {
  background: linear-gradient(135deg, #7b4d18, var(--amber));
  color: white;
}

.action.tertiary {
  background: linear-gradient(135deg, #2c5f87, #538ab5);
  color: white;
}

.action.ghost {
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
}

.switcher-button:hover,
.action:hover {
  transform: translateY(-1px);
}

.switcher-button:disabled,
.action:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

.banner {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  line-height: 1.6;
}

.banner[data-tone="good"] {
  background: var(--teal-soft);
  color: var(--teal);
}

.banner[data-tone="warning"] {
  background: var(--amber-soft);
  color: var(--amber);
}

.banner[data-tone="error"] {
  background: var(--red-soft);
  color: var(--red);
}

.mini-stats {
  margin: 20px 0 0;
  display: grid;
  gap: 14px;
}

.mini-stats div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(67, 68, 54, 0.14);
}

.mini-stats dt {
  color: var(--muted);
}

.mini-stats dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.transcript-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 520px;
  max-height: 72vh;
  overflow: auto;
  padding-right: 4px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  border-radius: 22px;
  border: 1px dashed rgba(67, 68, 54, 0.18);
  color: var(--muted);
  text-align: center;
  padding: 0 20px;
}

.segment-card {
  border: 1px solid rgba(67, 68, 54, 0.12);
  border-radius: 22px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.76);
}

.segment-card.partial {
  border-style: dashed;
  background: rgba(235, 245, 243, 0.84);
}

.segment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.segment-head time {
  color: var(--muted);
  font-size: 0.92rem;
}

.segment-tags,
.flag-row,
.token-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.speaker-pill,
.emotion-pill,
.voiceprint-pill,
.source-pill,
.risk-chip,
.flag-token,
.token-list li {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.86rem;
}

.speaker-pill.patient {
  background: rgba(166, 57, 50, 0.12);
  color: var(--red);
}

.speaker-pill.doctor {
  background: rgba(13, 109, 101, 0.12);
  color: var(--teal);
}

.speaker-pill.unknown {
  background: rgba(29, 29, 24, 0.08);
  color: var(--muted);
}

.emotion-pill {
  background: rgba(188, 122, 47, 0.14);
  color: var(--amber);
}

.voiceprint-pill {
  background: rgba(13, 109, 101, 0.18);
  color: var(--teal);
}

.voiceprint-pill.detail {
  background: rgba(13, 109, 101, 0.08);
  color: var(--muted);
}

.source-pill.tencent {
  background: rgba(13, 109, 101, 0.14);
  color: var(--teal);
}

.source-pill.local {
  background: rgba(29, 29, 24, 0.08);
  color: var(--muted);
}

.source-pill.manual {
  background: rgba(17, 63, 57, 0.16);
  color: var(--teal);
}

.source-pill.text {
  background: rgba(188, 122, 47, 0.14);
  color: var(--amber);
}

.source-pill.automatic {
  background: rgba(29, 29, 24, 0.08);
  color: var(--muted);
}

.risk-chip,
.flag-token,
.token-list li {
  background: rgba(29, 29, 24, 0.06);
}

.segment-text {
  margin: 12px 0 0;
  line-height: 1.8;
  font-size: 1.02rem;
}

.segment-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.segment-action {
  border: 1px solid rgba(67, 68, 54, 0.14);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, color 160ms ease;
}

.segment-action:hover {
  transform: translateY(-1px);
}

.segment-action.active {
  background: rgba(13, 109, 101, 0.12);
  color: var(--teal);
  border-color: rgba(13, 109, 101, 0.22);
}

.segment-action:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
}

.flag-row {
  margin-top: 12px;
}

.risk-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.risk-level.low {
  background: rgba(13, 109, 101, 0.12);
  color: var(--teal);
}

.risk-level.medium {
  background: rgba(188, 122, 47, 0.16);
  color: var(--amber);
}

.risk-level.high {
  background: rgba(166, 57, 50, 0.16);
  color: var(--red);
}

.risk-score-wrap {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.risk-score-ring {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 10px solid rgba(13, 109, 101, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.7);
}

.risk-score-ring strong {
  font-size: 2rem;
}

.risk-score-copy p {
  margin: 0 0 12px;
  line-height: 1.7;
}

.risk-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(29, 29, 24, 0.08);
}

.risk-bar-fill {
  height: 100%;
  min-width: 4%;
  border-radius: 999px;
}

.risk-bar-fill.low {
  background: linear-gradient(90deg, #8ccdc1, var(--teal));
}

.risk-bar-fill.medium {
  background: linear-gradient(90deg, #f0cd93, var(--amber));
}

.risk-bar-fill.high {
  background: linear-gradient(90deg, #ef9d95, var(--red));
}

.risk-section {
  padding-top: 18px;
  border-top: 1px dashed rgba(67, 68, 54, 0.14);
}

.token-list {
  padding: 0;
  margin: 10px 0 0;
  list-style: none;
}

.recommendation,
.tip-block p,
.footer-note,
.hero-note p {
  margin: 10px 0 0;
  line-height: 1.7;
  color: var(--muted);
}

.footer-note {
  margin-top: 18px;
  padding: 0 4px;
}

.auth-shell,
.admin-shell {
  padding-top: 40px;
}

.auth-grid,
.admin-grid,
.summary-grid {
  display: grid;
  gap: 20px;
}

.auth-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  align-items: start;
}

.auth-hero,
.auth-panel,
.admin-panel {
  padding: 24px;
}

.auth-stack {
  display: grid;
  gap: 20px;
}

.helper-list {
  margin: 18px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.feedback {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  line-height: 1.6;
}

.feedback[data-tone="good"] {
  background: var(--teal-soft);
  color: var(--teal);
}

.feedback[data-tone="warning"] {
  background: var(--amber-soft);
  color: var(--amber);
}

.feedback[data-tone="error"] {
  background: var(--red-soft);
  color: var(--red);
}

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

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  color: var(--text);
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.summary-card {
  border: 1px solid rgba(67, 68, 54, 0.12);
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.76);
}

.summary-card em {
  display: block;
  font-style: normal;
  font-size: 2rem;
  margin-top: 10px;
}

.admin-grid {
  grid-template-columns: minmax(0, 1fr);
}

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.user-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  margin-top: 6px;
}

.user-table th,
.user-table td {
  padding: 14px 12px;
  border-bottom: 1px dashed rgba(67, 68, 54, 0.14);
  text-align: left;
  vertical-align: top;
}

.user-table th {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.user-table tbody tr {
  cursor: pointer;
}

.user-table tbody tr:hover,
.user-table tbody tr.selected {
  background: rgba(215, 236, 232, 0.62);
}

.quality-table tbody tr {
  cursor: default;
}

.quality-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.42);
}

.quality-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.86rem;
}

.quality-pill.strong {
  background: rgba(13, 109, 101, 0.14);
  color: var(--teal);
}

.quality-pill.usable {
  background: rgba(188, 122, 47, 0.14);
  color: var(--amber);
}

.quality-pill.weak,
.quality-pill.missing {
  background: rgba(166, 57, 50, 0.12);
  color: var(--red);
}

.quality-summary {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.field input[type="file"] {
  padding: 12px 16px;
}

.document-panel {
  margin-top: 20px;
  padding: 24px;
}

.document-toolbar {
  display: grid;
  gap: 16px;
}

.document-action-row {
  display: flex;
  justify-content: flex-start;
}

.document-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
  gap: 20px;
  margin-top: 18px;
}

.triage-live-grid {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  margin-top: 20px;
}

.triage-live-grid .transcript-list {
  min-height: 380px;
  max-height: 60vh;
}

.document-main,
.document-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.triage-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.triage-input-panel {
  padding: 24px;
}

.triage-result-panel {
  margin-top: 0;
}

.triage-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.triage-department {
  margin: 12px 0 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.1;
}

.triage-guidance {
  margin: 10px 0 0;
  line-height: 1.7;
  color: var(--muted);
}

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

.document-record-strip {
  border: 1px solid rgba(67, 68, 54, 0.12);
  border-radius: 22px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.62);
}

.document-record-meta {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.note-sections {
  display: grid;
  gap: 14px;
}

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

.record-history-item {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(67, 68, 54, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.record-history-item:hover {
  border-color: rgba(13, 109, 101, 0.28);
  transform: translateY(-1px);
}

.record-history-item.active {
  border-color: rgba(13, 109, 101, 0.34);
  background: rgba(215, 236, 232, 0.58);
}

.record-history-item strong {
  font-size: 0.96rem;
}

.record-history-item span {
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.88rem;
}

.note-card,
.suggestion-card {
  border: 1px solid rgba(67, 68, 54, 0.12);
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.76);
}

.note-card h3 {
  margin: 0 0 10px;
  font-size: 1.02rem;
}

.note-card p {
  margin: 0;
  line-height: 1.75;
  color: var(--text);
}

.vertical-list {
  flex-direction: column;
  align-items: stretch;
}

.vertical-list li {
  border-radius: 16px;
  padding: 12px 14px;
  line-height: 1.65;
}

.empty-state.compact {
  min-height: 120px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 16px, 960px);
    padding: 16px 0 28px;
  }

  .shell-head,
  .hero-strip,
  .auth-grid,
  .workspace-grid,
  .summary-grid,
  .voiceprint-script-grid,
  .document-grid,
  .field-grid,
  .actions,
  .risk-score-wrap {
    grid-template-columns: 1fr;
  }

  .shell-head,
  .user-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-head,
  .admin-toolbar,
  .speaker-panel-head,
  .segment-head {
    flex-direction: column;
    align-items: stretch;
  }

  .user-chip {
    min-width: 0;
    width: 100%;
  }

  .control-panel,
  .transcript-panel,
  .risk-panel,
  .hero-note,
  .auth-hero,
  .auth-panel,
  .admin-panel,
  .document-panel {
    padding: 18px;
  }

  .transcript-list {
    min-height: 300px;
    max-height: none;
  }

  h1 {
    line-height: 1.02;
  }

  .lead,
  .brand-subline,
  .muted-copy,
  .quality-summary,
  .recommendation,
  .tip-block p,
  .hero-note p {
    font-size: 0.96rem;
  }

  .field input,
  .field textarea,
  .field select,
  .action {
    font-size: 16px;
  }

  .document-action-row {
    justify-content: stretch;
  }

  .document-action-row .action {
    width: 100%;
  }
}

@media (max-width: 1080px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .document-grid {
    grid-template-columns: 1fr;
  }

  .triage-live-grid {
    grid-template-columns: 1fr;
  }

  .triage-grid {
    grid-template-columns: 1fr;
  }

  .risk-panel {
    grid-column: auto;
  }

  .hero-strip {
    grid-template-columns: 1fr;
  }

  .transcript-list {
    max-height: none;
  }
}