:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --ink: #17211f;
  --muted: #66736d;
  --line: #dbe4e2;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --accent: #0e766e;
  --accent-strong: #0a5f59;
  --accent-soft: #d9f3ef;
  --blue: #2563eb;
  --blue-soft: #e7efff;
  --warn: #a15c07;
  --bad: #b42318;
  --good: #167243;
  --shadow: 0 14px 38px rgba(25, 36, 44, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(37, 99, 235, 0.10), transparent 28%),
    linear-gradient(180deg, rgba(14, 118, 110, 0.08), rgba(246, 248, 251, 0) 340px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 44px;
}

.workspace {
  display: grid;
  gap: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 2px 2px 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 36px;
  line-height: 1.08;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.lead {
  max-width: 680px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.top-metrics {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.service-state {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 9px 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.service-state span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #aab6b1;
}

.service-state.ok span {
  background: var(--good);
}

.service-state.bad span {
  background: var(--bad);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(350px, 0.82fr);
  gap: 20px;
  align-items: start;
}

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

.form-panel {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.panel-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.section-kicker {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel-head.compact {
  align-items: center;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  color: var(--bad);
  border-color: #efc8c3;
  background: #fff7f6;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span {
  color: #31413b;
  font-size: 14px;
  font-weight: 700;
}

.inline-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.inline-control button {
  min-width: 86px;
}

.field-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.link-button,
.steps a {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 30px;
  border: 1px solid #c8ded9;
  border-radius: 8px;
  background: #f4fbf9;
  color: var(--accent-strong);
  padding: 0 10px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.link-button.blue {
  border-color: #cbdcff;
  background: var(--blue-soft);
  color: #1d4ed8;
}

.link-button:hover,
.steps a:hover {
  border-color: #9ec8be;
  background: #e7f7f3;
}

button.link-button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cfdcd8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input {
  height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 248px;
  resize: vertical;
  padding: 13px 14px;
  line-height: 1.55;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.form-section {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid #e3ebe8;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfcfd);
  padding: 16px;
}

.section-index {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #edf7f5;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.counter {
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

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

button.primary,
button.secondary {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

button.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 20px rgba(14, 118, 110, 0.18);
}

button.primary:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

button.secondary {
  background: #fff;
  color: #24362f;
  border-color: var(--line);
}

button.secondary:hover {
  border-color: #acc1b8;
  background: #f8fbfa;
}

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

.side {
  display: grid;
  gap: 20px;
}

.status-panel,
.guide-panel {
  padding: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: #eef3f1;
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.ok {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

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

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

.status-card {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  min-height: 164px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 15px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.result-title {
  font-size: 16px;
  font-weight: 850;
}

.result-grid {
  display: grid;
  gap: 8px;
}

.result-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.result-row strong {
  min-width: 0;
  color: var(--ink);
  font-weight: 750;
  overflow-wrap: anywhere;
}

.steps {
  display: grid;
  gap: 14px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.steps span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid #cfdbd7;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.steps strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.steps p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.steps a {
  margin-top: 7px;
}

.steps li.done {
  color: var(--ink);
}

.steps li.done span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.refresh-section textarea {
  min-height: 132px;
}

.addon-section {
  margin-top: 4px;
  border-style: dashed;
  background: linear-gradient(180deg, #fbfcfd, #f7fbfa);
}

.addon-section .section-index {
  background: #eef2f7;
  color: #475569;
}

.field-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

button.full {
  width: 100%;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--ink);
  padding: 13px 14px;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  font-size: 14px;
  font-weight: 700;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.bad {
  border-color: #f0bbb4;
  color: var(--bad);
}

.toast.ok {
  border-color: #b8ded1;
  color: var(--good);
}

@media (max-width: 840px) {
  .app-shell {
    width: min(100% - 22px, 680px);
    padding: 20px 0;
  }

  .topbar,
  .layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .top-metrics {
    justify-content: stretch;
  }

  .service-state {
    flex: 1 1 150px;
  }

  h1 {
    font-size: 28px;
  }

  .layout {
    gap: 14px;
  }

  .form-panel,
  .status-panel,
  .guide-panel {
    padding: 16px;
  }

  .actions button {
    flex: 1 1 100%;
  }

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

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

  textarea {
    min-height: 200px;
  }
}
