:root {
  --border: #e2e5ea;
  --bg: #f7f8fa;
  --sidebar-bg: #1f2733;
  --sidebar-fg: #cbd2dc;
  --sidebar-fg-dim: #8892a0;
  --accent: #2f6fed;
  --text: #1a1d23;
  --error: #d64545;
  --success: #1f9d55;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* --- 로그인 / 비밀번호 변경 (센터 카드) --- */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.auth-box h1 {
  font-size: 18px;
  margin: 0 0 12px;
}

.notice { font-size: 13px; color: #555; margin: 0 0 20px; }
.error { color: var(--error); font-size: 13px; margin: 0 0 12px; }
.success { color: var(--success); font-size: 14px; }

.google-login-btn {
  display: inline-block;
  width: 100%;
  padding: 11px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  text-decoration: none;
  box-sizing: border-box;
}
.google-login-btn:hover { opacity: 0.92; }

/* --- 앱 셸 (좌측 메뉴 고정 + 우측 컨텐츠) --- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}

.sidebar-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  padding: 4px 20px 20px;
}

.menu-group { margin-bottom: 18px; }

.menu-group-label {
  font-size: 11px;
  color: var(--sidebar-fg-dim);
  padding: 0 20px 6px;
  letter-spacing: 0.03em;
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--sidebar-fg);
  padding: 9px 20px;
  font-size: 13.5px;
  cursor: pointer;
}

.menu-item:hover { background: rgba(255,255,255,0.06); }
.menu-item.active { background: rgba(255,255,255,0.1); color: #fff; font-weight: 600; }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 20px 4px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-name { font-size: 13px; color: #fff; margin-bottom: 8px; }

#logout-btn {
  width: 100%;
  padding: 7px;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 5px;
  color: var(--sidebar-fg);
  font-size: 12.5px;
  cursor: pointer;
}
#logout-btn:hover { background: rgba(255,255,255,0.16); }

.content {
  flex: 1;
  padding: 32px 40px;
  min-width: 0;
}

.placeholder h2 { margin-top: 0; font-size: 18px; }
.placeholder p { color: #777; font-size: 14px; }

/* --- 채널별 이익 화면 --- */

.content h2 { margin-top: 0; font-size: 18px; }
.content h3 { font-size: 15px; margin: 28px 0 10px; }

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: #555;
}
.filter-bar input, .filter-bar select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13.5px;
}
.filter-bar button {
  padding: 8px 18px;
  border: none;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  cursor: pointer;
  height: fit-content;
}

.queried-at { font-size: 12.5px; color: #888; margin: 0 0 12px; }

.warning {
  background: #fff6e5;
  border: 1px solid #f0c869;
  color: #8a5a00;
  border-radius: 5px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.profit-table, .common-costs {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 13.5px;
}
.profit-table th, .profit-table td, .common-costs td {
  border-bottom: 1px solid var(--border);
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}
.profit-table th { color: #666; font-weight: 600; font-size: 12.5px; text-align: center; }
.profit-table td.num, .common-costs td.num { text-align: right; font-variant-numeric: tabular-nums; }
.profit-table td.negative { color: var(--error); }
.profit-table tr.row-unavailable td { color: #999; font-style: italic; }
.profit-table tr.row-note td { color: #888; font-size: 12px; padding-top: 0; border-bottom: 1px solid var(--border); white-space: normal; }
.common-costs td.method { color: #999; font-size: 12px; }

.badge {
  display: inline-block;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 3px;
  background: #fde68a;
  color: #7a5b00;
  margin-left: 4px;
}

/* 좁은 화면에서는 표를 가로 스크롤 컨테이너로 */
@media (max-width: 700px) {
  .profit-table, .common-costs { display: block; overflow-x: auto; }
}

/* 400px 좁은 화면에서도 사이드바가 화면을 다 먹지 않게 */
@media (max-width: 560px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; padding: 12px 0; }
  .content { padding: 20px; }
}
