:root {
  --bg-page: #fafaf7;
  --bg-surface: #ffffff;
  --bg-soft: #f4f3ee;
  --text-primary: #1a1a1a;
  --text-secondary: #5f5e5a;
  --text-tertiary: #999791;
  --border-subtle: rgba(0, 0, 0, 0.07);
  --border-default: rgba(0, 0, 0, 0.14);
  --border-strong: rgba(0, 0, 0, 0.25);

  --accent: #1d4ed8;
  --accent-hover: #1e40af;

  /* Action grade colors */
  --grade-urgent-bg: #faece7;
  --grade-urgent-text: #4a1b0c;
  --grade-urgent-bar: #d85a30;
  --grade-major-bg: #faeeda;
  --grade-major-text: #412402;
  --grade-major-bar: #ba7517;
  --grade-watch-bg: #e6f1fb;
  --grade-watch-text: #042c53;
  --grade-watch-bar: #378add;
  --grade-ref-bg: #f1efe8;
  --grade-ref-text: #2c2c2a;
  --grade-ref-bar: #888780;

  /* Lens badge colors */
  --lens-consumer-bg: #fbeaf0;
  --lens-consumer-text: #72243e;
  --lens-tech-bg: #e1f5ee;
  --lens-tech-text: #085041;
  --lens-comp-bg: #eeedfe;
  --lens-comp-text: #3c3489;
  --lens-policy-bg: #faeeda;
  --lens-policy-text: #854f0b;
  --lens-macro-bg: #f1efe8;
  --lens-macro-text: #5f5e5a;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --font-sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, sans-serif;
  --font-serif: "Times New Roman", "Noto Serif KR", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ===== Header ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 16px;
  flex-wrap: wrap;
}

.page-header__title h1 {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.page-header__title h1 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
}

.page-header__title p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  display: inline;
  margin-left: 10px;
}

.page-header__meta {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1d9e75;
}

/* ===== Stats KPI ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  border-radius: var(--radius-md);
  padding: 16px 18px;
  border: 1px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
  user-select: none;
}

.stat-card:hover {
  transform: translateY(-1px);
}

.stat-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.stat-card.is-selected {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 1px var(--border-strong);
}
.stat-card--urgent.is-selected {
  border-color: var(--grade-urgent-bar);
  box-shadow: 0 0 0 1px var(--grade-urgent-bar);
}
.stat-card--major.is-selected {
  border-color: var(--grade-major-bar);
  box-shadow: 0 0 0 1px var(--grade-major-bar);
}
.stat-card--watch.is-selected {
  border-color: var(--grade-watch-bar);
  box-shadow: 0 0 0 1px var(--grade-watch-bar);
}

.stat-card__label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stat-card__label i {
  font-size: 12px;
}

.stat-card__value {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.stat-card__unit {
  font-size: 14px;
  font-weight: 400;
  margin-left: 3px;
  color: var(--text-secondary);
}

.stat-card--neutral {
  background: var(--bg-soft);
}
.stat-card--neutral .stat-card__label { color: var(--text-secondary); }

.stat-card--urgent {
  background: var(--grade-urgent-bg);
}
.stat-card--urgent .stat-card__label,
.stat-card--urgent .stat-card__value,
.stat-card--urgent .stat-card__unit {
  color: var(--grade-urgent-text);
}
.stat-card--urgent .stat-card__label i {
  color: var(--grade-urgent-bar);
}

.stat-card--major {
  background: var(--grade-major-bg);
}
.stat-card--major .stat-card__label,
.stat-card--major .stat-card__value,
.stat-card--major .stat-card__unit {
  color: var(--grade-major-text);
}

.stat-card--watch {
  background: var(--grade-watch-bg);
}
.stat-card--watch .stat-card__label,
.stat-card--watch .stat-card__value,
.stat-card--watch .stat-card__unit {
  color: var(--grade-watch-text);
}

.dot-amber, .dot-blue {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-amber { background: var(--grade-major-bar); }
.dot-blue { background: var(--grade-watch-bar); }

/* ===== Filter Panel ===== */
.filter-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 18px;
}

.filter-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-subtle);
}

.filter-row:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.filter-row:first-of-type {
  padding-top: 0;
}

.filter-row__label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  min-width: 40px;
  margin-top: 7px;
  flex-shrink: 0;
}

