/* med-note.com shared styles */
:root {
  --brown: #3D2008; --brown-hover: #5A3415; --brown-active: #6B3F1A;
  --cream: #FBF3E4; --card: #FFFBF4; --line: #EAD9BC;
  --ink: #2B1705; --muted: #5F4832; --link: #8A3D0F;
  --teal: #1F7A72; --purple: #6B4BA3; --coral: #D9583F;
  --sb-w: 210px; --sb-rail: 52px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Nunito Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--sans); }
a { color: var(--link); }
a:hover { color: #5E2A0A; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid #E8A33D; outline-offset: 2px; }

/* ---------- Sidebar ---------- */
.sb {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 20;
  width: var(--sb-w); overflow-x: hidden; overflow-y: auto;
  background: var(--brown); padding: 14px 10px;
  display: flex; flex-direction: column; gap: 16px;
  transition: width .2s ease, transform .2s ease;
}
.sb-head { display: flex; align-items: center; justify-content: space-between; }
.sb-logo { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--cream); font-family: var(--serif); font-size: 18px; font-weight: 600; }
.sb-logo:hover { color: #fff; }
.sb-logo-tile { flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--cream); display: flex; align-items: center; justify-content: center; }
.ib { flex: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: 8px; color: #F6E9D3; font-size: 22px; line-height: 1; cursor: pointer; }
.ib:hover { background: var(--brown-hover); }
.sb-nav { display: flex; flex-direction: column; gap: 10px; }
.nv-group { display: flex; flex-direction: column; }
.nv { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 8px; color: #F6E9D3; text-decoration: none; font-size: 14px; font-weight: 700; white-space: nowrap; }
.nv:hover { background: var(--brown-hover); color: #fff; }
.nv.on { background: var(--brown-active); color: #fff; }
.nv.sub { min-height: 40px; padding-left: 36px; font-weight: 400; color: #E3CFAF; }
.nv.sub.here { color: #fff; font-weight: 700; }
.nv-icon { flex: none; }
.dot { flex: none; width: 10px; height: 10px; margin: 0 3px; border-radius: 50%; }
.nv-clinical .dot { background: #4FC1B5; }
.nv-study .dot    { background: #B79CE8; }
.nv-graphics .dot { background: #F28B74; }
.sb-expand, .sb-close { display: none; }
.sb-backdrop { display: none; }
.topbar { display: none; }

.page { margin-left: var(--sb-w); padding: 48px 48px 56px; transition: margin-left .2s ease; }

/* Collapsed icon rail (desktop only) */
@media (min-width: 760px) {
  .sb-collapsed .sb { width: var(--sb-rail); cursor: pointer; }
  .sb-collapsed .sb:hover { background: #4A2A0E; }
  .sb-collapsed .page { margin-left: var(--sb-rail); }
  .sb-collapsed .sb-word, .sb-collapsed .nv-t, .sb-collapsed .nv.sub, .sb-collapsed .sb-collapse { display: none; }
  .sb-collapsed .nv { justify-content: center; padding: 0; width: 32px; }
  .sb-collapsed .nv .dot { width: 12px; height: 12px; margin: 0; }
  .sb-collapsed .sb-expand { display: flex; width: 32px; }
}

/* Mobile: top bar + drawer */
@media (max-width: 759px) {
  .topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; padding: 6px 8px 6px 14px; background: var(--brown); }
  .sb { width: 264px; transform: translateX(-100%); }
  .sb-open .sb { transform: none; }
  .sb-open .sb-backdrop { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(43, 23, 5, .55); }
  .sb-collapse { display: none; }
  .sb-close { display: flex; }
  .page { margin-left: 0; padding: 28px 18px 40px; }
}

/* ---------- Page content ---------- */
.wrap { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 40px; }
h1, h2 { font-family: var(--serif); font-weight: 600; margin: 0; }
.intro { display: flex; flex-direction: column; gap: 12px; }
.eyebrow { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--link); }
.intro h1 { font-size: clamp(32px, 4.4vw, 52px); line-height: 1.08; max-width: 780px; }
.lede { margin: 0; font-size: 18px; line-height: 1.5; color: var(--muted); max-width: 640px; }

/* Hero cards */
.heroes { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 20px; }
.hero { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.hero:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(61, 32, 8, .14); }
.hero--clinical { --tint: #DDF0EC; --accent: #17635C; --title: #0E4640; }
.hero--study    { --tint: #E9E1F5; --accent: #5B3F93; --title: #3F2A6B; }
.hero--graphics { --tint: #FBE0D8; --accent: #A63A22; --title: #7A2613; }
.hero-top { background: var(--tint); color: var(--accent); padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 12px; }
.hero-top h2 { font-size: 27px; line-height: 1.1; color: var(--title); }
.badge { align-self: flex-start; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--card); border-radius: 99px; padding: 4px 10px; }
.hero-body { flex: 1; padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; }
.hero-body p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.links { display: flex; flex-direction: column; margin: 4px -12px 0; }
.hero-cta { margin-top: auto; padding-top: 8px; font-weight: 700; color: var(--accent); }
.ql { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 15px; }
.ql:hover { background: #F6E7CB; color: var(--ink); }

/* Quick access */
.quick { display: flex; flex-direction: column; gap: 18px; }
.quick-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.quick-head h2 { font-size: 30px; }
.quick-head p, .quick-empty { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.filter { flex: 0 1 300px; display: flex; flex-direction: column; gap: 4px; }
.filter label { font-size: 13px; font-weight: 700; color: var(--muted); }
.filter input { height: 46px; padding: 0 14px; border: 1.5px solid #C9B28C; border-radius: 10px; background: var(--card); font: inherit; font-size: 15px; color: var(--ink); }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; align-items: start; }
.qgroup { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 8px 8px; }
.qgroup h3 { margin: 0 12px 6px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.qgroup h3 .dot { margin: 0; }
.qgroup--clinical .dot { background: var(--teal); }
.qgroup--study .dot    { background: var(--purple); }
.qgroup--graphics .dot { background: var(--coral); }
[hidden] { display: none !important; }

.foot { border-top: 1px solid var(--line); padding-top: 18px; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* ---------- Section pages ---------- */
.page.sub-page { padding: 0; }
.ph--clinical { --ph-bg: #17635C; --ph-dark: #0F4D47; --ph-ink: #0E4640; --ph-tint: #DDF0EC; }
.ph--study    { --ph-bg: #5B3F93; --ph-dark: #47307A; --ph-ink: #3F2A6B; --ph-tint: #E9E1F5; }
.ph--graphics { --ph-bg: #A63A22; --ph-dark: #862D19; --ph-ink: #7A2613; --ph-tint: #FBE0D8; }
.ph--army     { --ph-bg: #7A5410; --ph-dark: #5F410B; --ph-ink: #4F3608; --ph-tint: #F6E7C6; }
.ph { background: var(--ph-bg, #17635C); color: #fff; padding: 36px 48px 30px; }
.ph-inner, .secnav-inner { max-width: 1180px; margin: 0 auto; }
.ph-title { display: flex; align-items: center; gap: 18px; }
.ph-icon { flex: none; width: 68px; height: 68px; border-radius: 18px; background: var(--ph-tint); color: var(--ph-bg); display: flex; align-items: center; justify-content: center; }
.ph h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.05; color: #fff; }
.ph-lede { margin: 6px 0 0; max-width: 640px; font-size: 17px; line-height: 1.45; color: rgba(255,255,255,.92); }

/* Horizontal section menu with drop-downs */
.secnav { position: sticky; top: 0; z-index: 8; background: var(--ph-dark, #0F4D47); padding: 0 48px; }
.secnav-inner { display: flex; flex-wrap: wrap; gap: 4px; }
.sn-item { position: relative; }
.sn-btn { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 18px; border: 0; border-bottom: 3px solid transparent; background: none; color: #fff; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.sn-btn:hover, .sn-item.open .sn-btn { background: rgba(255,255,255,.12); }
.sn-item.on .sn-btn { border-bottom-color: var(--ph-tint); }
.sn-btn svg { transition: transform .15s; }
.sn-item.open .sn-btn svg { transform: rotate(180deg); }
.sn-btn:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
.dd { display: none; position: absolute; top: 100%; left: 0; z-index: 9; min-width: 260px; max-height: calc(100vh - 140px); overflow-y: auto; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 0 0 14px 14px; box-shadow: 0 14px 30px rgba(43,23,5,.2); }
.sn-item.open .dd { display: block; }
.dd--c2 { width: 520px; }
.dd--c3 { width: 720px; }
.dd-list { display: grid; grid-template-columns: 1fr; gap: 0 8px; }
.dd--c2 .dd-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dd--c3 .dd-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dd a { display: flex; align-items: center; min-height: 38px; padding: 4px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 14px; line-height: 1.3; }
.dd a:hover { background: var(--ph-tint, #DDF0EC); color: var(--ph-ink); }
.dd a.dd-all { margin-bottom: 6px; font-weight: 700; color: var(--ph-ink); background: var(--ph-tint, #DDF0EC); }
.dd-h { margin: 12px 10px 4px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }

.sub-body { max-width: 1180px; margin: 0 auto; padding: 32px 48px 24px; }
.sub-intro { margin-bottom: 22px; }
.sub-intro h2 { font-size: 30px; }
.sub-intro p { margin: 6px 0 0; font-size: 16px; line-height: 1.5; color: var(--muted); max-width: 720px; }
.key { font-family: ui-monospace, Menlo, monospace; font-weight: 700; background: #F1E3C8; border-radius: 4px; padding: 0 4px; }

/* Notes */
.notes { display: flex; flex-direction: column; gap: 20px; }
.note { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; scroll-margin-top: 70px; }
.note-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 14px 22px; background: #EEF7F5; border-bottom: 1px solid #CFE6E1; }
.note-head h2 { font-size: 22px; line-height: 1.2; color: #0E4640; }
.copy { flex: none; min-height: 44px; min-width: 84px; padding: 0 16px; border: 1.5px solid var(--teal); border-radius: 10px; background: var(--card); color: #0E4640; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.copy:hover { background: #DDF0EC; }
.copy.done { background: var(--teal); color: #fff; }
.note-body { padding: 18px 22px 20px; font-size: 15px; line-height: 1.6; }
.note-body > :first-child { margin-top: 0; }
.note-body p { margin: 0 0 12px; }
.note-body h3 { margin: 18px 0 8px; font-family: var(--sans); font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--teal); }
.note-body h4 { margin: 14px 0 8px; font-size: 15px; }
.note-body ul { margin: 0 0 12px; padding-left: 22px; }
.note-body li { margin-bottom: 6px; }
.lines div { padding: 3px 0; border-bottom: 1px dashed #EFE3CC; }
.lines div:last-child { border-bottom: 0; }
.positive { color: #8F2F1A; font-weight: 600; }
.icd { list-style: none; padding: 0 !important; display: flex; flex-direction: column; gap: 6px; }
.icd .code { display: inline-block; min-width: 64px; font-family: ui-monospace, Menlo, monospace; font-weight: 700; background: #DDF0EC; color: #0E4640; border-radius: 6px; padding: 1px 8px; margin-right: 6px; }
.rx-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 14px; }
.rx { border: 1px solid #CFE6E1; border-radius: 12px; padding: 12px 14px; background: #F7FBFA; }
.rx h5 { margin: 0 0 8px; font-size: 15px; color: #0E4640; }
.rx dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.rx dt { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.rx dd { margin: 0; }
.note-out { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; padding: 12px 22px; background: var(--card); border: 1.5px dashed #9FCFC7; border-radius: 16px; color: var(--ink); text-decoration: none; font-size: 15px; }
.note-out:hover { background: #EEF7F5; color: var(--ink); }
.note-out span:last-child { font-size: 14px; font-weight: 700; color: var(--teal); }
.to-top { align-self: flex-end; font-weight: 700; font-size: 14px; }
.sub-foot { max-width: 1180px; margin: 8px auto 0; padding: 18px 48px 40px; border-top: 0; }

@media (max-width: 959px) {
  .dd--c3 { width: 520px; }
  .dd--c3 .dd-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 759px) {
  .ph { padding: 22px 18px 20px; }
  .ph-icon { width: 54px; height: 54px; border-radius: 14px; }
  .ph-icon svg { width: 32px; height: 32px; }
  .secnav { top: 56px; padding: 0 6px; }
  .secnav-inner { flex-wrap: nowrap; overflow-x: auto; }
  .sn-item { position: static; }
  .sn-btn { padding: 0 12px; font-size: 14px; white-space: nowrap; }
  .dd, .dd--c2, .dd--c3 { position: absolute; left: 8px; right: 8px; width: auto; min-width: 0; max-height: 65vh; border-radius: 0 0 14px 14px; }
  .dd--c2 .dd-list, .dd--c3 .dd-list { grid-template-columns: 1fr; }
  .secnav { position: sticky; }
  .secnav-inner { position: relative; }
  .sub-body { padding: 20px 14px 16px; }
  .sub-foot { padding: 14px 18px 32px; }
  .note { scroll-margin-top: 120px; }
  .note-head { padding: 10px 10px 10px 16px; }
  .note-head h2 { font-size: 19px; }
  .note-body { padding: 14px 16px 16px; }
}

/* Section landing: hero cards inside a section page */
.sub-body > .heroes { margin-top: 4px; }

/* Prescriptions */
.jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; }
.jump a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 99px; background: var(--card); border: 1px solid #CFE6E1; color: #0E4640; text-decoration: none; font-size: 13px; font-weight: 600; }
.jump a:hover { background: #DDF0EC; color: #0E4640; }
.todo { margin: 0 0 22px; padding: 14px 18px; background: #FFF6E3; border: 1.5px dashed #E1B866; border-radius: 14px; }
.todo h3 { margin: 0 0 6px; font-size: 13px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #7A5410; }
.todo ul { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.55; color: #5C4011; }
.todo-inline { display: inline-block; padding: 4px 10px; background: #FFF6E3; border: 1px dashed #E1B866; border-radius: 8px; font-size: 14px; color: #5C4011; }
.draft { margin: 0 0 14px; padding: 12px 16px; background: #FBF6EC; border-left: 0; border: 1px dashed #D8C49E; border-radius: 12px; font-size: 14px; }
.draft-label { font-size: 12px !important; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #7A5410; }
.see { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 14px; color: var(--muted); }
.see a { font-weight: 700; color: var(--teal); }
.hint { font-size: 14px; color: var(--muted); font-style: italic; }
.ref { margin-top: 14px; padding: 14px 18px; background: #F7FBFA; border: 1px solid #CFE6E1; border-radius: 12px; }
.ref > :first-child { margin-top: 0; }
.tag { margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: #DDF0EC; color: #0E4640; font-size: 11px; letter-spacing: .04em; vertical-align: 2px; }
.icd li { font-size: 14px; }
.rx-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.rx-top h5 { margin: 6px 0 0; }
.copy-rx { min-width: 70px; min-height: 38px; padding: 0 12px; font-size: 13px; }
.rx--draft { background: #FBF6EC; border-style: dashed; border-color: #D8C49E; }

/* Note components hub */
.comp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.comp { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 70px; }
.comp-top { display: flex; align-items: flex-start; gap: 14px; }
.comp-icon { flex: none; width: 46px; height: 46px; border-radius: 12px; background: #DDF0EC; color: #17635C; display: flex; align-items: center; justify-content: center; }
.comp-top > div { flex: 1; min-width: 0; }
.comp h3 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1.2; }
.comp h3 a { color: #0E4640; text-decoration: none; }
.comp h3 a:hover { text-decoration: underline; }
.comp-top p { margin: 4px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.comp-count { flex: none; min-width: 34px; padding: 3px 9px; border-radius: 99px; background: #F1E3C8; color: #5C4011; font-size: 13px; font-weight: 700; text-align: center; }
.comp-list summary { display: flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 10px; background: #F7FBFA; border: 1px solid #CFE6E1; color: #0E4640; font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; }
.comp-list summary::-webkit-details-marker { display: none; }
.comp-list summary::after { content: "\25BE"; margin-left: auto; color: var(--teal); }
.comp-list[open] summary::after { content: "\25B4"; }
.comp-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 2px 8px; padding: 8px 0 0; }
.comp-links a { display: flex; align-items: center; min-height: 34px; padding: 3px 8px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 13px; line-height: 1.3; }
.comp-links a:hover { background: #DDF0EC; color: #0E4640; }
.comp-open { align-self: flex-start; font-weight: 700; font-size: 14px; color: var(--teal); }

/* Converted macro pages */
.back { display: inline-block; margin-bottom: 6px; font-size: 14px; font-weight: 700; color: var(--teal); text-decoration: none; }
.back:hover { text-decoration: underline; }
.page-note { margin: 0 0 20px; padding: 14px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; font-size: 15px; line-height: 1.55; }
.page-note > :first-child { margin-top: 0; }
.tools { display: flex; flex-direction: column; gap: 4px; max-width: 420px; margin: 0 0 14px; }
.tools label { font-size: 13px; font-weight: 700; color: var(--muted); }
.card-filter { height: 46px; padding: 0 14px; border: 1.5px solid #C9B28C; border-radius: 10px; background: var(--card); font: inherit; font-size: 15px; color: var(--ink); }
.jump-wrap { margin: 0 0 22px; }
.jump-wrap summary { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 10px; background: #F7FBFA; border: 1px solid #CFE6E1; color: #0E4640; font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; }
.jump-wrap summary::-webkit-details-marker { display: none; }
.jump-wrap summary::after { content: "\25BE"; color: var(--teal); }
.jump-wrap[open] summary::after { content: "\25B4"; }
.jump-wrap[open] summary { margin-bottom: 10px; }
.jump-wrap .jump { margin: 0; }
.filter-empty { font-size: 15px; color: var(--muted); }
.note-body table { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 14px; display: block; overflow-x: auto; }
.note-body th, .note-body td { border: 1px solid #E3D3B5; padding: 6px 10px; text-align: left; vertical-align: top; }
.note-body th { background: #F6ECD8; font-weight: 700; }
.note-body pre, .note-body code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; white-space: pre-wrap; }
.note-body pre { background: #FBF6EC; border: 1px solid #E3D3B5; border-radius: 10px; padding: 10px 12px; }
.orange { background: #FFE2B8; color: #5C3300; padding: 0 3px; border-radius: 3px; }
.note-body h5 { margin: 12px 0 6px; font-size: 14px; }

/* ---------- Study Notes ---------- */
.ph-warn { display: inline-block; margin: 10px 0 0; padding: 4px 12px; border-radius: 99px; background: #F6E7C6; color: #4F3608; font-size: 13px; font-weight: 700; }
.theme-study .jump a { border-color: #DCD0EF; color: #3F2A6B; }
.theme-study .jump a:hover { background: #E9E1F5; color: #3F2A6B; }
.theme-study .to-top, .theme-study .back { color: #5B3F93; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.sys { background: var(--card); border: 1px solid var(--line); border-top: 4px solid #8A6CC4; border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 70px; }
.sys:target { box-shadow: 0 0 0 3px #CDBDEB; }
.sys h3 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 21px; line-height: 1.2; }
.sys h3 a { color: #3F2A6B; text-decoration: none; }
.sys h3 a:hover { text-decoration: underline; }
.sys-blurb { margin: 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.sys-rel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sys-rel li { display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 1.3; }
.sys-rel a { color: var(--ink); }
.rel-tag { flex: none; min-width: 42px; text-align: center; padding: 2px 6px; border-radius: 6px; background: #FBE0D8; color: #7A2613; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.rel-tag--page { background: #E9E1F5; color: #3F2A6B; }
.rel-tag--vid { background: #DDF0EC; color: #0E4640; }
.sys-open { margin-top: auto; font-weight: 700; font-size: 14px; color: #5B3F93; }

.vid-topic { margin: 0 0 30px; scroll-margin-top: 70px; }
.vid-h { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-family: var(--serif); font-weight: 600; font-size: 24px; color: #3F2A6B; }
.vid-h span { font-family: var(--sans); font-size: 13px; padding: 2px 9px; border-radius: 99px; background: #E9E1F5; color: #3F2A6B; }
.vid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.vid { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s; }
.vid:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(61,32,8,.14); color: var(--ink); }
.vid-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #2B1705; overflow: hidden; }
.vid-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vid-play { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(43,23,5,.72); color: #fff; display: flex; align-items: center; justify-content: center; padding-left: 3px; transition: background .15s; }
.vid:hover .vid-play { background: #5B3F93; }
.vid-host { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border-radius: 6px; background: rgba(43,23,5,.78); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.vid-text { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; }
.vid-title { font-weight: 700; font-size: 15px; line-height: 1.35; }
.vid-meta { font-size: 13px; color: var(--muted); }
.vid-from { font-size: 12px; color: #5B3F93; font-style: italic; }
.theme-study .todo code { font-size: 13px; }

/* Study Notes pages */
.theme-study .note-head { background: #F3EEFA; border-bottom-color: #E2D8F2; }
.theme-study .note-head h2 { color: #3F2A6B; }
.theme-study .note-body h3 { color: #5B3F93; }
.theme-study .note-body h4 { color: #3F2A6B; }
.theme-study .note-body a { color: #5B3F93; }
.theme-study .note-body img { max-width: 100%; height: auto; border-radius: 10px; }
.weight { display: inline-block; margin: 8px 0 0 !important; padding: 3px 12px; border-radius: 99px; background: #E9E1F5; color: #3F2A6B !important; font-size: 13px !important; }
.plain { white-space: pre-wrap; font-size: 15px; line-height: 1.6; margin: 0 0 12px; tab-size: 4; }
.vid--inline { display: inline-flex; flex-direction: row; width: 100%; max-width: 520px; margin: 6px 0 14px; vertical-align: top; }
.vid--inline .vid-thumb { flex: 0 0 180px; aspect-ratio: 16 / 9; }
.vid--inline .vid-play { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
.vid--inline .vid-text { justify-content: center; }
.theme-study .note-body a.vid { color: var(--ink); text-decoration: none; }
@media (max-width: 520px) { .vid--inline { flex-direction: column; } .vid--inline .vid-thumb { flex: none; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 12px; background: #FBF7FE; border: 1px solid #E2D8F2; border-radius: 12px; }
.tile img { width: 100%; border-radius: 8px; }
.tile h3 { margin: 0 !important; font-family: var(--sans); font-size: 15px !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--ink) !important; }
.tile p { margin: 0 !important; font-size: 13px; line-height: 1.45; color: var(--muted); }
.tile-buy { margin-top: auto; font-size: 13px; font-weight: 700; }

/* ---------- Graphics & Cheatsheets (/visual-aids/) ---------- */
.theme-graphics .to-top, .theme-graphics .back { color: #A63A22; }
.heroes--two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); max-width: 900px; }
.hero-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 6px; }
.hero-thumbs a { display: block; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.hero-thumbs img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; transition: transform .2s; }
.hero-thumbs a:hover img { transform: scale(1.05); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; align-items: start; }
.gal { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; scroll-margin-top: 70px; }
.gal:target { box-shadow: 0 0 0 3px #F2B5A6; }
.gal-img { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; padding: 12px; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: zoom-in; }
.gal-img img { width: 100%; height: 100%; object-fit: contain; display: block; transition: transform .2s; }
.gal-img:hover img { transform: scale(1.03); }
.gal-zoom { position: absolute; right: 10px; bottom: 10px; width: 36px; height: 36px; border-radius: 50%; background: rgba(43,23,5,.75); color: #fff; display: flex; align-items: center; justify-content: center; opacity: .85; }
.gal-img:hover .gal-zoom, .gal-img:focus-visible .gal-zoom { background: #A63A22; opacity: 1; }
.gal-status { position: absolute; left: 10px; top: 10px; padding: 2px 10px; border-radius: 99px; background: #F6E7C6; color: #5C4011; font-size: 12px; font-weight: 700; }
.gal-text { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.gal-topic { align-self: flex-start; padding: 2px 9px; border-radius: 99px; background: #FBE0D8; color: #7A2613; font-size: 12px; font-weight: 700; }
.gal h3 { margin: 2px 0 0; font-family: var(--serif); font-weight: 600; font-size: 20px; line-height: 1.2; color: #7A2613; }
.gal-text p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.gal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 6px; }
.gal-pdf { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 10px; background: #A63A22; color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; }
.gal-pdf:hover { background: #862D19; color: #fff; }
.gal-meta { font-size: 13px; color: var(--muted); }
.gal-rel { font-size: 13px; font-weight: 700; color: #A63A22; }
.theme-graphics .todo { margin-top: 26px; }

.lightbox { width: min(1100px, 94vw); max-height: 92vh; padding: 0; border: 0; border-radius: 16px; background: var(--card); box-shadow: 0 24px 60px rgba(0,0,0,.4); overflow: hidden; }
.lightbox::backdrop { background: rgba(43,23,5,.7); }
.lightbox[open] { display: flex; flex-direction: column; }
.lb-bar { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); }
.lb-title { flex: 1; margin: 0; font-weight: 700; font-size: 15px; }
.lb-open { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 10px; background: #A63A22; color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; }
.lb-open:hover { background: #862D19; color: #fff; }
.lb-close { width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; font-size: 28px; line-height: 1; color: var(--ink); cursor: pointer; }
.lb-close:hover { background: #F6E7CB; }
.lightbox img { display: block; max-width: 100%; max-height: calc(92vh - 70px); margin: 0 auto; object-fit: contain; background: #fff; }

/* Fixes after visual check */
.nv { white-space: normal; line-height: 1.25; padding-top: 6px; padding-bottom: 6px; }
.gal-img { overflow: hidden; height: auto; }
.gal-img img { position: absolute; top: 12px; left: 12px; width: calc(100% - 24px); height: calc(100% - 24px); }

/* ---------- Army Links ---------- */
.ph--army .ph-icon { color: #7A5410; }
.secnav .sn-link { display: flex; align-items: center; min-height: 52px; padding: 0 16px; color: #fff; font-size: 15px; font-weight: 700; text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; }
.secnav .sn-link:hover { background: rgba(255,255,255,.12); color: #fff; border-bottom-color: var(--ph-tint); }
.secnav .sn-link:focus-visible { outline: 3px solid #fff; outline-offset: -3px; }
@media (max-width: 759px) { .secnav .sn-link { padding: 0 12px; font-size: 14px; } }

.al-grid { columns: 2 460px; column-gap: 20px; }
.al-card { break-inside: avoid; display: inline-block; width: 100%; margin: 0 0 20px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; scroll-margin-top: 70px; }
.al-card:target { box-shadow: 0 0 0 3px #E8C77F; }
.al-card > h2 { margin: 0; padding: 16px 20px; background: #F6E7C6; border-bottom: 1px solid #EAD3A2; font-size: 22px; line-height: 1.2; color: #4F3608; }
.al-row { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 6px 16px; padding: 14px 20px; border-bottom: 1px solid #F1E6D2; scroll-margin-top: 70px; }
.al-row:last-child { border-bottom: 0; }
.al-row:nth-child(even) { background: #FFFDF8; }
.al-row:target { background: #FFF4DA; }
.al-label { font-weight: 700; font-size: 15px; line-height: 1.3; color: var(--ink); }
.al-form { display: block; margin-bottom: 2px; font-family: var(--serif); font-size: 26px; line-height: 1.05; color: #7A5410; }
.al-row--form .al-label { font-weight: 600; font-size: 14px; color: var(--muted); }
.al-body { font-size: 15px; line-height: 1.5; min-width: 0; }
.al-body p { margin: 0 0 8px; }
.al-body p:last-child { margin-bottom: 0; }
.al-body h3 { margin: 12px 0 6px; font-family: var(--sans); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #7A5410; }
.al-body h3:first-child { margin-top: 0; }
.al-body ul, .al-steps { margin: 4px 0 8px; padding-left: 22px; }
.al-body li { margin-bottom: 3px; }
.al-steps li::marker { color: #7A5410; font-weight: 700; }
.al-cols { columns: 2 150px; column-gap: 18px; }
.al-go { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin: 0 0 6px; padding: 0 14px; border-radius: 10px; background: #7A5410; color: #fff !important; font-weight: 700; font-size: 14px; text-decoration: none; }
.al-go::after { content: "\2197"; font-size: 13px; opacity: .85; }
.al-go:hover { background: #5F410B; }
.al-go--inline { min-height: 34px; margin: 0 2px; padding: 0 10px; vertical-align: middle; }
.al-tag { display: inline-block; padding: 1px 8px; border-radius: 99px; background: #F1E3C8; color: #5C4011; font-size: 12px; font-weight: 700; vertical-align: middle; }
.al-warn { padding: 8px 12px; border-radius: 10px; background: #FBE0D8; color: #7A2613; font-size: 14px; }
.al-old { font-size: 14px; color: var(--muted); }
.al-shot { display: block; margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.al-shot img { display: block; width: 100%; height: auto; }
.theme-army .to-top { color: #7A5410; }
@media (max-width: 600px) {
  .al-row { grid-template-columns: 1fr; }
  .al-form { display: inline; margin-right: 8px; }
}
.al-shot { display: inline-block; width: 88px; margin: 6px 0 8px; padding: 6px; border-radius: 14px; }
.al-body a { overflow-wrap: anywhere; }
@media (max-width: 759px) { .al-card, .al-row { scroll-margin-top: 120px; } }

/* Section pages with two or three cards, linked subject pills, videos in the coral section */
.heroes--two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); max-width: 900px; }
.heroes--three { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.gal-topics { display: flex; flex-wrap: wrap; gap: 6px; }
a.gal-topic { text-decoration: none; transition: background .15s, color .15s; }
a.gal-topic:hover, a.gal-topic:focus-visible { background: #A63A22; color: #fff; }
a.gal-topic::after { content: " \2192"; }
.theme-graphics .jump a { border-color: #F2C4B8; color: #7A2613; }
.theme-graphics .jump a:hover { background: #FBE0D8; color: #7A2613; }
.theme-graphics .vid-h { color: #7A2613; }
.theme-graphics .vid-h span { background: #FBE0D8; color: #7A2613; }
.theme-graphics .vid:hover .vid-play { background: #A63A22; }
.theme-graphics .vid-from { color: #A63A22; }
.al-sub { display: block; margin-top: 3px; font-weight: 400; font-size: 13px; line-height: 1.4; color: var(--muted); }
/* Army Links: lay cards out row by row (left to right), so card order reads naturally */
.al-grid { columns: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(460px, 100%), 1fr)); gap: 20px; align-items: start; }
.al-card { display: block; margin: 0; }

/* Army Links: one column in phone order; script splits into two tagged columns on wide screens */
.al-grid { display: flex; flex-direction: column; gap: 20px; columns: auto; }
.al-grid.is-split { flex-direction: row; align-items: flex-start; }
.al-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.al-card { margin: 0; }
.ph-lede a, .sub-foot a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 2px; }

/* Sidebar contact link */
.nv-contact { margin-top: auto; border-top: 1px solid rgba(246,233,211,.15); border-radius: 0 0 8px 8px; padding-top: 10px; }
.sb-collapsed .nv-contact { margin-left: auto; margin-right: auto; }

/* ---------- Contact ---------- */
.ph--contact { --ph-bg: #5A3415; --ph-dark: #3D2008; --ph-ink: #3D2008; --ph-tint: #F6E7CB; }
.ph--contact .ph-icon { color: #5A3415; }
.ct-wrap { max-width: 720px; }
.ct-warn { margin: 0 0 20px; padding: 12px 16px; border-radius: 12px; background: #FFF6E3; border: 1.5px dashed #E1B866; color: #5C4011; font-size: 15px; line-height: 1.5; }
.ct-errors { margin: 0 0 18px; padding: 12px 16px; border-radius: 12px; background: #FBE0D8; color: #7A2613; font-size: 15px; }
.ct-errors p { margin: 0 0 4px; font-weight: 700; }
.ct-errors ul { margin: 0; padding-left: 20px; }
.ct-form { display: flex; flex-direction: column; gap: 16px; padding: 22px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.ct-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.ct-field { display: flex; flex-direction: column; gap: 6px; }
.ct-field label { font-weight: 700; font-size: 14px; }
.ct-field label span { font-weight: 400; color: var(--muted); }
.ct-field input, .ct-field select, .ct-field textarea { width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid #C9B28C; border-radius: 10px; background: #fff; font: inherit; font-size: 16px; color: var(--ink); }
.ct-field textarea { min-height: 170px; resize: vertical; line-height: 1.5; }
.ct-field input:focus, .ct-field select:focus, .ct-field textarea:focus { outline: 3px solid #E8A33D; outline-offset: 1px; border-color: #8A3D0F; }
.ct-hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.ct-btn { align-self: flex-start; display: inline-flex; align-items: center; min-height: 48px; padding: 0 24px; border: 0; border-radius: 12px; background: #5A3415; color: #fff; font: inherit; font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer; }
.ct-btn:hover { background: #3D2008; color: #fff; }
.ct-note { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.ct-done { padding: 26px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.ct-done h2 { margin: 0 0 8px; font-size: 26px; }
.ct-done p { margin: 0 0 18px; color: var(--muted); font-size: 16px; }

/* ---------- Memory tools ---------- */
.mt-item { padding: 12px 0; border-bottom: 1px dashed #E2D8F2; }
.mt-item:first-child { padding-top: 0; }
.mt-item:last-child { border-bottom: 0; padding-bottom: 0; }
.theme-study .note-body h3.mt-term { margin: 0 0 6px; font-family: var(--serif); font-weight: 600; font-size: 18px; letter-spacing: 0; text-transform: none; color: #3F2A6B; }
.mt-term span { display: block; margin-top: 1px; font-family: var(--sans); font-weight: 600; font-size: 13px; color: var(--muted); }
.theme-study .note-body h3.mt-sub { margin: 22px 0 8px; }
.theme-study .note-body h3.mt-sub:first-child { margin-top: 0; }
.mt-pairs { margin: 0 0 6px; }
.mt-pairs > div { display: grid; grid-template-columns: minmax(140px, 38%) 1fr; gap: 4px 14px; padding: 7px 0; border-bottom: 1px solid #F1EBF8; }
.mt-pairs > div:last-child { border-bottom: 0; }
.mt-pairs dt { font-weight: 700; color: var(--ink); }
.mt-pairs dd { margin: 0; }
.mt-check { margin: 6px 0 0 !important; padding: 6px 10px; border-radius: 8px; background: #FFF6E3; border-left: 3px solid #E1B866; font-size: 13px; line-height: 1.45; color: #5C4011; }
.mt-check-key { display: inline-block; padding: 0 7px; border-radius: 6px; background: #FFF6E3; border: 1px solid #E1B866; color: #5C4011; font-size: 12px; font-weight: 700; }
.mt-aside { font-size: 13px; color: var(--muted); font-style: italic; }
.mt-table { overflow-x: auto; margin: 4px 0 10px; }
.mt-table table { width: 100%; border-collapse: collapse; font-size: 14px; display: table; }
.mt-table th, .mt-table td { border: 1px solid #E2D8F2; padding: 7px 10px; text-align: left; vertical-align: top; }
.mt-table th { background: #F3EEFA; color: #3F2A6B; }
.mt-todo { columns: 2 200px; }
@media (max-width: 600px) { .mt-pairs > div { grid-template-columns: 1fr; gap: 2px; } }

/* Big M, little m grid (study/systems/psych.php) */
.mood-grid-wrap { overflow-x: auto; }
.note-body table.mood-grid { display: table; width: auto; max-width: 100%; }
.note-body .mood-grid td, .note-body .mood-grid thead th { text-align: center; }
.note-body .mood-grid thead th:first-child { text-align: left; }
.note-body .mood-grid td.mood-span { background: #F3EEFA; }
