:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  color: #1f2933;
  background: #f4f6f8;
}

body {
  margin: 0;
}

a {
  color: #0f609b;
}

.page {
  min-height: 100vh;
  padding: 24px;
  box-sizing: border-box;
}

.login {
  width: 100%;
  max-width: 360px;
  margin: 10vh auto 0;
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.login h1 {
  margin: 0 0 24px;
  font-size: 24px;
}

.login form {
  display: grid;
  gap: 12px;
}

.login label,
.filters label {
  font-size: 14px;
  font-weight: 700;
}

.login input,
.filters select {
  min-height: 40px;
  border: 1px solid #bcccdc;
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

.login button,
.filters button,
.secondary,
.link-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: #0f609b;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.secondary {
  background: #334e68;
}

.error {
  margin: 0;
  color: #b42318;
  font-size: 14px;
}

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
}

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

.topbar h1 {
  margin: 4px 0;
  font-size: 28px;
}

.topbar p {
  margin: 0;
  color: #52606d;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
}

.filters label {
  display: grid;
  gap: 6px;
}

.tree,
.metadata,
.viewer,
.table-section {
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
}

.domain + .domain {
  border-top: 1px solid #d9e2ec;
}

.domain summary {
  display: grid;
  grid-template-columns: 12px 64px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
}

.count,
.badge {
  background: #edf2f7;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  color: #334e68;
}

.documents {
  border-top: 1px solid #eef2f6;
}

.document-row {
  display: grid;
  grid-template-columns: 12px 92px minmax(180px, 1fr) minmax(220px, auto);
  gap: 12px;
  align-items: center;
  padding: 10px 16px 10px 36px;
  text-decoration: none;
  color: inherit;
}

.document-row:hover {
  background: #f8fafc;
}

.code {
  font-weight: 700;
}

.title {
  min-width: 0;
}

.meta {
  color: #627d98;
  font-size: 13px;
}

.indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.indicator.red { background: #d64545; }
.indicator.yellow { background: #f0b429; }
.indicator.green { background: #2f9e44; }

.metadata {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
}

.metadata div {
  display: grid;
  gap: 5px;
  padding: 12px;
  background: #ffffff;
}

.metadata .wide {
  grid-column: 1 / -1;
}

.metadata strong {
  color: #52606d;
  font-size: 12px;
  text-transform: uppercase;
}

.viewer {
  padding: 16px;
  margin-bottom: 18px;
}

.viewer h2,
.table-section h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.viewer iframe {
  width: 100%;
  height: min(72vh, 760px);
  border: 1px solid #bcccdc;
  border-radius: 6px;
  background: #ffffff;
}

.table-section {
  padding: 16px;
  margin-bottom: 18px;
  overflow-x: auto;
}

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

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

th {
  color: #52606d;
  font-size: 12px;
  text-transform: uppercase;
}

.empty {
  margin: 0;
  padding: 18px;
}

@media (max-width: 760px) {
  .page {
    padding: 14px;
  }

  .topbar {
    display: grid;
  }

  .document-row {
    grid-template-columns: 12px 82px 1fr;
  }

  .document-row .meta {
    grid-column: 3;
  }
}


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

.flash {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid #9ae6b4;
  border-radius: 6px;
  background: #f0fff4;
  color: #276749;
}

.search-form .search-input {
  flex: 1 1 360px;
}

.search-form input,
.panel-form input,
.panel-form select,
.panel-form textarea {
  min-height: 40px;
  border: 1px solid #bcccdc;
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  box-sizing: border-box;
}

.search-form input[type=search] {
  width: 100%;
}

.results {
  display: grid;
  gap: 8px;
}

.result-row {
  display: grid;
  grid-template-columns: 96px minmax(220px, 1fr) minmax(220px, auto);
  gap: 10px 14px;
  padding: 12px 14px;
  color: inherit;
  text-decoration: none;
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
}

.result-row:hover {
  background: #f8fafc;
}

.result-row .snippet {
  grid-column: 2 / -1;
  color: #52606d;
  font-size: 13px;
}

mark {
  background: #fff3bf;
  color: inherit;
  padding: 0 2px;
}

.forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.panel-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
}

.panel-form h2 {
  margin: 0;
  font-size: 18px;
}

.panel-form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
}

.panel-form textarea {
  resize: vertical;
}

@media (max-width: 760px) {
  .result-row {
    grid-template-columns: 1fr;
  }

  .result-row .snippet {
    grid-column: auto;
  }
}


.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
}

.stat-card strong {
  color: #52606d;
  font-size: 12px;
  text-transform: uppercase;
}

.stat-card span {
  font-size: 28px;
  font-weight: 700;
}

.stat-card small {
  color: #627d98;
}

.quality-section h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.small-button,
.danger-button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.small-button {
  background: #0f609b;
}

.danger-button {
  background: #b42318;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.tabs a {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #bcccdc;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  color: #334e68;
  text-decoration: none;
  font-weight: 700;
  background: #ffffff;
}

.tabs a.active {
  background: #0f609b;
  border-color: #0f609b;
  color: #ffffff;
}

.embedded {
  margin-bottom: 0;
}

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

.inline-form input {
  width: 110px;
  min-height: 36px;
  border: 1px solid #bcccdc;
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
}

.inline-form button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: #0f609b;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  padding: 0 12px;
  cursor: pointer;
}
