:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --line: #dfe3e6;
  --text: #172026;
  --muted: #68737d;
  --green: #1f8a5b;
  --blue: #2563a8;
  --red: #b42318;
  --amber: #a15c07;
  --ink: #202a33;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 11px;
  cursor: pointer;
}

button.primary { background: var(--ink); color: white; border-color: var(--ink); }
button.good { background: var(--green); color: white; border-color: var(--green); }
button.warn { background: var(--amber); color: white; border-color: var(--amber); }
button.danger { background: var(--red); color: white; border-color: var(--red); }
button:disabled { opacity: .5; cursor: wait; }

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

textarea { min-height: 80px; resize: vertical; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login form {
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  display: grid;
  gap: 12px;
}

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #202a33;
  color: white;
  padding: 18px 14px;
}

.brand {
  font-size: 20px;
  font-weight: 750;
  margin: 2px 6px 18px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav button {
  background: transparent;
  color: #e9eef2;
  border-color: transparent;
  text-align: left;
}

.nav button.active {
  background: rgba(255,255,255,.12);
}

.content {
  padding: 18px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.topbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 12px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.field-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.field-label input {
  color: var(--text);
  font-size: 14px;
}

.panel, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel { padding: 14px; }
.card { padding: 12px; display: grid; gap: 8px; }

.metric {
  display: grid;
  gap: 4px;
}

.metric strong {
  font-size: 24px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef1f3;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

tr:hover td { background: #fafafa; }

.score {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #e9f7ef;
  color: var(--green);
  font-weight: 750;
}

.score.mid { background: #fff4df; color: var(--amber); }
.score.low { background: #fde8e7; color: var(--red); }

.kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.lane {
  min-height: 240px;
  background: #eef1f3;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.lane h3 { display: flex; justify-content: space-between; gap: 8px; }

.object-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 14px;
}

.kv {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 8px 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  background: #f8fafb;
  color: var(--muted);
}

.map {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(32,42,51,.08) 1px, transparent 1px),
    linear-gradient(rgba(32,42,51,.08) 1px, transparent 1px),
    #e9eee9;
  background-size: 32px 32px;
  position: relative;
  overflow: hidden;
}

.pin {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  background: var(--red);
  transform: rotate(-45deg);
  left: var(--x);
  top: var(--y);
}

.pin::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  left: 6px;
  top: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(20,28,36,.42);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal form {
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: white;
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.process-step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.process-step span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-weight: 750;
}

pre.report {
  white-space: pre-wrap;
  margin: 0;
  background: #1f2933;
  color: #f5f7fa;
  border-radius: 8px;
  padding: 14px;
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 5; }
  .nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.cols-4, .grid.cols-3, .grid.cols-2, .object-layout { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(3, minmax(220px, 1fr)); }
}

@media (max-width: 620px) {
  .content { padding: 12px; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { align-items: flex-start; flex-direction: column; }
  .kv { grid-template-columns: 1fr; }
  th:nth-child(4), td:nth-child(4), th:nth-child(5), td:nth-child(5) { display: none; }
}
