:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --border: #d9e0e8;
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --brand: #0f4c81;
  --brand-soft: #e8f1f8;
  --positive: #14532d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

.brand-subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.brand-title {
  margin: 0.15rem 0 0;
  font-size: 1.3rem;
}

.header-nav {
  display: flex;
  gap: 1rem;
  font-weight: 600;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.2rem;
  margin: 1.2rem auto 2rem;
}

.main-column,
.side-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}

.panel-kicker {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.top-topic-panel {
  border-left: 5px solid var(--brand);
  background: linear-gradient(180deg, #ffffff, #f9fcff);
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 0.5rem;
  align-items: end;
}

.filter-form label {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.filter-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: #fff;
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.article-card-header {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-start;
}

.article-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.06rem;
}

.importance-badge {
  font-size: 0.8rem;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  white-space: nowrap;
  font-weight: 600;
  border: 1px solid transparent;
}

.importance-5,
.importance-4 {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.importance-3 {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.importance-2,
.importance-1 {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0.4rem 0 0.7rem;
}

.meta-grid dt {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.meta-grid dd {
  margin: 0;
  font-weight: 600;
}

.summary-list {
  margin: 0.4rem 0 0.7rem;
  padding-left: 1.1rem;
}

.summary-list li {
  margin-bottom: 0.25rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.88rem;
}

.button:hover {
  text-decoration: none;
  opacity: 0.92;
}

.button-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.button-secondary {
  background: #fff;
  border-color: var(--border);
  color: var(--text-primary);
}

.article-detail-layout {
  margin-top: 1.2rem;
  margin-bottom: 2rem;
}

.article-detail-layout h2,
.article-detail-layout h3 {
  margin-bottom: 0.5rem;
}

.back-link {
  margin-top: 1rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.1rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.admin-layout {
  margin-top: 1.2rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1040px;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 0.65rem;
  vertical-align: top;
  font-size: 0.9rem;
}

.admin-table th {
  color: var(--text-secondary);
  background: #f8fafc;
  font-size: 0.82rem;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-draft {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}

.status-pending_review,
.status-ai_pending {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.status-published,
.status-ai_ok {
  background: #ecfdf5;
  color: #166534;
  border-color: #bbf7d0;
}

.status-rejected,
.status-ai_failed,
.status-discarded {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.status-new {
  background: #eff6ff;
  color: #1e40af;
  border-color: #bfdbfe;
}

.status-selected {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}

.status-imported {
  background: #ecfeff;
  color: #155e75;
  border-color: #a5f3fc;
}

.admin-actions {
  margin-top: 0;
}

.admin-actions .button {
  font-size: 0.78rem;
  padding: 0.32rem 0.52rem;
}

.auth-layout {
  margin-top: 1.4rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
}

.auth-card {
  width: min(480px, 100%);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.auth-form input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.6rem;
  font-size: 0.95rem;
}

.auth-message {
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font-size: 0.9rem;
}

.auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.auth-success {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.auth-note {
  margin-top: 0.8rem;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

@media (max-width: 960px) {
  .home-layout {
    grid-template-columns: 1fr;
  }

  .filter-form {
    grid-template-columns: 1fr;
  }

  .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .article-card-header {
    flex-direction: column;
  }

  .meta-grid {
    grid-template-columns: 1fr;
  }
}
