:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #17191f;
  --muted: #676d7a;
  --line: #dfe3ea;
  --accent: #1f6feb;
  --accent-dark: #175bc2;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(23, 25, 31, 0.08);
}

.panel.wide {
  width: min(820px, 100%);
}

.brand {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

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

form {
  display: grid;
  gap: 16px;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

label {
  display: grid;
  gap: 7px;
  align-content: start;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.full {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  font-weight: 400;
  padding: 11px 12px;
}

input,
select {
  height: 44px;
  line-height: 20px;
}

select {
  appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2317191f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  background-size: 16px 16px;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 400;
}

.checkbox input {
  width: 18px;
  height: 18px;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 11px 16px;
}

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

button.secondary {
  background: #eef2f8;
  color: var(--text);
}

button.secondary:hover {
  background: #e2e8f2;
}

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

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

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

.hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.hint:empty {
  display: none;
}

.save-banner {
  min-height: 22px;
  margin-top: -12px;
  color: #126329;
  font-size: 13px;
  font-weight: 700;
}

.save-banner.error {
  color: var(--danger);
}

.section-title {
  border-top: 1px solid var(--line);
  margin: 28px 0 16px;
  padding-top: 22px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

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

.result {
  min-height: 120px;
  margin: 16px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text);
  font: 15px/1.55 Arial, Helvetica, sans-serif;
  white-space: pre-wrap;
}

.knowledge-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.knowledge-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
}

.knowledge-list a {
  color: var(--accent);
  font-weight: 700;
}

.knowledge-meta {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 720px) {
  .settings-grid,
  .generate-grid {
    grid-template-columns: 1fr;
  }

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