:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d9dee7;
  --line-strong: #cbd5df;
  --text: #151922;
  --muted: #647084;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-soft: #ecfdf5;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --warn: #92400e;
  --warn-bg: #fff7ed;
  --danger: #b91c1c;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.05);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 80px;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin: 2px 0 4px;
  font-size: 25px;
  line-height: 1.15;
}

.topbar p,
.panelHead p,
.hero p,
.empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

button,
.ghost {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0 13px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover,
.ghost:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

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

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

.page {
  display: grid;
  width: min(100%, 1680px);
  gap: 16px;
  margin: 0 auto;
  padding: 18px 20px 32px;
}

.notice {
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.8fr);
  gap: 20px;
  padding: 24px;
  border-color: #d7e7e4;
  background: linear-gradient(135deg, #ffffff 0%, #ffffff 58%, #f0fdfa 100%);
}

.hero h2 {
  max-width: 920px;
  margin: 5px 0 10px;
  font-size: 28px;
  line-height: 1.2;
}

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

.stats div,
.subCard,
.record {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px;
}

.stats div {
  min-height: 86px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stats strong {
  display: block;
  margin-bottom: 2px;
  font-size: 29px;
  line-height: 1.05;
}

.stats span,
.agentItem span,
.agentItem em,
.record span {
  color: var(--muted);
  font-size: 12px;
}

.panel {
  padding: 18px;
}

.panelHead,
.detailHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.panelHead h2,
.detailHead h2 {
  margin-bottom: 4px;
  font-size: 17px;
  line-height: 1.25;
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.strictGrid {
  margin-top: 14px;
}

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

.agentPanel {
  position: sticky;
  top: 98px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 16px;
}

.agentPanel h3 {
  margin-bottom: 4px;
  font-size: 16px;
}

.agentItems {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 210px);
  margin-top: 12px;
  overflow: auto;
  padding-right: 5px;
}

.agentItem {
  width: 100%;
  height: auto;
  min-height: 84px;
  justify-content: flex-start;
  align-items: flex-start;
  flex-direction: column;
  gap: 7px;
  text-align: left;
  padding: 12px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.agentItem.active {
  border-color: #14b8a6;
  background: #ecfeff;
  box-shadow: 0 10px 28px rgba(20, 184, 166, 0.15), inset 4px 0 0 var(--primary);
}

.agentItem:hover {
  transform: translateY(-1px);
  border-color: #99f6e4;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.agentItem strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1.25;
}

.agentItem em {
  font-style: normal;
  line-height: 1.4;
}

.detailPanel {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 14px;
}

.agentDetail {
  display: grid;
  gap: 14px;
  padding-top: 14px;
}

.status {
  display: inline-flex;
  margin-bottom: 8px;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

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

.subCard {
  background: var(--panel);
}

.subCard strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.subCard p,
.subCard li {
  color: #334155;
  font-size: 13px;
  line-height: 1.55;
}

ul {
  margin: 0;
  padding-left: 18px;
}

li + li {
  margin-top: 5px;
}

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

.tags span {
  border: 1px solid #dbe5ed;
  border-radius: 999px;
  background: #eef3f7;
  padding: 5px 9px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.testerGrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.85fr);
  gap: 14px;
  padding-top: 14px;
}

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

label {
  display: grid;
  gap: 6px;
  color: #374151;
  font-size: 12px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(13, 148, 136, 0.18);
  border-color: var(--primary);
}

textarea {
  resize: vertical;
}

.outputBox {
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.draft {
  display: grid;
  gap: 8px;
  color: var(--text);
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  line-height: 1.55;
}

.error {
  margin-bottom: 10px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff1f2;
  color: var(--danger);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}

.records,
.templateLibrary {
  display: grid;
  gap: 9px;
  padding-top: 12px;
}

.records {
  max-height: 560px;
  overflow: auto;
  padding-right: 3px;
}

.record {
  display: grid;
  gap: 7px;
  background: var(--panel-soft);
}

.record div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

dl {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

dd {
  margin: 0;
  color: #334155;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.empty {
  padding: 18px;
  text-align: center;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #c9d3dd transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #c9d3dd;
  background-clip: padding-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 1100px) {
  .hero,
  .grid,
  .split,
  .testerGrid {
    grid-template-columns: 1fr;
  }

  .agentPanel {
    position: static;
  }
}

@media (max-width: 700px) {
  .topbar,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .page {
    padding: 12px;
  }

  .stats,
  .infoGrid,
  .formGrid {
    grid-template-columns: 1fr;
  }

  dl {
    grid-template-columns: 1fr;
  }
}
