:root {
    --bg: #1c1c1e;
    --surface: #2c2c2e;
    --accent: #007AFF;
    --text: #ffffff;
    --text-muted: #8e8e93;
    --success: #34c759;
    --danger: #ff3b30;
    --warning: #ffcc00;
    --border: #38383a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.app-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px 10px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    border-bottom: 1px solid var(--border);
    background: rgba(28, 28, 30, 0.96);
    backdrop-filter: blur(12px);
    flex-shrink: 0;
    z-index: 20;
}
.app-chrome-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.app-chrome-logo {
    font-size: 22px;
    line-height: 1;
}
.app-chrome-titles { min-width: 0; }
.app-chrome-name {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.app-chrome-section {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-chrome-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.app-quota-chip {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.app-user-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    max-width: 120px;
}
.app-user-chip #user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 14px;
}

.home-welcome { margin-bottom: 18px; }
.home-eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.home-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 8px;
}
.home-lead {
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-muted);
}
.home-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.home-action-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}
.home-action-card:active { transform: scale(0.99); }
.home-action-icon { font-size: 24px; line-height: 1; }
.home-action-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.home-action-copy strong { font-size: 15px; }
.home-action-copy span { font-size: 12px; color: var(--text-muted); }
.home-action-arrow { color: var(--accent); font-size: 18px; }
.home-details {
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    overflow: hidden;
}
.home-details-summary {
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.home-details-summary::-webkit-details-marker { display: none; }
.home-details .referral-card {
    border: none;
    border-radius: 0;
    margin: 0;
    padding: 0 16px 16px;
}
.home-section { margin-bottom: 22px; }
.home-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.home-section-head h3 { margin-bottom: 0; }
.home-section-link {
    border: none;
    background: transparent;
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.studio-flow-header { margin-bottom: 14px; }
.studio-step-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent);
    margin-bottom: 4px;
}
.studio-flow-hint {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}
.studio-advanced {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(44, 44, 46, 0.5);
}
.studio-advanced-summary {
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.studio-advanced-summary::-webkit-details-marker { display: none; }
.studio-advanced-body { padding: 0 14px 14px; }

.nav-item-primary .nav-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 18px;
    margin-bottom: 2px;
}
.nav-item-primary.active .nav-icon {
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.35);
}