.filter-row__chips {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-row__hint {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  margin-top: 9px;
  flex-shrink: 0;
}

.filter-row.is-disabled {
  opacity: 0.4;
}

.filter-row.is-disabled .chip {
  cursor: not-allowed;
  pointer-events: none;
}

.chip {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  padding: 6px 13px;
  font-size: 12.5px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.chip:hover {
  background: var(--bg-soft);
  border-color: var(--border-strong);
}

.chip--active {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #fff;
  font-weight: 500;
}

.keyword-search {
  flex: 1;
  height: 32px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 0 12px;
  appearance: none;
}

.keyword-search:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.date-range__input {
  height: 30px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 0 8px;
  cursor: pointer;
}

.date-range__input:hover {
  border-color: var(--border-strong);
}

.date-range__sep {
  font-size: 12px;
  color: var(--text-tertiary);
}

.filter-hint-banner {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--lens-tech-bg);
  color: var(--lens-tech-text);
  border-radius: var(--radius-md);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-hint-banner i {
  font-size: 14px;
}

/* ===== Result Bar ===== */
.result-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.result-bar__left {
  font-size: 13px;
  color: var(--text-secondary);
}

.result-bar__left strong {
  color: var(--text-primary);
  font-weight: 600;
}

.tag-filter-clear {
  margin-left: 8px;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--text-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 3px 6px 3px 10px;
  font-size: 11.5px;
  font-family: ui-monospace, "SF Mono", monospace;
  cursor: pointer;
  transition: background 0.12s ease;
}

.tag-filter-clear[hidden] {
  display: none;
}

.tag-filter-clear:hover {
  background: #000;
}

.tag-filter-clear i {
  font-size: 13px;
}

.result-bar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.control-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.control-group__label {
  font-size: 11px;
  color: var(--text-tertiary);
}

.control-group select {
  height: 32px;
  font-size: 12.5px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  font-family: inherit;
  color: var(--text-primary);
  padding: 0 28px 0 10px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23999791' stroke-width='2.5' stroke-linecap='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.view-toggle__btn {
  background: var(--bg-surface);
  border: none;
  font-family: inherit;
  font-size: 12.5px;
  padding: 6px 11px;
  cursor: pointer;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-left: 1px solid var(--border-default);
}

.view-toggle__btn:first-child {
  border-left: none;
}

.view-toggle__btn:hover {
  background: var(--bg-soft);
}

.view-toggle__btn--active {
  background: var(--text-primary);
  color: #fff;
  font-weight: 500;
}

.view-toggle__btn i {
  font-size: 13px;
}

/* ===== Result Area ===== */
.result-area {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.group-section {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  align-items: stretch;
}

.group-header {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 2px;
}

.group-header__badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12px;
}

.group-header__badge--urgent {
  background: var(--grade-urgent-bg);
  color: var(--grade-urgent-text);
}
.group-header__badge--major {
  background: var(--grade-major-bg);
  color: var(--grade-major-text);
}
.group-header__badge--watch {
  background: var(--grade-watch-bg);
  color: var(--grade-watch-text);
}
.group-header__badge--ref {
  background: var(--grade-ref-bg);
  color: var(--grade-ref-text);
}
.group-header__badge--lens-소비자 { background: var(--lens-consumer-bg); color: var(--lens-consumer-text); }
.group-header__badge--lens-기술 { background: var(--lens-tech-bg); color: var(--lens-tech-text); }
.group-header__badge--lens-경쟁사 { background: var(--lens-comp-bg); color: var(--lens-comp-text); }
.group-header__badge--lens-정책 { background: var(--lens-policy-bg); color: var(--lens-policy-text); }
.group-header__badge--lens-거시 { background: var(--lens-macro-bg); color: var(--lens-macro-text); }

.group-header__count {
  color: var(--text-secondary);
  font-size: 12.5px;
}

.group-header__meaning {
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ===== News Card ===== */
.news-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 16px 18px 14px 22px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.15s ease, transform 0.15s ease;
  overflow: hidden;
}

.news-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}

.news-card--urgent::before { background: var(--grade-urgent-bar); }
.news-card--major::before { background: var(--grade-major-bar); }
.news-card--watch::before { background: var(--grade-watch-bar); }
.news-card--ref::before { background: var(--grade-ref-bar); }

.news-card:hover {
  border-color: var(--border-default);
  transform: translateY(-1px);
}

.news-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
}

.news-card__top-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.lens-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--radius-md);
  white-space: nowrap;
}

