:root {
  --bg: #061018;
  --panel: #101d29;
  --panel-2: #0c1722;
  --line: rgba(148, 163, 184, .18);
  --line-strong: rgba(148, 163, 184, .28);
  --text: #f8fafc;
  --muted: #9fb0c2;
  --muted-2: #cbd5e1;
  --orange: #ff7a00;
  --orange-2: #ff9a2f;
  --blue: #38a7ff;
  --green: #32d583;
  --purple: #8b5cf6;
  --red: #fb7185;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 16% 0%, rgba(56, 167, 255, .08), transparent 28%),
    radial-gradient(circle at 100% 16%, rgba(255, 122, 0, .13), transparent 30%),
    linear-gradient(180deg, #051018 0%, #07121b 52%, #060d14 100%);
}

button, select { font-family: inherit; }

.page-shell {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 24px 24px 32px;
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-symbol {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--orange), #ff9d2e);
  color: #fff;
  font-weight: 900;
  font-size: 20px;
  box-shadow: 0 14px 32px rgba(255, 122, 0, .23);
}

.report-header h1 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.06em;
  text-shadow: 0 1px 0 rgba(255, 122, 0, .2);
}

.report-header p {
  margin: 7px 0 0;
  color: #9fc2e8;
  font-size: 13px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.header-period {
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 11px 18px;
  background: rgba(15, 23, 42, .52);
  color: #dbeafe;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.download-btn,
.refresh-btn {
  height: 44px;
  border: 1px solid rgba(255, 122, 0, .58);
  border-radius: 12px;
  padding: 0 18px;
  background: rgba(255, 122, 0, .12);
  color: #ffb067;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}

.download-btn:hover,
.refresh-btn:hover { background: rgba(255, 122, 0, .2); }

.download-btn {
  background: rgba(56, 167, 255, .12);
  border-color: rgba(56, 167, 255, .45);
  color: #b9ddff;
}

.download-btn:hover { background: rgba(56, 167, 255, .2); }

.filter-panel {
  display: grid;
  grid-template-columns: 1.05fr 1.1fr 1.1fr 1.45fr 1.1fr auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(19, 34, 48, .96), rgba(13, 20, 29, .96));
}

.filter-item { min-width: 0; }

.filter-item label {
  display: block;
  margin: 0 0 7px;
  color: #b7c8dc;
  font-size: 12px;
  font-weight: 900;
}

.filter-help {
  margin: 6px 2px 0;
  color: #7f93a8;
  font-size: 11px;
  font-weight: 800;
}

select {
  width: 100%;
  height: 44px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 12px;
  padding: 0 14px;
  color: #f8fafc;
  background: #07121d;
  font-weight: 850;
  outline: none;
}

select:disabled {
  opacity: .42;
  cursor: not-allowed;
}

select:focus {
  border-color: rgba(255, 122, 0, .7);
  box-shadow: 0 0 0 3px rgba(255, 122, 0, .12);
}

.filter-item.is-active label { color: #ffbd7a; }
.filter-item.is-active select { border-color: rgba(255, 122, 0, .52); }

.period-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.period-card {
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 17px 18px;
  background: linear-gradient(135deg, rgba(18, 34, 48, .94), rgba(12, 18, 27, .94));
  min-width: 0;
}

.period-card .dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
}

.period-card.current .dot { background: var(--orange); }
.period-card.prev-month .dot { background: var(--blue); }
.period-card.prev-year .dot { background: var(--purple); }

.period-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 950;
}

.period-card p {
  margin: 0;
  color: #bcd0e7;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.kpi-card {
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 20px;
  padding: 20px;
  min-height: 190px;
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 122, 0, .16), transparent 34%),
    linear-gradient(135deg, rgba(18, 34, 48, .97), rgba(12, 19, 28, .97));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 14px 30px rgba(0,0,0,.14);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.kpi-card:hover,
