:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --text: #e6e9ef;
  --text-dim: #9aa3b2;
  --accent: #4f8cff;
  --action: #ff5c5c;   /* 🔴 행동 검토 */
  --watch: #ffb74d;    /* 🟡 주목 */
  --info: #8a94a6;     /* ⚪ 참고 */
  --up: #2ec27e;
  --down: #ff6b6b;
  --radius: 12px;
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Pretendard", "Segoe UI", Roboto, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 32px 24px 80px; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #141821, var(--bg));
}
.site-header .wrap { padding-bottom: 20px; }
.site-header h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.02em; }
.site-header .subtitle { color: var(--text-dim); font-size: 14px; margin: 0; }
.brand-dot { color: var(--accent); }

/* ---------- Toolbar (filters) ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin: 24px 0 20px;
}
.toolbar input[type="search"], .toolbar select {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 14px; outline: none;
}
.toolbar input[type="search"] { min-width: 220px; flex: 1; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent); }

.grade-filters { display: flex; gap: 6px; }
.chip {
  cursor: pointer; user-select: none;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); border-radius: 999px;
  padding: 7px 13px; font-size: 13px; transition: all .15s;
}
.chip:hover { border-color: var(--text-dim); }
.chip.active { color: var(--text); border-color: var(--accent); background: var(--surface-2); }

.count { color: var(--text-dim); font-size: 13px; margin-left: auto; }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card {
  display: block; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; transition: transform .12s, border-color .12s;
  color: inherit;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
.card .meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.card .date { color: var(--text-dim); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.card h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.4; letter-spacing: -0.01em; }
.card .summary { color: var(--text-dim); font-size: 13.5px; margin: 0 0 12px; }
.card .tickers { display: flex; gap: 6px; flex-wrap: wrap; }

.ticker {
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 2px 8px;
}

/* ---------- Grade badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; border-radius: 999px;
  padding: 3px 10px; border: 1px solid transparent;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.badge.action { color: var(--action); border-color: color-mix(in srgb, var(--action) 40%, transparent); background: color-mix(in srgb, var(--action) 12%, transparent); }
.badge.action::before { background: var(--action); }
.badge.watch  { color: var(--watch);  border-color: color-mix(in srgb, var(--watch) 40%, transparent);  background: color-mix(in srgb, var(--watch) 12%, transparent); }
.badge.watch::before  { background: var(--watch); }
.badge.info   { color: var(--info);   border-color: color-mix(in srgb, var(--info) 40%, transparent);   background: color-mix(in srgb, var(--info) 12%, transparent); }
.badge.info::before   { background: var(--info); }

.trigger-tag { font-size: 12px; color: var(--text-dim); }

/* 시장 구분 배지 (미국장/한국장/글로벌) */
.mkt { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 2px 8px; border: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.mkt.us { color: #6ea8ff; border-color: color-mix(in srgb, #6ea8ff 40%, transparent); }
.mkt.kr { color: #ff9e6e; border-color: color-mix(in srgb, #ff9e6e 40%, transparent); }
.mkt.global { color: var(--text-dim); }

.empty { color: var(--text-dim); text-align: center; padding: 60px 0; }

/* ---------- Briefing detail page ---------- */
.detail-nav { font-size: 13px; margin-bottom: 20px; }
.detail-header { border-bottom: 1px solid var(--border); padding-bottom: 18px; margin-bottom: 26px; }
.detail-header .meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.detail-header .asof { color: var(--text-dim); font-size: 13px; margin: 8px 0 0; }
.detail-header h1 { font-size: 26px; margin: 6px 0; letter-spacing: -0.02em; line-height: 1.3; }

.section { margin: 0 0 28px; }
.section > h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-dim); margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.section > h2 .num {
  background: var(--surface-2); border: 1px solid var(--border);
  width: 22px; height: 22px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--accent);
}

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.panel ul { margin: 0; padding-left: 18px; }
.panel li { margin: 6px 0; }
.panel li::marker { color: var(--text-dim); }

/* 3-axis grid */
.axes { display: grid; gap: 12px; }
@media (min-width: 720px) { .axes { grid-template-columns: repeat(3, 1fr); } }
.axis { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.axis h3 { margin: 0 0 8px; font-size: 14px; }
.axis .label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.axis p { margin: 4px 0 0; font-size: 14px; color: var(--text); }

/* Verdict block */
.verdict { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 20px; }
.verdict .row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.verdict .row:last-child { border-bottom: 0; }
.verdict .row .k { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin-bottom: 4px; }
.verdict .row.counter .k { color: var(--watch); }

.source-link { font-size: 12.5px; color: var(--text-dim); }
.source-link a { color: var(--accent); }

footer.site-footer { border-top: 1px solid var(--border); color: var(--text-dim); font-size: 12.5px; }
footer.site-footer .wrap { padding: 18px 24px; }
.admin-link { color: var(--text-dim); opacity: .7; }
.admin-link:hover { color: var(--accent); opacity: 1; }

/* 기술 구조 페이지 — 단계 흐름 / 2열 비교 / 용어 */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.step .n { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--accent); align-items: center; justify-content: center; font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.step h4 { margin: 0 0 4px; font-size: 14px; }
.step p { margin: 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px){ .two-col { grid-template-columns: 1fr; } }
.col-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.col-box.open { border-color: color-mix(in srgb, var(--up) 45%, var(--border)); }
.col-box.locked { border-color: color-mix(in srgb, var(--down) 45%, var(--border)); }
.col-box h4 { margin: 0 0 8px; font-size: 14px; }
.col-box ul { margin: 0; padding-left: 18px; }
.col-box li { font-size: 13px; margin: 4px 0; color: var(--text-dim); }
.glossary dt { font-weight: 600; font-size: 13.5px; margin-top: 10px; }
.glossary dd { margin: 2px 0 0; font-size: 13px; color: var(--text-dim); line-height: 1.55; }

/* ====================================================================
   Top-Down 대시보드 컴포넌트 (레짐 / 거시 타일 / 전달 체인 / 내비)
   ==================================================================== */

/* ---------- 상단 내비게이션 ---------- */
.topnav { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.topnav a {
  font-size: 13.5px; color: var(--text-dim); text-decoration: none;
  padding: 7px 14px; border-radius: 999px; border: 1px solid transparent;
}
.topnav a:hover { color: var(--text); border-color: var(--border); text-decoration: none; }
.topnav a.active { color: var(--text); background: var(--surface-2); border-color: var(--border); }

/* ---------- 레짐 배너 ---------- */
.regime-banner {
  border-radius: var(--radius); border: 1px solid var(--border);
  padding: 20px 22px; margin: 24px 0;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  position: relative; overflow: hidden;
}
.regime-banner::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
}
.regime-banner.lq-QE::before { background: var(--up); }
.regime-banner.lq-QT::before { background: var(--down); }
.regime-banner.lq-neutral::before { background: var(--watch); }
.regime-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.regime-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.regime-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; border-radius: 999px;
  padding: 4px 12px; border: 1px solid var(--border); background: var(--bg);
}
.regime-tag .dot { width: 8px; height: 8px; border-radius: 50%; }
.regime-tag.qe   { color: var(--up); }    .regime-tag.qe .dot   { background: var(--up); }
.regime-tag.qt   { color: var(--down); }  .regime-tag.qt .dot   { background: var(--down); }
.regime-tag.neutral { color: var(--watch);} .regime-tag.neutral .dot { background: var(--watch); }
.regime-tag.muted { color: var(--text-dim); } .regime-tag.muted .dot { background: var(--text-dim); }
.regime-banner h2 { margin: 6px 0 4px; font-size: 19px; letter-spacing: -0.01em; }
.regime-banner .asof { color: var(--text-dim); font-size: 12.5px; }
.regime-banner .fomc { text-align: right; color: var(--text-dim); font-size: 12.5px; white-space: nowrap; }
.regime-banner .fomc strong { display: block; color: var(--accent); font-size: 16px; }
@media (max-width: 700px){ .regime-banner .fomc { text-align: left; } }

/* ---------- 거시 지표 타일 ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; }
.tile .k { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.tile .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tile .c { font-size: 12px; margin-top: 2px; }
/* 상승/하락/보합 색상 — 타일·데일리 등 .c 쓰는 곳 모두 적용 */
.c.up { color: var(--up); }
.c.down { color: var(--down); }
.c.flat { color: var(--text-dim); }
.tile .note { font-size: 11.5px; color: var(--text-dim); margin-top: 6px; margin-bottom: 10px; }
.arrow.up::before { content: "▲ "; } .arrow.down::before { content: "▼ "; } .arrow.flat::before { content: "▬ "; }
.tile-tag { font-size: 10px; font-weight: 600; border-radius: 5px; padding: 2px 6px; border: 1px solid var(--border); white-space: nowrap; align-self: flex-start; margin-top: auto; }
.tile-tag.live { color: var(--up); }
.tile-tag.live.stale { color: var(--watch); }
.tile-tag.manual { color: var(--text-dim); }

/* ---------- 지표 평가 기준 패널 ---------- */
.criteria { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin: 4px 0 8px; }
.crit-head { margin-bottom: 12px; }
.crit-head strong { font-size: 14px; }
.crit-disclaimer { display: block; font-size: 12px; color: var(--text-dim); margin-top: 6px; line-height: 1.55; }
.crit-disclaimer b { color: var(--text); }
.crit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px 18px; }
.crit-row { border-top: 1px solid var(--border); padding-top: 8px; }
.crit-k { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.crit-kind { font-size: 10px; font-weight: 600; border-radius: 5px; padding: 1px 6px; border: 1px solid var(--border); }
.crit-kind.m { color: var(--up); } .crit-kind.p { color: var(--text-dim); }
.crit-read { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; line-height: 1.55; }

/* ---------- 전달 체인 (유가 → 물가 → 금리 → 주식) ---------- */
.chain-wrap { margin: 20px 0; }
.chain-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); margin-bottom: 10px; }
.chain { display: flex; align-items: stretch; gap: 26px; }
.chain .node {
  flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; position: relative;
}
.chain .node::after {
  content: "→"; position: absolute; right: -20px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); font-size: 18px; line-height: 1;
}
.chain .node:last-child::after { content: ""; }
.chain .node .stage { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.chain .node .stage .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.chain .node .note { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.dot.green { background: var(--up); } .dot.amber { background: var(--watch); } .dot.red { background: var(--down); }
/* 모바일: 세로 스택 + 아래 방향 화살표 (gap이 세로 간격도 처리) */
@media (max-width: 700px){
  .chain { flex-direction: column; gap: 28px; }
  .chain .node::after { content: "↓"; right: auto; left: 50%; top: auto; bottom: -23px; transform: translateX(-50%); }
}

/* ---------- 섹션 헤더 (대시보드 내) ---------- */
.dash-section { margin: 30px 0 14px; display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
.dash-section h2 { font-size: 15px; margin: 0; white-space: nowrap; }
.dash-section .more { font-size: 13px; margin-left: auto; }
#liveStamp { color: var(--text-dim); }
@media (max-width: 700px){ .dash-section .more { font-size: 11.5px; } }

/* ---------- 데일리 카드 ---------- */
.daily-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.daily-card .dcard-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 2px; }
.daily-card .date { font-size: 13px; color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.daily-card .market-line { font-size: 15px; margin: 6px 0 12px; }
.daily-card .mini-tiles { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.daily-card .mini { font-size: 13px; }
.daily-card .mini .mk { color: var(--text-dim); margin-right: 5px; }
.daily-card .sched, .daily-card .dnotes { margin: 8px 0 0; padding-left: 18px; }
.daily-card .sched li, .daily-card .dnotes li { font-size: 13.5px; margin: 3px 0; }
.daily-card h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin: 12px 0 4px; }

/* 최근 업데이트 cadence 뱃지 */
.cad { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 2px 8px; border: 1px solid var(--border); }
.cad.daily { color: var(--accent); } .cad.weekly { color: var(--up); }
.cad.monthly { color: var(--watch); } .cad.brief { color: var(--text); }
