﻿:root {
  --bg: #f0f4f7;
  --panel: #ffffff;
  --ink: #3d4e5c;
  --strong: #2c3a47;
  --muted: #8fa0b0;
  --line: #e2e8ed;
  --grid: rgba(60, 90, 110, 0.07);
  --mint: #3ecbc4;
  --mint-soft: rgba(62, 203, 196, 0.12);
  --blue: #4691c7;
  --gold: #d4c35a;
  --rose: #e09ea0;
  --shadow: 0 2px 12px rgba(40, 60, 80, 0.10), 0 1px 3px rgba(40, 60, 80, 0.05);
  --positive: #27ae7a;
  --positive-soft: rgba(39, 174, 122, 0.1);
  --negative: #d95a5a;
  --negative-soft: rgba(217, 90, 90, 0.1);
  --warning: #d9933a;
  --warning-soft: rgba(217, 147, 58, 0.1);

  --sidebar-bg: #182030;
  --sidebar-border: rgba(255, 255, 255, 0.05);
  --sidebar-text: #7a9cb0;
  --sidebar-strong: #d0e4f0;
  --sidebar-hover-bg: rgba(62, 203, 196, 0.13);
  --sidebar-hover-text: #b8d8e8;
  --sidebar-active-bg: rgba(62, 203, 196, 0.2);
  --sidebar-active-text: #4ecdc4;
  --sidebar-active-border: rgba(62, 203, 196, 0.45);
  --sidebar-sub-border: rgba(100, 180, 200, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans KR", Inter, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

/* ─── Sidebar ─────────────────────────────────────────────── */

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 298px;
  padding: 24px 16px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  z-index: 20;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* 사이드바 하단 '데이터 기준' */
.sidebar-data-source {
  margin-top: auto;
  padding: 14px 12px 4px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-data-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 700;
  letter-spacing: 0.03em;
}
.sidebar-data-source strong {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 700;
  word-break: keep-all;
}
.sidebar-data-source small {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
}

.sidebar-title {
  display: grid;
  gap: 4px;
  margin-bottom: 28px;
  padding: 0 4px;
}

.sidebar-title strong {
  color: var(--sidebar-strong);
  font-size: 23px;
}

.sidebar-logo {
  width: 110px;
  height: auto;
  display: block;
  margin-bottom: 4px;
}

.sidebar-title span {
  color: #4a6e80;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.side-nav {
  display: grid;
  gap: 4px;
}

.side-nav-button {
  height: 40px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--sidebar-text);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  text-align: left;
  padding: 0 14px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
}

.side-nav-button.is-active .nav-icon,
.side-nav-button:hover .nav-icon { opacity: 1; }

.nav-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-nav-button:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-hover-text);
}

.side-nav-button.is-active {
  border-color: var(--sidebar-active-border);
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.summary-media-nav {
  display: grid;
  gap: 2px;
  margin: 0 0 8px;
  padding: 6px 0 6px 10px;
  border-left: 2px solid var(--sidebar-sub-border);
}

.summary-nav-label {
  color: #3a5a68;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0 8px 4px;
}

.summary-month-label {
  margin-top: 6px;
  padding: 4px 8px 2px;
  border-top: 1px solid rgba(100, 160, 190, 0.1);
  color: #4a6e80;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.summary-month-label:first-of-type {
  margin-top: 0;
}

.summary-media-button {
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  color: #5a8298;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  padding: 0 10px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}

.summary-media-button:hover,
.summary-media-button.is-active {
  border-color: var(--sidebar-active-border);
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

/* Promotion select button in sidebar */
.promotion-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.promotion-select-badge {
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
  color: var(--sidebar-active-text);
  background: var(--sidebar-active-bg);
  border: 1px solid var(--sidebar-active-border);
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* ─── Main shell ──────────────────────────────────────────── */

.dashboard-shell {
  width: calc(100% - 298px);
  margin: 0 0 0 298px;
  padding: 20px 24px 32px;
}

.view-section {
  display: none;
}

.view-section.is-active {
  display: block;
}

/* 매체 보고서 섹션 간격 */
.media-section-gap {
  margin-bottom: 14px;
}

/* 매체 색상 점 (테이블 내) */
.media-color-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  flex-shrink: 0;
  vertical-align: middle;
  margin-bottom: 1px;
}

/* ─── Topbar ──────────────────────────────────────────────── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0 0 5px;
  color: #576470;
  font-size: 22px;
  font-weight: 800;
}

.topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.header-date {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.date-source {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-source span,
.date-source small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.date-source strong {
  color: var(--strong);
  font-size: 13px;
  font-weight: 800;
}

.date-controls {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}

.date-picker-shell {
  justify-content: flex-end;
}

.date-range-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 242px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--strong);
  font: inherit;
  padding: 0 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.14s, background 0.14s;
}

.date-range-trigger:hover,
.date-range-trigger[aria-expanded="true"] {
  border-color: var(--mint);
  background: #fbffff;
}

.date-range-trigger span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.date-range-trigger strong {
  flex: 1;
  color: var(--strong);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
}

.date-range-trigger svg {
  color: var(--muted);
  flex-shrink: 0;
}

.date-picker-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 35;
  display: none;
  width: min(560px, calc(100vw - 32px));
  padding: 18px 14px 12px;
  border: 1px solid rgba(220, 229, 235, 0.95);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(40, 60, 80, 0.17);
}

.date-picker-panel.is-open {
  display: block;
}

.date-picker-months {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.date-picker-calendar {
  min-width: 0;
}

.date-picker-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  margin-bottom: 10px;
}

.date-picker-month-header strong {
  color: var(--strong);
  font-size: 16px;
  font-weight: 800;
}

.date-picker-month-header strong span {
  color: var(--muted);
  font-size: 12px;
}

.date-picker-nav {
  display: inline-flex;
  gap: 4px;
}

.date-picker-nav button {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: #8c9aa5;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.date-picker-nav button:hover {
  border-color: var(--mint);
  color: #237570;
}

.date-picker-weekdays,
.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px 8px;
}

.date-picker-weekdays {
  margin-bottom: 8px;
}

.date-picker-weekdays span {
  color: var(--strong);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.date-picker-weekdays span:first-child {
  color: #f04a62;
}

.date-picker-day {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--strong);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
  justify-self: center;
}

.date-picker-day:hover:not(.is-disabled):not(.is-empty) {
  background: var(--mint-soft);
  color: #237570;
}

.date-picker-day.is-disabled {
  color: #bdc8d1;
  cursor: default;
}

.date-picker-day.is-in-range {
  border-radius: 8px;
  background: rgba(62, 203, 196, 0.1);
  color: #237570;
}

.date-picker-day.is-start,
.date-picker-day.is-end {
  background: var(--blue);
  color: #ffffff;
  font-weight: 800;
}

.date-picker-day.is-empty {
  pointer-events: none;
}

.date-picker-empty {
  grid-column: 1 / -1;
  padding: 36px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.date-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.date-picker-presets {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.date-preset-chip,
.date-picker-reset,
.date-picker-pin {
  min-width: 0;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: #f3f6f8;
  color: var(--strong);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 0 10px;
  cursor: pointer;
  box-shadow: none;
}

.date-preset-chip:hover,
.date-picker-reset:hover,
.date-picker-pin:hover {
  background: var(--mint-soft);
  color: #237570;
}

.date-preset-chip.is-active {
  background: rgba(62, 203, 196, 0.16);
  color: #237570;
}

.date-picker-reset {
  color: #7f8d98;
  text-decoration: underline;
  background: transparent;
}

.date-picker-pin {
  color: #5d746e;
  background: #edf4f2;
}

.date-picker-pin.is-active {
  background: #2f876e;
  color: #ffffff;
}

.date-presets {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

.date-divider {
  width: 1px;
  height: 32px;
  background: var(--line);
  flex-shrink: 0;
  margin: 0 3px;
}

.date-sep {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 0 2px;
}

.preset-button {
  min-width: 46px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  padding: 4px 9px;
  cursor: pointer;
  border-radius: 10px;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  white-space: nowrap;
}

.preset-main {
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
}

.preset-sub {
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.2;
}

.preset-button:hover {
  border-color: var(--mint);
  background: var(--mint-soft);
  color: #2a7a76;
}

.preset-button:hover .preset-sub {
  color: #2a7a76;
  opacity: 0.8;
}

.preset-button.is-active {
  border-color: var(--mint);
  background: rgba(62, 203, 196, 0.18);
  color: #226e6a;
}

.preset-button.is-active .preset-sub {
  color: #226e6a;
  opacity: 0.8;
}

.date-controls label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  margin: 0;
}

.date-controls input[type="date"] {
  width: 130px;
  height: 30px;
  flex-shrink: 0;
}

.date-apply-button {
  height: 30px;
  border: 1px solid var(--mint);
  background: rgba(62, 203, 196, 0.15);
  color: #2a7070;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 0 13px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}

.date-apply-button:hover {
  background: rgba(62, 203, 196, 0.28);
}

.date-picker-presets .date-preset-chip {
  min-width: 0;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: #f3f6f8;
  color: var(--strong);
  padding: 0 10px;
  box-shadow: none;
  display: inline-flex;
  flex-direction: row;
}

.date-picker-presets .date-preset-chip:hover,
.date-picker-presets .date-preset-chip.is-active {
  border: 0;
  background: rgba(62, 203, 196, 0.16);
  color: #237570;
}

.date-picker-footer .date-apply-button {
  min-width: 56px;
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.date-picker-footer .date-apply-button:hover {
  background: #357fb4;
}

/* ─── Filters ─────────────────────────────────────────────── */

/* ─── Filter Bar ──────────────────────────────────────────── */

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.quick-media-filter {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  flex: 1 1 560px;
}

.quick-media-filter.is-hidden {
  display: none;
}

.quick-filter-label {
  color: #6f7c87;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.media-quick-list {
  display: grid;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  padding: 0 2px 4px;
  scrollbar-width: thin;
}

.media-quick-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.media-quick-row.is-major-row {
  background: rgba(237, 246, 243, 0.72);
  border: 1px solid rgba(222, 235, 231, 0.92);
  border-radius: 999px;
  padding: 3px;
  width: fit-content;
}

.media-quick-row.is-children {
  padding-left: 3px;
}

.media-quick-btn {
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #6d7c88;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 0 12px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  white-space: nowrap;
}

.media-quick-btn.is-major {
  color: var(--strong);
  font-weight: 800;
}

.media-quick-btn:hover {
  border-color: transparent;
  background: rgba(47, 135, 110, 0.09);
  color: #237570;
}

.media-quick-btn[data-media-group="meta"]:hover {
  background: rgba(45, 112, 230, 0.1);
  color: #2d70e6;
}

.media-quick-btn[data-media-group="google"]:hover {
  background: rgba(218, 76, 76, 0.1);
  color: #c63f3f;
}

.media-quick-btn.is-active {
  border-color: transparent;
  background: #2f876e;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(47, 135, 110, 0.16);
}

.media-quick-btn[data-media-group="meta"].is-active {
  background: #2d70e6;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(45, 112, 230, 0.16);
}

.media-quick-btn[data-media-group="google"].is-active {
  background: #da4c4c;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(218, 76, 76, 0.16);
}

.filter-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  margin-left: auto;
  flex-shrink: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filter-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 36px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--strong);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.filter-open-btn:hover,
.filter-open-btn.has-active {
  border-color: var(--mint);
  background: var(--mint-soft);
  color: #237570;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--mint);
  color: #fff;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 800;
}

.filter-badge[hidden], .active-chips:empty { display: none; }

.active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  align-items: center;
}

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 10px;
  background: var(--mint-soft);
  border: 1px solid rgba(62, 203, 196, 0.3);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #237570;
}

.active-chip button {
  all: unset;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  opacity: 0.6;
  padding: 1px 2px;
}

.active-chip button:hover { opacity: 1; }

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 36px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--strong);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  margin-left: 0;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}

.export-btn:hover {
  border-color: var(--mint);
  background: var(--mint-soft);
  color: #237570;
}

#exportCsvDataset {
  width: 248px;
  flex: 0 1 248px;
  min-width: 0;
  min-height: 36px;
  max-width: 100%;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--strong);
  font: inherit;
  font-size: 12px;
}

.export-status { color: var(--muted); font-size: 12px; }
.export-status:empty { display: none; }

/* ─── Filter Drawer ───────────────────────────────────────── */

.filter-drawer {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
}

.filter-drawer.is-open {
  pointer-events: all;
}

.filter-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 30, 45, 0.35);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.filter-drawer.is-open .filter-drawer-overlay {
  opacity: 1;
}

.filter-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: var(--panel);
  box-shadow: -4px 0 32px rgba(40,60,80,0.16);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
}

.filter-drawer.is-open .filter-drawer-panel {
  transform: translateX(0);
}

.filter-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.filter-drawer-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--strong);
}

.filter-drawer-close {
  all: unset;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.filter-drawer-close:hover {
  background: var(--bg);
  color: var(--strong);
}

.filter-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-section-label {
  font-size: 11px;
  line-height: 1.45;
  font-weight: 800;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 9px;
}

.filter-select-wrap {
  position: relative;
  width: 100%;
}

.filter-drawer-select {
  position: relative;
  z-index: 0;
  width: 100%;
  height: 40px;
  padding: 0 40px 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: transparent;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 40px;
  box-sizing: border-box;
  text-indent: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238fa0b0' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.15s;
}

.filter-select-display {
  position: absolute;
  z-index: 2;
  left: 16px;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.filter-drawer-select option {
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--panel);
}

.filter-drawer-select:focus {
  outline: none;
  border-color: var(--mint);
}

.filter-drawer-select:focus + .filter-select-display {
  color: var(--strong);
}

.filter-drawer-footer {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.filter-drawer-reset {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.filter-drawer-reset:hover {
  border-color: var(--strong);
  color: var(--strong);
}

.filter-drawer-apply {
  flex: 2;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--mint);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s;
}

.filter-drawer-apply:hover { opacity: 0.88; }

/* ─── Metric Switcher ─────────────────────────────────────── */

.metric-control-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid #e4eaee;
  border-radius: 8px;
  background: #f7fafb;
  min-width: 0;
}

.metric-control-bar label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.metric-control-select {
  flex: 1 1 auto;
  min-width: 100px;
  max-width: 180px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid #dfe7eb;
  background: #fff;
  color: var(--strong);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  padding: 0 8px;
  box-sizing: border-box;
}

.metric-control-bar--single {
  margin-left: auto;
}

.metric-control-bar--single .metric-control-select {
  min-width: 110px;
  max-width: 180px;
}

.metric-control-bar--daily {
  flex-wrap: nowrap;
}

.metric-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chart-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
  min-width: 0;
  flex-wrap: wrap;
}

.anomaly-side-toggle {
  flex-shrink: 0;
  gap: 8px;
}

.anomaly-side-toggle .toggle-label-text {
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--muted);
  text-align: left;
}

.anomaly-side-toggle input:checked ~ .toggle-label-text {
  color: #b84d30;
}

.chart-tools {
  display: none;
  padding: 3px;
  border: 1px solid #e4eaee;
  background: #f7fafb;
  border-radius: 8px;
}

.chart-tools .metric-switcher + .metric-switcher {
  margin-top: 4px;
}

.metric-button,
.efficiency-button {
  min-width: 54px;
  min-height: 28px;
  border: 1px solid transparent;
  background: var(--panel);
  color: var(--strong);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  padding: 0 10px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.metric-button small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.metric-button.is-active,
.efficiency-button.is-active {
  border-color: var(--mint);
  background: rgba(62, 203, 196, 0.2);
  color: #266a68;
}

.efficiency-switcher {
  border-top: 1px solid #e4eaee;
  padding-top: 4px;
}

.efficiency-button {
  min-width: 52px;
  background: transparent;
  color: #7c8790;
}

/* 이상치 마커 토글 스위치 */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}

.toggle-switch input[type="checkbox"] {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.toggle-slider {
  position: relative;
  width: 32px;
  height: 18px;
  background: var(--line);
  border-radius: 9px;
  flex-shrink: 0;
  transition: background 0.2s;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: left 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
  background: #e17055;
}

.toggle-switch input:checked + .toggle-slider::after {
  left: 16px;
}

.toggle-label-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.2s;
}

.toggle-switch input:checked ~ .toggle-label-text {
  color: #c0572e;
}

/* ─── Panels & Controls ───────────────────────────────────── */

.control,
.panel,
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  cursor: grab;
  transition: opacity 0.15s, box-shadow 0.15s;
  position: relative;
}

.kpi[draggable="true"]:hover {
  box-shadow: 0 4px 18px rgba(40,60,80,0.15);
}

