.ap {
  --ap-cyan: #22d3ee;
  --ap-violet: #a78bfa;
  --ap-lime: #a3e635;
  --ap-pink: #f472b6;
  display: grid;
  gap: 18px;
  padding-bottom: 40px;
}

.ap [data-nerd] {
  min-width: 0;
}

.ap-hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
  padding: clamp(22px, 3vw, 38px);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 22px;
  background:
    radial-gradient(circle at 82% 8%, color-mix(in srgb, var(--info) 20%, transparent), transparent 40%),
    radial-gradient(circle at 5% 100%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 45%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface) 58%, color-mix(in srgb, var(--info) 10%, var(--surface)));
  overflow: hidden;
  box-shadow: var(--shadow);
}

.ap-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--line) 36%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--line) 36%, transparent) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(120deg, transparent 10%, rgba(0, 0, 0, 0.55) 60%, transparent 100%);
  pointer-events: none;
  opacity: 0.5;
}

.ap-hero__glow {
  position: absolute;
  width: 380px;
  height: 380px;
  right: -80px;
  top: -140px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 45%, transparent), transparent 68%);
  filter: blur(12px);
  pointer-events: none;
}

.ap-hero__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ap-hero__copy,
.ap-hero__score {
  position: relative;
  z-index: 1;
}

.ap-hero__copy {
  max-width: 780px;
}

.ap-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.ap-hero h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  font-weight: 900;
}

.ap-hero h1 span {
  background: linear-gradient(100deg, var(--accent), var(--info) 55%, var(--ap-violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ap-hero__sub {
  max-width: 66ch;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.ap-hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.ap-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ap-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.ap-badge--ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, var(--line)); }
.ap-badge--warn { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); }
.ap-badge--bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

.ap-hero__score {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 250px;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 18px;
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  backdrop-filter: blur(8px);
}

.ap-hero__score-label {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ap-hero__score strong {
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.ap-hero__score .ap-spark {
  width: 100%;
  height: 46px;
  margin-top: 10px;
}

.ap-hero__score-note {
  color: var(--muted-2);
  font-size: 11px;
  text-align: right;
}

.ap-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.ap-delta--up { color: var(--success); }
.ap-delta--down { color: var(--danger); }
.ap-delta--flat { color: var(--muted); }

.ap-toolbar {
  display: grid;
  gap: 12px;
}

.ap-page-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
}

.ap-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 6px 12px 6px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ap-chip:hover { color: var(--text); border-color: var(--line-strong); transform: translateY(-1px); }
.ap-chip.is-active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent) inset;
}
.ap-chip small { color: var(--muted-2); font-size: 11px; }
.ap-chip__mark,
.ap-chip__avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.02em;
  overflow: hidden;
}
.ap-chip__avatar img { width: 100%; height: 100%; object-fit: cover; }

.ap-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.ap-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.ap-toolbar__actions form { margin: 0; }

.ap-segment {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.ap-segment a,
.ap-segment button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 5px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.ap-segment a:hover,
.ap-segment button:hover { color: var(--text); background: var(--surface-2); }
.ap-segment .is-active { color: var(--accent-ink); background: var(--accent); }
.ap-segment--mode .is-active { color: var(--bg); }

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

.ap-kpi {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 16px 16px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface));
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.ap-kpi::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--info), transparent);
  opacity: 0.7;
}

.ap-kpi:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
}

.ap-kpi__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ap-kpi__label { color: var(--muted-2); font-size: 11px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.ap-kpi__value { font-size: clamp(28px, 3vw, 38px); line-height: 1; letter-spacing: -0.035em; }
.ap-kpi__foot { display: flex; align-items: center; gap: 8px; color: var(--muted-2); font-size: 11px; }
.ap-kpi__pct { color: var(--muted); font-weight: 800; }
.ap-kpi .ap-spark { width: 100%; height: 36px; margin-top: 4px; }

.ap-spark { display: block; overflow: visible; }
.ap-spark__line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ap-spark__area { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.ap-spark--hero .ap-spark__line { stroke: var(--info); stroke-width: 3; }
.ap-spark--hero .ap-spark__area { fill: color-mix(in srgb, var(--info) 20%, transparent); }
.ap-spark--page { height: 48px; margin: 10px 0; }

.ap-grid { display: grid; gap: 14px; }
.ap-grid--hero { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.92fr); }
.ap-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.ap-card {
  position: relative;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}

.ap-card--wide { min-width: 0; }

.ap-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.ap-card__head h2,
.ap-section__head h2,
.ap-weekly h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.ap-card__note { color: var(--muted-2); font-size: 11px; text-align: right; white-space: nowrap; }

.ap-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.ap-chart--mini { margin: 6px 0 0; }

.ap-chart__grid line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 7; opacity: 0.65; }
.ap-chart__axis { fill: var(--muted-2); font-family: var(--font-ui); font-size: 11px; font-weight: 600; }
.ap-chart__baseline { stroke: var(--line-strong); stroke-width: 1.2; stroke-dasharray: 5 5; opacity: 0.8; }
.ap-chart__line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ap-chart__area { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.ap-chart__dot {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2;
  opacity: 0;
  transition: opacity 0.15s ease, r 0.15s ease;
  cursor: crosshair;
}
.ap-chart:hover .ap-chart__dot,
.ap-chart__dot:hover { opacity: 1; }
.ap-chart__dot:hover { r: 8; }
.ap-chart__bar { opacity: 0.9; transition: opacity 0.15s ease; }
.ap-chart__bar:hover { opacity: 1; }

.ap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.ap-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ap-legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.ap-weekly {
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--info) 25%, var(--line));
  border-radius: 16px;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--info) 10%, var(--surface)), var(--surface) 60%),
    var(--surface);
}

