:root {
  --bg: #f4f7f5;
  --bg-alt: #dff4ec;
  --ink: #1f2a37;
  --muted: #5f6b7a;
  --line: #d2dde4;
  --card: rgba(255, 255, 255, 0.86);
  --accent: #0f766e;
  --accent-soft: #c5ece5;
  --danger: #b42318;
  --danger-soft: #fde7e3;
  --radius: 18px;
  --shadow: 0 20px 60px rgba(31, 42, 55, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 10%, var(--bg-alt), transparent 50%),
    radial-gradient(circle at 80% 0%, #fff1cc, transparent 34%),
    var(--bg);
}

h1,
h2,
h3 {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  letter-spacing: 0.01em;
  margin: 0 0 0.5rem;
}

p {
  line-height: 1.6;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a {
  color: inherit;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  filter: blur(2px);
  pointer-events: none;
}

.bg-shape-1 {
  width: 240px;
  height: 240px;
  background: linear-gradient(135deg, #3ab5a5, #7fd8cb);
  border-radius: 64% 36% 70% 30% / 41% 54% 46% 59%;
  top: -40px;
  right: min(4vw, 40px);
  animation: drift 22s ease-in-out infinite;
}

.bg-shape-2 {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, #ffd06f, #ffb75f);
  border-radius: 47% 53% 39% 61% / 59% 36% 64% 41%;
  left: -70px;
  bottom: -80px;
  animation: drift 18s ease-in-out infinite reverse;
}

@keyframes drift {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-20px) rotate(6deg);
  }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem max(4vw, 1rem);
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-block;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  font-size: 1.5rem;
  text-decoration: none;
}

.subtitle {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.search-form {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  min-width: 0;
}

.search-box {
  position: relative;
  min-width: 0;
  flex: 1 1 260px;
}

.search-form input {
  min-width: min(34vw, 260px);
}

.search-suggest {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(31, 42, 55, 0.16);
  z-index: 30;
  overflow: hidden;
}

.search-suggest ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-suggest li + li {
  border-top: 1px solid var(--line);
}

.search-suggest-link {
  display: grid;
  gap: 0.1rem;
  padding: 0.5rem 0.65rem;
  text-decoration: none;
}

.search-suggest-link:hover {
  background: #f5fbf9;
}

.search-suggest-title {
  font-weight: 600;
}

.search-suggest-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

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

.inline-form {
  display: inline-flex;
}

.container {
  width: min(1080px, 92vw);
  margin: 2.2rem auto 3.2rem;
  animation: rise 280ms ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.site-footer {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 1rem 2.8rem;
  color: var(--muted);
}

.card,
.content-wrap,
.auth-card,
.flash,
.table-wrap,
.wiki-page {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.flash {
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
}

.flash.success {
  border-left: 4px solid var(--accent);
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.1), rgba(255, 255, 255, 0.8));
}

.flash.error {
  border-left: 4px solid var(--danger);
  background: linear-gradient(90deg, rgba(180, 35, 24, 0.1), rgba(255, 255, 255, 0.8));
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.2rem;
}

.page-header.under-title {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 0.75rem;
}

.dashboard-primary-actions {
  justify-content: flex-end;
}

.dashboard-filter-row {
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.dashboard-filter-row select {
  width: auto;
  min-width: 210px;
  max-width: 300px;
}

.dashboard-reset-link {
  color: var(--muted);
  font-size: 0.86rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.dashboard-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.75rem;
}

.dashboard-tile {
  display: grid;
  gap: 0.25rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid #b4ddd5;
  border-radius: 12px;
  text-decoration: none;
  background: #eef9f6;
}

.dashboard-tile:hover {
  border-color: #89cfc2;
  background: #e4f6f1;
}

.dashboard-tile strong {
  font-size: 1rem;
}

.dashboard-tile span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.dashboard-tile-ghost {
  background: #fff;
}

.dashboard-recent-list {
  display: grid;
  gap: 0.45rem;
}

.dashboard-recent-item {
  display: grid;
  gap: 0.15rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  background: #fff;
}

.dashboard-recent-item span {
  color: var(--muted);
  font-size: 0.86rem;
}

.dashboard-article-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 0.25rem 0.65rem;
}

.dashboard-article-panel summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 700;
  padding: 0.5rem 0.35rem 0.65rem;
}

.dashboard-article-panel summary::-webkit-details-marker {
  display: none;
}

.dashboard-article-panel summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 1rem;
  transition: transform 120ms ease;
}

