:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f6f7f8;
  color: #1f2933;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.app-shell {
  min-height: 100vh;
  padding: 16px;
}

.app-header {
  margin-bottom: 16px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.25;
}

.panel {
  margin-bottom: 13px;
  padding: 13px;
  border: 1px solid #d7dde3;
  border-radius: 7px;
  background: #ffffff;
}

.status-grid {
  display: grid;
  gap: 8px;
  margin: 0 0 11px;
}

.status-grid div {
  min-width: 0;
}

dt {
  color: #607080;
  font-size: 10px;
  font-weight: 700;
}

dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 11px;
}

button {
  min-height: 29px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid #0f766e;
  border-radius: 5px;
  background: #0f766e;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

button:hover {
  background: #115e59;
}

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

.panel-title-row h2 {
  margin-bottom: 0;
}

.badge {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  background: #e7eef5;
  color: #34495e;
  font-size: 10px;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 5px;
  color: #607080;
  font-size: 10px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 29px;
  padding: 0 10px;
  border: 1px solid #c9d2dc;
  border-radius: 5px;
  color: #1f2933;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.result {
  margin-top: 10px;
  margin-bottom: 0;
  padding: 8px 10px;
  border-left: 3px solid #0f766e;
  background: #eefaf7;
  font-size: 12px;
}

.factor-card {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid #cbd9e4;
  border-radius: 7px;
  background: #f7fafc;
}

.formula-preview {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: #405466;
  font-size: 11px;
}

.formula-preview strong {
  color: #0f766e;
  font-size: 19px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

th,
td {
  padding: 6px 5px;
  border-bottom: 1px solid #e0e6eb;
  text-align: left;
  vertical-align: top;
}

th {
  color: #607080;
  font-size: 10px;
  font-weight: 700;
}

.distance-value {
  font-weight: 800;
}

.building-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.building-list-empty {
  color: #6b7280;
  font-size: 0.72rem;
}

.building-pill {
  min-height: 26px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #ffffff;
  padding: 0.25rem 0.5rem;
  font-size: 0.68rem;
  color: #111827;
  cursor: pointer;
  user-select: none;
}

.building-pill:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

.building-pill.has-distance-lines {
  border-color: #16a34a;
  background: #f0fdf4;
}

.building-pill.is-working {
  opacity: 0.55;
  pointer-events: none;
}

.tool-panel summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

.tool-panel summary::-webkit-details-marker {
  display: none;
}

.tool-panel summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transform: translateY(-1px);
}

.tool-panel[open] summary::before {
  content: "▾";
}

.feature-mount {
  margin-top: 10px;
}

.feature-placeholder {
  color: #607080;
  font-size: 12px;
}

.nested-panel {
  margin-top: 10px;
  margin-bottom: 10px;
}

input {
  width: 100%;
  min-height: 29px;
  padding: 0 10px;
  border: 1px solid #c9d2dc;
  border-radius: 5px;
  color: #1f2933;
  background: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
}

select {
  width: 100%;
  min-height: 29px;
  padding: 0 10px;
  border: 1px solid #c9d2dc;
  border-radius: 5px;
  color: #1f2933;
  background: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
}