:root {
  color-scheme: dark light;
  --bg: #fafafa;
  --text: #222;
  --muted: #888;
  --accent: #ff6600;
  --border: #e0e0e0;
  --card: #fff;
  --tag-bg: #f0f0f0;
  --tag-text: #555;
  --hover: #f5f0eb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --text: #e6edf3;
    --muted: #8b949e;
    --accent: #ff8533;
    --border: #30363d;
    --card: #161b22;
    --tag-bg: #21262d;
    --tag-text: #c9d1d9;
    --hover: #1c2128;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 2px solid var(--accent);
  flex-wrap: wrap;
}
.header h1 {
  font-size: 1.1rem;
  color: var(--accent);
  white-space: nowrap;
}
.header-right {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}
.header-right input[type="text"] {
  width: 160px;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
}
.header-right input[type="date"] {
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  font-size: 12px;
}
.header-right button {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}

.tab-bar {
  display: flex;
  gap: 0;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  padding: 0.5rem 0.8rem;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab:hover { color: var(--text); }

.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.5rem 1rem 2rem;
}

.stats-bar {
  display: flex;
  gap: 1.2rem;
  padding: 0.6rem 0;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.stats-bar .stat {
  display: flex;
  gap: 0.3rem;
}
.stats-bar .stat-val {
  color: var(--accent);
  font-weight: 600;
}

.article-list {
  list-style: none;
  counter-reset: item;
}
.article-list li {
  counter-increment: item;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.article-list li:hover {
  background: var(--hover);
}
.article-row {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}
.article-num {
  color: var(--muted);
  font-size: 13px;
  min-width: 1.8em;
  text-align: right;
}
.article-num::after {
  content: counter(item) ".";
}
.article-body {
  flex: 1;
  min-width: 0;
}
.article-title {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.35;
}
.article-title:visited { color: var(--muted); }
.article-title:hover { text-decoration: underline; }
.article-domain {
  font-size: 11px;
  color: var(--muted);
  margin-left: 0.3rem;
}
.article-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 0.15rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.article-tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0 0.35rem;
  border-radius: 3px;
  font-size: 11px;
}
.article-summary {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 0.2rem;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.load-more {
  text-align: center;
  padding: 1rem 0;
}
.load-more button {
  padding: 0.4rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.hidden { display: none !important; }

.report-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.report-controls select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  font-size: 13px;
}
.markdown-body {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  max-height: 70vh;
  overflow: auto;
  font-size: 14px;
  line-height: 1.6;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}
.markdown-body ul, .markdown-body ol { padding-left: 1.5rem; }

.admin-toolbar {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.admin-toolbar input {
  width: 220px;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
}
.admin-toolbar button {
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.admin-toolbar button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.admin-status {
  min-height: 1.8rem;
  padding: 0.45rem 0;
  color: var(--muted);
  font-size: 12px;
}
.admin-status.error { color: #d73a49; }
.ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}
.ops-block {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  min-width: 0;
}
.ops-block h2 {
  font-size: 13px;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
}
.ops-block pre {
  padding: 0.7rem;
  overflow: auto;
  font-size: 12px;
  color: var(--muted);
}
.table-wrap {
  max-height: 280px;
  overflow: auto;
}
.ops-block table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.ops-block th,
.ops-block td {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.ops-block th {
  color: var(--muted);
  font-weight: 600;
}
.status-pill {
  display: inline-block;
  padding: 0 0.35rem;
  border-radius: 3px;
  background: var(--tag-bg);
  color: var(--tag-text);
}
.status-pill.success {
  color: #22863a;
}
.status-pill.failed {
  color: #d73a49;
}

@media (max-width: 600px) {
  .header { flex-direction: column; align-items: flex-start; }
  .header-right { width: 100%; }
  .header-right input[type="text"] { flex: 1; }
  .ops-grid { grid-template-columns: 1fr; }
  .admin-toolbar input { width: 100%; }
}