/* Typography & Utils */
h2 { font-size: 22px; font-weight: 600; margin-bottom: 16px; }
h3 { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.text-muted { color: var(--text-muted); font-size: 14px; }
.text-hint { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.hidden { display: none !important; }

.studio-attach-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.studio-attachment-list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.studio-attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.studio-attachment-label {
    flex: 1;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.studio-attachment-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}
.studio-attachment-remove {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
}

.legal-settings-block {
    margin-top: 20px;
    padding: 14px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
}
.legal-operator-line {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 4px;
}
.legal-operator-line a { color: var(--accent); text-decoration: none; }
.legal-links-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}
.legal-links-row a {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
}

/* Web login (innoko.ru/app) */
.web-auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(8px);
}
.web-auth-overlay.hidden { display: none !important; }
html.vm-telegram-mini-app #web-auth-overlay { display: none !important; }
.web-auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px 24px;
    text-align: center;
}
.web-auth-brand {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.web-auth-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 10px;
}
.web-auth-hint {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 20px;
}
.web-auth-widget {
    min-height: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.web-auth-widget-embed {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.web-auth-widget-embed iframe {
    border: none;
}
.web-auth-login-btn {
    display: block;
    width: 100%;
    max-width: 280px;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}
.web-auth-login-btn-primary {
    background: #2AABEE;
    color: #fff;
}
.web-auth-login-btn-telegram {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.web-auth-tg-icon {
    display: inline-block;
    width: 22px;
    height: 22px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9.78 15.28l-.28 3.92c.4 0 .57-.17.78-.38l1.87-1.78 3.88 2.85c.71.39 1.21.19 1.4-.65l2.55-12c.23-1.05-.38-1.46-1.07-1.2L2.6 9.77c-1.04.4-1.03.97-.19 1.23l4.6 1.44L18.9 6.5c.56-.37 1.08-.17.66.2'/%3E%3C/svg%3E") center/contain no-repeat;
}
.user-name-login {
    color: var(--accent);
    font-weight: 600;
}
.web-auth-login-btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.web-auth-loading {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}
.web-auth-alt {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}
.web-auth-open-link {
    display: block;
    margin-top: 10px;
    word-break: break-all;
    font-size: 12px;
    opacity: 0.85;
    color: var(--accent);
}
.web-auth-alt a {
    color: var(--accent);
}
.web-auth-footnote {
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}


/* Tabs */
.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    display: none;
    -webkit-overflow-scrolling: touch;
}
.tab-content.active { display: block; }

/* Buttons */
.btn {
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    text-align: center;
}
.btn:active { opacity: 0.7; }
.btn-primary { background-color: var(--accent); color: white; }
.btn-secondary { background-color: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-accent { background-color: var(--success); color: white; }
.btn-full { width: 100%; }
.btn-large { padding: 16px 24px; font-size: 18px; width: 100%; border-radius: 16px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; margin-bottom: 16px; }
.half { flex: 1; }
label { display: block; font-size: 14px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
input[type="text"], textarea, select {
    width: 100%;
    background-color: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
}
input[type="text"]:focus, textarea:focus, select:focus {
    border-color: var(--accent);
}

/* Badges & Scores */
.score-badge {
    background: linear-gradient(135deg, #ff9500, #ff2d55);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}
.score-badge.small { padding: 4px 8px; font-size: 12px; }
.score-label { font-size: 12px; opacity: 0.9; }

/* Dashboard Tab */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.user-info { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.avatar { background: var(--surface); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.main-cta-container { margin-bottom: 24px; }
.trending-strip-container { margin-bottom: 24px; }
.trending-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}
.trending-strip::-webkit-scrollbar { display: none; }
.trend-chip {
    background: var(--surface);
    padding: 8px 16px;
    border-radius: 16px;
    white-space: nowrap;
    font-size: 14px;
    border: 1px solid var(--border);
    cursor: pointer;
}
.trend-chip,
.trend-item,
.mode-pill,
.nav-item {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
}
.recent-posts { display: flex; flex-direction: column; gap: 12px; }
.post-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border);
}
.post-card-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; color: var(--text-muted); }
.post-card-content { font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Studio Tab */
.studio-mode-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--surface);
    border-radius: 14px;
    border: 1px solid var(--border);
}
.mode-pill {
    flex: 1;
    border: none;
    border-radius: 10px;
    padding: 10px 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
}
.mode-pill.active {
    background: var(--accent);
    color: #fff;
}
.studio-mode-hint {
    margin-top: -4px;
    margin-bottom: 14px;
}
.studio-generating-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(0, 122, 255, 0.12);
    border: 1px solid var(--accent);
    font-size: 14px;
    line-height: 1.4;
}
.studio-generating-spinner {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 2px solid var(--text-muted);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: studio-spin 0.85s linear infinite;
    flex-shrink: 0;
}
@keyframes studio-spin {
    to { transform: rotate(360deg); }
}
.result-image {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 12px;
    display: block;
    margin-top: 4px;
    background: #000;
}
.action-buttons a.btn {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-area {
    margin-top: 24px;
    background: var(--surface);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--accent);
}

.pro-teaser-card {
    margin: 14px 0 12px;
    padding: 14px 16px;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(255, 215, 0, 0.12) 0%, rgba(0, 122, 255, 0.08) 100%);
    border: 1px solid rgba(255, 215, 0, 0.35);
}

.pro-teaser-card.hidden {
    display: none !important;
}

.pro-teaser-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.pro-teaser-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #000;
    background: linear-gradient(135deg, #ffd700, #ffa500);
}

.pro-teaser-title {
    font-size: 15px;
    color: #fff;
}

.pro-teaser-body {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-muted);
}

.pro-teaser-list {
    margin: 0 0 12px;
    padding-left: 18px;
    font-size: 13px;
    line-height: 1.5;
    color: #e8e8ed;
}

.pro-teaser-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.result-content { font-size: 15px; line-height: 1.5; margin-bottom: 16px; white-space: pre-wrap; }
.action-buttons { display: flex; gap: 8px; }
.action-buttons .btn { flex: 1; padding: 10px; font-size: 14px; }
.quick-refine-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.chip-btn {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
}
.chip-btn:active { opacity: 0.7; }
.status-msg { margin-top: 10px; font-size: 14px; text-align: center; }
.status-msg.error { color: var(--danger); }
.status-msg.success { color: var(--success); }
.status-msg.warning { color: var(--warning); }