.dashboard-article-panel[open] summary::after {
  transform: rotate(180deg);
}

.dashboard-article-panel > .stack {
  padding: 0 0.1rem 0.3rem;
}

.toc-shell {
  display: grid;
  gap: 1rem;
}

.toc-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.toc-index a {
  min-width: 2rem;
  text-align: center;
  padding: 0.25rem 0.5rem;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
}

.toc-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
}

.toc-group {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.toc-group h2 {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.toc-group h2 span {
  color: var(--muted);
  font-size: 0.9rem;
}

.toc-list {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
}

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

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

.toc-list a {
  text-decoration: none;
}

.toc-list time {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.card {
  padding: 1rem;
}

.card h3 {
  margin-top: 0;
}

.card p {
  color: var(--muted);
  min-height: 0;
}

.card-excerpt {
  margin: 0.35rem 0 0;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  overflow-wrap: anywhere;
}

.card-tags {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid #b9d7d1;
  background: #edf9f6;
  color: #33535f;
  font-size: 0.8rem;
  text-decoration: none;
}

.tag-chip-muted {
  color: var(--muted);
  background: #fff;
  border-color: var(--line);
  cursor: default;
}

a.tag-chip:hover {
  border-color: #8fcfc2;
  background: #e5f6f2;
}

.search-active-filters {
  margin: 0.2rem 0 0.8rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.search-filter-form {
  margin-bottom: 0.65rem;
}

.search-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}

.search-filter-form .action-row input[type="search"] {
  flex: 1 1 280px;
  min-width: 220px;
}

.search-results-list {
  display: grid;
  gap: 0.7rem;
}

.search-hit-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.85rem;
}

.search-hit-card h3 {
  margin: 0;
}

.search-hit-card h3 a {
  text-decoration: none;
}

.search-hit-meta {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.active-filter-badge {
  border-color: #7bc2b4;
  background: #d9f2ed;
  color: #13433d;
  font-weight: 600;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 50dvh;
}

.auth-card,
.content-wrap {
  padding: 1.4rem;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 1rem;
}

.new-page-wizard {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fcfffe;
  padding: 0.95rem;
}

.new-page-wizard h2 {
  margin-bottom: 0.1rem;
}

.wizard-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
}

.wizard-step {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.88rem;
  color: var(--muted);
  background: #fff;
}

.wizard-step.is-active {
  color: #13433d;
  border-color: #89cfc2;
  background: #e9f8f4;
  font-weight: 600;
}

.wizard-step.is-done {
  color: #0a5f58;
  border-color: #7ac9bb;
  background: #dbf2ec;
}

.wizard-panel {
  border: 1px dashed #c2d9d3;
  border-radius: 12px;
  padding: 0.75rem;
  background: #fff;
}

.wizard-heading {
  font-weight: 600;
}

.wizard-template-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.wizard-template.is-selected,
.wizard-sensitivity.is-selected {
  color: white;
  border-color: transparent;
  background: linear-gradient(150deg, #0f766e, #0a5f58);
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.24);
}

.wizard-sensitivity-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.advanced-options {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.65rem 0.75rem;
}

.advanced-options summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.advanced-options summary::-webkit-details-marker {
  display: none;
}

.advanced-options[open] summary {
  margin-bottom: 0.7rem;
}

.editor-mode-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}

.editor-toggle-group {
  display: inline-flex;
  gap: 0.35rem;
}

.editor-toggle-group .is-active {
  background: #e9f8f4;
  border-color: #89cfc2;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.editor-preview {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 0.8rem;
}

.upload-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: #fff;
}

