/* Research tool pages (templates/tool_base.html and the pages that extend it).
   Loaded after dataintell-marketing.css and uses its tokens; every rule is
   scoped under .tl so nothing leaks into the rest of the site. */

/* the dark header sits under the navbar, which is transparent until scrolled */
body { padding-top: 0 !important; }
.bg-dataintell { background: transparent !important; box-shadow: none !important; transition: background .3s, border-color .3s; border-bottom: 1px solid transparent; }
.bg-dataintell.dm-solid { background: rgba(23,17,28,.92) !important; backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line-dk); }

.tl a { text-decoration: none; }
.tl .visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── header ─────────────────────────────────────────────── */
.tl-head { position: relative; overflow: hidden; background: var(--ink); color: var(--paper); padding: 118px 0 40px; }
.tl-head::before { content: ""; position: absolute; right: -160px; top: -220px; width: 620px; height: 620px; border-radius: 50%; background: radial-gradient(circle, rgba(123,30,122,.4), rgba(23,17,28,0) 65%); pointer-events: none; }
.tl-head .dm-shell { position: relative; z-index: 1; }
.tl-crumb { margin: 0 0 18px; font-family: var(--dm-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--seal); }
.tl-crumb a { color: rgba(251,249,252,.72); }
.tl-crumb a:hover { color: var(--orchid); }
.tl-crumb span { color: rgba(251,249,252,.45); margin: 0 4px; }
.tl-head__row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 48px; }
.tl-head__text { flex: 1 1 420px; }
.tl-title { font-family: var(--dm-display); font-weight: 400; font-size: clamp(40px, 5vw, 64px); line-height: 1; letter-spacing: -.02em; margin: 0 0 12px; }
.tl-title em { font-style: italic; color: var(--orchid); }
.tl-sub { margin: 0; font-size: 17px; line-height: 1.5; color: rgba(251,249,252,.72); max-width: 54ch; }
.tl-count { margin: 0; font-family: var(--dm-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: rgba(251,249,252,.72); }
.tl-count b { font-family: var(--dm-display); font-weight: 400; font-size: 40px; letter-spacing: 0; text-transform: none; color: var(--paper); margin-right: 8px; }
.tl-points { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 24px; font-family: var(--dm-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: rgba(251,249,252,.72); }

.tl-search { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; max-width: 820px; }
.tl-search__box { flex: 1 1 340px; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border: 1px solid rgba(251,249,252,.2); border-radius: 8px; background: rgba(251,249,252,.06); transition: border-color .2s; }
.tl-search__box:focus-within { border-color: var(--orchid); }
.tl-search__box i { color: rgba(251,249,252,.7); }
.tl-search__box input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--paper); font: inherit; font-size: 16px; }
.tl-search__box input::placeholder { color: rgba(251,249,252,.55); }
.tl-search button { min-height: 52px; padding: 0 26px; border: 0; border-radius: 8px; background: var(--plum); color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; transition: background .2s; }
.tl-search button:hover { background: var(--orchid); }

.tl-messages { padding-top: 24px; }

/* ── body: filters + results ────────────────────────────── */
.tl-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 40px; padding-top: 40px; padding-bottom: 88px; }
.tl-main { flex: 999 1 560px; min-width: 0; }
.tl-filters { flex: 1 1 240px; max-width: 280px; display: flex; flex-direction: column; gap: 28px; }
.tl-filters h2, .tl-label { margin: 0 0 10px; font-family: var(--dm-mono); font-size: 11px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: var(--plum); }
.tl-opts { display: flex; flex-direction: column; gap: 2px; }
.tl-opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 6px; color: var(--ink); font-size: 14px; transition: background .15s; }
.tl-opt:hover { background: var(--mist); color: var(--ink); }
.tl-opt span { font-family: var(--dm-mono); font-size: 12px; color: var(--slate); }
.tl-opt[aria-current="true"] { background: var(--ink); color: var(--paper); }
.tl-opt[aria-current="true"] span { color: var(--seal); }
.tl-filter-toggle { display: none; }

.tl-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.tl-toolbar h2 { margin: 0 0 4px; font-family: var(--dm-display); font-weight: 400; font-size: 34px; line-height: 1.1; }
.tl-toolbar p { margin: 0; font-size: 14px; color: var(--slate); }
.tl-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tl-controls label { font-size: 14px; color: var(--slate); }
.tl-select { min-height: 44px; padding: 0 12px; border: 1px solid rgba(23,17,28,.18); border-radius: 6px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; }
.tl-switch { display: flex; border: 1px solid rgba(23,17,28,.18); border-radius: 6px; overflow: hidden; }
.tl-switch a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; }
.tl-switch a[aria-current="true"] { background: var(--ink); color: var(--paper); }