.intent-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.intent-pill {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.intent-pill.active {
    background: rgba(0, 122, 255, 0.16);
    color: #fff;
    border-color: var(--accent);
}

/* Trends Tab */
.search-container { margin-bottom: 20px; }
.trends-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trend-item {
    background: var(--surface);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border);
    cursor: pointer;
}
.trend-emoji { font-size: 32px; margin-bottom: 8px; }
.trend-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.trend-score { color: var(--warning); font-size: 12px; font-weight: bold; }

/* Analytics Tab */
.analytics-stats { display: flex; gap: 12px; margin-bottom: 24px; }
.stat-card {
    flex: 1;
    background: var(--surface);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border);
}
.stat-value { font-size: 28px; font-weight: 800; color: var(--accent); margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-muted); }
.chart-container { margin-bottom: 24px; }
.simple-chart {
    height: 150px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding-top: 20px;
    border-bottom: 1px solid var(--border);
}
.chart-bar-wrapper { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart-bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 4px; transition: height 0.3s; }
.chart-label { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* Settings Tab — compact hub (variant D) */
#tab-settings {
    padding-top: 16px;
}

.settings-hero {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
    transition: padding 0.2s ease, margin 0.2s ease;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255, 224, 102, 0.14) 0%, rgba(255, 149, 0, 0.1) 45%, rgba(0, 122, 255, 0.08) 100%);
    border: 1px solid rgba(255, 149, 0, 0.28);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.settings-hero-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.settings-hero-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    overflow: hidden;
}

.settings-hero-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.settings-hero-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-hero-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.settings-hero-quota-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    color: var(--neon-yellow, #ffe066);
    text-shadow: 0 0 16px rgba(255, 224, 102, 0.35);
    transition: font-size 0.2s ease;
}

#tab-settings.settings-panel-open .settings-hero {
    padding: 10px 14px;
    margin-bottom: 10px;
}

#tab-settings.settings-panel-open .settings-hero-quota-value {
    font-size: 26px;
}

.settings-hero-quota-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    white-space: nowrap;
}

.settings-hero-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.settings-hero-plan {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.settings-hero-plan-free {
    background: rgba(0, 0, 0, 0.28);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.settings-hero-plan-paid {
    background: linear-gradient(135deg, #ffd700, #ffa500);
    color: #000;
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.25);
}

.settings-hero-plan-guest {
    background: rgba(255, 149, 0, 0.15);
    color: #ffb340;
    border: 1px solid rgba(255, 149, 0, 0.45);
}

.guest-studio-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 149, 0, 0.1);
    border: 1px solid rgba(255, 149, 0, 0.35);
    font-size: 14px;
    line-height: 1.4;
}

.guest-studio-banner.hidden {
    display: none !important;
}

.guest-studio-banner-urgent {
    background: rgba(255, 59, 48, 0.12);
    border-color: rgba(255, 59, 48, 0.45);
}

.guest-studio-banner-btn {
    appearance: none;
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    cursor: pointer;
}

.btn-referral-guest {
    background: linear-gradient(135deg, #5e5ce6, #007aff) !important;
}

.settings-hero-upgrade {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.35);
}

