:root {
  --bg: #f4f6f9; --panel: #ffffff; --ink: #1b2733; --muted: #6b7787;
  --line: #e3e8ef; --primary: #0d6e6e; --primary-ink: #0a5757;
  --accent: #1f6feb; --warn: #c2410c; --danger: #b42318; --gold: #c8870a;
  --open: #0a7d4b; --soon: #c2410c; --closed: #8a94a6;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Pretendard", -apple-system, "Apple SD Gothic Neo", "Segoe UI", "Malgun Gothic", system-ui, sans-serif;
  font-size: 14px; line-height: 1.5;
}
h1, h2, h3 { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; background: linear-gradient(100deg, #0d6e6e, #0a5757);
  color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 28px; }
.topbar h1 { font-size: 19px; letter-spacing: -.3px; }
.tagline { margin: 0; font-size: 12px; opacity: .85; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.stat-chip {
  background: rgba(255,255,255,.16); padding: 5px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.stat-chip.warn { background: rgba(255,180,90,.28); }
.stat-chip.muted { background: rgba(255,255,255,.10); opacity: .8; }

.btn {
  border: 0; border-radius: 8px; padding: 7px 13px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: .15s; font-family: inherit;
}
.btn.primary { background: #fff; color: var(--primary-ink); }
.btn.primary:hover { background: #eafaf7; }
.btn.ghost { background: rgba(255,255,255,.14); color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.26); }
.btn:disabled { opacity: .55; cursor: progress; }

/* layout */
.layout { display: grid; grid-template-columns: 248px 1fr; gap: 18px; padding: 18px 22px; max-width: 1320px; margin: 0 auto; }
.sidebar { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 78px; align-self: start; max-height: calc(100vh - 96px); overflow-y: auto; }

.views { display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); }
.view-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px;
  cursor: pointer; color: var(--ink); font-weight: 500;
}
.view-item:hover { background: #eef2f6; }
.view-item.active { background: #e3f3f0; color: var(--primary-ink); font-weight: 700; }
.view-item .ico { width: 18px; text-align: center; }
.view-item .count { margin-left: auto; font-size: 12px; color: var(--muted); background: #eef1f5; border-radius: 999px; padding: 1px 8px; }
.view-item.active .count { background: #cdeae3; color: var(--primary-ink); }

.filter-block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 13px; box-shadow: var(--shadow); }
.filter-block h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; transition: .12s;
}
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .n { opacity: .6; margin-left: 4px; }
.chip.active .n { opacity: .85; }

.runs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.runs li { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.runs .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--open); flex: none; }
.runs .dot.err { background: var(--danger); }
.runs .src { color: var(--ink); font-weight: 600; }

/* content */
.content { min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
#search { flex: 0 1 320px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; background: #fff; }
.spacer { flex: 1; }
.sort { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sort select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; font-size: 13px; background: #fff; }
.result-count { font-size: 12px; color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); transition: .12s;
}
.card:hover { box-shadow: 0 4px 14px rgba(16,24,40,.10); }
.card.s-open { border-left-color: var(--open); }
.card.s-closing_soon { border-left-color: var(--soon); }
.card.s-closed { border-left-color: var(--closed); }
.card.pinned { background: linear-gradient(0deg, #fffdf5, #fff); border-left-color: var(--gold); }
.card.hiddenrow { opacity: .55; }

.card-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.badge { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.badge.src { background: #eef2f6; color: #41506a; }
.badge.api { background: #e7effe; color: #1f4fb0; }
.badge.dday { color: #fff; }
.badge.dday.open { background: var(--open); }
.badge.dday.closing_soon { background: var(--soon); }
.badge.dday.closed { background: var(--closed); }
.badge.dday.unknown { background: #94a3b8; }
.badge.rnd { background: #f3e8ff; color: #7e22ce; }
.dup { font-size: 11px; color: var(--muted); }

.card h2 { font-size: 15.5px; font-weight: 700; line-height: 1.4; margin: 2px 0 4px; }
.card h2 a { color: var(--ink); }
.card h2 a:hover { color: var(--accent); }
.meta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.meta b { color: #3a4759; font-weight: 600; }
.llm { font-size: 12.5px; color: #4b5563; background: #f6f8fa; border-radius: 8px; padding: 6px 10px; margin-top: 8px; }
.llm .tag { font-weight: 700; color: var(--primary-ink); margin-right: 6px; }

.kw-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; align-items: center; }
.kw { font-size: 11px; background: #e3f3f0; color: var(--primary-ink); border-radius: 999px; padding: 2px 8px; }
.relbar { width: 64px; height: 5px; background: #eef1f5; border-radius: 999px; overflow: hidden; margin-left: auto; }
.relbar > span { display: block; height: 100%; background: linear-gradient(90deg, #5eb8a8, var(--primary)); }

.actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.act { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 5px 10px; font-size: 12px; cursor: pointer; color: #4b5563; transition: .12s; font-family: inherit; }
.act:hover { background: #f1f5f9; }
.act.on { font-weight: 700; }
.act.pin.on { background: #fef3c7; border-color: #facc15; color: #92660a; }
.act.int.on { background: #ffe4ef; border-color: #fb7baa; color: #b42a63; }
.act.hide.on { background: #e2e8f0; border-color: #94a3b8; color: #475569; }
.act.rev.on { background: #dcfce7; border-color: #4ade80; color: #15803d; }
.note { margin-left: auto; flex: 1 1 180px; min-width: 140px; }
.note input { width: 100%; padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; font-family: inherit; }

.pager { display: flex; justify-content: center; gap: 6px; margin: 18px 0; }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 6px 11px; cursor: pointer; font-size: 13px; }
.pager button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager button:disabled { opacity: .4; cursor: default; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 14px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1b2733; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); z-index: 50; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; }
  .views, .filter-block { flex: 1 1 100%; }
}
