:root {
  --fg: #222;
  --muted: #777;
  --bg: #fafafa;
  --line: #ddd;
  --accent: #1a73e8;
  --warn: #c00;
  --ok: #0a0;
}

* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard", Roboto,
    "Apple SD Gothic Neo", "맑은 고딕", sans-serif;
  margin: 0;
  color: var(--fg);
  background: white;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--muted); font-size: 12px; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: #1a1a1a; color: white;
}
header .brand { color: white; font-weight: bold; font-size: 16px; }
header nav a { color: #ccc; margin-left: 16px; }
header nav a:hover { color: white; }

main { padding: 20px 24px; max-width: 1600px; margin: 0 auto; }

footer {
  margin: 60px 0 20px; padding: 16px 24px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px; text-align: center;
}

/* ─── 검색 페이지 ─── */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.filters form {
  background: var(--bg); padding: 16px; border-radius: 6px;
  border: 1px solid var(--line);
  position: sticky; top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.filter-group { margin-bottom: 14px; }
.filter-group .group-label {
  display: block; font-weight: 600; font-size: 12px;
  color: #555; text-transform: uppercase; margin-bottom: 4px;
}
.filter-group input[type=number],
.filter-group select {
  padding: 4px 6px; border: 1px solid var(--line); border-radius: 3px;
  font-size: 13px; width: 100%;
}
.filter-group .range { display: flex; align-items: center; gap: 4px; }
.filter-group .range input { flex: 1; }
.filter-group .check {
  display: inline-flex; align-items: center; gap: 4px;
  margin-right: 8px; font-size: 13px; cursor: pointer;
}
.risk-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
}
.filter-group small { display: block; margin-top: 2px; }

button.primary {
  width: 100%; padding: 8px; background: var(--accent); color: white;
  border: 0; border-radius: 4px; font-weight: bold; cursor: pointer;
  font-size: 14px;
}
button.primary:hover { background: #155cb8; }
.reset {
  display: block; text-align: center; margin-top: 6px; font-size: 12px;
  color: var(--muted);
}

.result-bar {
  padding: 8px 0 12px; border-bottom: 2px solid var(--fg); margin-bottom: 12px;
}
.chips {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin: 0 0 16px 0; padding: 8px 0;
}
.chips-label { font-size: 12px; color: var(--muted); margin-right: 4px; }
.chip {
  display: inline-block; padding: 3px 10px; background: #e8f0fe;
  color: var(--accent); border-radius: 12px; font-size: 12px;
  text-decoration: none; border: 1px solid #cde0ff;
}
.chip:hover { background: #d4e3fc; text-decoration: none; }
.chip-reset { background: #fee; color: var(--warn); border-color: #fcc; }
.chip-reset:hover { background: #fdd; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* ─── 결과 표 ─── */
.result-table {
  border-collapse: collapse; width: 100%; font-size: 13px;
}
.result-table th, .result-table td {
  border-bottom: 1px solid var(--line); padding: 6px 8px; vertical-align: top;
}
.result-table th { background: #333; color: white; text-align: left; }
.result-table td.r { text-align: right; }
.result-table td.c { text-align: center; }
.result-table tr:hover td { background: #f5faff; }
.result-table tr.risky { background: #fff5f5; }
.result-table tr.risky:hover td { background: #ffeded; }
.result-table .bn { font-weight: 500; }
.result-table .discount { color: var(--warn); font-weight: bold; }
.risk-badge { display: inline-block; padding: 1px 5px; background: #fee; color: var(--warn);
              border-radius: 3px; font-size: 11px; }
.safe-badge { color: var(--ok); }

.pager {
  display: flex; justify-content: center; gap: 16px; align-items: center;
  margin: 24px 0; font-size: 14px;
}
.pager a { padding: 4px 12px; border: 1px solid var(--line); border-radius: 3px; }

/* ─── 상세 페이지 ─── */
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); }
.item-meta { margin: 8px 0 16px; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px;
  background: #eee; color: #444; margin-right: 6px;
}
.badge.active { background: #e0ffe0; color: var(--ok); }
.badge.inactive { background: #fee; color: var(--warn); }

table.detail {
  border-collapse: collapse; margin-bottom: 24px;
  width: 100%; max-width: 800px;
}
table.detail th, table.detail td {
  border: 1px solid var(--line); padding: 8px 12px; text-align: left;
}
table.detail th { background: var(--bg); width: 140px; font-weight: 600; }

.risk-flags { margin-bottom: 16px; }
.risk-flags .risk-badge { font-size: 13px; padding: 4px 10px; margin-right: 4px; }
pre.bigo {
  background: var(--bg); border-left: 3px solid var(--line);
  padding: 12px 16px; white-space: pre-wrap; font-size: 13px;
  font-family: inherit;
}

.hour-picker { margin: 12px 0; }
.discount { color: var(--warn); }
