:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #fff;
  --text: #172033;
  --muted: #667085;
  --line: #d8e0ec;
  --accent: #1769aa;
  --accent-strong: #0c4f84;
  --ok: #087443;
  --warn: #9a5a00;
  --bad: #b42318;
  --shadow: 0 18px 45px rgba(21, 31, 48, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.site-nav {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px;
  background: #edf2f8;
  border: 1px solid var(--line);
  border-radius: 14px;
  width: max-content;
  max-width: 100%;
}

.site-nav a {
  color: #516070;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
}

.site-nav a.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 20px rgba(23, 105, 170, 0.18);
}

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

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex: none;
  background: linear-gradient(135deg, #1769aa, #31a8ff);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
}

.sub {
  color: var(--muted);
  margin-top: 5px;
}

.hint {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.badge {
  border: 1px solid #cfe0f2;
  color: #0c4f84;
  background: #eef6ff;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 700;
  white-space: nowrap;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  gap: 18px;
  align-items: start;
}

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

.panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel-title {
  font-weight: 750;
  font-size: 15px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.panel-body {
  padding: 18px;
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 7px;
  font: inherit;
  outline: none;
}

textarea:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.12);
}

textarea {
  min-height: 460px;
  resize: vertical;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

input {
  height: 40px;
  padding: 0 11px;
}

.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

button,
a.btn {
  height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 7px;
  padding: 0 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

button:hover,
a.btn:hover {
  border-color: #a7b4c5;
}

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

.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.summary {
  display: grid;
  gap: 10px;
}

.kv {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #edf1f6;
}

.kv:last-child {
  border-bottom: 0;
}

.k {
  color: var(--muted);
}

.v {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

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

.pill.ok {
  background: #e9f7ef;
  color: var(--ok);
}

.pill.warn {
  background: #fff5df;
  color: var(--warn);
}

.pill.bad {
  background: #fff0ee;
  color: var(--bad);
}

.warnings {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.warning {
  border: 1px solid #f3d08a;
  background: #fff9eb;
  color: #673c00;
  border-radius: 7px;
  padding: 9px 10px;
}

.error {
  border: 1px solid #f4b3ad;
  background: #fff1f0;
  color: var(--bad);
  border-radius: 7px;
  padding: 10px;
  margin-top: 12px;
  white-space: pre-wrap;
}

.empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
}

.result-label {
  margin-top: 16px;
}

.json-output {
  min-height: 260px;
  max-height: 420px;
  margin-top: 8px;
  background: #fbfdff;
}

.field-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.field-title {
  font-weight: 750;
  color: var(--text);
}

.field-row {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #fcfdff;
}

.field-key {
  color: var(--muted);
  font-weight: 700;
}

.field-value {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  max-height: 92px;
  overflow: auto;
}

.field-copy {
  height: 32px;
  padding: 0 10px;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.hidden {
  display: none !important;
}

.privacy {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #cfe0f2;
  background: #f2f8ff;
  border-radius: 8px;
  color: #344054;
}

@media (max-width: 860px) {
  .shell {
    width: min(100vw - 20px, 720px);
    padding-top: 16px;
  }

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

  .panel-actions {
    width: 100%;
  }

  .panel-actions button,
  .panel-actions a {
    flex: 1;
  }

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

  textarea {
    min-height: 360px;
  }

  .json-output {
    min-height: 240px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .field-copy {
    width: 100%;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }
}
