:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #667280;
  --line: #d8dee6;
  --accent: #176b5b;
  --accent-2: #1f7a8c;
  --danger: #b42318;
  --ok: #138a52;
  --shadow: 0 12px 30px rgba(20, 32, 44, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

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

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
}

button:hover {
  border-color: #9aa7b5;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.file-import {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
}

.file-import:hover {
  border-color: #9aa7b5;
}

.hidden {
  display: none !important;
}

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

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

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

.topbar h1 {
  margin: 0 0 4px;
  font-size: 26px;
}

.topbar p,
.panel-head p {
  margin: 0;
  color: var(--muted);
}

.status-pill {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
}

.template-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.template-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 128px;
  text-align: left;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 16px;
}

.template-tab strong {
  display: block;
  margin-bottom: 6px;
}

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

.template-tab em {
  color: var(--accent);
  font-style: normal;
  font-size: 13px;
  margin-top: 16px;
}

.template-tab.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(23, 107, 91, 0.12);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 16px;
}

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

.input-panel,
.card-panel {
  padding: 18px;
}

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

.panel-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.icon-button {
  padding: 8px 12px;
}

.voice-box {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.voice-button {
  min-height: 150px;
  border-color: #cad2dc;
  background: #f8fafb;
  color: var(--accent);
  font-weight: 700;
}

.voice-button.recording {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff7f5;
}

#voiceIcon {
  display: block;
  font-size: 28px;
  line-height: 1;
  margin-bottom: 10px;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  min-height: 150px;
}

.voice-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.voice-status.error {
  color: var(--danger);
}

.voice-status.ok {
  color: var(--ok);
}

.toolbar,
.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.quality {
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.quality-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.bar {
  height: 9px;
  border-radius: 999px;
  background: #e4e9ef;
  overflow: hidden;
}

.bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent-2);
}

.quality p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.field-reminders {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.reminder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.reminder-head h3 {
  margin: 0;
  font-size: 15px;
}

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

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

.field-chip {
  border: 1px solid #d3dae3;
  border-radius: 999px;
  padding: 7px 10px;
  color: #6b7684;
  background: #eef2f5;
  font-size: 13px;
}

.field-chip.filled {
  border-color: #1d9a63;
  background: #dff7e9;
  color: #0f6b42;
  font-weight: 700;
}

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

.form-section-title {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding: 10px 0 2px;
  border-top: 1px solid var(--line);
}

.form-section-title:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.form-section-title h3 {
  margin: 0;
  color: var(--accent);
  font-size: 16px;
}

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

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

.field label {
  font-size: 13px;
  color: #44505e;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
}

.field textarea {
  min-height: 86px;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-row button {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--accent);
  background: #f3faf7;
  border-color: #c9e8da;
}

.info-card {
  border: 1px solid #cfd7df;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  min-height: 360px;
}

.info-card h3 {
  margin: 0 0 12px;
  font-size: 22px;
}

.card-section {
  padding: 12px 0;
  border-top: 1px solid #edf0f3;
}

.card-section:first-of-type {
  border-top: 0;
}

.card-section h4 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--accent);
}

.card-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px;
  margin: 6px 0;
  font-size: 14px;
}

.card-row span:first-child {
  color: var(--muted);
}

.card-actions {
  margin-top: 12px;
}

.json-preview {
  margin-top: 14px;
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1720;
  color: #d6e2ef;
  font-size: 12px;
  white-space: pre-wrap;
}

.history-panel {
  padding: 18px;
}

.history-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px auto auto;
  gap: 10px;
  margin-bottom: 14px;
}

.history-toolbar input,
.history-toolbar select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
}

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

.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  cursor: pointer;
}

.history-item h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.history-item p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
}

.history-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.history-fields span {
  border: 1px solid #d3dae3;
  border-radius: 999px;
  padding: 5px 8px;
  background: #f6f8fa;
  font-size: 12px;
}

.history-detail {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #edf0f3;
}

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

.history-detail-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
}

.history-detail-row span {
  color: var(--muted);
}

.history-detail-row strong {
  overflow-wrap: anywhere;
}

.history-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .template-strip,
  .workspace {
    grid-template-columns: 1fr;
  }

  .history-toolbar {
    grid-template-columns: 1fr;
  }

  .history-detail-grid {
    grid-template-columns: 1fr;
  }

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

  .top-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .voice-box,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .voice-button {
    min-height: 74px;
  }
}
