:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #14161f;
  --muted: #6b7280;
  --line: #e6e8ef;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --accent: #0ea5a4;
  --danger: #dc2626;
  --success: #15803d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --max: 1080px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, .brand-text { font-family: "Sora", "Inter", sans-serif; letter-spacing: -.01em; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.main { padding: 32px 20px 64px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.accent { color: var(--brand); }
.req { color: var(--danger); }

/* Header */
.site-header {
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff; font-family: "Sora"; font-weight: 700; font-size: .85rem;
}
.brand-mark.small { width: 26px; height: 26px; font-size: .7rem; }
.brand-text { font-size: 1.15rem; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: var(--ink); font-weight: 500; font-size: .95rem; }
.nav a.active { color: var(--brand); }
.nav a:hover { text-decoration: none; color: var(--brand); }
.inline-form { display: inline; margin: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px;
  padding: 10px 18px; font-size: .95rem; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: .15s ease; white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-sm { padding: 7px 13px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #fff; border-color: #d7dae6; }
.btn-danger { background: #fff; color: var(--danger); border-color: #f3c6c6; }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* Flash */
.flash-wrap { padding-top: 18px; display: grid; gap: 8px; }
.flash { padding: 12px 16px; border-radius: 10px; font-size: .92rem; border: 1px solid; }
.flash-success { background: #f0fdf4; color: var(--success); border-color: #bbf7d0; }
.flash-error { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.flash-info { background: var(--brand-soft); color: var(--brand-dark); border-color: #c7d2fe; }

/* Hero */
.hero { padding: 30px 0 18px; }
.pill {
  display: inline-block; background: var(--brand-soft); color: var(--brand-dark);
  padding: 5px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; margin-bottom: 14px;
}
.hero h1 { font-size: clamp(2rem, 4vw, 2.9rem); margin: 0 0 12px; line-height: 1.1; }
.lead { font-size: 1.1rem; color: #44485a; max-width: 640px; margin: 0 0 22px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }

/* Search */
.search-bar { margin: 18px 0 30px; }
.search-form { display: flex; gap: 10px; flex-wrap: wrap; }
.search-form input[type=search], .search-form select {
  flex: 1; min-width: 180px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font-family: inherit; font-size: .95rem;
}
.search-form select { flex: 0 0 auto; }

/* Section heads */
.section-head { display: flex; align-items: center; margin: 8px 0 18px; }
.section-head.with-action { justify-content: space-between; }
.section-head h1, .section-head h2 { margin: 0; }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.paper-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
  transition: .15s ease;
}
.paper-card:hover { transform: translateY(-3px); border-color: #d7dae6; }
.paper-card h3 { margin: 2px 0; font-size: 1.12rem; line-height: 1.3; }
.paper-card h3 a { color: var(--ink); }
.paper-card h3 a:hover { color: var(--brand); }
.abstract { color: #4b4f60; font-size: .92rem; margin: 0; }
.tag {
  align-self: flex-start; background: var(--brand-soft); color: var(--brand-dark);
  font-size: .72rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
}
.meta { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: .82rem; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; }
.link-arrow { font-weight: 600; font-size: .9rem; }

/* Empty */
.empty {
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 48px 24px; text-align: center; display: grid; gap: 16px; justify-items: center;
}

/* Auth + forms */
.auth-card, .form-page {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 32px; margin: 12px auto; max-width: 460px;
}
.form-page { max-width: 680px; }
.auth-card h1, .form-page h1 { margin-top: 0; }
.form { display: grid; gap: 16px; margin-top: 18px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
.form input, .form textarea, .form select {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: .95rem; background: #fff; width: 100%;
}
.form input:focus, .form textarea:focus, .form select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.form textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hint { color: var(--muted); font-weight: 400; font-size: .8rem; }
.file-field input[type=file] { padding: 9px; background: #fafbff; }

/* Paper detail */
.paper-detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px; max-width: 820px; margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 18px; font-size: .9rem; }
.paper-detail h1 { font-size: 1.9rem; margin: 12px 0; }
.project-title { color: #44485a; margin: 0 0 16px; }
.detail-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 14px; background: #fafbff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin: 18px 0 24px; }
.detail-meta .label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.abstract-full { color: #2f3342; }
.detail-actions { margin: 24px 0 8px; }
.permalink code { background: #f1f2f7; padding: 2px 8px; border-radius: 6px; }

/* Table */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.table th { background: #fafbff; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }

.status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; text-transform: capitalize; }
.status-pending { background: #fef9c3; color: #854d0e; }
.status-approved { background: #dcfce7; color: var(--success); }
.status-rejected { background: #fee2e2; color: var(--danger); }

/* Tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: .9rem; }
.tab:hover { text-decoration: none; border-color: #d7dae6; }
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tab .count { background: rgba(0,0,0,.12); padding: 1px 8px; border-radius: 999px; font-size: .78rem; margin-left: 4px; }
.tab.active .count { background: rgba(255,255,255,.25); }

/* Review cards */
.review-list { display: grid; gap: 16px; }
.review-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; gap: 20px; flex-wrap: wrap; justify-content: space-between; }
.review-main { flex: 1; min-width: 280px; }
.review-main h3 { margin: 8px 0; }
.review-actions { display: flex; flex-direction: column; gap: 10px; min-width: 200px; }
.reject-form { display: flex; flex-direction: column; gap: 8px; }
.reject-form input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; font-size: .85rem; }

/* Error page */
.error-page { text-align: center; padding: 60px 20px; }
.error-code { font-family: "Sora"; font-size: 4rem; font-weight: 700; color: var(--brand); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 32px 20px 16px; }
.footer-inner p { margin: 6px 0 0; max-width: 320px; }
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-bottom { padding: 12px 20px 28px; font-size: .82rem; border-top: 1px solid var(--line); margin-top: 12px; }

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .nav { gap: 12px; }
  .nav a { font-size: .88rem; }
  .review-actions { min-width: 100%; }
}