.settings-hub-grid,
.settings-hub-more {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.settings-hub-more {
    animation: settingsMoreIn 0.22s ease-out;
}

@keyframes settingsMoreIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.settings-hub-tile {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 78px;
    padding: 12px 8px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.settings-hub-tile-sm {
    min-height: 68px;
}

.settings-hub-tile:active {
    transform: scale(0.98);
}

.settings-hub-tile.active,
.settings-hub-tile.is-expanded {
    border-color: rgba(0, 122, 255, 0.55);
    background: rgba(0, 122, 255, 0.12);
}

.settings-hub-icon {
    font-size: 22px;
    line-height: 1;
}

.settings-hub-tile-sm .settings-hub-icon {
    font-size: 20px;
}

.settings-hub-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.settings-hub-tile.active .settings-hub-label,
.settings-hub-tile.is-expanded .settings-hub-label {
    color: var(--accent);
}

.settings-panels {
    display: block;
}

.settings-panel {
    animation: settingsPanelIn 0.2s ease-out;
}

@keyframes settingsPanelIn {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: translateX(0); }
}

.settings-panel-back {
    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
    padding: 8px 0;
    border: none;
    background: none;
    color: var(--accent);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.settings-panel-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 14px;
}

.settings-panel-lead {
    margin: -6px 0 14px;
}

.settings-group {
    margin-bottom: 18px;
}

.settings-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.settings-group input[type="text"],
.settings-group input[type="password"],
.settings-group textarea,
.settings-group select {
    width: 100%;
}

.plan-badge { display: inline-block; padding: 8px 16px; border-radius: 20px; font-weight: 600; font-size: 14px; }
.plan-free { background-color: var(--surface); color: var(--text-muted); border: 1px solid var(--border); }
.plan-pro { background: linear-gradient(135deg, #ffd700, #ffa500); color: #000; box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2); }

.plans-container { margin-top: 8px; }

.faq-section { margin-top: 0; }
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.faq-list-cards {
    gap: 10px;
}

.faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.faq-list-cards .faq-item {
    background: linear-gradient(180deg, #2e2e32 0%, #26262a 100%);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.faq-item[open] {
    border-color: rgba(0, 122, 255, 0.45);
}

.faq-list-cards .faq-item[open] {
    border-color: rgba(255, 149, 0, 0.45);
}

.faq-question {
    list-style: none;
    cursor: pointer;
    padding: 14px 40px 14px 38px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    position: relative;
    user-select: none;
}

.faq-list-cards .faq-question {
    background: linear-gradient(90deg, var(--neon-yellow, #ffe066), var(--neon-orange, #ff9500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.faq-question::before {
    content: '❓';
    position: absolute;
    left: 12px;
    top: 14px;
    font-size: 14px;
    -webkit-text-fill-color: initial;
}

.faq-question::-webkit-details-marker { display: none; }
.faq-question::after {
    content: '+';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    font-weight: 400;
    color: var(--text-muted);
    transition: transform 0.2s;
    -webkit-text-fill-color: var(--text-muted);
}
.faq-item[open] .faq-question::after {
    content: '−';
    color: var(--accent);
    -webkit-text-fill-color: var(--accent);
}
.faq-answer {
    padding: 0 14px 14px 38px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-muted);
    position: relative;
}

.faq-list-cards .faq-answer::before {
    content: '💡';
    position: absolute;
    left: 12px;
    top: 2px;
    font-size: 14px;
}
.faq-answer b {
    color: var(--text);
    font-weight: 600;
}

.contact-section { margin-top: 8px; }
.contact-card {
    background: linear-gradient(180deg, rgba(0, 122, 255, 0.1), rgba(52, 199, 89, 0.06));
    border: 1px solid rgba(0, 122, 255, 0.28);
    border-radius: 12px;
    padding: 14px;
}
.contact-card-text {
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.contact-card-hint { margin-top: 10px; margin-bottom: 0; }

.plan-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
    opacity: 0.6;
}
.plan-card.active { border-color: var(--accent); opacity: 1; }
.plan-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.plan-price { font-weight: bold; color: var(--warning); }
.plan-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
}
.btn-inline {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
}
.stars-help-card {
    background: linear-gradient(180deg, rgba(255, 204, 0, 0.08), rgba(0, 122, 255, 0.08));
    border: 1px solid rgba(255, 204, 0, 0.25);
    border-radius: 14px;
    padding: 16px;
    margin-top: 14px;
}
.stars-help-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}
.stars-help-text {
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 12px;
}
.stars-help-actions {
    display: flex;
    gap: 10px;
}
.stars-help-actions .btn {
    flex: 1;
}

.cleanup-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cleanup-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.cleanup-item-main {
    min-width: 0;
    flex: 1;
}
.cleanup-item-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
    word-break: break-word;
}
.cleanup-item-meta {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
    word-break: break-word;
}
.cleanup-item .btn {
    flex: 0 0 auto;
    min-width: 110px;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 500;
    background-color: var(--bg);
    display: flex;
    justify-content: space-around;
    padding: 10px 0 calc(20px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.5);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    isolation: isolate;
}
.nav-item {
    position: relative;
    z-index: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 10px;
}
.nav-item.active { color: var(--accent); }
.nav-icon { font-size: 20px; }

/* ── Referral System ── */
:root {
    --neon-yellow: #ffe066;
    --neon-orange: #ff9500;
    --neon-pink: #ff2d55;
    --neon-purple: #bf5af2;
    --referral-glow: rgba(255, 149, 0, 0.35);
}

.referral-invite-banner {
    margin: 12px 0 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 149, 0, 0.12);
    border: 1px solid rgba(255, 149, 0, 0.35);
    color: #fff;
    font-size: 14px;
    line-height: 1.45;
}

.referral-card {
    position: relative;
    background: linear-gradient(145deg, #2a2a2e 0%, #1f1f23 100%);
    border: 1px solid rgba(255, 149, 0, 0.25);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 20px;
    overflow: hidden;
}

.referral-card-compact {
    margin-top: 4px;
    border-color: rgba(255, 149, 0, 0.4);
    box-shadow: 0 0 24px rgba(255, 149, 0, 0.08);
}

.referral-card-compact .referral-stats-row,
.referral-card-compact .referral-tiers,
.referral-card-compact .referral-progress-wrap {
    margin-bottom: 12px;
}

.referral-rule-hint {
    font-size: 11px;
    color: rgba(255, 224, 102, 0.85);
    margin-top: 6px;
    line-height: 1.35;
}

.referral-rule-hint-footer {
    margin: 10px 0 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 10px;
}

.referral-card-header .referral-rule-hint {
    margin-top: 4px;
}

.referral-card-glow {
    position: absolute;
    top: -40%;
    right: -20%;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, var(--referral-glow) 0%, transparent 70%);
    pointer-events: none;
}

.referral-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.referral-lightning {
    font-size: 28px;
    filter: drop-shadow(0 0 8px rgba(255, 224, 102, 0.8));
    animation: refPulse 2s ease-in-out infinite;
}

.referral-lightning-lg {
    font-size: 36px;
}

@keyframes refPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.85; }
}