.kpi-card:focus {
  transform: translateY(-2px);
  border-color: rgba(255, 122, 0, .5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 18px 42px rgba(0,0,0,.24);
  outline: none;
}

.kpi-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 122, 0, .38);
  background: rgba(255, 122, 0, .13);
  color: #ff8a1c;
  font-weight: 950;
}

.kpi-title {
  margin: 0 0 5px;
  font-size: 19px;
  font-weight: 950;
  letter-spacing: -0.04em;
  color: #fff;
}

.kpi-group {
  color: #a7b8cb;
  font-size: 12px;
  font-weight: 800;
}

.kpi-chip {
  flex: 0 0 auto;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 999px;
  padding: 5px 10px;
  color: #d4e2f2;
  background: rgba(2, 6, 23, .28);
  font-size: 12px;
  font-weight: 900;
}

.kpi-value {
  margin: 0 0 18px;
  font-size: 42px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.06em;
  color: #f8fafc;
}

.kpi-rates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kpi-rate-box {
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 14px;
  background: rgba(2, 6, 23, .28);
  padding: 10px;
}

.rate-label {
  display: block;
  margin-bottom: 5px;
  color: #b8c7d7;
  font-size: 12px;
  font-weight: 900;
}

.rate-value {
  display: block;
  color: #fff;
  font-size: 16px;
  font-weight: 950;
  margin-bottom: 3px;
}

.rate-up,
.rate-good { color: var(--green); font-weight: 950; }
.rate-down,
.rate-bad { color: var(--red); font-weight: 950; }
.rate-flat { color: #94a3b8; font-weight: 950; }

.dashboard-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(390px, .95fr);
  gap: 18px;
  align-items: stretch;
  width: 100%;
  margin-bottom: 18px;
}

.dashboard-chart-grid .chart-wide { grid-column: 1 / 2; min-width: 0; }
.dashboard-chart-grid .chart-side { grid-column: 2 / 3; min-width: 0; }

.panel,
.table-panel,
.insight-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(255, 122, 0, .08), transparent 32%),
    linear-gradient(135deg, rgba(18, 34, 48, .97), rgba(11, 17, 25, .97));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}

.panel {
  padding: 24px;
  min-height: 420px;
  overflow: hidden;
}

.trend-card,
.group-card,
.conversion-card,
.compare-card { height: 100%; }

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.panel-subtitle {
  margin: 7px 0 0;
  color: #9fb0c2;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.panel-header select {
  width: auto;
  min-width: 160px;
  height: 40px;
  font-size: 12px;
}

.chart-box {
  position: relative;
  width: 100%;
  height: 300px;
  min-width: 0;
}

.chart-box.tall { height: 320px; }
.chart-box.donut { height: 250px; }

.donut-layout {
  display: grid;
  grid-template-columns: minmax(170px, .9fr) minmax(190px, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 320px;
}

.group-legend {
  display: grid;
  gap: 12px;
}

.group-legend div {
  position: relative;
  padding: 13px 14px 13px 34px;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 14px;
  background: rgba(2, 6, 23, .22);
}

.legend-dot {
  position: absolute;
  left: 14px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.legend-dot.orange { background: var(--orange); }
.legend-dot.blue { background: var(--blue); }
.legend-dot.green { background: var(--green); }

.group-legend b {
  display: block;
  margin-bottom: 6px;
  color: #f8fafc;
  font-size: 14px;
  font-weight: 950;
}

.group-legend p {
  margin: 0;
  color: #b8c7d7;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
}

.group-count {
  display: inline-block;
  margin-left: 6px;
  color: #ffbd7a;
  font-size: 12px;
  font-weight: 950;
}

.insight-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 22px 28px;
  margin-bottom: 18px;
}

.insight-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--orange-2);
  font-size: 20px;
  font-weight: 950;
  white-space: nowrap;
}

.insight-panel p {
  margin: 0;
  color: #d5e3f2;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.6;
}

.insight-panel button {
  height: 48px;
  border: 1px solid rgba(255, 122, 0, .62);
  border-radius: 14px;
  padding: 0 22px;
  color: #ff9a2f;
  background: rgba(255, 122, 0, .08);
  font-weight: 950;
  cursor: pointer;
}

