* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Pretendard", "Malgun Gothic", -apple-system, sans-serif;
  background: #f5f6f8;
  color: #1f2430;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: #1f2937;
  color: #fff;
}
.topbar .brand { font-weight: 600; }
.topbar nav a {
  color: #cbd5e1;
  text-decoration: none;
  margin-left: 20px;
  font-size: 14px;
}
.topbar nav a:hover { color: #fff; }
.topbar nav .inline-form-btn { display: inline; margin-left: 20px; }
.topbar nav .link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #cbd5e1;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.topbar nav .link-btn:hover { color: #fff; }

.login-card { max-width: 360px; margin: 40px auto; }
.login-card .form-row { margin-top: 12px; }
.login-card input[type="password"] { flex: 1; }

.container { max-width: 960px; margin: 32px auto; padding: 0 20px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
}
/* 새로고침 버튼은 탭과 같은 글씨 크기로 두되, 아래 실선에 얹힌 것처럼 아래 모서리는 각지게. */
.page-head .btn {
  font-size: 14px;
  padding: 6px 14px;
  margin-bottom: 0;
  border-radius: 6px 6px 0 0;
}

h1 { font-size: 20px; margin: 0 0 8px; }
h2 { font-size: 15px; margin: 0 0 12px; color: #475569; }

.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 24px;
}

.view-tabs {
  display: flex;
  gap: 4px;
}
.view-tab {
  padding: 10px 18px;
  color: #64748b;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.view-tab:hover { color: #1f2430; }
.view-tab.active {
  color: #1d4ed8;
  border-bottom-color: #1d4ed8;
}

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 13px;
  text-decoration: none;
}
.pill:hover { border-color: #cbd5e1; background: #f8fafc; }
.pill.active {
  background: #1f2937;
  border-color: #1f2937;
  color: #fff;
  font-weight: 600;
}
.pill-count {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef1f5;
  color: #64748b;
}
.pill.active .pill-count { background: rgba(255, 255, 255, 0.2); color: #fff; }

.sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sort-link:hover { color: #2563eb; }
.sort-link.active { color: #1f2430; }
.sort-link .arrow { font-size: 9px; }

.balance-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}
.balance-table th, .balance-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #eef1f5;
  font-size: 14px;
}
.balance-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  font-size: 13px;
}
.balance-table tr:last-child td { border-bottom: none; }

.amount { font-weight: 600; }
/* 숫자 열은 오른쪽 정렬해야 자릿수가 세로로 맞는다. */
.balance-table th.num, .balance-table td.num { text-align: right; }
.runway-alert { color: #b91c1c; font-weight: 700; }

.summary-strip {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.summary-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
}
.summary-card .label { font-size: 11px; color: #64748b; margin-bottom: 3px; }
.summary-card .value { font-size: 15px; font-weight: 700; color: #1f2430; }
.summary-card .card-delta { font-size: 11px; color: #64748b; margin-top: 3px; }
.summary-card.highlight {
  background: #eff6ff;
  border-color: #93c5fd;
}
.summary-card.highlight .value { color: #1d4ed8; }
.summary-card.warn {
  background: #fef2f2;
  border-color: #fca5a5;
}
.summary-card.warn .value { color: #b91c1c; }

.roas-value { font-weight: 700; color: #047857; }

.spend-col { background: #f5f9ff; }
.spend-amount { font-weight: 700; color: #1d4ed8; }

.chart-card { padding: 18px 20px 8px; }
.chart-legend { display: flex; gap: 16px; margin-bottom: 4px; font-size: 12px; color: #64748b; }
.legend-swatch { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 2px; vertical-align: middle; }
.legend-swatch.bar { background: #bfdbfe; }
.monthly-chart { width: 100%; height: auto; display: block; }
.chart-axis { stroke: #e2e8f0; stroke-width: 1; }
.chart-axis-label { font-size: 9px; fill: #94a3b8; text-anchor: middle; }
.chart-bar { fill: #bfdbfe; }
.delta-up { color: #1d4ed8; font-weight: 600; }
.delta-down { color: #64748b; font-weight: 600; }

.anomaly-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.anomaly-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 14px;
}
.anomaly-manager { color: #64748b; font-size: 13px; }
.anomaly-name { font-weight: 700; }
.anomaly-desc { color: #475569; }
.anomaly-desc strong { color: #1f2430; }

.insight-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.insight-tag.tag-danger { background: #fef2f2; color: #b91c1c; }
.insight-tag.tag-warn { background: #fff7ed; color: #c2410c; }
.insight-tag.tag-up { background: #eff6ff; color: #1d4ed8; }
.insight-tag.tag-down { background: #f1f5f9; color: #475569; }
.insight-tag.tag-info { background: #ecfdf5; color: #047857; }
.insight-tag.tag-muted { background: #f1f5f9; color: #64748b; }

.section-divider {
  margin: 32px 0 14px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}
.section-divider h2 { margin: 0; }

.detail-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.account-select-form select {
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
}

/* 위 담당자 필터(pill)와 헷갈리지 않게, 요약/상세는 세그먼트 스위치 모양으로 구분한다. */
.mode-switch {
  display: inline-flex;
  padding: 3px;
  background: #eef1f5;
  border-radius: 999px;
}
.mode-option {
  padding: 6px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  text-decoration: none;
}
.mode-option:hover { color: #1f2430; }
.mode-option.active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
}

.account-link { color: inherit; text-decoration: none; }
.account-link:hover { color: #2563eb; text-decoration: underline; }
.account-link.active { color: #1d4ed8; font-weight: 600; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; color: #64748b; }
.muted { color: #94a3b8; }
.error-text { color: #b91c1c; font-weight: 600; }

.btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover { background: #1d4ed8; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.ghost { background: #e2e8f0; color: #334155; }
.btn.ghost:hover { background: #cbd5e1; }
.btn.danger { background: #dc2626; }
.btn.danger:hover { background: #b91c1c; }

.form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.form-row input, .form-row select {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
}
.form-row input[type="text"] { flex: 1; min-width: 140px; }

.actions { display: flex; gap: 6px; align-items: center; }
.inline-form-btn { display: inline; margin: 0; }

td input[type="text"], td input[type="number"] {
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 13px;
  width: 100%;
}
td input[type="number"] { width: 90px; }

.empty { color: #64748b; padding: 20px 0; }
