:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #dde1e8;
  --ink: #1a1d23;
  --dim: #6b7280;
  --accent: #2357d9;
  --accent-ink: #ffffff;
  --best: #e8f6ee;
  --best-line: #197a3d;
  --err: #c02626;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --panel: #171a21;
    --line: #2b313b;
    --ink: #e6e9ef;
    --dim: #8b93a1;
    --accent: #4f8cff;
    --best: #14301f;
    --best-line: #5fd08a;
    --err: #ff7b7b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  padding: 24px 16px 96px;
  max-width: 980px;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -0.01em; }
h2 { margin: 0 0 12px; font-size: 16px; }
p { margin: 0; }
.dim { color: var(--dim); }
.err { color: var(--err); }
.hint { margin-top: 10px; color: var(--dim); font-size: 13px; }

header { margin-bottom: 20px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 600; font-size: 16px; margin-bottom: 8px; padding: 0; }

.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: 1fr 1fr; gap: 24px; }
.grid.addr { grid-template-columns: 1.3fr 1fr 1.3fr; margin-top: 10px; }
.grid.parcel { grid-template-columns: 2.4fr repeat(4, 1fr); }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--dim); }
.address > label { margin-top: 10px; }

input, select {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  width: 100%;
  min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.actions { display: flex; align-items: center; gap: 14px; margin: 18px 0 28px; }

button[type="submit"] {
  font: inherit;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  padding: 10px 26px;
  cursor: pointer;
}
button[type="submit"]:disabled { opacity: 0.5; cursor: progress; }


table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--dim); font-weight: 500; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.reason { color: var(--dim); font-size: 13px; }

tr.best td { background: var(--best); font-weight: 600; }
tr.best td:first-child { box-shadow: inset 4px 0 0 var(--best-line); }
.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--best-line);
  border: 1px solid var(--best-line);
  border-radius: 999px;
  padding: 0 8px;
  margin-left: 4px;
}

details { margin-top: 16px; }
summary { cursor: pointer; color: var(--dim); margin-bottom: 10px; }

@media (max-width: 760px) {
  .grid.two, .grid.addr { grid-template-columns: 1fr; }
  .grid.parcel { grid-template-columns: 1fr 1fr; }
  .grid.parcel > label:first-child { grid-column: 1 / -1; }
  th:nth-child(3), td:nth-child(3) { display: none; }
}
