:root {
  color-scheme: light;
  --bg: #f4f6f4;
  --panel: #ffffff;
  --line: #d9e0d8;
  --text: #1d281f;
  --muted: #657268;
  --accent: #1f7a5a;
  --accent-strong: #155b43;
  --danger: #a33b2b;
  --warn: #a66a00;
  --soft: #edf4ef;
  --shadow: 0 12px 28px rgba(27, 42, 31, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  min-height: 36px;
  padding: 0 12px;
  font-weight: 650;
}

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

button.secondary,
.record-actions button {
  background: #e8eee9;
  color: var(--text);
}

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

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 17px;
}

h3 {
  font-size: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar p {
  color: var(--muted);
  margin-top: 2px;
}

.key-form {
  display: grid;
  grid-template-columns: minmax(180px, 260px) auto auto;
  gap: 8px;
  align-items: end;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.pill[data-tone="bad"],
.message[data-tone="bad"] {
  color: var(--danger);
}

.pill[data-tone="warn"] {
  color: var(--warn);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(360px, 1.15fr) minmax(360px, 1.15fr);
  gap: 12px;
  padding: 12px;
  min-height: calc(100vh - 69px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: auto;
  max-height: calc(100vh - 93px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.stack {
  display: grid;
  gap: 10px;
}

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

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

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

.section {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.card-lite {
  border: 1px solid var(--line);
  background: #fbfcfb;
  border-radius: 8px;
  padding: 10px;
}

.list,
.timeline {
  display: grid;
  gap: 8px;
}

.lot-row {
  display: grid;
  gap: 2px;
  width: 100%;
  text-align: left;
  background: #f2f6f3;
  color: var(--text);
  min-height: 62px;
}

.lot-row.selected {
  outline: 2px solid var(--accent);
  background: #e8f4ee;
}

.lot-row span,
.lot-row small,
.record span,
.record small,
.timeline-item span {
  color: var(--muted);
  font-size: 12px;
}

.lot-card,
.record,
.timeline-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.lot-card {
  display: grid;
  gap: 4px;
}

.record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.record div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

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

.record-actions button {
  min-height: 30px;
  padding: 0 9px;
}

.timeline-item {
  display: grid;
  gap: 7px;
}

.timeline-item > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

pre {
  margin: 0;
  background: #f6f8f6;
  border-radius: 6px;
  padding: 8px;
  overflow: auto;
  font-size: 12px;
  white-space: pre-wrap;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

.empty,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.message {
  min-height: 20px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.proof-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.proof-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.proof-list li span {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #cbd3cd;
}

.proof-list li[data-ok="true"] {
  color: var(--accent-strong);
  font-weight: 800;
}

.proof-list li[data-ok="true"] span {
  background: var(--accent);
}

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

  .panel {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .topbar,
  .key-form,
  .grid.two,
  .grid.three,
  .record {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .workspace {
    padding: 8px;
  }
}