.kpi-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.kpi-drag-over {
  outline: 2px dashed var(--mint);
  outline-offset: 2px;
}

/* ── 지글 모드 편집 바 ──────────────────────────────────────── */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.home-jiggle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  margin-bottom: 10px;
  background: rgba(62, 203, 196, 0.07);
  border: 1px solid rgba(62, 203, 196, 0.22);
  border-radius: 12px;
  animation: slideDown 0.18s ease;
}

.jiggle-bar-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--mint);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.jiggle-bar-btn {
  padding: 5px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s;
}

.jiggle-bar-reset {
  border: 1px solid rgba(217, 90, 90, 0.45);
  background: rgba(217, 90, 90, 0.07);
  color: var(--negative);
}
.jiggle-bar-reset:hover { background: rgba(217, 90, 90, 0.18); }

.jiggle-bar-done {
  border: 1px solid rgba(62, 203, 196, 0.45);
  background: var(--mint-soft);
  color: var(--mint);
}
.jiggle-bar-done:hover { background: rgba(62, 203, 196, 0.22); }

/* ── iOS 지글 모드 (꾹 누르기) ──────────────────────────────── */
@keyframes jiggle {
  0%   { transform: rotate(-0.15deg); }
  50%  { transform: rotate(0.15deg);  }
  100% { transform: rotate(-0.15deg); }
}

.home-widget.is-jiggling {
  animation: jiggle 0.55s ease-in-out infinite;
  z-index: 1;
}

.kpi.is-jiggling {
  animation: jiggle 0.55s ease-in-out infinite;
}

/* KPI 빈 슬롯 (삭제 후 + 추가 칸) */
.kpi-empty-slot {
  border: 2px dashed var(--line) !important;
  background: rgba(240,244,247,0.5) !important;
  box-shadow: none !important;
  cursor: default !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 90px;
}

.kpi-add-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--mint);
  background: var(--mint-soft);
  color: var(--mint);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, transform 0.1s;
  font-weight: 300;
}
.kpi-add-btn:hover { background: rgba(62,203,196,0.25); transform: scale(1.1); }

/* × 삭제 버튼 (위젯) */
.widget-delete-btn {
  position: absolute;
  top: -11px;
  right: -11px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ff3b30;
  color: #fff;
  border: 2.5px solid #fff;
  font-size: 17px;
  line-height: 1;
  z-index: 10;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 1px 5px rgba(0,0,0,0.28);
  transition: transform 0.1s;
}
.widget-delete-btn:hover { transform: scale(1.15); }

/* × 삭제 버튼 (KPI 카드) */
.kpi-delete-btn {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #ff3b30;
  color: #fff;
  border: 2px solid #fff;
  font-size: 14px;
  line-height: 1;
  z-index: 10;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.22);
  transition: transform 0.1s;
}
.kpi-delete-btn:hover { transform: scale(1.15); }

/* 위젯 크기 조절 바 */
.widget-size-bar {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  z-index: 5;
}

.widget-size-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--mint);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, transform 0.1s;
}
.widget-size-dot:hover   { transform: scale(1.2); }
.widget-size-dot.active  { background: var(--mint); }

.home-widget.widget-dragging { opacity: 0.4; }
.home-widget.widget-drag-over { outline: 2px dashed var(--mint); outline-offset: 3px; }

/* 위젯 추가 패널 */
.widget-add-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border: 1.5px dashed rgba(62, 203, 196, 0.35);
  background: rgba(62, 203, 196, 0.04);
  border-radius: 12px;
  flex-wrap: wrap;
}

.widget-add-panel::before {
  content: '+ 위젯 추가';
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
  margin-right: 4px;
}

.widget-add-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.widget-add-chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--mint);
  background: var(--mint-soft);
  color: var(--mint);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s;
}

.widget-add-chip:hover { background: rgba(62,203,196,0.25); }

.widget-add-empty {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}


/* home-camp-table */
.home-camp-table-wrap {
  overflow-x: auto;
}

.control {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
}

label,
.kpi-label {
  display: block;
  margin: 0 0 6px;
  color: #7c8590;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.panel header p {
  display: inline-block;
  margin: 0 0 8px;
  padding: 2px 10px;
  background: var(--mint-soft);
  color: #237570;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 10px;
}

select,
input {
  width: 100%;
  height: 32px;
  border: 1px solid #dde4ea;
  border-radius: 6px;
  padding: 0 9px;
  color: var(--strong);
  background: #fbfbfb;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  font-size: 12px;
}

.compact-select {
  width: min(360px, 100%);
}

/* ─── KPI Cards ───────────────────────────────────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  overflow: visible;
  padding-top: 10px; /* × 버튼이 위로 삐져나오는 여백 */
}

.kpi {
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
}

.kpi-label {
  margin-bottom: 4px;
  text-transform: uppercase;
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--strong);
  margin: 4px 0 6px;
  letter-spacing: 0;
  line-height: 1;
}

.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 6px;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
}

.kpi-delta.positive { color: var(--positive); background: var(--positive-soft); }
.kpi-delta.negative { color: var(--negative); background: var(--negative-soft); }
.kpi-delta.neutral  { color: var(--muted); }

.kpi-sub {
  font-size: 11px;
  color: var(--muted);
  display: block;
  line-height: 1.4;
}

/* ─── Board Grid ──────────────────────────────────────────── */

.board-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-widget-area {
  overflow: visible;
  padding-top: 14px; /* × 버튼이 위로 삐져나오는 여백 */
}

.panel {
  min-width: 0;
  padding: 20px;
  border-radius: 12px;
}

.panel header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 12px;
  min-width: 0;
  overflow: hidden;
}

.chart-panel header {
  align-items: center;
}

.panel h2 {
  margin: 0;
  color: #60707a;
  font-size: 14px;
  font-weight: 800;
}

.basis {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

/* ─── Insights ────────────────────────────────────────────── */

.insights {
  /* 텍스트 리스트 래퍼 */
}

.insight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.insight-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  line-height: 1.6;
  font-size: 13.5px;
  color: var(--ink);
  padding: 4px 0;
}

.insight-tag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.8;
}

.insight-text {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

/* 핵심 숫자 강조 */
.in-num {
  font-weight: 800;
  color: var(--strong);
  font-style: normal;
}

/* 프로모션·매체 이름 강조 */
.in-name {
  font-weight: 700;
  font-style: normal;
  color: var(--ink);
}

/* ─── Charts ──────────────────────────────────────────────── */

.chart {
  min-height: 270px;
}

.comparison-chart {
  min-height: 360px;
}

/* 매체별 stacked bar 차트 */
.stacked-chart {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}
.stacked-chart svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.stacked-bar-seg {
  transition: opacity 0.15s ease;
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 0.5;
}
.stacked-bar-seg:hover {
  opacity: 0.8;
  cursor: pointer;
}

/* 프로모션 막대 클릭 영역 (행 전체) */
.stacked-bar-hit {
  fill: transparent;
  cursor: pointer;
  transition: fill 0.15s ease;
}
.stacked-bar-seg.is-clickable { cursor: pointer; }
/* 클릭 가능한 차트의 라벨 텍스트는 아래 클릭영역으로 이벤트를 통과시킨다 */
#promotionAnalysisChart text { pointer-events: none; }
.stacked-bar-hit:hover {
  fill: rgba(62, 203, 196, 0.10);
}
.stacked-bar-hit.is-active {
  fill: rgba(62, 203, 196, 0.16);
  stroke: rgba(62, 203, 196, 0.55);
  stroke-width: 1;
}

/* 프로모션 보고서 매체 범례 */
.promotion-media-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  padding: 8px 4px 0;
  font-size: 11px;
  color: var(--ink);
  border-top: 1px solid var(--line);
}
.promo-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.promo-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* 프로모션 상세 패널 (칩 클릭) */
.promotion-detail-panel {
  margin-top: 12px;
  position: relative;
}
.promotion-detail-panel header {
  position: relative;
}
.promotion-detail-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(60, 75, 90, 0.08);
  color: var(--strong);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
}
.promotion-detail-close:hover {
  background: rgba(60, 75, 90, 0.18);
}

/* 활성화된 프로모션 칩 (상세 패널 열린 상태) */
.promo-chip.is-detail-active {
  background: var(--mint-soft);
  border-color: var(--mint);
  box-shadow: 0 0 0 2px rgba(62, 203, 196, 0.18);
}
.promo-chip-name {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.promo-chip-name:hover {
  text-decoration: underline;
}

/* 상세표 매체/캠페인 구분 행 */
tr.table-sep td {
  background: var(--mint-soft);
  color: var(--strong);
  font-weight: 800;
  font-size: 11px;
  padding: 6px 10px;
  text-align: center;
}

.pie-chart {
  min-height: 0;
}

/* ─── 전환 퍼널 차트 ───────────────────────────────────────── */
.funnel-chart {
  padding: 8px 16px 12px;
}
.funnel-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.funnel-step {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.funnel-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.funnel-step-label {
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 28px;
}
.funnel-rate {
  color: var(--text-muted);
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 10px;
}
.funnel-step-value {
  margin-left: auto;
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
}
.funnel-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
.funnel-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.funnel-kpi-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.funnel-kpi {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: var(--bg);
  border-radius: 8px;
  padding: 8px 6px;
}
.funnel-kpi-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.funnel-kpi-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

/* ─── 캠페인 상태 배지 ────────────────────────────────────── */
.status-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-right: 2px;
}
.status-active {
  background: rgba(46, 196, 182, 0.15);
  color: #2ec4b6;
  border: 1px solid rgba(46, 196, 182, 0.3);
}
.status-ended {
  background: rgba(150, 160, 175, 0.12);
  color: #8899aa;
  border: 1px solid rgba(150, 160, 175, 0.2);
}

.compact-chart,
.matrix {
  min-height: 300px;
}

.line-chart svg,
.combo-chart svg,
.bar-chart svg,
.compact-chart svg,
.comparison-chart svg {
  width: 100%;
  height: 100%;
  min-height: inherit;
  overflow: visible;
}

.axis,
.chart-label {
  fill: #8a949d;
  font-size: 11px;
}

.date-axis {
  font-size: 10px;
  font-weight: 800;
}

#brandTrendChart.combo-chart {
  min-height: 320px;
  overflow: visible;
  padding: 4px 2px 0;
}

.brand-trend-chart {
  min-height: 340px;
}

.brand-trend-metric-label {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f4faf8;
  color: #4f676f;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.brand-trend-plot-bg {
  fill: #fbfdfc;
  stroke: rgba(85, 191, 174, 0.16);
}

.brand-trend-grid-line {
  stroke: rgba(117, 132, 142, 0.14);
  stroke-width: 1;
}

.brand-trend-axis-value {
  fill: #9aa8af;
  font-size: 10px;
  font-weight: 800;
}

.brand-trend-area {
  opacity: 0.95;
}

.brand-trend-line {
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 3px 5px rgba(54, 76, 88, 0.08));
}

.brand-trend-dot-group {
  cursor: default;
}

.brand-trend-dot {
  stroke-width: 1.7;
  vector-effect: non-scaling-stroke;
  transition: opacity 0.12s ease, stroke-width 0.12s ease, transform 0.12s ease;
}

.brand-trend-dot-halo {
  opacity: 0.09;
  transition: opacity 0.12s ease;
}

.brand-trend-dot-group:hover .brand-trend-dot {
  opacity: 1;
  stroke-width: 2.7;
}

.brand-trend-dot-group:hover .brand-trend-dot-halo {
  opacity: 0.18;
}

.brand-trend-end-label rect {
  filter: drop-shadow(0 4px 9px rgba(32, 54, 64, 0.08));
}

.brand-trend-end-label text {
  font-size: 10px;
  font-weight: 900;
  dominant-baseline: middle;
}

.brand-trend-legend-item text {
  font-weight: 800;
}

.bar,
.dot,
.chart-label {
  cursor: default;
}

.dashboard-tooltip {
  position: fixed;
  z-index: 50;
  max-width: 320px;
  padding: 8px 12px;
  color: #4a5760;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid #d8e0e6;
  box-shadow: 0 8px 24px rgba(40, 60, 80, 0.14);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transform: translate(10px, 10px);
  transition: opacity 0.08s ease;
  border-radius: 8px;
}

.dashboard-tooltip.is-visible {
  opacity: 1;
}

.grid-line {
  stroke: var(--grid);
  stroke-width: 1;
}

.tick-line {
  stroke: #d8e2e8;
  stroke-width: 1;
}

.empty-chart {
  display: grid;
  min-height: 270px;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.series-line {
  fill: none;
  stroke: var(--mint);
  stroke-width: 2.4;
}

.series-area {
  fill: var(--mint-soft);
}

/* ─── 히트맵 ────────────────────────────────────────────────── */
.heatmap-chart {
  padding: 8px 12px 12px;
  overflow-x: auto;
}

.heatmap-svg {
  display: block;
  width: 100%;
  height: auto;
  min-width: 400px;
}

.heat-cell {
  transition: filter 0.12s;
}

.heat-cell:hover {
  filter: brightness(1.18);
}

.heat-cell-empty {
  fill: var(--line);
  opacity: 0.35;
}

/* ─── 트리맵 ────────────────────────────────────────────────── */
.treemap-chart {
  padding: 8px 12px 12px;
  overflow: hidden;
}

.treemap-svg {
  display: block;
  width: 100%;
  height: auto;
}

.treemap-rect {
  cursor: pointer;
  transition: filter 0.12s;
}

.treemap-rect:hover {
  filter: brightness(1.2);
}

.treemap-label {
  font-weight: 700;
  letter-spacing: 0;
  font-family: inherit;
}

.treemap-pct {
  font-weight: 500;
  font-family: inherit;
}

.dot {
  fill: white;
  stroke: var(--mint);
  stroke-width: 2;
}

.daily-bar,
.legend-bar {
  fill: var(--mint);
}

.combo-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2.2;
}

.combo-line-smooth {
  stroke-linecap: round;
  stroke-linejoin: round;
}

.combo-dot {
  fill: white;
  stroke: var(--blue);
  stroke-width: 2;
}

.kpi-value.is-counting,
.mc-kpi-row strong.is-counting {
  font-variant-numeric: tabular-nums;
}

.anim-grow-y,
.anim-grow-x,
.anim-dot-pop,
.anim-slice-in {
  transform-box: fill-box;
}

.anim-grow-y {
  transform-origin: center bottom;
}

.anim-grow-x {
  transform-origin: left center;
}

.anim-dot-pop,
.anim-slice-in {
  transform-origin: center;
}

.view-section.is-animating .chart-panel,
.view-section.is-animating .sales-chart-card,
.view-section.is-animating .mc-donut-card,
.view-section.is-animating .mc-kpi-chart,
.view-section.is-animating .mc-cmp-chart {
  animation: chartPanelIn 520ms cubic-bezier(0.19, 1, 0.22, 1) backwards;
}

.view-section.is-animating .anim-grow-y {
  animation: chartBarRise 780ms cubic-bezier(0.19, 1, 0.22, 1) backwards;
  animation-delay: var(--anim-delay, 0ms);
}

.view-section.is-animating .anim-grow-x {
  animation: chartBarSweep 760ms cubic-bezier(0.19, 1, 0.22, 1) backwards;
  animation-delay: var(--anim-delay, 0ms);
}

.view-section.is-animating .anim-line-draw {
  stroke-dasharray: var(--line-length);
  stroke-dashoffset: var(--line-length);
  animation: chartLineDraw 960ms cubic-bezier(0.33, 1, 0.68, 1) both;
  animation-delay: calc(var(--anim-delay, 0ms) + 120ms);
}

.view-section.is-animating .anim-dot-pop {
  animation: chartDotPop 520ms cubic-bezier(0.18, 1.24, 0.36, 1) backwards;
  animation-delay: calc(var(--anim-delay, 0ms) + 260ms);
}

.view-section.is-animating .anim-slice-in {
  animation: chartSliceIn 620ms cubic-bezier(0.19, 1, 0.22, 1) backwards;
  animation-delay: var(--anim-delay, 0ms);
}

.view-section.is-animating .anim-area-in {
  animation: chartAreaIn 780ms ease-out backwards;
  animation-delay: 100ms;
}

