* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  background: #f6f7f9;
  color: #111827;
  margin: 0;
  padding: 24px;
}
.wrap { max-width: 1400px; margin: 0 auto; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head h1 { margin: 0 0 4px; font-size: 24px; color: #0f172a; }
.subtitle { color: #64748b; font-size: 13px; }

.head-controls { display: flex; gap: 8px; align-items: center; }
.select {
  padding: 7px 11px; border: 1px solid #cbd5e1; border-radius: 8px;
  background: #fff; font-size: 13px; min-width: 160px;
}
.btn {
  background: #fff; border: 1px solid #cbd5e1; padding: 7px 11px;
  border-radius: 8px; cursor: pointer; font-size: 14px;
}
.btn:hover { background: #f1f5f9; }

.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 14px 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.card .label { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.card .value { font-size: 24px; font-weight: 700; color: #0f172a; }
.card.growth .value { color: #16a34a; }
.card.steady .value { color: #2563eb; }
.card.decline .value { color: #dc2626; }
.card.volatile .value { color: #d97706; }

.toolbar {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 12px 16px; margin-bottom: 16px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab {
  background: #f1f5f9; color: #475569; padding: 8px 14px;
  border-radius: 8px; cursor: pointer; font-size: 13px;
  font-weight: 500; border: 1px solid transparent; user-select: none;
  transition: all 0.15s;
}
.tab:hover { background: #e2e8f0; }
.tab.active { background: #2563eb; color: #fff; }
.tab .badge {
  display: inline-block; background: rgba(255,255,255,0.25);
  padding: 1px 7px; border-radius: 10px; font-size: 11px; margin-left: 4px;
  font-weight: 600;
}
.tab:not(.active) .badge { background: #cbd5e1; color: #475569; }

.controls { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.search-box {
  padding: 7px 11px; border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: 13px; min-width: 220px; background: #fff;
}
.search-box:focus { outline: none; border-color: #2563eb; }
.count-info { font-size: 12px; color: #64748b; }

section.table-section {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 8px; margin-bottom: 16px; overflow: hidden;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 1100px; }
th {
  background: #f8fafc; color: #475569; font-weight: 600; text-align: left;
  padding: 11px 10px; border-bottom: 1px solid #e2e8f0;
  font-size: 12px; cursor: pointer; user-select: none; position: sticky; top: 0;
  white-space: nowrap;
}
th:hover { background: #f1f5f9; }
th.num, td.num { text-align: right; }
th.sorted-asc::after { content: ' ↑'; color: #2563eb; }
th.sorted-desc::after { content: ' ↓'; color: #2563eb; }
td {
  padding: 10px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle;
}
tbody tr:hover { background: #f9fafb; }
td .name { display: block; max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.cat-chip {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
}
.cat-성장형 { background: #dcfce7; color: #166534; }
.cat-꾸준형 { background: #dbeafe; color: #1d4ed8; }
.cat-하락형 { background: #fee2e2; color: #991b1b; }
.cat-변동형 { background: #fef3c7; color: #92400e; }

.flag {
  display: inline-block; background: #fef3c7; color: #92400e;
  padding: 2px 6px; border-radius: 4px; font-size: 11px; margin-right: 3px; margin-bottom: 2px;
}
.flag-clean { color: #16a34a; font-size: 11px; }
.qa-perfect {
  background: #dcfce7; color: #166534; padding: 2px 8px;
  border-radius: 4px; font-size: 11px; font-weight: 600;
}

.empty { color: #94a3b8; font-size: 14px; padding: 40px 0; text-align: center; }

section.methodology {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 20px 24px; margin-top: 20px;
}
section.methodology h2 { margin: 0 0 12px; font-size: 17px; color: #0f172a; }
.method { font-size: 13px; color: #334155; line-height: 1.7; }
.method code { background: #f1f5f9; padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.method ul { margin: 8px 0; padding-left: 20px; }
.method li { margin: 4px 0; }

.footer { color: #94a3b8; font-size: 12px; margin-top: 24px; text-align: center; }

.banner-warn {
  background: #fef3c7; border: 1px solid #fde68a; color: #92400e;
  padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 13px;
}

@media (max-width: 768px) {
  body { padding: 12px; }
  .controls { margin-left: 0; width: 100%; }
  .search-box { flex: 1; min-width: 0; }
}