.muted-note.small {
  font-size: 0.84rem;
}

.upload-markdown-output {
  margin-top: 0.4rem;
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
}

.auth-card {
  width: min(420px, 100%);
}

.muted-note {
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.stack {
  display: grid;
  gap: 0.9rem;
}

.stack.large {
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 500;
}

.checkline {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  font-weight: 500;
}

label.checkline {
  display: inline-flex;
}

.checkline span {
  line-height: 1.35;
}

.checkline input[type="checkbox"] {
  margin: 0;
  flex: 0 0 auto;
}

input,
select,
textarea,
button,
.button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--line);
}

input,
select,
textarea {
  width: 100%;
  padding: 0.62rem 0.68rem;
  background: white;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  padding: 0;
  accent-color: var(--accent);
}

textarea {
  resize: vertical;
}

button,
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  gap: 0.3rem;
  padding: 0.55rem 0.9rem;
  color: white;
  border-color: transparent;
  background: linear-gradient(150deg, #0f766e, #0a5f58);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

button:hover,
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.3);
}

button.secondary,
.button.secondary,
button.ghost,
.button.ghost,
a.admin-link {
  color: var(--ink);
  background: var(--accent-soft);
  border: 1px solid #b2ddd5;
  box-shadow: none;
}

button.ghost {
  background: transparent;
}

button.danger,
.button.danger {
  background: linear-gradient(140deg, #b42318, #8d1710);
}

button.tiny,
.button.tiny {
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
}

a[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.55;
}

.actions {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.action-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.admin-nav {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 0.5rem;
}

.admin-nav .button {
  white-space: nowrap;
  width: 100%;
  text-align: center;
  justify-content: center;
}

.page-header.under-title .action-row {
  justify-content: flex-start;
}

.button.secondary.is-active-nav,
.button.secondary[aria-current="page"] {
  color: white;
  border-color: transparent;
  background: linear-gradient(150deg, #0f766e, #0a5f58);
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.26);
}

.admin-page-actions {
  margin-top: 0.1rem;
}

.admin-page-actions form {
  margin: 0;
}

.admin-index-shell {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.admin-index-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 1rem;
}

.admin-index-meta {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(130px, auto) minmax(0, 1fr);
  gap: 0.45rem 0.65rem;
}

.admin-index-meta dt {
  color: var(--muted);
}

.admin-index-meta dd {
  margin: 0;
}

.admin-index-progress {
  margin-top: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: #fbfdfc;
}

.admin-index-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
}

.admin-index-progress progress {
  width: 100%;
  height: 12px;
}

.admin-index-error {
  margin-top: 0.7rem;
  color: var(--danger);
  font-weight: 500;
}

.ssl-checklist,
.ssl-warning-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.45rem;
}

.ssl-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.2rem;
  padding: 0.1rem 0.45rem;
  margin-right: 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--line);
}

.ssl-state-ok {
  color: #0f5a43;
  background: #d9f3e9;
  border-color: #8fd2bb;
}

.ssl-state-warn {
  color: #8d1710;
  background: #fde6e3;
  border-color: #efb8b3;
}

.ssl-state-manual {
  color: #234468;
  background: #e7f0ff;
  border-color: #bad2f5;
}

.admin-restore-ready {
  margin-top: 0.85rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdfc;
}

.admin-restore-ready h3 {
  margin: 0 0 0.3rem;
}

.action-row input[type="text"],
.action-row input[type="search"],
.action-row select {
  width: auto;
  min-width: 170px;
}

.access-user-picker {
  margin: 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  gap: 0.6rem;
}

