:root {
  --bg: #0f1720;
  --panel: #16212e;
  --panel2: #1d2b3a;
  --text: #e6edf3;
  --muted: #8b9bb0;
  --border: #2a3a4d;
  --accent: #4c8dff;
  --accent2: #2f6fe0;
  --danger: #e0533d;
  --ok: #3fb950;
  --warn: #d9a441;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .6rem; }
code { background: var(--panel2); padding: .1em .35em; border-radius: 4px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.2rem; background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand a { color: var(--text); font-weight: 700; }
.topbar nav { display: flex; align-items: center; gap: 1rem; }
.container { max-width: 1100px; margin: 0 auto; padding: 1.4rem 1.2rem 4rem; }

.btn {
  display: inline-block; background: var(--accent); color: #fff; border: none;
  padding: .5rem .9rem; border-radius: 6px; cursor: pointer; font-size: .9rem;
}
.btn:hover { background: var(--accent2); text-decoration: none; }
.btn.secondary { background: var(--panel2); color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn.small { padding: .3rem .6rem; font-size: .82rem; }
.btn.tiny { padding: .15rem .45rem; font-size: .8rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.inline { display: inline; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); }
.warn { background: #3a2f16; border: 1px solid var(--warn); color: #f0d9a8; padding: .6rem .8rem; border-radius: 6px; }

.login { max-width: 360px; margin: 12vh auto; text-align: center; }
.login form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
input, select, textarea {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: .5rem .6rem; font: inherit; width: 100%;
}
label { display: block; font-size: .85rem; color: var(--muted); }
label input, label select { margin-top: .25rem; }

.cards { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.3rem; min-width: 140px; }
.card .num { font-size: 1.8rem; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: .82rem; }
.row-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }

.filters { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; background: var(--panel); padding: .8rem 1rem; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 1rem; }
.filters label { display: flex; flex-direction: column; }
.filters input, .filters select { width: auto; }

.list { list-style: none; padding: 0; }
.list li { padding: .5rem 0; border-bottom: 1px solid var(--border); }

.stories { list-style: none; padding: 0; }
.story { display: flex; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--border); }
.story-title { font-weight: 600; font-size: 1.02rem; }
.story-meta { display: flex; gap: .5rem; align-items: center; margin: .3rem 0; font-size: .82rem; }
.story-summary p { margin: .3rem 0 0; color: #cdd8e6; }
.story-actions { display: flex; flex-direction: column; gap: .4rem; align-items: flex-end; min-width: 110px; }
.badge { background: var(--panel2); border: 1px solid var(--border); padding: .05rem .45rem; border-radius: 20px; font-size: .74rem; color: var(--muted); }
.badge.used { background: #14351f; border-color: var(--ok); color: #8fe0a4; }
.badge.dupe { background: #2e2440; border-color: #7c5cbf; color: #c7b3ef; }
.pager { display: flex; align-items: center; gap: 1rem; justify-content: center; margin: 1.5rem 0; }
.btn.disabled { opacity: .4; pointer-events: none; }
.checkbox-inline { display: flex; flex-direction: row; align-items: center; gap: .4rem; }
.checkbox-inline input { width: auto; }
.issue-status { display: flex; align-items: center; gap: .6rem; }
.status { font-size: .74rem; padding: .05rem .45rem; border-radius: 20px; }
.status-summarized { color: var(--ok); }
.status-new { color: var(--accent); }
.status-error { color: var(--danger); }

table.feeds { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.feeds th, table.feeds td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
table.feeds tr.inactive { opacity: .5; }
table.feeds .url { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-actions { display: flex; gap: .4rem; }
.add-feed { margin-bottom: 1rem; }
.stacked { display: flex; flex-direction: column; gap: .6rem; max-width: 520px; margin-top: .8rem; }
.stacked .checkbox { flex-direction: row; align-items: center; gap: .4rem; }
.stacked .checkbox input { width: auto; }

.issue-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.issue-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1rem; }
@media (max-width: 820px) { .issue-grid { grid-template-columns: 1fr; } }
.selected { padding-left: 1.2rem; }
.selected li { padding: .6rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: .8rem; }
.sel-actions { display: flex; gap: .3rem; align-items: flex-start; }
textarea { width: 100%; resize: vertical; }

.preview-pane { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }
.preview-head { display: flex; justify-content: space-between; align-items: center; }
.nl-preview { background: #fff; color: #1a1a1a; border-radius: 6px; padding: 1.2rem; margin-top: .6rem; max-height: 70vh; overflow: auto; }
.nl-preview h3 { margin: 1.1rem 0 .3rem; font-size: 1.05rem; }
.nl-preview h3 a { color: #1a4fa0; }
.nl-preview p { margin: .3rem 0 .8rem; }