.referral-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
    background: linear-gradient(90deg, var(--neon-yellow), var(--neon-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.referral-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.referral-stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.referral-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.referral-stat-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 8px;
    text-align: center;
}

.referral-stat-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--neon-yellow);
    text-shadow: 0 0 12px rgba(255, 224, 102, 0.4);
    transition: transform 0.2s ease, text-shadow 0.2s ease;
}

.referral-card-compact .referral-stat-value {
    font-size: 24px;
}

.referral-stat-bump {
    animation: refStatBump 0.45s ease-out;
}

@keyframes refStatBump {
    0% { transform: scale(1); text-shadow: 0 0 12px rgba(255, 224, 102, 0.4); }
    45% { transform: scale(1.12); text-shadow: 0 0 18px rgba(255, 224, 102, 0.85); }
    100% { transform: scale(1); text-shadow: 0 0 12px rgba(255, 224, 102, 0.4); }
}

.referral-stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.referral-stat {
    flex: 1;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 10px;
}

/* ── Tier cards (compact + full) ── */
.referral-tiers {
    position: relative;
    z-index: 1;
    margin-bottom: 12px;
}

.referral-tiers-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.referral-tiers-full {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.referral-tier {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease, opacity 0.35s ease, background 0.35s ease;
}

.referral-tier.is-upcoming {
    opacity: 0.55;
    border-style: dashed;
    border-color: rgba(142, 142, 147, 0.35);
}

.referral-tier.is-permanent {
    border-color: rgba(255, 224, 102, 0.45);
    background: linear-gradient(145deg, rgba(255, 149, 0, 0.1), rgba(0, 0, 0, 0.2));
    box-shadow: inset 0 0 0 1px rgba(255, 224, 102, 0.08);
}

.referral-tier.is-next {
    border-color: rgba(255, 45, 85, 0.65);
    box-shadow: 0 0 18px rgba(255, 45, 85, 0.28), inset 0 0 12px rgba(255, 45, 85, 0.06);
    transform: translateY(-2px);
    animation: refNextGlow 2.2s ease-in-out infinite;
}

.referral-tier.is-done {
    border-color: rgba(52, 199, 89, 0.65);
    background: linear-gradient(145deg, rgba(52, 199, 89, 0.14), rgba(0, 0, 0, 0.22));
    box-shadow: 0 0 14px rgba(52, 199, 89, 0.22);
}

.referral-tier.is-done .referral-tier-reward {
    color: #5fe08a;
}

.referral-tier.is-done::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 10px;
    font-weight: 700;
    color: #34c759;
    opacity: 0.9;
}

