/* =========================================================================
Admin Control Panel — Analytics
   =========================================================================

Extracted from the Leptos `<style>` blocks that used to sit inside these
components. Those blocks only existed in the DOM while their component was
mounted, which made cross-panel styling depend on what happened to be on
screen, and made the same rule easy to declare twice with different values.

Sources:
     - apps/frontend-admin/src/ui/panels/admin/dashboard.rs
     - apps/frontend-admin/src/ui/panels/admin/analytics/dashboard.rs
     - apps/frontend-admin/src/ui/panels/admin/analytics/charts.rs
     - apps/frontend-admin/src/ui/components/charts.rs
     - apps/frontend-admin/src/ui/panels/admin/revenue/mod.rs
     - apps/frontend-admin/src/ui/panels/admin/revenue/dashboard.rs
     - apps/frontend-admin/src/ui/panels/admin/revenue/promotion.rs
     - apps/frontend-admin/src/ui/panels/admin/play_patterns/mod.rs
   ========================================================================= */

/* ---- dashboard.rs ---- */
.admin-dashboard {
    padding: 0;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.admin-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--text-color);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.metric-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: white;
}

.metric-icon.users { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.metric-icon.pro { background: linear-gradient(135deg, #f59e0b, #d97706); }
.metric-icon.active { background: linear-gradient(135deg, #10b981, #059669); }
.metric-icon.decks { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.metric-icon.tags-total { background: linear-gradient(135deg, #06b6d4, #0284c7); }
.metric-icon.tags-pending { background: linear-gradient(135deg, #f59e0b, #d97706); }

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.analytics-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 1rem;
}

.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.analytics-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-color);
}

.range-selector {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem;
    border-radius: 12px;
}

.range-btn {
    padding: 0.5rem 1rem;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.range-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

.range-btn.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 12px rgba(var(--color-accent-rgb), 0.3);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-loading, .error-message {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
}

@media (max-width: 768px) {
    .admin-dashboard {
        gap: 1rem;
    }

    .admin-section-title {
        margin: 0 0 0.5rem 0;
        font-size: 1.1rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .metric-card {
        padding: 1rem;
    }

    .metric-icon {
        width: 36px;
        height: 36px;
        margin-bottom: 0.5rem;
    }

    .metric-icon .icon {
        width: 1.25rem;
        height: 1.25rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }
    
    .analytics-section {
        padding: 0.75rem;
        margin-top: 0;
    }
    
    .analytics-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 1rem;
        gap: 0.5rem;
    }

    .analytics-header h3 {
        font-size: 1.1rem;
    }
    
    .range-selector {
        width: 100%;
        overflow-x: auto;
        padding: 0.25rem;
        scrollbar-width: none;
        border-radius: 8px;
    }
    
    .range-selector::-webkit-scrollbar {
        display: none;
    }
    
    .range-btn {
        flex: 1;
        padding: 0.4rem;
        font-size: 0.75rem;
        border-radius: 6px;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }
}
        

/* ---- dashboard.rs ---- */
.analytics-dashboard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-bottom: 3rem;
}
.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.analytics-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
}
.analytics-header p {
    margin: 0.35rem 0 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
}
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}
.usage-signal-grid,
.footprint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}
.usage-signal,
.footprint-metric {
    border: 1px solid var(--border-primary);
    background: color-mix(in srgb, var(--bg-tertiary) 88%, transparent);
    border-radius: 8px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.usage-signal span,
.footprint-metric span {
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.usage-signal strong,
.footprint-metric strong {
    color: var(--text-primary);
    font-size: 1.35rem;
}
.analytics-grid-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.analytics-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.analytics-section h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: 0.5rem;
}
.loading, .error {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}
.error {
    color: var(--color-danger);
}

@media (max-width: 768px) {
    .analytics-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .analytics-header h2 {
        font-size: 1.25rem;
    }
    .overview-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .analytics-grid-two {
        grid-template-columns: 1fr;
    }
    .metric-card {
        padding: 1rem;
    }
    .metric-value {
        font-size: 1.50rem;
    }
    .metric-icon {
        margin-bottom: 0.5rem;
    }
    .analytics-section {
        padding: 1rem;
    }
}
    

/* ---- charts.rs ---- */
.retention-table-container {
    overflow-x: auto;
}
.retention-table {
    width: 100%;
    border-collapse: spacing;
    border-spacing: 4px;
    font-size: 0.9rem;
}
.retention-table th {
    text-align: left;
    padding: 0.5rem;
    color: var(--text-secondary);
    font-weight: normal;
    border-bottom: 1px solid var(--border-primary);
}
.retention-table td {
    padding: 0.5rem;
}
.cohort-date {
    white-space: nowrap;
    color: var(--text-primary);
}
.cohort-size {
    color: var(--text-secondary);
}
.retention-cell {
    text-align: center;
    border-radius: 4px;
    color: #fff;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

@media (max-width: 768px) {
    .retention-table {
        font-size: 0.75rem;
        border-spacing: 2px;
    }
    .retention-table th, .retention-table td {
        padding: 0.25rem;
    }
    .cohort-date {
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
    
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.activity-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.activity-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}
.activity-name {
    color: var(--text-primary);
    text-transform: capitalize;
}
.activity-count {
    color: var(--text-secondary);
}
.activity-bar-bg {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}
.activity-bar-fill {
    height: 100%;
    background: var(--color-accent);
    border-radius: 3px;
}
    
    .activity-bar-fill.feature {
        background: linear-gradient(90deg, #38bdf8, #60a5fa);
    }

    .format-usage-list { display: flex; flex-direction: column; gap: 0.85rem; }
    .format-row { display: flex; flex-direction: column; gap: 0.35rem; }
    .format-row-top { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.88rem; }
    .format-row-top strong { color: var(--text-primary); }
    .format-row-top span { color: var(--text-secondary); text-align: right; }
    .activity-bar-fill.format { background: linear-gradient(90deg, #a78bfa, #f472b6); }
    @media (max-width: 640px) {
        .format-row-top { flex-direction: column; gap: 0.15rem; }
        .format-row-top span { text-align: left; }
    }

.chart-container {
    width: 100%;
    height: 250px;
    display: flex;
    flex-direction: column;
}
.line-chart {
    flex: 1;
    width: 100%;
}
    

/* ---- charts.rs ---- */
.chart-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}
.chart-container h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.chart-svg-wrapper {
    position: relative;
    width: 100%;
}
.chart-svg {
    width: 100%;
    height: auto;
    display: block;
    /* Belt and braces for the pie legend: the viewBox is sized to fit the
       labels, but one longer than expected would otherwise draw outside
       the widget rather than being cut off at its edge. */
    overflow: hidden;
}
@media (max-width: 600px) {
    .legend-group {
        transform: translate(20, 360) !important;
    }
    .pie-chart {
        transform: translate(60, -40) scale(0.9);
    }
}
        

/* ---- mod.rs ---- */
.revenue-panel {
    display: flex; flex-direction: column; gap: 1.25rem;
    height: 100%; overflow-y: auto;
}

/* ── Subtab strip ─────────────────────────────────────────────────── */
.revenue-subtabs {
    display: flex; gap: 0.4rem; flex-wrap: wrap;
    border-bottom: 1px solid var(--border-primary); padding-bottom: 0.6rem;
}
/* Sizing only — the shared button contract in styles/buttons.css supplies
   the neutral, hover, and selected states. `.revenue-subtab` is registered
   in both its neutral and active lists, so this strip behaves like every
   other segmented control in the product. */
.revenue-subtab {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.9rem; font-weight: 500; cursor: pointer;
}

/* ── Layout ───────────────────────────────────────────────────────── */
.admin-dashboard {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.admin-section-title {
    font-size: 1.5rem; font-weight: 700; margin: 0; color: var(--text-color);
}

.subtitle {
    font-size: 0.875rem; color: var(--text-muted);
    margin-top: -1.5rem; margin-bottom: 0.5rem;
}

/* ── Metric tiles ─────────────────────────────────────────────────── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.metric-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
}

.metric-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1rem; color: white;
}

.metric-icon.mrr { background: linear-gradient(135deg, #f59e0b, #d97706); }
.metric-icon.subscribers { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.metric-icon.arpu { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.metric-icon.sustainability { background: linear-gradient(135deg, #10b981, #059669); }
.metric-icon.referrals { background: linear-gradient(135deg, #ec4899, #db2777); }
.metric-icon.conversion { background: linear-gradient(135deg, #10b981, #059669); }
.metric-icon.cost { background: linear-gradient(135deg, #f59e0b, #d97706); }

.metric-value {
    font-size: 2rem; font-weight: 700;
    color: var(--text-color); margin-bottom: 0.25rem;
}

.metric-label { font-size: 0.875rem; color: var(--text-muted); }

/* ── Sections ─────────────────────────────────────────────────────── */
.analytics-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.analytics-header {
    display: flex; justify-content: space-between;
    align-items: center; gap: 1rem; flex-wrap: wrap;
}

.analytics-header h3 {
    margin: 0; font-size: 1.1rem; color: var(--text-color);
}

/* ── Stat cards ───────────────────────────────────────────────────── */
.stats-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }

.stats-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    flex: 1 1 240px;
}

.stats-card h4 { margin: 0 0 1rem 0; font-size: 1rem; color: var(--text-muted); }

.mini-stat {
    display: flex; justify-content: space-between;
    margin-bottom: 0.5rem; padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    gap: 1rem;
}
.mini-stat:last-child { border-bottom: none; }
.mini-stat .label { color: var(--text-muted); }
.mini-stat .value { font-weight: 600; color: var(--text-color); }

/* ── Tables ───────────────────────────────────────────────────────── */
.table-container { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

.data-table th {
    text-align: left; padding: 1rem; color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); font-weight: 600;
    white-space: nowrap;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    vertical-align: top;
}

.data-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* ── Shared states ────────────────────────────────────────────────── */
.chart-loading, .error-message, .empty-state {
    padding: 3rem; text-align: center; color: var(--text-muted);
}
.error-message { color: var(--danger-color, #f87171); }

@media (max-width: 768px) {
    .metrics-grid { grid-template-columns: 1fr; gap: 1rem; }
    .metric-card { padding: 1rem; }
    .metric-value { font-size: 1.5rem; }
    .analytics-section { padding: 1rem; border-radius: 12px; }
    .stats-row { flex-direction: column; gap: 1rem; }
}

/* ---- dashboard.rs ---- */
.admin-dashboard {
    padding: 0;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.admin-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-color);
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: -1.5rem;
    margin-bottom: 0.5rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.metric-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: white;
}

.metric-icon.mrr { background: linear-gradient(135deg, #f59e0b, #d97706); }
.metric-icon.subscribers { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.metric-icon.arpu { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.metric-icon.sustainability { background: linear-gradient(135deg, #10b981, #059669); }

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.analytics-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.analytics-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.stats-row {
    display: flex;
    gap: 1.5rem;
}

.stats-card {
     background: rgba(255, 255, 255, 0.03);
     border: 1px solid rgba(255, 255, 255, 0.1);
     border-radius: 12px;
     padding: 1rem 1.5rem;
     flex: 1;
}

.stats-card h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: var(--text-muted);
}

.mini-stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mini-stat:last-child {
    border-bottom: none;
}

.mini-stat .label {
    color: var(--text-muted);
}

.mini-stat .value {
    font-weight: 600;
    color: var(--text-color);
}

.table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-color);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
}

.status-badge.paid { background: var(--success-bg-hover); color: var(--success-color); }
.status-badge.pending { background: var(--warning-bg); color: var(--warning-color); }
.status-badge.failed { background: var(--danger-bg-hover); color: var(--danger-color); }

.amount {
    font-family: monospace;
    font-weight: 600;
}

.mono {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chart-loading, .error-message, .empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
}

.error-text {
    color: #f87171;
    text-align: center;
}

@media (max-width: 768px) {
    .admin-dashboard {
        gap: 1rem;
    }
    .admin-section-title {
        font-size: 1.2rem;
    }
    .subtitle {
        margin-top: -0.75rem;
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }
    .metric-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 0.5rem;
    }
    .metric-value {
        font-size: 1.25rem;
    }
    .metric-label {
        font-size: 0.75rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .metric-card {
        padding: 1rem;
    }

    .analytics-section {
        padding: 1rem;
        border-radius: 12px;
    }
    .stats-card {
        padding: 1rem;
    }
    .mini-stat {
        font-size: 0.85rem;
    }
    .data-table {
        font-size: 0.8rem;
    }
    .data-table th, .data-table td {
        padding: 0.75rem 0.5rem;
    }
}
        

/* ---- promotion.rs ---- */
/* ── Intro ────────────────────────────────────────────────────────── */
.promo-intro { flex: 1 1 100%; }
.promo-intro ul {
    margin: 0; padding-left: 1.1rem;
    display: flex; flex-direction: column; gap: 0.5rem;
}
.promo-intro li {
    font-size: 0.85rem; color: var(--text-muted); line-height: 1.55;
}
.promo-intro strong { color: var(--text-color); }

/* ── Small text ───────────────────────────────────────────────────── */
.promo-note {
    font-size: 0.8rem; color: var(--text-muted);
    margin: 0.5rem 0 0; line-height: 1.5;
}
.promo-name { color: var(--text-color); font-weight: 600; }
.promo-sub {
    font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem;
}
.promo-wrap { white-space: normal; min-width: 12rem; max-width: 22rem; }

/* ── Campaign state badges ────────────────────────────────────────── */
.status-badge {
    display: inline-block; padding: 4px 8px; border-radius: 4px;
    font-size: 0.72rem; text-transform: uppercase; font-weight: 600;
    border: 1px solid transparent; white-space: nowrap;
}
.status-badge.promo-live {
    background: rgba(34,197,94,0.12); color: #4ade80;
    border-color: rgba(34,197,94,0.35);
}
.status-badge.promo-scheduled {
    background: rgba(251,191,36,0.12); color: #fcd34d;
    border-color: rgba(251,191,36,0.35);
}
.status-badge.promo-off {
    background: rgba(255,255,255,0.04); color: var(--text-muted);
    border-color: rgba(255,255,255,0.12);
}

/* The conversion tile is the one number this panel exists to move. */
.metric-card.metric-emphasis {
    border-color: rgba(16,185,129,0.45);
    box-shadow: inset 0 0 0 1px rgba(16,185,129,0.12);
}
.metric-hint {
    font-size: 0.72rem; color: var(--text-muted);
    margin-top: 0.35rem; line-height: 1.4;
}

/* ── Buttons ──────────────────────────────────────────────────────── */
/* Sizing and layout only. Colour, border, hover, focus, and disabled
   states all come from the shared button contract in styles/buttons.css,
   which the ACP loads last — `.promo-btn` and `.promo-icon-btn` are
   registered in its neutral list and `.promo-btn-primary` in its primary
   list, so these controls behave exactly like buttons in the main app. */
.promo-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem; font-weight: 500; cursor: pointer;
}

.row-actions { display: flex; gap: 0.4rem; }
.promo-icon-btn {
    width: 30px; height: 30px;
    cursor: pointer; font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center;
}
/* Semantic hovers the shared contract does not name. Its danger rule
   already matches `button.danger`, so only success needs stating. */
.promo-icon-btn.success:hover {
    color: var(--success-color, #4ade80);
    border-color: var(--success-color, #4ade80);
}

/* ── Editor ───────────────────────────────────────────────────────── */
.modal-content.promo-editor {
    max-width: 720px; width: 100%;
    max-height: 88vh; overflow-y: auto;
}
.promo-error {
    background: rgba(248,113,113,0.1);
    border: 1px solid rgba(248,113,113,0.35);
    color: #fca5a5; border-radius: 8px;
    padding: 0.7rem 0.9rem; font-size: 0.85rem; margin-bottom: 0.5rem;
}
.promo-form-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem; margin: 1rem 0 1.25rem;
}
.promo-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.promo-field > span {
    font-size: 0.8rem; color: var(--text-muted); font-weight: 500;
}
.promo-field small {
    font-size: 0.72rem; color: var(--text-muted);
    opacity: 0.85; line-height: 1.45;
}
.promo-field-wide { grid-column: 1 / -1; }
.promo-input {
    padding: 0.5rem 0.7rem; border-radius: 6px;
    background: var(--bg-primary); color: var(--text-primary);
    border: 1px solid var(--border-primary);
    font-size: 0.9rem; font-family: inherit; width: 100%;
}
.promo-input:focus {
    outline: none; border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(var(--color-accent-rgb), 0.18);
}
.promo-toggle {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.9rem; color: var(--text-primary); cursor: pointer;
}

@media (max-width: 640px) {
    .promo-form-grid { grid-template-columns: 1fr; }
    .modal-content.promo-editor { max-height: 92vh; }
}

/* ---- mod.rs ---- */
.play-patterns-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}
.play-patterns-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--input-bg);
}
.play-patterns-stat-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.play-patterns-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    font-variant-numeric: tabular-nums;
}
.play-patterns-stat-value--small { font-size: 1rem; }
.play-patterns-stat-sub { font-size: 0.7rem; color: var(--text-muted); }

.play-patterns-progress { margin-bottom: 16px; }
.play-patterns-progress-track {
    height: 8px;
    border-radius: 4px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.play-patterns-progress-fill {
    height: 100%;
    background: var(--accent-gradient, var(--accent-color));
    transition: width 0.3s ease;
}
.play-patterns-progress-label {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.play-patterns-message {
    margin: 0 0 12px;
    padding: 8px 12px;
    border-left: 3px solid var(--accent-color);
    background: var(--input-bg);
    font-size: 0.85rem;
}

.play-patterns-body {
    display: grid;
    grid-template-columns: minmax(220px, 300px) 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 900px) {
    .play-patterns-body { grid-template-columns: 1fr; }
}

.play-patterns-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 60vh;
    overflow-y: auto;
}
.play-patterns-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-color);
    cursor: pointer;
    text-align: left;
    font-size: 0.85rem;
}
.play-patterns-row:hover { border-color: var(--accent-color); }
.play-patterns-row.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}
.play-patterns-row-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.play-patterns-row-sessions {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
}
.play-patterns-row-badge {
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--success-color, #22c55e);
    color: #06240f;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.play-patterns-detail-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
.play-patterns-detail-header h3 { margin: 0; }
.play-patterns-confidence {
    font-size: 0.75rem;
    color: var(--success-color, #22c55e);
}
.play-patterns-confidence.provisional { color: var(--warning-color); }
.play-patterns-caveat {
    margin: 6px 0 14px;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-muted);
    font-style: italic;
}

.play-patterns-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}
.play-patterns-metric {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
}
.play-patterns-metric-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.play-patterns-metric-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color);
    font-variant-numeric: tabular-nums;
}
.play-patterns-metric-sub { font-size: 0.66rem; color: var(--text-muted); }

.play-patterns-chart { margin-bottom: 20px; }
.play-patterns-chart h4 {
    margin: 0 0 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.play-patterns-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    min-height: 150px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--input-bg);
    overflow-x: auto;
}
.play-patterns-bar-item {
    display: flex;
    flex: 1;
    min-width: 34px;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.play-patterns-bar-item strong {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.play-patterns-bar-plot {
    display: flex;
    align-items: flex-end;
    width: 100%;
    height: 100px;
}
.play-patterns-bar {
    width: 100%;
    border-radius: 3px 3px 0 0;
    background: var(--accent-color);
    transition: height 0.2s ease;
}
.play-patterns-bar.accent { background: var(--success-color, #22c55e); }
.play-patterns-bar-item span {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.play-patterns-empty {
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}
