/* Custom styles for OM/SCM Faculty Directory */

:root {
    --bg: #edf2f7;
    --bg-accent: #dbe7f1;
    --surface: #ffffff;
    --surface-muted: #f7f9fc;
    --surface-strong: #e9eef5;
    --border: #cfd8e3;
    --border-strong: #b8c4d4;
    --text: #183247;
    --muted: #5f7288;
    --heading: #0f2438;
    --brand: #1d4e89;
    --brand-strong: #153a66;
    --brand-soft: #d8e7f7;
    --success-soft: #dff3e6;
    --warning-soft: #fff1d6;
    --danger-soft: #fbe0de;
    --alt-row: #f4f8fc;
    --hover-row: #e2edf8;
    --shadow: 0 14px 32px rgba(15, 36, 56, 0.08);
}

body.site-body {
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 32%),
        linear-gradient(180deg, var(--bg-accent), var(--bg));
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

a {
    color: var(--brand);
}

a:hover {
    color: var(--brand-strong);
}

.page-shell {
    padding-bottom: 1.5rem;
}

.site-navbar {
    background: linear-gradient(135deg, #163754, #10263b);
    box-shadow: 0 10px 24px rgba(16, 38, 59, 0.22);
}

.site-navbar .navbar-brand {
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.site-navbar .navbar-brand:hover,
.site-navbar .navbar-brand:focus {
    color: #ffffff;
}

.site-navbar .nav-link {
    color: rgba(255, 255, 255, 0.78);
    border-radius: 0.35rem;
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link:focus,
.site-navbar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.site-navbar .dropdown-menu {
    border-color: rgba(15, 36, 56, 0.12);
    border-radius: 0.45rem;
    box-shadow: 0 12px 28px rgba(15, 36, 56, 0.14);
}

.site-navbar .dropdown-item.active,
.site-navbar .dropdown-item:active {
    background: var(--brand);
    color: #fff;
}

/* Hamburger toggler for narrow viewports — default Bootstrap icon SVG is dark
   and invisible against this navbar's dark gradient. Paint a white version. */
.site-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.4);
    padding: 0.35rem 0.55rem;
}
.site-navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}
.site-navbar .navbar-toggler-icon {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba(255,255,255,0.9)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

.page-hero {
    margin-bottom: 1.5rem;
    padding: 1.5rem 1.75rem;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 1.25rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 252, 0.93));
    box-shadow: var(--shadow);
}

.page-hero h1,
.page-hero h2 {
    color: var(--heading);
}

.page-subtitle {
    max-width: 56rem;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1rem;
}

.card,
.table-card,
.panel-card {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--surface);
    box-shadow: 0 6px 18px rgba(15, 36, 56, 0.04);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
}

.department-card .department-sources {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.department-card .department-sources a {
    color: var(--muted);
    text-decoration: none;
}

.department-card .department-sources a:hover {
    color: var(--link);
    text-decoration: underline;
}

/* Department research profile: radar fingerprint + impact-weighted topic bars */
.research-profile .rp-block + .rp-block {
    border-top: 1px solid var(--border);
    margin-top: 1.25rem;
    padding-top: 1.25rem;
}

.research-profile h6.rp-heading {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

.research-profile .rp-radar svg {
    width: 100%;
    max-width: 480px;
    height: auto;
    display: block;
    margin: 0.25rem auto 0;
}

.research-profile .rp-grid {
    fill: none;
    stroke: var(--border);
    stroke-width: 1;
}

.research-profile .rp-spoke {
    stroke: var(--border);
    stroke-width: 1;
}

.research-profile .rp-shape {
    fill: rgba(78, 168, 109, 0.26);
    stroke: #3d8c5a;
    stroke-width: 2.5;
    stroke-linejoin: round;
}

.research-profile .rp-vertex {
    fill: #2f7548;
}

.research-profile .rp-axis-label {
    font-size: 14px;
    font-weight: 500;
    fill: var(--text);
}

.research-profile .rp-axis-pct {
    font-size: 12px;
    font-weight: 600;
    fill: var(--muted);
}

.research-profile .rp-bars {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.research-profile .rp-bar-row {
    display: grid;
    grid-template-columns: minmax(8rem, 10.5rem) 1fr auto;
    align-items: center;
    gap: 0.7rem;
}

.research-profile .rp-bar-label {
    font-size: 0.85rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.research-profile .rp-bar-track {
    position: relative;
    height: 1.05rem;
    border-radius: 0.5rem;
    background: var(--surface-strong);
    overflow: hidden;
}

.research-profile .rp-bar-fill {
    height: 100%;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    min-width: 3px;
}

.research-profile .rp-bar-count {
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    white-space: nowrap;
}

.research-profile .rp-caption {
    font-size: 0.76rem;
    color: var(--muted);
    margin-top: 1.1rem;
    margin-bottom: 0;
}

/* Cohort table: marks a citation count whose source is not OpenAlex. */
.cohort-cite-mark {
    color: var(--muted);
    font-weight: 600;
    margin-left: 1px;
}

/* Cohort table: the Name cell stacks the title beneath the name (like the
   All-Faculty directory), so it must wrap instead of clipping to one line. */
#cohResultsTable tbody td.cell-primary {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    line-height: 1.3;
}
#cohResultsTable tbody td.cell-primary .text-muted {
    margin-top: 2px;
    line-height: 1.25;
}

/* Cohort focal card: an accented identity block with a horizontal stat strip. */
.cohort-focal-card {
    border-left: 3px solid var(--brand);
    background: var(--surface-muted);
}
.cohort-focal-eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    font-weight: 600;
    color: var(--muted);
}
.cohort-focal-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.5rem;
    margin-top: 0.7rem;
}
.cohort-focal-stats > div { font-size: 0.85rem; }
.cohort-focal-stats .stat-label { color: var(--muted); margin-right: 0.35rem; }
.cohort-focal-stats .stat-value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Cohort intro / empty state shown before a focal member is chosen. */
.cohort-empty { color: var(--muted); }