.referral-tier-compact,
.referral-tier-full {
    position: relative;
}

@keyframes refNextGlow {
    0%, 100% { box-shadow: 0 0 14px rgba(255, 45, 85, 0.2), inset 0 0 10px rgba(255, 45, 85, 0.04); }
    50% { box-shadow: 0 0 22px rgba(255, 45, 85, 0.35), inset 0 0 14px rgba(255, 45, 85, 0.08); }
}

.referral-tier-pop {
    animation: refTierPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.referral-tier-done-flash {
    animation: refTierPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1), refDoneFlash 0.55s ease-out;
}

@keyframes refTierPop {
    0% { transform: scale(1); }
    35% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes refDoneFlash {
    0%, 100% { filter: none; }
    40% { filter: drop-shadow(0 0 10px rgba(52, 199, 89, 0.55)); }
}

.referral-tier-compact {
    padding: 10px 6px;
    text-align: center;
    min-height: 88px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.referral-tier-compact .referral-tier-icon {
    display: block;
    font-size: 20px;
    margin-bottom: 4px;
}

.referral-tier-compact .referral-tier-title {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.2;
    margin-bottom: 4px;
}

.referral-tier-compact .referral-tier-reward {
    display: block;
    font-size: 11px;
    color: var(--text);
    line-height: 1.2;
}

.referral-tier-full {
    padding: 12px 14px;
}

.referral-tier-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.referral-tier-full .referral-tier-icon {
    font-size: 28px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(255, 224, 102, 0.35));
}

.referral-tier-full .referral-tier-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.referral-tier-full .referral-tier-reward {
    display: block;
    font-size: 15px;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px rgba(255, 224, 102, 0.25);
}

.referral-tier-desc {
    margin: 8px 0 0 40px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.45;
}

/* Legacy chips — оставлены на случай старых ссылок */
.referral-rewards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.referral-reward-chip {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 6px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.referral-reward-chip strong {
    display: block;
    color: var(--text);
    font-size: 12px;
    margin-top: 4px;
}

.referral-reward-chip.ref-milestone-done {
    border-color: rgba(255, 149, 0, 0.6);
    box-shadow: 0 0 12px rgba(255, 149, 0, 0.25);
}

.referral-reward-chip.ref-milestone-done strong {
    color: var(--neon-yellow);
}

.referral-progress-wrap {
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.referral-progress-track {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 8px;
    padding: 0 4px;
}

.referral-progress-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 28px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.referral-progress-marker-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.referral-progress-marker-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1;
    transition: color 0.3s ease;
}

.referral-progress-marker.is-reached .referral-progress-marker-dot {
    background: var(--neon-yellow);
    border-color: rgba(255, 224, 102, 0.8);
    box-shadow: 0 0 8px rgba(255, 224, 102, 0.45);
}

.referral-progress-marker.is-reached .referral-progress-marker-label {
    color: var(--neon-yellow);
}

.referral-progress-marker.is-current .referral-progress-marker-dot {
    background: var(--neon-pink);
    border-color: rgba(255, 45, 85, 0.9);
    box-shadow: 0 0 10px rgba(255, 45, 85, 0.55);
    transform: scale(1.15);
}

.referral-progress-marker.is-current .referral-progress-marker-label {
    color: var(--neon-pink);
}

.referral-progress-wrap[data-ref-segment="complete"] .referral-progress-marker.is-reached .referral-progress-marker-dot {
    background: #34c759;
    border-color: rgba(52, 199, 89, 0.9);
    box-shadow: 0 0 8px rgba(52, 199, 89, 0.45);
}

.referral-progress-wrap[data-ref-segment="complete"] .referral-progress-marker.is-reached .referral-progress-marker-label {
    color: #34c759;
}

.referral-progress-bar {
    height: 10px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.06) 0%,
        rgba(255, 255, 255, 0.06) 50%,
        rgba(255, 255, 255, 0.04) 50%,
        rgba(255, 255, 255, 0.04) 100%);
    border-radius: 99px;
    overflow: hidden;
    position: relative;
}

.referral-progress-bar::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 2px;
    bottom: 2px;
    width: 2px;
    margin-left: -1px;
    border-radius: 1px;
    background: rgba(255, 255, 255, 0.14);
    z-index: 0;
}

