:root {
  --ink: #182236;
  --ink-soft: #4a566e;
  --muted: #74809a;
  --primary: #1b4b8f;
  --primary-dark: #143a70;
  --accent: #0e8a6d;
  --gold: #e8a13c;
  --bg: #f6f8fb;
  --card: #ffffff;
  --border: #e2e8f2;
  --danger: #b3372f;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(24, 34, 54, .07), 0 8px 24px rgba(24, 34, 54, .05);
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}
img, svg { max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; color: var(--ink); }
h1 { font-size: 2rem; margin-bottom: .6em; }
h2 { font-size: 1.4rem; margin: 1.4em 0 .5em; }
h3 { font-size: 1.05rem; }
code { background: #edf1f7; padding: .1em .4em; border-radius: 5px; font-size: .9em; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }
.section { padding: 2.2rem 20px; }
.muted { color: var(--muted); }
.muted-sm { color: var(--muted); font-size: .85rem; }
.accent { color: var(--accent); }
.break-all { word-break: break-all; }

/* ---------- Header ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand em { color: var(--primary); font-style: normal; }
.brand-mark { flex-shrink: 0; }
.site-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.site-nav a { color: var(--ink-soft); font-weight: 500; font-size: .95rem; }
.site-nav a:hover { color: var(--primary); text-decoration: none; }
.inline-form { display: inline; }
.link-btn { background: none; border: none; color: var(--ink-soft); font: inherit; font-weight: 500; font-size: .95rem; cursor: pointer; padding: 0; }
.link-btn:hover { color: var(--danger); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: .55em 1.2em; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card); color: var(--ink);
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-align: center;
}
.btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: #e5c3c0; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: .35em .8em; font-size: .85rem; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(160deg, #10305c 0%, #1b4b8f 55%, #176352 100%);
  color: #fff; padding: 4.2rem 0 3.4rem; text-align: center;
}
.hero h1 { color: #fff; font-size: clamp(1.9rem, 4.5vw, 3rem); margin-bottom: .4em; }
.hero .accent { color: #7fe0c3; }
.hero-sub { max-width: 620px; margin: 0 auto 1.8rem; color: #cfe0f5; font-size: 1.05rem; }
.hero-search { display: flex; max-width: 620px; margin: 0 auto 2rem; gap: 8px; }
.hero-search input {
  flex: 1; padding: .8em 1.1em; border-radius: 8px; border: none; font: inherit; font-size: 1rem;
}
.hero-search .btn { font-size: 1rem; }
.hero-stats { display: flex; justify-content: center; gap: 3rem; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.7rem; font-family: var(--font-display); }
.hero-stats span { color: #a9c3e4; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Cards / lists ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 1rem; }
.section-head h1, .section-head h2 { margin: 0; }
.see-all { font-weight: 600; font-size: .9rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.record-card {
  display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); color: var(--ink);
}
.record-card:hover { text-decoration: none; border-color: var(--primary); transform: translateY(-1px); }
.record-card h3 { margin: .55em 0 .3em; font-size: 1.02rem; line-height: 1.35; }
.card-authors { color: var(--ink-soft); font-size: .88rem; }
.card-meta { color: var(--muted); font-size: .8rem; margin-top: .5em; }

.type-badge {
  display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: .25em .7em; border-radius: 999px; background: #e8eef7; color: var(--primary);
}
.type-dataset { background: #e2f4ee; color: var(--accent); }
.type-preprint { background: #fdf1de; color: #a06818; }
.type-thesis { background: #f0e8f7; color: #6d3fa0; }
.type-software { background: #e8f2f4; color: #16697a; }
.type-poster, .type-presentation { background: #fbe9ec; color: #a03050; }

.popular-list { margin-left: 1.3em; }
.popular-list li { padding: .35em 0; }
.popular-list .muted { display: block; font-size: .85rem; }

.empty-state {
  background: var(--card); border: 1px dashed var(--border); border-radius: var(--radius);
  text-align: center; padding: 3rem 1.5rem; color: var(--muted);
}
.empty-state .btn { margin-top: 1rem; }

.how-it-works .steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-top: 1rem; }
.step { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff;
  font-weight: 700; margin-bottom: .7em; font-family: var(--font-display);
}
.step h3 { margin-bottom: .35em; }
.step p { color: var(--ink-soft); font-size: .92rem; }

/* ---------- Browse ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin: 1.2rem 0 .6rem; }
.filter-bar input[type="search"] { flex: 2 1 260px; }
.filter-bar select { flex: 1 1 140px; }
.filter-bar input, .filter-bar select {
  padding: .6em .9em; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--card);
}
.result-count { margin-bottom: 1rem; }
.result-list { display: flex; flex-direction: column; gap: 14px; }
.result-item {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.result-item h2 { font-size: 1.12rem; margin: .45em 0 .2em; }
.result-abstract { color: var(--ink-soft); font-size: .92rem; margin-top: .4em; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 1.5rem; margin-top: 1.6rem; font-weight: 600; }

/* ---------- Record page ---------- */
.record-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.record-title { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: .4em 0 .5em; }
.author-list { list-style: none; margin-bottom: 1rem; }
.author-list li { padding: .15em 0; font-size: .97rem; }
.author-name { font-weight: 600; }
.orcid {
  font-size: .7rem; font-weight: 700; background: #a6ce39; color: #fff; border-radius: 4px;
  padding: .1em .45em; margin-left: .5em; vertical-align: middle;
}
.orcid:hover { text-decoration: none; opacity: .85; }
.record-section { margin-top: 1.6rem; }
.record-section h2 { font-size: 1.15rem; margin: 0 0 .5em; }
.abstract { white-space: normal; color: var(--ink-soft); }
.keyword-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  padding: .25em .85em; font-size: .85rem; color: var(--ink-soft);
}
.tag:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.file-list { list-style: none; }
.file-list li { margin-bottom: 8px; }
.file-link {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; color: var(--ink);
}
.file-link:hover { border-color: var(--primary); text-decoration: none; }
.file-link:hover .file-name { color: var(--primary); }
.file-name { font-weight: 600; word-break: break-all; }
.citation-box {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px;
  font-size: .92rem; color: var(--ink-soft);
}
.citation-box .btn { margin-top: 10px; }
.bibtex-details { margin-top: 10px; }
.bibtex-details summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.bibtex-details pre {
  background: #182236; color: #cfe0f5; border-radius: 8px; padding: 14px; margin: 10px 0;
  overflow-x: auto; font-size: .82rem; line-height: 1.5;
}
.side-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.side-card h3 { margin-bottom: .7em; font-size: 1rem; }
.meta-list dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: .8em; }
.meta-list dd { font-size: .92rem; }
.meta-list dt:first-child { margin-top: 0; }
.stat-row { display: flex; align-items: baseline; gap: 8px; padding: .2em 0; }
.stat-row strong { font-size: 1.3rem; font-family: var(--font-display); }
.stat-row span { color: var(--muted); font-size: .85rem; }
.manage-card { display: flex; flex-direction: column; gap: 8px; }
.manage-card h3 { margin-bottom: 0; }
.manage-card .btn { width: 100%; }

