:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d1f1c;
  --muted: #62665f;
  --line: #e2e0d9;
  --accent: #2f5d3a;
  --accent-text: #ffffff;
  --link: #24577a;
  --ok: #2f6b3a;
  --ok-bg: #e4f1e5;
  --warn: #7a5200;
  --warn-bg: #fbefd2;
  --bad: #9b2420;
  --bad-bg: #f9e1df;
  --chip: #efede7;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151714;
    --surface: #1c1f1b;
    --text: #e6e7e2;
    --muted: #9da297;
    --line: #2f332d;
    --accent: #7fb88a;
    --accent-text: #10170f;
    --link: #8cc2e8;
    --ok: #9bd3a3;
    --ok-bg: #1f3322;
    --warn: #f0c76b;
    --warn-bg: #3a2f14;
    --bad: #f3a19b;
    --bad-bg: #3d1f1d;
    --chip: #262a24;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151714;
  --surface: #1c1f1b;
  --text: #e6e7e2;
  --muted: #9da297;
  --line: #2f332d;
  --accent: #7fb88a;
  --accent-text: #10170f;
  --link: #8cc2e8;
  --ok: #9bd3a3;
  --ok-bg: #1f3322;
  --warn: #f0c76b;
  --warn-bg: #3a2f14;
  --bad: #f3a19b;
  --bad-bg: #3d1f1d;
  --chip: #262a24;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: anywhere;
}
a { color: var(--link); }
h1 { font-size: 1.4rem; margin: 0 0 0.2rem; }
h2 { font-size: 1rem; margin: 1.6rem 0 0.5rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
p { margin: 0.3rem 0; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error, .bad-text { color: var(--bad); }

.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.brand { font-weight: 600; color: var(--text); text-decoration: none; margin-right: auto; }
.controls, .account { display: flex; align-items: center; gap: 8px; }

button {
  font: inherit; font-size: 0.9rem; padding: 4px 12px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

main { padding-top: 16px; padding-bottom: 8px; }
#status:empty { display: none; }
#status { padding-top: 12px; }

.journal .facts { margin-top: 0.4rem; }

ul.todo, ul.papers, ul.prs { list-style: none; padding: 0; margin: 0; }
ul.todo li {
  padding: 8px 12px; background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--warn); border-radius: 6px; margin-bottom: 6px;
}
.where { font-weight: 600; margin-right: 4px; }

li.paper { padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; }
.paper-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.paper-name { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.state { margin-top: 0.2rem; }
.facts { font-size: 0.9rem; }

.badge, .tag {
  display: inline-block; font-size: 0.78rem; font-weight: 500; padding: 1px 8px;
  border-radius: 999px; background: var(--chip); color: var(--muted); white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .warn-tag { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

code.cmd {
  display: block; margin: 6px 0; padding: 6px 8px; border-radius: 4px; background: var(--chip);
  font: 0.85rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; white-space: pre;
}
ul.prs { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 6px; }
ul.prs li { font-size: 0.9rem; padding: 2px 0; }

.picker { max-width: 560px; padding-top: 24px; }
.picker form { margin: 16px 0; }
.picker label { display: block; font-weight: 600; margin-bottom: 4px; }
.row { display: flex; gap: 8px; }
.row input {
  flex: 1; min-width: 0; font: inherit; padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
footer { padding-top: 16px; padding-bottom: 24px; border-top: 1px solid var(--line); margin-top: 24px; }