.referral-progress-fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--neon-orange), var(--neon-pink), var(--neon-purple));
    box-shadow: 0 0 12px rgba(255, 45, 85, 0.45);
    transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 1;
}

.referral-progress-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.45;
}

.referral-progress-label-main {
    color: var(--text);
    font-weight: 600;
}

.referral-progress-label-accent {
    color: var(--neon-orange);
    font-weight: 600;
}

.referral-progress-wrap[data-ref-segment="complete"] .referral-progress-label-main {
    color: #34c759;
}

/* Лента уведомлений о наградах (заготовка под push/toast) */
.referral-activity-feed {
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.referral-feed-banner {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 11px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 149, 0, 0.4);
    background: linear-gradient(135deg, rgba(255, 149, 0, 0.12), rgba(255, 45, 85, 0.06));
    opacity: 0;
    transform: translateY(6px);
}

.referral-feed-banner.referral-feed-enter {
    animation: refFeedEnter 0.4s ease-out forwards;
}

@keyframes refFeedEnter {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.referral-feed-icon {
    font-size: 16px;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 149, 0, 0.15);
    border: 1px solid rgba(255, 149, 0, 0.3);
}

.referral-feed-body {
    min-width: 0;
    flex: 1;
}

.referral-feed-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--neon-yellow);
    margin-bottom: 4px;
}

.referral-feed-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.referral-feed-item {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.btn-referral {
    background: linear-gradient(135deg, var(--neon-orange) 0%, var(--neon-pink) 100%);
    color: #fff;
    box-shadow: 0 4px 20px rgba(255, 45, 85, 0.35);
    position: relative;
    z-index: 1;
}

.btn-referral:active {
    box-shadow: 0 2px 10px rgba(255, 45, 85, 0.25);
}

.ref-neon-text {
    color: var(--neon-yellow);
    font-weight: 700;
}

/* Modal */
.referral-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.referral-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.referral-modal-content {
    position: relative;
    background: linear-gradient(160deg, #2c2c30, #1c1c1e);
    border: 1px solid rgba(255, 149, 0, 0.4);
    border-radius: 20px;
    padding: 28px 22px 22px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: 0 0 40px rgba(255, 149, 0, 0.2);
    animation: refModalIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes refModalIn {
    from { opacity: 0; transform: scale(0.85) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.referral-reward-icon {
    font-size: 52px;
    margin-bottom: 12px;
    animation: refPulse 1.5s ease-in-out infinite;
}

.referral-reward-body {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 12px 0 20px;
}

.ref-confetti-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
}

.ref-confetti-burst.ref-animate {
    animation: refConfetti 0.8s ease-out forwards;
}

@keyframes refConfetti {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.3); box-shadow:
        0 0 0 0 var(--neon-yellow),
        20px -30px 0 2px var(--neon-orange),
        -25px -20px 0 2px var(--neon-pink),
        30px 20px 0 2px var(--neon-purple),
        -20px 30px 0 2px var(--neon-yellow); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(2); box-shadow:
        0 -60px 0 0 transparent,
        40px -80px 0 0 transparent,
        -50px -60px 0 0 transparent,
        60px 40px 0 0 transparent,
        -40px 60px 0 0 transparent; }
}

/* ── Onboarding ── */
.onboarding-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.onboarding-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.onboarding-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: 20px 20px 16px 16px;
    padding: 24px 20px 20px;
    border: 1px solid var(--border);
    animation: refModalIn 0.35s ease-out;
}

.onboarding-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 16px;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
}

.onboarding-dot.active {
    background: var(--accent);
    box-shadow: 0 0 8px rgba(0, 122, 255, 0.5);
}

.onboarding-body {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin: 10px 0 18px;
}

/* ── Referral share chooser (web) ── */
.referral-share-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.referral-share-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.referral-share-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: 20px 20px 16px 16px;
    padding: 24px 20px 16px;
    border: 1px solid var(--border);
    animation: refModalIn 0.35s ease-out;
}

.referral-share-card h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.referral-share-hint {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
    margin: 0 0 16px;
}

.referral-share-card .btn + .btn {
    margin-top: 10px;
}

.referral-share-cancel {
    display: block;
    width: 100%;
    margin-top: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    padding: 8px;
    cursor: pointer;
}

