/* ==========================================================================
   App activity (admin/app-activity)
   ========================================================================== */

.aa-page {
    --aa-ink: #101828;
    --aa-muted: #667085;
    --aa-soft: #98a2b3;
    --aa-line: #eaecf0;
    --aa-bg: #f8fafc;
    --aa-violet: #7c3aed;
    --aa-violet-soft: #f4f0ff;
    --aa-good: #16a34a;
    --aa-bad: #dc2626;
}

/* Toolbar */
.aa-toolbar {
    position: relative;
    z-index: 20;
}

.aa-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    background: #f0fdf4;
    font-size: 12px;
    font-weight: 500;
    color: #15803d;
    white-space: nowrap;
}

.aa-status b {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.aa-status__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    animation: aa-blink 1.6s ease-in-out infinite;
}

.aa-status.is-off {
    background: #fef2f2;
    color: var(--aa-bad);
}

.aa-status.is-off .aa-status__dot {
    background: var(--aa-bad);
    animation: none;
}

@keyframes aa-blink {
    50% { opacity: 0.35; }
}

/* Grid */
.aa-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.aa-span-4 { grid-column: span 4; }
.aa-span-5 { grid-column: span 5; }
.aa-span-7 { grid-column: span 7; }
.aa-span-8 { grid-column: span 8; }
.aa-span-12 { grid-column: span 12; }

@media (max-width: 1180px) {
    .aa-span-4, .aa-span-5, .aa-span-7, .aa-span-8 { grid-column: span 12; }
}

.aa-page .skl-card {
    border-radius: 14px;
    padding: 1rem 1.1rem 1.1rem;
}

.aa-page .skl-card__head {
    margin-bottom: 0.85rem;
}

.aa-page .skl-card__icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: 0.85rem;
}

.aa-page .skl-card__title {
    font-size: 0.92rem;
}

.aa-icon--bad {
    background: #fef2f2 !important;
    color: var(--aa-bad) !important;
}

[data-aa-section].is-loading,
.aa-users.is-loading,
.aa-errors.is-loading,
.aa-drawer__body.is-loading > * {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

/* Live */
.aa-live {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.aa-live__top {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.aa-live__now {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-shrink: 0;
    min-width: 150px;
}

.aa-pulse {
    position: relative;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #22c55e;
}

.aa-pulse::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid #22c55e;
    opacity: 0;
    animation: aa-ring 1.8s ease-out infinite;
}

@keyframes aa-ring {
    0% { transform: scale(0.5); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

.aa-live__value {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--aa-ink);
    font-variant-numeric: tabular-nums;
}

.aa-live__label {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--aa-muted);
}

.aa-live__spark {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 84px;
}

.aa-today {
    padding-top: 0.85rem;
    border-top: 1px solid var(--aa-line);
}

.aa-today__title {
    margin-bottom: 0.55rem;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--aa-soft);
}

.aa-today__grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.aa-today__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--aa-bg);
    min-width: 0;
}