.lens-badge--소비자 { background: var(--lens-consumer-bg); color: var(--lens-consumer-text); }
.lens-badge--기술 { background: var(--lens-tech-bg); color: var(--lens-tech-text); }
.lens-badge--경쟁사 { background: var(--lens-comp-bg); color: var(--lens-comp-text); }
.lens-badge--정책 { background: var(--lens-policy-bg); color: var(--lens-policy-text); }
.lens-badge--거시 { background: var(--lens-macro-bg); color: var(--lens-macro-text); }

.news-card__meta {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-card__meta a {
  color: inherit;
  text-decoration: none;
}

.news-card__meta a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.news-card__grade {
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.news-card__grade--urgent { color: var(--grade-urgent-text); }
.news-card__grade--major { color: var(--grade-major-text); }
.news-card__grade--watch { color: var(--grade-watch-text); }
.news-card__grade--ref { color: var(--grade-ref-text); }

.news-card__headline {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.news-card__headline a {
  color: inherit;
  text-decoration: none;
}

.news-card__headline a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.news-card__summary {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.65;
  flex: 1;
}

.news-card__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.news-card__tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.tag {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-soft);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.tag:hover {
  background: var(--border-default);
  color: var(--text-primary);
}

.tag.is-active {
  background: var(--text-primary);
  color: #fff;
}

.news-card__actions {
  display: inline-flex;
  gap: 8px;
  flex-shrink: 0;
}

.news-card__action {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.news-card__action:hover {
  color: var(--text-primary);
  background: var(--bg-soft);
}

.news-card__action i {
  font-size: 16px;
}

.news-card__action--report {
  gap: 5px;
  padding: 5px 11px;
  border: 1px solid var(--accent);
  background: var(--accent);
  font-family: inherit;
  font-size: 12px;
  color: #fff;
  white-space: nowrap;
}

.news-card__action--report i {
  font-size: 14px;
}

.news-card__action--report:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

/* ===== List view ===== */
.result-area.is-list .group-section {
  grid-template-columns: 1fr;
}

.result-area.is-list .news-card {
  padding: 14px 18px 12px 22px;
}

.result-area.is-list .news-card__headline {
  font-size: 14px;
}

/* ===== Empty ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}

.empty-state i {
  font-size: 32px;
  margin-bottom: 8px;
  display: block;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
}

/* ===== Footer ===== */
.page-footer {
  margin-top: 28px;
  padding: 14px 18px;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.6;
}

.page-footer i {
  font-size: 15px;
  flex-shrink: 0;
}

/* ===== Modal (기존 유지) ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  animation: fadeIn 0.15s ease;
}

.modal__panel {
  position: relative;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal__header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.modal__close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-secondary);
  display: inline-flex;
  border-radius: var(--radius-sm);
}

.modal__close:hover { background: var(--bg-soft); }
.modal__close i { font-size: 20px; }

.modal__body { padding: 20px 24px; }

.modal__news-preview {
  background: var(--bg-soft);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.modal__news-preview-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin: 0 0 4px;
  font-weight: 500;
}

.modal__news-preview-headline {
  font-size: 13px;
  font-weight: 500;
  margin: 0;
  line-height: 1.5;
}

.modal__field { margin-bottom: 20px; }

.modal__field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.checkbox-group, .radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-item, .radio-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
  user-select: none;
}

.checkbox-item:hover { border-color: var(--border-strong); }
.checkbox-item:has(input:checked),
.radio-item--selected {
  background: var(--text-primary);
  color: #fff;
  border-color: var(--text-primary);
}

.checkbox-item input, .radio-item input { display: none; }

.modal__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn {
  font-family: inherit;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn--ghost {
  background: transparent;
  border-color: var(--border-default);
  color: var(--text-secondary);
}
.btn--ghost:hover { background: var(--bg-soft); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn i { font-size: 15px; }
.btn--loading i { animation: spin 0.8s linear infinite; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  z-index: 200;
}
.toast[hidden] { display: none; }
.toast i { font-size: 16px; color: #4ade80; }

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .result-area:not(.is-list) .group-section { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .container { padding: 20px 14px 40px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-row { flex-direction: column; gap: 6px; }
  .filter-row__label, .filter-row__hint { margin-top: 0; }
  .page-header__title h1 { font-size: 22px; }
  .page-header__title p { display: block; margin-left: 0; }
  .result-bar { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 600px) {
  .result-area:not(.is-list) .group-section { grid-template-columns: 1fr; }
}