.onboarding-skip {
    display: block;
    width: 100%;
    margin-top: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 8px;
}

/* ── Feature upsell (analytics) ── */
.feature-upsell {
    text-align: center;
    padding: 32px 16px;
    background: linear-gradient(160deg, rgba(0, 122, 255, 0.12), transparent);
    border-radius: 16px;
    border: 1px dashed rgba(0, 122, 255, 0.35);
    margin-bottom: 20px;
}

.feature-upsell-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.feature-upsell h3 {
    margin-bottom: 8px;
}

/* ── Studio tips ── */
.studio-tips-card {
    background: rgba(0, 122, 255, 0.08);
    border: 1px solid rgba(0, 122, 255, 0.2);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.studio-tips-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.studio-tips-list {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.studio-tips-list li {
    margin-bottom: 4px;
}

/* ── Admin subscriptions dashboard ── */
.subs-dashboard {
    margin-top: 14px;
}

.subs-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.subs-stat {
    border-radius: 14px;
    padding: 12px 8px;
    text-align: center;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}

.subs-stats-row-analytics {
    margin-bottom: 6px;
}

.subs-analytics-hint {
    margin: 0 0 12px;
    font-size: 11px;
    line-height: 1.4;
}

.subs-funnel-row {
    margin: 0 0 14px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(10, 132, 255, 0.08);
    border: 1px solid rgba(10, 132, 255, 0.2);
}

.subs-funnel-row.hidden {
    display: none !important;
}

.subs-funnel-title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
}

.subs-funnel-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.subs-funnel-chip {
    min-width: 72px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--surface);
    text-align: center;
}

.subs-funnel-chip-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.subs-funnel-chip-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
}

.subs-stat-total { border-color: rgba(0, 122, 255, 0.35); background: rgba(0, 122, 255, 0.08); }
.subs-stat-mau30 { border-color: rgba(88, 86, 214, 0.35); background: rgba(88, 86, 214, 0.08); }
.subs-stat-mau7 { border-color: rgba(90, 200, 250, 0.35); background: rgba(90, 200, 250, 0.08); }

.subs-stat-active { border-color: rgba(52, 199, 89, 0.35); background: rgba(52, 199, 89, 0.08); }
.subs-stat-expired { border-color: rgba(255, 149, 0, 0.35); background: rgba(255, 149, 0, 0.08); }
.subs-stat-free { border-color: rgba(142, 142, 147, 0.35); background: rgba(142, 142, 147, 0.08); }

.subs-stat-clickable {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.subs-stat-clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.subs-stat-clickable:active {
    transform: translateY(0);
}

.subs-stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
}

.subs-stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.subs-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.subs-tab {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.subs-tab.active {
    color: var(--text);
    border-color: var(--accent);
    background: rgba(0, 122, 255, 0.15);
}

.subs-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.subs-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}

.subs-card-active { border-left: 4px solid var(--success); }
.subs-card-expired { border-left: 4px solid var(--warning); opacity: 0.92; }
.subs-card-free { border-left: 4px solid var(--text-muted); }

.subs-card-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.subs-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007aff, #5856d6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.subs-card-body {
    min-width: 0;
    flex: 1;
}

.subs-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.subs-card-name {
    font-size: 15px;
    font-weight: 700;
    word-break: break-word;
}

.subs-card-id {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
    word-break: break-all;
}

.subs-card-id code {
    font-size: 11px;
}

.subs-card-meta {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.subs-meta-sep {
    margin: 0 4px;
}

.subs-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.subs-badge-pro {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 149, 0, 0.25));
    color: #ffd700;
}

.subs-badge-premium {
    background: rgba(191, 90, 242, 0.2);
    color: #bf5af2;
}

.subs-badge-free {
    background: rgba(142, 142, 147, 0.2);
    color: var(--text-muted);
}

.subs-days-chip {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(52, 199, 89, 0.15);
    color: var(--success);
    font-size: 11px;
    font-weight: 600;
}

.subs-days-chip-muted {
    background: rgba(255, 149, 0, 0.12);
    color: #ff9500;
}

.subs-card .btn {
    flex-shrink: 0;
    min-width: 96px;
}

.subs-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 24px 12px;
    border: 1px dashed var(--border);
    border-radius: 14px;
}
