/* ============================================================
   sf-unify.css — theStudyFix canonical disease-index skin
   Source of truth: ICC-3 Infections page (the "forever template").
   Additive override: linked LAST in <head>, so it wins on ties and
   snaps every template generation (.app/.disease, .criterion,
   .layout/.card, .sec/.chip) to the Infections look — WITHOUT
   touching page content or breaking any page's own JS/hiding rules.
   Border colours use longhand so a page's own accent colours survive.
   ============================================================ */

/* ---------- Top credit bar ---------- */
.top-credit { background: var(--bg-soft); border-bottom: 1px solid var(--border); padding: 10px 24px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 12px; color: var(--text-3); letter-spacing: 0.3px; }
.top-credit img { height: 22px; width: auto; display: block; }
.top-credit .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--spc); display: inline-block; }
.top-credit a { color: var(--spc); text-decoration: none; font-weight: 600; transition: color 0.15s; }
.top-credit a:hover { color: var(--text); text-decoration: underline; }

/* ---------- Shell ---------- */
.app, .layout { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar, .layout > aside { position: sticky; top: 0; height: 100vh; background: var(--bg-soft); border-right: 1px solid var(--border); overflow-y: auto; padding: 18px 0 40px; }
.sidebar-logo, .side-logo, .brand { display: flex; align-items: center; gap: 9px; padding: 0 20px 14px; text-decoration: none; }
.sidebar-logo img, .side-logo img, .brand img { height: 30px; width: 30px; border-radius: 6px; display: block; }
.sidebar-logo span, .side-logo span { font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }
.brand-title { font-size: 14px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; text-transform: none; }
.brand-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.sidebar-title { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--spc); padding: 0 20px 4px; }
.sidebar-subtitle, .sub { font-size: 12px; color: var(--text-3); padding: 0 20px 16px; line-height: 1.5; }

