:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f1f20;
  --muted: #6b7280;
  --accent: #0b63d6;
  --accent-hover: #084fa8;
  --border: #e2e4e9;
  --danger: #c0392b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Sans", "Noto Sans JP", "BIZ UDPGothic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  padding: 24px 20px 12px;
  max-width: 980px;
  margin: 0 auto;
}

.topbar h1 {
  margin: 0;
  font-size: 1.5rem;
}

.topbar h1 span { color: var(--accent); }

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.tabs {
  display: flex;
  gap: 6px;
  max-width: 980px;
  margin: 14px auto 0;
  padding: 0 20px;
}

.tab {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab:hover { background: #f0f1f4; }

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

.topic-panel {
  max-width: 980px;
  margin: 12px auto 80px;
  padding: 0 20px;
}

.topic-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.topic-eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.topic-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 16px;
}

.topic-name {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.3;
}

.topic-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 999px;
  flex: 0 0 auto;
  color: var(--accent);
}

.icon-btn:hover { background: #eaf1fb; }

.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

.topic-list {
  margin: 0;
  padding: 0;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 980px;
  margin: 12px auto 0;
  padding: 12px 20px;
  background: rgba(244, 245, 247, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.toolbar-actions,
.toolbar-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.count {
  font-size: 0.9rem;
  color: var(--muted);
}

.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn:hover { background: #f0f1f4; }

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

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.list {
  max-width: 980px;
  margin: 8px auto 80px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}

.status.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner.small {
  width: 13px;
  height: 13px;
  border-width: 2px;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 7px;
}

.btn.primary .spinner.small {
  border-color: rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
}

.month-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 4px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--muted);
}

.month-header:first-child {
  margin-top: 4px;
}

.month-count {
  background: var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 0.75rem;
  font-weight: 500;
}

.month-create {
  margin-left: auto;
}

.status.error { color: var(--danger); }

.article {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.article.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.article input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  cursor: pointer;
  accent-color: var(--accent);
}

.article-link {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.article-link:hover .article-title {
  color: var(--accent);
  text-decoration: underline;
}

.article-thumb {
  width: 96px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 6px;
  object-fit: cover;
  background: #eceef1;
}

.article-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.7rem;
}

.article-meta {
  min-width: 0;
}

.article-date {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.article-title {
  font-size: 0.98rem;
  line-height: 1.4;
  margin: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #1f1f20;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 20;
  max-width: 90vw;
}

.toast.error { background: var(--danger); }

@media (max-width: 600px) {
  .article-thumb { width: 72px; height: 52px; }
  .article-title { font-size: 0.92rem; }
}