/* ---------- Forms ---------- */
.stack-form { display: flex; flex-direction: column; gap: 18px; margin: 1.2rem 0 2rem; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 600; font-size: .92rem; }
.field > span em { color: var(--danger); font-style: normal; }
.field input, .field textarea, .field select {
  padding: .65em .9em; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--card);
  width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid rgba(27, 75, 143, .35); border-color: var(--primary);
}
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.author-row { display: grid; grid-template-columns: 1.2fr 1.2fr .9fr auto; gap: 8px; margin-bottom: 8px; }
.author-row input { padding: .55em .8em; border: 1px solid var(--border); border-radius: 8px; font: inherit; min-width: 0; }
.remove-author { color: var(--muted); }
.form-actions { display: flex; gap: 10px; }
.edit-file-list { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; background: var(--card); }
.edit-file-list li { margin: 4px 0; }
.file-del-label { display: flex; gap: 10px; align-items: baseline; cursor: pointer; flex-wrap: wrap; }
.error-list { margin-left: 1.2em; }
.hp-field { position: absolute; left: -9999px; top: -9999px; }
.auth-page { max-width: 460px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th {
  text-align: left; padding: 12px 14px; font-size: .75rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.table-actions { white-space: nowrap; }
.table-actions form { display: inline; }
.status { font-size: .78rem; font-weight: 700; text-transform: capitalize; padding: .2em .7em; border-radius: 999px; }
.status-published { background: #e2f4ee; color: var(--accent); }
.status-removed { background: #fbe9ec; color: var(--danger); }

/* ---------- Flash ---------- */
.flash { border-radius: 8px; padding: 12px 16px; margin: 14px 0; font-size: .95rem; }
.flash-success { background: #e2f4ee; color: #0b5c49; border: 1px solid #bde3d6; }
.flash-error { background: #fbe9ec; color: #7c2620; border: 1px solid #efc7c4; }

/* ---------- Prose ---------- */
.prose p, .prose ul { margin-bottom: 1em; color: var(--ink-soft); }
.prose ul { margin-left: 1.4em; }
.prose h2 { margin-top: 1.6em; }
.prose strong { color: var(--ink); }

/* ---------- Breadcrumbs, FAQ, type pages ---------- */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.crumbs span { margin: 0 .35em; }
.lede { font-size: 1.05rem; color: var(--ink-soft); margin-bottom: 1.4em; }
.faq-list { display: flex; flex-direction: column; gap: 4px; }
.faq-item {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 12px;
}
.faq-item h2 { font-size: 1.08rem; margin: 0 0 .5em; }
.faq-item p { color: var(--ink-soft); margin: 0; }
.faq-cta { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--border); }
.type-nav { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.type-nav h2 { font-size: 1.05rem; margin-bottom: .8em; }
.archive-list { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.archive-list li {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px;
}
.archive-list li a { font-weight: 600; }
.archive-list .muted { font-size: .85rem; margin-left: .4em; }
/* ---------- Import ---------- */
.import-option {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 18px;
}
.import-option h2 { margin: 0 0 .3em; font-size: 1.15rem; }
.import-option p { margin-bottom: .9em; font-size: .92rem; }
.import-option .filter-bar { margin: 0; }
.import-preview .preview-title { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: .8em; }
.import-preview .preview-abstract { margin-top: 1em; font-size: .92rem; color: var(--ink-soft); }
.orcid-works { list-style: none; }
.orcid-works li { margin-bottom: 8px; }
.orcid-works form {
  display: flex; align-items: center; gap: 14px; justify-content: space-between;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px;
}
.orcid-works .work-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.orcid-works .work-main strong { font-size: .95rem; }
.orcid-works button { flex-shrink: 0; }
.checkbox-line { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .92rem; }
.checkbox-line input { width: auto; margin-top: .25em; flex-shrink: 0; }
.rights-check { background: #fdf6e8; border: 1px solid #f0dcb4; border-radius: 8px; padding: 14px 16px; }
.biblio-details {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px;
}
.biblio-details summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.biblio-details .field-row { margin-top: 14px; }

.locked-field {
  padding: .65em .9em; border: 1px solid var(--border); border-radius: 8px;
  background: #eef2f7; color: var(--ink-soft);
}

/* ---------- Error page ---------- */
.error-page { text-align: center; padding-top: 4rem; padding-bottom: 4rem; }
.error-page h1 { font-size: 5rem; color: var(--border); -webkit-text-stroke: 2px var(--muted); }

/* ---------- Footer ---------- */
.site-footer { background: #10203a; color: #b6c4dd; margin-top: 3rem; padding: 2.5rem 0 1.2rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.site-footer strong { color: #fff; font-family: var(--font-display); font-size: 1.1rem; }
.site-footer p { max-width: 420px; font-size: .9rem; margin-top: .4em; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { color: #b6c4dd; font-size: .92rem; }
.footer-links a:hover { color: #fff; }
.footer-note { border-top: 1px solid #23375a; margin-top: 2rem; padding-top: 1.2rem; font-size: .82rem; color: #7387ab; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .record-layout { grid-template-columns: 1fr; }
  .author-row { grid-template-columns: 1fr 1fr; }
  .author-row input:nth-child(3) { grid-column: 1; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; }
  .hero { padding: 3rem 0 2.5rem; }
  .hero-search { flex-direction: column; }
  .hero-stats { gap: 1.8rem; }
}
