:root {
  font-family: Inter, "Segoe UI", sans-serif;
  color: #1b1b1b;
  background: #f6f7f9;
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  display: flex;
  gap: 28px;
  align-items: center;
  background: #1b1b1b;
  color: white;
  padding: 22px 32px;
}
header a {
  font-weight: 800;
  color: white;
  letter-spacing: 2px;
  text-decoration: none;
}
main {
  max-width: 1380px;
  margin: auto;
  padding: 32px;
}
h1,
h2 {
  margin: 0;
  font-size: 24px;
}
h2 {
  font-size: 20px;
}
p {
  line-height: 1.5;
}
.heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}
.eyebrow {
  font-size: 12px;
  color: #6b7280;
  letter-spacing: 1px;
}
.banner {
  background: #fff2e8;
  color: #8b3900;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid #ffd8bc;
}
button,
input,
select,
textarea {
  font: inherit;
  min-height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px;
  background: white;
  color: inherit;
}
button {
  cursor: pointer;
  font-weight: 600;
}
button:hover,
button.active {
  background: #fff2e8;
  border-color: #ff6b00;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #c84f00;
  outline-offset: 2px;
}
button.primary {
  background: #ff6b00;
  color: #fff;
  border: 0;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
nav,
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #6b7280;
  margin: 12px 0;
}
select,
input,
textarea {
  width: 100%;
  color: #1b1b1b;
}
input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
}
label.check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 24px 0;
}
.card,
article {
  padding: 22px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
}
.card strong {
  display: block;
  font-size: 30px;
  margin-top: 10px;
  font-weight: 750;
}
.muted {
  color: #6b7280;
}
.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: left;
  padding: 16px 12px;
  border-bottom: 1px solid #e5e7eb;
}
th {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
}
td button {
  padding: 4px 10px;
  min-height: 36px;
}
.status {
  padding: 5px 9px;
  border-radius: 8px;
  display: inline-block;
  font-size: 12px;
  background: #f3f4f6;
  color: #4b5563;
}
.red {
  background: #fef2f2;
  color: #991b1b;
}
.yellow {
  background: #fffbeb;
  color: #854d0e;
}
.green {
  background: #f0fdf4;
  color: #166534;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
dialog {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  width: min(1100px, 94vw);
  max-height: 90vh;
  padding: 24px;
}
dialog::backdrop {
  background: #1119;
}
.kpi-settings {
  display: grid;
  gap: 18px;
}
.kpi-settings h3 {
  margin: 0 0 8px;
  font-size: 16px;
}
.settings-card {
  margin: 0;
  padding: 18px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 1px 2px #1111110a;
}
.settings-section {
  display: grid;
  gap: 12px;
}
.settings-locations > details,
.metric-editor .grid {
  background: #f8fafc;
}
.source-editor {
  border-left: 4px solid #ff6b00;
}
.auto-select {
  border-color: #ff6b00;
  color: #a23f00;
}
.source-selection-result {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f0fdf4;
  color: #166534;
}
details {
  border: 1px solid #e5e7eb;
  padding: 14px;
  border-radius: 12px;
  margin: 12px 0;
}
summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 32px;
}
#notice:empty {
  display: none;
}
#notice {
  background: #fff2e8;
  padding: 12px;
  border-radius: 10px;
}
.empty {
  text-align: center;
  padding: 54px 20px;
}
.empty h2 {
  margin-bottom: 14px;
}
.danger {
  color: #991b1b;
}
.source {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
fieldset {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin: 15px 0;
}
legend {
  font-weight: 600;
}
a {
  color: #a23f00;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.history {
  max-height: 500px;
  overflow: auto;
}
@media (max-width: 760px) {
  main {
    padding: 18px 14px;
  }
  header {
    padding: 18px 14px;
    font-size: 12px;
    gap: 14px;
  }
  .cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .card {
    padding: 15px;
  }
  .card strong {
    font-size: 24px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .heading {
    align-items: flex-start;
  }
  .table-wrap {
    border: 0;
    background: none;
  }
  table,
  tbody,
  tr,
  td {
    display: block;
  }
  thead {
    display: none;
  }
  tr {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    margin: 12px 0;
    padding: 10px;
  }
  td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    padding: 7px 5px;
    text-align: right;
  }
  td:before {
    content: attr(data-label);
    color: #6b7280;
    text-align: left;
  }
  td:first-child {
    font-weight: 700;
    font-size: 16px;
  }
  dialog {
    width: 100vw;
    max-height: 100vh;
    padding: 16px;
    border-radius: 0;
  }
  .settings-card { padding: 14px; }
  h1 {
    font-size: 22px;
  }
}
