:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #6b7280;
  --line: #d7dce2;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warn: #a16207;
  --error: #b91c1c;
}

* {
  box-sizing: border-box;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 700;
}

h2 {
  font-size: 16px;
  font-weight: 650;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 16px;
  padding: 16px;
}

.summary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
}

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

.metric {
  padding: 14px 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.panel {
  min-width: 0;
  padding: 14px;
}

.wide {
  grid-row: span 2;
}

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

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  min-height: 34px;
  padding: 6px 12px;
}

button:hover {
  background: var(--accent-strong);
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.small-button {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  min-height: 34px;
  padding: 7px 9px;
}

textarea {
  min-height: 310px;
  resize: vertical;
  line-height: 1.55;
}

.persona-panel textarea {
  min-height: 120px;
  margin-bottom: 10px;
}

.field-label {
  display: block;
  margin: 8px 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.inline-form {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 8px;
}

.stack-form {
  display: grid;
  grid-template-columns: 1fr 0.75fr;
  gap: 8px;
  margin-bottom: 12px;
}

.stack-form input:last-child {
  grid-column: 1 / -1;
}

.result-line {
  min-height: 26px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e7f4f2;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
}

.table-wrap {
  overflow: auto;
  max-height: 580px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #f9fafb;
  color: #374151;
  font-weight: 650;
}

td:nth-child(4) {
  min-width: 260px;
}

.list {
  display: grid;
  gap: 8px;
  max-height: 310px;
  overflow: auto;
}

.list-item {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  font-size: 13px;
}

.list-item strong {
  font-size: 13px;
}

.list-item span {
  color: var(--muted);
}

.compact .list-item {
  grid-template-columns: 78px 1fr;
}

.level-error {
  color: var(--error);
}

.level-warning {
  color: var(--warn);
}

@media (max-width: 920px) {
  .layout,
  .summary,
  .inline-form,
  .stack-form {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-row: auto;
  }
}
