:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.4;
  background-color: #f5f7fa;
  color: #222;
}

body {
  margin: 0;
  padding: 1.5rem 2rem 3rem;
  background: linear-gradient(180deg, #f5f7fa 0%, #ffffff 100%);
}

header h1 {
  margin: 0 0 0.3rem;
  font-size: 1.9rem;
}

.subtitle {
  margin: 0;
  color: #666;
}

.filters {
  margin-top: 1.5rem;
  background: #fff;
  border: 1px solid #d9e1ec;
  border-radius: 8px;
  padding: 1rem 1.2rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.filters form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.filter-row label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  color: #334155;
  min-width: 180px;
}

.filter-row input[type="text"],
.filter-row input[type="number"],
.filter-row input[type="datetime-local"],
.filter-row select {
  margin-top: 0.35rem;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 0.95rem;
}

.filter-row input[type="text"]:focus,
.filter-row input[type="number"]:focus,
.filter-row input[type="datetime-local"]:focus,
.filter-row select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.filter-row .checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.65rem;
  min-width: auto;
}

.filter-actions {
  display: flex;
  gap: 0.75rem;
  margin-left: auto;
  margin-top: 1.65rem;
}

.filter-actions button {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.filter-actions button:hover {
  background: #1d4ed8;
}

.filter-actions .reset {
  align-self: center;
  color: #475569;
  text-decoration: none;
  font-size: 0.95rem;
}

.results {
  margin-top: 2rem;
}

.results-meta {
  display: flex;
  justify-content: space-between;
  color: #475569;
  margin-bottom: 0.5rem;
}

.table-wrapper {
  overflow-x: auto;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #d9e1ec;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

thead {
  background: #f1f5f9;
}

th, td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

tbody tr:hover {
  background: #f8fafc;
}

tbody tr.has-error {
  border-left: 4px solid #dc2626;
  background: rgba(220, 38, 38, 0.05);
}

.muted {
  color: #94a3b8;
}

.numeric {
  text-align: right;
}

.error-tag {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
  font-size: 0.85rem;
}

.view-link {
  text-decoration: none;
  color: #2563eb;
  font-weight: 600;
}

.view-link:hover {
  text-decoration: underline;
}

.empty {
  text-align: center;
  padding: 1.5rem;
  color: #94a3b8;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  color: #475569;
}

.pagination a {
  text-decoration: none;
  color: #2563eb;
  font-weight: 600;
}

.detail {
  margin-top: 2.5rem;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #d9e1ec;
  padding: 1.5rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.detail header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.detail h2 {
  margin: 0;
}

.detail .close {
  text-decoration: none;
  color: #2563eb;
}

.detail dl {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0.5rem 1rem;
}

.detail dt {
  font-weight: 600;
  color: #334155;
}

.detail dd {
  margin: 0;
  word-break: break-word;
}

.detail pre {
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

footer {
  margin-top: 3rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.85rem;
}

@media (max-width: 960px) {
  body {
    padding: 1.5rem;
  }

  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-actions {
    margin-top: 0;
    margin-left: 0;
    justify-content: flex-start;
  }

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