:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --surface: #ffffff;
  --surface-strong: #eef3ef;
  --text: #171a17;
  --muted: #687068;
  --line: #d7ded7;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e1f3ee;
  --amber: #b45309;
  --amber-soft: #fff0d4;
  --rose: #be123c;
  --rose-soft: #ffe4e6;
  --violet: #6d28d9;
  --violet-soft: #ede9fe;
  --shadow: 0 10px 28px rgba(25, 35, 28, 0.07);
  --shadow-soft: 0 2px 10px rgba(25, 35, 28, 0.045);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  max-width: 100%;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, #eef4ef 0, #f5f6f3 210px),
    var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  line-height: 1.5;
  letter-spacing: 0;
  max-width: 100%;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.28;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.control-panel {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(250, 251, 249, 0.94);
  backdrop-filter: blur(16px);
}

.search-box {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search-box span {
  color: var(--muted);
  font-weight: 800;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.segmented,
.priority-row,
.quick-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar,
.priority-row::-webkit-scrollbar,
.quick-row::-webkit-scrollbar {
  display: none;
}

.segment,
.chip,
.quick-chip {
  min-height: 36px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  white-space: nowrap;
}

.segment {
  padding: 0 13px;
  font-weight: 800;
}

.chip {
  padding: 0 11px;
  font-size: 13px;
  font-weight: 800;
}

.quick-row {
  min-width: 0;
  padding-top: 1px;
}

.quick-chip {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.quick-chip span {
  margin-left: 4px;
  color: inherit;
  opacity: 0.72;
}

.segment.is-active,
.chip.is-active,
.quick-chip.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.chip.is-disabled,
.chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stats-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 10px 0 12px;
  padding-bottom: 2px;
}

.stats-grid::-webkit-scrollbar {
  display: none;
}

.stat {
  min-width: 92px;
  min-height: 42px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
  text-align: left;
}

button.stat {
  cursor: pointer;
}

.stat.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.stat b {
  display: block;
  font-size: 17px;
  line-height: 1.15;
}

.stat span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.layout {
  display: grid;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}

.detail-column {
  display: none;
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 2px 10px;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.feed-list {
  display: grid;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}

.feed-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.feed-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 0;
}

.feed-section-heading h3 {
  font-size: 18px;
}

.feed-section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.feed-section-heading span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.group-heading {
  position: sticky;
  top: 118px;
  z-index: 2;
  width: fit-content;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(247, 248, 245, 0.94);
  backdrop-filter: blur(12px);
  font-size: 12px;
  font-weight: 900;
}

.item-shell {
  display: grid;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
}

.item-card {
  display: grid;
  gap: 11px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 15px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.item-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.13), var(--shadow-soft);
}

.item-card.is-muted {
  background: #fbfcfa;
}

.item-card.is-muted h3,
.item-card.is-muted .summary {
  color: #586158;
}

.item-card.is-read {
  opacity: 0.72;
}

.item-card.is-saved {
  border-color: rgba(15, 118, 110, 0.55);
}

.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.item-action {
  min-height: 29px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 850;
}

.item-action.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.meta-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.badge.telegram {
  color: var(--accent);
  background: var(--accent-soft);
}

.badge.telegram_review {
  color: var(--amber);
  background: var(--amber-soft);
}

.badge.news {
  color: var(--violet);
  background: var(--violet-soft);
}

.badge.general_news {
  color: #166534;
  background: #dcfce7;
}

.badge.daily_review {
  color: #075985;
  background: #e0f2fe;
}

.badge.personal_reading {
  color: #7c2d12;
  background: #ffedd5;
}

.badge.research {
  color: #155e75;
  background: #cffafe;
}

.badge.child_portfolio {
  color: #6b21a8;
  background: #f3e8ff;
}

.badge.chief_of_staff {
  color: #0f766e;
  background: var(--accent-soft);
}

.badge.p1 {
  color: var(--rose);
  background: var(--rose-soft);
}

.badge.p2 {
  color: var(--amber);
  background: var(--amber-soft);
}

.badge.p3 {
  color: var(--muted);
  background: var(--surface-strong);
}

.badge.status {
  color: #3f4a43;
  background: #edf2ef;
}

.time-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.summary {
  margin: 0;
  color: #353c36;
  font-size: 14px;
  line-height: 1.62;
}

.portfolio-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  min-width: 0;
  max-width: 100%;
}

