:root {
  color-scheme: light;
  --ink: #162033;
  --muted: #68758a;
  --line: #dce3ec;
  --surface: #ffffff;
  --canvas: #f4f6f8;
  --teal: #087f72;
  --teal-dark: #08645c;
  --blue: #2563eb;
  --red: #c2413b;
  --amber: #a16207;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button, textarea, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  min-height: 76px;
  padding: 14px 28px;
  background: #132438;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid var(--teal);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--teal-dark);
  border-radius: 6px;
  font-weight: 800;
}
.brand h1 { font-size: 18px; margin: 0; letter-spacing: 0; }
.brand p { margin: 3px 0 0; color: #aebed0; font-size: 12px; }
.health { display: flex; align-items: center; gap: 8px; color: #c9d4e0; font-size: 13px; }
.health span { width: 9px; height: 9px; border-radius: 50%; background: #eab308; }
.health.ok span { background: #22c55e; }
.health.error span { background: #ef4444; }

main { max-width: 1440px; margin: 0 auto; padding: 22px 28px 40px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  padding: 15px 17px;
  min-height: 82px;
}
.stats-grid span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.stats-grid strong { font-size: 25px; line-height: 1; }
.stats-grid .status-text { font-size: 17px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 16px; margin-bottom: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.panel-heading {
  min-height: 64px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-heading h2 { margin: 0; font-size: 15px; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.tester { padding-bottom: 16px; }
.tester label { display: block; padding: 14px 16px 7px; color: #48566a; font-size: 12px; font-weight: 700; }
textarea {
  display: block;
  width: calc(100% - 32px);
  min-height: 285px;
  resize: vertical;
  margin: 0 16px;
  padding: 14px;
  border: 1px solid #bfc9d6;
  border-radius: 4px;
  background: #101923;
  color: #d9e7f5;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.5;
  outline: none;
}
textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.actions { display: flex; align-items: center; gap: 12px; padding: 12px 16px 0; color: var(--muted); font-size: 12px; }
.header-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px 10px;
  padding: 12px 16px 0;
}
.header-grid label { padding: 0; }
.header-grid input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #bfc9d6;
  border-radius: 4px;
  padding: 0 11px;
  color: var(--ink);
  outline: none;
}
.header-grid input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
button { border-radius: 4px; min-height: 36px; border: 1px solid transparent; padding: 0 14px; font-weight: 700; }
.primary { background: var(--teal); color: #fff; }
.primary:hover { background: var(--teal-dark); }
.primary:disabled { opacity: .65; cursor: wait; }
.secondary { background: #fff; color: #344156; border-color: #cbd5e1; }
.icon-button { width: 36px; padding: 0; background: #fff; border-color: #cbd5e1; font-size: 20px; }

.response-panel { min-height: 420px; }
.response-code { border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 800; }
.response-code.neutral { background: #e8edf3; color: #536174; }
.response-code.success { background: #dcfce7; color: #166534; }
.response-code.failure { background: #fee2e2; color: #991b1b; }
pre {
  margin: 16px;
  min-height: 270px;
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  background: #101923;
  color: #d9e7f5;
  border-radius: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.5;
}
.config-summary { margin: 0 16px 16px; padding: 11px 12px; background: #eef6f5; border-left: 3px solid var(--teal); color: #3f5364; font-size: 12px; line-height: 1.6; }

.data-panel { min-height: 380px; }
.tabs { height: 46px; display: flex; align-items: end; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tab { min-height: 38px; background: transparent; color: var(--muted); border: 0; border-bottom: 3px solid transparent; border-radius: 0; }
.tab.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #e7ecf2; vertical-align: top; }
th { background: #f8fafc; color: #536174; font-size: 11px; text-transform: uppercase; }
td { color: #28364a; font-size: 12px; max-width: 310px; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 4px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.badge.sent { color: #166534; background: #dcfce7; }
.badge.failed { color: #991b1b; background: #fee2e2; }
.delete-button { width: 30px; min-height: 30px; padding: 0; color: var(--red); background: #fff; border-color: #fecaca; }
.empty-state { padding: 42px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }
.toast { position: fixed; right: 22px; bottom: 22px; max-width: 420px; padding: 12px 15px; color: #fff; background: #172033; border-radius: 5px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.toast.error { background: #991b1b; }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .topbar { padding: 12px 16px; align-items: flex-start; gap: 12px; }
  .health { font-size: 0; padding-top: 12px; }
  main { padding: 14px 12px 28px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid article { padding: 13px; }
  .panel-heading { align-items: flex-start; }
  textarea { min-height: 320px; }
  .header-grid { grid-template-columns: 1fr; }
}