.ap-weekly__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.ap-weekly__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.ap-weekly__item {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  background: var(--surface);
}

.ap-weekly__item span { color: var(--muted-2); font-size: 10px; font-weight: 900; letter-spacing: 0.09em; text-transform: uppercase; }
.ap-weekly__item strong { font-size: 22px; letter-spacing: -0.03em; }
.ap-weekly__item small { color: var(--muted-2); font-size: 11px; }

.ap-section { display: grid; gap: 14px; }

.ap-section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 2px 0;
}

.ap-section__sub { margin: 6px 0 0; max-width: 78ch; color: var(--muted); font-size: 13px; line-height: 1.6; }

.ap-group-title {
  margin: 8px 0 -4px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ap-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.ap-page-card {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.ap-page-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
}

.ap-page-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset, 0 16px 38px color-mix(in srgb, var(--accent) 16%, transparent);
}

.ap-page-card__head { display: flex; align-items: center; gap: 10px; }
.ap-page-card__avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--info));
  color: var(--bg);
  font-size: 18px;
  font-weight: 900;
  overflow: hidden;
  flex: 0 0 auto;
}
.ap-page-card__avatar img { width: 100%; height: 100%; object-fit: cover; }
.ap-page-card__title { display: grid; min-width: 0; gap: 2px; }
.ap-page-card__title strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-page-card__title small { color: var(--muted-2); font-size: 11px; }

.ap-page-card__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 35%, var(--surface));
}
.ap-page-card__stats div { display: grid; gap: 1px; min-width: 0; }
.ap-page-card__stats span { color: var(--muted-2); font-size: 9px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.ap-page-card__stats strong { font-size: 17px; letter-spacing: -0.02em; }
.ap-page-card__stats small { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ap-page-card__meters { display: grid; gap: 6px; }
.ap-page-card__meters > div { display: grid; grid-template-columns: 78px 1fr; align-items: center; gap: 8px; }
.ap-page-card__meters span { color: var(--muted-2); font-size: 10px; font-weight: 700; }
.ap-page-card__meters i { display: block; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ap-page-card__meters b { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--info)); }

.ap-page-card__post {
  display: grid;
  gap: 3px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.ap-page-card__post span { color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; }
.ap-page-card__post p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ap-page-card__post small { color: var(--muted-2); font-size: 10px; }

.ap-posts { display: grid; gap: 10px; }
.ap-post {
  display: flex;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 22%, var(--surface));
}
.ap-post__thumb {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}
.ap-post__thumb img { width: 100%; height: 100%; object-fit: cover; }
.ap-post__thumb-fallback { font-size: 30px; font-weight: 900; color: var(--accent); }
.ap-post__body { min-width: 0; display: grid; gap: 3px; align-content: start; }
.ap-post__meta { margin: 0; color: var(--muted-2); font-size: 10px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; }
.ap-post__caption { margin: 0; font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ap-post__stats { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted-2); font-size: 10px; }
.ap-post__stats strong { color: var(--text); }
.ap-post__links { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; }
.ap-post__links a { color: var(--accent); font-weight: 700; text-decoration: none; }
.ap-post__links a:hover { text-decoration: underline; }

.ap-glance { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ap-glance > div { display: grid; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--bg) 22%, var(--surface)); }
.ap-glance span { color: var(--muted-2); font-size: 10px; font-weight: 900; letter-spacing: 0.09em; text-transform: uppercase; }
.ap-glance strong { font-size: 19px; letter-spacing: -0.02em; }
.ap-glance small { color: var(--muted-2); font-size: 11px; }
.ap-glance__post { margin-top: 12px; }

.ap-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}

