:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --panel: #ffffff;
  --panel-2: #f0f6ef;
  --text: #17211b;
  --muted: #667064;
  --line: #dde5da;
  --accent: #20804e;
  --accent-2: #dff1e6;
  --warn: #9a6a18;
  --shadow: 0 18px 45px rgba(39, 61, 43, 0.08);
  font-family: Inter, "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px minmax(520px, 1fr) 360px;
  gap: 16px;
  padding: 18px;
}

.sidebar,
.feed {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 18px;
  align-self: start;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #102118;
  color: #fff;
  font-weight: 900;
}

.brand p,
.feed-header p,
.insight-head p {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1,
.feed-header h2,
.insight-head h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
}

.brand span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.search-box {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: #fff;
}

.search-box input {
  border: 0;
  outline: 0;
  width: 100%;
  color: var(--text);
}

.control-group {
  margin-top: 22px;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #31413a;
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 10px;
}

.chip-grid,
.tag-cloud,
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.tag-cloud span,
.card-tags span,
.type {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  color: #415047;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 9px;
}

.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.range {
  width: 100%;
  accent-color: var(--accent);
}

.range-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.range-row strong {
  color: var(--text);
}

.sidebar-actions,
.right-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.primary,
.secondary {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  font-size: 14px;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.secondary {
  background: #fff;
  color: #24342b;
  border-color: var(--line);
}

.compact {
  min-height: 34px;
  padding: 0 12px;
}

.feed {
  min-width: 0;
  padding: 0;
}

.feed-header {
  height: 76px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.article-list {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.article-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.article-card:hover,
.article-card.selected {
  border-color: #95cfad;
  box-shadow: 0 12px 30px rgba(32, 128, 78, 0.12);
  transform: translateY(-1px);
}

.article-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cover-dot {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e7f3eb;
  color: var(--accent);
  font-weight: 900;
  border: 1px solid #cfe5d6;
}

.identity {
  flex: 1;
  min-width: 0;
}

.identity strong {
  display: block;
  font-size: 15px;
}

.identity span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.type {
  background: var(--panel-2);
  color: var(--accent);
  border-color: #cbe4d2;
}

.type.est {
  background: #fff6e9;
  color: #b9791d;
  border-color: #f0d8ab;
}

.type.verified {
  background: #e9f6ee;
  color: #1f7a44;
  border-color: #bfe6cd;
}

.article-real {
  margin: 0 0 12px;
  padding: 8px 11px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #486053;
  background: #f4f8f5;
  border: 1px solid #dcebe1;
  border-radius: 8px;
}

.article-title {
  margin: 14px 0 8px;
  font-size: 20px;
  line-height: 1.45;
}

.article-lead {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.article-url {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  background: #fbfdfb;
  overflow-wrap: anywhere;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 12px;
}

.metric {
  min-height: 58px;
  border-radius: 8px;
  background: #f4f7f3;
  border: 1px solid #e1e8de;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px;
}

.metric span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.metric strong {
  margin-top: 3px;
  font-size: 15px;
}

.metric.highlight {
  background: var(--accent-2);
  border-color: #aedabb;
}

.metric.warn {
  background: #fff6df;
  border-color: #ead49c;
}

.metric.strong {
  background: #102118;
  color: #fff;
}

.metric.strong span {
  color: #c0cabf;
}

.right {
  display: flex;
  flex-direction: column;
}

.insight-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #b04f39;
  display: grid;
  place-items: center;
}

.score-panel {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  display: flex;
  align-items: center;
  gap: 14px;
}

.score-ring {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) var(--score), #e6eeE8 0);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.score-ring span {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 23px;
  font-weight: 900;
}

.score-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.insight-section {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.insight-section h3 {
  margin: 0 0 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 15px;
}

.insight-section ul {
  margin: 0;
  padding-left: 18px;
  color: #31413a;
  line-height: 1.7;
  font-size: 14px;
}

.hook-box,
.rewrite {
  margin: 0;
  background: var(--panel-2);
  border: 1px solid #cde6d4;
  border-radius: 8px;
  padding: 12px;
  line-height: 1.65;
  font-size: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 24, 18, 0.42);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22);
  padding: 18px;
}

.modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal h2 {
  margin: 0;
}

.modal header button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.form-grid input,
.form-grid textarea,
.form-grid select,
.csv-area {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  outline: none;
  min-width: 0;
}

.form-grid textarea {
  min-height: 110px;
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.csv-help {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.csv-area {
  width: 100%;
  min-height: 260px;
  margin-bottom: 12px;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.mini-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  font-weight: 900;
  line-height: 1;
}

.empty {
  margin: 24px;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 270px minmax(0, 1fr);
  }

  .right {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

  .feed-header {
    height: auto;
    padding: 14px;
    gap: 12px;
    align-items: start;
    flex-direction: column;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}
