.analytics-workspace { max-width: 1720px; }
.page-description { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.analytics-tabs { display: flex; gap: 7px; margin: 22px 0 4px; padding: 5px; width: fit-content; border: 1px solid var(--line); border-radius: 12px; background: #0d1115; }
.analytics-tab { padding: 10px 14px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 800; cursor: pointer; }
.analytics-tab:hover { color: var(--text); }
.analytics-tab.active { color: #0b0f12; background: var(--lime); }
.analytics-view[hidden] { display: none; }
.analytics-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin: 28px 0 18px; }
.quality-good { color: var(--lime); }
.quality-warning { color: var(--red); }

.insight-toolbar-panel { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-top: 18px; padding: 20px 24px; }
.insight-toolbar-copy { display: flex; align-items: flex-start; gap: 12px; }
.insight-toolbar-copy h2,
.insight-toolbar-copy p { margin: 0; }
.insight-toolbar-copy p { margin-top: 6px; color: var(--muted); font-size: 10px; }
.insight-controls { display: flex; gap: 10px; }
.insight-controls .field { min-width: 150px; margin: 0; }
.insight-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.insight-kpi { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.insight-kpi.accent { border-color: rgba(201, 255, 66, 0.35); background: linear-gradient(145deg, rgba(201, 255, 66, 0.08), var(--panel) 62%); }
.insight-kpi span,
.insight-kpi strong,
.insight-kpi small { display: block; }
.insight-kpi span { color: var(--muted); font-size: 9px; }
.insight-kpi strong { margin-top: 10px; color: #f0f5f7; font-size: 23px; letter-spacing: -0.5px; }
.insight-kpi.accent strong { color: var(--lime); }
.insight-kpi small { margin-top: 7px; overflow: hidden; color: #6e7a84; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.insight-empty { margin-top: 14px; padding: 30px; text-align: center; }
.insight-empty strong { color: var(--lime); font-size: 16px; }
.insight-empty p { margin: 10px 0 0; color: var(--muted); font-size: 11px; }

/* 실시간 줄. 탭 위에 항상 떠 있으므로 패널보다 낮은 높이로 두어 본문을
   밀어내지 않게 한다. */
.live-strip { display: flex; align-items: center; gap: 22px; margin-top: 14px; padding: 13px 18px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(145deg, rgba(201, 255, 66, 0.06), var(--panel) 60%); }
.live-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: #3d4650; }
.live-strip.online .live-dot { background: var(--lime); box-shadow: 0 0 0 0 rgba(201, 255, 66, 0.6); animation: livePulse 2.2s ease-out infinite; }
.live-strip.stale .live-dot { background: #d9a441; }
.live-strip.offline .live-dot { background: #d95f4a; }
@keyframes livePulse {
  70% { box-shadow: 0 0 0 7px rgba(201, 255, 66, 0); }
  100% { box-shadow: 0 0 0 0 rgba(201, 255, 66, 0); }
}
.live-metric { display: flex; align-items: baseline; gap: 8px; }
.live-metric span { color: var(--muted); font-size: 9px; }
.live-metric strong { color: #f0f5f7; font-size: 17px; letter-spacing: -0.4px; }
.live-metric.primary strong { color: var(--lime); font-size: 25px; }
.live-meta { display: flex; flex-direction: column; gap: 3px; margin-left: auto; text-align: right; }
.live-meta span { color: #6e7a84; font-size: 8px; }
.live-instance { opacity: 0.75; }
.chart-panel.wide { grid-column: 1 / -1; }
.insight-chart-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 0.8fr); gap: 14px; margin-top: 14px; }
.insight-chart-layout > .panel { min-width: 0; margin: 0; padding: 22px; }
.insight-trend-panel,
.insight-retention-panel { grid-column: span 1; }
.chart { width: 100%; min-height: 330px; }
.chart-funnel { min-height: 390px; }
.chart-retention { min-height: 360px; }
/* 수익·광고 패널. 세 표를 나란히 두되 좁아지면 한 줄씩 쌓인다. */
.insight-monetization-panel { grid-column: 1 / -1; }
.monetization-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 4px; }
.monetization-block { min-width: 0; }
.monetization-block h3 { margin: 0 0 8px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.mini-table th { padding: 7px 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 600; text-align: left; white-space: nowrap; }
.mini-table td { padding: 7px 8px; border-bottom: 1px solid #171d23; color: #e6edf2; }
.mini-table tbody tr:last-child td { border-bottom: none; }
.mini-table code { color: #ffb4b0; font-size: 9px; }
/* 실패·유실이 있는 줄만 붉게. 전부 칠하면 무엇이 문제인지 안 읽힌다. */
.mini-table tr.mini-warn td:last-child { color: #ff655d; font-weight: 600; }
.mini-empty { color: var(--muted); text-align: center; padding: 18px 8px; }

.diagnosis-panel { border-color: rgba(201, 255, 66, 0.22); background: linear-gradient(160deg, rgba(201, 255, 66, 0.06), var(--panel) 42%); }
.diagnosis-body { display: grid; gap: 10px; }
.diagnosis-card { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #0d1115; }
.diagnosis-card.warning { border-color: rgba(255, 101, 93, 0.35); }
.diagnosis-card strong,
.diagnosis-card span { display: block; }
.diagnosis-card strong { color: #e6edf2; font-size: 11px; line-height: 1.5; }
.diagnosis-card.warning strong { color: #ffd1ce; }
.diagnosis-card span { margin-top: 7px; color: var(--muted); font-size: 9px; line-height: 1.55; }
.retention-toggle { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #0d1115; }
.retention-toggle button { padding: 7px 9px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 8px; font-weight: 800; cursor: pointer; }
.retention-toggle button.active { color: #0b0f12; background: var(--lime); }

.analytics-filter-panel,
.analytics-delivery-panel,
.analytics-coverage-panel,
.analytics-events-panel,
.analytics-internal-panel { margin-top: 18px; padding: 24px; }
.analytics-filters { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); align-items: end; gap: 12px; }
.analytics-filters .field { margin: 0; }
.analytics-search-field { grid-column: span 2; }
.analytics-filter-actions { display: flex; justify-content: flex-end; gap: 8px; grid-column: span 2; }
.panel-note { margin: 0; color: var(--muted); font-size: 10px; }
.panel-copy { margin: -7px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }

.delivery-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.delivery-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #0e1216; }
.delivery-card span,
.delivery-card strong,
.delivery-card small { display: block; }
.delivery-card span { color: var(--muted); font-size: 9px; }
.delivery-card strong { margin-top: 10px; color: #e6edf2; font-size: 17px; }
.delivery-card small { margin-top: 7px; overflow: hidden; color: #6f7c87; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.delivery-card .status-ok { color: var(--lime); }
.delivery-card .status-issue { color: var(--red); }

.coverage-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 10px; }
.coverage-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: #0e1216; text-align: left; cursor: pointer; transition: transform 120ms, border-color 120ms, background 120ms; }
.coverage-card:hover { transform: translateY(-1px); border-color: #3b464f; }
.coverage-card.observed { border-color: rgba(201, 255, 66, 0.25); background: linear-gradient(145deg, rgba(201, 255, 66, 0.07), #0e1216 55%); }
.coverage-card.missing { opacity: 0.62; }
.coverage-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.coverage-card-header strong { color: var(--lime); font-size: 19px; }
.coverage-card code,
.coverage-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coverage-card code { margin-top: 13px; color: #dce4e9; font-size: 11px; }
.coverage-card small { margin-top: 5px; color: var(--muted); font-size: 9px; }

.source-tag { display: inline-flex; width: fit-content; padding: 4px 6px; border-radius: 5px; color: #b8c8d8; background: rgba(101, 169, 255, 0.11); font-size: 8px; font-weight: 850; letter-spacing: 0.7px; }
.source-tag.server { color: #e1f7a8; background: rgba(201, 255, 66, 0.1); }
.analytics-table-wrap { max-height: 760px; border: 1px solid #20272e; border-radius: 12px; }
.analytics-table { min-width: 1160px; }
.analytics-table thead { position: sticky; top: 0; z-index: 1; background: var(--panel); }
.analytics-table td { vertical-align: top; }
.analytics-table td > small,
.analytics-table td > code { display: block; }
.analytics-table td > small { margin-top: 6px; color: var(--muted); font-size: 9px; }
.event-name { color: var(--lime); font-size: 10px; white-space: nowrap; }
.stacked-value { display: block; max-width: 210px; }
.stacked-value + .stacked-value { margin-top: 8px; }
.stacked-value small,
.stacked-value code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stacked-value small { color: #66727d; font-size: 7px; letter-spacing: 0.8px; }
.stacked-value code { margin-top: 2px; color: #aeb9c2; font-size: 9px; }
.quality-badge { display: inline-flex; padding: 5px 7px; border-radius: 6px; font-size: 9px; white-space: nowrap; }
.quality-badge.valid { color: var(--lime); background: rgba(201, 255, 66, 0.09); }
.quality-badge.issue { color: #ffd1ce; background: rgba(255, 101, 93, 0.12); }
.properties-details { position: relative; }
.properties-details summary { color: var(--blue); font-size: 10px; cursor: pointer; }
.properties-details pre { width: min(480px, 60vw); max-height: 300px; margin: 8px 0 0; padding: 12px; overflow: auto; border: 1px solid #313a43; border-radius: 9px; color: #cad5dd; background: #090c0f; font-size: 9px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; color: var(--muted); font-size: 11px; }

.internal-profile-form { display: grid; grid-template-columns: minmax(260px, 1.2fr) minmax(300px, 1.5fr) auto; align-items: end; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: #0e1216; }
.internal-profile-form .field { margin: 0; }
.check-field { display: flex; align-items: center; gap: 8px; min-height: 42px; color: #aeb9c2; font-size: 10px; cursor: pointer; }
.check-field input { width: 16px; height: 16px; accent-color: var(--lime); }
.internal-confirmation { grid-column: span 2; }
.internal-profile-actions { display: flex; justify-content: flex-end; gap: 8px; }
.internal-table-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
.subheading { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; }
.subheading h3 { margin: 0; font-size: 12px; }
.subheading span { color: var(--muted); font-size: 9px; }
.compact-table-wrap { max-height: 390px; border: 1px solid #20272e; border-radius: 12px; }
.internal-table { min-width: 680px; }
.internal-table thead { position: sticky; top: 0; z-index: 1; background: var(--panel); }
.internal-table td { vertical-align: top; }
.internal-table code,
.internal-table small { display: block; }
.internal-table code { color: #c9d3da; font-size: 9px; }
.internal-table small { margin-top: 5px; color: var(--muted); font-size: 8px; }
.scope-badge { display: inline-flex; margin: 0 5px 5px 0; padding: 4px 6px; border-radius: 5px; color: #e1f7a8; background: rgba(201, 255, 66, 0.1); font-size: 8px; font-weight: 800; }
.action-badge { display: inline-flex; padding: 4px 6px; border-radius: 5px; color: #b8c8d8; background: rgba(101, 169, 255, 0.11); font-size: 8px; font-weight: 800; }
.action-badge.unmarked { color: #ffd1ce; background: rgba(255, 101, 93, 0.12); }

@media (max-width: 1280px) {
  .insight-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .insight-chart-layout { grid-template-columns: 1fr; }
  .monetization-grid { grid-template-columns: 1fr; }
  .insight-trend-panel, .insight-retention-panel { grid-column: auto; }
  .analytics-filters { grid-template-columns: repeat(4, minmax(140px, 1fr)); }
  .coverage-grid { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
  .delivery-grid { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
  .internal-profile-form { grid-template-columns: 1fr 1fr; }
  .internal-profile-actions { grid-column: span 2; }
}

@media (max-width: 980px) {
  .insight-toolbar-panel { align-items: stretch; flex-direction: column; }
  .live-strip { flex-wrap: wrap; gap: 14px; }
  .live-meta { width: 100%; margin-left: 0; text-align: left; }
  .analytics-stats { grid-template-columns: repeat(2, 1fr); }
  .analytics-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-search-field, .analytics-filter-actions { grid-column: span 1; }
  .coverage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .delivery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .internal-table-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .topbar { align-items: stretch; flex-direction: column; }
  .topbar-actions { align-items: flex-end; justify-content: space-between; }
  .analytics-tabs { width: 100%; overflow-x: auto; }
  .analytics-tab { flex: 1 0 max-content; }
  .insight-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .insight-controls .field { min-width: 0; }
  .insight-kpis, .analytics-stats, .analytics-filters, .coverage-grid, .delivery-grid, .internal-profile-form { grid-template-columns: 1fr; }
  .analytics-filter-actions { grid-column: auto; }
  .internal-confirmation, .internal-profile-actions { grid-column: auto; }
  .analytics-filter-actions .button { flex: 1; }
  .internal-profile-actions { justify-content: stretch; }
  .internal-profile-actions .button { flex: 1; }
  .analytics-filter-panel, .analytics-delivery-panel, .analytics-coverage-panel, .analytics-events-panel, .analytics-internal-panel { padding: 18px; }
}