@keyframes chartPanelIn {
  from { opacity: 0.86; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes chartBarRise {
  from { opacity: 0.22; transform: scaleY(0.04); }
  70% { opacity: 1; }
  to { opacity: 1; transform: scaleY(1); }
}

@keyframes chartBarSweep {
  from { opacity: 0.24; transform: scaleX(0.04); }
  70% { opacity: 1; }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes chartLineDraw {
  from { opacity: 0.42; stroke-dashoffset: var(--line-length); }
  to { opacity: 1; stroke-dashoffset: 0; }
}

@keyframes chartDotPop {
  from { opacity: 0; transform: scale(0.55); }
  70% { opacity: 1; transform: scale(1.18); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes chartSliceIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 0.9; transform: scale(1); }
}

@keyframes chartAreaIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .view-section.is-animating .chart-panel,
  .view-section.is-animating .sales-chart-card,
  .view-section.is-animating .mc-donut-card,
  .view-section.is-animating .mc-kpi-chart,
  .view-section.is-animating .mc-cmp-chart,
  .view-section.is-animating .anim-grow-y,
  .view-section.is-animating .anim-grow-x,
  .view-section.is-animating .anim-line-draw,
  .view-section.is-animating .anim-dot-pop,
  .view-section.is-animating .anim-slice-in,
  .view-section.is-animating .anim-area-in {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    stroke-dashoffset: 0 !important;
  }
}

/* ─── 전주 비교선 ──────────────────────────────────────────── */
.prev-period-line {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 1.5;
  stroke-dasharray: 5 3;
  opacity: 0.7;
}

/* ─── 이상치 마커 ──────────────────────────────────────────── */
.anomaly-dot {
  stroke: none;
  opacity: 0.9;
}
.anomaly-up   { fill: #ff6b6b; }
.anomaly-down { fill: #74b9ff; }

.secondary-axis {
  fill: #6490b4;
}

.bar {
  fill: var(--mint);
}

.bar.alt {
  fill: var(--blue);
  opacity: 0.55;
}

.axis-label {
  font-size: 11px;
}

/* ─── Matrix ──────────────────────────────────────────────── */

.matrix {
  display: grid;
  gap: 8px;
}

.matrix-cell {
  padding: 10px 12px;
  background: linear-gradient(90deg, var(--mint-soft), transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.matrix-cell span,
.matrix-cell small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.matrix-cell strong {
  display: block;
  margin: 4px 0;
  color: var(--strong);
  font-size: 16px;
}

/* ─── Weekly Compare ──────────────────────────────────────── */

.weekly-control,
.keyword-control {
  margin-bottom: 10px;
}

/* ── Keyword Report filter bar ── */
.keyword-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 0 12px;
  flex-wrap: wrap;
}

/* 키워드 기간 바: 좌측 월 선택 + 우측 주차 버튼 */
.keyword-period-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}
.keyword-month-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.kw-period-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
/* 월 체크박스 드롭다운 */
.kw-month-dropdown { position: relative; }
.kw-month-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-width: 130px;
  justify-content: space-between;
}
.kw-month-btn:hover { border-color: var(--mint, #3ecbc4); }
.kw-month-checks {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(40, 60, 80, 0.18);
  padding: 6px;
  min-width: 160px;
  max-height: 280px;
  overflow-y: auto;
}
.kw-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.kw-check-item:hover { background: rgba(62, 203, 196, 0.08); }
.kw-check-item input { cursor: pointer; accent-color: var(--mint, #3ecbc4); }
.keyword-week-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}
.kw-week-btn {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.kw-week-btn small {
  color: var(--muted);
  font-weight: 500;
  margin-left: 2px;
}
.kw-week-btn:hover {
  border-color: var(--mint, #3ecbc4);
  background: rgba(62, 203, 196, 0.08);
}
.kw-week-btn.is-active {
  background: var(--mint, #3ecbc4);
  border-color: var(--mint, #3ecbc4);
  color: #fff;
}
.kw-week-btn.is-active small {
  color: rgba(255, 255, 255, 0.85);
}

.keyword-search-row {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 10px;
}

.keyword-search-input {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
  min-width: 200px;
}
.keyword-search-input:focus {
  outline: none;
  border-color: var(--mint);
  box-shadow: 0 0 0 2px rgba(62, 203, 196, 0.15);
}

.keyword-insight-panel {
  margin-bottom: 12px;
}

.keyword-insight-panel .insight-list {
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 10px;
}

.keyword-insight-panel .insight-item {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: flex-start;
  min-height: 0;
  gap: 12px;
}

.keyword-insight-panel .insight-tag {
  margin-top: 2px;
}

.keyword-insight-panel .insight-text {
  display: block;
  min-height: 0;
  line-height: 1.6;
  overflow: visible;
}

.keyword-insight-panel .in-name {
  overflow-wrap: anywhere;
}

.kw-table-wrap {
  overflow-x: auto;
  max-height: calc(100vh - 190px);
  overflow-y: auto;
}

.kw-table-wrap table {
  min-width: 1520px;
  table-layout: fixed;
}

.kw-col-campaign { width: 190px; }
.kw-col-group { width: 250px; }
.kw-col-keyword { width: 180px; }
.kw-col-metric { width: 90px; }

.kw-table-wrap table th {
  white-space: nowrap;
  padding: 9px 10px;
  vertical-align: middle;
}
.kw-table-wrap table td {
  white-space: nowrap;
  padding: 9px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.kw-table-wrap table th:first-child,
.kw-table-wrap table td:first-child {
  min-width: 0;
  white-space: nowrap;
}

.kw-table-wrap table th:nth-child(1),
.kw-table-wrap table td:nth-child(1) {
  width: 190px;
  max-width: 190px;
}

.kw-table-wrap table th:nth-child(2),
.kw-table-wrap table td:nth-child(2) {
  width: 250px;
  max-width: 250px;
}

.kw-table-wrap table th:nth-child(3),
.kw-table-wrap table td:nth-child(3) {
  width: 180px;
  max-width: 180px;
}

.kw-table-wrap table th:nth-child(n+4),
.kw-table-wrap table td:nth-child(n+4) {
  width: 90px;
  max-width: 90px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.kw-table-wrap table th:nth-child(1),
.kw-table-wrap table th:nth-child(2),
.kw-table-wrap table th:nth-child(3),
.kw-table-wrap table td:nth-child(1),
.kw-table-wrap table td:nth-child(2),
.kw-table-wrap table td:nth-child(3) {
  text-align: left;
  padding-left: 14px;
}

.kw-table-wrap table th:nth-child(1) {
  padding-left: 16px;
}

.kw-table-wrap table td:nth-child(1) {
  padding-left: 16px;
  color: var(--strong);
  font-weight: 700;
}

.kw-table-wrap table td:nth-child(2),
.kw-table-wrap table td:nth-child(3) {
  color: #566b73;
}

.kw-total-row td {
  background: #f2fbfa;
  font-weight: 600;
  border-top: 1px solid #d4eeee;
  border-bottom: 2px solid #c8e7e5;
  position: sticky;
  top: 33px;
  z-index: 3;
  box-shadow:
    0 -8px 0 #ffffff,
    0 4px 8px rgba(42, 86, 82, 0.08);
}

.week-compare-controls {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
}

.week-compare-controls label {
  margin: 0;
}

.compare-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.compare-card {
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  border-radius: 2px;
  transition: border-color 0.15s;
}

.compare-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.compare-card strong {
  display: block;
  margin: 4px 0 2px;
  color: var(--strong);
  font-size: 17px;
  font-weight: 800;
}

.compare-card small {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.compare-card .compare-delta {
  display: flex;
  align-items: center;
  gap: 4px;
}

.compare-card .compare-arrow {
  font-size: 12px;
}

.compare-card.positive {
  border-color: rgba(39, 174, 122, 0.3);
  background: var(--positive-soft);
}

.compare-card.positive small,
.compare-card.positive .compare-arrow {
  color: var(--positive);
}

.compare-card.negative {
  border-color: rgba(217, 90, 90, 0.3);
  background: var(--negative-soft);
}

.compare-card.negative small,
.compare-card.negative .compare-arrow {
  color: var(--negative);
}

.compare-card.warning {
  border-color: rgba(217, 147, 58, 0.3);
  background: var(--warning-soft);
}

.compare-card.warning small,
.compare-card.warning .compare-arrow {
  color: var(--warning);
}

.compare-progress {
  height: 3px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 3px;
  margin: 7px 0;
  overflow: hidden;
}

.compare-progress-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--muted);
  transition: width 0.4s ease;
}

.compare-card.positive .compare-progress-bar { background: var(--positive); }
.compare-card.negative .compare-progress-bar { background: var(--negative); }
.compare-card.warning  .compare-progress-bar { background: var(--warning); }

/* ─── Tables ──────────────────────────────────────────────── */

.table-wrap {
  overflow: auto;
  max-height: 430px;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 12px;
}

.detail-table {
  min-width: 1040px;
}

.detail-table th {
  color: #6a7882;
  background: #f2f5f5;
  border-color: #dce8e8;
  text-align: center;
  font-size: 12px;
}

.detail-table td {
  border-color: #e6eeee;
  color: var(--strong);
  background: #ffffff;
  text-align: right;
}

.detail-table td:first-child {
  min-width: 168px;
  text-align: center;
  font-weight: 700;
}

.detail-table tr.total-row td {
  background: linear-gradient(90deg, var(--mint-soft), #f6fbfb);
  color: #4a6068;
  font-weight: 800;
}

.detail-table-wrap {
  max-height: none;
  border-color: var(--line);
}

th,
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  min-width: 320px;
  text-align: left;
  white-space: normal;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #7a848e;
  background: #f8f9fa;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

th::after {
  content: "↕";
  display: inline-block;
  margin-left: 6px;
  color: #b6c1c8;
  font-size: 10px;
  line-height: 1;
}

th[data-sort-direction="asc"]::after {
  content: "↑";
  color: var(--mint);
}

th[data-sort-direction="desc"]::after {
  content: "↓";
  color: var(--mint);
}

th:hover {
  color: var(--strong);
  background: #eef6f6;
}

.kw-table-wrap table th:first-child,
.kw-table-wrap table td:first-child {
  min-width: 0;
  width: 190px;
  max-width: 190px;
  white-space: nowrap;
}

.kw-table-wrap table th:nth-child(1),
.kw-table-wrap table th:nth-child(2),
.kw-table-wrap table th:nth-child(3),
.kw-table-wrap table td:nth-child(1),
.kw-table-wrap table td:nth-child(2),
.kw-table-wrap table td:nth-child(3) {
  text-align: left;
}

.kw-table-wrap table th:nth-child(n+4),
.kw-table-wrap table td:nth-child(n+4) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tbody tr:hover {
  background: #f4f9f9;
}

/* ─── Promotion Modal ─────────────────────────────────────── */

.promotion-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
}

.promotion-modal.is-open {
  display: flex;
}

.promotion-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 25, 40, 0.55);
  backdrop-filter: blur(2px);
}

.promotion-modal-panel {
  position: relative;
  left: 298px;
  width: min(480px, calc(100% - 298px - 40px));
  max-height: calc(100vh - 48px);
  margin: 24px auto 24px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 16px 48px rgba(20, 40, 60, 0.22);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
}

.promotion-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.promotion-modal-header strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: var(--strong);
}

.promotion-modal-header small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

.modal-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 2px;
  line-height: 1;
}

.modal-close:hover {
  background: #f5f7f9;
  color: var(--strong);
}

.promotion-modal-search {
  padding: 12px 18px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.promotion-modal-search input {
  width: 100%;
  height: 34px;
  border: 1px solid #d8e0e8;
  padding: 0 12px;
  font-size: 13px;
}

.promotion-modal-list {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}

.promotion-modal-all {
  display: block;
  width: 100%;
  padding: 10px 18px;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  color: var(--strong);
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.promotion-modal-all:hover,
.promotion-modal-all.is-active {
  background: var(--mint-soft);
  color: #256866;
}

.promotion-modal-month {
  padding: 8px 18px 4px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

.promotion-modal-month:first-child {
  border-top: 0;
  margin-top: 0;
}

.promotion-modal-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 9px 18px;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 0.1s;
}

.promotion-modal-item:hover {
  background: #f4f8fa;
}

.promotion-modal-item.is-active {
  background: var(--mint-soft);
}

.promotion-modal-item.is-active .promo-name {
  color: #226866;
}

.promo-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--strong);
  min-width: 0;
  flex: 1;
}

.promo-date {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── Responsive ──────────────────────────────────────────── */

@media (max-width: 1100px) {
  .app-sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--sidebar-border);
    padding: 16px 14px;
    overflow: visible;
  }

  .side-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .summary-media-nav {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--sidebar-sub-border);
    margin-top: 4px;
    padding-top: 8px;
  }

  .dashboard-shell {
    margin-left: 0;
    width: 100%;
  }

  .topbar {
    flex-direction: column;
  }

  .header-date {
    align-items: flex-start;
  }

  .date-controls {
    flex-wrap: wrap;
  }

  .date-picker-shell {
    width: 100%;
    justify-content: flex-start;
  }

  .date-range-trigger {
    min-width: min(280px, 100%);
  }

  .date-presets {
    flex-wrap: wrap;
  }

  .filter-bar {
    align-items: stretch;
  }

  .quick-media-filter {
    flex-basis: 100%;
  }

  .kpi-grid,
  .board-grid,
  .compare-cards {
    grid-template-columns: 1fr 1fr;
  }

  .span-2,
  .span-3 {
    grid-column: span 2;
  }

  .promotion-modal-panel {
    left: 0;
    margin-left: 12px;
  }
}

@media (max-width: 720px) {
  .dashboard-shell {
    padding: 14px;
  }

  .panel header {
    flex-direction: column;
    align-items: stretch;
  }

  .chart-header-right,
  .metric-control-bar,
  .metric-control-bar--single {
    width: 100%;
    margin-left: 0;
  }

  .metric-control-bar {
    flex-wrap: wrap;
  }

  .metric-control-select,
  .metric-control-bar--single .metric-control-select {
    flex: 1;
    width: auto;
    min-width: 130px;
  }

  .kpi-grid,
  .board-grid,
  .week-compare-controls,
  .compare-cards,
  .span-2,
  .span-3 {
    grid-template-columns: 1fr;
    grid-column: auto;
  }

  .summary-media-nav {
    grid-template-columns: 1fr 1fr;
  }

  .date-picker-panel {
    left: 0;
    right: auto;
    width: calc(100vw - 28px);
  }

  .date-picker-months {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .date-picker-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .date-apply-button {
    width: 100%;
  }

  .quick-media-filter {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .media-quick-list {
    width: 100%;
  }

  .promotion-modal-panel {
    width: calc(100% - 24px);
    margin: 12px;
    left: 0;
  }
}

/* ── Brand Search View ───────────────────────────────────────── */
.brand-kpi-grid {
  grid-template-columns: repeat(6, minmax(126px, 1fr));
  margin-bottom: 12px;
}

.brand-kpi-card {
  min-height: 104px;
}

.brand-creative-highlight-panel {
  margin-bottom: 12px;
}

.brand-creative-highlights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.brand-highlight-device-group {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e1efeb;
  border-radius: 14px;
  background: #fbfdfc;
}

.brand-highlight-device-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-highlight-device-head small {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  text-align: right;
}

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

/* ── 소재 운영 달력 ─────────────────────────── */
.creative-calendar-panel {
  margin-top: 12px;
  margin-bottom: 16px;
}
.creative-calendar-wrap {
  padding: 4px 0 8px;
  overflow-x: auto;
  overflow-y: visible;
}
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 600px;
  margin-bottom: 8px;
}
.cal-month-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.cal-month-tab,
.cal-nav-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
.cal-month-tab {
  min-height: 30px;
  padding: 7px 12px;
  border-radius: 999px;
}
.cal-month-tab.is-active {
  border-color: var(--accent);
  background: rgba(62, 203, 196, 0.14);
  color: var(--strong);
}
.cal-nav-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: 0 0 auto;
  font-size: 19px;
}
.cal-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.cal-grid {
  min-width: 600px;
}
.cal-month-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  padding: 4px 8px 6px;
}
/* 주 단위 래퍼: flex 세로 */
.cal-week {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}
/* 요일 헤더 행: 7열 그리드 */
.cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 2px solid var(--accent);
}
.cal-dow {
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 4px 0;
  color: var(--muted);
}
.cal-dow.sun { color: #e05252; }
.cal-dow.sat { color: #4a90d9; }
/* 날짜 숫자 행 */
.cal-date-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal-date-cell {
  padding: 4px 6px 2px;
  min-height: 26px;
}
.cal-date-cell.out-month .cal-date-num {
  opacity: 0.3;
}
.cal-date-num {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}
.cal-date-num.sun { color: #e05252; }
.cal-date-num.sat { color: #4a90d9; }
.cal-date-cell.today .cal-date-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-lane-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-height: 22px;
  padding: 1px 0;
}
.cal-event {
  border-left: 3px solid transparent;
  border-radius: 0 3px 3px 0;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  position: relative;
  overflow: visible;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 1px 1px 1px 0;
  cursor: pointer;
}
.cal-event:hover {
  z-index: 20;
}

/* 소재 보기 버튼 - 이벤트 안에 고정 */
.cal-preview-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 18px;
  margin-left: auto;
  padding: 2px 6px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  font: inherit;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

/* 마우스 따라다니는 소재 보기 버튼 */
.cal-floating-preview-btn {
  position: fixed;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.6);
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  pointer-events: auto;
  z-index: 998;
  white-space: nowrap;
  transition: opacity 0.08s ease;
  opacity: 0.75;
  display: none !important;
  pointer-events: none;
}
.cal-floating-preview-btn:hover {
  opacity: 1;
  background: rgba(0,0,0,0.8);
}
.cal-floating-preview-btn:active {
  opacity: 0.85;
}

.cal-event.ev-start {
  border-left-width: 3px;
  border-radius: 3px 0 0 3px;
  margin-left: 2px;
}
.cal-event.ev-start.ev-end {
  border-radius: 3px;
}
.cal-ev-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.cal-dev-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 2px;
  background: rgba(0,0,0,0.1);
  flex-shrink: 0;
  line-height: 1.3;
}
.cal-event-preview-popover {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  z-index: 9999;
  width: min(720px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid rgba(210, 220, 226, 0.95);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(30, 45, 60, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  display: none;
}

/* 미리보기 활성화 시 어두운 백드롭 */
.cal-preview-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 35, 0.5);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  display: none;
}
.cal-preview-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
  display: block;
}
/* 글로벌 popover가 .is-visible 클래스 가질 때만 표시 */
.cal-event-preview-popover.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
  display: block;
}
/* 기존 inline popover 룰 (혹시 잔존 대비) */
.cal-event.is-active .cal-event-preview-popover:not(.cal-popover-global) {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
  display: block;
}
.cal-preview-title {
  margin-bottom: 8px;
  padding-right: 32px;
  color: var(--strong);
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 미리보기 닫기 (X) 버튼 */
.cal-preview-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(60, 75, 90, 0.15);
  color: var(--strong);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  /* transition 제거로 깜빡임 방지 */
}
.cal-preview-close:hover {
  background: rgba(60, 75, 90, 0.28);
  color: #000;
}
.cal-preview-close:active {
  background: rgba(60, 75, 90, 0.4);
}
.cal-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.cal-preview-item {
  position: relative;
  margin: 0;
  min-width: 0;
}
.cal-preview-item img {
  display: block;
  width: 100%;
  max-height: 430px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
}
.cal-preview-item .brand-device-pill {
  position: static;
  align-self: flex-start;
  margin-bottom: 6px;
  padding: 4px 14px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 12px;
}
.cal-preview-item .brand-device-pill.pc {
  background: rgba(70, 145, 199, 0.18);
  color: #4691c7;
  border: 1px solid rgba(70, 145, 199, 0.4);
}
.cal-preview-item .brand-device-pill.mo {
  background: rgba(62, 203, 196, 0.18);
  color: #3ecbc4;
  border: 1px solid rgba(62, 203, 196, 0.4);
}
.cal-preview-item .brand-device-pill.common {
  background: rgba(143, 160, 176, 0.18);
  color: #8fa0b0;
  border: 1px solid rgba(143, 160, 176, 0.4);
}
.cal-preview-item {
  display: flex;
  flex-direction: column;
}
.cal-preview-noimg,
.creative-hover-noimg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  background: #f8fbfb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.cal-gap {
  /* 빈 공간 */
}
.cal-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 16px;
  text-align: center;
}

