.install-nav-btn {
  position: fixed; top: 3.4rem; right: 1.2rem; z-index: 999;
  font-size: .8rem; padding: .4rem .9rem; border-radius: 999px; border: 2px solid var(--accent);
  background: var(--accent); color: var(--bg); cursor: pointer; font-family: inherit; display: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.install-nav-btn:hover { opacity: .9; }
.admin-nav-link {
  position: fixed; top: 5.7rem; right: 1.2rem; z-index: 999;
  font-size: .8rem; padding: .4rem .9rem; border-radius: 999px; border: 2px solid var(--border);
  background: var(--card); color: var(--fg); text-decoration: none; display: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.admin-nav-link:hover { border-color: var(--accent); }
@media (max-width: 800px) {
  .install-nav-btn { top: 2.6rem; right: .7rem; font-size: .72rem; padding: .3rem .7rem; }
  .admin-nav-link { top: 4.6rem; right: .7rem; font-size: .72rem; padding: .3rem .7rem; }
}
:root {
  color-scheme: light dark;
  --bg: #fafaf8; --fg: #1d1d1f; --muted: #666; --card: #fff;
  --border: #ddd; --accent: #6b4f3b; --accent-soft: #f1e9e2;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1a1816; --fg: #eee; --muted: #aaa; --card: #262320; --border: #3a3632; --accent: #d8b98f; --accent-soft: #33291f; }
}
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0; padding: 1.2rem 1rem 4rem; background: var(--bg); color: var(--fg);
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}
.wrap { max-width: 1000px; margin: 0 auto; }

.site-nav { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.nav-toggle, .nav-home-mobile { display: none; }
.mobile-nav-bar { display: none; }
@media (max-width: 800px) {
  .mobile-nav-bar { display: flex; gap: .5rem; margin-bottom: .8rem; }
  .nav-toggle, .nav-home-mobile {
    display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 600;
    padding: .5rem 1rem; border-radius: 999px; border: 2px solid var(--border);
    background: var(--card); color: var(--fg); cursor: pointer; text-decoration: none; margin: 0;
  }
  .site-nav { display: none; }
  .site-nav.nav-open { display: flex; }
}
.site-nav a {
  font-size: .82rem; padding: .4rem .9rem; border-radius: 999px; border: 2px solid var(--border);
  background: var(--card); color: var(--fg); text-decoration: none;
}
.site-nav a.current { background: var(--accent); color: var(--bg); border-color: var(--accent); }

.breadcrumb { font-size: .82rem; margin: 0 0 .6rem; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

h1 { font-size: 1.7rem; margin: 0 0 .3rem; }
.subtitle { color: var(--muted); margin: 0 0 1.2rem; font-size: .92rem; line-height: 1.4; }

.submit-protocol {
  background: var(--accent-soft); border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem 1.2rem; margin: 0 0 1.8rem; display: flex; align-items: center;
  gap: 1rem; flex-wrap: wrap;
}
.submit-protocol p { margin: 0; font-size: .88rem; color: var(--fg); flex: 1; min-width: 200px; }
.submit-protocol .wa-submit-link {
  display: inline-flex; align-items: center; gap: .5rem; background: #25d366; color: #fff;
  padding: .5rem 1rem; border-radius: 999px; text-decoration: none; font-size: .85rem;
  font-weight: 600; white-space: nowrap;
}
.submit-protocol .wa-submit-link:hover { background: #1ebe5b; }
.submit-protocol .wa-submit-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.disclaimer {
  background: var(--card); border: 1px dashed var(--border); border-radius: 8px;
  padding: .8rem 1rem; margin: 0 0 1.6rem; font-size: .84rem; line-height: 1.55; color: var(--muted);
}

details.qcat {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: .9rem; padding: 0; scroll-margin-top: 1rem; overflow: hidden;
}
details.qcat > summary {
  font-size: 1.02rem; font-weight: 700; color: var(--accent); cursor: pointer;
  padding: .9rem 1.2rem; list-style: none; display: flex; justify-content: space-between; align-items: center;
}
details.qcat > summary::-webkit-details-marker { display: none; }
details.qcat > summary::after { content: "+"; font-size: 1.2rem; color: var(--muted); }
details.qcat[open] > summary::after { content: "\2212"; }
.qcat-body { padding: 0 1.2rem 1.1rem; }
.qcat-intro { color: var(--muted); font-size: .86rem; line-height: 1.5; margin: 0 0 .9rem; }

.subhead { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 1.2rem 0 .5rem; }
.subhead:first-child { margin-top: 0; }

.ref-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin: .4rem 0 1rem; }
.ref-table th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--accent); font-weight: 700; padding: .5rem .6rem; border-bottom: 2px solid var(--border);
}
.ref-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.ref-table td:first-child { font-weight: 600; white-space: nowrap; }
.table-scroll { max-width: 100%; overflow-x: auto; }

.pcard {
  border: 1px solid var(--border); border-radius: 8px; padding: .9rem 1.1rem;
  margin-bottom: .9rem; background: var(--bg);
}
.pcard h4 {
  margin: 0 0 .5rem; color: var(--accent); font-size: .98rem;
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .4rem;
}
.pattern-link { font-size: .78rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.pattern-link:hover { color: var(--accent); text-decoration: underline; }
.pattern-title-link { color: inherit; text-decoration: none; }
.pattern-title-link:hover { text-decoration: underline; }
.pcard .pfield { font-size: .87rem; line-height: 1.55; margin: .35rem 0; }
.pcard .pfield b { color: var(--fg); }

.point-chips {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; padding-top: .6rem;
  border-top: 1px dashed var(--border);
}
.point-chips-group { margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed var(--border); }
.point-chips-group .point-chips { margin-top: .3rem; padding-top: 0; border-top: none; }
.point-chips-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.chip {
  font-size: .85rem; font-weight: 600; padding: .15rem .5rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg); display: inline-flex; align-items: center;
  gap: .15rem; text-decoration: none;
}
.chip.up { border-color: #3a8f5c; color: #3a8f5c; }
.chip.down { border-color: #b4552e; color: #b4552e; }
.chip.even { border-color: #4a6fa5; color: #4a6fa5; }
.chip.nolink { cursor: default; opacity: .85; }
.chip .arrow { font-weight: 700; }

.related-list { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.6rem; }
.related-list a {
  font-size: .85rem; padding: .4rem .9rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--fg); text-decoration: none;
}
.related-list a:hover { border-color: var(--accent); color: var(--accent); }

.footer-note { color: var(--muted); font-size: .8rem; text-align: center; margin-top: 3rem; }

.wa-fab {
  position: fixed; bottom: 1.2rem; right: 1.2rem; width: 52px; height: 52px;
  background: #25d366; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.3); z-index: 999;
  text-decoration: none;
}
.wa-fab:hover { background: #1ebe5b; }
.logout-corner {
  position: fixed; top: 1rem; right: 1.2rem; z-index: 999;
  font-size: .8rem; padding: .4rem .9rem; border-radius: 999px; border: 1px solid #b4552e;
  background: var(--card); color: #b4552e; text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.logout-corner:hover { background: #b4552e; color: #fff; }
@media (max-width: 800px) { .logout-corner { top: .7rem; right: .7rem; font-size: .72rem; padding: .3rem .7rem; } }
@media (max-width: 800px) {
  .wa-fab { width: 46px; height: 46px; bottom: .9rem; right: .9rem; }
}
