:root {
  --bg: #f7fbff;
  --surface: #ffffff;
  --text: #1b2430;
  --muted: #5b6675;
  --primary: #1d5fd0;
  --border: #dbe3ee;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(15, 34, 58, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header h1 {
  margin: 0;
  font-size: 1.1rem;
}

.site-header input[type='search'] {
  grid-column: 1 / -1;
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.index-header {
  grid-template-columns: auto auto 1fr;
}

.index-header input[type='search'] {
  grid-column: auto;
  min-width: 0;
}

.lang-switch {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0.3rem 0.4rem;
  font-size: 0.85rem;
  width: fit-content;
  min-width: 0;
  justify-self: start;
}

.layout {
  display: block;
  padding: 1rem;
}

.filters {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.8rem;
  margin-bottom: 1rem;
}

.filters.open {
  display: block;
}

.filters h2 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
}

.filters label {
  display: block;
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.filters select {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.inline-check {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  color: var(--text) !important;
}

.summary {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.card-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: 1fr;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.95rem;
}

.card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  line-height: 1.35;
}

.meta-line {
  color: var(--muted);
  font-size: 0.92rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.tag {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.btn {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.72rem;
  color: var(--text);
  background: #fff;
  font-size: 0.9rem;
}

.btn.primary {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.site-footer {
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 0.8rem;
}

.icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
}

.article-header {
  grid-template-columns: 1fr auto;
}

.article-header .mobile-article-select {
  grid-column: 1 / -1;
  grid-row: 2;
}

.article-header .lang-switch {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}

.mobile-article-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 0.5rem;
}

.back-link {
  text-decoration: none;
  color: var(--primary);
  font-size: 0.92rem;
}

.article-page {
  margin: 1rem;
}

.article-layout {
  display: block;
}

.article-content-panel {
  min-height: calc(100vh - 120px);
}

.article-content-panel .reader {
  height: 100%;
}

.article-sidebar {
  display: none;
}

.article-filter-card,
.article-list-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.85rem;
}

.article-filter-card h2,
.article-list-card h3,
.article-meta-side h3,
.article-meta-side h2 {
  margin-top: 0;
}

.article-filter-card label {
  display: block;
  margin-bottom: 0.6rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.article-filter-card select {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 24vh;
  overflow: auto;
}

.article-list-item {
  display: block;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: #fff;
  font-size: 0.9rem;
}

.article-list-item.active {
  border-color: var(--primary);
  background: #eef4ff;
}

.article-meta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.85rem;
  margin-bottom: 0.8rem;
}

.article-meta-side {
  margin-top: 0.8rem;
}

.status {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

#docFrame,
#pdfEmbed {
  width: 100%;
  min-height: calc(100vh - 120px);
  height: calc(100vh - 120px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--muted);
}

@media (min-width: 900px) {
  .site-header {
    grid-template-columns: auto 1fr minmax(260px, 360px);
  }

  .index-header {
    grid-template-columns: auto 1fr;
  }

  .article-header {
    grid-template-columns: auto 1fr auto;
  }

  .site-header input[type='search'] {
    grid-column: auto;
  }

  .layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1rem;
    align-items: start;
  }

  .filters {
    display: block;
    position: sticky;
    top: 74px;
  }

  .icon-btn {
    display: none;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }

  .article-page {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 1rem;
  }

  .article-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1rem;
    align-items: start;
  }

  .article-sidebar {
    display: block;
    position: sticky;
    top: 74px;
    align-self: start;
  }

  .article-list-card {
    margin-top: 0.8rem;
  }

  .article-content-panel {
    min-width: 0;
    align-self: start;
    margin-top: 0;
    min-height: calc(100vh - 110px);
  }

  #docFrame,
  #pdfEmbed {
    min-height: calc(100vh - 110px);
    height: calc(100vh - 110px);
  }
}