:root {
  color-scheme: light;
  --bg: #f5f7f5;
  --ink: #18211c;
  --muted: #66736c;
  --line: #d9dfda;
  --panel: #ffffff;
  --accent: #1f7a5a;
  --accent-strong: #145f46;
  --amber: #b56a20;
  --red: #b84432;
  --shadow: 0 16px 40px rgba(32, 45, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

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

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

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

.input-panel {
  padding: 22px;
  position: sticky;
  top: 24px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e7f0eb;
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.25;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.form {
  display: grid;
  gap: 15px;
  margin-top: 20px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 90, 0.14);
}

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

button {
  height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-weight: 750;
  cursor: pointer;
}

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

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

.status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status.error {
  color: var(--red);
}

.results {
  display: grid;
  gap: 18px;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.summary-band > div {
  background: var(--panel);
  padding: 18px;
  min-height: 88px;
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.summary-band strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  line-height: 1.25;
}

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

.metric {
  min-height: 126px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: 32px;
  line-height: 1;
}

.metric small {
  display: block;
  margin-top: 12px;
  color: var(--amber);
  font-size: 13px;
  font-weight: 760;
}

.json-panel {
  overflow: hidden;
}

.writing-panel {
  overflow: hidden;
}

.writing-panel p {
  padding: 18px;
  color: #26332c;
  font-size: 15px;
  line-height: 1.8;
}

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

.panel-head h2 {
  font-size: 16px;
}

.panel-head button {
  width: 104px;
  flex: 0 0 auto;
  background: #26332c;
}

pre {
  margin: 0;
  padding: 18px;
  min-height: 480px;
  max-height: 68vh;
  overflow: auto;
  background: #101713;
  color: #e7f1ea;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

@media (max-width: 920px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .input-panel {
    position: static;
  }

  .summary-band,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    padding: 10px 0;
  }

  .field-row,
  .summary-band,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-head button {
    width: 100%;
  }
}