.tl-active { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.tl-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--plum); background: var(--mist); color: var(--plum); font-size: 13px; font-weight: 600; }
.tl-chip:hover { background: #fff; color: var(--plum); }
.tl-chip--plain { border-color: rgba(23,17,28,.18); background: transparent; color: var(--slate); }

/* ── cards ──────────────────────────────────────────────── */
.tl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tl-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(23,17,28,.08); border-radius: 10px; background: #fff; color: var(--ink); transition: border-color .2s, transform .2s; }
.tl-card:hover { color: var(--ink); border-color: rgba(123,30,122,.35); transform: translateY(-3px); }
.tl-card__media { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; height: 140px; padding: 14px; background: var(--ink-3); color: rgba(251,249,252,.82); font-family: var(--dm-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.tl-card__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tl-card__media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(23,17,28,0) 35%, rgba(23,17,28,.75)); }
.tl-card__media > span { position: relative; z-index: 1; }
.tl-card__body { display: flex; flex-direction: column; flex: 1; padding: 20px; }
.tl-card__t { font-family: var(--dm-display); font-size: 24px; line-height: 1.12; margin-bottom: 10px; }
.tl-card__by { font-size: 14px; color: var(--slate); margin-bottom: 10px; }
.tl-card__d { font-size: 14px; line-height: 1.5; color: var(--slate); margin-bottom: 16px; }
.tl-card__foot { margin-top: auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding-top: 12px; border-top: 1px solid rgba(23,17,28,.08); font-family: var(--dm-mono); font-size: 12px; color: var(--slate); }

.tl-list { display: flex; flex-direction: column; gap: 10px; }
.tl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 18px 20px; border: 1px solid rgba(23,17,28,.08); border-radius: 10px; background: #fff; color: var(--ink); transition: border-color .2s; }
.tl-row:hover { color: var(--ink); border-color: rgba(123,30,122,.35); }
.tl-row__main { flex: 1 1 320px; min-width: 0; }
.tl-row__t { display: block; font-family: var(--dm-display); font-size: 23px; line-height: 1.15; margin: 4px 0; }
.tl-row__meta { font-family: var(--dm-mono); font-size: 12px; color: var(--slate); }

/* product cards (/products/) */
.tl-product:hover { transform: none; }
.tl-product__media { height: 150px; }
.tl-product__logo, .tl-product__initial { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); z-index: 1; width: 76px; height: 76px; border-radius: 14px; }
.tl-card__media img.tl-product__logo { inset: auto; width: 76px; height: 76px; object-fit: contain; padding: 8px; background: #fff; }
.tl-product__initial { display: flex; align-items: center; justify-content: center; background: var(--plum); color: #fff; font-family: var(--dm-display); font-weight: 400; font-size: 40px; }
.tl-product .tl-card__t { margin: 0 0 10px; font-weight: 400; }
.tl-product .tl-card__d, .tl-product .tl-card__by { margin-top: 0; }
.tl-product__traction { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 16px; font-family: var(--dm-mono); font-size: 12px; color: #0A7373; }
.tl-product__acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.tl-product__acts .dm-btn { padding: 10px 16px; font-size: 14px; }

/* collaboration cards (/projects/collaborate/) */
.tl-collab:hover { transform: none; }
.tl-collab .tl-card__t { margin: 0 0 10px; font-weight: 400; }
.tl-collab .tl-card__t a { color: var(--ink); }
.tl-collab .tl-card__t a:hover { color: var(--plum); }
.tl-collab .tl-card__d { margin-top: 0; }
.tl-collab__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.tl-open { font-family: var(--dm-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #0A7373; }
.tl-skills { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; padding: 0; }
.tl-skills li { padding: 4px 10px; border-radius: 999px; background: var(--mist); color: var(--plum); font-size: 13px; }
.tl-person { display: flex; align-items: center; gap: 10px; margin: auto 0 16px; padding-top: 4px; }
.tl-person img, .tl-person > span { flex: none; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.tl-person > span { display: flex; align-items: center; justify-content: center; background: var(--plum); color: #fff; font-weight: 600; }
.tl-person strong { display: block; font-size: 14px; }
.tl-person small { font-size: 13px; color: var(--slate); }
.tl-collab__act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tl-collab__act .dm-btn { padding: 10px 16px; font-size: 14px; }
.tl-state { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 6px; background: var(--mist); color: var(--slate); font-size: 14px; font-weight: 600; }
.tl-state--ok { background: #E3F4EE; color: #0A5F4A; }
.tl-stats { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.tl-opt i { font-size: 11px; color: var(--slate); }

/* registry (/projects/ongoing/) */
.tl-head__side { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.tl-progress { display: block; height: 6px; margin: 0 0 4px; border-radius: 3px; background: var(--mist); overflow: hidden; }
.tl-progress span { display: block; height: 100%; background: var(--plum); }

/* ── Check an idea (/projects/check-idea/) ──────────────── */
.ci { padding-top: 40px; padding-bottom: 88px; }
.ci-top { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 40px; }
.ci-form-col { flex: 999 1 560px; min-width: 0; }
.ci-side { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.ci-h2 { font-family: var(--dm-display); font-weight: 400; font-size: 32px; line-height: 1.1; margin: 0 0 6px; }
.ci-h2 em { font-style: italic; color: var(--plum); }
.ci-note { margin: 0 0 28px; font-size: 15px; color: var(--slate); }
.ci-form { padding: clamp(22px, 3vw, 36px); border: 1px solid rgba(23,17,28,.08); border-radius: 12px; background: #fff; }
.ci-fields { display: flex; flex-direction: column; gap: 22px; }
.ci-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.ci-lbl { display: block; margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.ci-lbl small { font-weight: 400; color: var(--slate); }
.ci-fld { width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid rgba(23,17,28,.18); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 15px; }
.ci-fld:focus { outline: 2px solid var(--orchid); outline-offset: 1px; border-color: var(--plum); }
textarea.ci-fld { resize: vertical; }
.ci-help { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--slate); }
.ci-help--center { text-align: center; }
.ci-help a { color: var(--plum); font-weight: 600; }
.ci-submit { min-height: 56px; border: 0; border-radius: 8px; background: var(--plum); color: #fff; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; transition: background .2s; }
.ci-submit:hover { background: var(--orchid); }

.ci-how { margin-top: 28px; padding: 28px; border-radius: 12px; background: var(--mist); }
.ci-how ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 28px; }
.ci-how li { display: flex; gap: 14px; }
.ci-how b { flex: none; font-family: var(--dm-display); font-weight: 400; font-size: 30px; line-height: 1; color: var(--plum); }
.ci-how span { font-size: 14px; line-height: 1.5; color: var(--slate); }
.ci-how strong { display: block; margin-bottom: 4px; font-size: 15px; color: var(--ink); }

.ci-from { margin: 0; padding: 14px 16px; border-radius: 10px; background: var(--mist); font-size: 14px; color: var(--slate); }
.ci-from a { color: var(--plum); font-weight: 600; }
.ci-verdict, .ci-promise { padding: 28px; border-radius: 12px; background: var(--ink); color: var(--paper); }
.ci-verdict__k { margin: 0 0 12px; font-family: var(--dm-mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--seal); }
.ci-verdict__t { margin: 0 0 8px; font-family: var(--dm-display); font-weight: 400; font-size: 34px; line-height: 1.05; }
.ci-verdict__t em { font-style: italic; color: var(--orchid); }
.ci-verdict__n { margin: 0 0 16px; font-family: var(--dm-mono); font-size: 12px; color: rgba(251,249,252,.72); }
.ci-verdict__m { margin: 0 0 8px; font-size: 15px; line-height: 1.55; color: rgba(251,249,252,.85); }
.ci-verdict__a { margin: 0 0 22px; font-size: 14px; line-height: 1.55; color: rgba(251,249,252,.72); font-style: italic; }
.ci-verdict { border-top: 4px solid var(--orchid); }
.ci-verdict.ci-tier--novel { border-top-color: #4CC38A; }
.ci-verdict.ci-tier--overlap { border-top-color: #3DB5B5; }
.ci-verdict.ci-tier--related { border-top-color: var(--seal); }
.ci-verdict.ci-tier--duplicate { border-top-color: #F2765D; }
.ci-promise ul { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; font-size: 14px; line-height: 1.55; color: rgba(251,249,252,.75); }
.ci-promise strong { display: block; margin-bottom: 2px; color: var(--paper); }

.ci-acts { display: flex; flex-direction: column; gap: 10px; }
.ci-acts .dm-btn { justify-content: center; padding: 12px 20px; font-size: 15px; }
.ci-acts--row { flex-direction: row; flex-wrap: wrap; }
.ci-acts--center { justify-content: center; }
.ci-quiet { display: inline-block; margin-top: 6px; font-size: 14px; color: rgba(251,249,252,.72); }
.ci-quiet:hover { color: var(--orchid); }

.ci-band { margin-top: 56px; }
.ci-warn { margin-bottom: 20px; padding: 22px 24px; border-radius: 12px; background: #FDF5E3; border: 1px solid #EBD39A; }
.ci-warn h2 { margin: 0 0 6px; font-family: var(--dm-display); font-weight: 400; font-size: 28px; color: #6B4A0E; }
.ci-warn p { margin: 0; font-size: 15px; line-height: 1.55; color: #6B4A0E; }

.ci-matches { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 20px; }
.ci-match { padding: 22px; border: 1px solid rgba(23,17,28,.08); border-radius: 12px; background: #fff; }
.ci-match__top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.ci-match__score { font-family: var(--dm-display); font-size: 34px; line-height: 1; }
.ci-match__score small { font-size: 16px; color: var(--slate); }
.ci-match h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; line-height: 1.35; }
.ci-match h3 a { color: var(--ink); }
.ci-match h3 a:hover { color: var(--plum); }
.ci-match__by { margin: 0 0 14px; font-size: 13px; color: var(--slate); }
.ci-match__why { margin: 0 0 16px; font-size: 14px; line-height: 1.55; }
.ci-tier { font-family: var(--dm-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.ci-tier--novel { color: #15803D; }
.ci-tier--overlap { color: #0A7373; }
.ci-tier--related { color: #9A6B12; }
.ci-tier--duplicate { color: #B42318; }
.ci-flag { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: #B42318; }
.ci-dims { display: grid; grid-template-columns: 76px minmax(0, 1fr) 40px; gap: 8px 10px; align-items: center; margin: 0 0 14px; font-size: 13px; }
.ci-dims dt { font-weight: 400; color: var(--slate); }
.ci-dims dd { margin: 0; font-family: var(--dm-mono); font-size: 12px; text-align: right; }
.ci-bar { height: 6px; border-radius: 3px; background: var(--mist); overflow: hidden; }
.ci-dims dd.ci-bar { text-align: left; }
.ci-bar span { display: block; height: 100%; background: var(--plum); }
.ci-bar span.mid { background: #C98A12; }
.ci-bar span.hi { background: #B42318; }
.ci-match .ci-acts .dm-btn { padding: 10px 16px; font-size: 14px; }

.ci-report { padding: clamp(24px, 4vw, 40px); border-radius: 14px; background: #fff; border: 1px solid rgba(23,17,28,.08); }
.ci-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0 24px; padding: 0; list-style: none; }
.ci-tabs .nav-link { min-height: 42px; padding: 0 16px; border: 1px solid rgba(23,17,28,.15); border-radius: 999px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 600; }
.ci-tabs .nav-link.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.ci-count { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--plum); color: #fff; font-size: 11px; }
.ci-count--lock { background: var(--slate); }
.ci-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.ci-panel { padding: 24px; border: 1px solid rgba(23,17,28,.1); border-radius: 12px; background: #fff; font-size: 15px; line-height: 1.6; }
.ci-panel > p { margin: 0 0 14px; }
.ci-panel h3 { margin: 0 0 10px; font-family: var(--dm-display); font-weight: 400; font-size: 30px; }
.ci-narrow { max-width: 640px; }
.ci-panel__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.ci-score { font-family: var(--dm-display); font-size: 36px; line-height: 1; color: var(--plum); }
.ci-score small { font-size: 16px; color: var(--slate); }
.ci-proceed { border-width: 2px; border-color: var(--plum); }
.ci-proceed--strong-yes { border-color: #15803D; }
.ci-proceed--yes { border-color: #0A7373; }
.ci-proceed--yes-with-refinement { border-color: #C98A12; }
.ci-advice { padding: 12px 14px; border-radius: 8px; background: var(--mist); font-size: 14px; }
.ci-dim { margin-top: 16px; }
.ci-dim__head { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.ci-dim__head b { color: var(--plum); }
.ci-dim p { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--slate); }
.ci-refs { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 1.45; color: var(--slate); }
.ci-refs b { color: var(--plum); font-weight: 600; }
.ci-callout { margin-top: 10px; padding: 12px 14px; border-radius: 8px; background: var(--mist); font-size: 14px; }
.ci-callout b { display: block; margin-bottom: 2px; font-family: var(--dm-mono); font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--plum); }
.ci-callout--teal { background: #E6F4F4; }
.ci-callout--teal b { color: #0A7373; }
.ci-callout--gold { background: #FDF5E3; }
.ci-callout--gold b { color: #8A5D0B; }
.ci-lim { padding: 14px 0; border-top: 1px solid rgba(23,17,28,.08); font-size: 14px; }
.ci-lim p { margin: 0 0 6px; }
.ci-lim__src { font-family: var(--dm-mono); font-size: 12px; color: var(--slate); }
.ci-lim__src span { color: var(--plum); }
.ci-lim__l { color: #B42318; }
.ci-lim__o { color: #15803D; font-weight: 600; }
.ci-next { margin-top: 24px; padding: 28px; border-radius: 12px; background: var(--ink); color: var(--paper); text-align: center; }
.ci-next h3 { margin: 0 0 8px; font-family: var(--dm-display); font-weight: 400; font-size: 30px; }
.ci-next p { margin: 0 auto 18px; max-width: 56ch; color: rgba(251,249,252,.72); }
.ci-next .ci-acts--row { justify-content: center; }
.ci-locked { padding: 48px 20px; text-align: center; color: var(--slate); }
.ci-locked h3 { margin: 0 0 8px; font-family: var(--dm-display); font-weight: 400; font-size: 30px; color: var(--ink); }
.ci-locked p { margin: 0 auto 20px; max-width: 46ch; }
.ci-papers { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ci-paper { padding: 20px; border: 1px solid rgba(23,17,28,.1); border-radius: 12px; font-size: 14px; line-height: 1.55; }
.ci-paper p { margin: 0 0 10px; }
.ci-paper h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; line-height: 1.35; }
.ci-paper__src { font-family: var(--dm-mono); font-size: 12px; color: var(--slate); }
.ci-paper__src span { color: #0A7373; }
.ci-paper__by { color: var(--slate); font-size: 13px; }
.ci-paper a { color: var(--plum); font-weight: 600; }

.ci-loading { display: none; position: fixed; inset: 0; z-index: 9999; flex-direction: column; align-items: center; justify-content: center; padding: 24px; background: rgba(23,17,28,.9); text-align: center; }
.ci-loading.active { display: flex; }
.ci-loading__spin { width: 56px; height: 56px; margin-bottom: 20px; border: 4px solid rgba(251,249,252,.2); border-top-color: var(--orchid); border-radius: 50%; animation: ci-spin .9s linear infinite; }
.ci-loading__t { margin: 0 0 8px; color: var(--paper); font-size: 17px; font-weight: 600; }
.ci-loading__d { margin: 0; max-width: 300px; color: rgba(251,249,252,.72); font-size: 14px; }
@keyframes ci-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ci-loading__spin { animation-duration: 3s; } }
@media (max-width: 991.98px) { .ci { padding-top: 24px; } }

/* closing call to action under a list */
.tl-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; margin-top: 56px; padding: 32px; border-radius: 12px; background: var(--mist); }
.tl-cta h2 { font-family: var(--dm-display); font-weight: 400; font-size: 30px; line-height: 1.1; margin: 0 0 6px; }
.tl-cta p { margin: 0; color: var(--slate); max-width: 52ch; }

/* small mono labels */
.tl-tag { font-family: var(--dm-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--plum); }
.tl-badge { display: inline-block; margin-bottom: 10px; font-family: var(--dm-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--slate); }
.tl-badge--gold { color: #9A6B12; }
.tl-badge--teal { color: #0A7373; }
.tl-badge--plum { color: var(--plum); }
.tl-badge--blue { color: #1D4ED8; }
.tl-badge--red { color: #B42318; }

/* pagination + empty */
.tl-pager { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 36px; }
.tl-pager a, .tl-pager span { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 14px; border-radius: 6px; border: 1px solid rgba(23,17,28,.15); color: var(--ink); font-size: 14px; }
.tl-pager a:hover { border-color: var(--plum); color: var(--plum); }
.tl-pager [aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.tl-empty { padding: 56px 24px; border: 1px dashed rgba(23,17,28,.18); border-radius: 12px; text-align: center; }
.tl-empty h3 { font-family: var(--dm-display); font-weight: 400; font-size: 30px; margin: 0 0 8px; }
.tl-empty p { color: var(--slate); margin: 0 0 20px; }

/* ── phones ─────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .tl-head { padding-top: 100px; }
  .tl-body { gap: 16px; padding-top: 20px; }
  .tl-filters { flex-basis: 100%; max-width: none; gap: 0; }
  .tl-filter-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; border: 1px solid var(--ink); border-radius: 8px; background: var(--ink); color: var(--paper); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
  .tl-filter-toggle small { font-family: var(--dm-mono); font-size: 12px; color: var(--seal); }
  .tl-filter-panel { display: none; margin-top: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  .tl-filter-panel.is-open { display: flex; flex-direction: column; gap: 18px; }
  .tl-opts { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .tl-opt { min-height: 40px; border: 1px solid rgba(23,17,28,.18); border-radius: 999px; }
  .tl-toolbar h2 { font-size: 28px; }
}
@media (min-width: 992px) {
  .tl-filter-panel { display: flex; flex-direction: column; gap: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .tl-card { transition: none; }
}

/* institution picker (templates/users/_institution_picker.html) */
.inst-pick__field { position: relative; }
.inst-pick__list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; max-height: 300px; margin: 4px 0 0; padding: 4px; overflow-y: auto; list-style: none; border: 1px solid rgba(23,17,28,.15); border-radius: 10px; background: #fff; box-shadow: 0 12px 32px rgba(23,17,28,.14); }
.inst-pick__list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.inst-pick__list li strong { font-size: 15px; font-weight: 600; color: var(--ink); }
.inst-pick__list li span { font-size: 13px; color: var(--slate); }
.inst-pick__list li:hover, .inst-pick__list li[aria-selected="true"] { background: var(--mist); }
.inst-pick__ok { display: inline-flex; gap: 6px; align-items: center; margin-right: 6px; font-weight: 600; color: #0A5F4A; }

/* ── Leaderboard (/leaderboard/) ──────────────────────────── */
.lb { padding-top: 32px; padding-bottom: 88px; }
.lb-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 24px; }
.lb-tabs button { min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(23,17,28,.15); background: transparent; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.lb-tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.lb-tabs button:focus-visible { outline: 2px solid var(--plum); outline-offset: 2px; }
.lb-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 20px; }
.lb-main { flex: 999 1 600px; min-width: 0; }
.lb-side { flex: 1 1 280px; display: flex; flex-direction: column; gap: 20px; }
.lb-box { padding: 24px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.lb-box__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin: 0 0 8px; }
.lb-box__head h2 { margin: 0; font-family: var(--dm-display); font-weight: 400; font-size: 28px; line-height: 1.1; }
.lb-box__head p { margin: 0; font-size: 13px; color: var(--slate); }
.lb-boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 20px; }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-list li { border-top: 1px solid var(--line); }
.lb-list li:first-child { border-top: 0; }
.lb-list--two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); column-gap: 32px; }
.lb-list--two li, .lb-list--two li:first-child { border-top: 0; border-bottom: 1px solid var(--line); }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; color: var(--ink); }
.lb-row:hover { color: var(--plum); }
.lb-rank { flex: none; width: 28px; font-family: var(--dm-display); font-weight: 400; font-size: 26px; line-height: 1; color: var(--slate); text-align: center; }
.lb-rank--top { color: var(--plum); }
.lb-avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--ink-3); color: var(--paper); font-size: 14px; font-weight: 600; }
.lb-row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-row__text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; }
.lb-row__text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--slate); }
.lb-score { flex: none; font-family: var(--dm-mono); font-size: 14px; font-weight: 500; color: var(--ink); text-align: right; }
.lb-score small { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--slate); }
.lb-empty { margin: 8px 0 0; color: var(--slate); }
.lb-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 12px; }
.lb-field { display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); transition: border-color .2s; }
.lb-field:hover { color: var(--ink); border-color: rgba(123,30,122,.4); }
.lb-field__k { font-family: var(--dm-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--plum); }
.lb-field strong { font-size: 15px; line-height: 1.35; }
.lb-field small { font-size: 13px; color: var(--slate); }
.lb-field__foot { display: flex; justify-content: space-between; margin-top: auto; padding-top: 8px; font-family: var(--dm-mono); font-size: 12px; color: var(--slate); }
.lb-side__h { margin: 0 0 10px; font-family: var(--dm-display); font-weight: 400; font-size: 24px; }
.lb-side p { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: var(--slate); }
.lb-side p:last-child { margin-bottom: 0; }
.lb-points { list-style: none; margin: 0 0 14px; padding: 0; }
.lb-points li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.lb-points li:first-child { border-top: 0; }
.lb-points b { font-family: var(--dm-mono); font-weight: 500; color: var(--plum); }
.lb-acts { display: flex; flex-wrap: wrap; gap: 10px; }
