:root {
  --bg: #eef2f6;
  --panel: #ffffff;
  --ink: #182033;
  --muted: #6e7890;
  --line: #d9e0ea;
  --primary: #1f4fd6;
  --primary-dark: #173ea8;
  --danger: #d64242;
  --success: #1f9b5e;
  --pill: #edf3ff;
  --shadow: 0 18px 40px rgba(21, 34, 58, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans KR", sans-serif;
  background: linear-gradient(180deg, #f7f9fc 0%, var(--bg) 100%);
  color: var(--ink);
}

.shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.hidden { display: none !important; }

/* Boot-time visibility (set by the inline script in index.html before app.js
   runs) to avoid the login card flashing on a logged-in refresh. app.js removes
   these classes once it takes control so normal .hidden toggling applies. */
html.admin-boot-authed #login-card { display: none !important; }
html.admin-boot-authed #app-shell { display: block !important; }
[hidden] { display: none !important; }
.stack { display: grid; gap: 16px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { min-height: 20px; color: var(--danger); margin: 0; }

.login-card,
.panel {
  background: var(--panel);
  border: 1px solid rgba(217, 224, 234, 0.85);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.login-card {
  display: grid;
  gap: 24px;
  max-width: 540px;
  margin: 48px auto 0;
  padding: 28px;
}

label { display: grid; gap: 8px; font-size: 14px; color: var(--muted); }
input,
select,
textarea,
button {
  font: inherit;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
}
textarea {
  resize: vertical;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.ghost-toggle {
  min-width: 76px;
  padding-inline: 14px;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
}
button.primary {
  background: var(--primary);
  color: #fff;
}
button.primary:hover { background: var(--primary-dark); }
button.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.danger {
  background: rgba(214, 66, 66, 0.1);
  color: var(--danger);
  border: 1px solid rgba(214, 66, 66, 0.2);
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.topbar h1,
.topbar h2 { margin: 0; font-size: 36px; }
.topbar-actions {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}
.inline-field {
  min-width: 320px;
}

.app-frame {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.sidebar {
  position: static;
  display: grid;
  gap: 18px;
  align-self: start;
  margin-top: 94px;
  padding: 24px 20px;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.sidebar-link {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 18px;
  padding: 16px 16px;
  display: grid;
  gap: 6px;
}

.sidebar-link strong {
  font-size: 16px;
}

.sidebar-link span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(31, 79, 214, 0.12), rgba(31, 79, 214, 0.04));
  border-color: rgba(31, 79, 214, 0.22);
}

.content-area {
  min-width: 0;
}

.app-view {
  display: grid;
  gap: 20px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.controls label:first-child {
  grid-column: span 2;
}

.overview-panel {
  margin-bottom: 20px;
}

.overview-copy {
  margin: 6px 0 0;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.overview-rows {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

/* Chart hover tooltip */
#series-chart { position: relative; }
.series-hit { cursor: pointer; }
.series-tooltip {
  position: absolute;
  pointer-events: none;
  background: #182033;
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  white-space: nowrap;
  text-align: center;
  transform: translate(-50%, -120%);
  opacity: 0;
  transition: opacity 0.1s ease;
  z-index: 6;
}
.series-tooltip-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}
.series-tooltip-date {
  font-size: 13px; /* ~60% of the value size */
  font-weight: 500;
  opacity: 0.8;
  margin-top: 2px;
}
.series-tooltip.show { opacity: 1; }
.overview-row {
  display: grid;
  gap: 12px;
}
.overview-row.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.overview-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.overview-row.cols-1 { grid-template-columns: 1fr; }

/* Country breakdown (shown in the Growth & Activity panel when Country is selected) */
.country-breakdown {
  display: grid;
  gap: 10px;
  padding: 8px 4px;
}
.country-breakdown-hint {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}
.country-breakdown-row {
  display: grid;
  grid-template-columns: 120px 1fr 56px;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 6px 4px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.country-breakdown-row:hover {
  background: rgba(31, 79, 214, 0.07);
}
.country-back-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary);
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
}
.country-back-btn:hover { background: #eef2fb; }
.country-breakdown-label {
  font-weight: 600;
  color: var(--ink);
}
.country-breakdown-bar {
  height: 18px;
  border-radius: 9px;
  background: linear-gradient(90deg, #1f4fd6, #4f7af0);
  min-width: 4px;
}
.country-breakdown-count {
  text-align: right;
  font-weight: 700;
  color: var(--ink);
}
@media (max-width: 1100px) {
  .overview-row.cols-4,
  .overview-row.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===== Mobile content polish (no functional change) ===== */
@media (max-width: 1100px) {
  .shell { padding: 14px 12px 32px; }
  .panel { padding: 16px 14px; }
  .topbar h1,
  .topbar h2 { font-size: 24px; }
  .inline-field { min-width: 0; width: 100%; }
  .inline-field input { width: 100%; }
  .topbar-actions { width: 100%; flex-wrap: wrap; gap: 8px; }
  .overview-card { padding: 14px 12px; }
  .overview-card strong { font-size: 26px; }
  .overview-card span { font-size: 12px; }
  .members-table { min-width: 680px; }
  .members-table thead th,
  .members-table tbody td { padding: 10px 12px; font-size: 13px; }
  .table-shell,
  .section-table-shell { -webkit-overflow-scrolling: touch; }
  .country-breakdown-row { grid-template-columns: 96px 1fr 44px; }
}
@media (max-width: 480px) {
  .overview-row.cols-4,
  .overview-row.cols-3 { grid-template-columns: 1fr; }
}

/* Stop the whole PAGE from scrolling sideways: let layout containers shrink
   below their content, and keep wide tables scrolling INSIDE their own shell. */
@media (max-width: 1100px) {
  html,
  body { overflow-x: hidden; }
  .app-frame,
  .content-area,
  .app-view { min-width: 0; }
  .panel {
    min-width: 0;
    max-width: 100%;
  }
  .table-shell,
  .section-table-shell {
    min-width: 0;
    max-width: 100%;
  }
  input,
  select,
  textarea { max-width: 100%; }
}

.overview-card {
  appearance: none;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 20px;
  background:
    radial-gradient(circle at top right, rgba(31, 79, 214, 0.08), transparent 40%),
    #f9fbff;
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  font: inherit;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.overview-card:hover {
  border-color: rgba(31, 79, 214, 0.28);
  transform: translateY(-1px);
}

.overview-card.active {
  border-color: rgba(31, 79, 214, 0.38);
  box-shadow: 0 12px 28px rgba(31, 79, 214, 0.12);
}

.overview-card span {
  color: var(--muted);
  font-size: 13px;
}

.overview-card strong {
  font-size: 34px;
  line-height: 1;
}

.accent-card {
  background:
    linear-gradient(135deg, rgba(31, 79, 214, 0.12), rgba(31, 155, 94, 0.1)),
    #f9fbff;
}

.overview-note {
  margin: 14px 2px 0;
}

.overview-series-panel {
  margin-bottom: 20px;
}

.live-map-canvas {
  height: 520px;
  border-radius: 22px;
  overflow: hidden;
  margin-top: 18px;
  border: 1px solid var(--line);
  background: #dfe8f3;
}

.live-map-tooltip {
  display: grid;
  gap: 4px;
  min-width: 180px;
}

.live-map-tooltip strong {
  font-size: 14px;
}

.live-map-tooltip small {
  color: var(--muted);
}

.spot-map-tooltip {
  display: grid;
  gap: 4px;
  min-width: 210px;
}

.spot-map-tooltip strong {
  font-size: 14px;
}

.spot-map-tooltip small {
  color: var(--muted);
}

.spot-map-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.spot-map-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.spot-date-mode-card {
  display: grid;
  gap: 8px;
}

.spot-date-input-row {
  display: grid;
  gap: 6px;
}

.spot-filter-disabled {
  opacity: 0.46;
}

.spot-filter-disabled input,
.spot-filter-disabled select {
  background: #f3f4f6;
  cursor: not-allowed;
}

.spot-map-canvas {
  height: 560px;
  border-radius: 22px;
  overflow: hidden;
  margin-top: 18px;
  border: 1px solid var(--line);
  background: #f3f6f9;
}

.spot-map-canvas .leaflet-tile {
  filter: grayscale(0.92) saturate(0.45) brightness(1.08) contrast(0.84);
}

.member-spot-panel.collapsed .spot-map-actions button:not(#member-spot-toggle-btn) {
  display: none;
}

.member-spot-body {
  margin-top: 16px;
}

.member-spot-filter-grid {
  margin-top: 0;
}

.member-spot-map-canvas {
  height: 480px;
  max-height: 520px;
}

.member-analytics-controls {
  margin-top: 18px;
}

.member-analytics-summary {
  margin-top: 18px;
}

.member-analytics-table-shell {
  margin-top: 18px;
}

.member-analytics-pagination {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.member-analytics-pagination.hidden {
  display: none;
}

.member-analytics-table tbody tr {
  cursor: pointer;
}

.member-analytics-table tbody tr:hover td,
.member-analytics-table tbody tr.selected td {
  background: #eef4ff;
}

.member-analytics-spot-panel {
  min-height: 560px;
}

.series-range-group,
.series-metric-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.series-range-btn,
.series-metric-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  line-height: 1;
}

.series-range-btn.active,
.series-metric-btn.active {
  background: var(--pill);
  color: var(--primary);
  border-color: rgba(31, 79, 214, 0.18);
}

.series-metric-group {
  margin-top: 18px;
}

.series-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.series-summary-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  background: #f9fbff;
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
}

.series-summary-card span {
  color: var(--muted);
  font-size: 13px;
  display: block;
  width: 100%;
  text-align: center;
}

.series-summary-card strong {
  font-size: 26px;
  line-height: 1.05;
  display: block;
  width: 100%;
  text-align: center;
}

.series-chart-shell {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9ff 100%);
  padding: 18px;
}

.today-online-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  padding: 18px;
}
.today-online-panel.hidden {
  display: none;
}
.today-online-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.today-online-csv {
  padding: 6px 12px;
  border: 1px solid #1f4fd6;
  border-radius: 8px;
  background: #fff;
  color: #1f4fd6;
  font-weight: 600;
  cursor: pointer;
}
.today-online-csv:hover {
  background: #eef2fb;
}
.today-online-table-wrap {
  margin-top: 10px;
  overflow-x: auto;
}
.today-online-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.today-online-table th,
.today-online-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}
.today-online-table th {
  color: #64748b;
  font-weight: 700;
  font-size: 12px;
}
.today-online-table td:last-child {
  font-weight: 700;
}

.series-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.series-chart-head strong {
  display: block;
  font-size: 18px;
}

.series-chart-head p {
  margin: 4px 0 0;
}

.series-chart {
  min-height: 280px;
}

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

.series-chart-empty {
  min-height: 280px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.series-grid-line {
  stroke: #dce4f0;
  stroke-width: 1;
}

.series-axis-label {
  fill: #8490a8;
  font-size: 12px;
  font-family: "Segoe UI", "Noto Sans KR", sans-serif;
}

.series-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.series-point {
  fill: #ffffff;
  stroke: var(--primary);
  stroke-width: 3;
}

.section-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.section-stat-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 16px;
  background:
    radial-gradient(circle at top right, rgba(31, 79, 214, 0.06), transparent 40%),
    #f9fbff;
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

.section-stat-card span,
.section-stat-card small {
  color: var(--muted);
}

.section-stat-card strong {
  font-size: 28px;
  line-height: 1;
}

.section-stack {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.section-block-card {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfdff 0%, #f7faff 100%);
  padding: 18px;
}

.section-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-block-head h4 {
  margin: 0;
  font-size: 18px;
}

.section-block-head p {
  margin: 0;
}

.section-table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

.section-table {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
}

.section-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 14px 16px;
  text-align: left;
  white-space: nowrap;
  background: #f4f7fc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.section-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #e8edf5;
  vertical-align: top;
  font-size: 14px;
  white-space: nowrap;
}

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

.cell-primary {
  font-weight: 700;
  font-size: 14px;
}

.cell-secondary {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.section-empty {
  min-height: 200px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: #fbfdff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  margin-top: 18px;
}

.reason-chip {
  display: inline-flex;
  align-items: center;
  margin: 2px 6px 2px 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.reason-inline {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  min-height: 0;
}

.panel { padding: 20px; }
.panel-header,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-header h3,
.section-head h4 { margin: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--pill);
  color: var(--primary);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.table-copy {
  margin: 6px 0 0;
}

.table-shell {
  margin-top: 16px;
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fbfcff;
}

.members-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 860px;
}

.members-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f7fc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.members-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #e8edf5;
  font-size: 14px;
  vertical-align: middle;
}

.member-row {
  cursor: pointer;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.member-row:hover td {
  background: #f7faff;
}

.member-row.active td {
  background: #eef4ff;
}

.member-row:focus-visible {
  outline: 2px solid rgba(31, 79, 214, 0.4);
  outline-offset: -2px;
}

.member-primary {
  font-weight: 700;
  font-size: 15px;
}

.member-secondary {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.table-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #edf3ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pill {
  text-transform: capitalize;
}

.status-pill-active {
  background: #eef8f2;
  color: var(--success);
}

.status-pill-inactive {
  background: #fff1f1;
  color: var(--danger);
}

.table-empty {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.empty-state {
  min-height: 320px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.metric-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: #f9fbff;
  display: grid;
  gap: 8px;
}
.metric-card span {
  color: var(--muted);
  font-size: 13px;
}
.metric-card strong { font-size: 16px; }

.section-block {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin: 16px 0 0;
}
.kv-grid div {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: #f9fbff;
}
.kv-grid dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.kv-grid dd {
  margin: 0;
  font-weight: 600;
}

.plan-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}
.plan-row select {
  flex: 1;
}

.audit-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.audit-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f9fbff;
  padding: 12px 14px;
}
.audit-item strong {
  display: block;
  margin-bottom: 6px;
}
.audit-item time {
  color: var(--muted);
  font-size: 12px;
}

.campaigns-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.campaign-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.campaign-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.3fr);
  gap: 20px;
  margin-top: 18px;
}

.campaign-list-shell,
.campaign-editor-shell {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfdff 0%, #f7faff 100%);
  padding: 18px;
}

.campaign-list {
  display: grid;
  gap: 12px;
}

.campaign-card {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  text-align: left;
  display: grid;
  gap: 10px;
}

.campaign-card.active {
  border-color: rgba(31, 79, 214, 0.26);
  background: linear-gradient(135deg, rgba(31, 79, 214, 0.08), rgba(31, 79, 214, 0.03));
}

.campaign-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.campaign-card-head strong {
  font-size: 16px;
  line-height: 1.3;
}

.campaign-card-meta,
.campaign-card-copy,
.campaign-card-stats {
  color: var(--muted);
  font-size: 13px;
}

.campaign-card-copy {
  line-height: 1.45;
}

.campaign-card-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.campaign-form {
  display: grid;
  gap: 16px;
}

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

.campaign-form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  resize: vertical;
  min-height: 96px;
  font: inherit;
}

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

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f9fbff;
  padding: 12px 14px;
}

.checkbox-field input {
  width: auto;
  margin: 0;
}

.campaign-asset-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 16px;
  align-items: center;
}

.campaign-asset-row p {
  margin: 0 0 8px;
}

.campaign-asset-key {
  min-height: 48px;
  display: flex;
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 10px 12px;
  color: var(--muted);
  word-break: break-all;
}

.campaign-image-preview {
  min-height: 120px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  overflow: hidden;
}

.campaign-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.campaign-image-preview.empty {
  background: #fbfdff;
}

.campaign-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.free-trial-shell {
  display: grid;
  gap: 18px;
}

.settings-subpanel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
}

.settings-subpanel h4 {
  margin: 0;
  font-size: 15px;
}

.radar-metrics-accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.radar-metrics-accordion summary::-webkit-details-marker {
  display: none;
}

.radar-metrics-accordion summary::after {
  content: '펼치기';
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.radar-metrics-accordion[open] summary::after {
  content: '접기';
}

.radar-metrics-accordion[open] summary {
  margin-bottom: 4px;
}

.settings-subpanel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.settings-subpanel-title h4,
.settings-subpanel-title p {
  margin: 0;
}

.settings-subpanel-title p {
  margin-top: 4px;
}

.subpanel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.subpanel-header h4,
.subpanel-header p {
  margin: 0;
}

.subpanel-header p {
  margin-top: 4px;
}

.promotion-code-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.promotion-code-list,
.promotion-code-form {
  display: grid;
  gap: 12px;
}

.promotion-code-item {
  width: 100%;
  display: grid;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.promotion-code-item.active {
  border-color: rgba(31, 79, 214, 0.28);
  background: linear-gradient(135deg, rgba(31, 79, 214, 0.08), rgba(31, 79, 214, 0.03));
}

.promotion-code-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.promotion-code-item-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
}

.ultra-radar-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
}

.ultra-radar-plan-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 26px rgba(23, 35, 61, 0.05);
}

.ultra-radar-plan-card-free {
  border-color: rgba(31, 79, 214, 0.26);
  background: linear-gradient(180deg, #f8fbff 0%, rgba(255, 255, 255, 0.82) 100%);
}

.ultra-radar-plan-fields {
  grid-template-columns: 1fr;
  gap: 12px;
}

.free-trial-grid {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(180px, 220px);
  gap: 16px;
  align-items: start;
}

.free-trial-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.feedback-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.feedback-list-shell,
.feedback-detail-shell {
  min-width: 0;
}

.feedback-list-shell {
  overflow: hidden;
}

.feedback-table-shell {
  max-width: 100%;
  overflow-x: hidden;
}

.feedback-table {
  min-width: 0;
  table-layout: fixed;
}

.feedback-table th:nth-child(1),
.feedback-table td:nth-child(1) {
  width: 78px;
}

.feedback-table th:nth-child(2),
.feedback-table td:nth-child(2) {
  width: 118px;
}

.feedback-table th:nth-child(4),
.feedback-table td:nth-child(4) {
  width: 150px;
}

.feedback-table tbody td {
  white-space: normal;
}

.feedback-row {
  cursor: pointer;
}

.feedback-row.active {
  outline: 2px solid rgba(31, 79, 214, 0.28);
  outline-offset: -2px;
}

.feedback-row-read {
  background: rgba(226, 232, 240, 0.55);
  color: var(--muted);
}

.feedback-row-new {
  background: #fff;
}

.feedback-message-preview .cell-primary {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.feedback-message-preview .cell-secondary,
.feedback-scope-cell {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.feedback-detail-shell {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  padding: 16px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

/* 1:1 conversation thread (2026-07-20) */
.conversation-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 420px;
}
.conversation-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.conversation-head h4 {
  margin: 0 0 2px;
  overflow-wrap: anywhere;
}
.conversation-thread {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px;
  min-height: 260px;
}
.chat-row {
  display: flex;
}
.chat-row-user {
  justify-content: flex-start;
}
.chat-row-admin {
  justify-content: flex-end;
}
.chat-bubble {
  max-width: 78%;
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 13.5px;
  line-height: 1.4;
}
.chat-bubble-user {
  background: #f1f5f9;
  color: #0f172a;
  border-bottom-left-radius: 4px;
}
.chat-bubble-admin {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.chat-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-time {
  margin-top: 3px;
  font-size: 10.5px;
  opacity: 0.7;
}
.conversation-reply {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.conversation-reply textarea {
  flex: 1 1 auto;
  resize: vertical;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
}
.conversation-reply button {
  flex: 0 0 auto;
}

.feedback-detail-shell .kv-grid div {
  min-width: 0;
}

.feedback-detail-shell .kv-grid dd {
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.feedback-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  line-height: 1.5;
}

@media (max-width: 1100px) {
  .app-frame,
  .controls,
  .overview-grid,
  .section-stat-grid,
  .series-summary-grid,
  .campaign-summary-grid,
  .layout,
  .summary-grid,
  .kv-grid,
  .campaign-layout,
  .campaign-form-grid,
  .campaign-asset-row,
  .ultra-radar-plan-grid,
  .promotion-code-layout,
  .free-trial-grid,
  .feedback-layout {
    grid-template-columns: 1fr;
  }
  .controls label:first-child {
    grid-column: span 1;
  }
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
  .inline-field {
    min-width: 0;
  }
  .sidebar {
    margin-top: 0;
    padding: 24px 20px;
  }
}

/* ===== Mobile navigation (off-canvas drawer) ===== */
.mobile-nav-toggle { display: none; }
.sidebar-backdrop { display: none; }
.sidebar-drawer-header { display: none; }

@media (max-width: 1100px) {
  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    order: -1;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    align-self: flex-start;
  }
  .mobile-nav-toggle-icon { font-size: 18px; line-height: 1; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh; /* dynamic viewport so the bottom isn't hidden by mobile browser bars */
    width: 84%;
    max-width: 320px;
    margin: 0;
    border-radius: 0 18px 18px 0;
    z-index: 1400;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
    padding-bottom: 40px; /* so the last menu item is reachable */
  }
  .app-frame.nav-open .sidebar { transform: translateX(0); }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1350;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .app-frame.nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }
  .sidebar-drawer-title { font-weight: 800; font-size: 18px; }
  .sidebar-close {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    padding: 4px 8px;
  }
}

/* ===== AI Assistant chat widget (Phase 1: UI + mock) ===== */
.assistant-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 380px;
  min-width: 320px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1200;
  font-size: 14px;
}

/* Drag-to-resize grip at the top-left corner (widget is pinned bottom-right,
   so dragging this corner left/up enlarges width/height). */
.assistant-resize-grip {
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  z-index: 1300;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 40%, transparent 41%);
  border-top-left-radius: 16px;
}
.assistant-resize-grip::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 5px;
  width: 7px;
  height: 7px;
  border-top: 2px solid rgba(255, 255, 255, 0.85);
  border-left: 2px solid rgba(255, 255, 255, 0.85);
}
.assistant-widget[data-collapsed='true'] .assistant-resize-grip {
  display: none;
}
.assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: #1f4fd6;
  color: #fff;
  cursor: pointer;
  user-select: none;
}
.assistant-title {
  font-weight: 700;
  letter-spacing: 0.01em;
}
.assistant-toggle {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.assistant-toggle:hover {
  background: rgba(255, 255, 255, 0.32);
}
.assistant-body {
  display: flex;
  flex-direction: column;
  height: 900px;
  max-height: calc(100vh - 120px);
}
.assistant-widget[data-collapsed='true'] .assistant-body {
  display: none;
}
.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7f8fb;
}
.assistant-msg {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.assistant-msg-user {
  align-self: flex-end;
  background: #1f4fd6;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.assistant-msg-bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.assistant-msg-loading {
  color: var(--muted);
  font-style: italic;
}
.assistant-table-wrap {
  margin-top: 8px;
  overflow-x: auto;
}
.assistant-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
.assistant-table th,
.assistant-table td {
  border: 1px solid var(--line);
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
}
.assistant-table th {
  background: #eef2fb;
}
.assistant-download-btn {
  margin-top: 8px;
  padding: 6px 12px;
  border: 1px solid #1f4fd6;
  border-radius: 8px;
  background: #fff;
  color: #1f4fd6;
  font-weight: 600;
  cursor: pointer;
}
.assistant-download-btn:hover {
  background: #eef2fb;
}
.assistant-md {
  line-height: 1.55;
}
.assistant-md-h {
  font-weight: 700;
  font-size: 14px;
  margin: 10px 0 4px;
}
.assistant-md-h:first-child {
  margin-top: 0;
}
.assistant-md-p {
  margin: 4px 0;
}
.assistant-md-list {
  margin: 4px 0;
  padding-left: 20px;
}
.assistant-md-list li {
  margin: 2px 0;
}
.assistant-md code,
.assistant-gathered code {
  background: #f1f5f9;
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 12px;
}
.assistant-gathered {
  margin-top: 10px;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}
.assistant-gathered summary {
  cursor: pointer;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}
.assistant-gathered-item {
  margin-top: 10px;
}
.assistant-gathered-label {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}
.assistant-gathered-error {
  font-size: 12px;
  color: #b91c1c;
}
.assistant-inputbar {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.assistant-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  max-height: 180px;
  min-height: 72px;
}
.assistant-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.assistant-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.assistant-btn-ask {
  background: #1f4fd6;
  color: #fff;
}
.assistant-btn-ask:hover {
  background: #1a44ba;
}
.assistant-btn-reason {
  background: #eef2fb;
  color: #1f4fd6;
  border: 1px solid #1f4fd6;
}
.assistant-btn-reason:hover {
  background: #e2e9fb;
}
.assistant-btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.assistant-note {
  margin: 0;
  padding: 6px 12px 10px;
  font-size: 11px;
  color: var(--muted);
  background: #fff;
}
@media (max-width: 520px) {
  .assistant-widget {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

/* ===== Notifications (bell) + Summary (2026-07-11) ===== */
.notif-wrap { position: relative; display: inline-flex; }
.notif-bell {
  position: relative; background: transparent; border: 1px solid var(--border, #d1d5db);
  border-radius: 10px; padding: 6px 10px; cursor: pointer; font-size: 16px; line-height: 1;
}
.notif-bell:hover { background: rgba(0,0,0,0.04); }
.notif-badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; background: #ef4444; color: #fff;
  font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0; width: 360px; max-height: 480px;
  overflow-y: auto; background: #fff; border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,0.16); z-index: 60;
}
.notif-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid #f0f0f0; font-weight: 800;
}
.notif-panel-head button { font-size: 12px; background: none; border: none; color: #2563eb; cursor: pointer; }
.notif-list { padding: 4px 0; }
.notif-item { padding: 10px 14px; border-bottom: 1px solid #f5f5f5; cursor: default; }
.notif-item.unread { background: #eff6ff; }
.notif-item-title { font-weight: 700; font-size: 13px; color: #111827; }
.notif-item-body { font-size: 12px; color: #6b7280; margin-top: 2px; }
.notif-item-time { font-size: 11px; color: #9ca3af; margin-top: 3px; }
.notif-empty { padding: 24px 14px; text-align: center; color: #9ca3af; font-size: 13px; }

.summary-toggle { display: inline-flex; gap: 6px; }
.summary-period-btn {
  padding: 7px 16px; border-radius: 999px; border: 1px solid var(--border, #d1d5db);
  background: #fff; cursor: pointer; font-weight: 700; font-size: 13px;
}
.summary-period-btn.active { background: #111827; color: #fff; border-color: #111827; }
.summary-content { margin-top: 16px; }
.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.summary-card { border: 1px solid #eef0f3; border-radius: 14px; padding: 14px 16px; background: #fff; }
.summary-card-label { font-size: 12px; color: #6b7280; font-weight: 700; }
.summary-card-value { font-size: 26px; font-weight: 900; color: #111827; margin-top: 4px; }
.summary-card-delta { font-size: 12px; font-weight: 700; margin-top: 4px; }
.summary-card-delta.up { color: #059669; }
.summary-card-delta.down { color: #dc2626; }
.summary-card-delta.flat { color: #9ca3af; }
.summary-section-title { font-weight: 800; margin: 20px 0 8px; font-size: 14px; }
.summary-country-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.summary-country-table th, .summary-country-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid #f0f0f0; }
.summary-country-table th { color: #6b7280; font-weight: 700; }
.summary-period-label { color: #6b7280; font-size: 13px; margin: 4px 0 12px; }
