:root {
  --bg: #f6f7f9;
  --ink: #17191f;
  --muted: #68707d;
  --line: #d8dde6;
  --panel: #ffffff;
  --blue: #1c5fd4;
  --green: #0b7a45;
  --red: #b42318;
  --amber: #9a5b00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

header {
  display: grid;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 2;
}

h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  padding: 16px;
  max-width: 1360px;
  margin: 0 auto;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}

select, input, textarea, button {
  font: inherit;
}

select, input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

textarea {
  min-height: 150px;
  resize: vertical;
  font-size: 18px;
  line-height: 1.55;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
  cursor: pointer;
  min-height: 38px;
}

button.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
button.good { background: var(--green); color: #fff; border-color: var(--green); }
button.bad { background: var(--red); color: #fff; border-color: var(--red); }

.toolbar {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

.content, .side {
  display: grid;
  gap: 12px;
  align-content: start;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.text-large {
  font-size: 22px;
  line-height: 1.45;
  margin: 0;
  overflow-wrap: anywhere;
}

.lakota {
  font-size: 24px;
  line-height: 1.55;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef1f5;
  color: #2f3744;
  font-size: 12px;
}

.pill.low { background: #fff3cd; color: var(--amber); }
.pill.high { background: #dff5e8; color: var(--green); }
.pill.bad { background: #fde2df; color: var(--red); }

.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.row {
  display: grid;
  gap: 8px;
}

.progress {
  height: 10px;
  background: #e7ebf0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.progress > div {
  height: 100%;
  width: 0%;
  background: var(--blue);
}

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.small { font-size: 13px; }

.list {
  max-height: 300px;
  overflow: auto;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

.list button {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  text-align: left;
  padding: 8px;
  min-height: 0;
}

.list button.active {
  background: #eaf1ff;
}

.export-actions {
  display: grid;
  gap: 8px;
}

.export-actions a {
  color: var(--blue);
}

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .actions { grid-template-columns: 1fr 1fr; }
}

