:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-strong: #f8fbff;
  --text: #1f2937;
  --muted: #526175;
  --line: #d7e0ea;
  --accent: #0b66c3;
  --accent-strong: #084f99;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --radius: 14px;
  --shadow: 0 14px 30px rgba(15, 31, 52, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  line-height: 1.5;
  background:
    radial-gradient(1200px 700px at 90% -10%, #ddeafe 0%, transparent 60%),
    linear-gradient(180deg, #f4f8fd 0%, var(--bg) 100%);
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-strong);
}

.entity-link {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition:
    border-color 140ms ease,
    color 140ms ease;
}

.entity-link:hover {
  color: var(--accent);
  border-bottom-color: currentColor;
}

.entity-link:focus-visible {
  outline: 2px solid #b9d7fc;
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  width: min(960px, 92vw);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.9rem 0;
}

.nav-link {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.nav-link:hover {
  border-color: #bcc9d8;
  color: var(--text);
}

.main {
  padding: 1.6rem 0 2rem;
}

.page-title {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  letter-spacing: -0.02em;
}

.panel {
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-strong) 100%);
  box-shadow: var(--shadow);
}

.lead {
  margin: 0 0 1rem;
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

.section-title {
  margin: 1rem 0 0.6rem;
  font-size: 1.15rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stats li {
  display: grid;
  gap: 0.15rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
}

.metric {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.label {
  color: var(--muted);
  font-size: 0.9rem;
}

.entity-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.entity-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}

.entity-list li:last-child {
  border-bottom: 0;
}

.count {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1rem 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover {
  background: var(--accent-strong);
  color: #fff;
}

.btn.btn-quiet {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.btn.btn-quiet:hover {
  background: #f7faff;
  color: var(--text);
}

.btn.btn-danger {
  background: var(--danger-bg);
  border-color: #fecaca;
  color: var(--danger);
}

.btn.btn-danger:hover {
  background: #fee4e2;
  color: #8f1d14;
}

.form-grid {
  display: grid;
  gap: 0.9rem;
}

.form-grid .actions {
  margin: 0;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c5d1df;
  border-radius: 10px;
  background: #fff;
  padding: 0.62rem 0.72rem;
  color: var(--text);
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #b9d7fc;
  outline-offset: 0;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 7rem;
}

.error-list {
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem 0.75rem 1.4rem;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger);
}

.empty-state {
  color: var(--muted);
}

@media (max-width: 640px) {
  .main {
    padding-top: 1.1rem;
  }

  .panel {
    padding: 0.9rem;
  }

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

  .entity-list li {
    flex-direction: column;
    align-items: flex-start;
  }
}
