:root {
  --bg: #f5f1ea;
  --bg-strong: #ece5db;
  --panel: rgba(255, 251, 246, 0.9);
  --line: rgba(51, 44, 39, 0.12);
  --text: #1d1a17;
  --muted: #655b53;
  --accent: #1f5f68;
  --accent-soft: rgba(31, 95, 104, 0.10);
  --chip: #edf2ef;
  --shadow: 0 18px 48px rgba(42, 32, 24, 0.08);
  --radius: 20px;
  --list-sticky-top: 108px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(31, 95, 104, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(163, 120, 74, 0.10), transparent 24%),
    linear-gradient(180deg, #f8f4ec 0%, var(--bg) 100%);
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(92, 54, 23, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 54, 23, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 90%);
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1500px;
  margin: 0 auto;
  padding: 28px;
}

.hero,
.toolbar,
.panel {
  backdrop-filter: blur(10px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero {
  display: block;
  padding: 28px;
  border-radius: calc(var(--radius) + 6px);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -80px;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(31, 95, 104, 0.16), transparent 70%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
}

.hero h1,
.panel h2,
.section-title {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 4.5vw, 58px);
  line-height: 0.96;
}

.hero-text {
  max-width: 62ch;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.hero-brief {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.hero-brief:empty {
  display: none;
}

.brief-card {
  min-width: 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(51, 44, 39, 0.08);
}

.brief-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.brief-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.stat-card {
  min-width: 0;
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(238, 245, 242, 0.8));
  border: 1px solid rgba(51, 44, 39, 0.10);
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(22px, 2.8vw, 28px);
  line-height: 1.15;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  overflow-wrap: anywhere;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.overview-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.overview-card {
  min-width: 0;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(51, 44, 39, 0.10);
  box-shadow: var(--shadow);
}

.overview-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 10px;
}

.overview-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  overflow-wrap: anywhere;
}

.overview-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: var(--radius);
  position: sticky;
  top: 0;
  z-index: 30;
}

.toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toolbar-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.mode-switch,
.lang-switch {
  display: flex;
  gap: 8px;
}

.mode-button,
.lang-button,
.entity-link {
  appearance: none;
  border: 1px solid rgba(92, 54, 23, 0.12);
  background: #fffaf4;
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.mode-button,
.lang-button {
  padding: 10px 14px;
  font-weight: 700;
}

.entity-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-weight: 700;
  text-decoration: none;
}

.mode-button:hover,
.lang-button:hover,
.entity-link:hover {
  transform: translateY(-1px);
  border-color: rgba(179, 77, 46, 0.36);
}

.mode-button.active,
.lang-button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.search-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid rgba(92, 54, 23, 0.14);
  background: rgba(255, 255, 255, 0.75);
  font: inherit;
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: minmax(400px, 520px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: stretch;
}

.panel {
  border-radius: var(--radius);
  min-height: 72vh;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 14px;
  border-bottom: 1px solid rgba(92, 54, 23, 0.08);
}

.panel-head h2 {
  margin: 0;
  font-size: 28px;
}

.panel-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.panel-metric {
  display: inline-flex;
  min-width: 54px;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(31, 95, 104, 0.09);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
}

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

.list-scroll {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 12px;
}

.list-panel {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--list-sticky-top);
  min-height: calc(100vh - var(--list-sticky-top) - 12px);
  height: calc(100vh - var(--list-sticky-top) - 12px);
  align-self: start;
}

.entity-card {
  display: block;
  min-width: 0;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  margin-bottom: 10px;
  color: inherit;
  text-decoration: none;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.entity-card:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 95, 104, 0.28);
  background: rgba(255, 255, 255, 0.75);
}

.entity-card.active {
  border-color: rgba(31, 95, 104, 0.36);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(237, 242, 239, 0.96));
}

.entity-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.entity-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: var(--chip);
  color: #355056;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1;
  border: 1px solid rgba(51, 44, 39, 0.08);
}

.detail-content {
  padding: 22px;
}

.empty-state {
  color: var(--muted);
  padding: 40px 8px;
  text-align: center;
}

.section {
  padding: 0 0 24px;
  border-bottom: 1px solid rgba(92, 54, 23, 0.08);
  margin-bottom: 24px;
}

.section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-title {
  margin: 0 0 12px;
  font-size: 23px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.meta-card {
  min-width: 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(247, 234, 215, 0.58);
  border: 1px solid rgba(92, 54, 23, 0.08);
}

.meta-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.meta-card strong {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.prose {
  line-height: 1.72;
  white-space: pre-wrap;
}

.prose-md {
  line-height: 1.72;
}

.prose-md > :first-child {
  margin-top: 0;
}

.prose-md h1,
.prose-md h2,
.prose-md h3,
.prose-md h4 {
  margin: 22px 0 10px;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  line-height: 1.2;
}

.prose-md h1 {
  font-size: 30px;
}

.prose-md h2 {
  font-size: 24px;
}

.prose-md h3 {
  font-size: 20px;
}

.prose-md h4 {
  font-size: 17px;
}

.prose-md p {
  margin: 0 0 14px;
}

.prose-md ul,
.prose-md ol {
  margin: 0 0 16px 22px;
  padding: 0;
}

.prose-md li {
  margin: 6px 0;
}

.prose-md table {
  width: 100%;
  margin: 16px 0;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
}

.prose-md th,
.prose-md td {
  border: 1px solid rgba(92, 54, 23, 0.12);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.prose-md th {
  background: rgba(31, 95, 104, 0.09);
}

.prose-md strong {
  font-weight: 700;
}

.prose-md em {
  font-style: italic;
}

.compact-list {
  display: grid;
  gap: 10px;
}

.compact-item {
  min-width: 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(92, 54, 23, 0.08);
}

.compact-item h4 {
  margin: 0 0 6px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.compact-item h4 a {
  color: inherit;
  text-decoration: none;
}

.compact-item h4 a:hover {
  text-decoration: underline;
}

.compact-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.faq-list details {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(92, 54, 23, 0.08);
}

.faq-list details + details {
  margin-top: 10px;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 700;
}

.faq-category {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
}

.source-list a,
.detail-content a {
  color: var(--accent);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.source-list a:hover,
.detail-content a:hover {
  text-decoration: underline;
}

.inline-entity-link {
  font-weight: 700;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.service-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.support-note {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 1080px) {
  .hero-brief,
  .overview-strip,
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
  }

  .list-scroll {
    max-height: none;
  }

  .list-panel {
    position: static;
    top: auto;
    min-height: auto;
    height: auto;
    align-self: stretch;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 16px;
  }

  .hero h1 {
    font-size: 34px;
    line-height: 1.02;
  }

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

  .toolbar-group {
    width: 100%;
  }

  .mode-switch,
  .lang-switch {
    width: 100%;
  }

  .mode-button,
  .lang-button {
    flex: 1;
  }

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