/* Search — .search-input (new) + .search (legacy input) */
.search-wrap { padding: 0 16px 16px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.search-input, .search { width: 100%; background: var(--card); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; transition: border-color 0.15s; }
.search { width: calc(100% - 32px); margin: 0 16px 14px; display: block; }
.search-input::placeholder, .search::placeholder { color: var(--text-muted, #6e7681); }
.search-input:focus, .search:focus { outline: none; border-color: var(--inv); }

/* Sidebar nav */
.nav-group-title, .nav-cat, .cat-t { font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text-3); padding: 14px 20px 4px; }
.nav-link { display: flex; align-items: baseline; gap: 10px; padding: 4px 20px 4px 22px; color: var(--text-2); text-decoration: none; font-size: 13px; line-height: 1.4; border-left: 2px solid transparent; transition: background 0.12s, color 0.12s, border-left-color 0.12s; }
.nav-link:hover { background: var(--card); color: var(--text); border-left-color: var(--inv); text-decoration: none; }
.nav-link.active { background: var(--card); color: var(--text); border-left-color: var(--spc); }
.nav-num, .nav-link .n { color: var(--text-3); font-size: 11px; font-weight: 600; min-width: 20px; flex-shrink: 0; }
.nav-section { display: none; }
.nav-section.active { display: block; }

/* ---------- Main content ---------- */
.content, .layout > main { padding: 32px 56px 80px; max-width: 1000px; }
.main-header { margin-bottom: 8px; }
.main-title, .content > h1, .layout > main > h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.4px; color: var(--text); margin-bottom: 6px; line-height: 1.15; }
.main-subtitle, .subtitle { color: var(--text-3); font-size: 14px; margin: 0 0 18px; }

/* ---------- Tabs (content, underline) ---------- */
.tab-nav, .tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 28px; padding-top: 14px; }
.tab-nav .tab-btn, .tabs .tab-btn { flex: 0 0 auto; background: transparent; border: none; cursor: pointer; color: var(--text-3); padding: 12px 20px; font-family: inherit; font-size: 14px; font-weight: 600; border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s; margin-bottom: -1px; border-radius: 0; }
.tab-nav .tab-btn:hover, .tabs .tab-btn:hover { color: var(--text-2); background: transparent; }
.tab-nav .tab-btn.active, .tabs .tab-btn.active { color: var(--spc); border-bottom-color: var(--spc); background: transparent; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---------- Legend ---------- */
.legend { display: flex; gap: 18px; flex-wrap: wrap; padding: 14px 0 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); padding-bottom: 14px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }
/* Legend that lives INSIDE the header (relocated-tab pages) — drop the extra border/space so it sits cleanly above the tabs */
.main-header .legend { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.main-header .legend .legend-item { padding-bottom: 10px; }

/* ---------- Category headers ---------- */
.category, .cat { margin: 36px 0 18px; scroll-margin-top: 20px; }
.category:first-of-type, .cat:first-of-type { margin-top: 20px; }
.category-header, .cat > .cat-h, .cat-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.category-name, .cat-name { font-size: 22px; font-weight: 700; color: var(--spc); letter-spacing: -0.2px; }
.category-count, .cat-count, .count { color: var(--text-3); font-size: 12px; letter-spacing: 0.4px; }

/* ---------- Disease / card container ---------- */
.disease, .card, .criteria-card, .criterion { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin: 14px 0; overflow: hidden; transition: border-color 0.2s; scroll-margin-top: 20px; }
.disease:target, .card:target, .criteria-card:target, .criterion:target { border-color: var(--spc); box-shadow: 0 0 0 2px rgba(242,204,96,0.15); }
.disease-header, .criteria-header, .criterion-header, .card-head, .card-h { display: flex; align-items: center; gap: 12px; padding: 16px 22px 14px; border-bottom: 1px solid var(--border-soft); background: linear-gradient(180deg, rgba(255,255,255,0.018), transparent); margin: 0; }
.disease-num, .criteria-num, .criterion-num, .chip { background: var(--bg-soft); color: var(--text-3); font-weight: 700; font-size: 12px; padding: 4px 9px; border-radius: 6px; border: 1px solid var(--border); min-width: 32px; text-align: center; flex-shrink: 0; }
.disease-title, .criteria-title, .criterion-title, .card-title, .card-head h2, .card-h h3 { font-size: 17px; font-weight: 600; color: var(--text); letter-spacing: -0.1px; margin: 0; }

/* card body / sections wrapper */
.sections, .card-b { padding: 14px 22px 20px; display: grid; gap: 12px; }
/* hepatobil .card holds buckets directly (no body wrapper) — give it inner padding */
.card:not(:has(.card-b)) { padding: 0 0 6px; }
.card:not(:has(.card-b)) > .bucket { margin: 12px 22px 0; }

/* ---------- Buckets (both modifier systems: .cp and -cp) ---------- */
.bucket, .sec { padding: 11px 14px 12px; border-radius: var(--radius-sm); background: var(--bg-soft-2); border-left-width: 3px; border-left-style: solid; border-left-color: var(--border); }
.bucket.cp,  .bucket-cp,  .sec-cp  { border-left-color: var(--cp); }
.bucket.inv, .bucket-inv, .sec-inv { border-left-color: var(--inv); }
.bucket.mng, .bucket-mng, .sec-mng { border-left-color: var(--mng); }
.bucket.spc, .bucket-spec, .sec-spc { border-left-color: var(--spc); background: rgba(242,204,96,0.045); }
.bucket-label, .sec-l { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; margin-bottom: 7px; }
.bucket.cp .bucket-label,  .bucket-cp .bucket-label,  .sec-cp .sec-l  { color: var(--cp); }
.bucket.inv .bucket-label, .bucket-inv .bucket-label, .sec-inv .sec-l { color: var(--inv); }
.bucket.mng .bucket-label, .bucket-mng .bucket-label, .sec-mng .sec-l { color: var(--mng); }
.bucket.spc .bucket-label, .bucket-spec .bucket-label, .sec-spc .sec-l { color: var(--spc); }
.bucket ul, .sec ul { list-style: none; padding-left: 0; margin: 0; }
.bucket li, .sec li { position: relative; padding-left: 14px; margin-bottom: 3px; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.bucket li::before, .sec li::before { content: ""; position: absolute; left: 3px; top: 9px; width: 4px; height: 4px; border-radius: 50%; background: var(--text-3); }
.bucket li ul, .sec li ul { margin-top: 4px; padding-left: 4px; }
.bucket li ul li, .sec li ul li { font-size: 13.5px; color: var(--text-3); }
.bucket strong, .sec strong { color: var(--text); font-weight: 600; }
.bucket em, .sec em { color: var(--text-2); font-style: italic; }
.dash { color: var(--text-muted); font-style: italic; }

/* ---------- Criteria body (criteria-card h4 + legacy .criterion .sub-head) ---------- */
.criteria-body, .criterion-body { padding: 14px 22px 20px; }
.criteria-body h4, .criterion-body h4, .criterion-body .sub-head, .sub-head { color: var(--spc); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; margin: 16px 0 6px; }
.criteria-body h4:first-child, .criterion-body h4:first-child { margin-top: 0; }
.criteria-body ul, .criterion-body ul { list-style: none; padding-left: 0; margin: 6px 0; }
.criteria-body li, .criterion-body li { position: relative; padding-left: 14px; color: var(--text-2); font-size: 14px; line-height: 1.6; margin-bottom: 3px; }
.criteria-body li::before, .criterion-body li::before { content: ""; position: absolute; left: 3px; top: 10px; width: 4px; height: 4px; border-radius: 50%; background: var(--text-3); }
.criteria-body strong, .criterion-body strong { color: var(--text); font-weight: 600; }
.criteria-body em, .criterion-body em { color: var(--text-2); font-style: italic; }
.criteria-body table, .criterion-body table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13.5px; display: block; overflow-x: auto; }
.criteria-body th, .criteria-body td, .criterion-body th, .criterion-body td { padding: 7px 12px; text-align: left; border: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
.criteria-body th, .criterion-body th { background: var(--bg-soft); color: var(--text); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
.criteria-body p, .criterion-body p { color: var(--text-2); font-size: 14px; line-height: 1.6; margin: 6px 0; }

/* ---------- Footer ---------- */
.footer { margin-top: 60px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12px; }
.footer a { color: var(--spc); text-decoration: none; }

/* ---------- Mobile menu button ---------- */
.menu-btn, .burger { display: none; position: fixed; top: 16px; right: 16px; background: var(--card); border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 600; z-index: 101; }
@media (max-width: 900px) {
  .app, .layout { grid-template-columns: 1fr; }
  .sidebar, .layout > aside { position: fixed; transform: translateX(-100%); transition: transform 0.25s; z-index: 100; width: 280px; box-shadow: 4px 0 16px rgba(0,0,0,0.4); }
  .sidebar.open, .layout > aside.open { transform: translateX(0); }
  .content, .layout > main { padding: 24px 20px 60px; }
  .menu-btn, .burger { display: block; }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* ---------- Search hide (all generations) ---------- */
.disease.hidden, .card.hidden, .criteria-card.hidden, .criterion.hidden, .category.hidden, .cat.hidden { display: none; }

/* ---------- Hide redundant per-page credit pills (the top-credit bar already covers them; matches Infections which has no eyebrow) ---------- */
.eyebrow, .main-eyebrow { display: none; }