.ap-metric-card {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.ap-metric-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ap-metric-card__group { margin: 0; color: var(--accent); font-size: 9px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; }
.ap-metric-card h3 { margin: 2px 0 0; font-size: 15px; }
.ap-metric-card__value { margin: 2px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.ap-metric-card__desc { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.ap-metric-card__stats { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted-2); font-size: 10px; }
.ap-metric-card__stats strong { color: var(--text); }

.ap-scroll { overflow: auto; max-height: 560px; border: 1px solid var(--line); border-radius: 10px; }
.ap-scroll--small { max-height: 260px; }
.ap-disclosure { margin-top: 4px; }
.ap-disclosure summary { cursor: pointer; color: var(--muted); font-size: 11px; font-weight: 700; }
.ap-disclosure summary:hover { color: var(--accent); }
.ap-json {
  margin: 8px 0 0;
  padding: 10px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.ap-table { font-size: 12px; }
.ap-table th, .ap-table td { padding: 8px 10px; }
.ap-table--matrix th, .ap-table--matrix td { white-space: nowrap; }
.ap-nowrap { white-space: nowrap; }

.ap-post-cell__inner { display: flex; gap: 10px; min-width: 260px; max-width: 430px; }
.ap-post-cell__inner img { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; }
.ap-post-cell__inner > div { display: grid; gap: 2px; min-width: 0; }
.ap-post-cell__inner strong { font-size: 12px; font-weight: 700; }
.ap-post-cell__inner small { color: var(--muted-2); font-size: 10px; }
.ap-post-cell__inner a { color: var(--accent); font-size: 10px; font-weight: 700; text-decoration: none; }
.ap-post-cell__inner .ap-disclosure { margin-top: 2px; }

.ap-heat {
  display: grid;
  grid-template-columns: 38px repeat(24, minmax(11px, 1fr));
  gap: 3px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.ap-heat__corner { min-height: 12px; }
.ap-heat__hour, .ap-heat__day { color: var(--muted-2); font-size: 9px; font-weight: 700; text-align: center; }
.ap-heat__day { display: flex; align-items: center; text-align: left; }
.ap-heat__cell {
  aspect-ratio: 1;
  min-height: 13px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--line) 55%, transparent);
  cursor: crosshair;
  transition: transform 0.12s ease, outline-color 0.12s ease;
}
.ap-heat__cell:hover { transform: scale(1.18); outline: 1px solid var(--accent); }
.ap-heat__cell--0 { background: color-mix(in srgb, var(--line) 45%, transparent); }
.ap-heat__cell--1 { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.ap-heat__cell--2 { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.ap-heat__cell--3 { background: color-mix(in srgb, var(--accent) 65%, transparent); }
.ap-heat__cell--4 { background: var(--accent); }
.ap-heat__legend { display: flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--muted-2); font-size: 10px; }
.ap-heat__legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }

.ap-donut { display: flex; align-items: center; gap: 16px; }
.ap-donut svg { width: 210px; height: 210px; flex: 0 0 auto; }
.ap-donut__seg { cursor: crosshair; transition: opacity 0.15s ease; }
.ap-donut__seg:hover { opacity: 0.7; }
.ap-donut__total { fill: var(--text); font-size: 26px; font-weight: 900; }
.ap-donut__label { fill: var(--muted-2); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.ap-donut__legend { display: grid; gap: 8px; min-width: 0; }
.ap-donut__legend > div { display: grid; grid-template-columns: 10px 1fr auto auto; align-items: center; gap: 8px; font-size: 12px; }
.ap-donut__legend strong { font-size: 12px; }
.ap-donut__dot { width: 9px; height: 9px; border-radius: 50%; }

.ap-profile { display: grid; gap: 14px; }
.ap-profile__cover {
  height: 150px;
  margin: -18px -18px 0;
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 30%, var(--surface-2)), var(--surface-2));
  overflow: hidden;
}
.ap-profile__cover img { width: 100%; height: 100%; object-fit: cover; }
.ap-profile__head { display: flex; align-items: center; gap: 14px; margin-top: -56px; position: relative; z-index: 1; flex-wrap: wrap; }
.ap-profile__avatar {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border: 4px solid var(--surface);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), var(--info));
  color: var(--bg);
  font-size: 32px;
  font-weight: 900;
  overflow: hidden;
  flex: 0 0 auto;
}
.ap-profile__avatar img { width: 100%; height: 100%; object-fit: cover; }
.ap-profile__head h3 { margin: 0; font-size: 24px; letter-spacing: -0.03em; }
.ap-profile__stats { display: flex; gap: 10px; margin-left: auto; }
.ap-profile__stats div { display: grid; gap: 1px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); min-width: 92px; }
.ap-profile__stats span { color: var(--muted-2); font-size: 9px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.ap-profile__stats strong { font-size: 18px; }
.ap-profile__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.ap-profile__grid > div { display: grid; gap: 2px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: color-mix(in srgb, var(--bg) 25%, var(--surface)); }
.ap-profile__grid span { color: var(--muted-2); font-size: 9px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.ap-profile__grid strong { font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }

.ap-defs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.ap-defs > div { display: grid; gap: 2px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: color-mix(in srgb, var(--bg) 25%, var(--surface)); }
.ap-defs span { color: var(--muted-2); font-size: 9px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; overflow-wrap: anywhere; }
.ap-defs strong { font-size: 12px; overflow-wrap: anywhere; }
.ap-scope-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ap-scope { padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 10px; font-weight: 700; }
.ap-errors { margin: 6px 0 0; padding-left: 16px; color: var(--warning); font-size: 10px; line-height: 1.5; }
.ap-error { margin: 10px 0 0; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--line)); border-radius: 8px; color: var(--danger); font-size: 11px; }