.aa-today__item b {
    font-size: 1.05rem;
    font-weight: 750;
    color: var(--aa-ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aa-today__item span {
    font-size: 11px;
    color: var(--aa-muted);
}

@media (max-width: 640px) {
    .aa-live__top { flex-direction: column; align-items: stretch; }
    .aa-today__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Feed */
.aa-feed {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.aa-feed__list {
    flex: 1;
    max-height: 236px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    scrollbar-width: thin;
}

.aa-feed__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
    border-bottom: 1px solid #f2f4f7;
    border-radius: 6px;
}

.aa-feed__item:last-child {
    border-bottom: 0;
}

.aa-feed__item.is-new {
    animation: aa-flash 2.4s ease-out;
}

@keyframes aa-flash {
    0% { background: #ede9fe; }
    100% { background: transparent; }
}

.aa-feed__icon,
.aa-step__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    font-size: 11px;
    background: #f2f4f7;
    color: var(--aa-muted);
}

.aa-feed__icon i,
.aa-step__icon i {
    display: inline-flex;
    line-height: 1;
}

.tone-blue .aa-feed__icon, .tone-blue .aa-step__icon { background: #e0f2fe; color: #0284c7; }
.tone-violet .aa-feed__icon, .tone-violet .aa-step__icon { background: var(--aa-violet-soft); color: var(--aa-violet); }
.tone-good .aa-feed__icon, .tone-good .aa-step__icon { background: #dcfce7; color: var(--aa-good); }
.tone-amber .aa-feed__icon, .tone-amber .aa-step__icon { background: #fef3c7; color: #d97706; }

.aa-feed__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.aa-feed__who {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 650;
    color: var(--aa-ink);
}

.aa-feed__who button,
.aa-feed__who span {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aa-feed__who button:hover,
button.aa-feed__text:hover {
    color: var(--aa-violet);
}

.aa-feed__who em {
    flex-shrink: 0;
    font-size: 10px;
    font-style: normal;
    font-weight: 600;
    color: var(--aa-soft);
}

.aa-feed__text {
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    font: inherit;
    font-size: 12px;
    color: var(--aa-muted);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

button.aa-feed__text {
    cursor: pointer;
}

.aa-feed__item time {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--aa-soft);
    font-variant-numeric: tabular-nums;
}

.aa-feed__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 2rem 0;
    font-size: 12px;
    color: var(--aa-soft);
}

/* KPIs */
.aa-kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 1280px) {
    .aa-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .aa-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.aa-page .aa-kpi {
    min-height: 0;
    padding: 0.95rem 1.05rem;
    border-radius: 14px;
    gap: 0.35rem;
}

.aa-page .aa-kpi .skl-kpi__value {
    font-size: 1.6rem;
}

.aa-page .aa-kpi .skl-kpi__label {
    font-size: 11px;
}

.aa-kpi__foot {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    font-size: 12px;
    color: var(--aa-muted);
    min-width: 0;
}

.aa-kpi__foot > span:last-child {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aa-delta {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    height: 20px;
    padding: 0 6px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: #f2f4f7;
    color: var(--aa-muted);
}

.aa-delta.is-up { background: #dcfce7; color: #15803d; }
.aa-delta.is-down { background: #fee2e2; color: #b91c1c; }

.skl-kpi--hero .aa-delta { background: rgba(255, 255, 255, 0.18); color: #fff; }
.skl-kpi--hero .aa-delta.is-up { background: rgba(134, 239, 172, 0.28); }
.skl-kpi--hero .aa-delta.is-down { background: rgba(254, 202, 202, 0.3); }

/* Charts */
.aa-chart {
    position: relative;
    width: 100%;
}

.aa-chart--trend { height: 290px; }
.aa-chart--bars { height: 220px; }

/* Funnel */
.aa-funnel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aa-funnel__step {
    position: relative;
}

.aa-funnel__rate {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--aa-soft);
}

.aa-funnel__rate i {
    display: inline-flex;
    line-height: 1;
}

.aa-funnel__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 12px;
    color: var(--aa-muted);
}

.aa-funnel__row b {
    font-size: 14px;
    font-weight: 750;
    color: var(--aa-ink);
    font-variant-numeric: tabular-nums;
}

.aa-funnel__track {
    position: relative;
    height: 22px;
    border-radius: 6px;
    background: #f2f4f7;
    overflow: hidden;
}

.aa-funnel__track i {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 6px;
    background: linear-gradient(90deg, #a78bfa, #7c3aed);
    transition: width 0.4s ease;
}

.aa-funnel__track em {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
    color: var(--aa-muted);
}

/* Heatmap */
.aa-heat-legend {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--aa-soft);
}

.aa-heat-legend span { margin: 0 4px; }
.aa-heat-legend i { width: 12px; height: 12px; border-radius: 3px; }
.aa-heat-legend i:nth-of-type(1) { background: #f2f4f7; }
.aa-heat-legend i:nth-of-type(2) { background: rgba(124, 58, 237, 0.25); }
.aa-heat-legend i:nth-of-type(3) { background: rgba(124, 58, 237, 0.5); }
.aa-heat-legend i:nth-of-type(4) { background: rgba(124, 58, 237, 0.75); }
.aa-heat-legend i:nth-of-type(5) { background: #7c3aed; }

@media (max-width: 640px) {
    .aa-heat-legend { display: none; }
}

.aa-heat {
    overflow-x: auto;
}

.aa-heat__grid {
    display: grid;
    grid-template-columns: 26px repeat(24, minmax(14px, 1fr));
    gap: 3px;
    min-width: 440px;
}

.aa-heat__hour {
    font-size: 10px;
    color: var(--aa-soft);
    text-align: left;
}

.aa-heat__day {
    display: flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--aa-muted);
}

.aa-heat__grid i {
    display: block;
    aspect-ratio: 1.35;
    min-height: 16px;
    border-radius: 4px;
    cursor: default;
}

.aa-heat__grid i.is-zero {
    background: #f2f4f7;
}

/* Donuts */
.aa-donut {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.aa-donut__chart {
    position: relative;
    flex-shrink: 0;
    width: 140px;
    height: 140px;
}

.aa-donut__chart b {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--aa-ink);
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

.aa-legend {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.aa-legend li {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: var(--aa-muted);
}

.aa-legend li i {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    border-radius: 3px;
}

.aa-legend li span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aa-legend li b {
    font-weight: 700;
    color: var(--aa-ink);
    font-variant-numeric: tabular-nums;
}

.aa-legend li em {
    width: 34px;
    font-style: normal;
    font-size: 11px;
    text-align: right;
    color: var(--aa-soft);
}

/* Retention */
.aa-retention {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 4px;
}

.aa-ret__top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--aa-muted);
}

.aa-ret__top b {
    font-size: 15px;
    font-weight: 800;
    color: var(--aa-ink);
    font-variant-numeric: tabular-nums;
}

.aa-ret__track {
    height: 10px;
    border-radius: 999px;
    background: #f2f4f7;
    overflow: hidden;
}

.aa-ret__track i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: #7c3aed;
    transition: width 0.4s ease;
}

/* Top products */
.aa-ptable {
    display: flex;
    flex-direction: column;
}

.aa-ptable__row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 82px 64px 78px 78px;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 6px;
    border: 0;
    border-bottom: 1px solid #f2f4f7;
    border-radius: 0;
    background: none;
    text-align: right;
    font: inherit;
    font-size: 12px;
    color: var(--aa-ink);
    font-variant-numeric: tabular-nums;
}

.aa-ptable__row.is-head {
    padding-top: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--aa-soft);
}

.aa-ptable__row.is-link {
    cursor: pointer;
    transition: background 0.12s ease;
}

.aa-ptable__row.is-link:hover {
    background: var(--aa-bg);
}

.aa-ptable__row > span:nth-child(2) {
    text-align: left;
}

.aa-ptable__rank {
    text-align: left;
    font-weight: 700;
    color: var(--aa-soft);
}

.aa-ptable__name {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.aa-ptable__name b {
    font-weight: 600;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aa-ptable__name i {
    display: block;
    height: 4px;
    border-radius: 999px;
    background: #c4b5fd;
}

.aa-ptable__conv { font-weight: 700; color: var(--aa-muted); }
.aa-ptable__conv.is-good { color: var(--aa-good); }
.aa-ptable__conv.is-zero { color: #d0d5dd; }

@media (max-width: 760px) {
    .aa-ptable__row { grid-template-columns: 20px minmax(0, 1fr) 64px 64px; }
    .aa-ptable__row > span:nth-child(4),
    .aa-ptable__row > span:nth-child(6) { display: none; }
}

/* Bar lists */
.aa-bars {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.aa-bar {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    font: inherit;
}

.aa-bar.is-link {
    cursor: pointer;
}

.aa-bar.is-link:hover .aa-bar__row span {
    color: var(--aa-violet);
}

.aa-bar__row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--aa-ink);
}

.aa-bar__row span {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aa-bar__row b {
    flex-shrink: 0;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.aa-bar__row small {
    font-weight: 500;
    color: var(--aa-soft);
}

.aa-bar__track {
    height: 6px;
    border-radius: 999px;
    background: #f2f4f7;
    overflow: hidden;
}

.aa-bar__track i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: #a78bfa;
}

/* Search chips */
.aa-search {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.aa-search__title {
    display: block;
    margin-bottom: 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--aa-soft);
}

.aa-search__title.is-bad {
    color: var(--aa-bad);
}

.aa-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.aa-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 8px;
    border-radius: 7px;
    background: var(--aa-bg);
    border: 1px solid var(--aa-line);
    font-size: 12px;
    color: var(--aa-ink);
}

.aa-chip em {
    font-style: normal;
    font-size: 11px;
    font-weight: 700;
    color: var(--aa-soft);
}

.aa-chip.is-bad {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.aa-chip.is-bad em {
    color: #f87171;
}

/* Placeholders */
.aa-skeleton {
    height: 140px;
    border-radius: 10px;
    background: linear-gradient(90deg, #f2f4f7 0%, #f9fafb 50%, #f2f4f7 100%);
    background-size: 200% 100%;
    animation: aa-shimmer 1.2s linear infinite;
}

.aa-skeleton--tall {
    height: 320px;
}

@keyframes aa-shimmer {
    to { background-position: -200% 0; }
}

.aa-nodata {
    padding: 1.5rem 0;
    font-size: 12px;
    text-align: center;
    color: var(--aa-soft);
    list-style: none;
}

.aa-muted { color: var(--aa-soft); }
.aa-bad { color: var(--aa-bad); font-weight: 600; }

/* Sections (users / errors) */
.aa-section {
    margin-bottom: 1rem;
}

.aa-section__head {
    flex-wrap: wrap;
}

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

.aa-search-input {
    flex: 0 1 240px;
}

#adm-page .aa-section__tools .cdir-dd .catmgr-tb-dd-btn {
    width: auto;
    max-width: 220px;
    min-width: 96px;
    height: 32px;
    gap: 6px;
    padding: 0 8px 0 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
}

#adm-page .aa-section__tools .cdir-dd.is-open .catmgr-tb-dd-btn,
#adm-page .aa-section__tools .cdir-dd .catmgr-tb-dd-btn.is-active {
    border-color: #c4b5fd;
    background: #faf5ff;
    color: #6d28d9;
}

.aa-section__tools .cdir-dd__panel {
    left: auto !important;
    right: 0;
}

@media (max-width: 760px) {
    .aa-section__tools { width: 100%; }
    .aa-search-input { flex: 1 1 auto; }
}

.aa-users__head,
.aa-errors__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.aa-users__count {
    font-size: 12px;
    color: var(--aa-muted);
}

.aa-users__count b {
    color: var(--aa-ink);
}

/* Tables */
.aa-table {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--aa-line);
    border-radius: 12px;
    overflow: hidden;
}

.aa-row {
    display: grid;
    grid-template-columns: minmax(200px, 2.2fr) minmax(150px, 1.5fr) 70px 56px 96px 90px 110px minmax(110px, 1fr);
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 9px 14px;
    border: 0;
    border-bottom: 1px solid #f2f4f7;
    background: #fff;
    text-align: left;
    font: inherit;
    font-size: 12px;
    color: var(--aa-ink);
    text-decoration: none;
}

.aa-row:last-child {
    border-bottom: 0;
}

.aa-row--head {
    padding-top: 8px;
    padding-bottom: 8px;
    background: var(--aa-bg);
    font-size: 11px;
    font-weight: 600;
    color: var(--aa-soft);
}

.aa-row.is-link {
    cursor: pointer;
    transition: background 0.12s ease;
}

.aa-row.is-link:hover {
    background: #faf8ff;
}

.aa-table--errors .aa-row {
    grid-template-columns: 110px minmax(0, 3fr) minmax(160px, 1.3fr) 110px;
}

.is-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

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

.aa-cell.is-num {
    align-items: flex-end;
}

.aa-cell small {
    font-size: 11px;
    color: var(--aa-soft);
    white-space: nowrap;
}

.aa-who {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.aa-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--tone, #7c3aed) 14%, #fff);
    color: var(--tone, #7c3aed);
    font-size: 13px;
    font-weight: 750;
    object-fit: cover;
}

.aa-avatar.is-guest {
    background: #f2f4f7;
    color: var(--aa-soft);
}

.aa-avatar i {
    display: inline-flex;
    line-height: 1;
}

.aa-avatar--lg {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 18px;
}

.aa-who__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.aa-who__name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 650;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aa-who__sub {
    font-size: 11px;
    color: var(--aa-soft);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aa-tag {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    height: 18px;
    padding: 0 6px;
    border-radius: 5px;
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    white-space: nowrap;
}

.aa-tag--new { background: #dcfce7; color: #15803d; }
.aa-tag--good { background: #dcfce7; color: #15803d; }
.aa-tag--bad { background: #fee2e2; color: #b91c1c; }
.aa-tag--violet { background: var(--aa-violet-soft); color: var(--aa-violet); }
.aa-tag--amber { background: #fef3c7; color: #b45309; }

.aa-device {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.aa-plat {
    flex-shrink: 0;
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    background: #f2f4f7;
    color: var(--aa-muted);
}

.aa-plat--ios { background: var(--aa-violet-soft); color: var(--aa-violet); }
.aa-plat--android { background: #dcfce7; color: #15803d; }

.aa-device__meta {
    font-size: 11px;
    color: var(--aa-muted);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aa-seen {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.aa-seen b {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.aa-seen small {
    font-size: 11px;
    color: var(--aa-soft);
}

.aa-seen.is-online b {
    color: var(--aa-good);
}

.aa-seen.is-online b i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
}

.aa-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 2.25rem 1rem;
    font-size: 13px;
    color: var(--aa-muted);
}

.aa-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #f2f4f7;
    color: var(--aa-soft);
}

.aa-empty__icon.is-good {
    background: #dcfce7;
    color: var(--aa-good);
}

.aa-error__type {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 650;
}

.aa-error__msg {
    font-size: 11px;
    color: var(--aa-muted);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aa-link {
    color: var(--aa-violet);
    font-weight: 600;
    text-decoration: none;
}

.aa-page .adm-pager {
    margin-top: 10px;
}

@media (max-width: 1100px) {
    .aa-row--head { display: none; }

    .aa-row,
    .aa-table--errors .aa-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 12px;
        padding: 12px 14px;
    }

    .aa-row > .aa-who,
    .aa-table--errors .aa-error {
        grid-column: 1 / -1;
    }

    .aa-cell.is-num {
        align-items: flex-start;
        text-align: left;
    }

    .aa-cell[data-label]::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 600;
        color: var(--aa-soft);
    }
}

/* Drawer */
html.aa-lock {
    overflow: hidden;
}

.aa-drawer {
    position: fixed;
    inset: 0;
    z-index: 100000;
}

.aa-drawer[hidden] {
    display: none;
}

.aa-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    animation: aa-fade 0.15s ease;
}

.aa-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    width: min(760px, 100vw);
    background: #fff;
    box-shadow: -12px 0 32px -18px rgba(15, 23, 42, 0.35);
    animation: aa-slide 0.2s ease;
}

@keyframes aa-fade { from { opacity: 0; } }
@keyframes aa-slide { from { transform: translateX(32px); opacity: 0; } }

.aa-drawer__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 52px;
    padding: 0 12px 0 16px;
    border-bottom: 1px solid var(--aa-line, #eaecf0);
}

.aa-drawer__title {
    flex: 1;
    font-size: 13px;
    font-weight: 700;
    color: #101828;
}

.aa-drawer__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    font-size: 16px;
    cursor: pointer;
}

.aa-drawer__btn[hidden] {
    display: none;
}

.aa-drawer__btn:hover {
    background: #f1f5f9;
    color: #101828;
}

.aa-drawer__btn i {
    display: inline-flex;
    line-height: 1;
}

.aa-drawer__body {
    flex: 1;
    min-height: 0;
    padding: 16px 18px 24px;
    overflow-y: auto;
    font-size: 12px;
    color: #101828;
}

.aa-dr {
    --aa-ink: #101828;
    --aa-muted: #667085;
    --aa-soft: #98a2b3;
    --aa-line: #eaecf0;
    --aa-bg: #f8fafc;
    --aa-violet: #7c3aed;
    --aa-violet-soft: #f4f0ff;
    --aa-good: #16a34a;
    --aa-bad: #dc2626;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aa-dr__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aa-dr__img {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    border: 1px solid var(--aa-line);
    object-fit: contain;
    background: #fff;
}

.aa-dr__titles {
    flex: 1;
    min-width: 0;
}

.aa-dr__titles h3 {
    margin: 0 0 2px;
    font-size: 16px;
    font-weight: 750;
    color: var(--aa-ink);
}

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

.aa-dr__device {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px !important;
}

.aa-dr__link {
    flex-shrink: 0;
}

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

.aa-dr__stats > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 11px;
    border-radius: 10px;
    background: var(--aa-bg);
    min-width: 0;
}

.aa-dr__stats b {
    font-size: 15px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aa-dr__stats span {
    font-size: 11px;
    color: var(--aa-muted);
}

.aa-dr__sec h4 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--aa-soft);
}

.aa-dr__sec h4 span {
    padding: 1px 6px;
    border-radius: 5px;
    background: #f2f4f7;
    font-size: 11px;
    color: var(--aa-muted);
}

.aa-dr__cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

@media (max-width: 640px) {
    .aa-dr__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .aa-dr__cols { grid-template-columns: 1fr; }
    .aa-dr__head { flex-wrap: wrap; }
}

/* Drawer: product list */
.aa-plist {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--aa-line);
    border-radius: 12px;
    overflow: hidden;
}

.aa-plist__row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid #f2f4f7;
    background: #fff;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.aa-plist__row:last-child {
    border-bottom: 0;
}

.aa-plist__row:hover {
    background: #faf8ff;
}

.aa-plist__row img,
.aa-plist__ph {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #f2f4f7;
}

.aa-plist__ph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: var(--aa-soft);
}

.aa-plist__main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.aa-plist__main b {
    font-size: 12px;
    font-weight: 600;
    color: var(--aa-ink);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aa-plist__main small {
    font-size: 11px;
    color: var(--aa-soft);
}

.aa-plist__num {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 40px;
}

.aa-plist__num b {
    font-size: 14px;
    font-weight: 750;
    color: var(--aa-ink);
    font-variant-numeric: tabular-nums;
}

.aa-plist__num small {
    font-size: 10px;
    color: var(--aa-soft);
}

/* Drawer: visits timeline */
.aa-visit {
    margin-bottom: 10px;
    border: 1px solid var(--aa-line);
    border-radius: 12px;
    overflow: hidden;
}

.aa-visit__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--aa-bg);
    border-bottom: 1px solid var(--aa-line);
    font-size: 12px;
}

.aa-visit__none,
.aa-visit__more {
    padding: 8px 12px;
    font-size: 12px;
}

.aa-steps {
    position: relative;
    margin: 0;
    padding: 6px 12px 8px;
    list-style: none;
}

.aa-step {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 3px 0;
}

.aa-step time {
    width: 58px;
    flex-shrink: 0;
    font-size: 11px;
    color: var(--aa-soft);
    font-variant-numeric: tabular-nums;
}

.aa-step .aa-step__icon {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    font-size: 10px;
}

.aa-step__text {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    font: inherit;
    font-size: 12px;
    color: var(--aa-ink);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.aa-step__text.is-link {
    cursor: pointer;
    color: var(--aa-violet);
}

.aa-step__text.is-link:hover {
    text-decoration: underline;
}

/* Drawer: viewers table */
.aa-vtable {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--aa-line);
    border-radius: 12px;
    overflow: hidden;
}

.aa-vtable__row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 76px minmax(110px, 1fr) 90px;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid #f2f4f7;
    background: #fff;
    text-align: left;
    font: inherit;
    font-size: 12px;
    color: var(--aa-ink);
    cursor: pointer;
}

.aa-vtable__row:last-child {
    border-bottom: 0;
}

.aa-vtable__row:hover {
    background: #faf8ff;
}

.aa-vtable__row.is-head {
    background: var(--aa-bg);
    font-size: 11px;
    font-weight: 600;
    color: var(--aa-soft);
    cursor: default;
}

.aa-vtable__num {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
    .aa-vtable__row { grid-template-columns: minmax(0, 1fr) 50px; }
    .aa-vtable__row > :nth-child(3),
    .aa-vtable__row > :nth-child(4) { display: none; }
}

/* Dark mode */
html.dark .aa-today__item,
html.dark .aa-dr__stats > div,
html.dark .aa-visit__head,
html.dark .aa-row--head,
html.dark .aa-vtable__row.is-head {
    background: #0f172a;
}

html.dark .aa-row,
html.dark .aa-plist__row,
html.dark .aa-vtable__row,
html.dark .aa-drawer__panel {
    background: #111827;
    color: #e5e7eb;
}

html.dark .aa-table,
html.dark .aa-plist,
html.dark .aa-vtable,
html.dark .aa-visit {
    border-color: #1f2937;
}

html.dark .aa-live__value,
html.dark .aa-today__item b,
html.dark .aa-funnel__row b,
html.dark .aa-ret__top b,
html.dark .aa-legend li b,
html.dark .aa-donut__chart b,
html.dark .aa-drawer__title,
html.dark .aa-dr__titles h3 {
    color: #f9fafb;
}

.aa-drawer .adm-pager {
    margin-top: 10px;
}
