:root {
  --bg: #f3f5f4;
  --ink: #14201b;
  --muted: #5d6d66;
  --line: #d7e0db;
  --card: #ffffff;
  --green: #0b8f3a;
  --green-ink: #064d20;
  --soft: #e7f6ec;
  --warn: #8a4b12;
  --warn-bg: #fff4e8;
  --danger: #9d1c32;
  --shadow: 0 10px 30px rgba(20, 32, 27, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background:
    radial-gradient(900px 280px at 100% -10%, #dff5e6 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.45 "Segoe UI", Arial, sans-serif;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 32px 20px 64px; }
header { margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 14px; }
.mark {
  width: 36px; height: 36px; flex: none;
  border-radius: 8px;
  background: var(--green);
  color: white;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; letter-spacing: .04em;
}
h1 { font-size: 20px; line-height: 1.2; margin: 0; font-weight: 650; }
.lede { margin: 2px 0 0; color: var(--muted); font-size: 14px; line-height: 1.35; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
}
label.field { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: 15px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--ink);
  background: #fbfcfb;
}
textarea:focus { outline: 2px solid #b7e7c6; border-color: var(--green); }
.filters { margin-top: 12px; }
.filters[hidden] { display: none; }
.seg { display: flex; background: #eef2f0; border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  flex: 1;
  border: 0; background: transparent; color: var(--ink);
  border-radius: 8px; padding: 6px 8px; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.seg button small { color: var(--muted); font-size: 11px; font-weight: 400; }
.seg button[aria-pressed="true"] { background: white; box-shadow: 0 1px 2px rgba(0,0,0,.08); color: var(--green-ink); font-weight: 650; }
.seg button[aria-pressed="true"] small { color: var(--green-ink); }
.picks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pick {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 10px; background: #fbfcfb; cursor: pointer;
}
.pick-name { font-weight: 600; }
.pick-meta { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }
.doc-block {
  flex: 1 1 100%;
  background: #e7eee9;
  border: 1px solid #d3dfd7;
  border-radius: 12px;
  padding: 8px;
}
.doc-head {
  width: 100%;
  background: transparent;
  border-color: transparent;
  padding-left: 4px;
  padding-right: 4px;
}
.doc-cats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}
.pick.cat { padding: 4px 8px; font-size: 13px; background: #fff; }
.pick.cat .pick-name { font-weight: 500; }
@media (max-width: 640px) {
  .doc-cats { grid-template-columns: 1fr; }
}
button.go {
  margin-top: 14px;
  width: 100%;
  border: 0;
  background: var(--green);
  color: white;
  font: 600 16px/1 "Segoe UI", Arial, sans-serif;
  padding: 13px 16px;
  border-radius: 12px;
  cursor: pointer;
}
button.go:disabled { opacity: .55; cursor: progress; }
button.go.stop { background: #24312b; }
button.save {
  margin-top: 12px;
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: #8b9690;
  font: 600 16px/1 "Segoe UI", Arial, sans-serif;
  padding: 13px 16px;
  border-radius: 12px;
  cursor: not-allowed;
}
button.save:disabled {
  background: #fff;
  color: #8b9690;
  opacity: 1;
}
button.save.ready {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  cursor: pointer;
}
.progress { margin-top: 12px; }
.progress[hidden] { display: none; }
.progress-track {
  height: 12px;
  border-radius: 999px;
  background: #e5eeea;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #087a32, #3dcd58);
  transition: width .45s ease;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}
.hint { margin: 10px 2px 0; color: var(--muted); font-size: 13px; }
.caption { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.caption.follow { margin-top: 14px; }
#live { margin-top: 16px; display: grid; gap: 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
}
.card.has-photo {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px 16px;
  align-items: start;
}
.card.has-photo .power { grid-column: 1 / -1; margin-top: 0; }
.card .body { min-width: 0; }
.card img {
  width: 88px; height: 88px; object-fit: contain;
  background: #f6f8f7; border-radius: 10px; border: 1px solid var(--line);
}
.card h2 { margin: 0; font-size: 15px; line-height: 1.35; font-weight: 650; }
.ref {
  margin-top: 4px;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  background: var(--soft); color: var(--green-ink);
  border-radius: 999px; padding: 3px 8px; font-size: 12px;
}
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.power { margin-top: 8px; display: grid; gap: 8px; }
.power[hidden] { display: none; }
.block {
  border: 1px solid #d5e3da;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.block-title {
  padding: 5px 10px;
  background: #f3faf6;
  border-bottom: 1px solid #e3eee7;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.spec {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-top: 1px solid #eef3f0;
}
.spec:first-of-type { border-top: 0; }
.spec-k { font-size: 13px; }
.spec-v { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.copy {
  border: 1px solid #c9d6ce;
  background: #fff;
  color: var(--ink);
  border-radius: 7px;
  padding: 2px 7px;
  font: 700 12px/1.3 ui-monospace, Consolas, monospace;
  cursor: pointer;
}
.copy:hover { border-color: var(--green); }
.copy.copied { background: var(--soft); border-color: var(--green); color: var(--green-ink); }
.qty { font-size: 12px; font-weight: 700; color: var(--green-ink); }
.rt-wrap { overflow-x: auto; }
table.rt { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
table.rt th, table.rt td {
  padding: 6px 4px;
  border-bottom: 1px solid #e3eee7;
  border-right: 1px solid #e3eee7;
  text-align: center;
}
table.rt th:last-child,
table.rt td:last-child { border-right: 0; }
table.rt thead th {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink);
  background: #f3faf6;
}
table.rt thead th.corner {
  width: 28%;
  text-align: left;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  color: var(--muted);
  padding: 8px 10px;
  white-space: normal;
}
table.rt tbody th {
  width: 28%;
  text-align: left;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink);
  padding-left: 10px;
}
.rt-name { display: block; }
.rt-sub { display: block; margin-top: 1px; font-size: 11px; font-weight: 500; color: var(--muted); }
table.rt tr:last-child th,
table.rt tr:last-child td { border-bottom: 0; }
table.rt td { font-size: 12px; font-weight: 400; }
.dash { color: #b0bbb4; font-weight: 400; }
.log { margin: 10px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 13px; line-height: 1.45; }
.log li { padding: 1px 0; }
.log li.bad { color: var(--danger); }
.empty {
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 18px;
  color: var(--muted);
}
footer { margin-top: 18px; color: var(--muted); font-size: 12px; }
