:root {
  --bg: #f5f7fb;
  --panel-bg: #ffffff;
  --text: #1f2129;
  --muted: #6b7280;
  --accent: #2563eb;
  --border: #e5e7eb;
  font-family: "SF Pro Display", "HarmonyOS Sans", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px clamp(16px, 4vw, 56px);
  background: var(--bg);
  color: var(--text);
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.headline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.headline h1 {
  margin: 4px 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.headline .badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 0.8rem;
  margin: 0;
}

.headline .muted {
  margin: 0;
}

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

.status-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.status-bar p {
  margin: 4px 0 0;
  font-weight: 600;
}

.status-bar .ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coverage-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: #f8fafc;
}

.coverage-bar p {
  margin: 4px 0 0;
  font-weight: 600;
}

button {
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

button.tiny {
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 6px;
}

.layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.column.main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.column.side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--panel-bg);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-title h2 {
  margin: 0;
  font-size: 1.1rem;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.panel-actions .history-buttons {
  display: flex;
  gap: 8px;
}

.base-point p {
  margin: 0;
  line-height: 1.6;
  white-space: pre-wrap;
}

.base-point-display {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.base-point-display small {
  color: var(--muted);
}

.base-point-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.base-point-form label {
  font-size: 0.85rem;
  color: var(--muted);
}

.base-point-form textarea,
.base-point-form input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
}

.base-point-form textarea {
  min-height: 120px;
  resize: vertical;
}

.base-point-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-status {
  font-size: 0.85rem;
  color: var(--muted);
}

button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.dimension-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dimension-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: #fdfefe;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dimension-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.dimension-card header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.dimension-score {
  font-size: 1.4rem;
  font-weight: 700;
}

.dimension-summary {
  margin: 0;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--text);
  line-height: 1.5;
}

.dimension-baseline {
  margin: 0 0 4px 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.dimension-summary p {
  margin: 0;
  flex: 1;
}

.stance-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background-color: rgba(37, 99, 235, 0.12);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.dimension-keypoints {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.dimension-keypoints li {
  margin-bottom: 2px;
}

.dimension-polarity {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dimension-polarity p {
  margin: 0;
}

.dimension-card footer {
  font-size: 0.8rem;
  color: var(--muted);
}

.news-list,
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.news-item {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.news-item:last-child {
  border-bottom: none;
}

.news-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.news-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.news-title:hover {
  color: var(--accent);
}

.news-summary {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.news-empty,
.history-empty {
  padding: 12px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.history-list li {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: #fcfdff;
}

.history-list p {
  margin: 6px 0;
  color: var(--muted);
  line-height: 1.4;
}

.history-score {
  color: var(--accent);
  font-weight: 600;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.filters-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.news-explorer .filters {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.news-explorer .checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
}

.hidden {
  display: none;
}

.detail-metrics {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.detail-metrics span {
  font-size: 1.6rem;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.primary {
  background: #111827;
  color: #fff;
}

.headline h1 {
  margin: 4px 0;
}

.history-empty,
.news-empty {
  padding: 12px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.overall-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.overall-points {
  list-style: none;
  margin: 0;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--muted);
}

.overall-points li {
  position: relative;
  padding-left: 14px;
}

.overall-points li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
  line-height: 1.2;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .headline {
    flex-direction: column;
    align-items: flex-start;
  }
  .status-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    padding: 16px;
  }

  main {
    grid-template-columns: 1fr;
  }

  .panel-title {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-actions {
    width: 100%;
    justify-content: space-between;
  }
}

.settings-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
}

.settings-summary strong {
  color: var(--text);
}

.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  z-index: 999;
}

.settings-panel {
  width: min(600px, 90vw);
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: min(900px, 90vh);
  overflow-y: auto;
}

.settings-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.settings-panel header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.settings-panel header button {
  border: none;
  background: transparent;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