.portfolio-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #f1f5f2;
}

.tag {
  min-height: 23px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fbfcfa;
  font-size: 11px;
  font-weight: 750;
}

.detail-panel {
  min-width: 0;
  max-width: 100%;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.mobile-detail-inline {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.empty-state {
  padding: 22px;
}

.empty-state p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.detail-header {
  min-width: 0;
  max-width: 100%;
  padding: 17px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f5faf7);
}

.detail-header h2 {
  margin-top: 8px;
}

.detail-body {
  display: grid;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
  padding: 14px;
}

.info-block {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.info-block h3 {
  color: var(--accent-strong);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.info-block p,
.info-block li {
  margin: 0;
  color: #303630;
  font-size: 14px;
  line-height: 1.66;
}

.check-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  padding: 8px 10px;
  border-left: 3px solid var(--amber);
  background: #fff9ed;
}

.source-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  padding: 15px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfcfb);
}

.source-card + .source-card {
  margin-top: 10px;
}

.source-heading {
  display: grid;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
}

.source-heading small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.source-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.source-index {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 10px;
  font-weight: 900;
}

.source-text {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: none;
  overflow: visible;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #242a25;
  background: #fafbf9;
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 14px;
  line-height: 1.76;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.link-row a {
  min-width: 0;
  max-width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.image-card {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfcfa;
}

.image-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  background: #eef3ef;
}

.image-card figcaption {
  padding: 7px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.portfolio-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  min-width: 0;
  max-width: 100%;
}

.portfolio-artwork {
  min-width: 0;
  max-width: 100%;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfcfa;
}

.portfolio-artwork img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  background: #f1f5f2;
}

.portfolio-artwork figcaption {
  display: grid;
  gap: 4px;
  padding: 10px 11px;
}

.portfolio-artwork strong {
  font-size: 14px;
  line-height: 1.3;
}

.portfolio-artwork span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.portfolio-artwork em {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  color: #6b21a8;
  background: #f3e8ff;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.general-news-list {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.general-news-entry {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.general-news-index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #166534;
  background: #dcfce7;
  font-size: 13px;
  font-weight: 900;
}

.general-news-content {
  display: grid;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
}

.general-news-content h4 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.general-news-content p {
  margin: 0;
  color: #303630;
  font-size: 14px;
  line-height: 1.55;
}

.general-news-content b {
  color: var(--accent);
}

.general-news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.general-news-meta span {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 11px;
  font-weight: 800;
}

.article-link {
  width: fit-content;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.no-results {
  padding: 28px 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  text-align: center;
}

.no-results.compact {
  padding: 16px 14px;
  text-align: left;
}

.source-more {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.source-more summary {
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

@media (min-width: 760px) {
  .app-shell {
    padding: 24px;
  }

  h1 {
    font-size: 30px;
  }

  .control-panel {
    grid-template-columns: minmax(240px, 1fr) minmax(0, 2.4fr);
    align-items: center;
  }

  .priority-row,
  .quick-row {
    grid-column: 2;
    justify-content: flex-end;
  }

  .stats-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    overflow: visible;
  }

  .stat {
    min-width: 0;
  }

  .layout {
    grid-template-columns: minmax(320px, 0.86fr) minmax(380px, 1.14fr);
    align-items: start;
  }

  .detail-column {
    display: block;
    position: sticky;
    top: 112px;
  }

  .mobile-detail-inline {
    display: none;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding: 12px;
  }

  h1 {
    font-size: 22px;
  }

  .stats-grid {
    gap: 7px;
    margin: 8px 0 10px;
  }

  .stat {
    min-width: 86px;
    min-height: 40px;
    padding: 6px 8px;
  }

  .stat b {
    font-size: 16px;
  }

  .stat span {
    font-size: 10px;
  }

  .item-card,
  .detail-header,
  .detail-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .source-text {
    padding: 11px;
    font-size: 13px;
    line-height: 1.68;
  }

  .feed-section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
}
