/* Three theme states, not two: an explicit choice stamps data-theme on <html>,
   and the default "system" setting stamps nothing and follows the OS. The dark
   block is written twice because CSS cannot share one declaration block across
   a media query and an attribute selector without a preprocessor. */

:root {
  --bg: #f6f7fb;
  --panel: #fff;
  --card: #fff;
  --line: #e2e5ee;
  --text: #1b1d27;
  --muted: #5f6577;
  --accent: #3b5bdb;
  --ok: #2f9e5f;
  --warn: #b26a00;
  --bad: #c92a45;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12131a;
    --panel: #1b1d27;
    --card: #1f2230;
    --line: #2e3242;
    --text: #e6e8ef;
    --muted: #969cb0;
    --accent: #7aa2f7;
    --ok: #7ddba0;
    --warn: #e0af68;
    --bad: #f7768e;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #12131a;
  --panel: #1b1d27;
  --card: #1f2230;
  --line: #2e3242;
  --text: #e6e8ef;
  --muted: #969cb0;
  --accent: #7aa2f7;
  --ok: #7ddba0;
  --warn: #e0af68;
  --bad: #f7768e;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0 auto; padding: 2rem 1.25rem; max-width: 60rem;
  background: var(--bg); color: var(--text);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

header h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.01em; }
.sub { margin: 0.25rem 0 1.5rem; color: var(--muted); }
.hint { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 1rem; margin-bottom: 1rem;
}

label { display: block; font-weight: 600; margin-bottom: 0.4rem; }

textarea, input, select {
  width: 100%; padding: 0.55rem 0.7rem; background: var(--bg);
  color: var(--text); border: 1px solid var(--line); border-radius: 7px;
  font: inherit;
}
textarea { resize: vertical; font-family: ui-monospace, "Cascadia Code", monospace; font-size: 0.9rem; }

.row { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.75rem; flex-wrap: wrap; }
.row label { margin: 0; white-space: nowrap; }
.row select, .row input { width: auto; flex: 1 1 8rem; }
.filters { margin-top: 0; }

button, .export {
  padding: 0.55rem 1rem; border: 1px solid transparent; border-radius: 7px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
button:hover, .export:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: progress; }
button.danger { background: transparent; border-color: var(--line); color: var(--muted); }
button.danger:hover { border-color: var(--bad); color: var(--bad); filter: none; }

.counts { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0 0 1rem; }
.pill, .badge {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 99px;
  font-size: 0.75rem; font-weight: 600; background: var(--line); color: var(--muted);
}
.pill.done, .badge.status.done { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.pill.failed, .badge.status.failed { background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad); }
.pill.working { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }

.card {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: 10px; padding: 1rem; margin-bottom: 0.85rem;
}
.card.done { border-left-color: var(--ok); }
.card.failed { border-left-color: var(--bad); }
.card.pending, .card.fetching, .card.fetched, .card.summarizing { border-left-color: var(--warn); }

