:root {
  --navy: #12305a; --teal: #1f8a96; --bg: #ffffff; --soft: #f4f7fa; --text: #14202e; --muted: #5b6675; --line: #dde3ea;
  --card: #ffffff; --accent: #1f8a96; --warn: #b45309; --code: #eef2f6;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14181e; --soft: #1b2028; --text: #e6e9ee; --muted: #9aa4b2; --line: #2c333d; --card: #1b2028; --accent: #4fc3cf; --code: #232a33; --warn: #f5b94f; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.55 "Segoe UI", system-ui, -apple-system, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.top { background: linear-gradient(120deg, var(--navy), var(--teal)); color: #fff; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.18); font-weight: 800; }
.switch { color: #fff; border: 1px solid rgba(255,255,255,.5); border-radius: 999px; padding: 4px 14px; text-decoration: none; font-size: 14px; }
main.wrap { padding-top: 22px; padding-bottom: 50px; min-height: 70vh; }
.hero h1 { font-size: 34px; margin: 10px 0 6px; } .hero p { color: var(--muted); font-size: 18px; margin: 0 0 22px; max-width: 760px; }
.hero.small h1 { font-size: 28px; } .hero.small p { font-size: 16px; }
.label { font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 30px 0 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { display: block; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h2 { margin: 0 0 6px; font-size: 20px; color: var(--accent); } .card p { margin: 0; color: var(--muted); }
.crumbs { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.ask { background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.ask h2 { margin: 0 0 12px; font-size: 20px; }
.askform { display: flex; gap: 10px; align-items: flex-end; }
textarea, input[type=text], input[type=email], input[type=password], input:not([type]) { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
button { font: inherit; font-weight: 600; color: #fff; background: var(--teal); border: 0; border-radius: 10px; padding: 10px 18px; cursor: pointer; white-space: nowrap; }
button:hover { filter: brightness(1.08); } button:disabled { opacity: .6; cursor: default; }
button.small { padding: 4px 10px; font-size: 13px; font-weight: 500; background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.link { background: transparent; color: var(--accent); padding: 4px 0; font-weight: 500; }
.fine { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.thread .q { margin: 14px 0 6px; font-weight: 600; }
.thread .a { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.thread .a p { margin: 0 0 10px; } .thread .a p:last-child { margin-bottom: 0; } .thread .a ol, .thread .a ul { margin: 0 0 10px; padding-left: 22px; }
.thread .a.error { border-color: var(--warn); color: var(--warn); }
.thread .loading { color: var(--muted); font-style: italic; }
a.cite { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; margin-left: 3px; border-radius: 9px; font-size: 11px; font-weight: 700; text-decoration: none; background: var(--accent); color: #fff; vertical-align: 2px; }
.sources { margin: 10px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--line); font-size: 14px; }
.sources b { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.sources li { margin: 4px 0; } .sources q { color: var(--muted); }
.feedback { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.ticket { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; max-width: 560px; }
.ticket h3 { margin: 0; } .ticket label { display: grid; gap: 4px; font-size: 14px; }
.ticket-msg { margin: 0; font-weight: 600; color: var(--accent); }
.docbox { border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 14px; background: var(--card); }
.docbox h3 { margin: 0 0 8px; } .sections { columns: 2; column-gap: 28px; margin: 0; padding-left: 18px; font-size: 15px; } .sections li { margin: 2px 0; break-inside: avoid; }
.doc { display: grid; grid-template-columns: 250px 1fr; gap: 30px; align-items: start; }
.toc { position: sticky; top: 14px; max-height: calc(100vh - 28px); overflow: auto; font-size: 14px; border-right: 1px solid var(--line); padding-right: 14px; }
.toc h2 { font-size: 13px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; } .toc ol { padding-left: 18px; } .toc li { margin: 4px 0; }
.md h1 { font-size: 30px; margin-top: 0; } .md h2 { margin-top: 34px; padding-bottom: 4px; border-bottom: 2px solid var(--line); scroll-margin-top: 12px; }
.md h3 { margin-top: 24px; scroll-margin-top: 12px; } .md h2:target, .md h3:target { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 6px; }
.md .anchor { opacity: 0; text-decoration: none; font-size: .8em; } .md h2:hover .anchor, .md h3:hover .anchor { opacity: .6; }
.md figure { margin: 14px 0 20px; } .md figure img { max-width: 100%; border: 1px solid var(--line); border-radius: 8px; } .md figcaption { color: var(--muted); font-size: 14px; margin-top: 4px; }
code { background: var(--code); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.note { border-left: 4px solid var(--accent); background: var(--soft); padding: 8px 12px; border-radius: 0 8px 8px 0; margin: 10px 0; }
.table { overflow-x: auto; } table { border-collapse: collapse; width: 100%; margin: 10px 0 18px; font-size: 15px; }
th, td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; } th { background: var(--soft); }
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; padding: 18px 0; }
.panel { border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: 12px 0; background: var(--card); display: block; }
.panel label, .grid label { display: grid; gap: 4px; margin-bottom: 10px; font-size: 14px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; } .stats div { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--card); }
.stats b { display: block; font-size: 24px; } .stats span { color: var(--muted); font-size: 13px; }
.files { margin: 4px 0; padding-left: 18px; } form.inline { display: inline; } .upload { margin: 6px 0 12px; }
.flash { background: var(--soft); border-left: 4px solid var(--accent); padding: 8px 12px; } .error { color: var(--warn); }
tr.done { opacity: .55; } details pre { white-space: pre-wrap; font-size: 13px; }
@media (max-width: 760px) {
  .doc { grid-template-columns: 1fr; } .toc { position: static; max-height: none; border-right: 0; padding-right: 0; }
  .sections { columns: 1; } .askform { flex-direction: column; align-items: stretch; } .stats, .grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 26px; }
}