.access-user-picker legend {
  padding: 0 0.25rem;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

[data-restricted-only][hidden] {
  display: none !important;
}

.picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.picker-toolbar input[type="search"] {
  min-width: min(100%, 360px);
}

.allowed-users-list {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.45rem 0.9rem;
}

.user-checkline {
  display: flex !important;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.55rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfc;
}

.user-checkline span {
  display: grid;
  gap: 0.15rem;
}

.user-checkline input[type="checkbox"] {
  flex: 0 0 auto;
  margin-top: 0.2rem;
}

.standalone-checkline {
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 2.2rem;
}

.table-wrap {
  overflow-x: auto;
  padding: 0.5rem;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  text-align: left;
  padding: 0.65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

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

.media-ref-list {
  display: grid;
  gap: 0.2rem;
  font-size: 0.84rem;
}

.media-ref-list a {
  text-decoration: none;
}

.media-ref-list a:hover {
  text-decoration: underline;
}

.media-ref-empty {
  color: var(--muted);
  font-size: 0.84rem;
}

.media-missing-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.42rem;
}

.media-missing-list li {
  line-height: 1.45;
}

.media-missing-list code {
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
}

.wiki-page {
  padding: 1.3rem;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  align-items: start;
  gap: 1.1rem;
}

.article-main {
  min-width: 0;
}

.article-toc {
  position: sticky;
  top: 90px;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
  background: white;
}

.article-toc h2 {
  font-size: 1.1rem;
  margin-bottom: 0.6rem;
}

.article-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}

.article-toc li {
  line-height: 1.3;
}

.article-toc li.depth-3 {
  padding-left: 0.6rem;
}

.article-toc li.depth-4 {
  padding-left: 1.2rem;
}

.article-toc li.depth-5 {
  padding-left: 1.8rem;
}

.article-toc li.depth-6 {
  padding-left: 2.4rem;
}

.article-toc a {
  display: inline-block;
  width: 100%;
  padding: 0.18rem 0.38rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  transition: background-color 120ms ease, color 120ms ease;
}

.article-toc a:hover {
  color: var(--ink);
  background: #eef8f4;
}

.article-toc a.is-active {
  color: var(--accent);
  background: #def3ec;
  font-weight: 600;
}

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

.wiki-content {
  margin-top: 1.2rem;
}

.wiki-table-wrap {
  display: block;
  max-width: 100%;
  margin: 0.7rem 0 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.wiki-table-wrap table {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
  margin: 0;
}

.wiki-table-wrap th,
.wiki-table-wrap td {
  white-space: normal;
  word-break: break-word;
}

.wiki-backlinks {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.wiki-backlinks h2 {
  margin: 0 0 0.5rem;
}

.wiki-backlinks ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.wiki-content pre {
  background: #12202d;
  color: #ecf1f4;
  padding: 0.9rem;
  overflow: auto;
  border-radius: 10px;
}

.wiki-content code {
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.wiki-content img {
  max-width: 100%;
  border-radius: 10px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.history-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.5rem 0.8rem;
}

.history-raw {
  margin: 0;
  padding: 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f7fbfa;
  overflow: auto;
  max-height: 60dvh;
}

.history-diff-wrap {
  max-height: 70dvh;
  overflow: auto;
}

.history-diff-table {
  width: 100%;
  border-collapse: collapse;
}

.history-diff-table td,
.history-diff-table th {
  vertical-align: top;
}

.diff-line-no {
  width: 64px;
  min-width: 64px;
  color: var(--muted);
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
}

.diff-line-content code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: transparent;
}

.diff-row.diff-add td {
  background: #e9f8f1;
}

.diff-row.diff-del td {
  background: #fdecea;
}

.diff-row.diff-context td {
  background: #fff;
}

.diff-row.diff-skip td {
  color: var(--muted);
  font-style: italic;
  background: #f5f8f7;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.6rem 0;
}

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

.legal ul {
  margin: 0;
  padding-left: 1.1rem;
}

.legal-note {
  margin-top: 1rem;
  font-size: 0.92rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: 1fr;
  }

  .nav-right {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .search-form input {
    min-width: 0;
    width: 100%;
  }

  .search-form {
    width: 100%;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-primary-actions {
    justify-content: flex-start;
  }

  .dashboard-article-panel summary {
    font-size: 1.2rem;
  }

  .admin-nav {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-page-actions {
    justify-content: flex-start;
    width: 100%;
  }

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

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

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

  .article-toc {
    position: static;
  }
}