.ap-empty { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px; }
.ap-empty h2 { margin: 4px 0 6px; font-size: 28px; letter-spacing: -0.03em; }
.ap-note { padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.ap-note p { margin: 0; }

.ap-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  max-width: 260px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 10px));
  transition: opacity 0.12s ease;
}
.ap-tooltip.is-visible { opacity: 1; }

.ap-hint {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ap-page-menu {
  position: relative;
  flex: 0 1 340px;
  min-width: 240px;
}

.ap-page-menu__button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 5px 12px 5px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ap-page-menu__button:hover,
.ap-page-menu__button[aria-expanded="true"] {
  border-color: var(--accent);
}

.ap-page-menu__mark,
.ap-page-menu__avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--info));
  color: var(--bg);
  font-size: 10px;
  font-weight: 900;
  overflow: hidden;
  flex: 0 0 auto;
}

.ap-page-menu__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ap-page-menu__copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.ap-page-menu__copy strong {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-page-menu__copy small {
  color: var(--muted-2);
  font-size: 10px;
}

.ap-page-menu__chevron {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  transition: transform 0.15s ease;
}

.ap-page-menu__button[aria-expanded="true"] .ap-page-menu__chevron {
  transform: rotate(180deg);
}

.ap-page-menu__panel[hidden] {
  display: none;
}

.ap-page-menu__panel {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  width: min(400px, calc(100vw - 32px));
  max-height: 420px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.42);
}

.ap-page-menu__item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}

.ap-page-menu__item:hover {
  background: var(--surface-2);
}

.ap-page-menu__item.is-active {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent) inset;
}

.ap-page-menu__item > span:nth-child(2) {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.ap-page-menu__item strong {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-page-menu__item small {
  color: var(--muted-2);
  font-size: 10px;
}

.ap-page-menu__count {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 800;
}

.ap-kpi__spark-wrap {
  display: grid;
  gap: 2px;
  margin-top: 4px;
}

.ap-kpi__spark-label {
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ap-spark {
  cursor: zoom-in;
}

.ap-spark__dot {
  fill: transparent;
  pointer-events: all;
}

.ap-spark-caption {
  margin: -4px 0 8px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
}

.ap-chart {
  cursor: zoom-in;
}

.ap-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.ap-collapse-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.ap-card[data-collapsed="true"] > :not(.ap-card__head),
.ap-section[data-collapsed="true"] > :not(.ap-section__head),
.ap-weekly[data-collapsed="true"] > :not(.ap-weekly__head) {
  display: none !important;
}

.ap-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.ap-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 14, 0.74);
  backdrop-filter: blur(5px);
}

.ap-modal__dialog {
  position: relative;
  width: min(1240px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.ap-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.ap-modal__head h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.ap-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}

.ap-modal__chart {
  padding: 8px 0 14px;
}

.ap-modal__chart svg {
  width: 100%;
  height: auto;
  max-height: 62vh;
}

.ap-modal__table {
  max-height: 36vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ap-modal__table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ap-modal__table th,
.ap-modal__table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.ap-modal__table th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--muted-2);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

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

@media (max-width: 760px) {
  .ap-hero { flex-direction: column; align-items: flex-start; }
  .ap-hero__score { width: 100%; justify-items: start; }
  .ap-hero__score-note { text-align: left; }
  .ap-kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .ap-toolbar__row { align-items: flex-start; }
  .ap-toolbar__actions { margin-left: 0; width: 100%; }
  .ap-page-menu { flex: 1 1 100%; width: 100%; }
  .ap-page-menu__panel { width: 100%; }
  .ap-hint { display: none; }
  .ap-page-card__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-glance { grid-template-columns: minmax(0, 1fr); }
  .ap-donut { flex-direction: column; align-items: flex-start; }
  .ap-profile__stats { margin-left: 0; width: 100%; }
  .ap-profile__stats div { flex: 1 1 0; min-width: 0; }
  .ap-weekly__grid { grid-template-columns: minmax(0, 1fr); }
  .ap-post { flex-direction: column; }
  .ap-post__thumb { width: 100%; height: 160px; }
}
