:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --text: #17191c;
  --muted: #6d737c;
  --line: #e3e6eb;
  --panel: #ffffff;
  --teal: #12c7a3;
  --teal-dark: #079176;
  --orange: #ffad18;
  --violet: #4d35c8;
  --danger: #dc3b55;
  --shadow: 0 14px 34px rgba(22, 26, 32, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.brand-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 8px 20px rgba(23, 25, 28, 0.08);
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.top-actions,
.form-actions,
.section-head,
.tabs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.storage-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  max-width: 420px;
  padding: 6px 10px;
  overflow: hidden;
  color: #4b5562;
  background: #edf0f4;
  border: 1px solid #dce1e7;
  border-radius: 7px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storage-badge.mysql {
  color: var(--teal-dark);
  background: rgba(18, 199, 163, 0.12);
  border-color: rgba(18, 199, 163, 0.26);
}

.storage-badge.json {
  color: #8a5a00;
  background: rgba(255, 173, 24, 0.16);
  border-color: rgba(255, 173, 24, 0.32);
}

.tabs {
  padding: 6px;
  margin-bottom: 18px;
  background: #e9ebef;
  border-radius: 8px;
  overflow-x: auto;
}

.tab {
  border: 0;
  padding: 10px 18px;
  border-radius: 6px;
  color: #424850;
  background: transparent;
  white-space: nowrap;
}

.tab.is-active {
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 4px 12px rgba(20, 24, 28, 0.08);
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.section {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.section-head {
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  min-height: 112px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card span {
  display: block;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 12px;
  font-size: 34px;
  line-height: 1;
}

.stat-card:nth-child(1) strong {
  color: var(--teal-dark);
}

.stat-card:nth-child(2) strong {
  color: var(--violet);
}

.stat-card:nth-child(3) strong {
  color: #2467d6;
}

.stat-card:nth-child(4) strong {
  color: #db7b00;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  background: #fafbfc;
}

tr:last-child td {
  border-bottom: 0;
}

.book-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 42px;
  margin-right: 10px;
  color: #fff;
  border-radius: 6px;
  font-size: 18px;
  vertical-align: middle;
}

.muted,
.hint {
  color: var(--muted);
}

.hint {
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef1f4;
  color: #4f5660;
  font-size: 12px;
}

.pill.good {
  background: rgba(18, 199, 163, 0.12);
  color: var(--teal-dark);
}

.pill.warn {
  background: rgba(255, 173, 24, 0.17);
  color: #a36200;
}

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

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

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text);
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(18, 199, 163, 0.14);
}

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

.checkbox-line {
  flex-direction: row;
  align-items: center;
  align-self: end;
  min-height: 42px;
  padding: 0 2px;
}

.checkbox-line input {
  width: 18px;
  min-height: 18px;
}

.primary-button,
.ghost-button,
.link-button,
.danger-button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  padding: 9px 14px;
}

.primary-button {
  color: white;
  background: var(--teal);
}

.primary-button:hover {
  background: var(--teal-dark);
}

.ghost-button {
  color: #343942;
  background: #edf0f4;
}

.link-button {
  color: var(--teal-dark);
  background: transparent;
  text-decoration: none;
}

.danger-button {
  color: #fff;
  background: var(--danger);
}

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

.row-actions button {
  min-height: 32px;
  padding: 6px 10px;
}

.task-list {
  display: grid;
  gap: 8px;
  min-width: 360px;
}

.task-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-row.inactive {
  opacity: 0.72;
}

.task-main {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
}

.task-actions {
  justify-content: flex-end;
}

.speech-low-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.speech-low-list span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #4f5660;
  background: #eef1f4;
  font-size: 12px;
}

.mini-button {
  min-height: 28px !important;
  padding: 5px 8px !important;
  font-size: 12px;
}

.top-gap {
  margin-top: 18px;
}

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

.checkin-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

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

.checkin-item strong {
  display: block;
  margin-bottom: 5px;
}

.import-preview {
  min-height: 42px;
  padding: 11px 12px;
  border: 1px dashed #bcc4ce;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
}

.enrich-tip {
  padding: 12px 14px;
  color: #505862;
  background: #f5f7fa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.result-head strong {
  color: var(--text);
}

.result-head span {
  color: var(--muted);
}

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

.sample-item {
  padding: 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sample-item h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.sample-item p {
  margin: 6px 0 0;
  color: #343942;
  line-height: 1.5;
}

.sample-item p span {
  display: inline-flex;
  min-width: 42px;
  margin-right: 8px;
  color: var(--teal-dark);
  font-weight: 600;
}

.audio-progress {
  height: 10px;
  overflow: hidden;
  background: #edf0f4;
  border-radius: 999px;
}

.audio-progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #42d3ff);
  transition: width 0.2s ease;
}

.audio-job-line {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: #343942;
}

.audio-job-line span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  background: #eef1f4;
  border-radius: 999px;
  font-size: 12px;
}

.audio-error {
  margin: 10px 0 0;
  color: var(--danger);
}

.audio-problem-list {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #f8fafc;
  border: 1px dashed #c7d3e2;
  border-radius: 8px;
}

.audio-problem-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.audio-problem-main strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 15px;
}

.audio-problem-main p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.audio-problem-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.phonetic-review-list {
  align-items: stretch;
}

.phonetic-review-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.phonetic-review-main {
  display: grid;
  gap: 10px;
}

.phonetic-review-title {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.phonetic-review-title strong {
  color: var(--text);
  font-size: 16px;
}

.phonetic-review-title span {
  color: var(--muted);
  font-size: 12px;
}

.phonetic-review-title .phonetic-missing {
  color: #b66200;
  font-weight: 700;
}

.phonetic-review-fields {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(100px, 0.7fr) minmax(220px, 1.5fr);
  gap: 10px;
}

.phonetic-review-fields label {
  gap: 5px;
}

.phonetic-review-fields input {
  min-height: 36px;
  padding: 8px 10px;
}

.phonetic-review-actions {
  min-width: 112px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.status-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--orange);
}

.status-dot.ok::before {
  background: var(--teal);
}

.status-dot.bad::before {
  background: var(--danger);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(380px, calc(100vw - 48px));
  padding: 12px 16px;
  color: #fff;
  background: rgba(23, 25, 28, 0.92);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: 0.18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 24px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-head {
    align-items: center;
  }

  .stats-grid,
  .section-grid,
  .form-grid,
  .form-grid.compact,
  .sample-list {
    grid-template-columns: 1fr;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .storage-badge {
    max-width: 100%;
  }

  .audio-problem-row {
    grid-template-columns: 1fr;
  }

  .phonetic-review-row,
  .phonetic-review-fields {
    grid-template-columns: 1fr;
  }

  .audio-problem-actions {
    justify-content: flex-start;
  }
}

/* ===== 登录浮层 ===== */
.login-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: rgba(18, 22, 28, 0.55);
  backdrop-filter: blur(2px);
}

.login-overlay.is-visible {
  display: flex;
}

.login-card {
  width: min(360px, 90vw);
  padding: 36px 28px;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.login-sub {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
}

.login-card input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  outline: none;
}

.login-card input:focus {
  border-color: var(--teal-dark);
}

.login-card .primary-button {
  height: 44px;
  margin-top: 4px;
  font-size: 15px;
}

.login-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}
