:root {
  --bg: #f8f4ed;
  --surface: #fff;
  --ink: #292723;
  --soft: #585249;
  --muted: #756f65;
  --primary: #2e6e66;
  --primary-dark: #234f4a;
  --primary-light: #e6efed;
  --border: #e1d7c7;
  --font: 'Manrope', system-ui, sans-serif;
  --head: 'Lora', Georgia, serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.55; }
.document-header { border-bottom: 1px solid var(--border); background: rgba(248,244,237,.96); }
.document-brand { width: min(1180px, calc(100% - 2rem)); min-height: 76px; margin: 0 auto; display: flex; align-items: center; gap: .75rem; color: var(--ink); text-decoration: none; }
.document-brand__mark { width: 46px; height: 46px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--primary-dark); color: #fff; font: 700 1.05rem/1 var(--head); }
.document-brand > span:last-child { display: grid; }
.document-brand strong { font: 600 1.2rem/1.2 var(--head); }
.document-brand small { margin-top: .12rem; color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; }
.document-main { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2rem, 7vw, 4rem) 0 4rem; }
.document-title { max-width: 760px; margin: 0 auto 1.5rem; text-align: center; }
.document-title > span { color: var(--primary); font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.document-title h1 { margin: .6rem 0 0; font: 600 clamp(2rem, 7vw, 3.35rem)/1.08 var(--head); }
.document-title p { margin: .85rem 0 0; color: var(--soft); }
.document-status { padding: 1rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--soft); text-align: center; }
.document-current { overflow: hidden; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: 0 8px 32px rgba(41,39,35,.06); }
.document-current__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.3rem; border-bottom: 1px solid var(--border); }
.document-version { display: inline-block; padding: .28rem .55rem; border-radius: 999px; background: var(--primary-light); color: var(--primary-dark); font-size: .72rem; font-weight: 800; }
.document-current h2 { margin: .45rem 0 0; font: 600 1.35rem/1.25 var(--head); }
.document-current__head p { margin: .2rem 0 0; color: var(--muted); font-size: .8rem; }
.document-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; }
.document-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: .65rem .9rem; border: 1px solid var(--border); border-radius: 999px; color: var(--primary-dark); font-size: .82rem; font-weight: 800; text-decoration: none; }
.document-button--primary { border-color: var(--primary-dark); background: var(--primary-dark); color: #fff; }
.document-viewer-wrap { padding: 1rem; }
.document-viewer { width: 100%; max-height: min(78vh, 920px); overflow-y: auto; display: grid; gap: .8rem; padding: .8rem; border: 1px solid var(--border); border-radius: 12px; background: #e9e7e2; scrollbar-gutter: stable; }
.document-viewer img { display: block; width: min(100%, 900px); height: auto; margin: 0 auto; background: #fff; box-shadow: 0 2px 12px rgba(41,39,35,.12); }
.document-viewer-fallback { margin: .65rem 0 0; color: var(--muted); font-size: .78rem; text-align: center; }
.document-viewer-fallback a { color: var(--primary-dark); font-weight: 700; }
.document-history { margin-top: 1.25rem; padding: clamp(1.1rem, 4vw, 1.5rem); border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.document-history__head h2 { margin: 0; font: 600 1.55rem/1.25 var(--head); }
.document-history__head p { margin: .35rem 0 1rem; color: var(--soft); font-size: .84rem; }
.document-version-list { display: grid; gap: .8rem; }
.document-version-card { padding: 1rem; border: 1px solid var(--border); border-radius: 14px; background: #fdfcf9; }
.document-version-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.document-version-card h3 { margin: 0; font: 600 1.08rem/1.3 var(--head); }
.document-version-card time { color: var(--muted); font-size: .76rem; }
.document-version-card ul { margin: .75rem 0 0; padding-left: 1.2rem; color: var(--soft); font-size: .82rem; }
.document-version-card__links { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: .8rem; }
.document-version-card__links a { color: var(--primary-dark); font-size: .78rem; font-weight: 800; }
.document-version-card details { margin-top: .65rem; color: var(--muted); font-size: .72rem; }
.document-version-card code { overflow-wrap: anywhere; }
@media (max-width: 680px) {
  .document-main, .document-brand { width: min(100% - 1rem, 1180px); }
  .document-current__head { align-items: flex-start; flex-direction: column; }
  .document-actions { width: 100%; justify-content: stretch; }
  .document-button { flex: 1; }
  .document-viewer-wrap { padding: .5rem; }
  .document-viewer { max-height: 68vh; padding: .35rem; gap: .4rem; }
  .document-version-card__top { flex-direction: column; gap: .25rem; }
}