.card-head { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.actions { margin-left: auto; display: flex; gap: 0.4rem; }
.actions button { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

.card h2 { margin: 0.6rem 0 0.15rem; font-size: 1.05rem; }
.card h2 a { color: var(--accent); text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
/* Marks the title as leaving the site, so it reads as a link at a glance
   rather than only on hover. */
.card h2 a::after { content: " ↗"; font-size: 0.8em; opacity: 0.7; }

.url { margin: 0 0 0.6rem; font-size: 0.8rem; word-break: break-all; }
.url a { color: var(--muted); text-decoration: none; }
.url a:hover { color: var(--accent); text-decoration: underline; }
.summary { margin: 0 0 0.6rem; }
.points { margin: 0 0 0.6rem; padding-left: 1.1rem; color: var(--muted); font-size: 0.92rem; }
.tags { display: flex; gap: 0.35rem; flex-wrap: wrap; margin: 0; }
.tag { font-size: 0.72rem; padding: 0.1rem 0.5rem; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); }

.error { margin: 0; color: var(--bad); font-size: 0.9rem; }
.pending-note { margin: 0; color: var(--muted); font-style: italic; font-size: 0.9rem; }
.empty { color: var(--muted); text-align: center; padding: 2.5rem 0; }
.notice { background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid var(--accent);
          border-radius: 7px; padding: 0.6rem 0.8rem; margin: 0 0 1rem; font-size: 0.9rem; }

/* settings */
.nav { float: right; color: var(--accent); text-decoration: none; font-weight: 600; }
.nav:hover { text-decoration: underline; }
.panel-title { margin: 0 0 0.75rem; font-size: 1rem; }
.status-line { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin: 0 0 1rem; }
.status-line code { font-size: 0.85rem; color: var(--muted); }
.checkbox { display: flex; align-items: center; gap: 0.4rem; font-weight: 400; margin: 0; }
.checkbox input { width: auto; }
.error-notice { background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: var(--bad); }
.config { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.config th { text-align: left; padding: 0.4rem 0.8rem 0.4rem 0; color: var(--muted);
             font-weight: 600; white-space: nowrap; vertical-align: top; }
.config td { padding: 0.4rem 0; word-break: break-all; }
.config code { font-size: 0.85rem; }

/* auth */
body.centered { display: flex; min-height: 90vh; align-items: center; justify-content: center; }
.login-panel { width: min(24rem, 92vw); }
.login-panel h1 { margin: 0 0 0.15rem; font-size: 1.4rem; }
.spaced { margin-top: 0.85rem; }
.nav-group { float: right; display: flex; gap: 0.75rem; align-items: center; }
.inline { display: inline; }
.whoami { color: var(--muted); font-size: 0.85rem; }
button.linkish { background: none; border: none; color: var(--accent); font-weight: 600;
                 padding: 0; cursor: pointer; font-size: inherit; }
button.linkish:hover { text-decoration: underline; filter: none; }

/* sharing */
.badge.shared-in  { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.badge.shared-out { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.share-row { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.7rem;
             padding-top: 0.6rem; border-top: 1px solid var(--line); }
.chip { background: transparent; border: 1px solid var(--line); color: var(--muted);
        border-radius: 99px; padding: 0.15rem 0.6rem; font-size: 0.72rem; font-weight: 600; }
.chip:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.chip.on { border-color: var(--ok); color: var(--ok); }
.chip.on:hover { border-color: var(--bad); color: var(--bad); }

/* theme toggle */
.theme-toggle { background: none; border: 1px solid var(--line); color: var(--muted);
                border-radius: 99px; padding: 0.2rem 0.6rem; font-size: 0.78rem;
                font-weight: 600; cursor: pointer; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); filter: none; }

/* notable links found inside the content */
.notable { margin: 0.6rem 0 0; padding-top: 0.55rem; border-top: 1px dashed var(--line); }
.notable-title { color: var(--muted); font-size: 0.72rem; font-weight: 700;
                 text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 0.3rem; }
.notable ul { margin: 0; padding-left: 1.1rem; font-size: 0.88rem; }
.notable li { margin-bottom: 0.2rem; }
.notable a { color: var(--accent); text-decoration: none; word-break: break-word; }
.notable a:hover { text-decoration: underline; }
.notable .what { color: var(--muted); }

/* full extracted text, loaded on demand */
.prompt-meta { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.8rem; }
.fulltext-label { margin: 0.6rem 0 0.25rem; color: var(--muted); font-size: 0.72rem;
                  font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.fulltext { margin: 0.6rem 0 0; padding-top: 0.55rem; border-top: 1px dashed var(--line); }
.fulltext > summary { cursor: pointer; color: var(--muted); font-size: 0.72rem;
                      font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.fulltext > summary:hover { color: var(--accent); }
.fulltext > summary .hint { text-transform: none; letter-spacing: 0; }
/* Capped and scrolled in its own box: a long article must not push the rest of
   the list off the screen, and pre-wrap keeps the page from scrolling sideways. */
.fulltext-body {
  margin: 0.5rem 0 0; max-height: 28rem; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
  padding: 0.7rem; font-size: 0.85rem; line-height: 1.5;
  font-family: ui-monospace, "Cascadia Code", monospace;
  white-space: pre-wrap; word-break: break-word;
}

/* categories */
.badge.cat.auto { opacity: 0.85; font-style: italic; }
.share-row.cats { border-top: none; padding-top: 0.35rem; }
.chip-check { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 500;
              font-size: 0.78rem; color: var(--muted); border: 1px solid var(--line);
              border-radius: 99px; padding: 0.15rem 0.6rem; margin: 0; cursor: pointer; }
.chip-check input { width: auto; margin: 0; }
.chip-check:has(input:checked) { border-color: var(--accent); color: var(--accent); }