.table-panel { padding: 24px; }

.table-scroll {
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, .12);
  border-radius: 16px;
}

table {
  width: 100%;
  min-width: 1060px;
  border-collapse: collapse;
}

th, td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
  text-align: right;
  font-size: 13px;
  white-space: nowrap;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) { text-align: left; }

th {
  color: #bcd0e7;
  background: rgba(2, 6, 23, .28);
  font-weight: 950;
}

td {
  color: #edf4fb;
  font-weight: 750;
}

tr.total-row td {
  color: #fff;
  background: rgba(255, 122, 0, .09);
  font-weight: 950;
}

.empty-state {
  margin-top: 18px;
  border: 1px solid rgba(251, 113, 133, .28);
  border-radius: 18px;
  padding: 18px;
  background: rgba(251, 113, 133, .08);
  color: #fecdd3;
  font-weight: 800;
}

.kpi-modal[hidden],
.empty-state[hidden] { display: none !important; }

.kpi-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 6, 12, .72);
  backdrop-filter: blur(8px);
}

.kpi-modal-card {
  position: relative;
  width: min(620px, 94vw);
  border: 1px solid rgba(255, 122, 0, .45);
  border-radius: 26px;
  padding: 32px;
  background:
    radial-gradient(circle at top right, rgba(255, 122, 0, .18), transparent 36%),
    linear-gradient(135deg, rgba(15, 32, 46, .98), rgba(14, 21, 30, .98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, .55);
}

.kpi-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.modal-eyebrow {
  margin: 0 0 8px;
  color: #ff9a2f;
  font-size: 14px;
  font-weight: 950;
}

.kpi-modal-card h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.05em;
}

.modal-value {
  margin: 18px 0 24px;
  font-size: 58px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.06em;
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.modal-stats > div {
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 18px;
  padding: 18px;
  background: rgba(15, 23, 42, .52);
}

.modal-stats span {
  display: block;
  margin-bottom: 8px;
  color: #a8b6c8;
  font-size: 13px;
  font-weight: 900;
}

.modal-stats strong {
  display: block;
  margin-bottom: 6px;
  font-size: 25px;
}

.modal-stats p, .modal-desc { margin: 0; }

.modal-desc {
  color: #cbd5e1;
  line-height: 1.65;
  font-weight: 700;
}

@media (max-width: 1260px) {
  .filter-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .refresh-btn { grid-column: 1 / -1; }
  .dashboard-chart-grid { grid-template-columns: 1fr; }
  .dashboard-chart-grid .chart-wide,
  .dashboard-chart-grid .chart-side { grid-column: auto; }
}

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .page-shell { padding: 18px 14px 26px; }
  .report-header,
  .insight-panel { grid-template-columns: 1fr; display: grid; }
  .header-actions { justify-content: stretch; }
  .download-btn, .header-period { width: 100%; text-align: center; white-space: normal; }
  .filter-panel,
  .period-grid,
  .kpi-grid,
  .modal-stats { grid-template-columns: 1fr; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .panel-header select { width: 100%; }
  .donut-layout { grid-template-columns: 1fr; }
  .kpi-card { min-height: auto; }
  .modal-value { font-size: 46px; }
}


/* ─────────────────────────────────────
   헤더 로고/타이틀 정렬 보정
   ───────────────────────────────────── */
.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding-top: 6px;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-symbol.image-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
}

.brand-symbol.image-logo img {
  width: 46px;
  height: 46px;
  display: block;
  object-fit: contain;
  border-radius: 14px;
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(24px, 2.2vw, 34px);
  line-height: 1.12;
  font-weight: 950;
  letter-spacing: -0.06em;
  color: #ffffff;
  white-space: nowrap;
}

.brand-text p {
  margin: 7px 0 0;
  color: #9fc2e8;
  font-size: 13px;
  font-weight: 800;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .report-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .brand-text h1 {
    white-space: normal;
    font-size: 24px;
  }

  .header-actions {
    justify-content: flex-start;
    width: 100%;
  }
}
