/* ─────────────────────────────────────────────────────────
   INSIGHT PAGE — shadcn + Liquid Glass style
   White base · clean typography · smooth cards
───────────────────────────────────────────────────────── */

#page-insight {
  min-height: calc(100vh - 52px);
  background: var(--bg, #fafafa);
}

/* ── Page container ── */
.ins-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 72px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ═══════════════════════════════════════════════════
   KPI ROW
═══════════════════════════════════════════════════ */
.ins-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.ins-kpi {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e4e4e7);
  border-radius: 12px;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow .2s, border-color .2s;
}
.ins-kpi:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
  border-color: rgba(0,0,0,.12);
}

.ins-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ins-kpi-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted-fg, #71717a);
  letter-spacing: -0.01em;
}
.ins-kpi-ico {
  color: var(--muted-fg, #a1a1aa);
}
.ins-kpi-val {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.05em;
  color: var(--fg, #18181b);
  line-height: 1;
}

/* ═══════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════ */
.ins-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e4e4e7);
  border-radius: 12px;
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  transition: box-shadow .2s;
}
.ins-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.05);
}

.ins-card-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.ins-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--fg, #18181b);
  letter-spacing: -0.02em;
}
.ins-card-sub {
  font-size: 12px;
  color: var(--muted-fg, #71717a);
  margin-top: 2px;
}

/* ── Flex row layout ── */
.ins-flex-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
}
.ins-card-grow  { flex: 1.65; min-width: 0; }
.ins-card-fixed { flex: 1; min-width: 220px; }
.ins-card-half  { flex: 1; min-width: 0; }

/* ── Canvas wrap ── */
.ins-canvas-wrap {
  position: relative;
  width: 100%;
}
.ins-canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ═══════════════════════════════════════════════════
   DONUT
═══════════════════════════════════════════════════ */
.ins-donut-body {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}
.ins-donut-ring-wrap {
  position: relative;
  flex-shrink: 0;
  width: 120px;
  height: 120px;
}
.ins-donut-ring-wrap canvas {
  display: block;
}
.ins-donut-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.ins-donut-big {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--fg, #18181b);
  line-height: 1;
}
.ins-donut-small {
  font-size: 10px;
  color: var(--muted-fg, #71717a);
  margin-top: 2px;
  font-weight: 500;
}

.ins-donut-rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ins-donut-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ins-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  flex-shrink: 0;
}
.ins-dot-dark { background: #18181b; }
.ins-dot-mid  { background: #a1a1aa; }
.ins-dot-name {
  flex: 1;
  font-size: 12px;
  color: var(--muted-fg, #71717a);
}
.ins-dot-n {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg, #18181b);
  font-variant-numeric: tabular-nums;
}
.ins-dot-pct {
  font-size: 11px;
  color: var(--muted-fg, #a1a1aa);
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  text-align: right;
}

/* ═══════════════════════════════════════════════════
   RANK LIST
═══════════════════════════════════════════════════ */
.ins-rank-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ins-rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ins-rank-i {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted-fg, #a1a1aa);
  width: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.ins-rank-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.ins-rank-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg, #18181b);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
}
.ins-rank-track {
  height: 4px;
  background: var(--muted, #f4f4f5);
  border-radius: 999px;
  overflow: hidden;
}
.ins-rank-fill {
  height: 100%;
  background: #18181b;
  border-radius: 999px;
  width: 0%;
}
.ins-rank-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-fg, #52525b);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 28px;
  text-align: right;
}

/* ═══════════════════════════════════════════════════
   VISIBILITY TILES
═══════════════════════════════════════════════════ */
.ins-vis-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.ins-vis-tile {
  background: var(--muted, #f4f4f5);
  border-radius: 10px;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.ins-vis-n {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--fg, #18181b);
  line-height: 1;
}
.ins-vis-bar-mini {
  width: 100%;
  height: 3px;
  background: rgba(0,0,0,.08);
  border-radius: 999px;
  overflow: hidden;
}
.ins-vis-bar-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
}
.ins-vis-lbl {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted-fg, #71717a);
}

/* Segmented bar below tiles */
.ins-seg-bar {
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  gap: 2px;
  background: var(--muted, #f4f4f5);
}
.ins-seg {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  min-width: 0;
}

/* ═══════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════ */
.ins-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
  text-align: center;
  padding: 48px 24px;
  gap: 10px;
}
.ins-empty-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--muted, #f4f4f5);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted-fg, #a1a1aa);
  margin-bottom: 4px;
}
.ins-empty-title {
  font-size: 16px; font-weight: 600;
  color: var(--fg, #18181b);
  letter-spacing: -0.02em;
}
.ins-empty-sub {
  font-size: 13px;
  color: var(--muted-fg, #71717a);
  max-width: 280px;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .ins-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .ins-card-grow, .ins-card-fixed { flex: 1; }
}

@media (max-width: 700px) {
  .ins-page { padding: 20px 16px 80px; }
  .ins-kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .ins-flex-row { flex-direction: column; }
  .ins-card-fixed { min-width: unset; }
  .ins-donut-body { justify-content: center; }
  .ins-kpi-val { font-size: 24px; }
}
