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

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

body.login-page {
  background: #eef2f7;
}

a {
  color: #1f5fbf;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #dde1e6;
  display: flex;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  color: #16181d;
  font-weight: 700;
}

nav {
  display: flex;
  gap: 16px;
}

.page {
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px 24px 48px;
}

.heading {
  align-items: flex-start;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 20px;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0 0 6px;
}

h2 {
  font-size: 18px;
  margin: 0 0 12px;
}

h3 {
  font-size: 15px;
  margin: 16px 0 8px;
}

p {
  line-height: 1.5;
  margin: 0;
}

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

.counts span,
.status {
  background: #eef2f7;
  border-radius: 6px;
  display: inline-block;
  font-size: 13px;
  padding: 4px 8px;
}

.tag {
  background: #eef2f7;
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  margin: 0 4px 4px 0;
  padding: 4px 8px;
}

.tag.warn {
  background: #fef3c7;
  color: #92400e;
}

.filters,
.status-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

select,
button,
input[type="text"],
input[type="password"],
textarea {
  border: 1px solid #c8ced8;
  border-radius: 6px;
  font: inherit;
}

select,
button,
input[type="text"],
input[type="password"] {
  min-height: 36px;
  padding: 6px 10px;
}

button {
  background: #1f5fbf;
  border-color: #1f5fbf;
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
}

button.secondary {
  background: #eef2f7;
  border-color: #c8ced8;
  color: #16181d;
}

table {
  background: #ffffff;
  border: 1px solid #dde1e6;
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid #e7ebf0;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f0f3f7;
  font-size: 13px;
  font-weight: 700;
}

.score {
  font-weight: 800;
  text-align: right;
}

.score.big {
  background: #16181d;
  border-radius: 8px;
  color: #ffffff;
  font-size: 28px;
  min-width: 64px;
  padding: 12px;
  text-align: center;
}

.fit-cell {
  text-align: center;
}

.summary-cell {
  max-width: 260px;
  min-width: 180px;
}

.fit-mark {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  min-width: 38px;
  padding: 4px 8px;
}

.fit-mark.yes {
  background: #dcfce7;
  color: #166534;
}

.fit-mark.no {
  background: #fee2e2;
  color: #991b1b;
}

.fit-mark.unknown {
  background: #eef2f7;
  color: #596273;
}

.summary-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.summary-grid > div {
  min-width: 0;
}

.quality {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  margin-right: 4px;
  padding: 4px 8px;
  white-space: nowrap;
}

.quality-good {
  background: #dcfce7;
  color: #166534;
}

.quality-ok {
  background: #e0f2fe;
  color: #075985;
}

.quality-warn {
  background: #fef3c7;
  color: #92400e;
}

.quality-bad {
  background: #fee2e2;
  color: #991b1b;
}

.grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin-bottom: 24px;
}

section,
.template,
.grid > div {
  background: #ffffff;
  border: 1px solid #dde1e6;
  border-radius: 8px;
  padding: 18px;
}

.heading {
  background: transparent;
  border: 0;
  padding: 0;
}

dl {
  display: grid;
  gap: 8px 16px;
  grid-template-columns: 140px 1fr;
  margin: 0 0 16px;
}

dt {
  color: #596273;
}

dd {
  margin: 0;
}

textarea {
  min-height: 180px;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

.messages {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.messages li {
  line-height: 1.45;
}

.checks {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.checks label {
  align-items: center;
  display: flex;
  gap: 8px;
  line-height: 1.35;
}

.template-form {
  display: grid;
  gap: 16px;
}

.template-tools {
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.template-tools label {
  display: grid;
  gap: 6px;
}

.template {
  display: grid;
  gap: 12px;
}

.template label {
  display: grid;
  gap: 6px;
  line-height: 1.35;
}

.template-head {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.switch-row {
  align-items: center !important;
  display: flex !important;
  gap: 8px !important;
  white-space: nowrap;
}

.login-shell {
  align-items: center;
  display: flex;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  background: #ffffff;
  border: 1px solid #dde1e6;
  border-radius: 8px;
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 420px;
  padding: 24px;
  width: 100%;
}

.login-card label {
  display: grid;
  gap: 6px;
}

.error {
  background: #fee2e2;
  border-radius: 6px;
  color: #991b1b;
  padding: 10px 12px;
}

.preview {
  background: #f6f7f8;
  border: 1px solid #dde1e6;
  border-radius: 6px;
  line-height: 1.45;
  margin: 0;
  min-height: 72px;
  padding: 12px;
  white-space: pre-wrap;
}

.muted {
  color: #596273;
}

@media (max-width: 760px) {
  .topbar,
  .heading,
  .filters,
  .status-form,
  .template-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
