:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #1b1f2a;
  --muted: #667085;
  --line: #dfe3eb;
  --accent: #1769e0;
  --accent-strong: #0f4fb0;
  --star: #c98700;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 24px max(24px, calc((100vw - 1120px) / 2));
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

main {
  width: min(1120px, calc(100vw - 32px));
  margin: 24px auto 48px;
}

button,
select,
input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

button {
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-strong);
}

.flash {
  width: min(1120px, calc(100vw - 32px));
  margin: 16px auto 0;
  padding: 12px 14px;
  border: 1px solid #b8d4ff;
  border-radius: 6px;
  background: #eef6ff;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stats div,
.empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.stats span {
  display: block;
  font-size: 28px;
  font-weight: 700;
}

.stats label {
  color: var(--muted);
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(4, minmax(120px, max-content)) max-content;
  gap: 10px;
  margin: 16px 0;
}

.filters input {
  min-width: 0;
  padding: 0 12px;
}

.filters select {
  padding: 0 10px;
}

.paper-list {
  display: grid;
  gap: 12px;
}

.paper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 18px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.paper.read {
  opacity: 0.68;
}

.paper-title-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.paper-title {
  color: #123f8c;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}

.paper-title:hover {
  text-decoration: underline;
}

.star {
  color: var(--star);
  font-size: 18px;
}

.meta,
.summary,
.cited,
.mail {
  margin: 8px 0 0;
  line-height: 1.55;
}

.meta,
.mail {
  color: var(--muted);
}

.cited {
  color: #475467;
}

.actions {
  display: grid;
  align-content: start;
  gap: 8px;
}

.actions form,
.actions button {
  width: 100%;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.login-page {
  min-height: 100vh;
  background: linear-gradient(180deg, #eef4ff 0%, #f7f8fb 48%, #ffffff 100%);
}

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  width: min(100vw - 32px, 420px);
  margin: 0 auto;
}

.login-panel {
  width: 100%;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(28, 45, 80, 0.12);
}

.login-brand h1 {
  font-size: 26px;
}

.login-brand p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.login-form label {
  color: #344054;
  font-weight: 600;
}

.login-form input {
  width: 100%;
  padding: 0 12px;
}

.login-form button {
  margin-top: 8px;
  width: 100%;
}

.login-flash {
  width: 100%;
  margin: 18px 0 0;
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions form,
  .topbar-actions button {
    width: 100%;
  }

  .stats,
  .filters,
  .paper {
    grid-template-columns: 1fr;
  }

  .actions {
    grid-template-columns: 1fr 1fr;
  }
}
