:root {
  color-scheme: light;
  --bg: #f4f1e8;
  --paper: #fffdf8;
  --ink: #1f2523;
  --muted: #65716b;
  --line: #ded7c8;
  --accent: #b7492d;
  --accent-2: #207070;
  --accent-3: #7a5d18;
  --soft: #ebe5d8;
  --code: #26312f;
  --shadow: 0 18px 48px rgba(32, 35, 31, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(183, 73, 45, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(32, 112, 112, 0.1), transparent 38%),
    var(--bg);
  color: var(--ink);
}

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

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.86);
  backdrop-filter: blur(14px);
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-weight: 800;
  font-size: 21px;
  background: #fff8ed;
}

.brand-title {
  font-weight: 800;
  font-size: 19px;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.search {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.search input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
}

.search input:focus {
  outline: 2px solid rgba(32, 112, 112, 0.25);
  border-color: var(--accent-2);
}

.nav-section {
  margin-bottom: 20px;
}

.nav-heading {
  margin: 0 0 8px;
  color: var(--accent-3);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.nav-link {
  width: 100%;
  display: block;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.25;
}

.nav-link:hover {
  background: var(--soft);
}

.nav-link.active {
  background: #26312f;
  color: #fffdf8;
}

.main {
  min-width: 0;
  padding: 34px clamp(24px, 5vw, 64px) 56px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto 28px;
}

.section-label {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
h4 {
  line-height: 1.12;
  letter-spacing: 0;
}

#page-title {
  margin: 8px 0 0;
  font-size: clamp(34px, 5vw, 62px);
}

.status-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-strip div {
  min-width: 92px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.78);
}

.status-strip span {
  display: block;
  font-weight: 800;
  font-size: 16px;
}

.status-strip small {
  color: var(--muted);
  font-size: 12px;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 820px) 220px;
  gap: 36px;
  max-width: 1180px;
  margin: 0 auto;
  align-items: start;
}

.content {
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.content:focus {
  outline: none;
}

.content h1 {
  margin-top: 0;
  font-size: 42px;
}

.content h2 {
  margin: 36px 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 25px;
}

.content h3 {
  margin: 28px 0 10px;
  font-size: 19px;
}

.content p,
.content li {
  color: #2f3935;
  font-size: 16px;
  line-height: 1.68;
}

.content ul,
.content ol {
  padding-left: 24px;
}

.content code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #ebe5d8;
  color: var(--code);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.content pre {
  overflow: auto;
  padding: 16px;
  border-radius: 8px;
  background: var(--code);
  color: #fffdf8;
}

.content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.table-wrap {
  overflow-x: auto;
  margin: 18px 0 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.content th,
.content td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  line-height: 1.45;
}

.content th:last-child,
.content td:last-child {
  border-right: 0;
}

.content tbody tr:last-child td {
  border-bottom: 0;
}

.content th {
  background: #f1eadc;
  color: var(--accent-3);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.content blockquote {
  margin: 22px 0;
  padding: 10px 18px;
  border-left: 4px solid var(--accent);
  background: #fff6e8;
}

.content hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 32px 0;
}

.task {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.task input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-2);
}

.toc {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.82);
}

.toc-title {
  margin-bottom: 10px;
  color: var(--accent-3);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.toc-list a {
  display: block;
  padding: 7px 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.3;
}

.toc-list a:hover {
  color: var(--accent-2);
}

.empty {
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .toc {
    display: none;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 24px 14px 42px;
  }

  .topbar {
    display: grid;
  }

  .status-strip {
    justify-content: flex-start;
  }

  #page-title {
    font-size: 34px;
  }

  .content {
    padding: 22px;
  }
}
