:root {
  --bg: #f4eadc;
  --card: rgba(255, 251, 246, 0.94);
  --line: rgba(88, 58, 40, 0.14);
  --text: #2b1d15;
  --muted: #6e5647;
  --accent: #9d5a30;
  --accent-strong: #78411f;
  --ok: #e3f1dd;
  --soft: #f0e5d8;
  --shadow: 0 18px 45px rgba(43, 29, 21, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(157, 90, 48, 0.14), transparent 26%),
    linear-gradient(180deg, #f6efe6 0%, #eadac7 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell,
.content-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
}

.content-shell {
  padding: 28px 0 64px;
  display: grid;
  gap: 18px;
}

.content-shell-narrow {
  width: min(840px, calc(100vw - 32px));
}

.site-header {
  padding: 24px 0 0;
}

.shell-header,
.page-head,
.site-user,
.stats-inline,
.filters-actions,
.detail-actions,
.inline-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.shell-header {
  justify-content: space-between;
  padding: 22px 24px;
  border-radius: 26px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.site-kicker,
.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--muted);
}

.site-title,
.page-card h2,
.login-card h2 {
  margin: 0;
}

.site-nav {
  display: flex;
  gap: 18px;
}

.site-user {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.site-user span,
.muted,
.stats-inline span,
.stat-card span {
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.page-card,
.stack-form,
.filters-grid,
.detail-grid,
.stats-cards,
.stats-shell,
.stats-panels,
.stats-panel,
.stats-bar-list {
  display: grid;
  gap: 16px;
}

.page-head {
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
}

.stats-inline {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stats-inline strong {
  font-size: 1.1rem;
}

.filters-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stack-form label,
.filters-grid label {
  display: grid;
  gap: 8px;
}

.stack-form span,
.filters-grid span {
  font-size: 0.9rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

textarea {
  min-height: 160px;
  resize: vertical;
}

button,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
}

button {
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.button-secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.notice {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.notice-error {
  border-color: rgba(157, 90, 48, 0.4);
}

.table-wrap {
  overflow-x: auto;
}

.catalogue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.catalogue-table th,
.catalogue-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  text-align: left;
}

.catalogue-table th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.catalogue-table tbody tr:last-child td {
  border-bottom: none;
}

.primary-link {
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.badge-ok {
  background: var(--ok);
}

.badge-muted {
  background: var(--soft);
}

.detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.detail-grid dt {
  margin: 0 0 6px;
  color: var(--muted);
}

.detail-grid dd {
  margin: 0;
}

.stats-cards {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stats-cards-wide {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.stats-note,
.stats-empty,
.stats-bar-meta {
  color: var(--muted);
}

.stats-panels {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stats-panel h3 {
  margin: 0 0 10px;
}

.stats-bar-item {
  display: grid;
  gap: 8px;
}

.stats-bar-header,
.stats-bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stats-bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(157, 90, 48, 0.12);
  overflow: hidden;
}

.stats-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.stats-map-shell {
  display: grid;
  gap: 12px;
}

.stats-map {
  width: 100%;
  height: auto;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top left, rgba(157, 90, 48, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(255, 251, 246, 0.94), rgba(248, 239, 229, 0.92));
  padding: 14px;
}

.stats-map-region {
  fill: rgba(157, 90, 48, var(--region-opacity, 0.12));
  stroke: rgba(88, 58, 40, 0.42);
  stroke-width: 2;
}

.stats-map-label {
  fill: #fff;
  font-size: 14px;
  font-weight: 700;
  text-anchor: middle;
  pointer-events: none;
}

.stat-card strong {
  font-size: 1.8rem;
}

.site-footer {
  padding: 0 0 40px;
}

.site-footer .shell {
  padding: 18px 24px;
  border-radius: 24px;
  background: rgba(255, 251, 246, 0.78);
  border: 1px solid var(--line);
}

.site-footer p {
  margin: 0;
}

@media (max-width: 860px) {
  .shell-header,
  .page-head,
  .site-user,
  .detail-actions,
  .filters-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .site-nav {
    width: 100%;
    justify-content: space-between;
  }
}