.brand-highlight-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.14s, transform 0.14s, box-shadow 0.14s;
}

.brand-highlight-card:hover {
  border-color: rgba(47, 135, 110, 0.32);
  box-shadow: 0 10px 22px rgba(47, 88, 80, 0.12);
  transform: translateY(-1px);
}

.brand-highlight-card.bad:hover {
  border-color: rgba(218, 76, 76, 0.26);
}

.brand-highlight-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 6;
  border-radius: 0;
  overflow: hidden;
  background: #f0f4f5;
  border-bottom: 1px solid #e3efeb;
  flex-shrink: 0;
}

.brand-highlight-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-highlight-noimg,
.brand-highlight-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  min-height: 108px;
}

.brand-highlight-device-grid .brand-highlight-empty {
  grid-column: 1 / -1;
  min-height: 168px;
  border: 1px dashed #d6e7e2;
  border-radius: 12px;
  background: #ffffff;
}

.brand-highlight-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 13px 12px;
  flex: 1;
}

.brand-highlight-label {
  width: fit-content;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e8f6f2;
  color: #2f876e;
  font-size: 10px;
  font-weight: 900;
}

.brand-highlight-card.bad .brand-highlight-label {
  background: rgba(218, 76, 76, 0.1);
  color: #c63f3f;
}

.brand-highlight-body strong {
  color: var(--strong);
  font-size: 17px;
  font-weight: 900;
  line-height: 1.2;
}

.brand-highlight-body em,
.brand-highlight-name {
  color: #4f655f;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}

.brand-highlight-body small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
}

.brand-device-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 10px;
  line-height: 1.6;
}

.brand-device-pill.pc {
  background: rgba(70, 145, 199, 0.12);
  color: #4691c7;
  border: 1px solid rgba(70, 145, 199, 0.25);
}

.brand-device-pill.mo {
  background: rgba(0, 184, 148, 0.12);
  color: #00b894;
  border: 1px solid rgba(0, 184, 148, 0.25);
}

.brand-device-pill.common {
  background: rgba(143, 160, 176, 0.12);
  color: #8fa0b0;
  border: 1px solid rgba(143, 160, 176, 0.25);
}

.brand-detail-table td:nth-child(2) {
  text-align: center;
}

@media (max-width: 1500px) {
  .brand-highlight-device-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .brand-creative-highlights {
    grid-template-columns: 1fr;
  }
}

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

  .brand-highlight-device-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-highlight-device-head small {
    text-align: left;
  }

  .brand-highlight-card {
    flex-direction: column;
  }

  .brand-highlight-thumb {
    width: 100%;
    aspect-ratio: 16 / 6;
  }
}

/* ── Promotion Multi-select Filter Bar ──────────────────────── */
.promo-filter-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.promo-filter-label {
  font-size: 11px;
  font-weight: 900;
  color: #6e8981;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Chips area */
.promo-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.promo-all-chip {
  font-size: 11px;
  font-weight: 800;
  color: #2f876e;
  padding: 6px 11px;
  background: #e8f6f2;
  border: 1px solid #cfe9e2;
  border-radius: 999px;
}

.promo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e8f6f2;
  border: 1px solid #cfe9e2;
  border-radius: 999px;
  padding: 5px 5px 5px 11px;
  font-size: 11px;
  font-weight: 800;
  color: #2f876e;
  max-width: 220px;
}

.promo-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promo-chip-remove {
  background: rgba(47, 135, 110, 0.1);
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: #2f876e;
  line-height: 1;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  font-family: inherit;
  transition: color 0.12s;
}
.promo-chip-remove:hover { color: #c0392b; }

/* Search input */
.promo-search-wrap {
  position: relative;
  flex-shrink: 0;
}

.promo-search-input {
  height: 32px;
  width: 230px;
  padding: 0 12px;
  border: 1px solid #dfece7;
  border-radius: 999px;
  font-size: 12px;
  font-family: inherit;
  background: #fbfdfc;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.promo-search-input:focus {
  border-color: rgba(47, 135, 110, 0.38);
  box-shadow: 0 0 0 2px rgba(47, 135, 110, 0.12);
}
.promo-search-input::placeholder { color: var(--muted); }

/* Dropdown */
.promo-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 280px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 36px rgba(47, 88, 80, 0.16);
  z-index: 50;
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.promo-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 12px;
  color: var(--ink);
}
.promo-dd-item:hover { background: var(--bg); }
.promo-dd-item.is-checked { color: #2f876e; font-weight: 800; }

.promo-dd-checkbox {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
  color: #2f876e;
  background: var(--panel);
  transition: border-color 0.12s, background 0.12s;
}
.promo-dd-item.is-checked .promo-dd-checkbox {
  border-color: #2f876e;
  background: #e8f6f2;
}

.promo-dd-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.promo-dd-empty {
  padding: 12px 14px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  list-style: none;
}

/* Clear button */
.promo-clear-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfdfc;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
}
.promo-clear-btn:hover {
  border-color: #c0392b;
  color: #c0392b;
  background: rgba(192,57,43,0.05);
}

/* ── Creative Gallery ────────────────────────────────────────── */
.creative-gallery-panel header {
  flex-wrap: wrap;
  gap: 8px;
}

.creative-sort-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.creative-sort-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-right: 2px;
}

.creative-sort-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.creative-sort-btn:hover { border-color: var(--blue); color: var(--blue); }
.creative-sort-btn.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }

.creative-device-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
}

.creative-device-btn {
  min-width: 48px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.creative-device-btn.is-active {
  border-color: var(--mint);
  background: var(--mint-soft);
  color: #266a68;
}

.creative-table-wrap {
  max-height: 520px;
}

.creative-performance-table {
  min-width: 1260px;
}

.creative-performance-table th,
.creative-performance-table td {
  text-align: right;
  vertical-align: middle;
}

.creative-performance-table th:first-child,
.creative-performance-table td:first-child {
  min-width: 82px;
  width: 82px;
  text-align: center;
  white-space: nowrap;
}

.creative-performance-table th:nth-child(2),
.creative-performance-table td:nth-child(2) {
  min-width: 280px;
  text-align: left;
  white-space: normal;
}

.creative-performance-row:hover {
  background: #f4f9f9;
}

.creative-name-button {
  all: unset;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 360px;
  cursor: pointer;
}

.creative-name-button span {
  color: var(--strong);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.creative-name-button small {
  color: var(--muted);
  font-size: 10px;
  font-family: "Inter", "Segoe UI", sans-serif;
  line-height: 1.2;
}

.creative-capture-button {
  min-width: 48px;
  height: 26px;
  border: 1px solid rgba(62, 203, 196, 0.55);
  border-radius: 6px;
  background: var(--mint-soft);
  color: #266a68;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.creative-no-capture {
  color: var(--muted);
  font-size: 11px;
}

.creative-hover-preview {
  position: fixed;
  z-index: 1200;
  width: min(900px, 78vw);
  max-height: 720px;
  padding: 10px;
  border: 1px solid rgba(210, 220, 226, 0.95);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 16px 45px rgba(30, 45, 60, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.creative-hover-preview.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.creative-hover-single img,
.creative-hover-grid img {
  display: block;
  width: 100%;
  object-fit: contain;
  border-radius: 6px;
  background: var(--bg);
}

.creative-hover-single img {
  max-height: 640px;
}

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

.creative-hover-item {
  position: relative;
  margin: 0;
  min-width: 0;
}

.creative-hover-item img {
  max-height: 520px;
  border: 1px solid var(--line);
}

.creative-hover-item .brand-device-pill {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  box-shadow: 0 6px 14px rgba(20, 42, 45, 0.14);
}

.creative-hover-caption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Gallery grid */
.creative-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 4px 0 8px;
}

/* Empty state */
.creative-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
}

.creative-empty-icon { font-size: 36px; }
.creative-empty p { font-size: 14px; font-weight: 600; margin: 0; }
.creative-empty small { font-size: 11px; }
.creative-empty code { background: var(--bg); padding: 1px 6px; border-radius: 4px; font-family: monospace; }

/* Card */
.creative-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
}

.creative-card:hover {
  box-shadow: 0 6px 24px rgba(40,60,80,0.14);
  transform: translateY(-2px);
}

/* Thumbnail */
.creative-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 7;
  background: var(--bg);
  overflow: hidden;
  cursor: pointer;
}

.creative-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}

.creative-thumb:hover img { transform: scale(1.03); }

