:root {
  --bg: #f3efe6;
  --bg2: #ebe4d6;
  --ink: #1c1914;
  --muted: #6b6458;
  --accent: #0f6b4c;
  --accent2: #c45c26;
  --danger: #a32020;
  --card: #fffcf5;
  --line: #d5cbb8;
  --ok: #1a7a45;
  font-family: "Segoe UI", "PT Sans", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 10% 0%, #dfece4 0%, transparent 45%),
    radial-gradient(ellipse at 90% 10%, #f0e2d4 0%, transparent 40%),
    var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; }
.region-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.region-bar label { color: var(--muted); font-size: 0.92rem; }
.region-bar select {
  min-width: 220px;
  padding: 8px 10px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
}
.region-chip {
  color: var(--muted);
  font-size: 0.85rem;
}
.test-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
}
.test-toggle input { width: 16px; height: 16px; }
.test-on { color: var(--accent2); font-weight: 700; }
.test-off { color: var(--danger); font-weight: 700; }
.topbar { display:flex; gap:12px; align-items:center; justify-content:space-between; flex-wrap:wrap; border-bottom:1px solid var(--line); padding-bottom:12px; margin-bottom:16px; }
.brand { font-weight:700; font-size:1.15rem; }
.nav { display:flex; gap:8px; flex-wrap:wrap; }
.nav button, .nav a { background:transparent; border:none; color:var(--muted); padding:6px 10px; border-radius:8px; cursor:pointer; }
.nav button.active, .nav button:hover { background:var(--bg2); color:var(--ink); }
.panel { background:var(--card); border:1px solid var(--line); border-radius:14px; padding:18px; }
.scan { width:100%; font-size:1.35rem; padding:14px 16px; border:2px solid var(--accent); border-radius:12px; }
.hint { color:var(--muted); margin-top:8px; font-size:.92rem; }
.row { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.btn { border:none; border-radius:10px; padding:10px 14px; cursor:pointer; background:var(--bg2); }
.btn.primary { background:var(--accent); color:#fff; }
.btn.warn { background:var(--accent2); color:#fff; }
.flash { padding:10px 12px; border-radius:10px; margin:10px 0; }
.flash.err { background:#f8e4e4; color:var(--danger); }
.flash.ok { background:#e4f5ea; color:var(--ok); }
.meta { display:grid; grid-template-columns:140px 1fr; gap:6px 10px; margin:12px 0; }
.meta dt { color:var(--muted); } .meta dd { margin:0; }
.verdicts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin-top:14px; }
@media(max-width:720px){ .verdicts{grid-template-columns:1fr;} }
.vbtn { text-align:left; padding:16px 12px; border-radius:12px; border:1px solid var(--line); background:#fff; cursor:pointer; min-height:72px; }
.vbtn strong{display:block;margin-bottom:4px;}
.field { display:flex; flex-direction:column; gap:4px; margin:8px 0; flex:1; }
.field input, .field select { padding:8px 10px; border:1px solid var(--line); border-radius:8px; }
.table { width:100%; border-collapse:collapse; font-size:.92rem; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
.filters-row th { padding: 4px 3px; font-weight: normal; }
.filters-row input, .filters-row select {
  width: 100%;
  min-width: 72px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 0.8rem;
}
.login { max-width:420px; margin:12vh auto; }
.badge { display:inline-block; padding:2px 8px; border-radius:999px; background:var(--bg2); font-size:.8rem; margin-right:4px; }
.muted { color:var(--muted); }
.history { list-style:none; padding:0; }
.history li { padding:8px 0; border-bottom:1px solid var(--line); font-size:.9rem; }
.cells {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 168px;
  overflow: auto;
  padding: 4px 0;
}
.cell-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.88rem;
}
.cell-btn.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 20, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  max-width: 460px;
  width: 100%;
}
.modal h3 { margin: 0 0 8px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.ac-drop {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 20;
  max-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.ac-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: .92rem;
}
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover { background: #f3f7f5; }
