:root {
  --bg: #f5f6f2;
  --panel: #ffffff;
  --text: #18211f;
  --muted: #64716d;
  --line: #dce1da;
  --accent: #187c54;
  --danger: #9b2f24;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

.shell {
  width: min(1180px, calc(100vw - 40px));
  margin: 28px auto;
}

.shell-narrow {
  width: min(420px, calc(100vw - 40px));
  margin: 12vh auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav a {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.nav a:hover,
.nav a.active {
  border-color: var(--accent);
  color: var(--accent);
  background: #edf7f1;
}

h1, h2, h3, p {
  margin: 0;
}

h1 { font-size: 24px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }

p {
  margin-top: 6px;
  color: var(--muted);
}

.status {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  max-width: 340px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 16px;
}

.panel {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(24, 33, 31, 0.08);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

label {
  display: block;
  margin-bottom: 12px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cbd4ce;
  border-radius: 6px;
  padding: 10px;
  color: var(--text);
  background: #fff;
  font: inherit;
  line-height: 1.45;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 124, 84, 0.12);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.check span {
  margin: 0;
  color: var(--text);
}

button {
  min-height: 34px;
  border: 1px solid #adc1b6;
  border-radius: 6px;
  padding: 0 12px;
  color: #123b2b;
  background: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

button:hover {
  border-color: var(--accent);
  background: #edf7f1;
}

button.danger {
  border-color: #d7b0aa;
  color: var(--danger);
}

button.danger:hover {
  border-color: var(--danger);
  background: #faf0ee;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: #136a47;
}

.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
}

tr:hover td {
  background: #fafbf8;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.badge-ok { background: #e3f3ea; color: var(--accent); }
.badge-off { background: #f3e4e1; color: var(--danger); }
.badge-muted { background: #eceeea; color: var(--muted); }

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tabs button {
  border-radius: 6px 6px 0 0;
}

.tabs button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbf8;
}

.card-item .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

pre {
  min-height: 80px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101815;
  color: #d6f3e4;
  white-space: pre-wrap;
  font-size: 13px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.key-plain {
  padding: 10px;
  border: 1px dashed var(--accent);
  border-radius: 6px;
  background: #edf7f1;
  font-family: Consolas, monospace;
  font-size: 14px;
  word-break: break-all;
  margin-bottom: 10px;
}

.empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  .grid,
  .row {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ===== 话术图片附件 ===== */
.qa-img-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}
.qa-img {
  position: relative;
  display: inline-block;
  width: 64px;
  height: 64px;
  border: 1px solid #d6e0da;
  border-radius: 6px;
  overflow: hidden;
  background: #f6f9f7;
}
.qa-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.qa-img-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  line-height: 16px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.qa-img-del:hover {
  background: #c0392b;
}
.qa-img-upload {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: #4a6457;
}
.qa-img-upload input {
  display: block;
  margin-top: 4px;
}