.creative-zoom-icon {
  position: absolute;
  bottom: 6px;
  right: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(20, 30, 40, 0.72);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.creative-thumb:hover .creative-zoom-icon { opacity: 1; }

.creative-thumb--empty {
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
}

.creative-no-img {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* Info section */
.creative-info {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.creative-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.creative-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.creative-id {
  font-size: 10px;
  color: var(--muted);
  font-family: "Inter", "Segoe UI", sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.creative-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cm-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.cm-item em {
  font-style: normal;
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cm-item {
  font-size: 11px;
  font-weight: 700;
  color: var(--strong);
}

.cm-item--highlight { color: var(--blue); }

.creative-no-data {
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
  padding: 4px 0;
}

/* Modal */
.creative-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.creative-modal.is-open { display: flex; }

.creative-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 30, 40, 0.7);
  backdrop-filter: blur(4px);
}

.creative-modal-box {
  position: relative;
  z-index: 1;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  max-width: min(90vw, 960px);
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.18s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.creative-modal-box img {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 48px);
  object-fit: contain;
}

.creative-modal-caption {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--bg);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.creative-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(40,60,80,0.5);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.15s;
  font-family: inherit;
}

.creative-modal-close:hover { background: rgba(20,30,40,0.8); }

/* ── Clean mint dashboard theme ───────────────────────────── */
/* Promotion status follows the dashboard's navy, mint and soft-gray palette. */
.promo-status-view { --ps-accent: #258e88; }
.ps-intro { display: flex; justify-content: flex-end; align-items: center; padding: 0 2px 12px; }
.ps-eyebrow { display: block; color: var(--ps-accent); font-size: 10px; font-weight: 800; letter-spacing: .14em; margin-bottom: 9px; }
.ps-freshness { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 8px; color: #526e68; font-size: 12px; }
.ps-freshness strong { color: var(--strong); font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ps-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.6fr); gap: 18px; margin-bottom: 24px; }
.ps-summary-card { box-sizing: border-box; display: flex; flex-direction: column; gap: 14px; height: 350px; min-width: 0; padding: 20px; border: 1px solid #dfe7e2; border-radius: 16px; background: #fff; box-shadow: none; }
.ps-summary-totals { display: grid; grid-template-rows: minmax(148px, 44%) minmax(0, 1fr); gap: 0; padding: 0; overflow: hidden; }
.ps-summary-totals > section { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 18px; min-height: 0; }
.ps-summary-totals > section + section { border-top: 1px solid #dfe7e2; }
.ps-summary-totals .is-highlight { background: #f4f8f5; }
.ps-summary-totals > .ps-total-summary { justify-content: flex-start; gap: 6px; padding: 14px 20px; background: #f4f3f9; overflow-y: auto; }
.ps-summary-total-value { display: flex; align-items: baseline; gap: 9px; }
.ps-total-summary .ps-total-month { display: block; width: auto; height: auto; padding: 3px 0; background: transparent; color: #666a77; font-size: 11px; font-weight: 500; }
.ps-total-channels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 0; border: 0; background: transparent; flex-shrink: 0; }
.ps-total-channel { display: grid; align-content: center; justify-items: center; gap: 4px; padding: 0 4px; color: #536f63; font-size: 11px; line-height: 1.4; }
.ps-total-channel + .ps-total-channel { border-left: 1px solid #e3ebe7; }
.ps-channel-label { color: #60676d; font-size: 11px; text-align: center; word-break: keep-all; }
.ps-channel-label::before { content: ''; display: inline-block; width: 4px; height: 4px; margin-right: 4px; border-radius: 50%; background: #a695bd; vertical-align: 2px; }
.is-naver .ps-channel-label::before { background: #67b494; }
.is-ohouse .ps-channel-label::before { background: #77accb; }
.ps-channel-value { display: flex; align-items: baseline; gap: 3px; }
.ps-channel-value b { font-size: 18px; font-weight: 700; color: var(--strong); }
.ps-channel-value small { font-size: 9px; color: #59756a; }
.ps-total-channel.is-unknown { grid-column: 1 / -1; border-left: 0; border-top: 1px solid #e3ebe7; margin-top: 7px; padding-top: 7px; }
.ps-summary-totals > .ps-active-summary { justify-content: flex-start; gap: 8px; padding: 16px 20px; }
.ps-active-summary .ps-summary-items { margin-top: 0; }
.ps-active-summary .ps-summary-items button { padding: 10px 2px; }
.ps-summary-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.ps-summary-heading h2 { margin: 0; font-size: 14px; color: #233d36; font-weight: 700; line-height: 1.5; word-break: keep-all; }
.ps-summary-heading > span { flex-shrink: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #f0f5f7; color: #72929c; }
.ps-summary-number { color: var(--strong); font-size: 34px; font-weight: 800; letter-spacing: -.04em; line-height: 1.15; }
.ps-summary-number small { margin-left: 5px; color: #526e76; font-size: 12px; font-weight: 500; }
.ps-summary-caption { display: block; margin: 0; color: #646f6a; font-size: 11px; line-height: 1.55; }
.ps-summary-content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.ps-week-summary + .ps-week-summary { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.ps-summary-subheading { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ps-summary-subheading h3 { margin: 0; color: var(--strong); font-size: 13px; }
.ps-summary-subheading > span { color: #646f6a; font-size: 11px; }
.ps-summary-subheading b { margin-left: auto; font-size: 17px; color: #258e88; }
.ps-summary-subheading b small { margin-left: 3px; font-size: 10px; font-weight: 500; }
.ps-summary-items { list-style: none; margin: 7px 0 0; padding: 0; }
.ps-summary-items li + li { border-top: 1px solid #edf1f4; }
.ps-summary-items button { display: block; box-sizing: border-box; width: 100%; min-width: 0; padding: 12px 2px; text-align: left; border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; border-radius: 4px; }
.ps-summary-items button:hover { background: #f0f8f5; }
.ps-summary-items strong { display: block; font-size: 13px; font-weight: 600; line-height: 1.65; overflow-wrap: anywhere; }
.ps-summary-items small { display: block; margin-top: 5px; font-size: 11px; line-height: 1.6; color: #646f6a; overflow-wrap: anywhere; }
.ps-summary-empty { margin: 16px 0; color: #646f6a; font-size: 12px; line-height: 1.7; }
.ps-change-types { display: flex; flex-wrap: wrap; gap: 5px; }
.ps-change-type { padding: 4px 7px; border-radius: 5px; background: #f0f5f6; color: #486470; font-size: 9px; line-height: 1.4; }
.ps-change-type b { color: var(--strong); margin-left: 3px; }
.ps-summary-changes { border-color: #dfe7e2; gap: 12px; }
.ps-summary-changes .ps-summary-heading h2 { color: var(--strong); font-size: 14px; }
.ps-summary-changes .ps-summary-heading h2 small { margin-left: 4px; color: #58776a; font-size: 12px; font-weight: 600; }
.ps-summary-heading > .ps-review-scope { width: auto; height: auto; background: transparent; color: #646f6a; font-size: 11px; }
.ps-change-type.is-scheme { background: #e1eefb; color: #3c6e9f; }
.ps-change-type.is-content { background: #eaddf8; color: #79539c; }
.ps-change-type.is-unknown { background: #fff0cf; color: #936e2d; }
.ps-change-type.is-mix { background: #dceeea; color: #397e70; }
.ps-change-type.is-reconciled { background: #e5eef5; color: #587895; }
.ps-change-type.is-exception { background: #e9e9ee; color: #6e7085; }
.ps-change-type.is-attention { background: #fae8cb; color: #855a26; }
.ps-review-toolbar, .ps-review-form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.ps-review-toolbar { justify-content: space-between; padding-bottom: 2px; }
.ps-review-statuses { display: flex; flex-wrap: wrap; gap: 4px; }
.ps-review-statuses button { min-height: 36px; padding: 6px 8px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #646f6a; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.ps-review-statuses b { margin-left: 2px; font-variant-numeric: tabular-nums; }
.ps-review-statuses button:hover { background: #f1f7f4; }
.ps-review-statuses button[aria-pressed="true"] { border-bottom-color: #2f6b54; color: #234938; }
#psReviewType { width: auto; min-height: 34px; max-width: 100%; padding: 4px 7px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--strong); font: inherit; font-size: 12px; }
.ps-review-list { padding-right: 5px; border-top: 1px solid var(--line); }
.ps-review-list ul { list-style: none; margin: 0; padding: 0; }
.ps-review-list li { padding: 16px 2px; }
.ps-review-list li + li { border-top: 1px solid var(--line); }
.ps-review-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.ps-review-item { min-width: 0; }
.ps-review-name { padding: 2px 0; min-width: 0; border: 0; background: transparent; color: #233d36; text-align: left; font: inherit; font-size: 14px; font-weight: 700; line-height: 1.6; overflow-wrap: anywhere; cursor: pointer; }
.ps-review-name:hover { color: #256650; text-decoration: underline; }
.ps-review-action, .ps-review-check { box-sizing: border-box; display: inline-flex; flex-shrink: 0; align-items: center; gap: 7px; min-height: 40px; padding: 5px 9px; border: 1px solid #c8dbd3; border-radius: 8px; background: linear-gradient(145deg, #ffffffcf, #e6f2ed66); color: #285c4a; font: inherit; font-size: 12px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.ps-review-action:hover, .ps-review-check:hover { border-color: #75af99; background: #edf7f2; }
.ps-review-action.is-confirmed, .ps-review-check:has(input:checked) { color: #245d49; background: #e7f4ee; border-color: #b7dccc; }
.ps-review-check { justify-self: start; }
.ps-review-check input { margin: 0; accent-color: #287458; width: 17px; height: 17px; }
.ps-review-meta, .ps-review-preview, .ps-review-types, .ps-review-detail > p { margin: 5px 0 0; font-size: 12px; line-height: 1.65; color: #616e67; overflow-wrap: anywhere; }
.ps-review-types { font-size: 11px; color: #6c6b7b; }
.ps-review-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ps-review-preview.is-confirmed, .ps-review-detail > p b { color: #245d49; font-weight: 600; }
.ps-stat { display: flex; flex-direction: column; gap: 14px; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 2px 8px #24384c04; }
.ps-stat.is-highlight { background: #e9f7f4; border-color: #c7e8df; }
.ps-stat-label { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 14px; font-weight: 700; color: #233d36; }
.ps-stat-label > span { display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; background: #f0f5f7; color: #72929c; font-size: 17px; }
.is-highlight .ps-stat-label > span { color: #258e88; background: #d8efe8; }
.ps-stat > strong { color: var(--strong); font-size: clamp(21px, 2.2vw, 31px); font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ps-stat > strong small { margin-left: 5px; font-size: 13px; color: #7a8e9c; font-weight: 500; }
.ps-stat > small { font-size: 11px; color: #718797; }
.promo-status-view .panel { margin-bottom: 24px; border-radius: 13px; box-shadow: 0 2px 10px #24384c05; }
.promo-status-view .panel-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; min-width: 0; }
.promo-status-view .panel-heading > div { min-width: 0; max-width: 100%; }
.promo-status-view .panel-heading h2 { margin: 0; font-size: 17px; color: var(--strong); letter-spacing: -.025em; }
.ps-caption { font-size: 11px; color: #526e76; }
.ps-footnote { margin: 18px 0 0; color: #526e76; font-size: 11px; line-height: 1.65; }
.ps-timeline-axis, .ps-timeline-row { display: grid; grid-template-columns: minmax(130px, 24%) minmax(100px, 1fr) 58px; align-items: center; gap: 20px; }
.ps-timeline-axis { padding: 8px 0 15px; font-size: 10px; color: #718797; border-bottom: 1px solid var(--line); }
.ps-timeline-axis > div { display: flex; justify-content: space-between; }
.ps-timeline-axis > span:last-child, .ps-timeline-row > span:last-child { text-align: right; }
.ps-timeline-row { min-height: 43px; }
.ps-timeline-row > button { border: 0; background: none; color: var(--ink); font: inherit; font-size: 12px; font-weight: 600; text-align: left; padding: 7px 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.ps-timeline-row > button:hover { color: var(--ps-accent); }
.ps-timeline-row > span { color: #718797; font-size: 11px; font-variant-numeric: tabular-nums; }
.ps-track { position: relative; height: 25px; background: repeating-linear-gradient(to right, transparent 0, transparent calc(25% - 1px), #e9eff2 calc(25% - 1px), #e9eff2 25%); border-left: 1px solid #e9eff2; }
.ps-track-bar { position: absolute; top: 5px; height: 15px; min-width: 3px; border-radius: 4px; background: #bfd2de; }
.ps-track-bar.is-recent { background: linear-gradient(90deg, #67cbbd, #36aaa0); }
.ps-count { display: inline-block; vertical-align: middle; margin-left: 6px; border-radius: 5px; padding: 4px 7px; background: #eef5f6; color: #547b83; font-size: 11px; letter-spacing: 0; }
.ps-toolbar { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin: 8px 0 20px; }
.ps-segments { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px; border-radius: 8px; background: #f0f4f7; }
.ps-segments button { border: 0; padding: 8px 13px; border-radius: 6px; background: transparent; color: #526e76; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.ps-segments button.is-active { color: #247d78; background: white; box-shadow: 0 1px 4px #24384c12; }
.ps-search-controls { display: flex; gap: 8px; }
.ps-search-controls input, .ps-search-controls select { min-width: 0; border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; color: var(--ink); background: white; font: inherit; font-size: 12px; }
.ps-search-controls input { width: 208px; }
.ps-search-controls input::placeholder { color: #8598a6; }
.ps-table-wrap { overflow-x: auto; }
.ps-table { width: 100%; min-width: 920px; border-collapse: collapse; font-size: 12px; }
.ps-table th { padding: 13px 12px; background: #f6f9fa; color: #526e76; font-size: 11px; font-weight: 600; white-space: nowrap; }
.ps-table td { padding: 18px 12px; border-bottom: 1px solid #edf1f4; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.ps-table th { text-align: right; }
.ps-table th:nth-child(-n+3), .ps-table td:nth-child(-n+3) { text-align: left; }
.ps-table tbody tr:hover, .ps-table tbody tr.is-selected { background: #f5fbf9; }
.ps-name { display: flex; align-items: center; gap: 12px; }
.ps-row-index { color: #627880; font-size: 10px; }
.ps-name > div { min-width: 150px; max-width: 270px; white-space: normal; overflow-wrap: anywhere; }
.ps-name strong { display: block; color: var(--strong); font-weight: 700; line-height: 1.6; }
.ps-change-indicator { display: inline-block; width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; color: #ad7913; }
.ps-attention-indicator { display: inline-flex; flex-shrink: 0; width: 17px; height: 17px; margin-right: 4px; align-items: center; justify-content: center; border-radius: 4px; background: #fff0c2; color: #a46b0b; font-size: 13px; font-weight: 800; line-height: 1; vertical-align: -2px; }
.ps-change-indicator svg { display: block; width: 100%; height: 100%; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ps-name small, .ps-days { display: block; font-size: 10px; line-height: 1.55; color: #526e76; margin-top: 4px; }
.ps-period { color: #526e76; font-size: 11px; line-height: 1.55; }
.ps-badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 5px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.ps-badge i { width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.ps-badge.is-recent { color: #247d68; background: #e8f6ef; }
.ps-badge.is-past { color: #718493; background: #edf2f5; }
.ps-roas { color: #258e88; font-size: 13px; }
.ps-detail-button { border: 1px solid var(--line); border-radius: 6px; background: white; padding: 8px 12px; color: #4e6a7b; font: inherit; font-size: 11px; white-space: nowrap; cursor: pointer; }
.ps-detail-button:hover { color: #258e88; border-color: #99d3c7; }
.ps-empty { display: grid; place-items: center; gap: 12px; min-height: 220px; text-align: center; color: #526e76; font-size: 13px; padding: 24px; }
.ps-empty > span { font-size: 36px; color: #a1b9bf; }
.ps-empty > strong { color: var(--strong); }
.ps-empty p { margin: 0; font-size: 12px; }
.ps-empty-compact { min-height: 100px; }
.ps-media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.ps-media-card { border: 1px solid var(--line); border-radius: 9px; padding: 18px; min-width: 0; }
.ps-media-card > strong { font-size: 12px; color: var(--strong); overflow-wrap: anywhere; }
.ps-media-cost { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 18px; color: var(--strong); font-size: 20px; font-weight: 700; }
.ps-media-cost small { font-size: 11px; font-weight: 500; color: #258e88; }
.ps-share-track { height: 5px; background: #edf3f4; border-radius: 4px; overflow: hidden; margin-top: 11px; }
.ps-share-track > span { display: block; height: 100%; background: #54bbae; }
.ps-media-card dl { margin: 16px 0 0; display: grid; gap: 8px; font-size: 11px; }
.ps-media-card dl > div { display: flex; justify-content: space-between; gap: 8px; }
.ps-media-card dt { color: #718797; }
.ps-media-card dd { margin: 0; font-variant-numeric: tabular-nums; }
.promo-status-view button:focus-visible, .promo-status-view input:focus-visible, .promo-status-view select:focus-visible { outline: 2px solid #258e88; outline-offset: 3px; }
.promo-status-view button:disabled { opacity: .45; cursor: default; }
.promotion-status-mode .filter-bar, .promotion-status-mode #dateRangeTrigger, .promotion-status-mode #datePickerPanel { display: none !important; }
.ps-source-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-inline-start: 5px; padding-inline-start: 12px; border-inline-start: 1px solid #cbded6; }
.ps-source-actions a, .ps-source-actions button { color: #286a57; font: inherit; font-size: 11px; font-weight: 600; text-decoration: none; background: none; border: 0; padding: 4px 0; cursor: pointer; }
.ps-source-actions a:hover, .ps-source-actions button:not(:disabled):hover { text-decoration: underline; }
.ps-connection { margin: 0 0 18px; padding: 14px 16px; border: 1px solid #cce3e9; border-radius: 8px; background: #edf7fa; color: #456e80; font-size: 12px; line-height: 1.65; }
.ps-connection.is-error { border-color: #efd9bc; background: #fff7e9; color: #916b2f; }
.ps-stat.has-warning { border-color: #efdfc6; background: #fffbf3; }
.ps-stat.has-warning .ps-stat-label > span { color: #b88834; background: #fbf0da; }
.ps-month-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
.ps-month-controls button, .ps-month-controls input { box-sizing: border-box; white-space: nowrap; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; font: inherit; font-size: 12px; color: #49685d; background: white; }
.ps-month-controls input { flex: 0 1 160px; width: 160px; min-width: 125px; max-width: 100%; }
.ps-month-controls button { flex: 0 0 auto; width: auto; }
.ps-month-controls button { cursor: pointer; }
.ps-month-controls button[data-ps-month-step] { font-size: 20px; padding: 1px 10px 4px; }
.ps-available-months { margin-bottom: 12px; }
.ps-month-tab-year { display: flex; align-items: baseline; gap: 10px; }
.ps-month-tab-year + .ps-month-tab-year { margin-top: 8px; }
.ps-month-tab-year > strong { flex-shrink: 0; font-size: 11px; color: #587367; }
.ps-month-tab-year > div { display: flex; flex-wrap: wrap; gap: 5px; }
.ps-month-tab-year button { border: 1px solid #e2ebe7; border-radius: 6px; padding: 5px 9px; background: white; color: #597367; font: inherit; font-size: 11px; cursor: pointer; }
.ps-month-tab-year button.is-active { background: #e8f5ee; border-color: #aed5c0; color: #387b5e; font-weight: 700; }
.ps-month-tab-year button:disabled { color: #98a79e; background: #f7f9f8; opacity: .7; cursor: default; }
.promo-status-view .ps-month-note { margin: 0 0 14px; font-size: 10px; }
.ps-calendar-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 0 0 17px; color: #526e76; font-size: 11px; }
.ps-channel-dot { display: inline-flex; align-items: center; gap: 5px; }
.ps-channel-dot::before { content: ''; width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: #9b8bc6; }
.ps-channel-dot.is-naver::before { background: #3eab86; }
.ps-channel-dot.is-ohouse::before { background: #63a9ce; }
.ps-calendar-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
.ps-calendar { min-width: 680px; --ps-event-height: 28px; --ps-event-gap: 4px; --ps-events-top: 40px; }
.ps-calendar-week { position: relative; height: max(112px, calc(var(--ps-events-top) + var(--ps-week-lanes) * (var(--ps-event-height) + var(--ps-event-gap)) + 4px)); border-bottom: 1px solid #e9efec; }
.ps-calendar-week:last-child { border-bottom: 0; }
.ps-week-dates { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); position: absolute; inset: 0; }
.ps-calendar-week .ps-calendar-day { min-height: 0; height: 100%; padding: 5px 7px; border-bottom: 0; }
.ps-week-events { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: var(--ps-event-height); row-gap: var(--ps-event-gap); position: relative; top: var(--ps-events-top); pointer-events: none; }
.ps-week-events .ps-span-event { display: flex; align-items: center; justify-content: space-between; gap: 6px; width: auto; min-width: 0; height: var(--ps-event-height); margin: 0 3px; padding: 3px 7px; pointer-events: auto; }
.ps-span-event > span:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ps-span-event.continues-before { margin-left: 0; border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ps-span-event.continues-after { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.ps-weekdays, .ps-calendar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.ps-weekdays { background: #f5f8f7; text-align: center; color: #526e76; font-size: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.ps-weekdays span:nth-child(6) { color: #6f98b6; }
.ps-weekdays span:last-child { color: #d68d8d; }
.ps-calendar-day { min-height: 132px; padding: 7px; border-right: 1px solid #e9efec; border-bottom: 1px solid #e9efec; min-width: 0; }
.ps-calendar-day:nth-child(7n) { border-right: 0; }
.ps-calendar-day.is-outside { background: #f8faf9; }
.ps-calendar-day.is-outside .ps-day-number { color: #b4c1bf; }
.ps-calendar-day.is-today { background: #f0faf6; }
.ps-calendar-day.is-selected { box-shadow: inset 0 0 0 2px #51b6a1; }
.ps-day-number { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: #536c62; font: inherit; font-size: 12px; font-weight: 600; padding: 4px; margin-bottom: 7px; cursor: pointer; }
.ps-day-number small { font-size: 9px; background: #327c64; color: white; padding: 2px 4px; border-radius: 4px; }
.ps-event { display: block; width: 100%; margin-bottom: 4px; padding: 5px 6px; text-align: left; border: 0; border-left: 2px solid #9b8bc6; border-radius: 3px; background: #f0edf7; color: #66547f; font: inherit; font-size: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; }
.ps-event.is-naver { color: #397c60; background: #e7f4ec; border-left-color: #56ac83; }
.ps-event.is-ohouse { color: #487f9e; background: #eaf4f9; border-left-color: #6eaacb; }
.ps-event.is-excluded { color: #8d9695; background: #eff2f1; border-left-color: #adb7b3; }
.ps-more { border: 0; background: none; color: #718797; font: inherit; font-size: 10px; padding: 3px 4px; cursor: pointer; }
.ps-badge.is-active { color: #247d68; background: #e8f6ef; }
.ps-badge.is-upcoming { color: #4e87a6; background: #eaf3fa; }
.ps-badge.is-ended, .ps-badge.is-excluded { color: #718493; background: #edf2f5; }
.ps-badge.is-unknown { color: #a77e35; background: #fff3db; }
.ps-check { color: #4f7566; font-size: 11px; }
.ps-check.needs-check { color: #a77e35; font-weight: 600; }
.ps-date-chip { border: 1px solid #c4e2d6; border-radius: 6px; background: #eef8f3; color: #3e8069; font: inherit; font-size: 11px; padding: 7px 10px; margin-bottom: 14px; cursor: pointer; }
.ps-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.ps-detail-grid h3 { margin: 0 0 14px; font-size: 13px; color: var(--strong); }
.ps-benefits { white-space: pre-wrap; font-size: 12px; color: #536e63; line-height: 1.65; margin: 0; }
.ps-info-list { margin: 0; display: grid; gap: 11px; font-size: 12px; }
.ps-info-list > div { display: grid; grid-template-columns: 104px minmax(0,1fr); gap: 8px; }
.ps-info-list dt { color: #597367; }
.ps-info-list dd { margin: 0; color: #536e63; overflow-wrap: anywhere; white-space: pre-wrap; }
.ps-detail-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line); }
.ps-detail-links a { text-decoration: none; color: #286a57; font-size: 11px; background: #f1f7f4; padding: 8px 11px; border-radius: 6px; }
.ps-review-detail { background: #f6faf8; border: 1px solid #d8e6e0; border-radius: 10px; padding: 14px; margin: 0 0 18px; }
.ps-review-detail h3, .ps-review-receipt h4 { color: var(--strong); font-size: 13px; margin: 0 0 8px; }
.ps-review-detail > p { white-space: pre-wrap; }
.ps-review-receipt { margin-top: 10px; padding: 10px; border: 1px solid #d8e6e0; border-radius: 8px; background: #fff; }
.ps-review-receipt ul { list-style: none; margin: 0; padding: 0; }
.ps-review-receipt li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ps-review-receipt details { margin-top: 7px; color: #526a64; font-size: 12px; }
.ps-review-receipt summary { cursor: pointer; }
.ps-confirmation-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; color: var(--strong); font-size: 13px; overflow-wrap: anywhere; }
.ps-confirmation-heading small, .ps-review-receipt p { margin: 3px 0; color: #526a64; font-size: 12px; }
.ps-confirmation-note { white-space: pre-wrap; overflow-wrap: anywhere; }
.ps-withdraw-review { margin-left: auto; padding: 3px 6px; border: 0; background: none; color: #586f65; font: inherit; font-size: 11px; cursor: pointer; }
.ps-withdraw-review:hover { text-decoration: underline; }
.ps-review-detail form { display: grid; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #d8e6e0; }
.ps-review-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ps-review-fields[hidden] { display: none; }
.ps-review-form-actions p { font-size: 11px; margin: 0; color: #526a64; }
.ps-review-fields label, .ps-review-note { display: grid; gap: 4px; color: #3b6558; font-size: 12px; font-weight: 600; }
.ps-review-fields input, .ps-review-fields select, .ps-review-note textarea { box-sizing: border-box; width: 100%; min-width: 0; border: 1px solid #cadfd5; border-radius: 6px; background: #fff; padding: 7px 8px; font: inherit; font-weight: 400; color: var(--ink); }
.ps-review-note textarea { min-height: 52px; resize: vertical; }
.ps-review-form-actions { justify-content: space-between; }
.ps-review-form-actions button { border-color: #a6cdbd; color: #245d49; }
.ps-modal { box-sizing: border-box; width: min(690px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: min(760px, calc(100dvh - 48px)); padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); box-shadow: 0 18px 70px #153b3340; overflow-y: auto; }
.ps-modal::backdrop { background: #142f2b66; }
.ps-modal .panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.ps-modal .panel-heading > div { min-width: 0; }
.ps-modal h2 { margin: 0; color: var(--strong); font-size: 18px; overflow-wrap: anywhere; }
.ps-modal .ps-detail-grid { grid-template-columns: 1fr; gap: 22px; }
.ps-modal-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 12px; padding-bottom: 17px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.ps-modal button:focus-visible, .ps-modal a:focus-visible { outline: 2px solid #258e88; outline-offset: 3px; }
.promo-status-view a:focus-visible { outline: 2px solid #258e88; outline-offset: 3px; }
@media (max-width: 1200px) {
  .ps-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps-summary-totals, .ps-summary-upcoming { height: 288px; }
  .ps-summary-changes { grid-column: 1 / -1; }
  .ps-search-controls { flex: 1; justify-content: flex-end; }
}
@media (max-width: 700px) {
  .promotion-status-mode .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .promotion-status-mode .side-nav-button { min-height: 38px; height: auto; padding: 9px 12px; white-space: nowrap; font-size: 12px; }
  .ps-intro, .ps-freshness { justify-content: flex-start; }
  .ps-summary { grid-template-columns: 1fr; gap: 10px; }
  .ps-summary-totals, .ps-summary-upcoming { height: 320px; }
  .ps-summary-changes { height: 360px; }
  .ps-summary-totals > .ps-total-summary { gap: 4px; padding: 10px 16px; }
  .ps-stat { padding: 15px; gap: 10px; }
  .ps-stat > strong { font-size: 22px; }
  .promo-status-view .panel-heading { flex-wrap: wrap; }
  .ps-caption { font-size: 10px; }
  .ps-timeline-axis, .ps-timeline-row { grid-template-columns: 105px minmax(70px, 1fr) 32px; gap: 10px; }
  .ps-search-controls { width: 100%; justify-content: flex-start; }
  .ps-search-controls input { flex: 1; width: 100px; }
  .ps-segments { width: 100%; }
  .ps-segments button { flex: 1; padding: 8px; }
  .ps-detail-grid { grid-template-columns: 1fr; }
  .ps-search-controls { flex-wrap: wrap; }
  .ps-search-controls input { flex-basis: 100%; }
  .ps-calendar-day { min-height: 125px; }
}
@media (max-width: 360px) {
  .ps-review-fields { grid-template-columns: minmax(0, 1fr); }
  .ps-source-actions { margin-inline-start: 0; padding-inline-start: 0; border-inline-start: 0; }
}

:root {
  --bg: #d7eee7;
  --panel: #ffffff;
  --ink: #35564f;
  --strong: #1d3f38;
  --muted: #7d918c;
  --line: #e7efec;
  --grid: rgba(40, 90, 78, 0.07);
  --mint: #6ccfc1;
  --mint-soft: rgba(108, 207, 193, 0.15);
  --blue: #3a86c6;
  --gold: #f0ac3f;
  --rose: #de8c94;
  --shadow: 0 14px 34px rgba(47, 96, 84, 0.11), 0 2px 7px rgba(47, 96, 84, 0.06);
  --positive: #1e8f6f;
  --positive-soft: rgba(30, 143, 111, 0.11);
  --negative: #cf5b5b;
  --negative-soft: rgba(207, 91, 91, 0.1);
  --sidebar-bg: #2f876e;
  --sidebar-border: rgba(255, 255, 255, 0.16);
  --sidebar-text: rgba(255, 255, 255, 0.78);
  --sidebar-strong: #ffffff;
  --sidebar-hover-bg: rgba(255, 255, 255, 0.12);
  --sidebar-hover-text: #ffffff;
  --sidebar-active-bg: #ffffff;
  --sidebar-active-text: #2f876e;
  --sidebar-active-border: rgba(255, 255, 255, 0.8);
  --sidebar-sub-border: rgba(255, 255, 255, 0.2);
}

body {
  background: var(--bg);
  color: var(--ink);
}

@media (min-width: 1101px) {
  .app-sidebar {
    inset: 32px auto 32px 32px;
    width: clamp(190px, 14vw, 240px);
    padding: 26px 14px 18px;
    border: 1px solid var(--sidebar-border);
    border-radius: 22px;
    box-shadow: 0 22px 42px rgba(37, 108, 86, 0.28);
  }

  .dashboard-shell {
    width: auto;
    min-height: calc(100vh - 64px);
    margin: 32px 32px 32px calc(clamp(190px, 14vw, 240px) + 56px);
    padding: 18px 18px 24px;
    border: 1px solid rgba(255, 255, 255, 0.68);
    border-radius: 24px;
    background: rgba(248, 251, 250, 0.82);
    box-shadow: 0 20px 44px rgba(49, 88, 80, 0.13);
  }

  .promotion-modal-panel {
    left: 232px;
    width: min(480px, calc(100% - 232px - 56px));
  }
}

.sidebar-title {
  margin-bottom: 30px;
  padding: 0 8px;
}

.sidebar-title strong {
  color: var(--sidebar-strong);
  font-size: 20px;
  letter-spacing: 0;
}

.sidebar-title span {
  color: rgba(255, 255, 255, 0.62);
}

.side-nav {
  gap: 8px;
}

.side-nav-button {
  height: 38px;
  border-radius: 999px;
  color: var(--sidebar-text);
  padding: 0 12px;
}

.side-nav-button:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-hover-text);
}

.side-nav-button.is-active {
  background: var(--sidebar-active-bg);
  border-color: var(--sidebar-active-border);
  color: var(--sidebar-active-text);
}

.summary-media-nav {
  border-left-color: var(--sidebar-sub-border);
}

.summary-nav-label,
.summary-month-label {
  color: rgba(255, 255, 255, 0.48);
}

.summary-media-button {
  color: rgba(255, 255, 255, 0.68);
}

.summary-media-button:hover,
.summary-media-button.is-active {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.promotion-select-badge {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}

.topbar {
  align-items: center;
  margin-bottom: 14px;
}

.topbar h1 {
  color: var(--strong);
}

.topbar p,
.date-source span,
.date-source small {
  color: var(--muted);
}

.date-source strong,
.date-range-trigger,
.filter-open-btn,
.export-btn,
.active-chip {
  box-shadow: none;
}

.date-range-trigger,
.filter-open-btn,
.export-btn {
  background: #ffffff;
  border-color: rgba(220, 234, 229, 0.95);
}

.date-range-trigger:hover,
.date-range-trigger[aria-expanded="true"],
.filter-open-btn:hover,
.filter-open-btn.has-active {
  border-color: rgba(47, 135, 110, 0.34);
  background: #ffffff;
  color: var(--strong);
}

.date-picker-panel,
.filter-drawer-panel,
.promotion-modal-panel,
.creative-modal-box {
  border-color: rgba(222, 235, 231, 0.96);
  border-radius: 18px;
  box-shadow: 0 24px 54px rgba(47, 88, 80, 0.2);
}

.date-preset-chip,
.date-picker-reset,
.date-picker-pin {
  background: #eef6f3;
}

.date-picker-footer .date-apply-button,
.filter-drawer-apply {
  background: #2f876e;
  border-color: #2f876e;
}

.date-picker-footer .date-apply-button:hover {
  background: #27755f;
}

.date-picker-pin.is-active {
  background: #2f876e;
  color: #ffffff;
}

.quick-filter-label,
label,
.kpi-label {
  color: #6e8981;
}

.media-quick-btn.is-major:not(.is-active) {
  color: var(--strong);
}

.active-chip {
  background: #e6f5f1;
  border-color: #cfe9e2;
  color: #28715f;
}

.control,
.panel,
.kpi {
  border: 0;
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel header p {
  background: #e8f6f2;
  color: #2f876e;
}

.panel h2,
.kpi-value,
.filter-drawer-title {
  color: var(--strong);
}

.kpi {
  padding: 16px 16px 15px;
}

.kpi-delta {
  border-radius: 999px;
}

.metric-control-bar,
.creative-device-tabs {
  border-color: #e3efeb;
  background: #f2f7f5;
  border-radius: 999px;
}

.metric-control-select,
select,
input {
  border-color: #dfece7;
  background: #fbfdfc;
}

.chart {
  color: var(--ink);
}

.table-wrap {
  border-color: #e4efeb;
  border-radius: 12px;
  background: #ffffff;
}

th,
.detail-table th,
.creative-performance-table th {
  background: #f2f7f5;
  color: #58736b;
}

td,
.detail-table td {
  border-bottom-color: #edf3f1;
}

tbody tr:hover,
tbody tr:hover td {
  background: #f3faf7;
}

.detail-table tr.total-row td {
  background: #e9f7f2;
  color: #255f51;
}

.creative-device-btn.is-active,
.creative-capture-button {
  border-color: rgba(47, 135, 110, 0.28);
  background: #e8f6f2;
  color: #2f876e;
}

.creative-device-btn.is-active {
  background: #2f876e;
  color: #ffffff;
}

.insight-card {
  border-color: #e5efeb;
  background: #ffffff;
}

@media (max-width: 1100px) {
  .app-sidebar {
    background: var(--sidebar-bg);
    box-shadow: none;
  }

  .dashboard-shell {
    background: transparent;
  }
}

/* ── Period report pages ──────────────────────────────────── */
.report-layout {
  display: grid;
  gap: 16px;
}

.report-chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* 콤보 카드: 3컬럼 전체 차지 */
.report-chart-card--combo {
  grid-column: 1 / -1;
}

/* ── 비밀번호 게이트 ────────────────────────────────────── */
html.auth-locked body {
  overflow: hidden;
}
html.auth-locked .app-sidebar,
html.auth-locked .dashboard-shell {
  visibility: hidden;
  pointer-events: none;
}
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.42), transparent 34%),
    linear-gradient(135deg, #d7eee7 0%, #eef8f5 54%, #ffffff 100%);
}
html.auth-locked .auth-gate {
  display: flex;
}
.auth-card {
  width: min(420px, calc(100vw - 40px));
  padding: 32px 30px 28px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 58px rgba(47, 96, 84, 0.18);
}
.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  background: #e8f6f2;
  color: #2f876e;
  font-size: 11px;
  font-weight: 900;
}
.auth-card h1 { margin: 18px 0 6px; color: var(--strong); font-size: 26px; font-weight: 900; }
.auth-card p  { margin: 0 0 22px; color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1.5; }
.auth-card label { display: block; margin-bottom: 8px; color: #6e8981; font-size: 12px; font-weight: 900; }
.auth-card input {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1px solid #dfece7; border-radius: 12px;
  background: #fbfdfc; color: var(--strong);
  font: inherit; font-size: 15px; font-weight: 800; outline: none;
}
.auth-card input:focus { border-color: rgba(47,135,110,0.44); box-shadow: 0 0 0 3px rgba(47,135,110,0.11); }
.auth-error { display: block; min-height: 20px; margin: 8px 0 10px; color: var(--negative); font-size: 12px; font-weight: 800; }
.auth-card button {
  width: 100%; height: 44px; border: 0; border-radius: 12px;
  background: #2f876e; color: #fff;
  font: inherit; font-size: 14px; font-weight: 900; cursor: pointer;
  transition: background 0.14s, transform 0.14s;
}
.auth-card button:hover { background: #27755f; transform: translateY(-1px); }

/* ── BigQuery 로딩 화면 ─────────────────────────────────
   비밀번호 화면과 같은 배경·카드를 써서 게이트 → 로딩 → 대시보드가 한 흐름으로
   이어지게 한다. 월별 칩은 응답이 도착하는 순서대로 채워진다(진짜 진행률). */
.data-loader {
  position: fixed;
  inset: 0;
  z-index: 5100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.42), transparent 34%),
    linear-gradient(135deg, #d7eee7 0%, #eef8f5 54%, #ffffff 100%);
}
.data-loader.is-leaving { animation: loaderOut 0.35s ease-in forwards; }
.loader-card {
  width: min(460px, calc(100vw - 40px));
  padding: 30px 30px 24px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 58px rgba(47, 96, 84, 0.18);
  text-align: center;
}
.loader-card h1 { margin: 10px 0 6px; color: var(--strong); font-size: 22px; font-weight: 900; }
.loader-card p  { margin: 0 0 20px; color: var(--muted); font-size: 13px; font-weight: 700; }

/* 세 점이 궤도를 돈다 — 데이터가 흘러들어오는 느낌 */
.loader-orbit {
  position: relative;
  width: 60px;
  height: 60px;
  margin: 20px auto 6px;
}
.loader-orbit::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px dashed rgba(47, 135, 110, 0.22);
  border-radius: 50%;
  animation: orbitRing 9s linear infinite;
}
.loader-orbit i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #2f876e;
  animation: orbitDot 1.5s cubic-bezier(0.55, 0.1, 0.45, 0.9) infinite;
}
.loader-orbit i:nth-child(2) { background: var(--mint); animation-delay: -0.5s; }
.loader-orbit i:nth-child(3) { background: #a6e3d9; animation-delay: -1s; }

.loader-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}
.loader-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 34px;
  border: 1px dashed #cfe4dd;
  border-radius: 10px;
  background: linear-gradient(90deg, #f3f9f7 0%, #e2f3ee 50%, #f3f9f7 100%);
  background-size: 200% 100%;
  color: #8aa39c;
  font-size: 12px;
  font-weight: 900;
  animation: chipShimmer 1.3s ease-in-out infinite;
}
.loader-chip.is-done {
  border: 1px solid #2f876e;
  background: #2f876e;
  color: #fff;
  animation: chipPop 0.34s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.loader-chip.is-done span::before { content: "✓ "; }
.loader-chip.is-failed {
  border: 1px solid var(--negative);
  background: var(--negative-soft);
  color: var(--negative);
  animation: none;
}
.loader-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8f3ef;
}
.loader-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), #2f876e);
  transition: width 0.35s ease;
}
.loader-count { display: block; margin-top: 10px; color: var(--muted); font-size: 12px; font-weight: 800; }
.loader-count b { color: var(--strong); }

/* 다른 기간을 고를 때 뜨는 작은 알림 — 화면은 떠 있으니 가리지 않는다 */
.data-loading-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 4500;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 14px;
  border-radius: 999px;
  background: rgba(29, 63, 56, 0.94);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, -140%);
  transition: transform 0.28s ease, opacity 0.28s ease;
  pointer-events: none;
}
.data-loading-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.data-loading-toast i {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: toastSpin 0.8s linear infinite;
}
.data-loading-toast.is-error { background: var(--negative); }
.data-loading-toast.is-error i { display: none; }

@keyframes orbitDot {
  from { transform: rotate(0deg) translateX(22px) rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) translateX(22px) rotate(-180deg) scale(0.7); }
  to   { transform: rotate(360deg) translateX(22px) rotate(-360deg) scale(1); }
}
@keyframes orbitRing  { to { transform: rotate(360deg); } }
@keyframes chipShimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes chipPop    { from { transform: scale(0.8); } to { transform: scale(1); } }
@keyframes loaderOut  { to { opacity: 0; visibility: hidden; } }
@keyframes toastSpin  { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .loader-orbit { display: none; }
  .loader-chip,
  .loader-chip.is-done,
  .data-loader.is-leaving,
  .data-loading-toast i { animation: none; }
  .loader-bar span,
  .data-loading-toast { transition: none; }
}

/* ── 전기간 대비 코멘트 바 ─────────────────────────────── */
.period-comment-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 22px 13px;
  border-top: 1px dashed var(--line);
  background: transparent;
}
.pc-period {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}
.pc-period::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.5;
}
.pc-period em {
  font-style: normal;
  font-weight: 700;
  color: var(--text);
}
.pc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.pc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  background: #f0f0f0;
  color: #777;
  border: none;
  letter-spacing: -0.01em;
}
.pc-chip b {
  font-weight: 700;
  font-size: 12px;
}
.pc-chip--good {
  background: #e6f7f1;
  color: #1a8a5c;
}
.pc-chip--good b { color: #1a8a5c; }
.pc-chip--bad {
  background: #fdf0ef;
  color: #c73030;
}
.pc-chip--bad b { color: #c73030; }
.pc-chip--flat {
  background: #f0f0f0;
  color: #888;
}
.pc-chip--flat b { color: #666; }

.report-chart--combo {
  min-height: 340px;
  overflow-x: auto;
}

/* 콤보 차트 지표 셀렉터 3개 */
.report-combo-selectors {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.report-combo-selector-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.combo-slot-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.report-chart-card header {
  align-items: center;
  gap: 20px 14px;
}

.report-chart-card header > div:nth-child(2) {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.report-chart-card header .report-combo-selectors {
  margin-left: 0;
}

.report-metric-select {
  width: 140px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  padding: 0 12px;
}

.brand-trend-selectors {
  margin-left: auto;
  justify-content: flex-end;
}

.brand-trend-selectors .report-metric-select {
  width: 156px;
}

.report-chart {
  min-height: 260px;
}

.report-bar {
  fill: rgba(108, 207, 193, 0.44);
  transition: fill 0.15s, opacity 0.15s;
}

.report-bar:hover {
  fill: rgba(47, 135, 110, 0.76);
}

.report-line {
  fill: none;
  stroke: #2f876e;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.report-dot {
  fill: #ffffff;
  stroke: #2f876e;
  stroke-width: 2;
}

.report-table-panel header {
  align-items: center;
}

.report-count {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e8f6f2;
  color: #2f876e;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.report-table-wrap {
  max-height: 520px;
}

.period-report-table {
  min-width: 1120px;
}

.period-report-table th:first-child,
.period-report-table td:first-child {
  min-width: 190px;
}

.period-report-table td:first-child {
  color: var(--strong);
  font-weight: 800;
}

@media (max-width: 1280px) {
  .report-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .brand-trend-selectors {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .brand-trend-selectors .report-metric-select {
    flex: 1 1 auto;
    width: auto;
    min-width: 160px;
  }
}

/* ─── 월 예상 마감 (Month Close) ─────────────────────────────── */

/* 사이드바 구분선 + 특수 탭 */
.side-nav-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 14px 8px 10px;
}
.side-nav-button.is-special {
  color: #cdd9e4;
  background: rgba(62, 203, 196, 0.06);
}
.side-nav-button.is-special.is-active {
  background: rgba(62, 203, 196, 0.18);
  border-color: rgba(62, 203, 196, 0.4);
  color: #4ecdc4;
}
.side-nav-button.is-special:hover {
  background: rgba(62, 203, 196, 0.12);
}

/* View 전체 */
.month-close-view {
  padding-top: 6px;
}
.month-close-view .panel {
  padding: 14px 16px;
}
.month-close-view .panel header {
  margin-bottom: 8px;
}

/* 상단 툴바: 월 선택 + 서브탭 */
.month-close-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: var(--panel);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.month-close-month-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}
.month-close-month-picker label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}
.month-close-month-picker select {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}
.month-close-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}
.month-close-tab {
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.month-close-tab:hover {
  background: var(--mint-soft);
  border-color: var(--mint);
}
.month-close-tab.is-active {
  background: var(--mint);
  color: #fff;
  border-color: var(--mint);
}

/* 페이지 토글 */
.mc-page { display: none; }
.mc-page.is-active { display: block; }

/* 1. 광고 운영 총계 */
.mc-summary-panel header p {
  text-align: center;
}
.mc-summary-panel header div {
  text-align: center;
}
.mc-summary-panel header h2 {
  font-size: 16px;
  font-weight: 900;
}
.mc-summary-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: center;
  padding: 8px 0;
}
.mc-summary-kpis {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mc-kpi-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: baseline;
  gap: 8px;
  padding: 5px 4px;
  border-bottom: 1px solid var(--line);
}
.mc-kpi-row:last-child { border-bottom: none; }
.mc-kpi-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}
.mc-kpi-row strong {
  font-size: 17px;
  font-weight: 900;
  color: var(--strong);
  text-align: right;
}
.mc-kpi-row em {
  font-style: normal;
  font-size: 10px;
  color: var(--muted);
}
.mc-summary-donuts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mc-donut-card {
  text-align: center;
}
.mc-donut-title {
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--strong);
}
.mc-donut-svg {
  width: 130px;
  height: 130px;
  display: block;
  margin: 0 auto;
}
.mc-donut-values {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  color: var(--ink);
  align-items: center;
}
.mc-donut-values li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.mc-donut-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.mc-summary-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.mc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink);
}
.mc-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* 2. KPI 달성률 */
.mc-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 8px 0;
}
.mc-kpi-chart {
  text-align: center;
}
.mc-kpi-chart-label {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 6px;
}
.mc-kpi-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  height: 140px;
  padding: 0 12px;
}
.mc-kpi-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  max-width: 60px;
  height: 100%;
}
.mc-kpi-bar-value {
  font-size: 11px;
  font-weight: 800;
  color: var(--strong);
}
.mc-kpi-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  margin-top: auto;
}
.mc-kpi-bar-target {
  background: linear-gradient(180deg, rgba(143, 160, 176, 0.55) 0%, rgba(143, 160, 176, 0.85) 100%);
}
.mc-kpi-bar-actual {
  background: linear-gradient(180deg, rgba(62, 203, 196, 0.55) 0%, rgba(62, 203, 196, 0.95) 100%);
}
.mc-kpi-bar-axis {
  font-size: 10px;
  color: var(--muted);
}
.mc-kpi-table-wrap {
  margin-top: 8px;
}
.mc-kpi-table th,
.mc-kpi-table td {
  text-align: center;
  padding: 5px 10px;
  font-size: 12px;
}
.mc-rate-ok {
  background: var(--positive-soft);
  color: var(--positive);
  font-weight: 900;
}
.mc-rate-warn {
  background: var(--warning-soft);
  color: var(--warning);
  font-weight: 900;
}

/* 3. 광고비 소진 예상 테이블 */
.mc-channels-table-wrap {
  overflow-x: auto;
}
.mc-channels-table {
  font-size: 11px;
  min-width: 1200px;
}
.mc-channels-table th,
.mc-channels-table td {
  padding: 6px 8px;
  text-align: right;
  white-space: nowrap;
}
.mc-channels-table th:first-child,
.mc-channels-table th:nth-child(2),
.mc-channels-table th:nth-child(3),
.mc-channels-table td:first-child,
.mc-channels-table td:nth-child(2),
.mc-channels-table td:nth-child(3) {
  text-align: left;
}
.mc-row-subtotal td {
  background: var(--mint-soft);
  color: var(--strong);
  font-weight: 800;
}
.mc-row-grandtotal td {
  background: rgba(62, 203, 196, 0.22);
  color: var(--strong);
  font-weight: 900;
  font-size: 12px;
}

/* 4. 5. YoY/MoM 공통 */
.mc-compare-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 8px 0;
}
.mc-cmp-chart {
  text-align: center;
}
.mc-cmp-chart-label {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
}
.mc-cmp-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  height: 110px;
  padding: 0 12px;
}
.mc-cmp-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  max-width: 56px;
  height: 100%;
}
.mc-cmp-bar-value {
  font-size: 10px;
  font-weight: 800;
  color: var(--strong);
}
.mc-cmp-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  margin-top: auto;
  background: linear-gradient(180deg, rgba(62, 203, 196, 0.55) 0%, rgba(62, 203, 196, 0.95) 100%);
}
/* 비교 차트: 마지막(최신) 컬럼만 mint 강조, 이전 컬럼은 옅은 그레이 */
.mc-cmp-bar-col:not(:last-child) .mc-cmp-bar {
  background: linear-gradient(180deg, rgba(143, 160, 176, 0.45) 0%, rgba(143, 160, 176, 0.75) 100%);
}
.mc-cmp-bar-axis {
  font-size: 10px;
  color: var(--muted);
}
.mc-compare-table-wrap {
  margin-top: 8px;
  overflow-x: auto;
}
.mc-compare-table {
  font-size: 11px;
  min-width: 1000px;
}
.mc-compare-table th,
.mc-compare-table td {
  padding: 5px 8px;
  text-align: center;
}
.mc-row-rate {
  background: rgba(220, 226, 232, 0.4);
  font-weight: 800;
}
.mc-diff-up { color: var(--negative); font-weight: 800; }
.mc-diff-down { color: var(--blue); font-weight: 800; }

/* Sales report */
.sales-view {
  display: none;
  gap: 18px;
}
.sales-view.is-active {
  display: flex;
  flex-direction: column;
}
.sales-kpi-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.sales-kpi .kpi-value {
  font-size: clamp(18px, 2vw, 26px);
  line-height: 1.08;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.sales-board-grid,
.sales-table-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.sales-board-grid .span-2,
.sales-table-grid .span-2 {
  grid-column: span 2;
}
.sales-chart-card header,
.sales-table-grid .table-panel header {
  align-items: flex-start;
  gap: 12px;
}
.sales-selectors {
  flex-shrink: 0;
}
.sales-trend-chart {
  min-height: 288px;
}
.sales-channel-chart {
  min-height: 330px;
}
.sales-compact-chart {
  min-height: 300px;
}
.sales-trend-area {
  fill: rgba(62, 203, 196, 0.16);
}
.sales-trend-line {
  fill: none;
  stroke: #14b8a6;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.sales-trend-dot {
  fill: #fff;
  stroke: #14b8a6;
  stroke-width: 2;
}
.sales-bar {
  fill: #3ecbc4;
}
.sales-bar:nth-of-type(3n + 1) {
  fill: #3ecbc4;
}
.sales-bar:nth-of-type(3n + 2) {
  fill: #4691c7;
}
.sales-bar:nth-of-type(3n) {
  fill: #8bb6a8;
}
.sales-bar-label {
  font-weight: 800;
  fill: var(--ink);
}
.sales-insight-panel .insights {
  padding-top: 4px;
}
.sales-insight-panel .insight-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.sales-insight-panel .insight-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}
.sales-insight-panel .insight-tag {
  align-self: flex-start;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}
.sales-insight-panel .insight-text {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  word-break: keep-all;
}
.sales-table-wrap {
  max-height: 520px;
  overflow: auto;
}
.sales-product-table {
  min-width: 1040px;
}
.sales-channel-table {
  min-width: 760px;
}
.sales-product-name {
  max-width: 360px;
  font-weight: 800;
  color: var(--strong);
}
.sales-table-grid th,
.sales-table-grid td {
  white-space: nowrap;
}
.sales-table-grid th:first-child,
.sales-table-grid td:first-child,
.sales-table-grid th:nth-child(2),
.sales-table-grid td:nth-child(2) {
  text-align: left;
}
.sales-table-grid td:not(:first-child):not(:nth-child(2)),
.sales-table-grid th:not(:first-child):not(:nth-child(2)) {
  text-align: right;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── AI Assistant ─────────────────────────────────────────── */
.ai-assistant {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 80;
  pointer-events: none;
}

.ai-chat-launcher,
.ai-chat-panel {
  pointer-events: auto;
}

.ai-chat-launcher {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.44), transparent 26%),
    linear-gradient(135deg, #42c9b1 0%, #2e9b7f 100%);
  box-shadow: 0 18px 34px rgba(41, 141, 116, 0.28), 0 5px 12px rgba(22, 80, 68, 0.14);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.ai-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 42px rgba(41, 141, 116, 0.32), 0 7px 16px rgba(22, 80, 68, 0.16);
}

.ai-chat-launcher:active {
  transform: translateY(0) scale(0.98);
}

.ai-chat-launcher:focus-visible,
.ai-chat-icon-button:focus-visible,
.ai-chat-external-toggle:focus-visible,
.ai-chat-input-row button:focus-visible,
.ai-chat-suggestions button:focus-visible {
  outline: 3px solid rgba(47, 174, 143, 0.25);
  outline-offset: 3px;
}

.ai-chat-launcher-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
}

.ai-chat-launcher svg,
.ai-chat-header svg,
.ai-chat-input-row svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-chat-launcher svg {
  fill: rgba(255, 255, 255, 0.98);
  stroke: none;
}

.ai-chat-launcher-icon img,
.ai-chat-avatar img,
.ai-chat-mini-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.ai-chat-panel {
  position: absolute;
  right: 0;
  bottom: 88px;
  width: min(420px, calc(100vw - 32px));
  height: min(780px, calc(100vh - 116px));
  max-height: min(780px, calc(100vh - 116px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(185, 222, 211, 0.82);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 26px 70px rgba(31, 68, 56, 0.22), 0 8px 24px rgba(38, 101, 84, 0.12);
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transform-origin: right bottom;
  visibility: hidden;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.19, 1, 0.22, 1), visibility 0.22s;
}

.ai-assistant.is-open .ai-chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.ai-assistant.is-open .ai-chat-launcher {
  filter: saturate(0.92);
  transform: scale(0.92);
}

.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 20px 16px;
  background:
    linear-gradient(135deg, rgba(73, 196, 164, 0.2), rgba(65, 151, 127, 0.13)),
    #ffffff;
  border-bottom: 1px solid rgba(212, 231, 224, 0.86);
}

.ai-chat-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ai-chat-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 16px;
  color: #ffffff;
  background: linear-gradient(135deg, #36bca0 0%, #2d9479 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 8px 16px rgba(41, 141, 116, 0.22);
}

.ai-chat-avatar svg {
  width: 25px;
  height: 25px;
  fill: rgba(255, 255, 255, 0.9);
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 1.5;
}

.ai-chat-avatar img {
  width: 25px;
  height: 25px;
}

.ai-chat-identity p {
  margin: 0 0 2px;
  color: #3f7f6f;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-chat-identity h2 {
  margin: 0;
  color: var(--strong);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
}

.ai-chat-external-toggle {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(155, 169, 178, 0.48);
  border-radius: 14px;
  padding: 0;
  color: #7d8a92;
  background: #f6f8f9;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.ai-chat-external-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-chat-external-toggle:hover {
  border-color: rgba(126, 149, 163, 0.7);
  color: #657984;
  background: #eef2f4;
}

.ai-chat-external-toggle.is-active {
  border-color: rgba(81, 150, 199, 0.52);
  color: #337ead;
  background: rgba(116, 186, 231, 0.16);
  box-shadow: 0 0 0 3px rgba(103, 177, 225, 0.11), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.ai-chat-external-toggle.is-active:hover {
  border-color: rgba(66, 136, 187, 0.68);
  color: #286d9a;
  background: rgba(116, 186, 231, 0.22);
}

.ai-chat-icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(178, 214, 203, 0.72);
  border-radius: 999px;
  color: #6f8595;
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.ai-chat-icon-button svg {
  width: 17px;
  height: 17px;
}

.ai-chat-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
  max-height: none;
  padding: 18px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 18% 8%, rgba(80, 196, 164, 0.12), transparent 36%),
    linear-gradient(180deg, #fbfdfb 0%, #f3f9f5 100%);
}

.ai-chat-message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.ai-chat-message--user {
  justify-content: flex-end;
}

.ai-chat-mini-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  color: #ffffff;
  background: linear-gradient(135deg, #42c9b1, #2e9b7f);
  font-size: 10px;
  font-weight: 900;
}

.ai-chat-mini-avatar img {
  width: 16px;
  height: 16px;
}

.ai-chat-bubble {
  max-width: 308px;
  padding: 13px 14px;
  border: 1px solid rgba(208, 229, 221, 0.82);
  border-radius: 16px 16px 16px 6px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(45, 88, 72, 0.08);
}

.ai-chat-message--assistant .ai-chat-bubble {
  max-width: min(334px, calc(100% - 37px));
}

.ai-chat-message--user .ai-chat-bubble {
  border-color: rgba(58, 179, 146, 0.26);
  border-radius: 16px 16px 6px 16px;
  color: #153f34;
  background: linear-gradient(135deg, rgba(72, 199, 166, 0.2), rgba(76, 150, 126, 0.14));
}

.ai-chat-bubble strong {
  display: block;
  margin-bottom: 5px;
  color: var(--strong);
  font-size: 13px;
  font-weight: 900;
}

.ai-chat-bubble p {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
  word-break: keep-all;
}

.ai-chat-content {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.58;
  word-break: keep-all;
}

.ai-chat-content p {
  margin: 0;
}

.ai-chat-content p + p {
  margin-top: 8px;
}

.ai-chat-content ul,
.ai-chat-content ol {
  margin: 8px 0 0;
  padding-left: 17px;
}

.ai-chat-content li {
  padding-left: 2px;
}

.ai-chat-content li + li {
  margin-top: 7px;
}

.ai-chat-content strong {
  display: inline;
  margin: 0;
  color: #123a31;
  font-size: inherit;
  font-weight: 900;
}

.ai-chat-content code {
  padding: 1px 5px;
  border-radius: 6px;
  color: #15624f;
  background: rgba(76, 199, 166, 0.13);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.94em;
  font-weight: 800;
}

.ai-chat-table-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 10px 0 2px;
  overflow-x: auto;
  border: 1px solid rgba(203, 224, 216, 0.9);
  border-radius: 12px;
  background: #fbfefd;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.ai-chat-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.ai-chat-table th,
.ai-chat-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(219, 234, 229, 0.9);
  color: #23463d;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.42;
  text-align: left;
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.ai-chat-table th + th,
.ai-chat-table td + td {
  border-left: 1px solid rgba(219, 234, 229, 0.74);
}

.ai-chat-table th:first-child,
.ai-chat-table td:first-child {
  width: 76px;
  min-width: 76px;
  max-width: 76px;
  text-align: center;
}

.ai-chat-table th:nth-child(2),
.ai-chat-table td:nth-child(2) {
  width: 140px;
}

.ai-chat-table th:nth-child(3),
.ai-chat-table td:nth-child(3) {
  width: 190px;
}

.ai-chat-table th:nth-child(4),
.ai-chat-table td:nth-child(4) {
  width: 170px;
}

.ai-chat-table th:nth-child(5),
.ai-chat-table td:nth-child(5) {
  width: 150px;
}

.ai-chat-table th:nth-child(6),
.ai-chat-table td:nth-child(6),
.ai-chat-table th:nth-child(7),
.ai-chat-table td:nth-child(7),
.ai-chat-table th:nth-child(8),
.ai-chat-table td:nth-child(8),
.ai-chat-table th:nth-child(9),
.ai-chat-table td:nth-child(9) {
  width: 116px;
  white-space: nowrap;
  overflow-wrap: normal;
}

.ai-chat-table th:nth-child(6),
.ai-chat-table td:nth-child(6),
.ai-chat-table th:nth-child(7),
.ai-chat-table td:nth-child(7),
.ai-chat-table th:nth-child(8),
.ai-chat-table td:nth-child(8) {
  text-align: right;
}

.ai-chat-table th {
  position: sticky;
  top: 0;
  color: #315d52;
  background: #edf8f4;
  font-weight: 900;
}

.ai-chat-table td:last-child,
.ai-chat-table th:last-child {
  width: 320px;
  min-width: 320px;
  white-space: normal;
  overflow-wrap: break-word;
}

.ai-chat-table tbody tr:last-child td {
  border-bottom: 0;
}

.ai-chat-table-expand {
  position: absolute;
  right: 6px;
  top: 6px;
  z-index: 3;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(135, 181, 168, 0.62);
  border-radius: 9px;
  color: #327564;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 16px rgba(35, 84, 69, 0.12);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.ai-chat-table-expand:hover {
  border-color: rgba(58, 179, 146, 0.58);
  color: #1f6f5b;
  background: #ffffff;
}

.ai-chat-table-expand svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-chat-table-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 28px;
}

.ai-chat-table-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 38, 33, 0.34);
  backdrop-filter: blur(5px);
}

.ai-chat-table-modal__panel {
  position: relative;
  z-index: 1;
  width: min(1040px, calc(100vw - 40px));
  max-height: min(760px, calc(100vh - 52px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(188, 220, 211, 0.86);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(21, 55, 45, 0.28);
}

.ai-chat-table-modal__panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(219, 234, 229, 0.95);
  background: linear-gradient(135deg, #f1fbf7, #ffffff);
}

.ai-chat-table-modal__panel header strong {
  color: #143a31;
  font-size: 15px;
  font-weight: 900;
}

.ai-chat-table-modal__panel header button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(178, 214, 203, 0.72);
  border-radius: 999px;
  color: #637d75;
  background: #ffffff;
  cursor: pointer;
}

.ai-chat-table-modal__panel header button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.ai-chat-table-modal__body {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px;
}

.ai-chat-table-modal .ai-chat-table {
  min-width: 1680px;
  font-size: 13px;
}

.ai-chat-table-modal .ai-chat-table th:first-child,
.ai-chat-table-modal .ai-chat-table td:first-child {
  width: 82px;
  min-width: 82px;
  max-width: 82px;
}

.ai-chat-table-modal .ai-chat-table th:nth-child(2),
.ai-chat-table-modal .ai-chat-table td:nth-child(2) {
  width: 160px;
}

.ai-chat-table-modal .ai-chat-table th:nth-child(3),
.ai-chat-table-modal .ai-chat-table td:nth-child(3) {
  width: 240px;
}

.ai-chat-table-modal .ai-chat-table th:nth-child(4),
.ai-chat-table-modal .ai-chat-table td:nth-child(4) {
  width: 240px;
}

.ai-chat-table-modal .ai-chat-table th:nth-child(5),
.ai-chat-table-modal .ai-chat-table td:nth-child(5) {
  width: 180px;
}

.ai-chat-table-modal .ai-chat-table td:last-child,
.ai-chat-table-modal .ai-chat-table th:last-child {
  width: 430px;
  min-width: 430px;
}

.ai-chat-table-modal .ai-chat-table th,
.ai-chat-table-modal .ai-chat-table td {
  padding: 10px 12px;
  font-size: 12px;
}

.ai-chat-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid rgba(207, 228, 220, 0.86);
}

.ai-chat-sources a {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid rgba(47, 133, 109, 0.34);
  color: #277b65;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.4;
}

.ai-chat-sources a:hover {
  color: #155743;
  border-bottom-color: currentColor;
}

.ai-chat-lead {
  color: #123a31;
  font-weight: 900;
}

.ai-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 37px;
}

.ai-chat-suggestions button {
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(58, 179, 146, 0.22);
  border-radius: 999px;
  color: #356f61;
  background: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.ai-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-chat-input-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: end;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid rgba(226, 232, 237, 0.82);
  background: rgba(255, 255, 255, 0.98);
}

.ai-chat-input-row textarea {
  width: 100%;
  min-height: 44px;
  max-height: 104px;
  border: 1px solid rgba(190, 212, 221, 0.86);
  border-radius: 14px;
  padding: 11px 14px;
  color: var(--strong);
  background: #f8fbfc;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
  resize: none;
  outline: none;
}

.ai-chat-input-row textarea:focus {
  border-color: rgba(58, 179, 146, 0.72);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(58, 179, 146, 0.12);
}

.ai-chat-input-row button[type="submit"] {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  color: #ffffff;
  background: linear-gradient(135deg, #42c9b1, #2e9b7f);
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(41, 141, 116, 0.22);
}

.ai-chat-input-row button[type="submit"] svg {
  width: 18px;
  height: 18px;
}

.ai-chat-input-row.is-sending button[type="submit"] {
  opacity: 0.7;
  cursor: progress;
}

.ai-chat-input-row textarea:disabled {
  color: var(--muted);
  background: #eef7f3;
}

.ai-chat-external-toggle:disabled {
  cursor: progress;
  opacity: 0.58;
}

.ai-chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 18px;
}

.ai-chat-typing i {
  width: 6px;
  height: 6px;
  display: block;
  border-radius: 999px;
  background: #42aa8e;
  animation: aiTypingDot 0.9s ease-in-out infinite;
}

.ai-chat-typing i:nth-child(2) {
  animation-delay: 0.12s;
}

.ai-chat-typing i:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes aiTypingDot {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

@media (min-width: 1181px) and (max-width: 1560px) {
  .sales-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .sales-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sales-board-grid,
  .sales-table-grid {
    grid-template-columns: 1fr;
  }
  .sales-board-grid .span-2,
  .sales-table-grid .span-2 {
    grid-column: span 1;
  }
  .sales-insight-panel .insight-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .ai-assistant {
    right: 14px;
    bottom: 14px;
  }
  .ai-chat-launcher {
    width: 56px;
    height: 56px;
  }
  .ai-chat-panel {
    right: 0;
    bottom: 74px;
    width: calc(100vw - 28px);
    height: calc(100vh - 104px);
    max-height: calc(100vh - 104px);
    border-radius: 22px;
  }
  .ai-chat-body {
    min-height: 0;
    max-height: none;
  }
  .sales-kpi-grid,
  .sales-insight-panel .insight-list {
    grid-template-columns: 1fr;
  }
  .sales-chart-card header,
  .sales-table-grid .table-panel header {
    flex-direction: column;
  }
  .sales-selectors,
  .sales-selectors .report-combo-selector-item,
  .sales-selectors .report-metric-select {
    width: 100%;
  }
}

/* Major category → work group → destination, preserving existing data-view routes. */
.app-sidebar.has-nav-tree .sidebar-title { margin-bottom: 20px; }
.side-nav.side-nav-tree { display: grid; grid-template-columns: minmax(0, 1fr); gap: 17px; }
.side-nav-tree .side-nav-section { display: block; min-width: 0; }
.side-nav-tree .side-nav-section + .side-nav-section { border-top: 1px solid rgba(255,255,255,.13); padding-top: 14px; }
.side-nav-tree summary { display: flex; align-items: center; justify-content: space-between; list-style: none; cursor: pointer; user-select: none; }
.side-nav-tree summary::-webkit-details-marker { display: none; }
.side-nav-tree summary::marker { content: ''; }
.side-nav-tree summary::after { content: ''; flex-shrink: 0; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); margin-left: 8px; margin-right: 3px; }
.side-nav-tree details[open] > summary::after { transform: rotate(45deg); }
.side-nav-tree details:not([open]) > :not(summary) { display: none !important; }
.side-nav-tree .side-nav-category { margin: 0; padding: 6px 10px; min-height: 46px; color: rgba(255,255,255,.9); font-size: 20px; font-weight: 800; letter-spacing: .01em; border-radius: 6px; }
.side-nav-reports > .side-nav-category { display: flex; align-items: center; }
.side-nav-category-label { display: flex; align-items: center; gap: 9px; min-width: 0; }
.side-nav-summary-text { min-width: 0; }
.side-nav-preview { display: block; margin-top: 4px; color: rgba(255,255,255,.88); font-size: 11px; font-weight: 400; line-height: 1.55; letter-spacing: 0; word-break: keep-all; overflow-wrap: anywhere; }
.side-nav-category .side-nav-preview { padding-inline-start: 27px; }
.side-nav-tree details[open] > summary .side-nav-preview { display: none; }
.side-nav-tree details:not([open]) > summary { align-items: flex-start; }
.side-nav-tree details:not([open]) > summary::after { margin-top: 8px; }
.side-nav-tree .side-nav-category .nav-icon, .side-nav-tree .side-nav-category .nav-icon svg { width: 18px; height: 18px; }
.side-nav-tree summary:hover { background: rgba(255,255,255,.07); }
.side-nav-tree summary:focus-visible { outline: 2px solid rgba(255,255,255,.75); outline-offset: 2px; }
.side-nav-tree .side-nav-section[open] > .side-nav-list { margin-top: 7px; }
.side-nav-tree .side-nav-group { min-width: 0; margin-left: 9px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.2); }
.side-nav-tree .side-nav-group { margin-top: 7px; }
.side-nav-tree .side-nav-subcategory { padding: 5px 7px 5px 10px; min-height: 38px; font-size: 16px; font-weight: 600; color: rgba(255,255,255,.88); border-radius: 5px; }
.side-nav-tree .side-nav-group[open] > .side-nav-list { margin-top: 4px; }
.side-nav-tree .side-nav-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.side-nav-tree .side-nav-button { min-width: 0; width: 100%; height: 38px; min-height: 38px; padding: 0 9px; gap: 7px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.side-nav-tree .nav-icon, .side-nav-tree .nav-icon svg { width: 16px; height: 16px; }
.side-nav-tree .side-nav-button:focus-visible { outline: 2px solid rgba(255,255,255,.75); outline-offset: 2px; }
@media (max-width: 1100px) {
  .side-nav.side-nav-tree { grid-template-columns: minmax(150px, 1fr) minmax(200px, 1.5fr); align-items: start; gap: 18px; }
  .side-nav-tree .side-nav-section + .side-nav-section { padding-top: 0; border-top: 0; }
}
@media (max-width: 700px) {
  .side-nav.side-nav-tree { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 10px; }
}
@media (max-width: 480px) {
  .side-nav.side-nav-tree { grid-template-columns: minmax(0, 1fr); }
}
