* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f5f3;
  --panel: #ffffff;
  --ink: #191918;
  --mut: #85857f;
  --line: #ececе8;
  --line2: #e7e7e2;
  --amber: #f7c566;
  --amber-soft: #fbeed3;
  --amber-deep: #eab04b;
  --green-soft: #e1f4e5;
  --green-ink: #2f7d44;
  --red-soft: #fce7e5;
  --red-ink: #c2453b;
  --chip: #f2f2ef;
  --radius: 16px;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidenav {
  width: 216px; flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line2);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; text-decoration: none; }
.brand-badge {
  width: 38px; height: 38px; border-radius: 12px; background: #1c1c1a;
  color: var(--amber); font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.brand-name { display: block; color: var(--ink); font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; }
.brand-sub { display: block; color: var(--mut); font-size: 11.5px; }

.nav-label { padding: 4px 10px 8px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #b3b3ac; font-weight: 600; }
.sidenav nav { display: flex; flex-direction: column; gap: 2px; }
.sidenav nav a {
  display: flex; align-items: center; gap: 10px;
  color: #55554f; text-decoration: none; padding: 9px 12px; font-size: 13.5px; font-weight: 500;
  border-radius: 12px;
}
.sidenav nav a svg { width: 17px; height: 17px; stroke: currentColor; flex-shrink: 0; }
.sidenav nav a:hover { background: var(--chip); color: var(--ink); }
.sidenav nav a.active { background: var(--amber-soft); color: var(--ink); font-weight: 600; }

.sidenav-foot { margin-top: auto; }
.foot-note { padding: 10px; font-size: 12px; color: var(--mut); line-height: 1.6; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
main { padding: 28px 32px; max-width: 1500px; width: 100%; }
.foot { margin-top: auto; padding: 16px; text-align: center; color: #b3b3ac; font-size: 12px; }

.page-title { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.page-sub { color: var(--mut); margin: 4px 0 22px; font-size: 13.5px; }
.page-narrow { max-width: 1050px; }

.flash { padding: 12px 32px; font-weight: 500; font-size: 13.5px; }
.flash.ok { background: var(--green-soft); color: var(--green-ink); }
.flash.err { background: var(--red-soft); color: var(--red-ink); }

/* ---------- stat tiles & highlight cards ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); gap: 14px; margin-bottom: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 1px 2px rgba(25,25,20,.03); }
.tile-head { display: flex; justify-content: space-between; align-items: center; color: var(--mut); font-size: 13px; font-weight: 500; }
.tile-ico { opacity: .75; font-size: 15px; }
.tile-num { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin-top: 6px; }
.tile.hi .hi-rank { display: inline-block; background: var(--chip); color: var(--mut); font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; margin: 10px 0 4px; }
.hi-name { display: block; color: var(--ink); font-weight: 700; text-decoration: none; font-size: 15px; }
.hi-name:hover { text-decoration: underline; text-decoration-color: var(--amber-deep); }
.hi-sub { color: var(--mut); font-size: 12.5px; margin-top: 3px; }
.hi-stats { display: flex; gap: 22px; margin-top: 12px; }
.hi-stats span { font-size: 12px; color: var(--mut); }
.hi-stats b { display: block; color: var(--ink); font-size: 16px; font-weight: 700; }

/* ---------- inputs & buttons ---------- */
input, select {
  padding: 10px 13px; border: 1px solid var(--line2); border-radius: 12px;
  font-size: 13.5px; background: var(--panel); width: 100%; color: var(--ink);
  font-family: inherit;
}
input::placeholder { color: #b3b3ac; }
input:focus, select:focus { outline: 2px solid rgba(234,176,75,.35); border-color: var(--amber-deep); }

.btn {
  display: inline-block; padding: 10px 20px; border-radius: 12px;
  border: 1px solid var(--line2); background: var(--panel); color: var(--ink);
  cursor: pointer; font-size: 13.5px; font-weight: 600; text-decoration: none; text-align: center;
  font-family: inherit;
}
.btn:hover { background: var(--chip); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #1c1c1a; }
.btn.primary:hover { background: var(--amber-deep); }
.btn.wide { width: 100%; margin-top: 10px; }

.searchbar { display: flex; gap: 10px; margin-bottom: 18px; }
.searchbar .within { flex: 0 0 225px; }
.searchbar input[type="search"] { flex: 1; }

.layout { display: flex; gap: 18px; align-items: flex-start; }

/* ---------- filters panel ---------- */
.filters {
  width: 268px; flex-shrink: 0; background: var(--panel);
  border: 1px solid var(--line2); border-radius: var(--radius); padding: 18px;
  position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto;
  box-shadow: 0 1px 2px rgba(25,25,20,.03);
}
.filters h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.01em; }
.filters details { border-top: 1px solid var(--line2); padding: 12px 0; }
.filters details:first-of-type { border-top: none; }
.filters summary { font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--mut); cursor: pointer; margin-bottom: 9px; list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.row2 { display: flex; gap: 8px; }

.checklist { max-height: 240px; overflow-y: auto; }
.checklist label { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; font-size: 13px; }
.checklist input { width: 15px; height: 15px; accent-color: var(--amber-deep); }
.checklist .cnt { margin-left: auto; color: #b3b3ac; font-size: 12px; font-variant-numeric: tabular-nums; }

.results { flex: 1; min-width: 0; }

/* ---------- publication cards ---------- */
.pub {
  background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(25,25,20,.03);
}
.pub-head { display: flex; gap: 12px; align-items: center; font-size: 12.5px; margin-bottom: 7px; flex-wrap: wrap; }
.doc-type { background: var(--chip); color: #55554f; padding: 3px 11px; border-radius: 20px; font-weight: 600; font-size: 12px; }
.pub-meta { color: var(--mut); }
.cited { margin-left: auto; background: var(--green-soft); color: var(--green-ink); font-weight: 600; font-size: 12px; padding: 3px 11px; border-radius: 20px; }
.pub-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 6px; }
.pub-authors { line-height: 1.8; font-size: 13px; }
.pub-authors .author { color: #454540; text-decoration: none; }
.pub-authors .author:hover { text-decoration: underline; text-decoration-color: var(--amber-deep); }
.pub-authors .author.first { font-weight: 700; color: var(--ink); }
.pub-authors .mail { margin-left: 2px; }
.pub-authors .sep { color: #c9c9c2; margin-right: 5px; }
.pub-foot { margin-top: 8px; font-size: 12.5px; display: flex; gap: 16px; flex-wrap: wrap; }
.pub-foot a { color: var(--ink); font-weight: 600; text-decoration: none; }
.pub-foot a:hover { text-decoration: underline; text-decoration-color: var(--amber-deep); }
.pub-foot .emails, .pub-foot .role { color: var(--mut); }
.legend { color: #b3b3ac; font-size: 12.5px; margin: 10px 2px; }
.empty { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); padding: 48px; text-align: center; color: var(--mut); }

/* ---------- pager ---------- */
.pager { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.pg { padding: 7px 16px; border: 1px solid var(--line2); background: var(--panel); border-radius: 12px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 13px; }
.pg:not(.disabled):hover { background: var(--chip); }
.pg.disabled { opacity: .35; }
.pg-info { color: var(--mut); font-size: 13px; }

/* ---------- tables ---------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px rgba(25,25,20,.03); }
.tbl th, .tbl td { padding: 12px 14px; text-align: left; }
.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); font-weight: 600; border-bottom: 1px solid var(--line2); }
.tbl td { border-bottom: 1px solid #f4f4f1; font-size: 13.5px; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #fafaf8; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl a { color: var(--ink); font-weight: 600; text-decoration: none; }
.tbl a:hover { text-decoration: underline; text-decoration-color: var(--amber-deep); }

/* ---------- cards & metrics ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line2); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(25,25,20,.03);
}
.card h3 { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 14px; }
.profile h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.muted { color: var(--mut); }
.muted a { color: var(--ink); font-weight: 600; text-decoration: none; }
.metrics { display: flex; gap: 30px; margin: 18px 0; flex-wrap: wrap; }
.metric .num { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.metric .lbl { font-size: 12px; color: var(--mut); margin-top: 2px; }

.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 4px; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; background: #1c1c1a; color: var(--amber);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 19px; flex-shrink: 0;
}
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip { background: var(--chip); color: #55554f; padding: 4px 13px; border-radius: 20px; font-size: 12.5px; text-decoration: none; }
.chip b { color: var(--ink); font-weight: 600; }
a.chip:hover { background: var(--amber-soft); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; margin: 18px 0 6px; }
.stat-grid.three { grid-template-columns: repeat(3, minmax(120px, 220px)); }
.stat { background: #fafaf8; border: 1px solid var(--line2); border-radius: 14px; padding: 13px 15px; }
.stat .num { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.stat .lbl { font-size: 11.5px; color: var(--mut); margin-top: 2px; }

.live-card { border: 1px solid var(--line2); border-radius: 14px; padding: 16px 20px; margin-top: 14px; background: var(--panel); }
.live-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live-head h3 { font-size: 13.5px; font-weight: 700; margin: 0; }
.live-action { margin-left: auto; }
.pill { background: var(--chip); color: var(--mut); font-size: 11.5px; font-weight: 600; padding: 3px 11px; border-radius: 20px; }
.pill.green { background: var(--green-soft); color: var(--green-ink); }
.small { font-size: 12.5px; }

.scopus-card { border: 1px dashed var(--line2); border-radius: 14px; padding: 16px 20px; margin-top: 10px; }
.scopus-card.ok { border-style: solid; border-color: #bfe5c8; background: #f4fbf5; }
.scopus-card h3 { font-size: 13.5px; font-weight: 700; margin-bottom: 8px; }
.warn { color: #8a5a17; background: var(--amber-soft); padding: 10px 14px; border-radius: 12px; margin: 10px 0; font-size: 13px; }
.warn code { background: #f3ddb0; padding: 1px 6px; border-radius: 6px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ---------- charts ---------- */
.bars { margin-top: 6px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.bar-y { width: 42px; text-align: right; color: var(--mut); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.bar-track { flex: 1; background: #f0f0ec; border-radius: 20px; height: 16px; }
.bar-fill { background: #8fabec; height: 100%; border-radius: 20px; min-width: 3px; }
.bar-n { width: 72px; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

.donut-wrap { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.donut { width: 168px; height: 168px; border-radius: 50%; position: relative; flex-shrink: 0; }
.donut::after { content: ""; position: absolute; inset: 26%; background: var(--panel); border-radius: 50%; }
.donut-legend { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.donut-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }
.donut-legend b { font-weight: 700; }

/* ---------- ranked lists & tags ---------- */
.rank-list { list-style: none; counter-reset: rank; }
.rank-list li {
  counter-increment: rank; display: flex; align-items: baseline; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #f4f4f1; font-size: 13.5px;
}
.rank-list li:last-child { border-bottom: none; }
.rank-list li::before { content: counter(rank); background: var(--chip); color: var(--mut); font-weight: 700; font-size: 11px; min-width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.rank-list a { color: var(--ink); font-weight: 600; text-decoration: none; }
.rank-list a:hover { text-decoration: underline; text-decoration-color: var(--amber-deep); }
.rank-val { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { background: var(--chip); color: #454540; padding: 5px 13px; border-radius: 20px; text-decoration: none; font-size: 12.5px; font-weight: 500; }
.tag b { font-weight: 700; color: var(--ink); }
.tag:hover { background: var(--amber-soft); }
.tag.rising { background: var(--green-soft); color: var(--green-ink); }
.tag.rising b { color: var(--green-ink); }

.ranked { padding-left: 20px; }
.ranked li { margin-bottom: 8px; line-height: 1.55; font-size: 13.5px; }
.ranked .cnt { color: #b3b3ac; font-size: 12.5px; }
.ranked a { color: var(--ink); font-weight: 600; text-decoration: none; }

.loading { text-align: center; color: var(--mut); padding: 40px !important; }

.pub-funders { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 9px; padding-top: 9px; border-top: 1px solid #f4f4f1; }
.pub-funders .chip { padding: 3px 11px; font-size: 12px; }
.funding-raw summary { color: var(--mut); font-size: 12px; cursor: pointer; }
.funding-raw p { margin-top: 6px; font-size: 12.5px; color: #55554f; line-height: 1.6; max-width: 900px; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; font-weight: 600; color: var(--mut); margin-bottom: 6px; }
.award-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f4f4f1; }
.award-row:last-child { border-bottom: none; }
.award-row .btn { margin-left: auto; }
.award-name { color: var(--ink); font-weight: 700; text-decoration: none; font-size: 14px; }
.award-name:hover { text-decoration: underline; text-decoration-color: var(--amber-deep); }
.evidence { list-style: none; }
.evidence li { padding: 7px 0; border-bottom: 1px solid #f4f4f1; font-size: 13.5px; }
.evidence li:last-child { border-bottom: none; }
.evidence a { color: var(--ink); font-weight: 600; }

.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line2);
  border-radius: 20px; padding: 32px; box-shadow: 0 8px 30px rgba(25,25,20,.06);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-card h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.login-error { background: var(--red-soft); color: var(--red-ink); padding: 10px 14px; border-radius: 12px; font-size: 13px; margin-bottom: 14px; }
.login-remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mut); margin: 4px 0 16px; cursor: pointer; }
.login-remember input { width: 15px; height: 15px; accent-color: var(--amber-deep); }
.login-foot { color: #b3b3ac; font-size: 12px; margin-top: 18px; }

.sidenav-user { padding: 10px; border-top: 1px solid var(--line2); margin-top: 10px; }
.sidenav-user .who { font-size: 12.5px; color: var(--mut); margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; }
.sidenav-user button { width: 100%; }

@media (max-width: 960px) {
  .app { flex-direction: column; }
  .sidenav { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 10px 12px; gap: 4px; }
  .brand { padding: 4px 8px; }
  .sidenav nav { flex-direction: row; flex-wrap: wrap; }
  .nav-label, .sidenav-foot { display: none; }
  main { padding: 18px 16px; }
  .layout { flex-direction: column; }
  .filters { width: 100%; position: static; max-height: none; }
  .searchbar { flex-wrap: wrap; }
  .searchbar .within { flex-basis: 100%; }
  .two-col, .three-col { grid-template-columns: 1fr; }
}