/* Removable school chips in the filter-based cohort pathway. */
.coh-school-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.3rem 0.15rem 0.6rem;
    border-radius: 0.6rem;
    font-size: 0.78rem;
    background: #eaf3ff;
    color: #14457a;
    border: 1px solid #cad7e8;
}
.coh-chip-x {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 1.1em;
    line-height: 1;
    padding: 0 0.2rem;
    border-radius: 0.3rem;
}
.coh-chip-x:hover { background: rgba(20, 69, 122, 0.12); }
.coh-chip-x:focus-visible { outline: 2px solid #1d4e89; outline-offset: 1px; }

/* Faculty citation-history sparkline (cumulative total over time) */
.citation-trend svg {
    width: 100%;
    max-width: 320px;
    height: auto;
    display: block;
}

.citation-trend .ct-area {
    fill: rgba(78, 168, 109, 0.18);
    stroke: none;
}

.citation-trend .ct-line {
    fill: none;
    stroke: #3d8c5a;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.citation-trend .ct-dot {
    fill: #2f7548;
}

.citation-trend .ct-year {
    font-size: 10px;
    fill: var(--muted);
}

.citation-trend .ct-total {
    font-size: 11px;
    font-weight: 700;
    fill: #2f7548;
    font-variant-numeric: tabular-nums;
}

.coi-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 0.35rem;
    vertical-align: 1px;
}

.coi-badge-coauthor {
    background: #fde2e2;
    color: #8a1c1c;
}

.coi-badge-phd {
    background: #fde9c8;
    color: #8a4a0a;
}

.coi-badge-school {
    background: #d8e6fb;
    color: #14457a;
}

.coi-preview {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.coi-prev-row {
    padding: 0.3rem 0;
    line-height: 1.55;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.06);
}

.coi-prev-row:last-child { border-bottom: none; }

.coi-prev-badge {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    border-radius: 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 0.4rem;
    vertical-align: 1px;
}

.coi-prev-ok    { background: #d6efd6; color: #1f5d2a; }
.coi-prev-warn  { background: #fde9c8; color: #8a4a0a; }
.coi-prev-miss  { background: #ececec; color: #555; }

.coi-suggest-btn {
    background: #f1f5fb;
    border: 1px solid #cad7e8;
    color: #14457a;
    padding: 0.1rem 0.5rem;
    border-radius: 0.4rem;
    font-size: 0.85rem;
    margin: 0.1rem 0.2rem 0.1rem 0;
    cursor: pointer;
}

.coi-suggest-btn:hover {
    background: #e1ecfa;
    border-color: #9db8d8;
}

.tag-chip {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    margin: 0.1rem 0.25rem 0.1rem 0;
    border: 1px solid transparent;
    line-height: 1.4;
}
a.tag-chip { text-decoration: none; cursor: pointer; }
a.tag-chip:hover { filter: brightness(0.96); border-color: currentColor; }
a.tag-chip:focus-visible {
    outline: 2px solid #1d4e89;
    outline-offset: 2px;
    border-radius: 0.5rem;
}

.tag-topical {
    background: #eaf3ff;
    color: #14457a;
    border-color: #cad7e8;
}

.tag-method {
    background: #efe8fb;
    color: #4b2884;
    border-color: #d3c6ee;
}

.tag-focus {
    background: #e6f6ec;
    color: #1d6b3a;
    border-color: #bfe4cd;
}

.tag-journal {
    background: #fdf2e3;
    color: #8a4b00;
    border-color: #f0d8b0;
}

/* Reviewer Finder results: card/list layout so tags, badges, and the full
   best-matching-paper title wrap freely instead of being truncated. */
.reviewer-results { display: flex; flex-direction: column; gap: 0.7rem; }
.reviewer-card {
    border: 1px solid rgba(207, 216, 227, 0.9);
    border-radius: 0.6rem;
    padding: 0.8rem 1rem;
    background: #fff;
}
.reviewer-card .rc-head {
    display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem;
}
.reviewer-card .rc-rank { color: var(--bs-secondary-color, #6c757d); font-weight: 600; }
.reviewer-card .rc-name { font-weight: 600; }
.reviewer-card .rc-school { color: var(--bs-secondary-color, #6c757d); }
.reviewer-card .rc-score {
    flex: 0 0 auto; font-weight: 700; font-size: 1.05rem; color: #14457a;
}
.reviewer-card .rc-badges { margin-top: 0.45rem; line-height: 1.9; }
.reviewer-card .rc-title {
    margin-top: 0.45rem; font-size: 0.84rem; color: #444; line-height: 1.4;
}
.reviewer-card .rc-email { margin-top: 0.3rem; font-size: 0.84rem; }

.faculty-tags, .paper-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.25rem;
}

/* "Most related papers" disclosure on faculty pages and the all-papers table. */
.related-papers {
    margin-top: 0.35rem;
    font-size: 0.85rem;
}
.related-papers > summary {
    cursor: pointer;
    color: var(--muted);
    width: fit-content;
}
.related-papers > summary:hover { color: var(--brand); }
.related-papers > summary::before {
    content: "\203A";
    display: inline-block;
    margin-right: 0.35rem;
    transition: transform 0.15s ease;
}
.related-papers[open] > summary::before { transform: rotate(90deg); }
.related-list {
    list-style: none;
    margin: 0.35rem 0 0.2rem;
    padding-left: 0.8rem;
    border-left: 2px solid var(--border);
}
.related-list li { margin: 0.35rem 0; line-height: 1.35; }
.related-list li > a { font-weight: 500; }
.related-list .related-meta {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    margin-top: 0.05rem;
}

/* Hide the native disclosure marker across browsers so our ::before chevron
   is the only indicator. The -webkit- variant is in each template's inline
   style block; this one handles Firefox + standards-compliant engines. */
details > summary { list-style: none; }
details > summary::marker { display: none; }

.tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 1rem;
    background: #f7f9fc;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    align-items: center;
}

.tag-filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.tag-filter-group strong {
    margin-right: 0.35rem;
    font-size: 0.85rem;
}

.tag-filter-pill {
    padding: 0.1rem 0.55rem;
    border-radius: 0.6rem;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    background: #fff;
    color: #333;
    cursor: pointer;
    user-select: none;
}
.tag-filter-pill:focus-visible {
    outline: 2px solid #1d4e89;
    outline-offset: 2px;
}

.tag-filter-pill.is-active.topical { background: #14457a; color: #fff; border-color: #14457a; }
.tag-filter-pill.is-active.method  { background: #4b2884; color: #fff; border-color: #4b2884; }

.tag-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    background: #fafbfd;
}

.tag-filter-clear {
    padding: 0.1rem 0.55rem;
    border-radius: 0.6rem;
    font-size: 0.75rem;
    border: 1px solid #c9c9c9;
    background: #fff;
    color: #555;
    cursor: pointer;
}

.stat-card {
    height: 100%;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 252, 0.98));
}

.stat-card .card-body {
    padding: 1.15rem 1rem;
}

.stat-card h3 {
    margin-bottom: 0.2rem;
    color: var(--heading);
    font-size: 1.85rem;
    font-weight: 700;
}

.stat-card small {
    color: var(--muted) !important;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
}

.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 6px 18px rgba(15, 36, 56, 0.05);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.filter-toolbar .toolbar-main,
.filter-toolbar .toolbar-actions,
.filter-toolbar .toolbar-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.filter-toolbar .toolbar-main {
    flex: 1 1 22rem;
}

.filter-toolbar .toolbar-actions {
    justify-content: flex-end;
}

.filter-toolbar .toolbar-meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.toolbar-label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.filter-toolbar .form-control,
.filter-toolbar .form-select {
    border-color: var(--border);
    background: var(--surface);
}

.search-combobox {
    position: relative;
    flex: 1 1 22rem;
    min-width: 0;
}
.search-combobox .form-control { width: 100%; }

.search-suggestions {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 50;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    max-height: 22rem;
    overflow-y: auto;
    background: var(--surface, #fff);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 12px 30px rgba(15, 36, 56, 0.18);
}
.search-suggestions[hidden] { display: none; }
.suggest-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.5rem 0.85rem;
    cursor: pointer;
    line-height: 1.3;
}
.suggest-item + .suggest-item {
    border-top: 1px solid rgba(15, 36, 56, 0.06);
}
.suggest-item.is-active,
.suggest-item:hover {
    background: rgba(15, 36, 56, 0.06);
}
.suggest-name { font-weight: 600; color: var(--text, #1c2733); }
.suggest-nick { font-style: italic; color: var(--muted); font-weight: 500; }
.suggest-school { font-size: 0.85rem; color: var(--muted); }
.search-suggestions mark {
    background: rgba(255, 213, 79, 0.55);
    color: inherit;
    padding: 0;
    border-radius: 2px;
}

.alpha-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
    margin: -0.15rem 0 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.82);
}

.alpha-shortcuts-label {
    margin-right: 0.35rem;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.alpha-shortcuts a,
.alpha-shortcuts span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
}

.alpha-shortcuts a {
    border: 1px solid rgba(29, 78, 137, 0.18);
    background: var(--surface);
    color: var(--brand);
}

.alpha-shortcuts a:hover,
.alpha-shortcuts a:focus {
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.alpha-shortcuts span {
    border: 1px dashed var(--border);
    color: #9aa8b6;
}

.table-card {
    overflow: hidden;
}

.table-card .table-responsive {
    margin-bottom: 0;
}

.table-titlebar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.15rem 0;
}

.table-titlebar h3,
.table-titlebar h5,
.table-titlebar p {
    margin: 0;
}

.results-summary {
    color: var(--muted);
    font-size: 0.9rem;
}

.empty-state {
    margin: 1rem;
    padding: 1rem 1.15rem;
    border: 1px dashed var(--border-strong);
    border-radius: 0.85rem;
    background: var(--surface-muted);
    color: var(--muted);
}

.data-table {
    margin-bottom: 0;
    color: var(--text);
    width: 100%;
    table-layout: fixed;
}

.data-table thead th {
    font-weight: 700;
    color: var(--heading);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.045em;
    padding: 0.85rem 0.9rem;
    background: #eff4fa;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    vertical-align: middle;
    position: sticky;
    top: 0;
    z-index: 3;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
}

/* Bootstrap's .table-responsive applies overflow-x: auto, which creates a
   scroll container that breaks position:sticky on thead th — sticky would
   attach to the wrapper instead of the viewport. Override to overflow:visible
   for our data tables; their fixed layout + ellipsis truncation handle narrow
   widths without needing horizontal scroll. */
.table-responsive:has(> .data-table) {
    overflow: visible;
}

.data-table tbody td {
    height: 4rem;
    max-width: 0;
    padding: 0.8rem 0.9rem;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-color: rgba(207, 216, 227, 0.7);
}

.data-table tbody tr {
    height: 4rem;
    transition: background-color 0.16s ease;
}

/* The All-Faculty table has ~2k rows; skip layout/paint for off-screen rows
   so filtering relayouts only what's near the viewport. Safe here because
   .data-table is table-layout:fixed (column widths don't depend on row
   content) and rows are a fixed height, so the intrinsic-size placeholder
   keeps scrolling stable. */
.faculty-row {
    content-visibility: auto;
    contain-intrinsic-size: auto 4rem;
}

.data-table tbody tr.is-row-alt > * {
    background-color: var(--alt-row);
}

.data-table tbody tr:hover > * {
    background-color: var(--hover-row);
}

.data-table .sticky-head {
    position: sticky;
    top: 0;
    z-index: 5;
}

.data-table td.wrap,
.data-table th.wrap {
    white-space: nowrap;
}

.data-table td.nowrap,
.data-table th.nowrap {
    white-space: nowrap;
}

.directory-table th:first-child,
.directory-table td:first-child {
    padding-left: 1.15rem;
}

.directory-table th:last-child,
.directory-table td:last-child {
    padding-right: 1.15rem;
}

.table-detail-row > td {
    padding: 0.95rem 1.15rem 1.1rem;
    background: #f7fbff !important;
    border-top: 0;
}

.detail-panel {
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    background: var(--surface);
}

.detail-panel .form-label {
    color: var(--muted);
}

.panel-card {
    border-color: var(--border-strong);
    overflow: hidden;
}

.stacked-actions {
    display: grid;
    gap: 1rem;
}

.action-panel-toggle {
    padding: 1rem 1.15rem !important;
    border: 0;
    border-radius: 0;
    background: linear-gradient(180deg, #ffffff, var(--surface-muted)) !important;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.action-panel-toggle:hover,
.action-panel-toggle:focus {
    box-shadow: inset 0 0 0 1px rgba(29, 78, 137, 0.22);
}

.action-panel-toggle h6 {
    color: var(--heading);
}

.action-panel-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.25rem;
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: #fff;
    color: var(--brand-strong);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.admin-panel .card-body,
.panel-card .card-body {
    border-top: 1px solid var(--border);
}

.panel-card .card-header.bg-info-subtle,
.panel-card .card-header.bg-success-subtle {
    background: var(--surface-muted) !important;
}

.panel-card .card-body {
    padding: 1rem 1.1rem;
}

.panel-card .btn,
.filter-toolbar .btn {
    border-width: 1px;
}

.panel-card .table-responsive {
    margin: 0 -1.1rem;
}

.panel-card .data-table th:first-child,
.panel-card .data-table td:first-child {
    padding-left: 1.1rem;
}

.panel-card .data-table th:last-child,
.panel-card .data-table td:last-child {
    padding-right: 1.1rem;
}

.sort-header {
    padding: 0 !important;
}

.sort-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.85rem 0.9rem;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
}

.sort-button:hover {
    background: rgba(29, 78, 137, 0.08);
}
.sort-button:focus-visible {
    background: rgba(29, 78, 137, 0.12);
    outline: 2px solid #1d4e89;
    outline-offset: -2px;
}

.sort-button::after {
    content: "\2195";
    opacity: 0.35;
    font-size: 0.8em;
}

.sort-header[aria-sort="ascending"] .sort-button::after {
    content: "\2191";
    opacity: 1;
}

.sort-header[aria-sort="descending"] .sort-button::after {
    content: "\2193";
    opacity: 1;
}

.status-pill,
.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
}

.status-scraped,
.status-resolved,
.status-flagged,
.status-pending,
.status-manual {
    color: inherit;
}

.status-scraped { background: var(--success-soft); color: #1e6b43; }
.status-resolved { background: var(--brand-soft); color: var(--brand-strong); }
.status-flagged { background: var(--danger-soft); color: #8f2f28; }
.status-pending { background: #edf1f5; color: #5a6877; }
.status-manual { background: #eee6fb; color: #5e3a99; }

.meta-pill {
    background: var(--surface-muted);
    border-color: var(--border);
    color: var(--muted);
}

.badge-discipline {
    display: inline-flex;
    align-items: center;
    min-width: 3.2rem;
    justify-content: center;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.badge-discipline-ops { background: #dcecff; color: #1e4d8a; }
.badge-discipline-scm { background: #d6f3ef; color: #11655d; }
.badge-discipline-ds { background: #dbe0f9; color: #2d3a8c; }
.badge-discipline-marketing { background: #dff0f8; color: #215c73; }
.badge-discipline-management { background: #fff1d6; color: #7b5818; }
.badge-discipline-is { background: #ece6fb; color: #5f43a2; }
.badge-discipline-finance { background: #f9dedd; color: #8a2f31; }
.badge-discipline-accounting { background: #dde4ea; color: #334452; }
.badge-discipline-economics { background: #d9f5ec; color: #1c6b5a; }
.badge-discipline-statistics { background: #dff4fa; color: #1d6170; }
.badge-discipline-cs { background: #ffe8d7; color: #9a4f14; }
.badge-discipline-strategy { background: #dfeeed; color: #2c615d; }
.badge-discipline-other { background: #edf1f5; color: #556577; }

.faculty-table {
    font-size: 0.9rem;
}
@media (min-width: 1025px) {
    .faculty-table { min-width: 1120px; }
}
@media (max-width: 1024px) and (min-width: 768px) {
    .faculty-table thead th,
    .faculty-table tbody td { padding: 0.55rem 0.55rem; }
    .faculty-table { font-size: 0.85rem; }
}

.faculty-count-col {
    text-align: center;
}

.faculty-count-cell {
    text-align: center;
}

.faculty-count-chip {
    display: inline-flex;
    min-width: 2.9rem;
    align-items: center;
    justify-content: center;
    padding: 0.38rem 0.7rem;
    border-radius: 999px;
    background: linear-gradient(180deg, #edf5ff, #dcecff);
    color: var(--brand-strong);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
}

.faculty-count-chip.is-zero {
    background: #edf1f5;
    color: var(--muted);
}

.faculty-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.faculty-links a {
    display: inline-flex;
    align-items: center;
    padding: 0.24rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--brand);
    font-size: 0.78rem;
    text-decoration: none;
}

.faculty-links a:hover {
    background: var(--brand-soft);
    border-color: rgba(29, 78, 137, 0.2);
    text-decoration: none;
}

.faculty-detail-card .card-body h2 {
    font-size: 1.7rem;
    font-weight: 700;
}

.faculty-detail-card .detail-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.65rem 1rem;
    font-size: 0.95rem;
}

.faculty-detail-card .detail-grid dt {
    color: var(--muted);
    font-weight: 600;
    text-align: right;
}

.faculty-detail-card .detail-grid dd {
    margin-bottom: 0;
}

/* Faculty profile hero (monogram + name/title/badges) */
.faculty-hero {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.faculty-avatar {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(15, 36, 56, 0.18);
}

.faculty-hero-body {
    flex: 1 1 auto;
    min-width: 0;
}

.faculty-hero-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
    text-align: right;
}

/* Headline metric tiles */
.metric-tiles {
    margin-top: 0.25rem;
}

.metric-tile .card-body {
    padding: 1rem 1.1rem;
}

.metric-tile-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.metric-tile-head h3 {
    margin-bottom: 0;
    color: var(--heading);
    font-size: 1.85rem;
    font-weight: 700;
}

.metric-tile small {
    color: var(--muted) !important;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
}

.metric-tile-note {
    margin-top: 0.45rem;
    line-height: 1.4;
}

.metric-tile .citation-trend {
    margin-bottom: 0.35rem;
}

@media (max-width: 575.98px) {
    .faculty-avatar { width: 48px; height: 48px; font-size: 1.15rem; }
    .faculty-hero-badges { justify-content: flex-start; }
}

.publications-list li {
    padding-left: 0.6rem;
    border-left: 3px solid var(--brand-soft);
}

.publications-list li:hover {
    border-left-color: var(--brand);
}

.author-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.badge-country {
    font-size: 0.76rem;
    font-weight: 600;
}

.accordion-item {
    border: 1px solid var(--border);
    border-radius: 1rem !important;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(15, 36, 56, 0.05);
}

.accordion-button {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 252, 0.98));
    color: var(--heading);
    font-weight: 600;
}

.accordion-button:not(.collapsed) {
    background: var(--surface);
    color: var(--heading);
}

.toolbar-sticky {
    /* Intentionally non-sticky: only the table column-header row should stick
       on scroll, so readers always see what each column is. */
}

@media (max-width: 991px) {
    .filter-toolbar {
        padding: 0.95rem;
    }

    .filter-toolbar .toolbar-actions {
        justify-content: flex-start;
    }

    .faculty-detail-card .detail-grid {
        grid-template-columns: 1fr;
    }

    .faculty-detail-card .detail-grid dt {
        text-align: left;
    }
}

@media (max-width: 767.98px) {
    .page-hero { padding: 1.15rem 1rem; }
    .stat-card h3 { font-size: 1.55rem; }
    .data-table thead th,
    .data-table tbody td { padding: 0.7rem 0.72rem; }
    .table-titlebar { padding: 0.9rem 0.95rem 0; }

    /* Card layout: tables marked .mobile-cards reflow each <tr> into a
       stacked card. <thead> is hidden; each <td> uses data-label as a key.
       Overrides reset the desktop-only `.data-table tbody td` rules
       (height: 4rem; max-width: 0; overflow: hidden; white-space: nowrap)
       that would otherwise clip every cell to zero. */
    .data-table.mobile-cards {
        display: block;
        width: 100%;
        min-width: 0 !important;
        font-size: 0.92rem;
    }
    .data-table.mobile-cards colgroup { display: none; }
    .data-table.mobile-cards thead { display: none; }
    .data-table.mobile-cards tbody { display: block; width: 100%; }
    .data-table.mobile-cards tbody tr {
        display: block;
        width: 100%;
        height: auto;
        border: 1px solid var(--bs-border-color, #dee2e6);
        border-radius: 0.5rem;
        padding: 0.55rem 0.75rem;
        margin-bottom: 0.6rem;
        background: #fff;
        box-sizing: border-box;
    }
    .data-table.mobile-cards tbody tr:hover > * { background: transparent; }
    .data-table.mobile-cards tbody tr.is-row-alt { background: #fafbfd; }
    .data-table.mobile-cards tbody tr.is-row-alt > * { background: transparent; }
    .data-table.mobile-cards tbody td {
        display: block;
        height: auto;
        max-width: none;
        overflow: visible;
        white-space: normal;
        text-overflow: clip;
        border: none;
        padding: 0.3rem 0;
        line-height: 1.4;
    }
    .data-table.mobile-cards tbody td::before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: var(--muted, #6c757d);
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        margin-right: 0.4rem;
    }
    .data-table.mobile-cards tbody td:not([data-label])::before,
    .data-table.mobile-cards tbody td[data-label=""]::before { content: none; }
    .data-table.mobile-cards tbody td.cell-primary {
        border-bottom: 1px solid var(--bs-border-color, #dee2e6);
        padding-bottom: 0.5rem;
        margin-bottom: 0.45rem;
        font-size: 1rem;
        font-weight: 600;
    }
    .data-table.mobile-cards tbody td.cell-primary::before { content: none; }
    /* Restore wrapping on cells that desktop-styled with nowrap */
    .data-table.mobile-cards tbody td.wrap,
    .data-table.mobile-cards tbody td.nowrap { white-space: normal; }
    /* Per-cell directory-table edge padding overrides (lines 535-543) bite
       through the cards layout — neutralize them. */
    .directory-table.mobile-cards td:first-child,
    .directory-table.mobile-cards td:last-child { padding-left: 0; padding-right: 0; }

    /* Filter toolbar stacks on phone; pills get bigger tap targets. */
    .tag-filter-bar { padding: 0.5rem; }
    .tag-filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
        width: 100%;
    }
    .tag-filter-pill { min-height: 40px; padding: 0.5rem 0.7rem; font-size: 0.85rem; }
    .tag-filter-clear { min-height: 40px; padding: 0.5rem 0.7rem; }
    .filter-toolbar .toolbar-main { flex-direction: column; align-items: stretch; }
    .filter-toolbar .toolbar-meta { flex-wrap: wrap; gap: 0.4rem; }
    .sort-toggle .btn { flex: 1 1 auto; }

    /* Faculty-table min-width should never apply on phone. */
    .faculty-table { min-width: 0; }
}

/* Productivity column + chip */
.productivity-col { text-align: center; }
.productivity-cell {
    text-align: center;
    white-space: nowrap;
    padding: 0.4rem 0.5rem;
    overflow: visible;
    text-overflow: clip;
}

/* Action column (edit + delete), the Name cell (which now carries the title
   as a subtitle), and the tag cell shouldn't truncate -- the Name wraps to a
   second line instead of being clipped. */
.faculty-table tbody td:last-child,
.faculty-table tbody td.cell-primary,
.faculty-table tbody td.tag-cell {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}
.faculty-table tbody td.tag-cell { padding: 0.55rem 0.75rem; }
.productivity-chip {
    display: inline-flex;
    min-width: 3.1rem;
    align-items: center;
    justify-content: center;
    padding: 0.32rem 0.65rem;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1;
    border: 1px solid #cdd2d8;
    background: #e9ecef;
    color: #1a3a2a;
}
.productivity-chip.is-blank {
    background: transparent;
    color: var(--muted);
    border-color: transparent;
    font-weight: 500;
}

/* Productivity / leaderboard styling */
.medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.6rem;
    padding: 0 .4rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: .72rem;
    margin-left: .4rem;
    vertical-align: middle;
    text-decoration: none;
}
.medal-gold   { background: #f4c542; color: #3a2900; border: 1px solid #c69800; }
.medal-silver { background: #dde0e3; color: #1a252d; border: 1px solid #8d98a4; }
.medal-bronze { background: #e0a07a; color: #2a1200; border: 1px solid #8a4d1e; }
/* Impact medals: cool blue/violet palette + rounded-square shape + monospace
   numerals so they read as visually distinct from the warm circular
   productivity podium, even when both appear on the same row. */
.medal[class*="medal-impact-"] {
    border-radius: .3rem;
    font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: -.02em;
}
.medal-impact-gold   { background: #5d8df0; color: #08152e; border: 1px solid #2f59ad; }
.medal-impact-silver { background: #b8c4e0; color: #141b2c; border: 1px solid #6c7a99; }
.medal-impact-bronze { background: #9279c4; color: #14082e; border: 1px solid #553b94; }
a.medal:hover { filter: brightness(0.95); }

/* Award badges: like medals in size/shape, but they reward a qualitative
   attribute (e.g. practitioner outreach) rather than a leaderboard rank, so
   they carry an icon instead of a number and use their own palette. */
.award-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 999px;
    margin-left: .4rem;
    vertical-align: middle;
    text-decoration: none;
    line-height: 1;
}
.award-practitioner { background: #d8efe9; color: #0f5d52; border: 1px solid #2f9183; }
.award-science { background: #ede7f6; color: #5e35b1; border: 1px solid #9575cd; }
.award-economics { background: #faedcc; color: #8a5a00; border: 1px solid #d4a017; }
.award-cs { background: #e3eef7; color: #1f5b87; border: 1px solid #6aa0c4; }
a.award-badge:hover { filter: brightness(0.95); }

/* Productivity ↔ Impact toggle on leaderboard pages. */
.metric-toggle {
    display: inline-flex;
    border-radius: 999px;
    overflow: hidden;
    background: #eef0f3;
    padding: .15rem;
    margin: .6rem 0 1rem;
    gap: .15rem;
}
.metric-toggle button {
    border: 0;
    background: transparent;
    color: #344;
    font-weight: 600;
    padding: .35rem .9rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: .9rem;
}
.metric-toggle button.is-active {
    background: #2c4a78;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.metric-col-hidden { display: none !important; }

/* Name + medal cells: the name truncates with an ellipsis while the medals
   stay pinned (flex: 0 0 auto) so they're never clipped off the right edge of
   a fixed-layout table cell, no matter how long the name is. */
.school-name-wrap,
.name-medal-wrap {
    display: flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
}
.school-name-link,
.name-medal-wrap > a:not(.medal) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 0 1 auto;
}
.school-name-wrap .medal,
.name-medal-wrap .medal,
.school-name-wrap .award-badge,
.name-medal-wrap .award-badge {
    flex: 0 0 auto;
    margin-left: 0;
}

.data-pull-caption {
    color: var(--muted);
    font-size: .85rem;
    margin-top: .35rem;
}

.productivity-value {
    font-variant-numeric: tabular-nums;
}

.leaderboard-table td, .leaderboard-table th {
    vertical-align: middle;
}

/* Column-width helpers — replace inline `style="width:N%"` on table headers. */
.col-w-5  { width: 5%; }
.col-w-6  { width: 6%; }
.col-w-7  { width: 7%; }
.col-w-8  { width: 8%; }
.col-w-9  { width: 9%; }
.col-w-10 { width: 10%; }
.col-w-11 { width: 11%; }
.col-w-12 { width: 12%; }
.col-w-13 { width: 13%; }
.col-w-14 { width: 14%; }
.col-w-15 { width: 15%; }
.col-w-16 { width: 16%; }
.col-w-18 { width: 18%; }
.col-w-19 { width: 19%; }
.col-w-20 { width: 20%; }
.col-w-21 { width: 21%; }
.col-w-22 { width: 22%; }
.col-w-24 { width: 24%; }
.col-w-25 { width: 25%; }
.col-w-28 { width: 28%; }
.col-w-30 { width: 30%; }
.col-w-32 { width: 32%; }
.col-w-35 { width: 35%; }
.col-w-38 { width: 38%; }
.col-w-40 { width: 40%; }
.col-w-42 { width: 42%; }
.col-w-47 { width: 47%; }
.col-w-48 { width: 48%; }

/* Per-page utilities replacing one-off inline styles. */
.faculty-title-line { font-size: 1.05rem; }
.col-w-actions { width: 110px; }

/* Methodology page. The body fills the page container so the params grid
   can expand and table-heavy prose has room to breathe; the prose itself
   keeps a soft max-width to stay legible on wide monitors. */
.methodology-body > * { width: 100%; }
.methodology-prose { max-width: 72rem; }

.methodology-params {
    background: #f8f9fa;
    border: 1px solid #e3e6ea;
    border-radius: .6rem;
    padding: 1.15rem 1.35rem;
}
.methodology-params > h2 {
    letter-spacing: .05em;
    font-size: .72rem;
}
.methodology-params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: .9rem 1.5rem;
    margin: 0 0 .85rem;
}
.methodology-params-grid > div {
    display: flex;
    flex-direction: column;
    border-left: 2px solid #dde1e6;
    padding-left: .65rem;
}
.methodology-params-grid dt {
    font-size: .78rem;
    line-height: 1.25;
    color: #6c757d;
    font-weight: 500;
}
.methodology-params-grid dd {
    margin: .15rem 0 0;
    font-size: 1.1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.methodology-prose { line-height: 1.7; }
.methodology-prose h2 {
    font-size: 1.3rem;
    margin-top: 2.4rem;
    padding-top: .85rem;
    border-top: 1px solid #eef0f2;
}
.methodology-prose h2:first-of-type {
    margin-top: 1.25rem;
    padding-top: 0;
    border-top: none;
}
.methodology-prose p,
.methodology-prose ul { margin-bottom: 1rem; }
.methodology-prose ul { padding-left: 1.3rem; }
.methodology-prose li { margin-bottom: .35rem; }
.methodology-prose li:last-child { margin-bottom: 0; }
.methodology-prose blockquote {
    border-left: 3px solid #0d6efd;
    background: #f6f8fb;
    margin: 1.15rem 0;
    padding: .7rem 1rem;
    border-radius: 0 .35rem .35rem 0;
    color: #374151;
}
.methodology-prose blockquote > :last-child { margin-bottom: 0; }
.methodology-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: .95rem;
}
.methodology-prose th,
.methodology-prose td {
    border: 1px solid #e3e6ea;
    padding: .45rem .65rem;
    text-align: left;
}
.methodology-prose th { background: #f1f3f5; }
